From 06fbd599cf55b9e49dc54f5f7f356d19e4c2ffec Mon Sep 17 00:00:00 2001 From: QuietMisdreavus Date: Tue, 19 Dec 2017 15:04:03 -0600 Subject: turn errors with external docs into actual errors --- src/libsyntax/ext/expand.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/libsyntax') diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index edf3d40be94..735588d2949 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -1111,10 +1111,10 @@ impl<'a, 'b> Folder for InvocationCollector<'a, 'b> { match File::open(&filename).and_then(|mut f| f.read_to_end(&mut buf)) { Ok(..) => {} Err(e) => { - self.cx.span_warn(at.span, - &format!("couldn't read {}: {}", - filename.display(), - e)); + self.cx.span_err(at.span, + &format!("couldn't read {}: {}", + filename.display(), + e)); } } @@ -1133,9 +1133,9 @@ impl<'a, 'b> Folder for InvocationCollector<'a, 'b> { attr::mk_list_item("include".into(), include_info)))); } Err(_) => { - self.cx.span_warn(at.span, - &format!("{} wasn't a utf-8 file", - filename.display())); + self.cx.span_err(at.span, + &format!("{} wasn't a utf-8 file", + filename.display())); } } } else { -- cgit 1.4.1-3-g733a5 From 95b87d18c0ba2ce019cab6fb75ab52460e6899e7 Mon Sep 17 00:00:00 2001 From: QuietMisdreavus Date: Tue, 19 Dec 2017 16:43:32 -0600 Subject: add files loaded through doc(include) into dep-info --- src/libsyntax/ext/expand.rs | 4 ++++ src/test/run-make/include_bytes_deps/Makefile | 2 +- src/test/run-make/include_bytes_deps/input.md | 1 + src/test/run-make/include_bytes_deps/main.rs | 5 +++++ 4 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 src/test/run-make/include_bytes_deps/input.md (limited to 'src/libsyntax') 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"); -- cgit 1.4.1-3-g733a5