rust/tests/crashes/137190-2.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

19 lines
325 B
Rust
Raw Normal View History

2025-03-07 23:17:25 +01:00
//@ known-bug: #137190
trait Supertrait<T> {
fn method(&self) {}
}
trait Trait<P>: Supertrait<()> {}
impl<P> Trait<P> for () {}
const fn upcast<P>(x: &dyn Trait<P>) -> &dyn Supertrait<()> {
x
}
const fn foo() -> &'static dyn Supertrait<()> {
upcast::<()>(&())
}
const _: &'static dyn Supertrait<()> = foo();