blob: df97d2c13278e941005d900ab4b5af0db3b49beb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
// Check that we can statically dispatch methods for object
// unsafe trait objects, directly and indirectly
//
// check-pass
#![feature(object_safe_for_dispatch)]
trait Statics {
fn plain() {}
fn generic<T>() {}
}
trait Trait: Sized {}
impl<'a> Statics for dyn Trait + 'a {}
fn static_poly<T: Statics + ?Sized>() {
T::plain();
T::generic::<usize>();
}
fn inferred_poly<T: Statics + ?Sized>(t: &T) {
static_poly::<T>();
T::plain();
T::generic::<usize>();
}
fn call(t: &dyn Trait) {
static_poly::<dyn Trait>();
inferred_poly(t);
}
fn main() {
static_poly::<dyn Trait>();
<dyn Trait>::plain();
<dyn Trait>::generic::<usize>()
}
|