summaryrefslogtreecommitdiffstats
path: root/tests/ui/impl-trait/fresh-lifetime-from-bare-trait-obj-114664.rs
blob: 57d688492515b0e0ed2b1a5feb18a028a14d3e15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// edition:2015
// check-pass
// issue: 114664

fn ice() -> impl AsRef<Fn(&())> {
    //~^ WARN trait objects without an explicit `dyn` are deprecated
    //~| WARN trait objects without an explicit `dyn` are deprecated
    //~| WARN trait objects without an explicit `dyn` are deprecated
    //~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
    //~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
    //~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
    Foo
}

struct Foo;
impl AsRef<dyn Fn(&())> for Foo {
    fn as_ref(&self) -> &(dyn for<'a> Fn(&'a ()) + 'static) {
        todo!()
    }
}

pub fn main() {}