@@ -356,13 +356,16 @@ struct UnresolvedImportError {
356356
357357// Reexports of the form `pub use foo as bar;` where `foo` is `extern crate foo;`
358358// are permitted for backward-compatibility under a deprecation lint.
359- fn pub_use_of_private_extern_crate_hack ( import : ImportSummary , decl : Decl < ' _ > ) -> Option < NodeId > {
359+ fn pub_use_of_private_extern_crate_hack (
360+ import : ImportSummary ,
361+ decl : Decl < ' _ > ,
362+ ) -> Option < LocalDefId > {
360363 match ( import. is_single , decl. kind ) {
361364 ( true , DeclKind :: Import { import : decl_import, .. } )
362- if let ImportKind :: ExternCrate { id , .. } = decl_import. kind
365+ if let ImportKind :: ExternCrate { def_id , .. } = decl_import. kind
363366 && import. vis . is_public ( ) =>
364367 {
365- Some ( id )
368+ Some ( def_id )
366369 }
367370 _ => None ,
368371 }
@@ -1282,7 +1285,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
12821285
12831286 let ( ident, target, bindings, import_id) = match import. kind {
12841287 ImportKind :: Single { source, target, ref decls, id, .. } => ( source, target, decls, id) ,
1285- ImportKind :: Glob { ref max_vis, id, def_id : _ } => {
1288+ ImportKind :: Glob { ref max_vis, id, def_id } => {
12861289 if import. module_path . len ( ) <= 1 {
12871290 // HACK(eddyb) `lint_if_path_starts_with_module` needs at least
12881291 // 2 segments, so the `resolve_path` above won't trigger it.
@@ -1309,7 +1312,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
13091312 if let Some ( max_vis) = max_vis. get ( )
13101313 && import. vis . greater_than ( max_vis, self . tcx )
13111314 {
1312- let def_id = self . local_def_id ( id) ;
13131315 self . lint_buffer . buffer_lint (
13141316 UNUSED_IMPORTS ,
13151317 id,
@@ -1629,7 +1631,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
16291631 if let Some ( extern_crate_id) = pub_use_of_private_extern_crate_hack ( import. summary ( ) , decl)
16301632 {
16311633 let ImportKind :: Single { id, .. } = import. kind else { unreachable ! ( ) } ;
1632- let sugg = self . tcx . source_span ( self . local_def_id ( extern_crate_id) ) . shrink_to_lo ( ) ;
1634+ let sugg = self . tcx . source_span ( extern_crate_id) . shrink_to_lo ( ) ;
16331635 let diagnostic = crate :: errors:: PrivateExternCrateReexport { ident, sugg } ;
16341636 return Some ( BufferedEarlyLint {
16351637 lint_id : LintId :: of ( PUB_USE_OF_PRIVATE_EXTERN_CRATE ) ,
@@ -1671,7 +1673,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
16711673
16721674 pub ( crate ) fn check_for_redundant_imports ( & mut self , import : Import < ' ra > ) -> bool {
16731675 // This function is only called for single imports.
1674- let ImportKind :: Single { source, target, ref decls, id, .. } = import. kind else {
1676+ let ImportKind :: Single { source, target, ref decls, id, def_id , .. } = import. kind else {
16751677 unreachable ! ( )
16761678 } ;
16771679
@@ -1690,7 +1692,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
16901692 // Skip if the import is public or was used through non scope-based resolution,
16911693 // e.g. through a module-relative path.
16921694 if self . import_use_map . get ( & import) == Some ( & Used :: Other )
1693- || self . effective_visibilities . is_exported ( self . local_def_id ( id ) )
1695+ || self . effective_visibilities . is_exported ( def_id )
16941696 {
16951697 return false ;
16961698 }
0 commit comments