diff options
| author | Tim Neumann <timnn@google.com> | 2023-01-06 10:37:53 +0000 |
|---|---|---|
| committer | Tim Neumann <timnn@google.com> | 2023-01-13 20:36:03 +0000 |
| commit | 496edf97c5c150967217f886e14d355c4f9890d0 (patch) | |
| tree | 7ed55d3e694a6654af6f4b6202b9b3e7cd6e333f /compiler | |
| parent | 5ca6f7d2c34953ee360ccf7d3c84c7853ea2df4b (diff) | |
| download | rust-496edf97c5c150967217f886e14d355c4f9890d0.tar.gz rust-496edf97c5c150967217f886e14d355c4f9890d0.zip | |
Update `rental` hack to work with remapped paths.
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_expand/src/base.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/compiler/rustc_expand/src/base.rs b/compiler/rustc_expand/src/base.rs index 00453f78287..ffde8480c02 100644 --- a/compiler/rustc_expand/src/base.rs +++ b/compiler/rustc_expand/src/base.rs @@ -31,11 +31,11 @@ use rustc_span::edition::Edition; use rustc_span::hygiene::{AstPass, ExpnData, ExpnKind, LocalExpnId}; use rustc_span::source_map::SourceMap; use rustc_span::symbol::{kw, sym, Ident, Symbol}; -use rustc_span::{BytePos, FileName, RealFileName, Span, DUMMY_SP}; +use rustc_span::{BytePos, FileName, Span, DUMMY_SP}; use smallvec::{smallvec, SmallVec}; use std::iter; -use std::path::PathBuf; +use std::path::{Path, PathBuf}; use std::rc::Rc; pub(crate) use rustc_span::hygiene::MacroKind; @@ -1423,8 +1423,10 @@ fn pretty_printing_compatibility_hack(item: &Item, sess: &ParseSess) -> bool { if let [variant] = &*enum_def.variants { if variant.ident.name == sym::Input { let filename = sess.source_map().span_to_filename(item.ident.span); - if let FileName::Real(RealFileName::LocalPath(path)) = filename { - if let Some(c) = path + if let FileName::Real(real) = filename { + if let Some(c) = real + .local_path() + .unwrap_or(Path::new("")) .components() .flat_map(|c| c.as_os_str().to_str()) .find(|c| c.starts_with("rental") || c.starts_with("allsorts-rental")) |
