| //! Regression test for: <https://github.com/rust-lang/rust/issues/144132> | |
| //! <https://github.com/rust-lang/rust/issues/135017> | |
| //@ run-rustfix | |
| #![allow(dead_code, unused_variables)] | |
| struct Foo<T>(T); | |
| struct Bar<'a>(&'a i32); | |
| struct Baz<const N: usize>(i32); | |
| fn main() { | |
| let foo: Foo<i32> = Foo(2i32); | |
| //~^ ERROR attributes cannot be applied to generic arguments | |
| let _: &'static str = "123"; | |
| //~^ ERROR attributes cannot be applied to types | |
| let _: Bar<'static> = Bar(&123); | |
| //~^ ERROR attributes cannot be applied to generic arguments | |
| let _: Baz<42> = Baz(42); | |
| //~^ ERROR attributes cannot be applied to generic arguments | |
| let _: Foo<String> = Foo(String::new()); | |
| //~^ ERROR attributes cannot be applied to generic arguments | |
| let _: Bar<'static> = Bar(&456); | |
| //~^ ERROR attributes cannot be applied to generic arguments | |
| let _generic: Box<i32> = Box::new(1); | |
| //~^ ERROR attributes cannot be applied to generic arguments | |
| let _assignment: i32 = *Box::new(1); | |
| //~^ ERROR attributes cannot be applied to types | |
| let _complex: Vec<String> = vec![]; | |
| //~^ ERROR attributes cannot be applied to generic arguments | |
| let _nested: Box<Vec<u64>> = Box::new(vec![]); | |
| //~^ ERROR attributes cannot be applied to generic arguments | |
| } | |
| fn g() -> i32 { 0 } | |
| //~^ ERROR attributes cannot be applied to types | |
| struct S { | |
| field: i32, | |
| //~^ ERROR attributes cannot be applied to types | |
| field1: (i32, i32), | |
| //~^ ERROR attributes cannot be applied to types | |
| } | |
| type Tuple = (i32, String); | |
| //~^ ERROR attributes cannot be applied to types | |
| impl S {} | |
| //~^ ERROR attributes cannot be applied to types |