diff options
| author | Stefan Lankes <stlankes@users.noreply.github.com> | 2019-10-22 19:01:09 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-10-22 19:01:09 +0200 |
| commit | ddcd157d03a067419d7f5b4375cfaff5a474856a (patch) | |
| tree | c0b1bc8b196ff630dc9b7dfcf6f4e869e38b5e6c /src/libsyntax_ext | |
| parent | 8a11c61a7af9ffa6585ee93b266e02fa1d642ba8 (diff) | |
| parent | 57bfb8096295150c06559da10adc5629e445a4ac (diff) | |
| download | rust-ddcd157d03a067419d7f5b4375cfaff5a474856a.tar.gz rust-ddcd157d03a067419d7f5b4375cfaff5a474856a.zip | |
Merge branch 'master' into rusty-hermit
Diffstat (limited to 'src/libsyntax_ext')
| -rw-r--r-- | src/libsyntax_ext/source_util.rs | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/libsyntax_ext/source_util.rs b/src/libsyntax_ext/source_util.rs index 438e199ebdb..f6c58fcdfa1 100644 --- a/src/libsyntax_ext/source_util.rs +++ b/src/libsyntax_ext/source_util.rs @@ -76,7 +76,13 @@ pub fn expand_include<'cx>(cx: &'cx mut ExtCtxt<'_>, sp: Span, tts: TokenStream) None => return DummyResult::any(sp), }; // The file will be added to the code map by the parser - let file = cx.resolve_path(file, sp); + let file = match cx.resolve_path(file, sp) { + Ok(f) => f, + Err(mut err) => { + err.emit(); + return DummyResult::any(sp); + }, + }; let directory_ownership = DirectoryOwnership::Owned { relative: None }; let p = parse::new_sub_parser_from_file(cx.parse_sess(), &file, directory_ownership, None, sp); @@ -122,7 +128,13 @@ pub fn expand_include_str(cx: &mut ExtCtxt<'_>, sp: Span, tts: TokenStream) Some(f) => f, None => return DummyResult::any(sp) }; - let file = cx.resolve_path(file, sp); + let file = match cx.resolve_path(file, sp) { + Ok(f) => f, + Err(mut err) => { + err.emit(); + return DummyResult::any(sp); + }, + }; match cx.source_map().load_binary_file(&file) { Ok(bytes) => match std::str::from_utf8(&bytes) { Ok(src) => { @@ -147,7 +159,13 @@ pub fn expand_include_bytes(cx: &mut ExtCtxt<'_>, sp: Span, tts: TokenStream) Some(f) => f, None => return DummyResult::any(sp) }; - let file = cx.resolve_path(file, sp); + let file = match cx.resolve_path(file, sp) { + Ok(f) => f, + Err(mut err) => { + err.emit(); + return DummyResult::any(sp); + }, + }; match cx.source_map().load_binary_file(&file) { Ok(bytes) => { base::MacEager::expr(cx.expr_lit(sp, ast::LitKind::ByteStr(Lrc::new(bytes)))) |
