rust/tests/ui/impl-trait/in-trait/reveal.rs

20 lines
302 B
Rust
Raw Normal View History

2022-09-06 12:16:08 -05:00
// check-pass
2023-09-13 11:04:42 -05:00
#![feature(lint_reasons)]
2022-09-06 12:16:08 -05:00
#![allow(incomplete_features)]
pub trait Foo {
2022-09-06 12:16:08 -05:00
fn f() -> Box<impl Sized>;
}
impl Foo for () {
#[expect(refining_impl_trait)]
2022-09-06 12:16:08 -05:00
fn f() -> Box<String> {
Box::new(String::new())
}
}
fn main() {
let x: Box<String> = <() as Foo>::f();
}