Skip to content

Commit eaea188

Browse files
committed
Do not suggest #![feature(...)] if we are in beta or stable channel.
Fix #23973
1 parent cf00fc4 commit eaea188

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/libsyntax/feature_gate.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,13 +409,25 @@ impl<'a> Context<'a> {
409409

410410
pub fn emit_feature_err(diag: &SpanHandler, feature: &str, span: Span, explain: &str) {
411411
diag.span_err(span, explain);
412+
413+
// #23973: do not suggest `#![feature(...)]` if we are in beta/stable
414+
match option_env!("CFG_RELEASE_CHANNEL") {
415+
Some("stable") | Some("beta") => return,
416+
_ => {}
417+
}
412418
diag.fileline_help(span, &format!("add #![feature({})] to the \
413419
crate attributes to enable",
414420
feature));
415421
}
416422

417423
pub fn emit_feature_warn(diag: &SpanHandler, feature: &str, span: Span, explain: &str) {
418424
diag.span_warn(span, explain);
425+
426+
// #23973: do not suggest `#![feature(...)]` if we are in beta/stable
427+
match option_env!("CFG_RELEASE_CHANNEL") {
428+
Some("stable") | Some("beta") => return,
429+
_ => {}
430+
}
419431
if diag.handler.can_emit_warnings {
420432
diag.fileline_help(span, &format!("add #![feature({})] to the \
421433
crate attributes to silence this warning",

0 commit comments

Comments
 (0)