rust/tests/ui/rfcs/rfc-2632-const-trait-impl/specializing-constness.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

32 lines
488 B
Rust
Raw Normal View History

2022-09-24 15:15:19 -05:00
#![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;
}
2023-04-16 06:12:37 -05:00
#[const_trait]
pub trait Spec {}
impl<T: ~const Spec> const A for T {
2022-09-24 15:15:19 -05:00
default fn a() -> u32 {
2
}
}
2023-04-16 06:12:37 -05:00
impl<T: Spec + Sup> A for T {
//~^ ERROR: cannot specialize
2023-07-29 03:20:25 -05:00
//FIXME(effects) ~| ERROR: missing `~const` qualifier
2022-09-24 15:15:19 -05:00
fn a() -> u32 {
3
}
}
fn main() {}