1
Fork 0

~const trait or projection bounds do not imply non-const bounds

This commit is contained in:
Michael Goulet 2024-01-07 22:53:50 +00:00
parent 0ee9cfd54d
commit e44b11f695
11 changed files with 214 additions and 83 deletions

View file

@ -1,21 +1,35 @@
error[E0308]: mismatched types
error[E0277]: the trait bound `T: ~const Bar` is not satisfied
--> $DIR/trait-where-clause-const.rs:21:5
|
LL | T::b();
| ^^^^^^ expected `host`, found `true`
| ^ the trait `~const Bar` is not implemented for `T`
|
= note: expected constant `host`
found constant `true`
note: required by a bound in `Foo::b`
--> $DIR/trait-where-clause-const.rs:15:24
|
LL | fn b() where Self: ~const Bar;
| ^^^^^^^^^^ required by this bound in `Foo::b`
help: consider further restricting this bound
|
LL | const fn test1<T: ~const Foo + Bar + ~const Bar>() {
| ++++++++++++
error[E0308]: mismatched types
--> $DIR/trait-where-clause-const.rs:23:5
error[E0277]: the trait bound `T: ~const Bar` is not satisfied
--> $DIR/trait-where-clause-const.rs:23:12
|
LL | T::c::<T>();
| ^^^^^^^^^^^ expected `host`, found `true`
| ^ the trait `~const Bar` is not implemented for `T`
|
= note: expected constant `host`
found constant `true`
note: required by a bound in `Foo::c`
--> $DIR/trait-where-clause-const.rs:16:13
|
LL | fn c<T: ~const Bar>();
| ^^^^^^^^^^ required by this bound in `Foo::c`
help: consider further restricting this bound
|
LL | const fn test1<T: ~const Foo + Bar + ~const Bar>() {
| ++++++++++++
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0308`.
For more information about this error, try `rustc --explain E0277`.