forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#70364 - petrochenkov:nofrustc, r=Centril
resolve: Remove `rustc_attrs` as a standalone feature gate Now it only gates specific built-in attributes. So if you want to make a rustc attribute, make it a built-in (this was already the case in practice for some time).
- Loading branch information
Showing
10 changed files
with
75 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
// run-pass | ||
// check-pass | ||
// aux-build:lint-for-crate-rpass.rs | ||
// ignore-stage1 | ||
// compile-flags: -D crate-not-okay | ||
|
||
#![feature(plugin, register_attr, custom_inner_attributes, rustc_attrs)] | ||
#![feature(plugin, register_attr, custom_inner_attributes)] | ||
|
||
#![register_attr( | ||
rustc_crate_okay, | ||
rustc_crate_blue, | ||
rustc_crate_red, | ||
rustc_crate_grey, | ||
rustc_crate_green, | ||
crate_okay, | ||
crate_blue, | ||
crate_red, | ||
crate_grey, | ||
crate_green, | ||
)] | ||
|
||
#![plugin(lint_for_crate_rpass)] //~ WARNING compiler plugins are deprecated | ||
#![rustc_crate_okay] | ||
#![rustc_crate_blue] | ||
#![rustc_crate_red] | ||
#![rustc_crate_grey] | ||
#![rustc_crate_green] | ||
#![crate_okay] | ||
#![crate_blue] | ||
#![crate_red] | ||
#![crate_grey] | ||
#![crate_green] | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// force-host | ||
// no-prefer-dynamic | ||
|
||
#![deny(unused)] | ||
#![crate_type = "proc-macro"] | ||
|
||
extern crate proc_macro; | ||
use proc_macro::*; | ||
|
||
#[proc_macro_attribute] | ||
pub fn duplicate(attr: TokenStream, item: TokenStream) -> TokenStream { | ||
let mut new_name = Some(attr.into_iter().nth(0).unwrap()); | ||
let mut encountered_idents = 0; | ||
let input = item.to_string(); | ||
let ret = item | ||
.into_iter() | ||
.map(move |token| match token { | ||
TokenTree::Ident(_) if encountered_idents == 1 => { | ||
encountered_idents += 1; | ||
new_name.take().unwrap() | ||
} | ||
TokenTree::Ident(_) => { | ||
encountered_idents += 1; | ||
token | ||
} | ||
_ => token, | ||
}) | ||
.collect::<TokenStream>(); | ||
let mut input_again = input.parse::<TokenStream>().unwrap(); | ||
input_again.extend(ret); | ||
input_again | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,10 @@ | ||
error[E0658]: attributes starting with `rustc` are reserved for use by the `rustc` compiler | ||
error: attributes starting with `rustc` are reserved for use by the `rustc` compiler | ||
--> $DIR/expand-to-unstable-2.rs:10:10 | ||
| | ||
LL | #[derive(Unstable)] | ||
| ^^^^^^^^ | ||
| | ||
= help: add `#![feature(rustc_attrs)]` to the crate attributes to enable | ||
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0658`. |
29 changes: 13 additions & 16 deletions
29
...i-fulldeps/macro-crate-multi-decorator.rs → ...proc-macro/macro-crate-multi-decorator.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters