about summary refs log tree commit diff
diff options
context:
space:
mode:
authorQuietMisdreavus <grey@quietmisdreavus.net>2017-12-19 16:43:32 -0600
committerQuietMisdreavus <grey@quietmisdreavus.net>2017-12-19 16:43:32 -0600
commit95b87d18c0ba2ce019cab6fb75ab52460e6899e7 (patch)
treeb2d33748374214cc009db49826f8834a5e3d50c4
parent8fc0d47581a42138dba0840bb5abf144c142bdd7 (diff)
downloadrust-95b87d18c0ba2ce019cab6fb75ab52460e6899e7.tar.gz
rust-95b87d18c0ba2ce019cab6fb75ab52460e6899e7.zip
add files loaded through doc(include) into dep-info
-rw-r--r--src/libsyntax/ext/expand.rs4
-rw-r--r--src/test/run-make/include_bytes_deps/Makefile2
-rw-r--r--src/test/run-make/include_bytes_deps/input.md1
-rw-r--r--src/test/run-make/include_bytes_deps/main.rs5
4 files changed, 11 insertions, 1 deletions
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs
index 735588d2949..2b648f3d52b 100644
--- a/src/libsyntax/ext/expand.rs
+++ b/src/libsyntax/ext/expand.rs
@@ -1120,6 +1120,10 @@ impl<'a, 'b> Folder for InvocationCollector<'a, 'b> {
 
                     match String::from_utf8(buf) {
                         Ok(src) => {
+                            // Add this input file to the code map to make it available as
+                            // dependency information
+                            self.cx.codemap().new_filemap_and_lines(&filename, &src);
+
                             let include_info = vec![
                                 dummy_spanned(ast::NestedMetaItemKind::MetaItem(
                                         attr::mk_name_value_item_str("file".into(),
diff --git a/src/test/run-make/include_bytes_deps/Makefile b/src/test/run-make/include_bytes_deps/Makefile
index f7b1d21ace2..1293695b799 100644
--- a/src/test/run-make/include_bytes_deps/Makefile
+++ b/src/test/run-make/include_bytes_deps/Makefile
@@ -8,7 +8,7 @@ ifneq ($(shell uname),FreeBSD)
 ifndef IS_WINDOWS
 all:
 	$(RUSTC) --emit dep-info main.rs
-	$(CGREP) "input.txt" "input.bin" < $(TMPDIR)/main.d
+	$(CGREP) "input.txt" "input.bin" "input.md" < $(TMPDIR)/main.d
 else
 all:
 
diff --git a/src/test/run-make/include_bytes_deps/input.md b/src/test/run-make/include_bytes_deps/input.md
new file mode 100644
index 00000000000..2a19b7405f7
--- /dev/null
+++ b/src/test/run-make/include_bytes_deps/input.md
@@ -0,0 +1 @@
+# Hello, world!
diff --git a/src/test/run-make/include_bytes_deps/main.rs b/src/test/run-make/include_bytes_deps/main.rs
index 579b2a452a1..27ca1a46a50 100644
--- a/src/test/run-make/include_bytes_deps/main.rs
+++ b/src/test/run-make/include_bytes_deps/main.rs
@@ -8,6 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(external_doc)]
+
+#[doc(include="input.md")]
+pub struct SomeStruct;
+
 pub fn main() {
     const INPUT_TXT: &'static str = include_str!("input.txt");
     const INPUT_BIN: &'static [u8] = include_bytes!("input.bin");