about summary refs log tree commit diff
path: root/src/libsyntax_ext
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-07-07 17:00:17 +0200
committerGitHub <noreply@github.com>2019-07-07 17:00:17 +0200
commit3250b8ee596afc9881aee092279efaa57486d2ea (patch)
treec445db0b21aa62544140ff60894f770dc8fade07 /src/libsyntax_ext
parent9cd75fb35f1d24f805c6759fd6236cd708b81ee1 (diff)
parent941653b528deb96d5ed13935143db14c45d99d6e (diff)
downloadrust-3250b8ee596afc9881aee092279efaa57486d2ea.tar.gz
rust-3250b8ee596afc9881aee092279efaa57486d2ea.zip
Rollup merge of #62042 - petrochenkov:macstab, r=matthewjasper
Support stability and deprecation checking for all macros

RELNOTES: Deprecation attributes on macros now have effect.

Fixes https://github.com/rust-lang/rust/issues/34079
Fixes https://github.com/rust-lang/rust/issues/49912
Unblocks https://github.com/rust-lang/rust/pull/62086
Unblocks https://github.com/rust-lang/rust/pull/61000
Diffstat (limited to 'src/libsyntax_ext')
-rw-r--r--src/libsyntax_ext/asm.rs9
-rw-r--r--src/libsyntax_ext/concat_idents.rs11
-rw-r--r--src/libsyntax_ext/deriving/decodable.rs2
-rw-r--r--src/libsyntax_ext/deriving/encodable.rs2
-rw-r--r--src/libsyntax_ext/deriving/mod.rs66
-rw-r--r--src/libsyntax_ext/format.rs47
-rw-r--r--src/libsyntax_ext/global_asm.rs12
-rw-r--r--src/libsyntax_ext/lib.rs84
-rw-r--r--src/libsyntax_ext/log_syntax.rs12
-rw-r--r--src/libsyntax_ext/proc_macro_server.rs4
-rw-r--r--src/libsyntax_ext/test_case.rs9
-rw-r--r--src/libsyntax_ext/trace_macros.rs11
12 files changed, 122 insertions, 147 deletions
diff --git a/src/libsyntax_ext/asm.rs b/src/libsyntax_ext/asm.rs
index b015815ac9c..c1c2732605c 100644
--- a/src/libsyntax_ext/asm.rs
+++ b/src/libsyntax_ext/asm.rs
@@ -8,7 +8,6 @@ use errors::DiagnosticBuilder;
 
 use syntax::ast;
 use syntax::ext::base::{self, *};
-use syntax::feature_gate;
 use syntax::parse;
 use syntax::parse::token::{self, Token};
 use syntax::ptr::P;
@@ -46,14 +45,6 @@ pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt<'_>,
                        sp: Span,
                        tts: &[tokenstream::TokenTree])
                        -> Box<dyn base::MacResult + 'cx> {
-    if !cx.ecfg.enable_asm() {
-        feature_gate::emit_feature_err(&cx.parse_sess,
-                                       sym::asm,
-                                       sp,
-                                       feature_gate::GateIssue::Language,
-                                       feature_gate::EXPLAIN_ASM);
-    }
-
     let mut inline_asm = match parse_inline_asm(cx, sp, tts) {
         Ok(Some(inline_asm)) => inline_asm,
         Ok(None) => return DummyResult::expr(sp),
diff --git a/src/libsyntax_ext/concat_idents.rs b/src/libsyntax_ext/concat_idents.rs
index 8f061abc77b..df919141603 100644
--- a/src/libsyntax_ext/concat_idents.rs
+++ b/src/libsyntax_ext/concat_idents.rs
@@ -2,25 +2,16 @@ use rustc_data_structures::thin_vec::ThinVec;
 
 use syntax::ast;
 use syntax::ext::base::{self, *};
-use syntax::feature_gate;
 use syntax::parse::token::{self, Token};
 use syntax::ptr::P;
 use syntax_pos::Span;
-use syntax_pos::symbol::{Symbol, sym};
+use syntax_pos::symbol::Symbol;
 use syntax::tokenstream::TokenTree;
 
 pub fn expand_syntax_ext<'cx>(cx: &'cx mut ExtCtxt<'_>,
                               sp: Span,
                               tts: &[TokenTree])
                               -> Box<dyn base::MacResult + 'cx> {
-    if !cx.ecfg.enable_concat_idents() {
-        feature_gate::emit_feature_err(&cx.parse_sess,
-                                       sym::concat_idents,
-                                       sp,
-                                       feature_gate::GateIssue::Language,
-                                       feature_gate::EXPLAIN_CONCAT_IDENTS);
-    }
-
     if tts.is_empty() {
         cx.span_err(sp, "concat_idents! takes 1 or more arguments.");
         return DummyResult::any(sp);
diff --git a/src/libsyntax_ext/deriving/decodable.rs b/src/libsyntax_ext/deriving/decodable.rs
index d773f3ff7bc..8009f42b8cf 100644
--- a/src/libsyntax_ext/deriving/decodable.rs
+++ b/src/libsyntax_ext/deriving/decodable.rs
@@ -3,7 +3,6 @@
 use crate::deriving::{self, pathvec_std};
 use crate::deriving::generic::*;
 use crate::deriving::generic::ty::*;
-use crate::deriving::warn_if_deprecated;
 
 use syntax::ast;
 use syntax::ast::{Expr, MetaItem, Mutability};
@@ -26,7 +25,6 @@ pub fn expand_deriving_decodable(cx: &mut ExtCtxt<'_>,
                                  mitem: &MetaItem,
                                  item: &Annotatable,
                                  push: &mut dyn FnMut(Annotatable)) {
-    warn_if_deprecated(cx, span, "Decodable");
     expand_deriving_decodable_imp(cx, span, mitem, item, push, "serialize")
 }
 
diff --git a/src/libsyntax_ext/deriving/encodable.rs b/src/libsyntax_ext/deriving/encodable.rs
index faaedba3e77..cd89a42cf82 100644
--- a/src/libsyntax_ext/deriving/encodable.rs
+++ b/src/libsyntax_ext/deriving/encodable.rs
@@ -85,7 +85,6 @@
 use crate::deriving::{self, pathvec_std};
 use crate::deriving::generic::*;
 use crate::deriving::generic::ty::*;
-use crate::deriving::warn_if_deprecated;
 
 use syntax::ast::{Expr, ExprKind, MetaItem, Mutability};
 use syntax::ext::base::{Annotatable, ExtCtxt};
@@ -107,7 +106,6 @@ pub fn expand_deriving_encodable(cx: &mut ExtCtxt<'_>,
                                  mitem: &MetaItem,
                                  item: &Annotatable,
                                  push: &mut dyn FnMut(Annotatable)) {
-    warn_if_deprecated(cx, span, "Encodable");
     expand_deriving_encodable_imp(cx, span, mitem, item, push, "serialize")
 }
 
diff --git a/src/libsyntax_ext/deriving/mod.rs b/src/libsyntax_ext/deriving/mod.rs
index aa9913d436c..e491e93256d 100644
--- a/src/libsyntax_ext/deriving/mod.rs
+++ b/src/libsyntax_ext/deriving/mod.rs
@@ -2,6 +2,7 @@
 
 use rustc_data_structures::sync::Lrc;
 use syntax::ast::{self, MetaItem};
+use syntax::attr::Deprecation;
 use syntax::edition::Edition;
 use syntax::ext::base::{Annotatable, ExtCtxt, Resolver, MultiItemModifier};
 use syntax::ext::base::{SyntaxExtension, SyntaxExtensionKind};
@@ -60,10 +61,10 @@ impl MultiItemModifier for BuiltinDerive {
 }
 
 macro_rules! derive_traits {
-    ($( $name:expr => $func:path, )+) => {
+    ($( [$deprecation:expr] $name:ident => $func:path, )+) => {
         pub fn is_builtin_trait(name: ast::Name) -> bool {
-            match &*name.as_str() {
-                $( $name )|+ => true,
+            match name {
+                $( sym::$name )|+ => true,
                 _ => false,
             }
         }
@@ -79,8 +80,12 @@ macro_rules! derive_traits {
 
             $(
                 resolver.add_builtin(
-                    ast::Ident::with_empty_ctxt(Symbol::intern($name)),
+                    ast::Ident::with_empty_ctxt(sym::$name),
                     Lrc::new(SyntaxExtension {
+                        deprecation: $deprecation.map(|msg| Deprecation {
+                            since: Some(Symbol::intern("1.0.0")),
+                            note: Some(Symbol::intern(msg)),
+                        }),
                         allow_internal_unstable: allow_internal_unstable.clone(),
                         ..SyntaxExtension::default(
                             SyntaxExtensionKind::LegacyDerive(Box::new(BuiltinDerive($func))),
@@ -94,42 +99,41 @@ macro_rules! derive_traits {
 }
 
 derive_traits! {
-    "Clone" => clone::expand_deriving_clone,
+    [None]
+    Clone => clone::expand_deriving_clone,
 
-    "Hash" => hash::expand_deriving_hash,
+    [None]
+    Hash => hash::expand_deriving_hash,
 
-    "RustcEncodable" => encodable::expand_deriving_rustc_encodable,
+    [None]
+    RustcEncodable => encodable::expand_deriving_rustc_encodable,
 
-    "RustcDecodable" => decodable::expand_deriving_rustc_decodable,
+    [None]
+    RustcDecodable => decodable::expand_deriving_rustc_decodable,
 
-    "PartialEq" => partial_eq::expand_deriving_partial_eq,
-    "Eq" => eq::expand_deriving_eq,
-    "PartialOrd" => partial_ord::expand_deriving_partial_ord,
-    "Ord" => ord::expand_deriving_ord,
+    [None]
+    PartialEq => partial_eq::expand_deriving_partial_eq,
+    [None]
+    Eq => eq::expand_deriving_eq,
+    [None]
+    PartialOrd => partial_ord::expand_deriving_partial_ord,
+    [None]
+    Ord => ord::expand_deriving_ord,
 
-    "Debug" => debug::expand_deriving_debug,
+    [None]
+    Debug => debug::expand_deriving_debug,
 
-    "Default" => default::expand_deriving_default,
+    [None]
+    Default => default::expand_deriving_default,
 
-    "Copy" => bounds::expand_deriving_copy,
+    [None]
+    Copy => bounds::expand_deriving_copy,
 
     // deprecated
-    "Encodable" => encodable::expand_deriving_encodable,
-    "Decodable" => decodable::expand_deriving_decodable,
-}
-
-#[inline] // because `name` is a compile-time constant
-fn warn_if_deprecated(ecx: &mut ExtCtxt<'_>, sp: Span, name: &str) {
-    if let Some(replacement) = match name {
-        "Encodable" => Some("RustcEncodable"),
-        "Decodable" => Some("RustcDecodable"),
-        _ => None,
-    } {
-        ecx.span_warn(sp,
-                      &format!("derive({}) is deprecated in favor of derive({})",
-                               name,
-                               replacement));
-    }
+    [Some("derive(Encodable) is deprecated in favor of derive(RustcEncodable)")]
+    Encodable => encodable::expand_deriving_encodable,
+    [Some("derive(Decodable) is deprecated in favor of derive(RustcDecodable)")]
+    Decodable => decodable::expand_deriving_decodable,
 }
 
 /// Construct a name for the inner type parameter that can't collide with any type parameters of
diff --git a/src/libsyntax_ext/format.rs b/src/libsyntax_ext/format.rs
index a5f96559ca8..c3dbd48cc6e 100644
--- a/src/libsyntax_ext/format.rs
+++ b/src/libsyntax_ext/format.rs
@@ -9,7 +9,6 @@ use errors::Applicability;
 use syntax::ast;
 use syntax::ext::base::{self, *};
 use syntax::ext::build::AstBuilder;
-use syntax::feature_gate;
 use syntax::parse::token;
 use syntax::ptr::P;
 use syntax::symbol::{Symbol, sym};
@@ -686,14 +685,16 @@ impl<'a, 'b> Context<'a, 'b> {
     }
 }
 
-pub fn expand_format_args<'cx>(ecx: &'cx mut ExtCtxt<'_>,
-                               mut sp: Span,
-                               tts: &[tokenstream::TokenTree])
-                               -> Box<dyn base::MacResult + 'cx> {
+fn expand_format_args_impl<'cx>(
+    ecx: &'cx mut ExtCtxt<'_>,
+    mut sp: Span,
+    tts: &[tokenstream::TokenTree],
+    nl: bool,
+) -> Box<dyn base::MacResult + 'cx> {
     sp = sp.apply_mark(ecx.current_expansion.mark);
     match parse_args(ecx, sp, tts) {
         Ok((efmt, args, names)) => {
-            MacEager::expr(expand_preparsed_format_args(ecx, sp, efmt, args, names, false))
+            MacEager::expr(expand_preparsed_format_args(ecx, sp, efmt, args, names, nl))
         }
         Err(mut err) => {
             err.emit();
@@ -702,34 +703,20 @@ pub fn expand_format_args<'cx>(ecx: &'cx mut ExtCtxt<'_>,
     }
 }
 
+pub fn expand_format_args<'cx>(
+    ecx: &'cx mut ExtCtxt<'_>,
+    sp: Span,
+    tts: &[tokenstream::TokenTree],
+) -> Box<dyn base::MacResult + 'cx> {
+    expand_format_args_impl(ecx, sp, tts, false)
+}
+
 pub fn expand_format_args_nl<'cx>(
     ecx: &'cx mut ExtCtxt<'_>,
-    mut sp: Span,
+    sp: Span,
     tts: &[tokenstream::TokenTree],
 ) -> Box<dyn base::MacResult + 'cx> {
-    //if !ecx.ecfg.enable_allow_internal_unstable() {
-
-    // For some reason, the only one that actually works for `println` is the first check
-    if !sp.allows_unstable(sym::format_args_nl) // the span is marked `#[allow_insternal_unsable]`
-        && !ecx.ecfg.enable_allow_internal_unstable()  // NOTE: when is this enabled?
-        && !ecx.ecfg.enable_format_args_nl()  // enabled using `#[feature(format_args_nl]`
-    {
-        feature_gate::emit_feature_err(&ecx.parse_sess,
-                                       sym::format_args_nl,
-                                       sp,
-                                       feature_gate::GateIssue::Language,
-                                       feature_gate::EXPLAIN_FORMAT_ARGS_NL);
-    }
-    sp = sp.apply_mark(ecx.current_expansion.mark);
-    match parse_args(ecx, sp, tts) {
-        Ok((efmt, args, names)) => {
-            MacEager::expr(expand_preparsed_format_args(ecx, sp, efmt, args, names, true))
-        }
-        Err(mut err) => {
-            err.emit();
-            DummyResult::expr(sp)
-        }
-    }
+    expand_format_args_impl(ecx, sp, tts, true)
 }
 
 /// Take the various parts of `format_args!(efmt, args..., name=names...)`
diff --git a/src/libsyntax_ext/global_asm.rs b/src/libsyntax_ext/global_asm.rs
index 5220143a3cc..112192fac5d 100644
--- a/src/libsyntax_ext/global_asm.rs
+++ b/src/libsyntax_ext/global_asm.rs
@@ -13,27 +13,15 @@ use errors::DiagnosticBuilder;
 use syntax::ast;
 use syntax::source_map::respan;
 use syntax::ext::base::{self, *};
-use syntax::feature_gate;
 use syntax::parse::token;
 use syntax::ptr::P;
-use syntax::symbol::{Symbol, sym};
 use syntax_pos::Span;
 use syntax::tokenstream;
 use smallvec::smallvec;
 
-pub const MACRO: Symbol = sym::global_asm;
-
 pub fn expand_global_asm<'cx>(cx: &'cx mut ExtCtxt<'_>,
                               sp: Span,
                               tts: &[tokenstream::TokenTree]) -> Box<dyn base::MacResult + 'cx> {
-    if !cx.ecfg.enable_global_asm() {
-        feature_gate::emit_feature_err(&cx.parse_sess,
-                                       MACRO,
-                                       sp,
-                                       feature_gate::GateIssue::Language,
-                                       feature_gate::EXPLAIN_GLOBAL_ASM);
-    }
-
     match parse_global_asm(cx, sp, tts) {
         Ok(Some(global_asm)) => {
             MacEager::items(smallvec![P(ast::Item {
diff --git a/src/libsyntax_ext/lib.rs b/src/libsyntax_ext/lib.rs
index 77b69ddd303..62530f4fe7b 100644
--- a/src/libsyntax_ext/lib.rs
+++ b/src/libsyntax_ext/lib.rs
@@ -41,12 +41,29 @@ pub mod proc_macro_impl;
 
 use rustc_data_structures::sync::Lrc;
 use syntax::ast;
-
+use syntax::attr::Stability;
 use syntax::ext::base::MacroExpanderFn;
 use syntax::ext::base::{NamedSyntaxExtension, SyntaxExtension, SyntaxExtensionKind};
 use syntax::edition::Edition;
 use syntax::symbol::{sym, Symbol};
 
+const EXPLAIN_ASM: &str =
+    "inline assembly is not stable enough for use and is subject to change";
+const EXPLAIN_GLOBAL_ASM: &str =
+    "`global_asm!` is not stable enough for use and is subject to change";
+const EXPLAIN_CUSTOM_TEST_FRAMEWORKS: &str =
+    "custom test frameworks are an unstable feature";
+const EXPLAIN_LOG_SYNTAX: &str =
+    "`log_syntax!` is not stable enough for use and is subject to change";
+const EXPLAIN_CONCAT_IDENTS: &str =
+    "`concat_idents` is not stable enough for use and is subject to change";
+const EXPLAIN_FORMAT_ARGS_NL: &str =
+    "`format_args_nl` is only for internal language use and is subject to change";
+const EXPLAIN_TRACE_MACROS: &str =
+    "`trace_macros` is not stable enough for use and is subject to change";
+const EXPLAIN_UNSTABLE_COLUMN: &str =
+    "internal implementation detail of the `column` macro";
+
 pub fn register_builtins(resolver: &mut dyn syntax::ext::base::Resolver,
                          user_exts: Vec<NamedSyntaxExtension>,
                          edition: Edition) {
@@ -57,23 +74,27 @@ pub fn register_builtins(resolver: &mut dyn syntax::ext::base::Resolver,
     };
     macro_rules! register {
         ($( $name:ident: $f:expr, )*) => { $(
-            register(Symbol::intern(stringify!($name)), SyntaxExtension::default(
+            register(sym::$name, SyntaxExtension::default(
                 SyntaxExtensionKind::LegacyBang(Box::new($f as MacroExpanderFn)), edition
             ));
         )* }
     }
-    macro_rules! register_attr {
-        ($( $name:ident: $f:expr, )*) => { $(
-            register(Symbol::intern(stringify!($name)), SyntaxExtension::default(
-                SyntaxExtensionKind::LegacyAttr(Box::new($f)), edition
-            ));
+    macro_rules! register_unstable {
+        ($( [$feature:expr, $reason:expr, $issue:expr] $name:ident: $f:expr, )*) => { $(
+            register(sym::$name, SyntaxExtension {
+                stability: Some(Stability::unstable(
+                    $feature, Some(Symbol::intern($reason)), $issue
+                )),
+                ..SyntaxExtension::default(
+                    SyntaxExtensionKind::LegacyBang(Box::new($f as MacroExpanderFn)), edition
+                )
+            });
         )* }
     }
 
     use syntax::ext::source_util::*;
     register! {
         line: expand_line,
-        __rust_unstable_column: expand_column_gated,
         column: expand_column,
         file: expand_file,
         stringify: expand_stringify,
@@ -81,35 +102,60 @@ pub fn register_builtins(resolver: &mut dyn syntax::ext::base::Resolver,
         include_str: expand_include_str,
         include_bytes: expand_include_bytes,
         module_path: expand_mod,
-
-        asm: asm::expand_asm,
-        global_asm: global_asm::expand_global_asm,
         cfg: cfg::expand_cfg,
         concat: concat::expand_syntax_ext,
-        concat_idents: concat_idents::expand_syntax_ext,
         env: env::expand_env,
         option_env: env::expand_option_env,
-        log_syntax: log_syntax::expand_syntax_ext,
-        trace_macros: trace_macros::expand_trace_macros,
         compile_error: compile_error::expand_compile_error,
         assert: assert::expand_assert,
     }
 
-    register_attr! {
-        test_case: test_case::expand,
-        test: test::expand_test,
-        bench: test::expand_bench,
+    register_unstable! {
+        [sym::__rust_unstable_column, EXPLAIN_UNSTABLE_COLUMN, 0]
+        __rust_unstable_column: expand_column,
+        [sym::asm, EXPLAIN_ASM, 29722]
+        asm: asm::expand_asm,
+        [sym::global_asm, EXPLAIN_GLOBAL_ASM, 35119]
+        global_asm: global_asm::expand_global_asm,
+        [sym::concat_idents, EXPLAIN_CONCAT_IDENTS, 29599]
+        concat_idents: concat_idents::expand_syntax_ext,
+        [sym::log_syntax, EXPLAIN_LOG_SYNTAX, 29598]
+        log_syntax: log_syntax::expand_syntax_ext,
+        [sym::trace_macros, EXPLAIN_TRACE_MACROS, 29598]
+        trace_macros: trace_macros::expand_trace_macros,
     }
 
+    register(sym::test_case, SyntaxExtension {
+        stability: Some(Stability::unstable(
+            sym::custom_test_frameworks,
+            Some(Symbol::intern(EXPLAIN_CUSTOM_TEST_FRAMEWORKS)),
+            50297,
+        )),
+        ..SyntaxExtension::default(
+            SyntaxExtensionKind::LegacyAttr(Box::new(test_case::expand)), edition
+        )
+    });
+    register(sym::test, SyntaxExtension::default(
+        SyntaxExtensionKind::LegacyAttr(Box::new(test::expand_test)), edition
+    ));
+    register(sym::bench, SyntaxExtension::default(
+        SyntaxExtensionKind::LegacyAttr(Box::new(test::expand_bench)), edition
+    ));
+
     // format_args uses `unstable` things internally.
     let allow_internal_unstable = Some([sym::fmt_internals][..].into());
-    register(Symbol::intern("format_args"), SyntaxExtension {
+    register(sym::format_args, SyntaxExtension {
         allow_internal_unstable: allow_internal_unstable.clone(),
         ..SyntaxExtension::default(
             SyntaxExtensionKind::LegacyBang(Box::new(format::expand_format_args)), edition
         )
     });
     register(sym::format_args_nl, SyntaxExtension {
+        stability: Some(Stability::unstable(
+            sym::format_args_nl,
+            Some(Symbol::intern(EXPLAIN_FORMAT_ARGS_NL)),
+            0,
+        )),
         allow_internal_unstable,
         ..SyntaxExtension::default(
             SyntaxExtensionKind::LegacyBang(Box::new(format::expand_format_args_nl)), edition
diff --git a/src/libsyntax_ext/log_syntax.rs b/src/libsyntax_ext/log_syntax.rs
index 1be3990837c..cbdfd08b497 100644
--- a/src/libsyntax_ext/log_syntax.rs
+++ b/src/libsyntax_ext/log_syntax.rs
@@ -1,22 +1,12 @@
 use syntax::ext::base;
-use syntax::feature_gate;
 use syntax::print;
 use syntax::tokenstream;
-use syntax::symbol::sym;
 use syntax_pos;
 
-pub fn expand_syntax_ext<'cx>(cx: &'cx mut base::ExtCtxt<'_>,
+pub fn expand_syntax_ext<'cx>(_cx: &'cx mut base::ExtCtxt<'_>,
                               sp: syntax_pos::Span,
                               tts: &[tokenstream::TokenTree])
                               -> Box<dyn base::MacResult + 'cx> {
-    if !cx.ecfg.enable_log_syntax() {
-        feature_gate::emit_feature_err(&cx.parse_sess,
-                                       sym::log_syntax,
-                                       sp,
-                                       feature_gate::GateIssue::Language,
-                                       feature_gate::EXPLAIN_LOG_SYNTAX);
-    }
-
     println!("{}", print::pprust::tts_to_string(tts));
 
     // any so that `log_syntax` can be invoked as an expression and item.
diff --git a/src/libsyntax_ext/proc_macro_server.rs b/src/libsyntax_ext/proc_macro_server.rs
index c9d99e5831a..e5027354527 100644
--- a/src/libsyntax_ext/proc_macro_server.rs
+++ b/src/libsyntax_ext/proc_macro_server.rs
@@ -548,10 +548,10 @@ impl server::Literal for Rustc<'_> {
         self.lit(token::Float, Symbol::intern(n), None)
     }
     fn f32(&mut self, n: &str) -> Self::Literal {
-        self.lit(token::Float, Symbol::intern(n), Some(Symbol::intern("f32")))
+        self.lit(token::Float, Symbol::intern(n), Some(sym::f32))
     }
     fn f64(&mut self, n: &str) -> Self::Literal {
-        self.lit(token::Float, Symbol::intern(n), Some(Symbol::intern("f64")))
+        self.lit(token::Float, Symbol::intern(n), Some(sym::f64))
     }
     fn string(&mut self, string: &str) -> Self::Literal {
         let mut escaped = String::new();
diff --git a/src/libsyntax_ext/test_case.rs b/src/libsyntax_ext/test_case.rs
index 6e3bc05b65e..186673c142f 100644
--- a/src/libsyntax_ext/test_case.rs
+++ b/src/libsyntax_ext/test_case.rs
@@ -17,7 +17,6 @@ use syntax::source_map::respan;
 use syntax::symbol::sym;
 use syntax_pos::Span;
 use syntax::source_map::{ExpnInfo, MacroAttribute};
-use syntax::feature_gate;
 
 pub fn expand(
     ecx: &mut ExtCtxt<'_>,
@@ -25,14 +24,6 @@ pub fn expand(
     _meta_item: &ast::MetaItem,
     anno_item: Annotatable
 ) -> Vec<Annotatable> {
-    if !ecx.ecfg.enable_custom_test_frameworks() {
-        feature_gate::emit_feature_err(&ecx.parse_sess,
-                                       sym::custom_test_frameworks,
-                                       attr_sp,
-                                       feature_gate::GateIssue::Language,
-                                       feature_gate::EXPLAIN_CUSTOM_TEST_FRAMEWORKS);
-    }
-
     if !ecx.ecfg.should_test { return vec![]; }
 
     let sp = {
diff --git a/src/libsyntax_ext/trace_macros.rs b/src/libsyntax_ext/trace_macros.rs
index 512513e9b41..0dce8a36f4c 100644
--- a/src/libsyntax_ext/trace_macros.rs
+++ b/src/libsyntax_ext/trace_macros.rs
@@ -1,6 +1,5 @@
 use syntax::ext::base::{self, ExtCtxt};
-use syntax::feature_gate;
-use syntax::symbol::{kw, sym};
+use syntax::symbol::kw;
 use syntax_pos::Span;
 use syntax::tokenstream::TokenTree;
 
@@ -8,14 +7,6 @@ pub fn expand_trace_macros(cx: &mut ExtCtxt<'_>,
                            sp: Span,
                            tt: &[TokenTree])
                            -> Box<dyn base::MacResult + 'static> {
-    if !cx.ecfg.enable_trace_macros() {
-        feature_gate::emit_feature_err(&cx.parse_sess,
-                                       sym::trace_macros,
-                                       sp,
-                                       feature_gate::GateIssue::Language,
-                                       feature_gate::EXPLAIN_TRACE_MACROS);
-    }
-
     match tt {
         [TokenTree::Token(token)] if token.is_keyword(kw::True) => {
             cx.set_trace_macros(true);