Clean up some non-mod-rs stuff.
This commit is contained in:
parent
7d3b9b1640
commit
7f4bc2247a
29 changed files with 45 additions and 165 deletions
|
@ -1890,7 +1890,6 @@ mod tests {
|
||||||
missing_fragment_specifiers: Lock::new(FxHashSet::default()),
|
missing_fragment_specifiers: Lock::new(FxHashSet::default()),
|
||||||
raw_identifier_spans: Lock::new(Vec::new()),
|
raw_identifier_spans: Lock::new(Vec::new()),
|
||||||
registered_diagnostics: Lock::new(ErrorMap::new()),
|
registered_diagnostics: Lock::new(ErrorMap::new()),
|
||||||
non_modrs_mods: Lock::new(vec![]),
|
|
||||||
buffered_lints: Lock::new(vec![]),
|
buffered_lints: Lock::new(vec![]),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,9 +52,6 @@ pub struct ParseSess {
|
||||||
pub raw_identifier_spans: Lock<Vec<Span>>,
|
pub raw_identifier_spans: Lock<Vec<Span>>,
|
||||||
/// The registered diagnostics codes
|
/// The registered diagnostics codes
|
||||||
crate registered_diagnostics: Lock<ErrorMap>,
|
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
|
/// Used to determine and report recursive mod inclusions
|
||||||
included_mod_stack: Lock<Vec<PathBuf>>,
|
included_mod_stack: Lock<Vec<PathBuf>>,
|
||||||
source_map: Lrc<SourceMap>,
|
source_map: Lrc<SourceMap>,
|
||||||
|
@ -81,7 +78,6 @@ impl ParseSess {
|
||||||
registered_diagnostics: Lock::new(ErrorMap::new()),
|
registered_diagnostics: Lock::new(ErrorMap::new()),
|
||||||
included_mod_stack: Lock::new(vec![]),
|
included_mod_stack: Lock::new(vec![]),
|
||||||
source_map,
|
source_map,
|
||||||
non_modrs_mods: Lock::new(vec![]),
|
|
||||||
buffered_lints: Lock::new(vec![]),
|
buffered_lints: Lock::new(vec![]),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6591,16 +6591,7 @@ impl<'a> Parser<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
let relative = match self.directory.ownership {
|
let relative = match self.directory.ownership {
|
||||||
DirectoryOwnership::Owned { relative } => {
|
DirectoryOwnership::Owned { relative } => 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::UnownedViaBlock |
|
DirectoryOwnership::UnownedViaBlock |
|
||||||
DirectoryOwnership::UnownedViaMod(_) => None,
|
DirectoryOwnership::UnownedViaMod(_) => None,
|
||||||
};
|
};
|
||||||
|
|
|
@ -12,3 +12,7 @@
|
||||||
|
|
||||||
pub mod inner_modrs_mod;
|
pub mod inner_modrs_mod;
|
||||||
pub mod inner_foors_mod;
|
pub mod inner_foors_mod;
|
||||||
|
pub mod inline {
|
||||||
|
#[path="somename.rs"]
|
||||||
|
pub mod innie;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
pub fn foo() {}
|
|
@ -0,0 +1 @@
|
||||||
|
pub fn foo() {}
|
|
@ -10,3 +10,7 @@
|
||||||
|
|
||||||
pub mod inner_modrs_mod;
|
pub mod inner_modrs_mod;
|
||||||
pub mod inner_foors_mod;
|
pub mod inner_foors_mod;
|
||||||
|
pub mod inline {
|
||||||
|
#[path="somename.rs"]
|
||||||
|
pub mod innie;
|
||||||
|
}
|
||||||
|
|
16
src/test/run-pass/non_modrs_mods/non_modrs_mods.rs
Normal file
16
src/test/run-pass/non_modrs_mods/non_modrs_mods.rs
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
// 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();
|
||||||
|
modrs_mod::inline::innie::foo();
|
||||||
|
foors_mod::inner_modrs_mod::innest::foo();
|
||||||
|
foors_mod::inner_foors_mod::innest::foo();
|
||||||
|
foors_mod::inline::innie::foo();
|
||||||
|
attr_mod::inner_modrs_mod::innest::foo();
|
||||||
|
}
|
|
@ -9,7 +9,6 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
// ignore-tidy-linelength
|
// ignore-tidy-linelength
|
||||||
// ignore-windows
|
|
||||||
|
|
||||||
mod auxiliary {
|
mod auxiliary {
|
||||||
mod foo;
|
mod foo;
|
||||||
|
|
5
src/test/ui/missing_non_modrs_mod/foo_inline.rs
Normal file
5
src/test/ui/missing_non_modrs_mod/foo_inline.rs
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
// ignore-test this is just a helper for the real test in this dir
|
||||||
|
|
||||||
|
mod inline {
|
||||||
|
mod missing;
|
||||||
|
}
|
|
@ -8,7 +8,5 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
// ignore-windows
|
|
||||||
|
|
||||||
mod foo;
|
mod foo;
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
mod foo_inline;
|
||||||
|
fn main() {}
|
|
@ -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`.
|
|
@ -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;
|
|
|
@ -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;
|
|
|
@ -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() {}
|
|
|
@ -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() {}
|
|
|
@ -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;
|
|
|
@ -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;
|
|
|
@ -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() {}
|
|
|
@ -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() {}
|
|
|
@ -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;
|
|
|
@ -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;
|
|
|
@ -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;
|
|
|
@ -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() {}
|
|
|
@ -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;
|
|
Loading…
Add table
Add a link
Reference in a new issue