1
Fork 0

add files loaded through doc(include) into dep-info

This commit is contained in:
QuietMisdreavus 2017-12-19 16:43:32 -06:00
commit 95b87d18c0
4 changed files with 11 additions and 1 deletions

View file

@ -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(),

View 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:

View file

@ -0,0 +1 @@
# Hello, world!

View 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");