File tree 2 files changed +14
-3
lines changed 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -845,6 +845,10 @@ impl<'a> ModuleS<'a> {
845
845
_ => false ,
846
846
}
847
847
}
848
+
849
+ fn is_local ( & self ) -> bool {
850
+ self . normal_ancestor_id . is_some ( )
851
+ }
848
852
}
849
853
850
854
impl < ' a > fmt:: Debug for ModuleS < ' a > {
@@ -1585,8 +1589,7 @@ impl<'a> Resolver<'a> {
1585
1589
ctxt = ctxt. source ( ) . 0 ;
1586
1590
}
1587
1591
let module = self . invocations [ & ctxt. source ( ) . 1 ] . module . get ( ) ;
1588
- let crate_root =
1589
- if module. def_id ( ) . unwrap ( ) . is_local ( ) { self . graph_root } else { module } ;
1592
+ let crate_root = if module. is_local ( ) { self . graph_root } else { module } ;
1590
1593
return Success ( PrefixFound ( crate_root, 1 ) )
1591
1594
}
1592
1595
@@ -2569,7 +2572,8 @@ impl<'a> Resolver<'a> {
2569
2572
let unqualified_def = resolve_identifier_with_fallback ( self , None ) ;
2570
2573
let qualified_binding = self . resolve_module_relative_path ( span, segments, namespace) ;
2571
2574
match ( qualified_binding, unqualified_def) {
2572
- ( Ok ( binding) , Some ( ref ud) ) if binding. def ( ) == ud. def => {
2575
+ ( Ok ( binding) , Some ( ref ud) ) if binding. def ( ) == ud. def &&
2576
+ segments[ 0 ] . identifier . name . as_str ( ) != "$crate" => {
2573
2577
self . session
2574
2578
. add_lint ( lint:: builtin:: UNUSED_QUALIFICATIONS ,
2575
2579
id,
Original file line number Diff line number Diff line change @@ -18,4 +18,11 @@ fn main() {
18
18
use foo:: bar;
19
19
foo:: bar ( ) ; //~ ERROR: unnecessary qualification
20
20
bar ( ) ;
21
+
22
+ let _ = || -> Result < ( ) , ( ) > { try!( Ok ( ( ) ) ) ; Ok ( ( ) ) } ; // issue #37345
23
+
24
+ macro_rules! m {
25
+ ( ) => { $crate:: foo:: bar( ) ; }
26
+ }
27
+ m ! ( ) ; // issue #37357
21
28
}
You can’t perform that action at this time.
0 commit comments