-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Make sure to insert Sized
bound first into clauses list
#123302
Conversation
This comment has been minimized.
This comment has been minimized.
So the |
You probably need to do sth. similar to #120323 (comment) / https://github.com/rust-lang/rust/pull/120323/files#diff-bdb9592e6609d61bb876c9d8a8da8b0acf3d1516ee7f35eaca144d74b96afdf0 to fix the incremental issue. |
ya i'll fix the test later -- too interested in the root cause rn lol |
I'm ok with reverting the change that triggered this at least in beta to get some additional time for the fix for the underlying issue. Am I right to understand that even though my PR caused a user visible change, conceptually it shouldn't have? If I'm wrong on that, then my mental model of the language of how trait bounds are meant to work is incorrect and needs a refresher. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The failing test is one that changed on the original PR but isn't now. The reason for it is that by removing an explicit Sized
bound the implicit one is added, and in the incr compilation mode where we ignore spans, that means adding or removing an explicit Sized
bound is a no-op. With this change instead just reordering the bounds list, it goes back to triggering recompilation of that item. You can look at the original PR for what the test change needs to be.
r=me.
Idle thought: I wonder what happens if we always sorted trait bound predicates in a stable way, independent of source placement 🤔 |
yes, caching in the old trait solver is broken.
Breakage :3 this affects both incomplete inference guides from |
0e24d74
to
f2fd2d8
Compare
… r=estebank Make sure to insert `Sized` bound first into clauses list rust-lang#120323 made it so that we don't insert an implicit `Sized` bound whenever we see an *explicit* `Sized` bound. However, since the code that inserts implicit sized bounds puts the bound as the *first* in the list, that means that it had the **side-effect** of possibly meaning we check `Sized` *after* checking other trait bounds. If those trait bounds result in ambiguity or overflow or something, it may change how we winnow candidates. (**edit: SEE** rust-lang#123303) This is likely the cause for the regression in rust-lang#123279 (comment), since the impl... ```rust impl<T: Job + Sized> AsJob for T { // <----- changing this to `Sized + Job` or just `Job` (which turns into `Sized + Job`) will FIX the issue. } ``` ...looks incredibly suspicious. Fixes [after beta-backport] rust-lang#123279. Alternative is to revert rust-lang#120323. I don't have a strong opinion about this, but think it may be nice to keep the diagnostic changes around.
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#123198 (Add fn const BuildHasherDefault::new) - rust-lang#123226 (De-LLVM the unchecked shifts [MCP#693]) - rust-lang#123302 (Make sure to insert `Sized` bound first into clauses list) - rust-lang#123348 (rustdoc: add a couple of regression tests) - rust-lang#123362 (Check that nested statics in thread locals are duplicated per thread.) - rust-lang#123368 (CFI: Support non-general coroutines) - rust-lang#123375 (rustdoc: synthetic auto trait impls: accept unresolved region vars for now) - rust-lang#123378 (Update sysinfo to 0.30.8) Failed merges: - rust-lang#123349 (Fix capture analysis for by-move closure bodies) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#123302 - compiler-errors:sized-bound-first, r=estebank Make sure to insert `Sized` bound first into clauses list rust-lang#120323 made it so that we don't insert an implicit `Sized` bound whenever we see an *explicit* `Sized` bound. However, since the code that inserts implicit sized bounds puts the bound as the *first* in the list, that means that it had the **side-effect** of possibly meaning we check `Sized` *after* checking other trait bounds. If those trait bounds result in ambiguity or overflow or something, it may change how we winnow candidates. (**edit: SEE** rust-lang#123303) This is likely the cause for the regression in rust-lang#123279 (comment), since the impl... ```rust impl<T: Job + Sized> AsJob for T { // <----- changing this to `Sized + Job` or just `Job` (which turns into `Sized + Job`) will FIX the issue. } ``` ...looks incredibly suspicious. Fixes [after beta-backport] rust-lang#123279. Alternative is to revert rust-lang#120323. I don't have a strong opinion about this, but think it may be nice to keep the diagnostic changes around.
[beta] backports - Fix f16 and f128 feature gates in editions other than 2015 rust-lang#123307 / rust-lang#123445 - Update to LLVM 18.1.2 rust-lang#122772 - unix fs: Make hurd using explicit new rather than From rust-lang#123057 - Don't inherit codegen attrs from parent static rust-lang#123310 - Make sure to insert Sized bound first into clauses list rust-lang#123302 r? cuviper
[beta] backports - Fix f16 and f128 feature gates in editions other than 2015 rust-lang#123307 / rust-lang#123445 - Update to LLVM 18.1.2 rust-lang#122772 - unix fs: Make hurd using explicit new rather than From rust-lang#123057 - Don't inherit codegen attrs from parent static rust-lang#123310 - Make sure to insert Sized bound first into clauses list rust-lang#123302 r? cuviper
#120323 made it so that we don't insert an implicit
Sized
bound whenever we see an explicitSized
bound. However, since the code that inserts implicit sized bounds puts the bound as the first in the list, that means that it had the side-effect of possibly meaning we checkSized
after checking other trait bounds.If those trait bounds result in ambiguity or overflow or something, it may change how we winnow candidates. (edit: SEE #123303) This is likely the cause for the regression in #123279 (comment), since the impl...
...looks incredibly suspicious.
Fixes [after beta-backport] #123279.
Alternative is to revert #120323. I don't have a strong opinion about this, but think it may be nice to keep the diagnostic changes around.