@@ -5,7 +5,8 @@ use std::ops::ControlFlow;
55use itertools:: Itertools as _;
66use rustc_ast:: visit:: { self , Visitor } ;
77use rustc_ast:: {
8- self as ast, CRATE_NODE_ID , Crate , ItemKind , ModKind , NodeId , Path , join_path_idents,
8+ self as ast, CRATE_NODE_ID , Crate , DUMMY_NODE_ID , ItemKind , ModKind , NodeId , Path ,
9+ join_path_idents,
910} ;
1011use rustc_ast_pretty:: pprust;
1112use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
@@ -192,11 +193,11 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
192193 }
193194
194195 fn report_with_use_injections ( & mut self , krate : & Crate ) {
195- for UseError { mut err, candidates, def_id , instead, suggestion, path, is_call } in
196+ for UseError { mut err, candidates, node_id , instead, suggestion, path, is_call } in
196197 mem:: take ( & mut self . use_injections )
197198 {
198- let ( span, found_use) = if let Some ( def_id ) = def_id . as_local ( ) {
199- UsePlacementFinder :: check ( krate, self . def_id_to_node_id ( def_id ) )
199+ let ( span, found_use) = if node_id != DUMMY_NODE_ID {
200+ UsePlacementFinder :: check ( krate, node_id )
200201 } else {
201202 ( None , FoundUse :: No )
202203 } ;
@@ -1705,9 +1706,9 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
17051706
17061707 let import_suggestions =
17071708 self . lookup_import_candidates ( ident, Namespace :: MacroNS , parent_scope, is_expected) ;
1708- let ( span, found_use) = match parent_scope. module . nearest_parent_mod ( ) . as_local ( ) {
1709- Some ( def_id ) => UsePlacementFinder :: check ( krate , self . def_id_to_node_id ( def_id ) ) ,
1710- None => ( None , FoundUse :: No ) ,
1709+ let ( span, found_use) = match parent_scope. module . nearest_parent_mod_node_id ( ) {
1710+ DUMMY_NODE_ID => ( None , FoundUse :: No ) ,
1711+ node_id => UsePlacementFinder :: check ( krate , node_id ) ,
17111712 } ;
17121713 show_candidates (
17131714 self . tcx ,
0 commit comments