rust/tests/pretty/stmt_expr_attributes.rs

270 lines
4.9 KiB
Rust
Raw Normal View History

//@ pp-exact
#![feature(inline_const)]
#![feature(inline_const_pat)]
#![feature(rustc_attrs)]
2015-11-24 13:56:20 +00:00
#![feature(stmt_expr_attributes)]
2021-12-01 19:45:14 +00:00
fn main() {}
fn _0() {
#[rustc_dummy]
foo();
}
fn _1() {
#[rustc_dummy]
unsafe {
#![rustc_dummy]
// code
}
}
fn _2() {
#[rustc_dummy]
{ foo(); }
{
#![rustc_dummy]
foo()
}
}
fn _3() {
#[rustc_dummy]
2021-12-01 19:45:14 +00:00
match () { _ => {} }
}
fn _4() {
#[rustc_dummy]
2021-05-11 19:21:54 +00:00
match () {
#![rustc_dummy]
_ => (),
}
2021-05-11 19:21:54 +00:00
let _ =
#[rustc_dummy] match () {
#![rustc_dummy]
() => (),
};
}
fn _5() {
#[rustc_dummy]
let x = 1;
let x = #[rustc_dummy] 1;
let y = ();
let z = ();
foo3(x, #[rustc_dummy] y, z);
qux(3 + #[rustc_dummy] 2);
}
fn _6() {
#[rustc_dummy]
[1, 2, 3];
let _ = #[rustc_dummy] [1, 2, 3];
#[rustc_dummy]
[1; 4];
let _ = #[rustc_dummy] [1; 4];
}
struct Foo {
data: (),
}
struct Bar(());
fn _7() {
#[rustc_dummy]
Foo { data: () };
let _ = #[rustc_dummy] Foo { data: () };
}
fn _8() {
#[rustc_dummy]
();
#[rustc_dummy]
(0);
#[rustc_dummy]
(0,);
#[rustc_dummy]
(0, 1);
}
fn _9() {
macro_rules! stmt_mac { () => { let _ = (); } }
#[rustc_dummy]
stmt_mac!();
#[rustc_dummy]
2021-12-01 19:45:14 +00:00
stmt_mac! {};
#[rustc_dummy]
stmt_mac![];
#[rustc_dummy]
2021-12-01 19:45:14 +00:00
stmt_mac! {}
let _ = ();
}
macro_rules! expr_mac { () => { () } }
fn _10() {
let _ = #[rustc_dummy] expr_mac!();
let _ = #[rustc_dummy] expr_mac![];
2021-12-01 19:45:14 +00:00
let _ = #[rustc_dummy] expr_mac! {};
}
fn _11() {
let _: [(); 0] = #[rustc_dummy] [];
let _ = #[rustc_dummy] [0, 0];
let _ = #[rustc_dummy] [0; 0];
let _ = #[rustc_dummy] foo();
let _ = #[rustc_dummy] 1i32.clone();
let _ = #[rustc_dummy] ();
let _ = #[rustc_dummy] (0);
let _ = #[rustc_dummy] (0,);
let _ = #[rustc_dummy] (0, 0);
let _ = #[rustc_dummy] 0 + #[rustc_dummy] 0;
let _ = #[rustc_dummy] !0;
let _ = #[rustc_dummy] -0i32;
let _ = #[rustc_dummy] false;
let _ = #[rustc_dummy] 'c';
let _ = #[rustc_dummy] 0;
let _ = #[rustc_dummy] 0 as usize;
let _ =
#[rustc_dummy] while false {
#![rustc_dummy]
};
let _ =
#[rustc_dummy] while let None = Some(()) {
#![rustc_dummy]
};
let _ =
#[rustc_dummy] for _ in 0..0 {
#![rustc_dummy]
};
let _ =
#[rustc_dummy] loop {
#![rustc_dummy]
};
2021-05-11 19:21:54 +00:00
let _ =
#[rustc_dummy] match false {
#![rustc_dummy]
_ => (),
};
let _ = #[rustc_dummy] || #[rustc_dummy] ();
let _ = #[rustc_dummy] move || #[rustc_dummy] ();
let _ =
#[rustc_dummy] ||
{
#![rustc_dummy]
#[rustc_dummy]
()
};
let _ =
#[rustc_dummy] move ||
{
#![rustc_dummy]
#[rustc_dummy]
()
};
let _ =
#[rustc_dummy] {
#![rustc_dummy]
};
let _ =
#[rustc_dummy] {
#![rustc_dummy]
let _ = ();
};
let _ =
#[rustc_dummy] {
#![rustc_dummy]
let _ = ();
()
};
let const {
#![rustc_dummy]
} =
#[rustc_dummy] const {
#![rustc_dummy]
};
let mut x = 0;
let _ = #[rustc_dummy] x = 15;
let _ = #[rustc_dummy] x += 15;
let s = Foo { data: () };
let _ = #[rustc_dummy] s.data;
let _ = (#[rustc_dummy] s).data;
let t = Bar(());
let _ = #[rustc_dummy] t.0;
let _ = (#[rustc_dummy] t).0;
let v = vec!(0);
let _ = #[rustc_dummy] v[0];
let _ = (#[rustc_dummy] v)[0];
let _ = #[rustc_dummy] 0..#[rustc_dummy] 0;
let _ = #[rustc_dummy] 0..;
let _ = #[rustc_dummy] (0..0);
let _ = #[rustc_dummy] (0..);
let _ = #[rustc_dummy] (..0);
let _ = #[rustc_dummy] (..);
let _: fn(&u32) -> u32 = #[rustc_dummy] std::clone::Clone::clone;
let _ = #[rustc_dummy] &0;
let _ = #[rustc_dummy] &mut 0;
let _ = #[rustc_dummy] &#[rustc_dummy] 0;
let _ = #[rustc_dummy] &mut #[rustc_dummy] 0;
while false { let _ = #[rustc_dummy] continue; }
while true { let _ = #[rustc_dummy] break; }
|| #[rustc_dummy] return;
let _ = #[rustc_dummy] expr_mac!();
let _ = #[rustc_dummy] expr_mac![];
2021-12-01 19:45:14 +00:00
let _ = #[rustc_dummy] expr_mac! {};
let _ = #[rustc_dummy] Foo { data: () };
let _ = #[rustc_dummy] Foo { ..s };
let _ = #[rustc_dummy] Foo { data: (), ..s };
let _ = #[rustc_dummy] (0);
}
fn _12() {
#[rustc_dummy]
let _ = 0;
#[rustc_dummy]
0;
#[rustc_dummy]
expr_mac!();
#[rustc_dummy]
{
#![rustc_dummy]
}
}
2021-12-01 19:45:14 +00:00
fn foo() {}
fn foo3(_: i32, _: (), _: ()) {}
fn qux(_: i32) {}