diff options
| author | bors <bors@rust-lang.org> | 2019-06-08 23:17:06 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-06-08 23:17:06 +0000 |
| commit | 053666f9062d71091ea7970dcbad5963097191a3 (patch) | |
| tree | fa334bba0a1d0e0b7546d5e3a2c51242d0245e27 /src/test/ui | |
| parent | 991c719a1d0f95c37ed7ea56bdb38bcc2a6246b9 (diff) | |
| parent | e0c825cc72e3d7834e3493e12e673c25606c8293 (diff) | |
| download | rust-053666f9062d71091ea7970dcbad5963097191a3.tar.gz rust-053666f9062d71091ea7970dcbad5963097191a3.zip | |
Auto merge of #61672 - Centril:rollup-jxo89ir, r=Centril
Rollup of 6 pull requests Successful merges: - #61646 (Remove useless allocations in macro_rules follow logic.) - #61658 (remove useless ident() functions in const tests) - #61660 (Minimize use of `#![feature(custom_attribute)]`) - #61666 (Add test for trait ICE) - #61669 ( syntax: Remove `Deref` impl from `Token`) - #61670 (Update RLS) Failed merges: r? @ghost
Diffstat (limited to 'src/test/ui')
45 files changed, 656 insertions, 284 deletions
diff --git a/src/test/ui/attr-eq-token-tree.rs b/src/test/ui/attr-eq-token-tree.rs index 6aacb9d572a..c301492b9e2 100644 --- a/src/test/ui/attr-eq-token-tree.rs +++ b/src/test/ui/attr-eq-token-tree.rs @@ -1,4 +1,2 @@ -#![feature(custom_attribute)] - #[my_attr = !] //~ ERROR unexpected token: `!` fn main() {} diff --git a/src/test/ui/attr-eq-token-tree.stderr b/src/test/ui/attr-eq-token-tree.stderr index 571779dfa1a..bb37c2e0cc4 100644 --- a/src/test/ui/attr-eq-token-tree.stderr +++ b/src/test/ui/attr-eq-token-tree.stderr @@ -1,5 +1,5 @@ error: unexpected token: `!` - --> $DIR/attr-eq-token-tree.rs:3:13 + --> $DIR/attr-eq-token-tree.rs:1:13 | LL | #[my_attr = !] | ^ diff --git a/src/test/ui/attributes/attr-before-view-item.rs b/src/test/ui/attributes/attr-before-view-item.rs new file mode 100644 index 00000000000..fc040bd1a5d --- /dev/null +++ b/src/test/ui/attributes/attr-before-view-item.rs @@ -0,0 +1,10 @@ +// compile-pass +// pretty-expanded FIXME #23616 + +#![feature(rustc_attrs)] +#![feature(test)] + +#[rustc_dummy = "bar"] +extern crate test; + +fn main() {} diff --git a/src/test/ui/attributes/attr-before-view-item2.rs b/src/test/ui/attributes/attr-before-view-item2.rs new file mode 100644 index 00000000000..c7fad3802e9 --- /dev/null +++ b/src/test/ui/attributes/attr-before-view-item2.rs @@ -0,0 +1,12 @@ +// compile-pass +// pretty-expanded FIXME #23616 + +#![feature(rustc_attrs)] +#![feature(test)] + +mod m { + #[rustc_dummy = "bar"] + extern crate test; +} + +fn main() {} diff --git a/src/test/ui/attributes/attr-mix-new.rs b/src/test/ui/attributes/attr-mix-new.rs new file mode 100644 index 00000000000..d9cb5510960 --- /dev/null +++ b/src/test/ui/attributes/attr-mix-new.rs @@ -0,0 +1,11 @@ +// compile-pass +// pretty-expanded FIXME #23616 + +#![feature(rustc_attrs)] + +#[rustc_dummy(bar)] +mod foo { + #![feature(globs)] +} + +fn main() {} diff --git a/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-1.rs b/src/test/ui/attributes/attrs-with-no-formal-in-generics-1.rs index ca5fdd9da85..ca5fdd9da85 100644 --- a/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-1.rs +++ b/src/test/ui/attributes/attrs-with-no-formal-in-generics-1.rs diff --git a/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-1.stderr b/src/test/ui/attributes/attrs-with-no-formal-in-generics-1.stderr index 55e7a987784..55e7a987784 100644 --- a/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-1.stderr +++ b/src/test/ui/attributes/attrs-with-no-formal-in-generics-1.stderr diff --git a/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-2.rs b/src/test/ui/attributes/attrs-with-no-formal-in-generics-2.rs index c795612acf0..c795612acf0 100644 --- a/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-2.rs +++ b/src/test/ui/attributes/attrs-with-no-formal-in-generics-2.rs diff --git a/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-2.stderr b/src/test/ui/attributes/attrs-with-no-formal-in-generics-2.stderr index acd0ae3678a..acd0ae3678a 100644 --- a/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-2.stderr +++ b/src/test/ui/attributes/attrs-with-no-formal-in-generics-2.stderr diff --git a/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-3.rs b/src/test/ui/attributes/attrs-with-no-formal-in-generics-3.rs index 3cfc70b4185..3cfc70b4185 100644 --- a/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-3.rs +++ b/src/test/ui/attributes/attrs-with-no-formal-in-generics-3.rs diff --git a/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-3.stderr b/src/test/ui/attributes/attrs-with-no-formal-in-generics-3.stderr index b9ca0097467..b9ca0097467 100644 --- a/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-3.stderr +++ b/src/test/ui/attributes/attrs-with-no-formal-in-generics-3.stderr diff --git a/src/test/ui/attributes/class-attributes-1.rs b/src/test/ui/attributes/class-attributes-1.rs new file mode 100644 index 00000000000..7808367f2c1 --- /dev/null +++ b/src/test/ui/attributes/class-attributes-1.rs @@ -0,0 +1,19 @@ +// compile-pass +// pp-exact - Make sure we actually print the attributes + +#![feature(rustc_attrs)] + +struct Cat { + name: String, +} + +impl Drop for Cat { + #[rustc_dummy] + fn drop(&mut self) { println!("{} landed on hir feet" , self . name); } +} + + +#[rustc_dummy] +fn cat(name: String) -> Cat { Cat{name: name,} } + +fn main() { let _kitty = cat("Spotty".to_string()); } diff --git a/src/test/ui/attributes/class-attributes-2.rs b/src/test/ui/attributes/class-attributes-2.rs new file mode 100644 index 00000000000..348c70f35c3 --- /dev/null +++ b/src/test/ui/attributes/class-attributes-2.rs @@ -0,0 +1,31 @@ +// compile-pass + +#![feature(rustc_attrs)] + +struct Cat { + name: String, +} + +impl Drop for Cat { + #[rustc_dummy] + /** + Actually, cats don't always land on their feet when you drop them. + */ + fn drop(&mut self) { + println!("{} landed on hir feet", self.name); + } +} + +#[rustc_dummy] +/** +Maybe it should technically be a kitten_maker. +*/ +fn cat(name: String) -> Cat { + Cat { + name: name + } +} + +fn main() { + let _kitty = cat("Spotty".to_string()); +} diff --git a/src/test/ui/attributes/item-attributes.rs b/src/test/ui/attributes/item-attributes.rs new file mode 100644 index 00000000000..72c9a35dc07 --- /dev/null +++ b/src/test/ui/attributes/item-attributes.rs @@ -0,0 +1,181 @@ +// These are attributes of the implicit crate. Really this just needs to parse +// for completeness since .rs files linked from .rc files support this +// notation to specify their module's attributes + +// compile-pass + +#![feature(rustc_attrs)] + +#![rustc_dummy = "val"] +#![rustc_dummy = "val"] +#![rustc_dummy] +#![rustc_dummy(attr5)] + +#![crate_id="foobar#0.1"] + +// These are attributes of the following mod +#[rustc_dummy = "val"] +#[rustc_dummy = "val"] +mod test_first_item_in_file_mod {} + +mod test_single_attr_outer { + #[rustc_dummy = "val"] + pub static X: isize = 10; + + #[rustc_dummy = "val"] + pub fn f() { } + + #[rustc_dummy = "val"] + pub mod mod1 {} + + pub mod rustrt { + #[rustc_dummy = "val"] + extern {} + } +} + +mod test_multi_attr_outer { + #[rustc_dummy = "val"] + #[rustc_dummy = "val"] + pub static X: isize = 10; + + #[rustc_dummy = "val"] + #[rustc_dummy = "val"] + pub fn f() { } + + #[rustc_dummy = "val"] + #[rustc_dummy = "val"] + pub mod mod1 {} + + pub mod rustrt { + #[rustc_dummy = "val"] + #[rustc_dummy = "val"] + extern {} + } + + #[rustc_dummy = "val"] + #[rustc_dummy = "val"] + struct T {x: isize} +} + +mod test_stmt_single_attr_outer { + pub fn f() { + #[rustc_dummy = "val"] + static X: isize = 10; + + #[rustc_dummy = "val"] + fn f() { } + + #[rustc_dummy = "val"] + mod mod1 { + } + + mod rustrt { + #[rustc_dummy = "val"] + extern { + } + } + } +} + +mod test_stmt_multi_attr_outer { + pub fn f() { + + #[rustc_dummy = "val"] + #[rustc_dummy = "val"] + static X: isize = 10; + + #[rustc_dummy = "val"] + #[rustc_dummy = "val"] + fn f() { } + + #[rustc_dummy = "val"] + #[rustc_dummy = "val"] + mod mod1 { + } + + mod rustrt { + #[rustc_dummy = "val"] + #[rustc_dummy = "val"] + extern { + } + } + } +} + +mod test_attr_inner { + pub mod m { + // This is an attribute of mod m + #![rustc_dummy = "val"] + } +} + +mod test_attr_inner_then_outer { + pub mod m { + // This is an attribute of mod m + #![rustc_dummy = "val"] + // This is an attribute of fn f + #[rustc_dummy = "val"] + fn f() { } + } +} + +mod test_attr_inner_then_outer_multi { + pub mod m { + // This is an attribute of mod m + #![rustc_dummy = "val"] + #![rustc_dummy = "val"] + // This is an attribute of fn f + #[rustc_dummy = "val"] + #[rustc_dummy = "val"] + fn f() { } + } +} + +mod test_distinguish_syntax_ext { + pub fn f() { + format!("test{}", "s"); + #[rustc_dummy = "val"] + fn g() { } + } +} + +mod test_other_forms { + #[rustc_dummy] + #[rustc_dummy(word)] + #[rustc_dummy(attr(word))] + #[rustc_dummy(key1 = "val", key2 = "val", attr)] + pub fn f() { } +} + +mod test_foreign_items { + pub mod rustrt { + extern { + #![rustc_dummy] + + #[rustc_dummy] + fn rust_get_test_int() -> u32; + } + } +} + + +// FIXME(#623): - these aren't supported yet +/*mod test_literals { + #![str = "s"] + #![char = 'c'] + #![isize = 100] + #![usize = 100_usize] + #![mach_int = 100u32] + #![float = 1.0] + #![mach_float = 1.0f32] + #![nil = ()] + #![bool = true] + mod m {} +}*/ + +fn test_fn_inner() { + #![rustc_dummy] +} + +fn main() {} diff --git a/src/test/ui/attributes/method-attributes.rs b/src/test/ui/attributes/method-attributes.rs new file mode 100644 index 00000000000..2d608acc71f --- /dev/null +++ b/src/test/ui/attributes/method-attributes.rs @@ -0,0 +1,28 @@ +// compile-pass +// pp-exact - Make sure we print all the attributes +// pretty-expanded FIXME #23616 + +#![feature(rustc_attrs)] + +#[rustc_dummy] +trait Frobable { + #[rustc_dummy] + fn frob(&self); + #[rustc_dummy] + fn defrob(&self); +} + +#[rustc_dummy] +impl Frobable for isize { + #[rustc_dummy] + fn frob(&self) { + #![rustc_dummy] + } + + #[rustc_dummy] + fn defrob(&self) { + #![rustc_dummy] + } +} + +fn main() {} diff --git a/src/test/ui/attributes/obsolete-attr.rs b/src/test/ui/attributes/obsolete-attr.rs new file mode 100644 index 00000000000..89e2ad2669c --- /dev/null +++ b/src/test/ui/attributes/obsolete-attr.rs @@ -0,0 +1,7 @@ +// Obsolete attributes fall back to feature gated custom attributes. + +#[ab_isize="stdcall"] extern {} //~ ERROR attribute `ab_isize` is currently unknown + +#[fixed_stack_segment] fn f() {} //~ ERROR attribute `fixed_stack_segment` is currently unknown + +fn main() {} diff --git a/src/test/ui/attributes/obsolete-attr.stderr b/src/test/ui/attributes/obsolete-attr.stderr new file mode 100644 index 00000000000..2ed7f87935f --- /dev/null +++ b/src/test/ui/attributes/obsolete-attr.stderr @@ -0,0 +1,21 @@ +error[E0658]: The attribute `fixed_stack_segment` is currently unknown to the compiler and may have meaning added to it in the future + --> $DIR/obsolete-attr.rs:5:3 + | +LL | #[fixed_stack_segment] fn f() {} + | ^^^^^^^^^^^^^^^^^^^ + | + = note: for more information, see https://github.com/rust-lang/rust/issues/29642 + = help: add #![feature(custom_attribute)] to the crate attributes to enable + +error[E0658]: The attribute `ab_isize` is currently unknown to the compiler and may have meaning added to it in the future + --> $DIR/obsolete-attr.rs:3:3 + | +LL | #[ab_isize="stdcall"] extern {} + | ^^^^^^^^ + | + = note: for more information, see https://github.com/rust-lang/rust/issues/29642 + = help: add #![feature(custom_attribute)] to the crate attributes to enable + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/attributes/unknown-attr.rs b/src/test/ui/attributes/unknown-attr.rs new file mode 100644 index 00000000000..e2a4f3226d5 --- /dev/null +++ b/src/test/ui/attributes/unknown-attr.rs @@ -0,0 +1,9 @@ +// Unknown attributes fall back to feature gated custom attributes. + +#![feature(custom_inner_attributes)] + +#![mutable_doc] //~ ERROR attribute `mutable_doc` is currently unknown + +#[dance] mod a {} //~ ERROR attribute `dance` is currently unknown + +#[dance] fn main() {} //~ ERROR attribute `dance` is currently unknown diff --git a/src/test/ui/attributes/unknown-attr.stderr b/src/test/ui/attributes/unknown-attr.stderr new file mode 100644 index 00000000000..d0ac58108fc --- /dev/null +++ b/src/test/ui/attributes/unknown-attr.stderr @@ -0,0 +1,30 @@ +error[E0658]: The attribute `mutable_doc` is currently unknown to the compiler and may have meaning added to it in the future + --> $DIR/unknown-attr.rs:5:4 + | +LL | #![mutable_doc] + | ^^^^^^^^^^^ + | + = note: for more information, see https://github.com/rust-lang/rust/issues/29642 + = help: add #![feature(custom_attribute)] to the crate attributes to enable + +error[E0658]: The attribute `dance` is currently unknown to the compiler and may have meaning added to it in the future + --> $DIR/unknown-attr.rs:7:3 + | +LL | #[dance] mod a {} + | ^^^^^ + | + = note: for more information, see https://github.com/rust-lang/rust/issues/29642 + = help: add #![feature(custom_attribute)] to the crate attributes to enable + +error[E0658]: The attribute `dance` is currently unknown to the compiler and may have meaning added to it in the future + --> $DIR/unknown-attr.rs:9:3 + | +LL | #[dance] fn main() {} + | ^^^^^ + | + = note: for more information, see https://github.com/rust-lang/rust/issues/29642 + = help: add #![feature(custom_attribute)] to the crate attributes to enable + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/attributes/variant-attributes.rs b/src/test/ui/attributes/variant-attributes.rs new file mode 100644 index 00000000000..a910340f4a0 --- /dev/null +++ b/src/test/ui/attributes/variant-attributes.rs @@ -0,0 +1,37 @@ +// compile-pass +// pp-exact - Make sure we actually print the attributes +// pretty-expanded FIXME #23616 + +#![allow(non_camel_case_types)] +#![feature(rustc_attrs)] + +enum crew_of_enterprise_d { + + #[rustc_dummy] + jean_luc_picard, + + #[rustc_dummy] + william_t_riker, + + #[rustc_dummy] + beverly_crusher, + + #[rustc_dummy] + deanna_troi, + + #[rustc_dummy] + data, + + #[rustc_dummy] + worf, + + #[rustc_dummy] + geordi_la_forge, +} + +fn boldly_go(_crew_member: crew_of_enterprise_d, _where: String) { } + +fn main() { + boldly_go(crew_of_enterprise_d::worf, + "where no one has gone before".to_string()); +} diff --git a/src/test/ui/custom-attribute-multisegment.rs b/src/test/ui/custom-attribute-multisegment.rs index 95cefe53938..24349213902 100644 --- a/src/test/ui/custom-attribute-multisegment.rs +++ b/src/test/ui/custom-attribute-multisegment.rs @@ -1,7 +1,5 @@ // Unresolved multi-segment attributes are not treated as custom. -#![feature(custom_attribute)] - mod existent {} #[existent::nonexistent] //~ ERROR failed to resolve: could not find `nonexistent` in `existent` diff --git a/src/test/ui/custom-attribute-multisegment.stderr b/src/test/ui/custom-attribute-multisegment.stderr index 9ba9c00e55b..57eca211ed1 100644 --- a/src/test/ui/custom-attribute-multisegment.stderr +++ b/src/test/ui/custom-attribute-multisegment.stderr @@ -1,5 +1,5 @@ error[E0433]: failed to resolve: could not find `nonexistent` in `existent` - --> $DIR/custom-attribute-multisegment.rs:7:13 + --> $DIR/custom-attribute-multisegment.rs:5:13 | LL | #[existent::nonexistent] | ^^^^^^^^^^^ could not find `nonexistent` in `existent` diff --git a/src/test/ui/expanded-cfg.rs b/src/test/ui/expanded-cfg.rs index fbae093f2ac..c98fd7ffea8 100644 --- a/src/test/ui/expanded-cfg.rs +++ b/src/test/ui/expanded-cfg.rs @@ -1,6 +1,6 @@ // skip-codegen // compile-pass -#![feature(custom_attribute)] + macro_rules! mac { {} => { #[cfg(attr)] diff --git a/src/test/ui/issues/issue-24434.rs b/src/test/ui/issues/issue-24434.rs index 7b270ceb688..2424a1c92cd 100644 --- a/src/test/ui/issues/issue-24434.rs +++ b/src/test/ui/issues/issue-24434.rs @@ -1,8 +1,7 @@ // compile-pass -#![allow(unused_attributes)] // compile-flags:--cfg set1 -#![cfg_attr(set1, feature(custom_attribute))] +#![cfg_attr(set1, feature(rustc_attrs))] +#![rustc_dummy] -#![foobar] fn main() {} diff --git a/src/test/ui/lint/lint-obsolete-attr.rs b/src/test/ui/lint/lint-obsolete-attr.rs deleted file mode 100644 index 149948b5a6d..00000000000 --- a/src/test/ui/lint/lint-obsolete-attr.rs +++ /dev/null @@ -1,12 +0,0 @@ -// When denying at the crate level, be sure to not get random warnings from the -// injected intrinsics by the compiler. - -#![deny(unused_attributes)] -#![allow(dead_code)] -#![feature(custom_attribute)] - -#[ab_isize="stdcall"] extern {} //~ ERROR unused attribute - -#[fixed_stack_segment] fn f() {} //~ ERROR unused attribute - -fn main() {} diff --git a/src/test/ui/lint/lint-obsolete-attr.stderr b/src/test/ui/lint/lint-obsolete-attr.stderr deleted file mode 100644 index c06bd26df2b..00000000000 --- a/src/test/ui/lint/lint-obsolete-attr.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error: unused attribute - --> $DIR/lint-obsolete-attr.rs:8:1 - | -LL | #[ab_isize="stdcall"] extern {} - | ^^^^^^^^^^^^^^^^^^^^^ - | -note: lint level defined here - --> $DIR/lint-obsolete-attr.rs:4:9 - | -LL | #![deny(unused_attributes)] - | ^^^^^^^^^^^^^^^^^ - -error: unused attribute - --> $DIR/lint-obsolete-attr.rs:10:1 - | -LL | #[fixed_stack_segment] fn f() {} - | ^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 2 previous errors - diff --git a/src/test/ui/lint/lint-unknown-attr.rs b/src/test/ui/lint/lint-unknown-attr.rs deleted file mode 100644 index 828b869c12e..00000000000 --- a/src/test/ui/lint/lint-unknown-attr.rs +++ /dev/null @@ -1,11 +0,0 @@ -// When denying at the crate level, be sure to not get random warnings from the -// injected intrinsics by the compiler. - -#![feature(custom_attribute)] -#![deny(unused_attributes)] - -#![mutable_doc] //~ ERROR unused attribute - -#[dance] mod a {} //~ ERROR unused attribute - -#[dance] fn main() {} //~ ERROR unused attribute diff --git a/src/test/ui/lint/lint-unknown-attr.stderr b/src/test/ui/lint/lint-unknown-attr.stderr deleted file mode 100644 index 9817760c224..00000000000 --- a/src/test/ui/lint/lint-unknown-attr.stderr +++ /dev/null @@ -1,26 +0,0 @@ -error: unused attribute - --> $DIR/lint-unknown-attr.rs:9:1 - | -LL | #[dance] mod a {} - | ^^^^^^^^ - | -note: lint level defined here - --> $DIR/lint-unknown-attr.rs:5:9 - | -LL | #![deny(unused_attributes)] - | ^^^^^^^^^^^^^^^^^ - -error: unused attribute - --> $DIR/lint-unknown-attr.rs:11:1 - | -LL | #[dance] fn main() {} - | ^^^^^^^^ - -error: unused attribute - --> $DIR/lint-unknown-attr.rs:7:1 - | -LL | #![mutable_doc] - | ^^^^^^^^^^^^^^^ - -error: aborting due to 3 previous errors - diff --git a/src/test/ui/macros/macro-inner-attributes.rs b/src/test/ui/macros/macro-inner-attributes.rs index 268ddda1b3c..56a90231566 100644 --- a/src/test/ui/macros/macro-inner-attributes.rs +++ b/src/test/ui/macros/macro-inner-attributes.rs @@ -1,4 +1,4 @@ -#![feature(custom_attribute)] +#![feature(rustc_attrs)] macro_rules! test { ($nm:ident, #[$a:meta], @@ -12,7 +12,7 @@ test!(b, #[cfg(not(qux))], pub fn bar() { }); -#[qux] +#[rustc_dummy] fn main() { a::bar(); //~^ ERROR failed to resolve: use of undeclared type or module `a` diff --git a/src/test/ui/macros/macro-input-future-proofing.stderr b/src/test/ui/macros/macro-input-future-proofing.stderr index a35f6283afb..542486927df 100644 --- a/src/test/ui/macros/macro-input-future-proofing.stderr +++ b/src/test/ui/macros/macro-input-future-proofing.stderr @@ -55,10 +55,10 @@ LL | ($($a:ty, $b:ty)* -) => (); = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$ty:ty` is followed by `-`, which is not allowed for `ty` fragments - --> $DIR/macro-input-future-proofing.rs:18:7 + --> $DIR/macro-input-future-proofing.rs:18:15 | LL | ($($ty:ty)-+) => (); - | ^^^^^^^^ not allowed after `ty` fragments + | ^ not allowed after `ty` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` diff --git a/src/test/ui/macros/macro-outer-attributes.rs b/src/test/ui/macros/macro-outer-attributes.rs index aa70060425f..0752f7e3153 100644 --- a/src/test/ui/macros/macro-outer-attributes.rs +++ b/src/test/ui/macros/macro-outer-attributes.rs @@ -1,4 +1,4 @@ -#![feature(custom_attribute)] +#![feature(rustc_attrs)] macro_rules! test { ($nm:ident, #[$a:meta], @@ -13,7 +13,7 @@ test!(b, pub fn bar() { }); // test1!(#[bar]) -#[qux] +#[rustc_dummy] fn main() { a::bar(); //~ ERROR cannot find function `bar` in module `a` b::bar(); diff --git a/src/test/ui/malformed/malformed-interpolated.rs b/src/test/ui/malformed/malformed-interpolated.rs index 7c4ca3c017e..5101b5caeea 100644 --- a/src/test/ui/malformed/malformed-interpolated.rs +++ b/src/test/ui/malformed/malformed-interpolated.rs @@ -1,9 +1,9 @@ -#![feature(custom_attribute)] +#![feature(rustc_attrs)] macro_rules! check { ($expr: expr) => ( - #[my_attr = $expr] //~ ERROR unexpected token: `-0` - //~| ERROR unexpected token: `0 + 0` + #[rustc_dummy = $expr] //~ ERROR unexpected token: `-0` + //~| ERROR unexpected token: `0 + 0` use main as _; ); } diff --git a/src/test/ui/malformed/malformed-interpolated.stderr b/src/test/ui/malformed/malformed-interpolated.stderr index e805416172b..bcd2ef545d8 100644 --- a/src/test/ui/malformed/malformed-interpolated.stderr +++ b/src/test/ui/malformed/malformed-interpolated.stderr @@ -7,19 +7,19 @@ LL | check!(0u8); = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). error: unexpected token: `-0` - --> $DIR/malformed-interpolated.rs:5:21 + --> $DIR/malformed-interpolated.rs:5:25 | -LL | #[my_attr = $expr] - | ^^^^^ +LL | #[rustc_dummy = $expr] + | ^^^^^ ... LL | check!(-0); // ERROR, see above | ----------- in this macro invocation error: unexpected token: `0 + 0` - --> $DIR/malformed-interpolated.rs:5:21 + --> $DIR/malformed-interpolated.rs:5:25 | -LL | #[my_attr = $expr] - | ^^^^^ +LL | #[rustc_dummy = $expr] + | ^^^^^ ... LL | check!(0 + 0); // ERROR, see above | -------------- in this macro invocation diff --git a/src/test/ui/proc-macro/resolve-error.rs b/src/test/ui/proc-macro/resolve-error.rs index 82607136f0b..1298c08df84 100644 --- a/src/test/ui/proc-macro/resolve-error.rs +++ b/src/test/ui/proc-macro/resolve-error.rs @@ -2,8 +2,6 @@ // aux-build:derive-clona.rs // aux-build:test-macros.rs -#![feature(custom_attribute)] - #[macro_use] extern crate derive_foo; #[macro_use] @@ -25,10 +23,12 @@ macro_rules! attr_proc_mac { //~^ ERROR cannot find struct Foo; -#[attr_proc_macra] // OK, interpreted as a custom attribute +// Interpreted as a feature gated custom attribute +#[attr_proc_macra] //~ ERROR attribute `attr_proc_macra` is currently unknown struct Bar; -#[FooWithLongNan] // OK, interpreted as a custom attribute +// Interpreted as a feature gated custom attribute +#[FooWithLongNan] //~ ERROR attribute `FooWithLongNan` is currently unknown struct Asdf; #[derive(Dlone)] diff --git a/src/test/ui/proc-macro/resolve-error.stderr b/src/test/ui/proc-macro/resolve-error.stderr index 705ef6006a0..f9f116c15dc 100644 --- a/src/test/ui/proc-macro/resolve-error.stderr +++ b/src/test/ui/proc-macro/resolve-error.stderr @@ -1,5 +1,23 @@ +error[E0658]: The attribute `attr_proc_macra` is currently unknown to the compiler and may have meaning added to it in the future + --> $DIR/resolve-error.rs:27:3 + | +LL | #[attr_proc_macra] + | ^^^^^^^^^^^^^^^ + | + = note: for more information, see https://github.com/rust-lang/rust/issues/29642 + = help: add #![feature(custom_attribute)] to the crate attributes to enable + +error[E0658]: The attribute `FooWithLongNan` is currently unknown to the compiler and may have meaning added to it in the future + --> $DIR/resolve-error.rs:31:3 + | +LL | #[FooWithLongNan] + | ^^^^^^^^^^^^^^ + | + = note: for more information, see https://github.com/rust-lang/rust/issues/29642 + = help: add #![feature(custom_attribute)] to the crate attributes to enable + error: cannot find derive macro `FooWithLongNan` in this scope - --> $DIR/resolve-error.rs:24:10 + --> $DIR/resolve-error.rs:22:10 | LL | #[derive(FooWithLongNan)] | ^^^^^^^^^^^^^^ help: try: `FooWithLongName` @@ -46,5 +64,6 @@ error: cannot find macro `bang_proc_macrp!` in this scope LL | bang_proc_macrp!(); | ^^^^^^^^^^^^^^^ help: you could try the macro: `bang_proc_macro` -error: aborting due to 8 previous errors +error: aborting due to 10 previous errors +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/stmt_expr_attrs_no_feature.rs b/src/test/ui/stmt_expr_attrs_no_feature.rs index 8952175e425..674a5ed18ce 100644 --- a/src/test/ui/stmt_expr_attrs_no_feature.rs +++ b/src/test/ui/stmt_expr_attrs_no_feature.rs @@ -1,4 +1,4 @@ -#![feature(custom_attribute)] +#![feature(rustc_attrs)] macro_rules! stmt_mac { () => { @@ -7,18 +7,19 @@ macro_rules! stmt_mac { } fn main() { - #[attr] + #[rustc_dummy] fn a() {} - #[attr] //~ ERROR attributes on expressions are experimental + // Bug: built-in attrs like `rustc_dummy` are not gated on blocks, but other attrs are. + #[rustfmt::skip] //~ ERROR attributes on expressions are experimental { } - #[attr] + #[rustc_dummy] 5; - #[attr] + #[rustc_dummy] stmt_mac!(); } @@ -26,25 +27,25 @@ fn main() { #[cfg(unset)] fn c() { - #[attr] + #[rustc_dummy] 5; } #[cfg(not(unset))] fn j() { - #[attr] + #[rustc_dummy] 5; } #[cfg_attr(not(unset), cfg(unset))] fn d() { - #[attr] + #[rustc_dummy] 8; } #[cfg_attr(not(unset), cfg(not(unset)))] fn i() { - #[attr] + #[rustc_dummy] 8; } @@ -53,30 +54,30 @@ fn i() { macro_rules! item_mac { ($e:ident) => { fn $e() { - #[attr] + #[rustc_dummy] 42; #[cfg(unset)] fn f() { - #[attr] + #[rustc_dummy] 5; } #[cfg(not(unset))] fn k() { - #[attr] + #[rustc_dummy] 5; } #[cfg_attr(not(unset), cfg(unset))] fn g() { - #[attr] + #[rustc_dummy] 8; } #[cfg_attr(not(unset), cfg(not(unset)))] fn h() { - #[attr] + #[rustc_dummy] 8; } @@ -90,51 +91,51 @@ item_mac!(e); extern { #[cfg(unset)] - fn x(a: [u8; #[attr] 5]); - fn y(a: [u8; #[attr] 5]); //~ ERROR attributes on expressions are experimental + fn x(a: [u8; #[rustc_dummy] 5]); + fn y(a: [u8; #[rustc_dummy] 5]); //~ ERROR attributes on expressions are experimental } struct Foo; impl Foo { #[cfg(unset)] - const X: u8 = #[attr] 5; - const Y: u8 = #[attr] 5; //~ ERROR attributes on expressions are experimental + const X: u8 = #[rustc_dummy] 5; + const Y: u8 = #[rustc_dummy] 5; //~ ERROR attributes on expressions are experimental } trait Bar { #[cfg(unset)] - const X: [u8; #[attr] 5]; - const Y: [u8; #[attr] 5]; //~ ERROR attributes on expressions are experimental + const X: [u8; #[rustc_dummy] 5]; + const Y: [u8; #[rustc_dummy] 5]; //~ ERROR attributes on expressions are experimental } struct Joyce { #[cfg(unset)] - field: [u8; #[attr] 5], - field2: [u8; #[attr] 5] //~ ERROR attributes on expressions are experimental + field: [u8; #[rustc_dummy] 5], + field2: [u8; #[rustc_dummy] 5] //~ ERROR attributes on expressions are experimental } struct Walky( - #[cfg(unset)] [u8; #[attr] 5], - [u8; #[attr] 5] //~ ERROR attributes on expressions are experimental + #[cfg(unset)] [u8; #[rustc_dummy] 5], + [u8; #[rustc_dummy] 5] //~ ERROR attributes on expressions are experimental ); enum Mike { Happy( - #[cfg(unset)] [u8; #[attr] 5], - [u8; #[attr] 5] //~ ERROR attributes on expressions are experimental + #[cfg(unset)] [u8; #[rustc_dummy] 5], + [u8; #[rustc_dummy] 5] //~ ERROR attributes on expressions are experimental ), Angry { #[cfg(unset)] - field: [u8; #[attr] 5], - field2: [u8; #[attr] 5] //~ ERROR attributes on expressions are experimental + field: [u8; #[rustc_dummy] 5], + field2: [u8; #[rustc_dummy] 5] //~ ERROR attributes on expressions are experimental } } fn pat() { match 5 { #[cfg(unset)] - 5 => #[attr] (), - 6 => #[attr] (), //~ ERROR attributes on expressions are experimental + 5 => #[rustc_dummy] (), + 6 => #[rustc_dummy] (), //~ ERROR attributes on expressions are experimental _ => (), } } diff --git a/src/test/ui/stmt_expr_attrs_no_feature.stderr b/src/test/ui/stmt_expr_attrs_no_feature.stderr index 1b5e989af7b..01372cc164b 100644 --- a/src/test/ui/stmt_expr_attrs_no_feature.stderr +++ b/src/test/ui/stmt_expr_attrs_no_feature.stderr @@ -1,80 +1,80 @@ error[E0658]: attributes on expressions are experimental - --> $DIR/stmt_expr_attrs_no_feature.rs:13:5 + --> $DIR/stmt_expr_attrs_no_feature.rs:14:5 | -LL | #[attr] - | ^^^^^^^ +LL | #[rustfmt::skip] + | ^^^^^^^^^^^^^^^^ | = note: for more information, see https://github.com/rust-lang/rust/issues/15701 = help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable error[E0658]: attributes on expressions are experimental - --> $DIR/stmt_expr_attrs_no_feature.rs:94:18 + --> $DIR/stmt_expr_attrs_no_feature.rs:95:18 | -LL | fn y(a: [u8; #[attr] 5]); - | ^^^^^^^ +LL | fn y(a: [u8; #[rustc_dummy] 5]); + | ^^^^^^^^^^^^^^ | = note: for more information, see https://github.com/rust-lang/rust/issues/15701 = help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable error[E0658]: attributes on expressions are experimental - --> $DIR/stmt_expr_attrs_no_feature.rs:101:19 + --> $DIR/stmt_expr_attrs_no_feature.rs:102:19 | -LL | const Y: u8 = #[attr] 5; - | ^^^^^^^ +LL | const Y: u8 = #[rustc_dummy] 5; + | ^^^^^^^^^^^^^^ | = note: for more information, see https://github.com/rust-lang/rust/issues/15701 = help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable error[E0658]: attributes on expressions are experimental - --> $DIR/stmt_expr_attrs_no_feature.rs:107:19 + --> $DIR/stmt_expr_attrs_no_feature.rs:108:19 | -LL | const Y: [u8; #[attr] 5]; - | ^^^^^^^ +LL | const Y: [u8; #[rustc_dummy] 5]; + | ^^^^^^^^^^^^^^ | = note: for more information, see https://github.com/rust-lang/rust/issues/15701 = help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable error[E0658]: attributes on expressions are experimental - --> $DIR/stmt_expr_attrs_no_feature.rs:113:18 + --> $DIR/stmt_expr_attrs_no_feature.rs:114:18 | -LL | field2: [u8; #[attr] 5] - | ^^^^^^^ +LL | field2: [u8; #[rustc_dummy] 5] + | ^^^^^^^^^^^^^^ | = note: for more information, see https://github.com/rust-lang/rust/issues/15701 = help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable error[E0658]: attributes on expressions are experimental - --> $DIR/stmt_expr_attrs_no_feature.rs:118:10 + --> $DIR/stmt_expr_attrs_no_feature.rs:119:10 | -LL | [u8; #[attr] 5] - | ^^^^^^^ +LL | [u8; #[rustc_dummy] 5] + | ^^^^^^^^^^^^^^ | = note: for more information, see https://github.com/rust-lang/rust/issues/15701 = help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable error[E0658]: attributes on expressions are experimental - --> $DIR/stmt_expr_attrs_no_feature.rs:124:14 + --> $DIR/stmt_expr_attrs_no_feature.rs:125:14 | -LL | [u8; #[attr] 5] - | ^^^^^^^ +LL | [u8; #[rustc_dummy] 5] + | ^^^^^^^^^^^^^^ | = note: for more information, see https://github.com/rust-lang/rust/issues/15701 = help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable error[E0658]: attributes on expressions are experimental - --> $DIR/stmt_expr_attrs_no_feature.rs:129:22 + --> $DIR/stmt_expr_attrs_no_feature.rs:130:22 | -LL | field2: [u8; #[attr] 5] - | ^^^^^^^ +LL | field2: [u8; #[rustc_dummy] 5] + | ^^^^^^^^^^^^^^ | = note: for more information, see https://github.com/rust-lang/rust/issues/15701 = help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable error[E0658]: attributes on expressions are experimental - --> $DIR/stmt_expr_attrs_no_feature.rs:137:14 + --> $DIR/stmt_expr_attrs_no_feature.rs:138:14 | -LL | 6 => #[attr] (), - | ^^^^^^^ +LL | 6 => #[rustc_dummy] (), + | ^^^^^^^^^^^^^^ | = note: for more information, see https://github.com/rust-lang/rust/issues/15701 = help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable diff --git a/src/test/ui/suffixed-literal-meta.rs b/src/test/ui/suffixed-literal-meta.rs index bd2d6623d91..a6531490c01 100644 --- a/src/test/ui/suffixed-literal-meta.rs +++ b/src/test/ui/suffixed-literal-meta.rs @@ -1,15 +1,15 @@ -#![feature(custom_attribute)] +#![feature(rustc_attrs)] -#[my_attr = 1usize] //~ ERROR: suffixed literals are not allowed in attributes -#[my_attr = 1u8] //~ ERROR: suffixed literals are not allowed in attributes -#[my_attr = 1u16] //~ ERROR: suffixed literals are not allowed in attributes -#[my_attr = 1u32] //~ ERROR: suffixed literals are not allowed in attributes -#[my_attr = 1u64] //~ ERROR: suffixed literals are not allowed in attributes -#[my_attr = 1isize] //~ ERROR: suffixed literals are not allowed in attributes -#[my_attr = 1i8] //~ ERROR: suffixed literals are not allowed in attributes -#[my_attr = 1i16] //~ ERROR: suffixed literals are not allowed in attributes -#[my_attr = 1i32] //~ ERROR: suffixed literals are not allowed in attributes -#[my_attr = 1i64] //~ ERROR: suffixed literals are not allowed in attributes -#[my_attr = 1.0f32] //~ ERROR: suffixed literals are not allowed in attributes -#[my_attr = 1.0f64] //~ ERROR: suffixed literals are not allowed in attributes -fn main() { } +#[rustc_dummy = 1usize] //~ ERROR: suffixed literals are not allowed in attributes +#[rustc_dummy = 1u8] //~ ERROR: suffixed literals are not allowed in attributes +#[rustc_dummy = 1u16] //~ ERROR: suffixed literals are not allowed in attributes +#[rustc_dummy = 1u32] //~ ERROR: suffixed literals are not allowed in attributes +#[rustc_dummy = 1u64] //~ ERROR: suffixed literals are not allowed in attributes +#[rustc_dummy = 1isize] //~ ERROR: suffixed literals are not allowed in attributes +#[rustc_dummy = 1i8] //~ ERROR: suffixed literals are not allowed in attributes +#[rustc_dummy = 1i16] //~ ERROR: suffixed literals are not allowed in attributes +#[rustc_dummy = 1i32] //~ ERROR: suffixed literals are not allowed in attributes +#[rustc_dummy = 1i64] //~ ERROR: suffixed literals are not allowed in attributes +#[rustc_dummy = 1.0f32] //~ ERROR: suffixed literals are not allowed in attributes +#[rustc_dummy = 1.0f64] //~ ERROR: suffixed literals are not allowed in attributes +fn main() {} diff --git a/src/test/ui/suffixed-literal-meta.stderr b/src/test/ui/suffixed-literal-meta.stderr index 495404af3e8..83de173b1a7 100644 --- a/src/test/ui/suffixed-literal-meta.stderr +++ b/src/test/ui/suffixed-literal-meta.stderr @@ -1,96 +1,96 @@ error: suffixed literals are not allowed in attributes - --> $DIR/suffixed-literal-meta.rs:3:13 + --> $DIR/suffixed-literal-meta.rs:3:17 | -LL | #[my_attr = 1usize] - | ^^^^^^ +LL | #[rustc_dummy = 1usize] + | ^^^^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). error: suffixed literals are not allowed in attributes - --> $DIR/suffixed-literal-meta.rs:4:13 + --> $DIR/suffixed-literal-meta.rs:4:17 | -LL | #[my_attr = 1u8] - | ^^^ +LL | #[rustc_dummy = 1u8] + | ^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). error: suffixed literals are not allowed in attributes - --> $DIR/suffixed-literal-meta.rs:5:13 + --> $DIR/suffixed-literal-meta.rs:5:17 | -LL | #[my_attr = 1u16] - | ^^^^ +LL | #[rustc_dummy = 1u16] + | ^^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). error: suffixed literals are not allowed in attributes - --> $DIR/suffixed-literal-meta.rs:6:13 + --> $DIR/suffixed-literal-meta.rs:6:17 | -LL | #[my_attr = 1u32] - | ^^^^ +LL | #[rustc_dummy = 1u32] + | ^^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). error: suffixed literals are not allowed in attributes - --> $DIR/suffixed-literal-meta.rs:7:13 + --> $DIR/suffixed-literal-meta.rs:7:17 | -LL | #[my_attr = 1u64] - | ^^^^ +LL | #[rustc_dummy = 1u64] + | ^^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). error: suffixed literals are not allowed in attributes - --> $DIR/suffixed-literal-meta.rs:8:13 + --> $DIR/suffixed-literal-meta.rs:8:17 | -LL | #[my_attr = 1isize] - | ^^^^^^ +LL | #[rustc_dummy = 1isize] + | ^^^^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). error: suffixed literals are not allowed in attributes - --> $DIR/suffixed-literal-meta.rs:9:13 + --> $DIR/suffixed-literal-meta.rs:9:17 | -LL | #[my_attr = 1i8] - | ^^^ +LL | #[rustc_dummy = 1i8] + | ^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). error: suffixed literals are not allowed in attributes - --> $DIR/suffixed-literal-meta.rs:10:13 + --> $DIR/suffixed-literal-meta.rs:10:17 | -LL | #[my_attr = 1i16] - | ^^^^ +LL | #[rustc_dummy = 1i16] + | ^^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). error: suffixed literals are not allowed in attributes - --> $DIR/suffixed-literal-meta.rs:11:13 + --> $DIR/suffixed-literal-meta.rs:11:17 | -LL | #[my_attr = 1i32] - | ^^^^ +LL | #[rustc_dummy = 1i32] + | ^^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). error: suffixed literals are not allowed in attributes - --> $DIR/suffixed-literal-meta.rs:12:13 + --> $DIR/suffixed-literal-meta.rs:12:17 | -LL | #[my_attr = 1i64] - | ^^^^ +LL | #[rustc_dummy = 1i64] + | ^^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). error: suffixed literals are not allowed in attributes - --> $DIR/suffixed-literal-meta.rs:13:13 + --> $DIR/suffixed-literal-meta.rs:13:17 | -LL | #[my_attr = 1.0f32] - | ^^^^^^ +LL | #[rustc_dummy = 1.0f32] + | ^^^^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). error: suffixed literals are not allowed in attributes - --> $DIR/suffixed-literal-meta.rs:14:13 + --> $DIR/suffixed-literal-meta.rs:14:17 | -LL | #[my_attr = 1.0f64] - | ^^^^^^ +LL | #[rustc_dummy = 1.0f64] + | ^^^^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). diff --git a/src/test/ui/tool-attributes/tool-attributes-misplaced-1.rs b/src/test/ui/tool-attributes/tool-attributes-misplaced-1.rs index 33cffcefd89..ce902b7e7d2 100644 --- a/src/test/ui/tool-attributes/tool-attributes-misplaced-1.rs +++ b/src/test/ui/tool-attributes/tool-attributes-misplaced-1.rs @@ -1,12 +1,11 @@ -#![feature(custom_attribute)] - type A = rustfmt; //~ ERROR expected type, found tool module `rustfmt` type B = rustfmt::skip; //~ ERROR expected type, found tool attribute `rustfmt::skip` #[derive(rustfmt)] //~ ERROR cannot find derive macro `rustfmt` in this scope struct S; -#[rustfmt] // OK, interpreted as a custom attribute +// Interpreted as a feature gated custom attribute +#[rustfmt] //~ ERROR attribute `rustfmt` is currently unknown fn check() {} #[rustfmt::skip] // OK diff --git a/src/test/ui/tool-attributes/tool-attributes-misplaced-1.stderr b/src/test/ui/tool-attributes/tool-attributes-misplaced-1.stderr index 1c799b41c5a..1df9821f244 100644 --- a/src/test/ui/tool-attributes/tool-attributes-misplaced-1.stderr +++ b/src/test/ui/tool-attributes/tool-attributes-misplaced-1.stderr @@ -1,39 +1,49 @@ +error[E0658]: The attribute `rustfmt` is currently unknown to the compiler and may have meaning added to it in the future + --> $DIR/tool-attributes-misplaced-1.rs:8:3 + | +LL | #[rustfmt] + | ^^^^^^^ + | + = note: for more information, see https://github.com/rust-lang/rust/issues/29642 + = help: add #![feature(custom_attribute)] to the crate attributes to enable + error: cannot find derive macro `rustfmt` in this scope - --> $DIR/tool-attributes-misplaced-1.rs:6:10 + --> $DIR/tool-attributes-misplaced-1.rs:4:10 | LL | #[derive(rustfmt)] | ^^^^^^^ error: cannot find macro `rustfmt!` in this scope - --> $DIR/tool-attributes-misplaced-1.rs:15:5 + --> $DIR/tool-attributes-misplaced-1.rs:14:5 | LL | rustfmt!(); | ^^^^^^^ error[E0573]: expected type, found tool module `rustfmt` - --> $DIR/tool-attributes-misplaced-1.rs:3:10 + --> $DIR/tool-attributes-misplaced-1.rs:1:10 | LL | type A = rustfmt; | ^^^^^^^ not a type error[E0573]: expected type, found tool attribute `rustfmt::skip` - --> $DIR/tool-attributes-misplaced-1.rs:4:10 + --> $DIR/tool-attributes-misplaced-1.rs:2:10 | LL | type B = rustfmt::skip; | ^^^^^^^^^^^^^ not a type error[E0423]: expected value, found tool module `rustfmt` - --> $DIR/tool-attributes-misplaced-1.rs:14:5 + --> $DIR/tool-attributes-misplaced-1.rs:13:5 | LL | rustfmt; | ^^^^^^^ not a value error[E0423]: expected value, found tool attribute `rustfmt::skip` - --> $DIR/tool-attributes-misplaced-1.rs:17:5 + --> $DIR/tool-attributes-misplaced-1.rs:16:5 | LL | rustfmt::skip; | ^^^^^^^^^^^^^ not a value -error: aborting due to 6 previous errors +error: aborting due to 7 previous errors -For more information about this error, try `rustc --explain E0423`. +Some errors have detailed explanations: E0423, E0658. +For more information about an error, try `rustc --explain E0423`. diff --git a/src/test/ui/traits/trait-with-dst.rs b/src/test/ui/traits/trait-with-dst.rs new file mode 100644 index 00000000000..86d6585bc61 --- /dev/null +++ b/src/test/ui/traits/trait-with-dst.rs @@ -0,0 +1,22 @@ +// compile-pass +// #55266 + +struct VTable<DST: ?Sized> { + _to_dst_ptr: fn(*mut ()) -> *mut DST, +} + +trait HasVTableFor<DST: ?Sized + 'static> { + const VTABLE: &'static VTable<DST>; +} + +impl<T, DST: ?Sized + 'static> HasVTableFor<DST> for T { + const VTABLE: &'static VTable<DST> = &VTable { + _to_dst_ptr: |_: *mut ()| unsafe { std::mem::zeroed() }, + }; +} + +pub fn push<DST: ?Sized + 'static, T>() { + <T as HasVTableFor<DST>>::VTABLE; +} + +fn main() {} diff --git a/src/test/ui/unrestricted-attribute-tokens.rs b/src/test/ui/unrestricted-attribute-tokens.rs index 4798f7b396c..b07ab96bce1 100644 --- a/src/test/ui/unrestricted-attribute-tokens.rs +++ b/src/test/ui/unrestricted-attribute-tokens.rs @@ -1,8 +1,8 @@ // compile-pass -#![feature(custom_attribute)] +#![feature(rustc_attrs)] -#[my_attr(a b c d)] -#[my_attr[a b c d]] -#[my_attr{a b c d}] +#[rustc_dummy(a b c d)] +#[rustc_dummy[a b c d]] +#[rustc_dummy{a b c d}] fn main() {} diff --git a/src/test/ui/unused/unused-attr.rs b/src/test/ui/unused/unused-attr.rs index 810732a9775..cb8ac0e6a05 100644 --- a/src/test/ui/unused/unused-attr.rs +++ b/src/test/ui/unused/unused-attr.rs @@ -1,49 +1,48 @@ #![deny(unused_attributes)] -#![allow(dead_code, unused_imports, unused_extern_crates)] -#![feature(custom_attribute)] +#![feature(rustc_attrs)] -#![foo] //~ ERROR unused attribute +#![rustc_dummy] //~ ERROR unused attribute -#[foo] //~ ERROR unused attribute +#[rustc_dummy] //~ ERROR unused attribute extern crate core; -#[foo] //~ ERROR unused attribute +#[rustc_dummy] //~ ERROR unused attribute use std::collections; -#[foo] //~ ERROR unused attribute +#[rustc_dummy] //~ ERROR unused attribute extern "C" { - #[foo] //~ ERROR unused attribute + #[rustc_dummy] //~ ERROR unused attribute fn foo(); } -#[foo] //~ ERROR unused attribute +#[rustc_dummy] //~ ERROR unused attribute mod foo { - #[foo] //~ ERROR unused attribute + #[rustc_dummy] //~ ERROR unused attribute pub enum Foo { - #[foo] //~ ERROR unused attribute + #[rustc_dummy] //~ ERROR unused attribute Bar, } } -#[foo] //~ ERROR unused attribute +#[rustc_dummy] //~ ERROR unused attribute fn bar(f: foo::Foo) { match f { - #[foo] //~ ERROR unused attribute + #[rustc_dummy] //~ ERROR unused attribute foo::Foo::Bar => {} } } -#[foo] //~ ERROR unused attribute +#[rustc_dummy] //~ ERROR unused attribute struct Foo { - #[foo] //~ ERROR unused attribute + #[rustc_dummy] //~ ERROR unused attribute a: isize } -#[foo] //~ ERROR unused attribute +#[rustc_dummy] //~ ERROR unused attribute trait Baz { - #[foo] //~ ERROR unused attribute + #[rustc_dummy] //~ ERROR unused attribute fn blah(&self); - #[foo] //~ ERROR unused attribute + #[rustc_dummy] //~ ERROR unused attribute fn blah2(&self) {} } diff --git a/src/test/ui/unused/unused-attr.stderr b/src/test/ui/unused/unused-attr.stderr index 6f096d74144..956b870715e 100644 --- a/src/test/ui/unused/unused-attr.stderr +++ b/src/test/ui/unused/unused-attr.stderr @@ -1,8 +1,8 @@ error: unused attribute - --> $DIR/unused-attr.rs:7:1 + --> $DIR/unused-attr.rs:6:1 | -LL | #[foo] - | ^^^^^^ +LL | #[rustc_dummy] + | ^^^^^^^^^^^^^^ | note: lint level defined here --> $DIR/unused-attr.rs:1:9 @@ -11,88 +11,88 @@ LL | #![deny(unused_attributes)] | ^^^^^^^^^^^^^^^^^ error: unused attribute - --> $DIR/unused-attr.rs:10:1 + --> $DIR/unused-attr.rs:9:1 | -LL | #[foo] - | ^^^^^^ +LL | #[rustc_dummy] + | ^^^^^^^^^^^^^^ error: unused attribute - --> $DIR/unused-attr.rs:15:5 + --> $DIR/unused-attr.rs:14:5 | -LL | #[foo] - | ^^^^^^ +LL | #[rustc_dummy] + | ^^^^^^^^^^^^^^ error: unused attribute - --> $DIR/unused-attr.rs:13:1 + --> $DIR/unused-attr.rs:12:1 | -LL | #[foo] - | ^^^^^^ +LL | #[rustc_dummy] + | ^^^^^^^^^^^^^^ error: unused attribute - --> $DIR/unused-attr.rs:23:9 + --> $DIR/unused-attr.rs:22:9 | -LL | #[foo] - | ^^^^^^ +LL | #[rustc_dummy] + | ^^^^^^^^^^^^^^ error: unused attribute - --> $DIR/unused-attr.rs:21:5 + --> $DIR/unused-attr.rs:20:5 | -LL | #[foo] - | ^^^^^^ +LL | #[rustc_dummy] + | ^^^^^^^^^^^^^^ error: unused attribute - --> $DIR/unused-attr.rs:19:1 + --> $DIR/unused-attr.rs:18:1 | -LL | #[foo] - | ^^^^^^ +LL | #[rustc_dummy] + | ^^^^^^^^^^^^^^ error: unused attribute - --> $DIR/unused-attr.rs:31:9 + --> $DIR/unused-attr.rs:30:9 | -LL | #[foo] - | ^^^^^^ +LL | #[rustc_dummy] + | ^^^^^^^^^^^^^^ error: unused attribute - --> $DIR/unused-attr.rs:28:1 + --> $DIR/unused-attr.rs:27:1 | -LL | #[foo] - | ^^^^^^ +LL | #[rustc_dummy] + | ^^^^^^^^^^^^^^ error: unused attribute - --> $DIR/unused-attr.rs:38:5 + --> $DIR/unused-attr.rs:37:5 | -LL | #[foo] - | ^^^^^^ +LL | #[rustc_dummy] + | ^^^^^^^^^^^^^^ error: unused attribute - --> $DIR/unused-attr.rs:36:1 + --> $DIR/unused-attr.rs:35:1 | -LL | #[foo] - | ^^^^^^ +LL | #[rustc_dummy] + | ^^^^^^^^^^^^^^ error: unused attribute - --> $DIR/unused-attr.rs:44:5 + --> $DIR/unused-attr.rs:43:5 | -LL | #[foo] - | ^^^^^^ +LL | #[rustc_dummy] + | ^^^^^^^^^^^^^^ error: unused attribute - --> $DIR/unused-attr.rs:46:5 + --> $DIR/unused-attr.rs:45:5 | -LL | #[foo] - | ^^^^^^ +LL | #[rustc_dummy] + | ^^^^^^^^^^^^^^ error: unused attribute - --> $DIR/unused-attr.rs:42:1 + --> $DIR/unused-attr.rs:41:1 | -LL | #[foo] - | ^^^^^^ +LL | #[rustc_dummy] + | ^^^^^^^^^^^^^^ error: unused attribute - --> $DIR/unused-attr.rs:5:1 + --> $DIR/unused-attr.rs:4:1 | -LL | #![foo] - | ^^^^^^^ +LL | #![rustc_dummy] + | ^^^^^^^^^^^^^^^ error: aborting due to 15 previous errors |
