-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Inconsistent "overflow evaluating the requirement" error for adding impl in another crate #77446
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
This now compiles successfully. Bisecting… |
Ah, right. #130654 (stabilize |
@fmease As this is marked with |
It's best if whoever's analyzing this tries to simplify it further. It definitely doesn't look minimal. |
minimized, somewhat: // src/lib.rs
pub trait TraitUnrelated {
type AssTypeUnrelated;
}
pub trait TraitA {
type AssTypeA;
}
pub trait TraitB<T>
where
T: TraitA,
{
type AssTypeB;
}
impl<T, ST> TraitB<ST> for T
where
ST: TraitA,
// reordering the following two lines makes it compile
ExpressionImplHelper<T::AssTypeUnrelated>: TraitB<ST>,
T: TraitUnrelated,
{
type AssTypeB = <ExpressionImplHelper<T::AssTypeUnrelated> as TraitB<ST>>::AssTypeB;
}
pub struct ExpressionImplHelper<B>(pub B); // src/bin/foo.rs
use mycrate::*;
struct MyTypeA;
struct MyTypeB;
impl TraitA for MyTypeA {
type AssTypeA = ();
}
impl TraitB<MyTypeA> for MyTypeB {
type AssTypeB = ();
}
fn main(){} The fact that the ordering of the where clauses (both in the original, and in the reduced version) makes the error go away makes me think that the bug is due to a minor implementation detail, and a test is unlikely to catch future problems(?)... Opportunistically |
I tried this code:
(lib.rs)
(main.rs)
I expected this code to compile without any issue or a clear error message why I cannot implment that
AsExpression
there, but instead I got a compilation error:As an intresting side note: This happens for the following impl:
removing it results in a successful compilation.
Meta
rustc --version --verbose
:rustc 1.48.0-nightly (fc2daaae6 2020-09-28)
The text was updated successfully, but these errors were encountered: