]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_session/parse.rs
Rollup merge of #68314 - oli-obk:true_unwind, r=eddyb
[rust.git] / src / librustc_session / parse.rs
index 946e77d35595e101ee35d03844c75e9becbef0e7..a98cf929095ead3aa73ea261caace287291f0e14 100644 (file)
@@ -62,16 +62,6 @@ pub fn merge(&self, mut spans: FxHashMap<Symbol, Vec<Span>>) {
     }
 }
 
-/// The strenght of a feature gate.
-/// Either it is a `Hard` error, or only a `Soft` warning.
-#[derive(Debug, Copy, Clone, PartialEq)]
-pub enum GateStrength {
-    /// A hard error. (Most feature gates should use this.)
-    Hard,
-    /// Only a warning. (Use this only as backwards-compatibility demands.)
-    Soft,
-}
-
 /// Construct a diagnostic for a language feature error due to the given `span`.
 /// The `feature`'s `Symbol` is the one you used in `active.rs` and `rustc_span::symbols`.
 pub fn feature_err<'a>(
@@ -94,26 +84,7 @@ pub fn feature_err_issue<'a>(
     issue: GateIssue,
     explain: &str,
 ) -> DiagnosticBuilder<'a> {
-    leveled_feature_err(sess, feature, span, issue, explain, GateStrength::Hard)
-}
-
-/// Construct a diagnostic for a feature gate error / warning.
-///
-/// You should typically just use `feature_err` instead.
-pub fn leveled_feature_err<'a>(
-    sess: &'a ParseSess,
-    feature: Symbol,
-    span: impl Into<MultiSpan>,
-    issue: GateIssue,
-    explain: &str,
-    level: GateStrength,
-) -> DiagnosticBuilder<'a> {
-    let diag = &sess.span_diagnostic;
-
-    let mut err = match level {
-        GateStrength::Hard => diag.struct_span_err_with_code(span, explain, error_code!(E0658)),
-        GateStrength::Soft => diag.struct_span_warn(span, explain),
-    };
+    let mut err = sess.span_diagnostic.struct_span_err_with_code(span, explain, error_code!(E0658));
 
     if let Some(n) = find_feature_issue(feature, issue) {
         err.note(&format!(
@@ -127,13 +98,6 @@ pub fn leveled_feature_err<'a>(
         err.help(&format!("add `#![feature({})]` to the crate attributes to enable", feature));
     }
 
-    // If we're on stable and only emitting a "soft" warning, add a note to
-    // clarify that the feature isn't "on" (rather than being on but
-    // warning-worthy).
-    if !sess.unstable_features.is_nightly_build() && level == GateStrength::Soft {
-        err.help("a nightly build of the compiler is required to enable this feature");
-    }
-
     err
 }