mirror of
https://github.com/allankoechke/rust.git
synced 2026-11-30 11:05:36 +00:00
Use our new routine. Again, this means we can now also recover from
leading doc comments and inner attributes.
Moreover, we now actually store type & const arguments that have outer
attributes in the AST instead of using `{type error}` & `{const error}`
for them, respectively.
37 lines
871 B
Rust
37 lines
871 B
Rust
// Exercise outer attributes being applied to "nothing" in invalid contexts.
|
|
|
|
struct Baz<const N: usize>(i32);
|
|
|
|
fn f() {
|
|
let _: Baz<#[cfg(false)]> = todo!();
|
|
//~^ ERROR attributes cannot be applied to generic arguments
|
|
}
|
|
|
|
fn g(_param: #[attr]) {}
|
|
//~^ ERROR attributes cannot be applied to types
|
|
//~| ERROR expected type, found `)`
|
|
|
|
fn barrier0() {
|
|
fn f() -> #[attr] { 0 }
|
|
//~^ ERROR attributes cannot be applied to types
|
|
//~| ERROR expected type, found `{`
|
|
}
|
|
|
|
struct S {
|
|
field: #[attr],
|
|
//~^ ERROR attributes cannot be applied to types
|
|
//~| ERROR expected type, found `,`
|
|
}
|
|
|
|
fn barrier1() {
|
|
type Tuple = (#[attr], String);
|
|
//~^ ERROR attributes cannot be applied to types
|
|
//~| ERROR expected type, found `,`
|
|
}
|
|
|
|
impl #[attr] {}
|
|
//~^ ERROR attributes cannot be applied to types
|
|
//~| ERROR expected type, found `{`
|
|
|
|
fn main() {}
|