diff options
Diffstat (limited to 'tests/ui/impl-trait/normalize-tait-in-const.rs')
-rw-r--r-- | tests/ui/impl-trait/normalize-tait-in-const.rs | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/ui/impl-trait/normalize-tait-in-const.rs b/tests/ui/impl-trait/normalize-tait-in-const.rs new file mode 100644 index 000000000..020bcbb83 --- /dev/null +++ b/tests/ui/impl-trait/normalize-tait-in-const.rs @@ -0,0 +1,39 @@ +// known-bug: #103507 +// failure-status: 101 +// normalize-stderr-test "note: .*\n\n" -> "" +// normalize-stderr-test "thread 'rustc' panicked.*\n" -> "" +// rustc-env:RUST_BACKTRACE=0 + +#![feature(type_alias_impl_trait)] +#![feature(const_trait_impl)] +#![feature(const_refs_to_cell)] +#![feature(inline_const)] + +use std::marker::Destruct; + +trait T { + type Item; +} + +type Alias<'a> = impl T<Item = &'a ()>; + +struct S; +impl<'a> T for &'a S { + type Item = &'a (); +} + +const fn filter_positive<'a>() -> &'a Alias<'a> { + &&S +} + +const fn with_positive<F: ~const for<'a> Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) { + fun(filter_positive()); +} + +const fn foo(_: &Alias<'_>) {} + +const BAR: () = { + with_positive(foo); +}; + +fn main() {} |