-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect recursion in type inference #49017
Comments
Catch this error in my code
This commit make error appears: https://bitbucket.org/O01eg/sendxmppd-rust/commits/df0c04b537c0f1fd94f4abcf64af01ff75b97dd5?at=iq-set-processing Reproduced with rustc 1.34.0 and rustc 1.36.0-dev (316a391 2019-04-19) |
Triage: no change |
Error now:
|
FWIW, this is a slightly reduced version of the code:pub trait Encodable {}
pub trait Inner
where
for<'a> &'a Self: Encodable, {
}
pub trait Outer {
type Inner: Inner;
}
struct SomeStruct {}
impl<'a> Encodable for SomeStruct
where
&'a Self: Encodable, {
} One way or the other, the original bug has disappeared and the only reason this does not compile is the unsatisfied trait bound which can be fixed with the suggestion, which really is just to explicitly require what the Inner trait requires or instead use this: pub trait Outer {
type InnerType where Self::InnerType: Inner;
} So maybe this can be closed? |
I encountered a recursion overflow error on a trait implementation of HashMap (
Encodable
) when I tried to extend an unrelated trait (Inner
) by a where clause for the same trait. This might end in a case of 'You are holding it wrong', but I couldn't find any clue why the change should infer with the given implementation:Minimal Example
Playground
Error Log
Reproduced with:
The text was updated successfully, but these errors were encountered: