diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 7771bc9b1cb1..640e650207e8 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -1850,6 +1850,8 @@ fn resolve_ident_in_lexical_scope(&mut self, } else { ident.span.modern() } + } else { + ident = ident.modern_and_legacy(); } // Walk backwards up the ribs in scope. @@ -1987,7 +1989,7 @@ fn resolve_crate_root(&mut self, ident: Ident) -> Module<'a> { // When resolving `$crate` from a `macro_rules!` invoked in a `macro`, // we don't want to pretend that the `macro_rules!` definition is in the `macro` // as described in `SyntaxContext::apply_mark`, so we ignore prepended modern marks. - ctxt.marks().into_iter().find(|&mark| mark.transparency() != Transparency::Opaque) + ctxt.marks().into_iter().rev().find(|m| m.transparency() != Transparency::Transparent) } else { ctxt = ctxt.modern(); ctxt.adjust(Mark::root()) @@ -2628,6 +2630,7 @@ fn fresh_binding(&mut self, // must not add it if it's in the bindings map // because that breaks the assumptions later // passes make about or-patterns.) + let ident = ident.modern_and_legacy(); let mut def = Def::Local(pat_id); match bindings.get(&ident).cloned() { Some(id) if id == outer_pat_id => { @@ -3782,7 +3785,8 @@ fn with_resolved_label(&mut self, label: Option