summaryrefslogtreecommitdiffstats
path: root/src/test/ui/rfc-2632-const-trait-impl/specializing-constness.rs
blob: ff0cd489d47440cd448e46f61675335f6f5a4930 (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
#![feature(const_trait_impl, min_specialization, rustc_attrs)]

#[rustc_specialization_trait]
#[const_trait]
pub trait Sup {}

impl const Sup for () {}

#[const_trait]
pub trait A {
    fn a() -> u32;
}

impl<T: ~const Default> const A for T {
    default fn a() -> u32 {
        2
    }
}

impl<T: Default + Sup> A for T { //~ ERROR: cannot specialize
    fn a() -> u32 {
        3
    }
}

fn main() {}