2017-04-11 23:53:20 +03:00
|
|
|
trait Trait {}
|
|
|
|
|
2020-09-07 10:01:45 +01:00
|
|
|
fn get_function<'a>() -> &'a dyn Fn() -> dyn Trait {
|
|
|
|
panic!("")
|
|
|
|
}
|
2017-04-11 23:53:20 +03:00
|
|
|
|
|
|
|
fn main() {
|
2020-06-28 20:34:56 +01:00
|
|
|
// This isn't great. The issue here is that `dyn Trait` is not sized, so
|
|
|
|
// `dyn Fn() -> dyn Trait` is not well-formed.
|
2020-09-07 10:01:45 +01:00
|
|
|
let t: &dyn Trait = &get_function()();
|
|
|
|
//~^ ERROR expected function, found `&dyn Fn() -> (dyn Trait + 'static)`
|
2017-04-11 23:53:20 +03:00
|
|
|
}
|