about summary refs log tree commit diff
path: root/src/libsyntax/feature_gate
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-12-31 21:25:16 +0100
committerMazdak Farrokhzad <twingoow@gmail.com>2020-01-08 04:25:33 +0100
commit2c3e5d3de023c0bfbf4a4c4d3b0d7a9844e96ffe (patch)
treed8a6e6281016eab3b52f1e0bbd0b89b7ea09035e /src/libsyntax/feature_gate
parent7e393b5b3b543d355ae16c1940cf98b6c7fcb8aa (diff)
downloadrust-2c3e5d3de023c0bfbf4a4c4d3b0d7a9844e96ffe.tar.gz
rust-2c3e5d3de023c0bfbf4a4c4d3b0d7a9844e96ffe.zip
- remove syntax::{span_warn!, span_err!, span_fatal!. struct_err!}
- remove syntax::{help!, span_help!, span_note!}
- remove unused syntax::{struct_span_fatal, struct_span_err_or_warn!, span_err_or_warn!}
- lintify check_for_bindings_named_same_as_variants + conflicting_repr_hints
- inline syntax::{struct_span_warn!, diagnostic_used!}
- stringify_error_code! -> error_code! & use it more.
- find_plugin_registrar: de-fatalize an error
- de-fatalize metadata errors
- move type_error_struct! to rustc_typeck
- struct_span_err! -> rustc_errors
Diffstat (limited to 'src/libsyntax/feature_gate')
-rw-r--r--src/libsyntax/feature_gate/check.rs28
1 files changed, 11 insertions, 17 deletions
diff --git a/src/libsyntax/feature_gate/check.rs b/src/libsyntax/feature_gate/check.rs
index 0e94a722777..26545bfa61b 100644
--- a/src/libsyntax/feature_gate/check.rs
+++ b/src/libsyntax/feature_gate/check.rs
@@ -4,7 +4,7 @@ use crate::attr;
 use crate::sess::ParseSess;
 use crate::visit::{self, FnKind, Visitor};
 
-use errors::{Applicability, DiagnosticBuilder, Handler};
+use errors::{error_code, struct_span_err, Applicability, DiagnosticBuilder, Handler};
 use rustc_data_structures::fx::FxHashMap;
 use rustc_error_codes::*;
 use rustc_feature::{find_feature_issue, GateIssue};
@@ -91,9 +91,7 @@ fn leveled_feature_err<'a>(
     let diag = &sess.span_diagnostic;
 
     let mut err = match level {
-        GateStrength::Hard => {
-            diag.struct_span_err_with_code(span, explain, stringify_error_code!(E0658))
-        }
+        GateStrength::Hard => diag.struct_span_err_with_code(span, explain, error_code!(E0658)),
         GateStrength::Soft => diag.struct_span_warn(span, explain),
     };
 
@@ -827,15 +825,9 @@ pub fn get_features(
             };
 
             if let Some(edition) = edition_enabled_features.get(&name) {
-                struct_span_warn!(
-                    span_handler,
-                    mi.span(),
-                    E0705,
-                    "the feature `{}` is included in the Rust {} edition",
-                    name,
-                    edition,
-                )
-                .emit();
+                let msg =
+                    &format!("the feature `{}` is included in the Rust {} edition", name, edition);
+                span_handler.struct_span_warn_with_code(mi.span(), msg, error_code!(E0705)).emit();
                 continue;
             }
 
@@ -863,13 +855,14 @@ pub fn get_features(
 
             if let Some(allowed) = allow_features.as_ref() {
                 if allowed.iter().find(|&f| name.as_str() == *f).is_none() {
-                    span_err!(
+                    struct_span_err!(
                         span_handler,
                         mi.span(),
                         E0725,
                         "the feature `{}` is not in the list of allowed features",
                         name
-                    );
+                    )
+                    .emit();
                     continue;
                 }
             }
@@ -953,13 +946,14 @@ pub fn check_crate(
 fn maybe_stage_features(span_handler: &Handler, krate: &ast::Crate, unstable: UnstableFeatures) {
     if !unstable.is_nightly_build() {
         for attr in krate.attrs.iter().filter(|attr| attr.check_name(sym::feature)) {
-            span_err!(
+            struct_span_err!(
                 span_handler,
                 attr.span,
                 E0554,
                 "`#![feature]` may not be used on the {} release channel",
                 option_env!("CFG_RELEASE_CHANNEL").unwrap_or("(unknown)")
-            );
+            )
+            .emit();
         }
     }
 }