diff options
| author | bors <bors@rust-lang.org> | 2019-08-16 18:35:17 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-08-16 18:35:17 +0000 |
| commit | bdfd698f37184da42254a03ed466ab1f90e6fb6c (patch) | |
| tree | 43da66e41e36d1b5f1b460ef1e7a1875e506e846 /src/libsyntax | |
| parent | 9a32ad0dd51f8451aa6e39d7e9ea89483cb8fcfa (diff) | |
| parent | 6b0a83862ce7f0fa0bd5d729b3b89b6ad25f8221 (diff) | |
| download | rust-bdfd698f37184da42254a03ed466ab1f90e6fb6c.tar.gz rust-bdfd698f37184da42254a03ed466ab1f90e6fb6c.zip | |
Auto merge of #63640 - Centril:rollup-yeb8o66, r=Centril
Rollup of 10 pull requests Successful merges: - #60492 (Add custom nth_back for Chain) - #61780 (Finalize the error type for `try_reserve`) - #63495 ( Remove redundant `ty` fields from `mir::Constant` and `hair::pattern::PatternRange`.) - #63525 (Make sure that all file loading happens via SourceMap) - #63595 (add sparc64-unknown-openbsd target) - #63604 (Some update for vxWorks) - #63613 (Hygienize use of built-in macros in the standard library) - #63632 (A couple of comment fixes.) - #63634 (ci: properly set the job name in CPU stats) - #63636 (ci: move linkcheck from mingw-2 to mingw-1) Failed merges: r? @ghost
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 13 | ||||
| -rw-r--r-- | src/libsyntax/source_map.rs | 20 |
2 files changed, 25 insertions, 8 deletions
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index e7deadbc9a0..dac402921b9 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -25,7 +25,6 @@ use syntax_pos::{Span, DUMMY_SP, FileName}; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::sync::Lrc; -use std::fs; use std::io::ErrorKind; use std::{iter, mem}; use std::ops::DerefMut; @@ -1241,13 +1240,11 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> { } let filename = self.cx.resolve_path(&*file.as_str(), it.span()); - match fs::read_to_string(&filename) { - Ok(src) => { - let src_interned = Symbol::intern(&src); - - // Add this input file to the code map to make it available as - // dependency information - self.cx.source_map().new_source_file(filename.into(), src); + match self.cx.source_map().load_file(&filename) { + Ok(source_file) => { + let src = source_file.src.as_ref() + .expect("freshly loaded file should have a source"); + let src_interned = Symbol::intern(src.as_str()); let include_info = vec