mirror of
https://github.com/rust-lang/rust
synced 2024-11-05 20:45:15 +00:00
12 lines
349 B
Rust
12 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)`
|
|
}
|