mirror of
https://github.com/allankoechke/rust.git
synced 2026-11-30 11:05:36 +00:00
22 lines
755 B
Rust
22 lines
755 B
Rust
// Some examples of attribute parsing previously missing from the test suite
|
|
|
|
#![feature(rustc_attrs, stmt_expr_attributes)]
|
|
|
|
fn foo<const N: u8 = #[rustc_dummy] 11>() {}
|
|
//~^ ERROR defaults for generic parameters are not allowed here
|
|
|
|
fn main() {
|
|
match #[rustc_dummy] 10 { _ => {} }
|
|
let _ = - #[rustc_dummy] 10;
|
|
let _ = || #[rustc_dummy] 10;
|
|
if #[rustc_dummy] true {}
|
|
if let _ = #[rustc_dummy] 10 {}
|
|
for _ in #[rustc_dummy] (0..10) {}
|
|
for (_ in #[rustc_dummy] (0..10)) {}
|
|
//~^ ERROR unexpected parentheses surrounding `for` loop head
|
|
foo::<#[rustc_dummy] 10>();
|
|
//~^ ERROR attributes cannot be applied to generic arguments
|
|
cfg_select! { _ => #[rustc_dummy] 10 }
|
|
//~^ ERROR expected expression, found `#`
|
|
}
|