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 @@ -172,7 +172,6 @@ impl<'a> base::Resolver for Resolver<'a> {
172
172
expansion : mark,
173
173
} ;
174
174
expansion. visit_with ( & mut visitor) ;
175
- self . current_module . unresolved_invocations . borrow_mut ( ) . remove ( & mark) ;
176
175
invocation. expansion . set ( visitor. legacy_scope ) ;
177
176
}
178
177
@@ -390,7 +389,7 @@ impl<'a> Resolver<'a> {
390
389
Err ( Determinacy :: Determined )
391
390
} ,
392
391
} ;
393
- self . current_module . macro_resolutions . borrow_mut ( )
392
+ self . current_module . nearest_item_scope ( ) . macro_resolutions . borrow_mut ( )
394
393
. push ( ( path. into_boxed_slice ( ) , span) ) ;
395
394
return def;
396
395
}
@@ -410,7 +409,7 @@ impl<'a> Resolver<'a> {
410
409
}
411
410
} ;
412
411
413
- self . current_module . legacy_macro_resolutions . borrow_mut ( )
412
+ self . current_module . nearest_item_scope ( ) . legacy_macro_resolutions . borrow_mut ( )
414
413
. push ( ( scope, path[ 0 ] , span, kind) ) ;
415
414
416
415
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