@@ -346,13 +346,16 @@ struct UnresolvedImportError {
346346
347347// Reexports of the form `pub use foo as bar;` where `foo` is `extern crate foo;`
348348// are permitted for backward-compatibility under a deprecation lint.
349- fn pub_use_of_private_extern_crate_hack ( import : ImportSummary , decl : Decl < ' _ > ) -> Option < NodeId > {
349+ fn pub_use_of_private_extern_crate_hack (
350+ import : ImportSummary ,
351+ decl : Decl < ' _ > ,
352+ ) -> Option < LocalDefId > {
350353 match ( import. is_single , decl. kind ) {
351354 ( true , DeclKind :: Import { import : decl_import, .. } )
352- if let ImportKind :: ExternCrate { id , .. } = decl_import. kind
355+ if let ImportKind :: ExternCrate { def_id , .. } = decl_import. kind
353356 && import. vis . is_public ( ) =>
354357 {
355- Some ( id )
358+ Some ( def_id )
356359 }
357360 _ => None ,
358361 }
@@ -1240,7 +1243,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
12401243
12411244 let ( ident, target, bindings, import_id) = match import. kind {
12421245 ImportKind :: Single { source, target, ref decls, id, .. } => ( source, target, decls, id) ,
1243- ImportKind :: Glob { ref max_vis, id, def_id : _ } => {
1246+ ImportKind :: Glob { ref max_vis, id, def_id } => {
12441247 if import. module_path . len ( ) <= 1 {
12451248 // HACK(eddyb) `lint_if_path_starts_with_module` needs at least
12461249 // 2 segments, so the `resolve_path` above won't trigger it.
@@ -1267,7 +1270,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
12671270 if let Some ( max_vis) = max_vis. get ( )
12681271 && import. vis . greater_than ( max_vis, self . tcx )
12691272 {
1270- let def_id = self . local_def_id ( id) ;
12711273 self . lint_buffer . buffer_lint (
12721274 UNUSED_IMPORTS ,
12731275 id,
@@ -1549,7 +1551,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
15491551 if let Some ( extern_crate_id) =
15501552 pub_use_of_private_extern_crate_hack ( import. summary ( ) , binding)
15511553 {
1552- let extern_crate_sp = self . tcx . source_span ( self . local_def_id ( extern_crate_id) ) ;
1554+ let extern_crate_sp = self . tcx . source_span ( extern_crate_id) ;
15531555 self . lint_buffer . buffer_lint (
15541556 PUB_USE_OF_PRIVATE_EXTERN_CRATE ,
15551557 import_id,
@@ -1625,7 +1627,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
16251627
16261628 pub ( crate ) fn check_for_redundant_imports ( & mut self , import : Import < ' ra > ) -> bool {
16271629 // This function is only called for single imports.
1628- let ImportKind :: Single { source, target, ref decls, id, .. } = import. kind else {
1630+ let ImportKind :: Single { source, target, ref decls, id, def_id , .. } = import. kind else {
16291631 unreachable ! ( )
16301632 } ;
16311633
@@ -1644,7 +1646,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
16441646 // Skip if the import is public or was used through non scope-based resolution,
16451647 // e.g. through a module-relative path.
16461648 if self . import_use_map . get ( & import) == Some ( & Used :: Other )
1647- || self . effective_visibilities . is_exported ( self . local_def_id ( id ) )
1649+ || self . effective_visibilities . is_exported ( def_id )
16481650 {
16491651 return false ;
16501652 }
0 commit comments