Skip to content

Commit 95b87d1

Browse files
add files loaded through doc(include) into dep-info
1 parent 8fc0d47 commit 95b87d1

File tree

4 files changed

+11
-1
lines changed

4 files changed

+11
-1
lines changed

src/libsyntax/ext/expand.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,6 +1120,10 @@ impl<'a, 'b> Folder for InvocationCollector<'a, 'b> {
11201120

11211121
match String::from_utf8(buf) {
11221122
Ok(src) => {
1123+
// Add this input file to the code map to make it available as
1124+
// dependency information
1125+
self.cx.codemap().new_filemap_and_lines(&filename, &src);
1126+
11231127
let include_info = vec![
11241128
dummy_spanned(ast::NestedMetaItemKind::MetaItem(
11251129
attr::mk_name_value_item_str("file".into(),

src/test/run-make/include_bytes_deps/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ifneq ($(shell uname),FreeBSD)
88
ifndef IS_WINDOWS
99
all:
1010
$(RUSTC) --emit dep-info main.rs
11-
$(CGREP) "input.txt" "input.bin" < $(TMPDIR)/main.d
11+
$(CGREP) "input.txt" "input.bin" "input.md" < $(TMPDIR)/main.d
1212
else
1313
all:
1414

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Hello, world!

src/test/run-make/include_bytes_deps/main.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#![feature(external_doc)]
12+
13+
#[doc(include="input.md")]
14+
pub struct SomeStruct;
15+
1116
pub fn main() {
1217
const INPUT_TXT: &'static str = include_str!("input.txt");
1318
const INPUT_BIN: &'static [u8] = include_bytes!("input.bin");

0 commit comments

Comments
 (0)