From a6cb1e64438f7a933b46b875551a85eac1327ea9 Mon Sep 17 00:00:00 2001
From: Eric Huss <eric@huss.org>
Date: Mon, 15 Oct 2018 18:43:57 -0700
Subject: [PATCH] Fix mod from inline mod in non-mod-rs.

This works under the assumption that filesystem paths should match mod paths.

When a mod is loaded from within an inline mod, it was using the wrong path when
inside a non-mod-rs file. It was not including the path components from the
non-mod-rs file.

This change also includes:
- Added a test to the run-pass test.
- Added a test to verify the error message when missing.
- Remove unused `non_modrs_mods` for feature gate diagnostics.
- Fixes the run-pass test, it was accidentally removed during stabilization.
- Remove the vestiges of the feature gate tests in `test/ui`.
- Enable the diagnostic test on windows, there didn't seem to be a reason to
  disable it.
---
 src/libsyntax/parse/lexer/mod.rs                  |  1 -
 src/libsyntax/parse/mod.rs                        |  4 ----
 src/libsyntax/parse/parser.rs                     | 15 +++++----------
 src/test/run-pass/non_modrs_mods/foors_mod.rs     |  5 +++++
 .../block/block_inner/block_inner_inner.rs        |  1 +
 .../run-pass/non_modrs_mods/non_modrs_mods.rs     | 15 +++++++++++++++
 src/test/ui/missing_non_modrs_mod/foo_inline.rs   |  5 +++++
 .../missing_non_modrs_mod.rs                      |  2 --
 .../missing_non_modrs_mod_inline.rs               |  2 ++
 .../missing_non_modrs_mod_inline.stderr           | 11 +++++++++++
 src/test/ui/non_modrs_mods/foors_mod.rs           | 14 --------------
 .../foors_mod/compiletest-ignore-dir              |  0
 .../non_modrs_mods/foors_mod/inner_foors_mod.rs   | 11 -----------
 .../foors_mod/inner_foors_mod/innest.rs           | 11 -----------
 .../foors_mod/inner_modrs_mod/innest.rs           | 11 -----------
 .../foors_mod/inner_modrs_mod/mod.rs              | 11 -----------
 .../modrs_mod/compiletest-ignore-dir              |  0
 .../non_modrs_mods/modrs_mod/inner_foors_mod.rs   | 11 -----------
 .../modrs_mod/inner_foors_mod/innest.rs           | 11 -----------
 .../modrs_mod/inner_modrs_mod/innest.rs           | 11 -----------
 .../modrs_mod/inner_modrs_mod/mod.rs              | 11 -----------
 src/test/ui/non_modrs_mods/modrs_mod/mod.rs       | 12 ------------
 .../some_crazy_attr_mod_dir/arbitrary_name.rs     | 11 -----------
 .../compiletest-ignore-dir                        |  0
 .../inner_modrs_mod/innest.rs                     | 11 -----------
 .../inner_modrs_mod/mod.rs                        | 11 -----------
 26 files changed, 44 insertions(+), 164 deletions(-)
 create mode 100644 src/test/run-pass/non_modrs_mods/foors_mod/block/block_inner/block_inner_inner.rs
 create mode 100644 src/test/run-pass/non_modrs_mods/non_modrs_mods.rs
 create mode 100644 src/test/ui/missing_non_modrs_mod/foo_inline.rs
 create mode 100644 src/test/ui/missing_non_modrs_mod/missing_non_modrs_mod_inline.rs
 create mode 100644 src/test/ui/missing_non_modrs_mod/missing_non_modrs_mod_inline.stderr
 delete mode 100644 src/test/ui/non_modrs_mods/foors_mod.rs
 delete mode 100644 src/test/ui/non_modrs_mods/foors_mod/compiletest-ignore-dir
 delete mode 100644 src/test/ui/non_modrs_mods/foors_mod/inner_foors_mod.rs
 delete mode 100644 src/test/ui/non_modrs_mods/foors_mod/inner_foors_mod/innest.rs
 delete mode 100644 src/test/ui/non_modrs_mods/foors_mod/inner_modrs_mod/innest.rs
 delete mode 100644 src/test/ui/non_modrs_mods/foors_mod/inner_modrs_mod/mod.rs
 delete mode 100644 src/test/ui/non_modrs_mods/modrs_mod/compiletest-ignore-dir
 delete mode 100644 src/test/ui/non_modrs_mods/modrs_mod/inner_foors_mod.rs
 delete mode 100644 src/test/ui/non_modrs_mods/modrs_mod/inner_foors_mod/innest.rs
 delete mode 100644 src/test/ui/non_modrs_mods/modrs_mod/inner_modrs_mod/innest.rs
 delete mode 100644 src/test/ui/non_modrs_mods/modrs_mod/inner_modrs_mod/mod.rs
 delete mode 100644 src/test/ui/non_modrs_mods/modrs_mod/mod.rs
 delete mode 100644 src/test/ui/non_modrs_mods/some_crazy_attr_mod_dir/arbitrary_name.rs
 delete mode 100644 src/test/ui/non_modrs_mods/some_crazy_attr_mod_dir/compiletest-ignore-dir
 delete mode 100644 src/test/ui/non_modrs_mods/some_crazy_attr_mod_dir/inner_modrs_mod/innest.rs
 delete mode 100644 src/test/ui/non_modrs_mods/some_crazy_attr_mod_dir/inner_modrs_mod/mod.rs

diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs
index a814c88ee7821..69843a1351656 100644
--- a/src/libsyntax/parse/lexer/mod.rs
+++ b/src/libsyntax/parse/lexer/mod.rs
@@ -1869,7 +1869,6 @@ mod tests {
             missing_fragment_specifiers: Lock::new(FxHashSet::default()),
             raw_identifier_spans: Lock::new(Vec::new()),
             registered_diagnostics: Lock::new(ErrorMap::new()),
-            non_modrs_mods: Lock::new(vec![]),
             buffered_lints: Lock::new(vec![]),
         }
     }
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs
index 5c6d5816a472b..6e9f434d32306 100644
--- a/src/libsyntax/parse/mod.rs
+++ b/src/libsyntax/parse/mod.rs
@@ -52,9 +52,6 @@ pub struct ParseSess {
     pub raw_identifier_spans: Lock<Vec<Span>>,
     /// The registered diagnostics codes
     crate registered_diagnostics: Lock<ErrorMap>,
-    // Spans where a `mod foo;` statement was included in a non-mod.rs file.
-    // These are used to issue errors if the non_modrs_mods feature is not enabled.
-    pub non_modrs_mods: Lock<Vec<(ast::Ident, Span)>>,
     /// Used to determine and report recursive mod inclusions
     included_mod_stack: Lock<Vec<PathBuf>>,
     code_map: Lrc<SourceMap>,
@@ -81,7 +78,6 @@ impl ParseSess {
             registered_diagnostics: Lock::new(ErrorMap::new()),
             included_mod_stack: Lock::new(vec![]),
             code_map,
-            non_modrs_mods: Lock::new(vec![]),
             buffered_lints: Lock::new(vec![]),
         }
     }
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index c7089a295fc3d..98541f3cdd23e 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -6426,6 +6426,10 @@ impl<'a> Parser<'a> {
             self.directory.path.to_mut().push(&path.as_str());
             self.directory.ownership = DirectoryOwnership::Owned { relative: None };
         } else {
+            if let DirectoryOwnership::Owned{ relative: Some(id) } = self.directory.ownership {
+                self.directory.path.to_mut().push(id.as_str());
+                self.directory.ownership = DirectoryOwnership::Owned { relative: None };
+            }
             self.directory.path.to_mut().push(&id.as_str());
         }
     }
@@ -6533,16 +6537,7 @@ impl<'a> Parser<'a> {
         }
 
         let relative = match self.directory.ownership {
-            DirectoryOwnership::Owned { relative } => {
-                // Push the usage onto the list of non-mod.rs mod uses.
-                // This is used later for feature-gate error reporting.
-                if let Some(cur_file_ident) = relative {
-                    self.sess
-                        .non_modrs_mods.borrow_mut()
-                        .push((cur_file_ident, id_sp));
-                }
-                relative
-            },
+            DirectoryOwnership::Owned { relative } => relative,
             DirectoryOwnership::UnownedViaBlock |
             DirectoryOwnership::UnownedViaMod(_) => None,
         };
diff --git a/src/test/run-pass/non_modrs_mods/foors_mod.rs b/src/test/run-pass/non_modrs_mods/foors_mod.rs
index 7d37c6d939954..40577f1122ef3 100644
--- a/src/test/run-pass/non_modrs_mods/foors_mod.rs
+++ b/src/test/run-pass/non_modrs_mods/foors_mod.rs
@@ -12,3 +12,8 @@
 
 pub mod inner_modrs_mod;
 pub mod inner_foors_mod;
+pub mod block {
+    pub mod block_inner {
+        pub mod block_inner_inner;
+    }
+}
diff --git a/src/test/run-pass/non_modrs_mods/foors_mod/block/block_inner/block_inner_inner.rs b/src/test/run-pass/non_modrs_mods/foors_mod/block/block_inner/block_inner_inner.rs
new file mode 100644
index 0000000000000..b76b4321d62aa
--- /dev/null
+++ b/src/test/run-pass/non_modrs_mods/foors_mod/block/block_inner/block_inner_inner.rs
@@ -0,0 +1 @@
+pub fn foo() {}
diff --git a/src/test/run-pass/non_modrs_mods/non_modrs_mods.rs b/src/test/run-pass/non_modrs_mods/non_modrs_mods.rs
new file mode 100644
index 0000000000000..a1f7ba2fed201
--- /dev/null
+++ b/src/test/run-pass/non_modrs_mods/non_modrs_mods.rs
@@ -0,0 +1,15 @@
+// run-pass
+//
+// ignore-pretty issue #37195
+pub mod modrs_mod;
+pub mod foors_mod;
+#[path = "some_crazy_attr_mod_dir/arbitrary_name.rs"]
+pub mod attr_mod;
+pub fn main() {
+    modrs_mod::inner_modrs_mod::innest::foo();
+    modrs_mod::inner_foors_mod::innest::foo();
+    foors_mod::inner_modrs_mod::innest::foo();
+    foors_mod::inner_foors_mod::innest::foo();
+    foors_mod::block::block_inner::block_inner_inner::foo();
+    attr_mod::inner_modrs_mod::innest::foo();
+}
diff --git a/src/test/ui/missing_non_modrs_mod/foo_inline.rs b/src/test/ui/missing_non_modrs_mod/foo_inline.rs
new file mode 100644
index 0000000000000..df60629eca161
--- /dev/null
+++ b/src/test/ui/missing_non_modrs_mod/foo_inline.rs
@@ -0,0 +1,5 @@
+// ignore-test this is just a helper for the real test in this dir
+
+mod inline {
+    mod missing;
+}
diff --git a/src/test/ui/missing_non_modrs_mod/missing_non_modrs_mod.rs b/src/test/ui/missing_non_modrs_mod/missing_non_modrs_mod.rs
index 9c95f45939367..84fa1f032d78e 100644
--- a/src/test/ui/missing_non_modrs_mod/missing_non_modrs_mod.rs
+++ b/src/test/ui/missing_non_modrs_mod/missing_non_modrs_mod.rs
@@ -8,7 +8,5 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// ignore-windows
-
 mod foo;
 fn main() {}
diff --git a/src/test/ui/missing_non_modrs_mod/missing_non_modrs_mod_inline.rs b/src/test/ui/missing_non_modrs_mod/missing_non_modrs_mod_inline.rs
new file mode 100644
index 0000000000000..9ebb4f1bdbdb3
--- /dev/null
+++ b/src/test/ui/missing_non_modrs_mod/missing_non_modrs_mod_inline.rs
@@ -0,0 +1,2 @@
+mod foo_inline;
+fn main() {}
diff --git a/src/test/ui/missing_non_modrs_mod/missing_non_modrs_mod_inline.stderr b/src/test/ui/missing_non_modrs_mod/missing_non_modrs_mod_inline.stderr
new file mode 100644
index 0000000000000..457e8fcccbfb3
--- /dev/null
+++ b/src/test/ui/missing_non_modrs_mod/missing_non_modrs_mod_inline.stderr
@@ -0,0 +1,11 @@
+error[E0583]: file not found for module `missing`
+  --> $DIR/foo_inline.rs:4:9
+   |
+LL |     mod missing;
+   |         ^^^^^^^
+   |
+   = help: name the file either missing.rs or missing/mod.rs inside the directory "$DIR/foo_inline/inline"
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0583`.
diff --git a/src/test/ui/non_modrs_mods/foors_mod.rs b/src/test/ui/non_modrs_mods/foors_mod.rs
deleted file mode 100644
index 7d37c6d939954..0000000000000
--- a/src/test/ui/non_modrs_mods/foors_mod.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-//
-// ignore-test: not a test, used by non_modrs_mods.rs
-
-pub mod inner_modrs_mod;
-pub mod inner_foors_mod;
diff --git a/src/test/ui/non_modrs_mods/foors_mod/compiletest-ignore-dir b/src/test/ui/non_modrs_mods/foors_mod/compiletest-ignore-dir
deleted file mode 100644
index e69de29bb2d1d..0000000000000
diff --git a/src/test/ui/non_modrs_mods/foors_mod/inner_foors_mod.rs b/src/test/ui/non_modrs_mods/foors_mod/inner_foors_mod.rs
deleted file mode 100644
index 77cab972352bd..0000000000000
--- a/src/test/ui/non_modrs_mods/foors_mod/inner_foors_mod.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-pub mod innest;
diff --git a/src/test/ui/non_modrs_mods/foors_mod/inner_foors_mod/innest.rs b/src/test/ui/non_modrs_mods/foors_mod/inner_foors_mod/innest.rs
deleted file mode 100644
index b61667cfd882c..0000000000000
--- a/src/test/ui/non_modrs_mods/foors_mod/inner_foors_mod/innest.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-pub fn foo() {}
diff --git a/src/test/ui/non_modrs_mods/foors_mod/inner_modrs_mod/innest.rs b/src/test/ui/non_modrs_mods/foors_mod/inner_modrs_mod/innest.rs
deleted file mode 100644
index b61667cfd882c..0000000000000
--- a/src/test/ui/non_modrs_mods/foors_mod/inner_modrs_mod/innest.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-pub fn foo() {}
diff --git a/src/test/ui/non_modrs_mods/foors_mod/inner_modrs_mod/mod.rs b/src/test/ui/non_modrs_mods/foors_mod/inner_modrs_mod/mod.rs
deleted file mode 100644
index 77cab972352bd..0000000000000
--- a/src/test/ui/non_modrs_mods/foors_mod/inner_modrs_mod/mod.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-pub mod innest;
diff --git a/src/test/ui/non_modrs_mods/modrs_mod/compiletest-ignore-dir b/src/test/ui/non_modrs_mods/modrs_mod/compiletest-ignore-dir
deleted file mode 100644
index e69de29bb2d1d..0000000000000
diff --git a/src/test/ui/non_modrs_mods/modrs_mod/inner_foors_mod.rs b/src/test/ui/non_modrs_mods/modrs_mod/inner_foors_mod.rs
deleted file mode 100644
index 77cab972352bd..0000000000000
--- a/src/test/ui/non_modrs_mods/modrs_mod/inner_foors_mod.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-pub mod innest;
diff --git a/src/test/ui/non_modrs_mods/modrs_mod/inner_foors_mod/innest.rs b/src/test/ui/non_modrs_mods/modrs_mod/inner_foors_mod/innest.rs
deleted file mode 100644
index b61667cfd882c..0000000000000
--- a/src/test/ui/non_modrs_mods/modrs_mod/inner_foors_mod/innest.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-pub fn foo() {}
diff --git a/src/test/ui/non_modrs_mods/modrs_mod/inner_modrs_mod/innest.rs b/src/test/ui/non_modrs_mods/modrs_mod/inner_modrs_mod/innest.rs
deleted file mode 100644
index b61667cfd882c..0000000000000
--- a/src/test/ui/non_modrs_mods/modrs_mod/inner_modrs_mod/innest.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-pub fn foo() {}
diff --git a/src/test/ui/non_modrs_mods/modrs_mod/inner_modrs_mod/mod.rs b/src/test/ui/non_modrs_mods/modrs_mod/inner_modrs_mod/mod.rs
deleted file mode 100644
index 77cab972352bd..0000000000000
--- a/src/test/ui/non_modrs_mods/modrs_mod/inner_modrs_mod/mod.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-pub mod innest;
diff --git a/src/test/ui/non_modrs_mods/modrs_mod/mod.rs b/src/test/ui/non_modrs_mods/modrs_mod/mod.rs
deleted file mode 100644
index 9e3f10f12ed63..0000000000000
--- a/src/test/ui/non_modrs_mods/modrs_mod/mod.rs
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-pub mod inner_modrs_mod;
-pub mod inner_foors_mod;
diff --git a/src/test/ui/non_modrs_mods/some_crazy_attr_mod_dir/arbitrary_name.rs b/src/test/ui/non_modrs_mods/some_crazy_attr_mod_dir/arbitrary_name.rs
deleted file mode 100644
index 226e6fda0a41f..0000000000000
--- a/src/test/ui/non_modrs_mods/some_crazy_attr_mod_dir/arbitrary_name.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-pub mod inner_modrs_mod;
diff --git a/src/test/ui/non_modrs_mods/some_crazy_attr_mod_dir/compiletest-ignore-dir b/src/test/ui/non_modrs_mods/some_crazy_attr_mod_dir/compiletest-ignore-dir
deleted file mode 100644
index e69de29bb2d1d..0000000000000
diff --git a/src/test/ui/non_modrs_mods/some_crazy_attr_mod_dir/inner_modrs_mod/innest.rs b/src/test/ui/non_modrs_mods/some_crazy_attr_mod_dir/inner_modrs_mod/innest.rs
deleted file mode 100644
index b61667cfd882c..0000000000000
--- a/src/test/ui/non_modrs_mods/some_crazy_attr_mod_dir/inner_modrs_mod/innest.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-pub fn foo() {}
diff --git a/src/test/ui/non_modrs_mods/some_crazy_attr_mod_dir/inner_modrs_mod/mod.rs b/src/test/ui/non_modrs_mods/some_crazy_attr_mod_dir/inner_modrs_mod/mod.rs
deleted file mode 100644
index 77cab972352bd..0000000000000
--- a/src/test/ui/non_modrs_mods/some_crazy_attr_mod_dir/inner_modrs_mod/mod.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-pub mod innest;