Rename RealFileName::Named to LocalPath and Devirtualized to Remapped
This commit is contained in:
parent
d66506d353
commit
6720a37042
13 changed files with 82 additions and 132 deletions
|
@ -1072,7 +1072,7 @@ impl<'a> ExtCtxt<'a> {
|
|||
// after macro expansion (that is, they are unhygienic).
|
||||
if !path.is_absolute() {
|
||||
let callsite = span.source_callsite();
|
||||
let mut result = match self.source_map().span_to_unmapped_path(callsite) {
|
||||
let mut result = match self.source_map().span_to_filename(callsite) {
|
||||
FileName::Real(name) => name.into_local_path(),
|
||||
FileName::DocTest(path, _) => path,
|
||||
other => {
|
||||
|
|
|
@ -361,7 +361,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
|
|||
// FIXME: Avoid visiting the crate as a `Mod` item,
|
||||
// make crate a first class expansion target instead.
|
||||
pub fn expand_crate(&mut self, mut krate: ast::Crate) -> ast::Crate {
|
||||
let file_path = match self.cx.source_map().span_to_unmapped_path(krate.span) {
|
||||
let file_path = match self.cx.source_map().span_to_filename(krate.span) {
|
||||
FileName::Real(name) => name.into_local_path(),
|
||||
other => PathBuf::from(other.to_string()),
|
||||
};
|
||||
|
|
|
@ -725,7 +725,7 @@ fn ident_name_compatibility_hack(
|
|||
if let ExpnKind::Macro(_, macro_name) = orig_span.ctxt().outer_expn_data().kind {
|
||||
let source_map = rustc.sess.source_map();
|
||||
let filename = source_map.span_to_filename(orig_span);
|
||||
if let FileName::Real(RealFileName::Named(path)) = filename {
|
||||
if let FileName::Real(RealFileName::LocalPath(path)) = filename {
|
||||
let matches_prefix = |prefix, filename| {
|
||||
// Check for a path that ends with 'prefix*/src/<filename>'
|
||||
let mut iter = path.components().rev();
|
||||
|
@ -788,7 +788,7 @@ fn ident_name_compatibility_hack(
|
|||
if macro_name == sym::tuple_from_req && matches_prefix("actix-web", "extract.rs") {
|
||||
let snippet = source_map.span_to_snippet(orig_span);
|
||||
if snippet.as_deref() == Ok("$T") {
|
||||
if let FileName::Real(RealFileName::Named(macro_path)) =
|
||||
if let FileName::Real(RealFileName::LocalPath(macro_path)) =
|
||||
source_map.span_to_filename(rustc.def_site)
|
||||
{
|
||||
if macro_path.to_string_lossy().contains("pin-project-internal-0.") {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue