diff --git a/compiler/rustc_ast_passes/src/feature_gate.rs b/compiler/rustc_ast_passes/src/feature_gate.rs index 9cf3182daea59..2178b65727d09 100644 --- a/compiler/rustc_ast_passes/src/feature_gate.rs +++ b/compiler/rustc_ast_passes/src/feature_gate.rs @@ -607,8 +607,7 @@ fn maybe_stage_features(sess: &Session, features: &Features, krate: &ast::Crate) // does not check the same for lib features unless there's at least one // declared lang feature if !sess.opts.unstable_features.is_nightly_build() { - let lang_features = &features.declared_lang_features; - if lang_features.len() == 0 { + if features.declared_features.is_empty() { return; } for attr in krate.attrs.iter().filter(|attr| attr.has_name(sym::feature)) { @@ -624,7 +623,8 @@ fn maybe_stage_features(sess: &Session, features: &Features, krate: &ast::Crate) attr.meta_item_list().into_iter().flatten().flat_map(|nested| nested.ident()) { let name = ident.name; - let stable_since = lang_features + let stable_since = features + .declared_lang_features .iter() .flat_map(|&(feature, _, since)| if feature == name { since } else { None }) .next(); diff --git a/compiler/rustc_passes/messages.ftl b/compiler/rustc_passes/messages.ftl index d7513fbad63c8..1d93cbaddd6fe 100644 --- a/compiler/rustc_passes/messages.ftl +++ b/compiler/rustc_passes/messages.ftl @@ -290,9 +290,6 @@ passes_export_name = passes_extern_main = the `main` function cannot be declared in an `extern` block -passes_feature_only_on_nightly = - `#![feature]` may not be used on the {$release_channel} release channel - passes_feature_previously_declared = feature `{$feature}` is declared {$declared}, but was previously declared {$prev_declared} diff --git a/compiler/rustc_passes/src/errors.rs b/compiler/rustc_passes/src/errors.rs index a026ff3b13b57..58d27d5b4bbaa 100644 --- a/compiler/rustc_passes/src/errors.rs +++ b/compiler/rustc_passes/src/errors.rs @@ -1492,14 +1492,6 @@ pub struct TraitImplConstStable { pub span: Span, } -#[derive(Diagnostic)] -#[diag(passes_feature_only_on_nightly, code = E0554)] -pub struct FeatureOnlyOnNightly { - #[primary_span] - pub span: Span, - pub release_channel: &'static str, -} - #[derive(Diagnostic)] #[diag(passes_unknown_feature, code = E0635)] pub struct UnknownFeature { diff --git a/compiler/rustc_passes/src/stability.rs b/compiler/rustc_passes/src/stability.rs index 6bdfaf0c90897..2c34f477de5c5 100644 --- a/compiler/rustc_passes/src/stability.rs +++ b/compiler/rustc_passes/src/stability.rs @@ -936,12 +936,6 @@ pub fn check_unused_or_stable_features(tcx: TyCtxt<'_>) { let declared_lib_features = &tcx.features().declared_lib_features; let mut remaining_lib_features = FxIndexMap::default(); for (feature, span) in declared_lib_features { - if !tcx.sess.opts.unstable_features.is_nightly_build() { - tcx.dcx().emit_err(errors::FeatureOnlyOnNightly { - span: *span, - release_channel: env!("CFG_RELEASE_CHANNEL"), - }); - } if remaining_lib_features.contains_key(&feature) { // Warn if the user enables a lib feature multiple times. tcx.dcx().emit_err(errors::DuplicateFeatureErr { span: *span, feature: *feature });