summaryrefslogtreecommitdiffstats
path: root/src/test/ui/specialization/min_specialization/spec-marker-supertraits.rs
blob: 3bb2480e9e2bef50a4deef89bd73161d1ac0b537 (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
// Check that supertraits cannot be used to work around min_specialization
// limitations.

#![feature(min_specialization)]
#![feature(rustc_attrs)]

trait HasMethod {
    fn method(&self);
}

#[rustc_unsafe_specialization_marker]
trait Marker: HasMethod {}

trait Spec {
    fn spec_me(&self);
}

impl<T> Spec for T {
    default fn spec_me(&self) {}
}

impl<T: Marker> Spec for T {
    //~^ ERROR cannot specialize on trait `HasMethod`
    fn spec_me(&self) {
        self.method();
    }
}

fn main() {}