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
497 B
Rust
Raw Normal View History

2023-08-06 13:20:55 +00:00
#![feature(const_trait_impl, effects, min_specialization, rustc_attrs)]
2022-09-24 20:15:19 +00:00
#[rustc_specialization_trait]
#[const_trait]
pub trait Sup {}
impl const Sup for () {}
#[const_trait]
pub trait A {
fn a() -> u32;
}
2023-04-16 11:12:37 +00:00
#[const_trait]
pub trait Spec {}
impl<T: ~const Spec> const A for T {
2022-09-24 20:15:19 +00:00
default fn a() -> u32 {
2
}
}
2023-04-16 11:12:37 +00:00
impl<T: Spec + Sup> A for T {
//~^ ERROR: cannot specialize
2023-07-29 08:20:25 +00:00
//FIXME(effects) ~| ERROR: missing `~const` qualifier
2022-09-24 20:15:19 +00:00
fn a() -> u32 {
3
}
}
fn main() {}