rust/tests/ui/issues/issue-41139.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

13 lines
349 B
Rust
Raw Normal View History

trait Trait {}
2020-09-07 17:01:45 +08:00
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.
2020-09-07 17:01:45 +08:00
let t: &dyn Trait = &get_function()();
//~^ ERROR expected function, found `&dyn Fn() -> (dyn Trait + 'static)`
}