rust/tests/ui/issues/issue-41139.rs
2023-01-11 09:32:08 +00:00

13 lines
349 B
Rust

trait Trait {}
fn get_function<'a>() -> &'a dyn Fn() -> dyn Trait {
panic!("")
}
fn main() {
// This isn't great. The issue here is that `dyn Trait` is not sized, so
// `dyn Fn() -> dyn Trait` is not well-formed.
let t: &dyn Trait = &get_function()();
//~^ ERROR expected function, found `&dyn Fn() -> (dyn Trait + 'static)`
}