rust/tests/ui/attributes/dump_def_parents.rs
Noah Lev 277e049d91 Move Const::{from_anon_const,try_from_lit} to hir_ty_lowering
These operations are much more about lowering the HIR than about
`Const`s themselves. They fit better in hir_ty_lowering with
`lower_const_arg` (formerly `Const::from_const_arg`) and the rest.

To accomplish this, `const_evaluatable_predicates_of` had to be changed
to not use `from_anon_const` anymore. Instead of visiting the HIR and
lowering anon consts on the fly, it now visits the `rustc_middle::ty`
data structures instead and directly looks for `UnevaluatedConst`s. This
approach was proposed in:
https://github.com/rust-lang/rust/pull/131081#discussion_r1821189257
2024-12-02 19:34:47 +00:00

35 lines
973 B
Rust

//@ normalize-stderr-test: "DefId\(.+?\)" -> "DefId(..)"
#![feature(rustc_attrs)]
fn bar() {
fn foo() {
#[rustc_dump_def_parents]
fn baz() {
//~^ ERROR: rustc_dump_def_parents: DefId
|| {
qux::<
{
//~^ ERROR: rustc_dump_def_parents: DefId
fn inhibits_dump() {
qux::<
{
//~^ ERROR: rustc_dump_def_parents: DefId
"hi";
1
},
>();
}
qux::<{ 1 + 1 }>();
//~^ ERROR: rustc_dump_def_parents: DefId
1
},
>();
};
}
}
}
const fn qux<const N: usize>() {}
fn main() {}