@@ -59,7 +59,7 @@ use rustc_span::{Span, DUMMY_SP};
5959use smallvec:: { smallvec, SmallVec } ;
6060use std:: cell:: { Cell , RefCell } ;
6161use std:: collections:: BTreeSet ;
62- use std:: { cmp, fmt, mem , ptr} ;
62+ use std:: { cmp, fmt, ptr} ;
6363use tracing:: debug;
6464
6565use diagnostics:: { ImportSuggestion , LabelSuggestion , Suggestion } ;
@@ -966,8 +966,6 @@ pub struct Resolver<'a> {
966966 registered_attrs : FxHashSet < Ident > ,
967967 registered_tools : RegisteredTools ,
968968 macro_use_prelude : FxHashMap < Symbol , & ' a NameBinding < ' a > > ,
969- /// FIXME: The only user of this is a doc link resolution hack for rustdoc.
970- all_macro_rules : FxHashMap < Symbol , Res > ,
971969 macro_map : FxHashMap < DefId , Lrc < SyntaxExtension > > ,
972970 dummy_ext_bang : Lrc < SyntaxExtension > ,
973971 dummy_ext_derive : Lrc < SyntaxExtension > ,
@@ -1360,7 +1358,6 @@ impl<'a> Resolver<'a> {
13601358 registered_attrs,
13611359 registered_tools,
13621360 macro_use_prelude : FxHashMap :: default ( ) ,
1363- all_macro_rules : Default :: default ( ) ,
13641361 macro_map : FxHashMap :: default ( ) ,
13651362 dummy_ext_bang : Lrc :: new ( SyntaxExtension :: dummy_bang ( session. edition ( ) ) ) ,
13661363 dummy_ext_derive : Lrc :: new ( SyntaxExtension :: dummy_derive ( session. edition ( ) ) ) ,
@@ -1912,11 +1909,6 @@ impl<'a> Resolver<'a> {
19121909 }
19131910 }
19141911
1915- // For rustdoc.
1916- pub fn take_all_macro_rules ( & mut self ) -> FxHashMap < Symbol , Res > {
1917- mem:: take ( & mut self . all_macro_rules )
1918- }
1919-
19201912 /// For rustdoc.
19211913 /// For local modules returns only reexports, for external modules returns all children.
19221914 pub fn module_children_or_reexports ( & self , def_id : DefId ) -> Vec < ModChild > {
@@ -1928,8 +1920,12 @@ impl<'a> Resolver<'a> {
19281920 }
19291921
19301922 /// For rustdoc.
1931- pub fn macro_rules_scope ( & self , def_id : LocalDefId ) -> MacroRulesScopeRef < ' a > {
1932- * self . macro_rules_scopes . get ( & def_id) . expect ( "not a `macro_rules` item" )
1923+ pub fn macro_rules_scope ( & self , def_id : LocalDefId ) -> ( MacroRulesScopeRef < ' a > , Res ) {
1924+ let scope = * self . macro_rules_scopes . get ( & def_id) . expect ( "not a `macro_rules` item" ) ;
1925+ match scope. get ( ) {
1926+ MacroRulesScope :: Binding ( mb) => ( scope, mb. binding . res ( ) ) ,
1927+ _ => unreachable ! ( ) ,
1928+ }
19331929 }
19341930
19351931 /// Retrieves the span of the given `DefId` if `DefId` is in the local crate.
0 commit comments