From 5dd802b35ebaca11cca2849379c7aba8e45731b4 Mon Sep 17 00:00:00 2001 From: Muhammad Mominul Huque Date: Thu, 2 Aug 2018 20:40:16 +0600 Subject: [PATCH 1/2] Stabilize tool_attributes --- .../src/language-features/tool-attributes.md | 26 ------------------- src/libsyntax/feature_gate.rs | 6 ++--- src/test/compile-fail/unknown-tool-name.rs | 1 - src/test/run-pass/tool_attributes.rs | 1 - src/test/ui/feature-gate-tool_attributes.rs | 15 ----------- .../ui/feature-gate-tool_attributes.stderr | 11 -------- 6 files changed, 2 insertions(+), 58 deletions(-) delete mode 100644 src/doc/unstable-book/src/language-features/tool-attributes.md delete mode 100644 src/test/ui/feature-gate-tool_attributes.rs delete mode 100644 src/test/ui/feature-gate-tool_attributes.stderr diff --git a/src/doc/unstable-book/src/language-features/tool-attributes.md b/src/doc/unstable-book/src/language-features/tool-attributes.md deleted file mode 100644 index 15fc84a3e2a3d..0000000000000 --- a/src/doc/unstable-book/src/language-features/tool-attributes.md +++ /dev/null @@ -1,26 +0,0 @@ -# `tool_attributes` - -The tracking issue for this feature is: [#44690] - -[#44690]: https://github.com/rust-lang/rust/issues/44690 - ------------------------- - -Tool attributes let you use scoped attributes to control the behavior -of certain tools. - -Currently tool names which can be appear in scoped attributes are restricted to -`clippy` and `rustfmt`. - -## An example - -```rust -#![feature(tool_attributes)] - -#[rustfmt::skip] -fn foo() { println!("hello, world"); } - -fn main() { - foo(); -} -``` diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 40fb2c69e57cb..8978353bdfb23 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -447,8 +447,6 @@ declare_features! ( // Access to crate names passed via `--extern` through prelude (active, extern_prelude, "1.27.0", Some(44660), Some(Edition::Edition2018)), - // Scoped attributes - (active, tool_attributes, "1.25.0", Some(44690), None), // Scoped lints (active, tool_lints, "1.28.0", Some(44690), None), @@ -619,6 +617,8 @@ declare_features! ( (accepted, repr_transparent, "1.28.0", Some(43036), None), // Defining procedural macros in `proc-macro` crates (accepted, proc_macro, "1.29.0", Some(38356), None), + // Scoped attributes + (accepted, tool_attributes, "1.29.0", Some(44690), None), ); // If you change this, please modify src/doc/unstable-book as well. You must @@ -1199,8 +1199,6 @@ impl<'a> Context<'a> { // so we skip this then if !is_macro { if attr.is_scoped() { - gate_feature!(self, tool_attributes, attr.span, - &format!("scoped attribute `{}` is experimental", attr.path)); if attr::is_known_tool(attr) { attr::mark_used(attr); } else { diff --git a/src/test/compile-fail/unknown-tool-name.rs b/src/test/compile-fail/unknown-tool-name.rs index c2192a21d9050..356dcf95c7050 100644 --- a/src/test/compile-fail/unknown-tool-name.rs +++ b/src/test/compile-fail/unknown-tool-name.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(tool_attributes)] #![foo::bar] //~ ERROR an unknown tool name found in scoped attribute: `foo::bar`. [E0694] diff --git a/src/test/run-pass/tool_attributes.rs b/src/test/run-pass/tool_attributes.rs index eb13930de403f..9d8e56e44cbb3 100644 --- a/src/test/run-pass/tool_attributes.rs +++ b/src/test/run-pass/tool_attributes.rs @@ -10,7 +10,6 @@ // Scoped attributes should not trigger an unused attributes lint. -#![feature(tool_attributes)] #![deny(unused_attributes)] fn main() { diff --git a/src/test/ui/feature-gate-tool_attributes.rs b/src/test/ui/feature-gate-tool_attributes.rs deleted file mode 100644 index 2b7cf56d93812..0000000000000 --- a/src/test/ui/feature-gate-tool_attributes.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -fn main() { - #[rustfmt::skip] //~ ERROR scoped attribute `rustfmt::skip` is experimental - let x = 3 - ; -} diff --git a/src/test/ui/feature-gate-tool_attributes.stderr b/src/test/ui/feature-gate-tool_attributes.stderr deleted file mode 100644 index da89c4a5ef692..0000000000000 --- a/src/test/ui/feature-gate-tool_attributes.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0658]: scoped attribute `rustfmt::skip` is experimental (see issue #44690) - --> $DIR/feature-gate-tool_attributes.rs:12:5 - | -LL | #[rustfmt::skip] //~ ERROR scoped attribute `rustfmt::skip` is experimental - | ^^^^^^^^^^^^^^^^ - | - = help: add #![feature(tool_attributes)] to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0658`. From ca26f7c4da0117f1a74f04abbfb3d878f7f3870e Mon Sep 17 00:00:00 2001 From: Muhammad Mominul Huque Date: Thu, 9 Aug 2018 23:03:34 +0600 Subject: [PATCH 2/2] Fix compile-fail tests --- .../compile-fail/feature-gate-tool_attributes.rs | 15 --------------- .../compile-fail/unknown_tool_attributes-1.rs | 3 +-- 2 files changed, 1 insertion(+), 17 deletions(-) delete mode 100644 src/test/compile-fail/feature-gate-tool_attributes.rs diff --git a/src/test/compile-fail/feature-gate-tool_attributes.rs b/src/test/compile-fail/feature-gate-tool_attributes.rs deleted file mode 100644 index 5a7536ca3304b..0000000000000 --- a/src/test/compile-fail/feature-gate-tool_attributes.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -fn main() { - #[rustfmt::skip] //~ ERROR scoped attribute `rustfmt::skip` is experimental - let x = - 3; -} diff --git a/src/test/compile-fail/unknown_tool_attributes-1.rs b/src/test/compile-fail/unknown_tool_attributes-1.rs index ba38c297a1127..f0e4539301a40 100644 --- a/src/test/compile-fail/unknown_tool_attributes-1.rs +++ b/src/test/compile-fail/unknown_tool_attributes-1.rs @@ -13,6 +13,5 @@ #![feature(custom_attributes)] #[foo::bar] -//~^ ERROR scoped attribute `foo::bar` is experimental (see issue #44690) [E0658] -//~^^ ERROR an unknown tool name found in scoped attribute: `foo::bar`. [E0694] +//~^ ERROR an unknown tool name found in scoped attribute: `foo::bar`. [E0694] fn main() {}