@@ -21,7 +21,6 @@ pub(super) struct ModulePath {
21
21
pub ( super ) struct ModulePathSuccess {
22
22
pub path : PathBuf ,
23
23
pub directory_ownership : DirectoryOwnership ,
24
- warn : bool ,
25
24
}
26
25
27
26
impl < ' a > Parser < ' a > {
@@ -55,17 +54,10 @@ impl<'a> Parser<'a> {
55
54
if self . eat ( & token:: Semi ) {
56
55
if in_cfg && self . recurse_into_file_modules {
57
56
// This mod is in an external file. Let's go get it!
58
- let ModulePathSuccess { path, directory_ownership, warn } =
57
+ let ModulePathSuccess { path, directory_ownership } =
59
58
self . submod_path ( id, & outer_attrs, id_span) ?;
60
- let ( module, mut attrs) =
59
+ let ( module, attrs) =
61
60
self . eval_src_mod ( path, directory_ownership, id. to_string ( ) , id_span) ?;
62
- // Record that we fetched the mod from an external file.
63
- if warn {
64
- let attr = attr:: mk_attr_outer (
65
- attr:: mk_word_item ( Ident :: with_dummy_span ( sym:: warn_directory_ownership) ) ) ;
66
- attr:: mark_known ( & attr) ;
67
- attrs. push ( attr) ;
68
- }
69
61
Ok ( ( id, ItemKind :: Mod ( module) , Some ( attrs) ) )
70
62
} else {
71
63
let placeholder = ast:: Mod {
@@ -136,17 +128,16 @@ impl<'a> Parser<'a> {
136
128
// `#[path]` included and contains a `mod foo;` declaration.
137
129
// If you encounter this, it's your own darn fault :P
138
130
Some ( _) => DirectoryOwnership :: Owned { relative : None } ,
139
- _ => DirectoryOwnership :: UnownedViaMod ( true ) ,
131
+ _ => DirectoryOwnership :: UnownedViaMod ,
140
132
} ,
141
133
path,
142
- warn : false ,
143
134
} ) ;
144
135
}
145
136
146
137
let relative = match self . directory . ownership {
147
138
DirectoryOwnership :: Owned { relative } => relative,
148
139
DirectoryOwnership :: UnownedViaBlock |
149
- DirectoryOwnership :: UnownedViaMod ( _ ) => None ,
140
+ DirectoryOwnership :: UnownedViaMod => None ,
150
141
} ;
151
142
let paths = Parser :: default_submod_path (
152
143
id, relative, & self . directory . path , self . sess . source_map ( ) ) ;
@@ -167,12 +158,7 @@ impl<'a> Parser<'a> {
167
158
}
168
159
Err ( err)
169
160
}
170
- DirectoryOwnership :: UnownedViaMod ( warn) => {
171
- if warn {
172
- if let Ok ( result) = paths. result {
173
- return Ok ( ModulePathSuccess { warn : true , ..result } ) ;
174
- }
175
- }
161
+ DirectoryOwnership :: UnownedViaMod => {
176
162
let mut err = self . diagnostic ( ) . struct_span_err ( id_sp,
177
163
"cannot declare a new module at this location" ) ;
178
164
if !id_sp. is_dummy ( ) {
@@ -250,14 +236,12 @@ impl<'a> Parser<'a> {
250
236
directory_ownership : DirectoryOwnership :: Owned {
251
237
relative : Some ( id) ,
252
238
} ,
253
- warn : false ,
254
239
} ) ,
255
240
( false , true ) => Ok ( ModulePathSuccess {
256
241
path : secondary_path,
257
242
directory_ownership : DirectoryOwnership :: Owned {
258
243
relative : None ,
259
244
} ,
260
- warn : false ,
261
245
} ) ,
262
246
( false , false ) => Err ( Error :: FileNotFoundForModule {
263
247
mod_name : mod_name. clone ( ) ,
0 commit comments