File tree 3 files changed +22
-3
lines changed
3 files changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -922,6 +922,10 @@ impl<'a> ModuleData<'a> {
922
922
fn is_local ( & self ) -> bool {
923
923
self . normal_ancestor_id . is_local ( )
924
924
}
925
+
926
+ fn nearest_item_scope ( & ' a self ) -> Module < ' a > {
927
+ if self . is_trait ( ) { self . parent . unwrap ( ) } else { self }
928
+ }
925
929
}
926
930
927
931
impl < ' a > fmt:: Debug for ModuleData < ' a > {
Original file line number Diff line number Diff line change @@ -151,7 +151,6 @@ impl<'a> base::Resolver for Resolver<'a> {
151
151
expansion : mark,
152
152
} ;
153
153
expansion. visit_with ( & mut visitor) ;
154
- self . current_module . unresolved_invocations . borrow_mut ( ) . remove ( & mark) ;
155
154
invocation. expansion . set ( visitor. legacy_scope ) ;
156
155
}
157
156
@@ -351,7 +350,7 @@ impl<'a> Resolver<'a> {
351
350
Err ( Determinacy :: Determined )
352
351
} ,
353
352
} ;
354
- self . current_module . macro_resolutions . borrow_mut ( )
353
+ self . current_module . nearest_item_scope ( ) . macro_resolutions . borrow_mut ( )
355
354
. push ( ( path. into_boxed_slice ( ) , span) ) ;
356
355
return def;
357
356
}
@@ -371,7 +370,7 @@ impl<'a> Resolver<'a> {
371
370
} ,
372
371
} ;
373
372
374
- self . current_module . legacy_macro_resolutions . borrow_mut ( )
373
+ self . current_module . nearest_item_scope ( ) . legacy_macro_resolutions . borrow_mut ( )
375
374
. push ( ( scope, path[ 0 ] , span, kind) ) ;
376
375
377
376
result
Original file line number Diff line number Diff line change
1
+ // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ trait T { m ! ( ) ; } //~ ERROR cannot find macro `m!` in this scope
12
+
13
+ struct S ;
14
+ impl S { m ! ( ) ; } //~ ERROR cannot find macro `m!` in this scope
15
+
16
+ fn main ( ) { }
You can’t perform that action at this time.
0 commit comments