mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-30 14:01:51 +00:00
13 lines
349 B
Rust
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)`
|
|
}
|