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
While working on #512, I discovered that there are two ways that an implemented method may have a different signature than expected from the trait:
the implemented method fn<..> A -> B type (including late-bound vars) may be a subtype of that of the declared method;
the implemented method may have less strict trait bounds.
traitTrait:Sized{fnmethod1(self,other:&'staticu32);fnmethod2<T:Copy>(self,other:T);}implTraitfor(){// This implementation is more general because it works for non-static refs.fnmethod1(self,_other:&u32){}// This implementation is more general because it works for non-`Copy` `T`s.fnmethod2<T>(self,_other:T){}}fnmain(){let _ = ().method1(&1u32);// Error: we pass incorrect predicates// let _ = ().method2(false);}
In both cases our translation is incorrect. Once #512 lands we'll be able to fix this by using the method binders to convert between the trait-declared method generics and the actually-implemented method generics.
The text was updated successfully, but these errors were encountered:
While working on #512, I discovered that there are two ways that an implemented method may have a different signature than expected from the trait:
fn<..> A -> B
type (including late-bound vars) may be a subtype of that of the declared method;In both cases our translation is incorrect. Once #512 lands we'll be able to fix this by using the method binders to convert between the trait-declared method generics and the actually-implemented method generics.
The text was updated successfully, but these errors were encountered: