@@ -240,7 +240,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
240240 return self . report_conflict ( ident, ns, new_binding, old_binding) ;
241241 }
242242
243- let container = match old_binding. parent_module . unwrap ( ) . kind {
243+ let container = match old_binding. parent_module . unwrap ( ) . expect_local ( ) . kind {
244244 // Avoid using TyCtxt::def_kind_descr in the resolver, because it
245245 // indirectly *calls* the resolver, and would cause a query cycle.
246246 ModuleKind :: Def ( kind, def_id, _, _) => kind. descr ( def_id) ,
@@ -1757,15 +1757,15 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
17571757 }
17581758 return ;
17591759 }
1760- if Some ( parent_nearest) == scope. opt_def_id ( ) {
1760+ if Some ( parent_nearest) == scope. kind . opt_def_id ( ) {
17611761 err. subdiagnostic ( MacroDefinedLater { span : unused_ident. span } ) ;
17621762 err. subdiagnostic ( MacroSuggMovePosition { span : ident. span , ident } ) ;
17631763 return ;
17641764 }
17651765 }
17661766
17671767 if ident. name == kw:: Default
1768- && let ModuleKind :: Def ( DefKind :: Enum , def_id, _, _) = parent_scope. module . kind
1768+ && let ModuleKind :: Def ( DefKind :: Enum , def_id, _, _) = parent_scope. module . kind ( )
17691769 {
17701770 let span = self . def_span ( def_id) ;
17711771 let source_map = self . tcx . sess . source_map ( ) ;
@@ -1894,7 +1894,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
18941894 ident. name,
18951895 ) ;
18961896 let sugg_span =
1897- if let ModuleKind :: Def ( DefKind :: Enum , id, _, _) = parent_scope. module . kind {
1897+ if let ModuleKind :: Def ( DefKind :: Enum , id, _, _) = parent_scope. module . kind ( ) {
18981898 let span = self . def_span ( id) ;
18991899 if span. from_expansion ( ) {
19001900 None
@@ -2607,7 +2607,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
26072607 let module = module. to_module ( ) ;
26082608 current_module. is_ancestor_of ( module) && current_module != module
26092609 } )
2610- . flat_map ( |( _, module) | module. kind . name ( ) ) ,
2610+ . map ( |( _, module) | module. name ) ,
26112611 )
26122612 . filter ( |c| !c. to_string ( ) . is_empty ( ) )
26132613 . collect :: < Vec < _ > > ( ) ;
@@ -2631,8 +2631,8 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
26312631 ) -> ( String , String , Option < Suggestion > ) {
26322632 let is_last = failed_segment_idx == path. len ( ) - 1 ;
26332633 let ns = if is_last { opt_ns. unwrap_or ( TypeNS ) } else { TypeNS } ;
2634- let module_res = match module {
2635- Some ( ModuleOrUniformRoot :: Module ( module) ) => module. res ( ) ,
2634+ let module_def_id = match module {
2635+ Some ( ModuleOrUniformRoot :: Module ( module) ) => module. opt_def_id ( ) ,
26362636 _ => None ,
26372637 } ;
26382638 let scope = match & path[ ..failed_segment_idx] {
@@ -2647,7 +2647,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
26472647 } ;
26482648 let message = format ! ( "cannot find `{ident}` in {scope}" ) ;
26492649
2650- if module_res == self . graph_root . res ( ) {
2650+ if module_def_id == Some ( CRATE_DEF_ID . to_def_id ( ) ) {
26512651 let is_mod = |res| matches ! ( res, Res :: Def ( DefKind :: Mod , _) ) ;
26522652 let mut candidates = self . lookup_import_candidates ( ident, TypeNS , parent_scope, is_mod) ;
26532653 candidates
@@ -3145,7 +3145,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
31453145 if !kinds. contains ( MacroKinds :: BANG ) {
31463146 return None ;
31473147 }
3148- let module_name = crate_module. kind . name ( ) . unwrap_or ( kw:: Crate ) ;
3148+ let module_name = crate_module. name ( ) . unwrap_or ( kw:: Crate ) ;
31493149 let import_snippet = match import. kind {
31503150 ImportKind :: Single { source, target, .. } if source != target => {
31513151 format ! ( "{source} as {target}" )
0 commit comments