Skip to content

Commit 7f6b608

Browse files
committed
Stabilization change for mod.rs
This change is in response to #53125. The patch makes the feature accepted and removes the tests that tested the non-accepted status of the feature.
1 parent 0198a1e commit 7f6b608

File tree

8 files changed

+3
-185
lines changed

8 files changed

+3
-185
lines changed

Diff for: src/libsyntax/feature_gate.rs

+3-30
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ use visit::{self, FnKind, Visitor};
3737
use parse::ParseSess;
3838
use symbol::{keywords, Symbol};
3939

40-
use std::{env, path};
40+
use std::{env};
4141

4242
macro_rules! set {
4343
// The const_fn feature also enables the min_const_fn feature, because `min_const_fn` allows
@@ -409,9 +409,6 @@ declare_features! (
409409
// Resolve absolute paths as paths from other crates
410410
(active, extern_absolute_paths, "1.24.0", Some(44660), Some(Edition::Edition2018)),
411411

412-
// `foo.rs` as an alternative to `foo/mod.rs`
413-
(active, non_modrs_mods, "1.24.0", Some(44660), Some(Edition::Edition2018)),
414-
415412
// `extern` in paths
416413
(active, extern_in_paths, "1.23.0", Some(44660), None),
417414

@@ -660,6 +657,8 @@ declare_features! (
660657
(accepted, repr_transparent, "1.28.0", Some(43036), None),
661658
// Defining procedural macros in `proc-macro` crates
662659
(accepted, proc_macro, "1.29.0", Some(38356), None),
660+
// `foo.rs` as an alternative to `foo/mod.rs`
661+
(accepted, non_modrs_mods, "1.30.0", Some(44660), None),
663662
// Allows use of the :vis macro fragment specifier
664663
(accepted, macro_vis_matcher, "1.30.0", Some(41022), None),
665664
// Allows importing and reexporting macros with `use`,
@@ -1494,31 +1493,6 @@ impl<'a> PostExpansionVisitor<'a> {
14941493
}
14951494
}
14961495

1497-
impl<'a> PostExpansionVisitor<'a> {
1498-
fn whole_crate_feature_gates(&mut self, _krate: &ast::Crate) {
1499-
for &(ident, span) in &*self.context.parse_sess.non_modrs_mods.borrow() {
1500-
if !span.allows_unstable() {
1501-
let cx = &self.context;
1502-
let level = GateStrength::Hard;
1503-
let has_feature = cx.features.non_modrs_mods;
1504-
let name = "non_modrs_mods";
1505-
debug!("gate_feature(feature = {:?}, span = {:?}); has? {}",
1506-
name, span, has_feature);
1507-
1508-
if !has_feature && !span.allows_unstable() {
1509-
leveled_feature_err(
1510-
cx.parse_sess, name, span, GateIssue::Language,
1511-
"mod statements in non-mod.rs files are unstable", level
1512-
)
1513-
.help(&format!("on stable builds, rename this file to {}{}mod.rs",
1514-
ident, path::MAIN_SEPARATOR))
1515-
.emit();
1516-
}
1517-
}
1518-
}
1519-
}
1520-
}
1521-
15221496
impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
15231497
fn visit_attribute(&mut self, attr: &ast::Attribute) {
15241498
if !attr.span.allows_unstable() {
@@ -2088,7 +2062,6 @@ pub fn check_crate(krate: &ast::Crate,
20882062
};
20892063

20902064
let visitor = &mut PostExpansionVisitor { context: &ctx };
2091-
visitor.whole_crate_feature_gates(krate);
20922065
visit::walk_crate(visitor, krate);
20932066
}
20942067

Diff for: src/test/ui/directory_ownership/mod_file_not_owning.rs

-15
This file was deleted.

Diff for: src/test/ui/directory_ownership/mod_file_not_owning.stderr

-15
This file was deleted.

Diff for: src/test/ui/directory_ownership/unowned_mod_with_path.rs

-15
This file was deleted.

Diff for: src/test/ui/directory_ownership/unowned_mod_with_path.stderr

-15
This file was deleted.

Diff for: src/test/ui/non_modrs_mods/non_modrs_mods.rs

-28
This file was deleted.

Diff for: src/test/ui/non_modrs_mods/non_modrs_mods.stderr

-39
This file was deleted.

Diff for: src/test/ui/run-pass/non_modrs_mods/non_modrs_mods.rs

-28
This file was deleted.

0 commit comments

Comments
 (0)