about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-08-03 17:42:17 +0200
committerMazdak Farrokhzad <twingoow@gmail.com>2019-11-06 11:08:23 +0100
commit79b35e90f1cbfa21b6a39354cf7d8e8acfa8b0e1 (patch)
tree18845b20988b8c6e7f22982a404d439742f40a96
parentc0056c04f61a051e26dae2631c59637da815abbb (diff)
downloadrust-79b35e90f1cbfa21b6a39354cf7d8e8acfa8b0e1.tar.gz
rust-79b35e90f1cbfa21b6a39354cf7d8e8acfa8b0e1.zip
legacy_directory_ownership -> error
-rw-r--r--src/doc/rustc/src/lints/listing/deny-by-default.md12
-rw-r--r--src/librustc/lint/builtin.rs12
-rw-r--r--src/librustc_lint/lib.rs2
-rw-r--r--src/librustc_passes/ast_validation.rs5
-rw-r--r--src/libsyntax/parse/mod.rs2
-rw-r--r--src/libsyntax/parse/parser/module.rs26
-rw-r--r--src/libsyntax_expand/expand.rs2
-rw-r--r--src/libsyntax_pos/symbol.rs1
8 files changed, 9 insertions, 53 deletions
diff --git a/src/doc/rustc/src/lints/listing/deny-by-default.md b/src/doc/rustc/src/lints/listing/deny-by-default.md
index 540543f98f3..f175a881fef 100644
--- a/src/doc/rustc/src/lints/listing/deny-by-default.md
+++ b/src/doc/rustc/src/lints/listing/deny-by-default.md
@@ -45,18 +45,6 @@ error: defaults for type parameters are only allowed in `struct`, `enum`, `type`
   = note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887>
 ```
 
-## legacy-directory-ownership
-
-The legacy_directory_ownership warning is issued when
-
-* There is a non-inline module with a `#[path]` attribute (e.g. `#[path = "foo.rs"] mod bar;`),
-* The module's file ("foo.rs" in the above example) is not named "mod.rs", and
-* The module's file contains a non-inline child module without a `#[path]` attribute.
-
-The warning can be fixed by renaming the parent module to "mod.rs" and moving
-it into its own directory if appropriate.
-
-
 ## missing-fragment-specifier
 
 The missing_fragment_specifier warning is issued when an unused pattern in a
diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs
index 4dd45f27aca..9301dac32cd 100644
--- a/src/librustc/lint/builtin.rs
+++ b/src/librustc/lint/builtin.rs
@@ -208,17 +208,6 @@ declare_lint! {
 }
 
 declare_lint! {
-    pub LEGACY_DIRECTORY_OWNERSHIP,
-    Deny,
-    "non-inline, non-`#[path]` modules (e.g., `mod foo;`) were erroneously allowed in some files \
-     not named `mod.rs`",
-     @future_incompatible = FutureIncompatibleInfo {
-         reference: "issue #37872 <https://github.com/rust-lang/rust/issues/37872>",
-         edition: None,
-     };
-}
-
-declare_lint! {
     pub MISSING_FRAGMENT_SPECIFIER,
     Deny,
     "detects missing fragment specifiers in unused `macro_rules!` patterns",
@@ -549,7 +538,6 @@ declare_lint_pass! {
         SAFE_EXTERN_STATICS,
         SAFE_PACKED_BORROWS,
         PATTERNS_IN_FNS_WITHOUT_BODY,
-        LEGACY_DIRECTORY_OWNERSHIP,
         MISSING_FRAGMENT_SPECIFIER,
         PARENTHESIZED_PARAMS_IN_TYPES_AND_MODULES,
         LATE_BOUND_LIFETIME_ARGUMENTS,
diff --git a/src/librustc_lint/lib.rs b/src/librustc_lint/lib.rs
index 4636a3d65b7..1dcd61896c3 100644
--- a/src/librustc_lint/lib.rs
+++ b/src/librustc_lint/lib.rs
@@ -336,6 +336,8 @@ fn register_builtins(store: &mut lint::LintStore, no_interleave_lints: bool) {
         "converted into hard error, see https://github.com/rust-lang/rust/issues/46205");
     store.register_removed("legacy_constructor_visibility",
         "converted into hard error, see https://github.com/rust-lang/rust/issues/39207");
+    store.register_removed("legacy_disrectory_ownership",
+        "converted into hard error, see https://github.com/rust-lang/rust/issues/37872");
 }
 
 fn register_internals(store: &mut lint::LintStore) {
diff --git a/src/librustc_passes/ast_validation.rs b/src/librustc_passes/ast_validation.rs
index e625334040e..e046f6c2a07 100644
--- a/src/librustc_passes/ast_validation.rs
+++ b/src/librustc_passes/ast_validation.rs
@@ -654,11 +654,6 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
             ItemKind::Mod(_) => {
                 // Ensure that `path` attributes on modules are recorded as used (cf. issue #35584).
                 attr::first_attr_value_str_by_name(&item.attrs, sym::path);
-                if attr::contains_name(&item.attrs, sym::warn_directory_ownership) {
-                    let lint = lint::builtin::LEGACY_DIRECTORY_OWNERSHIP;
-                    let msg = "cannot declare a new module at this location";
-                    self.lint_buffer.buffer_lint(lint, item.id, item.span, msg);
-                }
             }
             ItemKind::Union(ref vdata, _) => {
                 if let VariantData::Tuple(..) | VariantData::Unit(..) = vdata {
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs
index 6d8ecdf805b..59f4a4d22d6 100644
--- a/src/libsyntax/parse/mod.rs
+++ b/src/libsyntax/parse/mod.rs
@@ -51,7 +51,7 @@ pub enum DirectoryOwnership {
         relative: Option<ast::Ident>,
     },
     UnownedViaBlock,
-    UnownedViaMod(bool /* legacy warnings? */),
+    UnownedViaMod,
 }
 
 // A bunch of utility functions of the form `parse_<thing>_from_<source>`
diff --git a/src/libsyntax/parse/parser/module.rs b/src/libsyntax/parse/parser/module.rs
index 242a17659a0..958cdae9492 100644
--- a/src/libsyntax/parse/parser/module.rs
+++ b/src/libsyntax/parse/parser/module.rs
@@ -21,7 +21,6 @@ pub(super) struct ModulePath {
 pub(super) struct ModulePathSuccess {
     pub path: PathBuf,
     pub directory_ownership: DirectoryOwnership,
-    warn: bool,
 }
 
 impl<'a> Parser<'a> {
@@ -55,17 +54,10 @@ impl<'a> Parser<'a> {
         if self.eat(&token::Semi) {
             if in_cfg && self.recurse_into_file_modules {
                 // This mod is in an external file. Let's go get it!
-                let ModulePathSuccess { path, directory_ownership, warn } =
+                let ModulePathSuccess { path, directory_ownership } =
                     self.submod_path(id, &outer_attrs, id_span)?;
-                let (module, mut attrs) =
+                let (module, attrs) =
                     self.eval_src_mod(path, directory_ownership, id.to_string(), id_span)?;
-                // Record that we fetched the mod from an external file.
-                if warn {
-                    let attr = attr::mk_attr_outer(
-                        attr::mk_word_item(Ident::with_dummy_span(sym::warn_directory_ownership)));
-                    attr::mark_known(&attr);
-                    attrs.push(attr);
-                }
                 Ok((id, ItemKind::Mod(module), Some(attrs)))
             } else {
                 let placeholder = ast::Mod {
@@ -136,17 +128,16 @@ impl<'a> Parser<'a> {
                     // `#[path]` included and contains a `mod foo;` declaration.
                     // If you encounter this, it's your own darn fault :P
                     Some(_) => DirectoryOwnership::Owned { relative: None },
-                    _ => DirectoryOwnership::UnownedViaMod(true),
+                    _ => DirectoryOwnership::UnownedViaMod,
                 },
                 path,
-                warn: false,
             });
         }
 
         let relative = match self.directory.ownership {
             DirectoryOwnership::Owned { relative } => relative,
             DirectoryOwnership::UnownedViaBlock |
-            DirectoryOwnership::UnownedViaMod(_) => None,
+            DirectoryOwnership::UnownedViaMod => None,
         };
         let paths = Parser::default_submod_path(
                         id, relative, &self.directory.path, self.sess.source_map());
@@ -167,12 +158,7 @@ impl<'a> Parser<'a> {
                 }
                 Err(err)
             }
-            DirectoryOwnership::UnownedViaMod(warn) => {
-                if warn {
-                    if let Ok(result) = paths.result {
-                        return Ok(ModulePathSuccess { warn: true, ..result });
-                    }
-                }
+            DirectoryOwnership::UnownedViaMod => {
                 let mut err = self.diagnostic().struct_span_err(id_sp,
                     "cannot declare a new module at this location");
                 if !id_sp.is_dummy() {
@@ -250,14 +236,12 @@ impl<'a> Parser<'a> {
                 directory_ownership: DirectoryOwnership::Owned {
                     relative: Some(id),
                 },
-                warn: false,
             }),
             (false, true) => Ok(ModulePathSuccess {
                 path: secondary_path,
                 directory_ownership: DirectoryOwnership::Owned {
                     relative: None,
                 },
-                warn: false,
             }),
             (false, false) => Err(Error::FileNotFoundForModule {
                 mod_name: mod_name.clone(),
diff --git a/src/libsyntax_expand/expand.rs b/src/libsyntax_expand/expand.rs
index da70fdbb0f3..8c82e59e528 100644
--- a/src/libsyntax_expand/expand.rs
+++ b/src/libsyntax_expand/expand.rs
@@ -1300,7 +1300,7 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> {
                         Some(_) => DirectoryOwnership::Owned {
                             relative: Some(item.ident),
                         },
-                        None => DirectoryOwnership::UnownedViaMod(false),
+                        None => DirectoryOwnership::UnownedViaMod,
                     };
                     path.pop();
                     module.directory = path;
diff --git a/src/libsyntax_pos/symbol.rs b/src/libsyntax_pos/symbol.rs
index 3f7b3e5b3d8..d834a59b486 100644
--- a/src/libsyntax_pos/symbol.rs
+++ b/src/libsyntax_pos/symbol.rs
@@ -734,7 +734,6 @@ symbols! {
         visible_private_types,
         volatile,
         warn,
-        warn_directory_ownership,
         wasm_import_module,
         wasm_target_feature,
         while_let,