Only allow ~const bounds for traits with #[const_trait]

This commit is contained in:
Oli Scherer
2022-10-03 17:08:42 +00:00
parent d9f8b4b985
commit 33bcea8f61
34 changed files with 192 additions and 83 deletions

View File

@@ -2,13 +2,18 @@
struct S;
impl PartialEq for S {
#[const_trait]
trait Foo {
fn eq(&self, _: &Self) -> bool;
}
impl Foo for S {
fn eq(&self, _: &S) -> bool {
true
}
}
const fn equals_self<T: ~const PartialEq>(t: &T) -> bool {
const fn equals_self<T: ~const Foo>(t: &T) -> bool {
true
}