]> git.lizzy.rs Git - rust.git/commitdiff
add files loaded through doc(include) into dep-info
authorQuietMisdreavus <grey@quietmisdreavus.net>
Tue, 19 Dec 2017 22:43:32 +0000 (16:43 -0600)
committerQuietMisdreavus <grey@quietmisdreavus.net>
Tue, 19 Dec 2017 22:43:32 +0000 (16:43 -0600)
src/libsyntax/ext/expand.rs
src/test/run-make/include_bytes_deps/Makefile
src/test/run-make/include_bytes_deps/input.md [new file with mode: 0644]
src/test/run-make/include_bytes_deps/main.rs

index 735588d29495deba8a99a27d6bf645f0b31d5739..2b648f3d52b341fbf494f36ee56a7c21ff9746e7 100644 (file)
@@ -1120,6 +1120,10 @@ fn fold_attribute(&mut self, at: ast::Attribute) -> Option<ast::Attribute> {
 
                     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(),
index f7b1d21ace281fa3b81b26eb7e612dfb92809aac..1293695b7997776e270e51f0f9e4405f8a57a3ab 100644 (file)
@@ -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 (file)
index 0000000..2a19b74
--- /dev/null
@@ -0,0 +1 @@
+# Hello, world!
index 579b2a452a1124aa922406068582ed5758640755..27ca1a46a500d6613891f0a991917c9dd53e0ae9 100644 (file)
@@ -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");