Make assoc types work with ?const opt=out

This commit is contained in:
Deadbeef 2021-07-26 17:25:01 +08:00
parent 8c2a1e8e43
commit 1fa712d0ba
No known key found for this signature in database
GPG key ID: 027DF9338862ADDD
7 changed files with 24 additions and 27 deletions

View file

@ -1,5 +1,7 @@
// FIXME(fee1-dead): this should have a better error message
#![feature(const_trait_impl)]
#![feature(const_trait_bound_opt_out)]
#![allow(incomplete_features)]
struct NonConstAdd(i32);
@ -20,4 +22,12 @@ impl const Foo for NonConstAdd {
//~^ ERROR
}
trait Baz {
type Qux: ?const std::ops::Add;
}
impl const Baz for NonConstAdd {
type Qux = NonConstAdd; // OK
}
fn main() {}

View file

@ -1,5 +1,5 @@
error[E0277]: cannot add `NonConstAdd` to `NonConstAdd`
--> $DIR/assoc-type.rs:19:5
--> $DIR/assoc-type.rs:21:5
|
LL | type Bar: std::ops::Add;
| ------------- required by this bound in `Foo::Bar`