1be24d70ce
Revert: create const block bodies in typeck via query feeding as per the discussion in https://github.com/rust-lang/rust/pull/125806#discussion_r1622563948 It was a mistake to try to shoehorn const blocks and some specific anon consts into the same box and feed them during typeck. It turned out not simplifying anything (my hope was that we could feed `type_of` to start avoiding the huge HIR matcher, but that didn't work out), but instead making a few things more fragile. reverts the const-block-specific parts of https://github.com/rust-lang/rust/pull/124650 `@bors` rollup=never had a small perf impact previously fixes https://github.com/rust-lang/rust/issues/125846 r? `@compiler-errors`
269 lines
4.9 KiB
Rust
269 lines
4.9 KiB
Rust
//@ pp-exact
|
|
|
|
#![feature(inline_const_pat)]
|
|
#![feature(rustc_attrs)]
|
|
#![feature(stmt_expr_attributes)]
|
|
|
|
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]
|
|
match () { _ => {} }
|
|
}
|
|
|
|
fn _4() {
|
|
|
|
#[rustc_dummy]
|
|
match () {
|
|
#![rustc_dummy]
|
|
_ => (),
|
|
}
|
|
|
|
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]
|
|
stmt_mac! {};
|
|
|
|
#[rustc_dummy]
|
|
stmt_mac![];
|
|
|
|
#[rustc_dummy]
|
|
stmt_mac! {}
|
|
|
|
let _ = ();
|
|
}
|
|
|
|
macro_rules! expr_mac { () => { () } }
|
|
|
|
fn _10() {
|
|
let _ = #[rustc_dummy] expr_mac!();
|
|
let _ = #[rustc_dummy] expr_mac![];
|
|
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]
|
|
};
|
|
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![];
|
|
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]
|
|
}
|
|
}
|
|
|
|
fn foo() {}
|
|
fn foo3(_: i32, _: (), _: ()) {}
|
|
fn qux(_: i32) {}
|