File tree 2 files changed +19
-2
lines changed
2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change 19
19
use rustc:: lint;
20
20
use rustc:: session:: Session ;
21
21
use syntax:: ast:: * ;
22
+ use syntax:: attr;
22
23
use syntax:: parse:: token:: { self , keywords} ;
23
24
use syntax:: visit:: { self , Visitor } ;
24
25
use syntax_pos:: Span ;
@@ -168,6 +169,10 @@ impl<'a> Visitor for AstValidator<'a> {
168
169
}
169
170
}
170
171
}
172
+ ItemKind :: Mod ( _) => {
173
+ // Ensure that `path` attributes on modules are recorded as used (c.f. #35584).
174
+ attr:: first_attr_value_str_by_name ( & item. attrs , "path" ) ;
175
+ }
171
176
_ => { }
172
177
}
173
178
Original file line number Diff line number Diff line change 8
8
// option. This file may not be copied, modified, or distributed
9
9
// except according to those terms.
10
10
11
- #[ cfg_attr( all( ) , path = "nonexistent_file.rs" ) ] mod foo;
12
- //~^ ERROR nonexistent_file.rs
11
+ #![ feature( rustc_attrs) ]
12
+ #![ allow( dead_code) ]
13
+ #![ deny( unused_attributes) ] // c.f #35584
14
+
15
+ mod auxiliary {
16
+ #[ cfg_attr( any( ) , path = "nonexistent_file.rs" ) ] pub mod namespaced_enums;
17
+ #[ cfg_attr( all( ) , path = "namespaced_enums.rs" ) ] pub mod nonexistent_file;
18
+ }
19
+
20
+ #[ rustc_error]
21
+ fn main ( ) { //~ ERROR compilation successful
22
+ let _ = auxiliary:: namespaced_enums:: Foo :: A ;
23
+ let _ = auxiliary:: nonexistent_file:: Foo :: A ;
24
+ }
You can’t perform that action at this time.
0 commit comments