]> git.lizzy.rs Git - rust.git/commitdiff
inline two explanation constants
authorMazdak Farrokhzad <twingoow@gmail.com>
Sat, 30 Nov 2019 01:40:28 +0000 (02:40 +0100)
committerMazdak Farrokhzad <twingoow@gmail.com>
Sat, 30 Nov 2019 01:40:45 +0000 (02:40 +0100)
src/librustc_parse/config.rs
src/librustc_typeck/check/coercion.rs
src/libsyntax/feature_gate/check.rs
src/libsyntax/lib.rs

index 9c309f605157d9a61edd2cb81c7c200d10fec5ae..dde320aed219f01556a553fcb2985cce0275f6df 100644 (file)
 use crate::validate_attr;
 use rustc_feature::Features;
 use syntax::attr::HasAttrs;
-use syntax::feature_gate::{
-    feature_err,
-    EXPLAIN_STMT_ATTR_SYNTAX,
-    get_features,
-    GateIssue,
-};
+use syntax::feature_gate::{feature_err, get_features, GateIssue};
 use syntax::attr;
 use syntax::ast;
 use syntax::edition::Edition;
@@ -218,7 +213,7 @@ pub fn maybe_emit_expr_attr_err(&self, attr: &ast::Attribute) {
                                       sym::stmt_expr_attributes,
                                       attr.span,
                                       GateIssue::Language,
-                                      EXPLAIN_STMT_ATTR_SYNTAX);
+                                      "attributes on expressions are experimental");
 
             if attr.is_doc_comment() {
                 err.help("`///` is for documentation comments. For a plain comment, use `//`.");
index 871acb2726a213f18605822f80fb0642fe394ded..593f8e74ba9cba0daaca69ec643445ef3c6344d3 100644 (file)
@@ -644,11 +644,13 @@ fn coerce_unsized(&self, source: Ty<'tcx>, target: Ty<'tcx>) -> CoerceResult<'tc
         }
 
         if has_unsized_tuple_coercion && !self.tcx.features().unsized_tuple_coercion {
-            feature_gate::emit_feature_err(&self.tcx.sess.parse_sess,
-                                           sym::unsized_tuple_coercion,
-                                           self.cause.span,
-                                           feature_gate::GateIssue::Language,
-                                           feature_gate::EXPLAIN_UNSIZED_TUPLE_COERCION);
+            feature_gate::emit_feature_err(
+                &self.tcx.sess.parse_sess,
+                sym::unsized_tuple_coercion,
+                self.cause.span,
+                feature_gate::GateIssue::Language,
+                "unsized tuple coercion is not stable enough for use and is subject to change",
+            );
         }
 
         Ok(coercion)
index b5dc7d4db2b49a3df9ae5813461419cd8cdd8710..c53f5f41e3267c7348f6972201ec950786495be5 100644 (file)
@@ -150,12 +150,6 @@ fn leveled_feature_err<'a, S: Into<MultiSpan>>(
 const EXPLAIN_BOX_SYNTAX: &str =
     "box expression syntax is experimental; you can call `Box::new` instead";
 
-pub const EXPLAIN_STMT_ATTR_SYNTAX: &str =
-    "attributes on expressions are experimental";
-
-pub const EXPLAIN_UNSIZED_TUPLE_COERCION: &str =
-    "unsized tuple coercion is not stable enough for use and is subject to change";
-
 struct PostExpansionVisitor<'a> {
     parse_sess: &'a ParseSess,
     features: &'a Features,
index 9db2007ea9cb652b7beaaf4a2def67fc8e83aa4a..fda95374f64026c5d7013ee728cd43556040c6ce 100644 (file)
@@ -97,7 +97,6 @@ pub mod feature_gate {
     pub use check::{
         check_crate, check_attribute, get_features, feature_err, emit_feature_err,
         GateIssue, UnstableFeatures,
-        EXPLAIN_STMT_ATTR_SYNTAX, EXPLAIN_UNSIZED_TUPLE_COERCION,
     };
 }
 pub mod mut_visit;