-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Where bounds with associated types equality cause overflow. #89503
Comments
if it helps, a bisection seems to lead to #85868 searched nightlies: from nightly-2021-08-15 to nightly-2021-10-04 bisected with cargo-bisect-rustc v0.6.0Host triple: x86_64-unknown-linux-gnu cargo bisect-rustc --start=2021-08-15 |
Assigning priority as discussed in the Zulip thread of the Prioritization Working Group. @rustbot label -I-prioritize +P-critical |
It appears that 371f3cd exposed a bug in the handling of projection sub-obligations. If I modify the code to unconditionally cache all sub-obligations (or avoid updating the projection cache entirely), the overflow error still occurs. It looks like the code previous compiled because we used to only store a small subset of the projection subobligations in the cache. Some of the previously-discarded subobligations appear to cause an overflow error when we process them again (when we read the cached projection result). |
Minimized: trait Assoc {
type B;
}
struct Test<U, T>(U, T);
impl<U, T> Assoc for Test<U, T>
where
U: Assoc,
T: Assoc<B = <U as Assoc>::B>,
{
type B = <U as Assoc>::B;
}
trait TestTrait {}
impl<U, T> TestTrait for Test<U, T>
where
U: Assoc,
T: Assoc<B = <Self as Assoc>::B>,
{
}
fn main() {} produces the following error on Nightly (and succeeds on stable):
|
I think that this error is actually legitimate:
cc @rust-lang/wg-traits |
Oh I see...this is maybe slightly different. |
This could potentially be fixed by removing this:
But that has other implications. |
@rust-lang/wg-traits @Aaron1011 This was marked as P-critical by wg-pri, but it doesn't look like we've seen much progress on resolving this issue (I don't see a linked PR). We missed it in our earlier T-release triage as it wasn't milestoned, but the release is next week -- do we think there's a minimal patch likely that we could backport in time? We also discuss this in today's release team meeting and there was a general feeling I think that if the crater run we just started doesn't show this to be widespread breakage we're probably OK to accept this breakage (rather than e.g. delaying the release or trying to revert 371f3cd which seems pretty difficult and introduces other regressions, I believe). |
Yeah, this is really rough. #89503 (comment) is one potential patch, but I've tried it before and it ends up causing other fallout that needs its own fixes. Unfortunately, through a series of relatively small bug fixes, we've ended up in a rut that needs larger design decisions/discussions to get out of. I think we need to see what comes out of the crater run. If this isn't widespread, then I think accepting that this has regressed into a larger class of bugs is better than reverting and running into incremental bugs. |
The crater run only reported one crate failing due to this: https://crater-reports.s3.amazonaws.com/beta-1.56-3/beta-2021-10-15/reg/mpstthree-0.0.13/log.txt |
Demoting to P-high after reading the latest comments @rustbot label -P-critical +P-high |
@rustbot label: +T-types -T-compiler |
Code
I tried this code:
It used to compile but now it doesn't because:
Version it worked on
It most recently worked on:
Stable:
1.55.0
Nightly:
rustc 1.56.0-nightly (50171c310 2021-09-01)
Version with regression
rustc --version --verbose
:(Probably all nightly versions after
2021-09-01
)@rustbot modify labels: +regression-from-stable-to-beta -regression-untriaged
The text was updated successfully, but these errors were encountered: