@@ -21,7 +21,6 @@ pub(super) struct ModulePath {
2121pub ( super ) struct ModulePathSuccess {
2222 pub path : PathBuf ,
2323 pub directory_ownership : DirectoryOwnership ,
24- warn : bool ,
2524}
2625
2726impl < ' a > Parser < ' a > {
@@ -55,17 +54,10 @@ impl<'a> Parser<'a> {
5554 if self . eat ( & token:: Semi ) {
5655 if in_cfg && self . recurse_into_file_modules {
5756 // 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 } =
5958 self . submod_path ( id, & outer_attrs, id_span) ?;
60- let ( module, mut attrs) =
59+ let ( module, attrs) =
6160 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- }
6961 Ok ( ( id, ItemKind :: Mod ( module) , Some ( attrs) ) )
7062 } else {
7163 let placeholder = ast:: Mod {
@@ -136,17 +128,16 @@ impl<'a> Parser<'a> {
136128 // `#[path]` included and contains a `mod foo;` declaration.
137129 // If you encounter this, it's your own darn fault :P
138130 Some ( _) => DirectoryOwnership :: Owned { relative : None } ,
139- _ => DirectoryOwnership :: UnownedViaMod ( true ) ,
131+ _ => DirectoryOwnership :: UnownedViaMod ,
140132 } ,
141133 path,
142- warn : false ,
143134 } ) ;
144135 }
145136
146137 let relative = match self . directory . ownership {
147138 DirectoryOwnership :: Owned { relative } => relative,
148139 DirectoryOwnership :: UnownedViaBlock |
149- DirectoryOwnership :: UnownedViaMod ( _ ) => None ,
140+ DirectoryOwnership :: UnownedViaMod => None ,
150141 } ;
151142 let paths = Parser :: default_submod_path (
152143 id, relative, & self . directory . path , self . sess . source_map ( ) ) ;
@@ -167,12 +158,7 @@ impl<'a> Parser<'a> {
167158 }
168159 Err ( err)
169160 }
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 => {
176162 let mut err = self . diagnostic ( ) . struct_span_err ( id_sp,
177163 "cannot declare a new module at this location" ) ;
178164 if !id_sp. is_dummy ( ) {
@@ -250,14 +236,12 @@ impl<'a> Parser<'a> {
250236 directory_ownership : DirectoryOwnership :: Owned {
251237 relative : Some ( id) ,
252238 } ,
253- warn : false ,
254239 } ) ,
255240 ( false , true ) => Ok ( ModulePathSuccess {
256241 path : secondary_path,
257242 directory_ownership : DirectoryOwnership :: Owned {
258243 relative : None ,
259244 } ,
260- warn : false ,
261245 } ) ,
262246 ( false , false ) => Err ( Error :: FileNotFoundForModule {
263247 mod_name : mod_name. clone ( ) ,
0 commit comments