about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorFelix S. Klock II <pnkfelix@pnkfx.org>2015-04-02 17:29:22 +0200
committerFelix S. Klock II <pnkfelix@pnkfx.org>2015-04-02 17:29:22 +0200
commiteaea188d9674c8b9eba36dec5f20277a6fe7ae43 (patch)
treed0c6611810f73eff87218eebe391e1c00c9e59e5 /src/libsyntax
parentcf00fc4da984481a75229ce1e40f339f292d2166 (diff)
downloadrust-eaea188d9674c8b9eba36dec5f20277a6fe7ae43.tar.gz
rust-eaea188d9674c8b9eba36dec5f20277a6fe7ae43.zip
Do not suggest `#![feature(...)]` if we are in beta or stable channel.
Fix #23973
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/feature_gate.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs
index dbddd9dd44d..2d6fbb7c683 100644
--- a/src/libsyntax/feature_gate.rs
+++ b/src/libsyntax/feature_gate.rs
@@ -409,6 +409,12 @@ impl<'a> Context<'a> {
 
 pub fn emit_feature_err(diag: &SpanHandler, feature: &str, span: Span, explain: &str) {
     diag.span_err(span, explain);
+
+    // #23973: do not suggest `#![feature(...)]` if we are in beta/stable
+    match option_env!("CFG_RELEASE_CHANNEL") {
+        Some("stable") | Some("beta") => return,
+        _ => {}
+    }
     diag.fileline_help(span, &format!("add #![feature({})] to the \
                                    crate attributes to enable",
                                   feature));
@@ -416,6 +422,12 @@ pub fn emit_feature_err(diag: &SpanHandler, feature: &str, span: Span, explain:
 
 pub fn emit_feature_warn(diag: &SpanHandler, feature: &str, span: Span, explain: &str) {
     diag.span_warn(span, explain);
+
+    // #23973: do not suggest `#![feature(...)]` if we are in beta/stable
+    match option_env!("CFG_RELEASE_CHANNEL") {
+        Some("stable") | Some("beta") => return,
+        _ => {}
+    }
     if diag.handler.can_emit_warnings {
         diag.fileline_help(span, &format!("add #![feature({})] to the \
                                        crate attributes to silence this warning",