summaryrefslogtreecommitdiffstats
path: root/tests/ui/object-safety/object-safety-sized.rs
blob: b424b892d3b4525cb4b7b4b295b77e70d2a9e571 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Check that we correctly prevent users from making trait objects
// from traits where `Self : Sized`.
//
// revisions: curr object_safe_for_dispatch

#![cfg_attr(object_safe_for_dispatch, feature(object_safe_for_dispatch))]

trait Bar : Sized {
    fn bar<T>(&self, t: T);
}

fn make_bar<T:Bar>(t: &T) -> &dyn Bar {
    //[curr]~^ ERROR E0038
    t
    //[object_safe_for_dispatch]~^ ERROR E0038
}

fn main() {
}