You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As you can see, I listed all the possible trait implementations Prop for types of PropWrapper (in this case, two possible types), but the compiler still complains:
error[E0277]: the trait bound `PropWrapper<N>: Prop` is not satisfied
--> src/main.rs:29:8
|
29 | n: <PropWrapper<N> as Prop>::Ty,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Prop` is not implemented for `PropWrapper<N>`
|
= help: the following other types implement trait `Prop`:
PropWrapper<Number::Float>
PropWrapper<Number::Int>
This is unnecessary and the default case will never hit.
Is it reasonable for the compiler to check if all possible implementations are all listed for the case of using adt_const_params?
I use the nigthly build rustc 1.77.0-nightly (f688dd684 2024-01-04)
The text was updated successfully, but these errors were encountered:
psionic12
changed the title
[adt_const_params] consider avoid specialization when implement traits for Foo<const B: Bar>
[adt_const_params] consider to avoid using specialization when implement traits for Foo<const B: Bar>
Jan 5, 2024
Similar to assoc const equality bounds, assoc type equality bounds exhibit a related problem at the moment: rust-lang/rust#20400 and closed/postponed RFC #1672.
Not sure this should be a lacking in RFC or a bug in compiler, sorry if I issued to the wrong place.
The title is a little confusing, here is an exmple for illustating:
As you can see, I listed all the possible trait implementations
Prop
for types ofPropWrapper
(in this case, two possible types), but the compiler still complains:Currently my workaround is to use specialization:
This is unnecessary and the default case will never hit.
Is it reasonable for the compiler to check if all possible implementations are all listed for the case of using
adt_const_params
?I use the nigthly build rustc 1.77.0-nightly (f688dd684 2024-01-04)
The text was updated successfully, but these errors were encountered: