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
traitEngine{typeG:Curve<F = Self::F>;typeF;}traitCurve: core::ops::MulAssign<<SelfasCurve>::F>{typeF;}fnshould_work<E:Engine>(mutp:E::G,f:E::F){
p *= f
}fnmain(){println!("Hello, world!");}
I expected this to compile, because I clearly specify that G::F = Self::F, but it seems that this unification doesn't occur, resulting in the following compiler error:
Compiling playground v0.0.1 (/playground)
error[E0277]: cannot multiply-assign `<E as Engine>::F` to `<E as Engine>::G`
--> src/main.rs:11:7
|
6 | trait Curve: core::ops::MulAssign<<Self as Curve>::F> {
| ----------------------------------------------------- required by `Curve`
...
10 | fn test<E: Engine>(mut p: E::G, f: E::F) {
| - help: consider further restricting the associated type: `where <E as Engine>::G: std::ops::MulAssign<<E as Engine>::F>`
11 | p *= f
| ^^ no implementation for `<E as Engine>::G *= <E as Engine>::F`
|
= help: the trait `std::ops::MulAssign<<E as Engine>::F>` is not implemented for `<E as Engine>::G`
error[E0308]: mismatched types
--> src/main.rs:11:10
|
11 | p *= f
| ^ expected Curve::F, found Engine::F
|
= note: expected associated type `<<E as Engine>::G as Curve>::F`
found associated type `<E as Engine>::F`
Hi!
I tried this code:
I expected this to compile, because I clearly specify that
G::F = Self::F
, but it seems that this unification doesn't occur, resulting in the following compiler error:Here's a playground link: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=c008af6306a36b074e3704fe6b474c84
Meta
This reproduces on the latest stable, beta, and nightly.
This might be related to #20775 and #48822, but not sure.
The text was updated successfully, but these errors were encountered: