-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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 that predicates with unmentioned bound vars are still considered global in the old solver #117589
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
…try> Make sure that predicates with unmentioned bound vars are still considered global in the old solver In the old solver, we consider predicates with late-bound vars to not be "global": https://github.com/rust-lang/rust/blob/9c8a2694fadf3900c4d7880f6357cee60e9aa39b/compiler/rustc_trait_selection/src/traits/select/mod.rs#L1840-L1844 The implementation of `has_late_bound_vars` was modified in rust-lang#115834 so that we'd properly anonymize binders that had late-bound vars but didn't reference them. This fixed an ICE. However, this also led to a behavioral change in rust-lang#117056 (comment) for a couple of crates, which now consider `for<'a> GL33: Shader` (note the binder var that is *not* used in the predicate) to not be "global". This forces associated types to not be normalizable due to the old trait solver being dumb. This PR distinguishes types which *reference* late-bound vars and binders which *have* late-bound vars. The latter is represented with the new type flag `TypeFlags::HAS_BINDER_VARS`, which is used when we only care about knowing whether binders have vars in their bound var list (even if they're not used, like for binder anonymization). This should fix (after beta backport) the `luminance-gl` and `luminance-webgl` crates in rust-lang#117056. r? types **(priority is kinda high on a review here given beta becomes stable on November 16.)**
…dered global in the old solver
b220750
to
32294fc
Compare
@bors try |
…try> Make sure that predicates with unmentioned bound vars are still considered global in the old solver In the old solver, we consider predicates with late-bound vars to not be "global": https://github.com/rust-lang/rust/blob/9c8a2694fadf3900c4d7880f6357cee60e9aa39b/compiler/rustc_trait_selection/src/traits/select/mod.rs#L1840-L1844 The implementation of `has_late_bound_vars` was modified in rust-lang#115834 so that we'd properly anonymize binders that had late-bound vars but didn't reference them. This fixed an ICE. However, this also led to a behavioral change in rust-lang#117056 (comment) for a couple of crates, which now consider `for<'a> GL33: Shader` (note the binder var that is *not* used in the predicate) to not be "global". This forces associated types to not be normalizable due to the old trait solver being dumb. This PR distinguishes types which *reference* late-bound vars and binders which *have* late-bound vars. The latter is represented with the new type flag `TypeFlags::HAS_BINDER_VARS`, which is used when we only care about knowing whether binders have vars in their bound var list (even if they're not used, like for binder anonymization). This should fix (after beta backport) the `luminance-gl` and `luminance-webgl` crates in rust-lang#117056. r? types **(priority is kinda high on a review here given beta becomes stable on November 16.)**
r=me with or without crater (maybe we want to land and then do a crater run?) |
☀️ Try build successful - checks-actions |
@craterbot check |
👌 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
@bors r=jackh726 rollup=never |
🚧 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
☀️ Test successful - checks-actions |
Finished benchmarking commit (f64d028): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 638.32s -> 638.639s (0.05%) |
84: Automated pull from upstream `master` r=Dajamante a=github-actions[bot] This PR pulls the following changes from the upstream repository: * rust-lang/rust#117585 * rust-lang/rust#117576 * rust-lang/rust#96979 * rust-lang/rust#117191 * rust-lang/rust#117179 * rust-lang/rust#117574 * rust-lang/rust#117537 * rust-lang/rust#117608 * rust-lang/rust#117596 * rust-lang/rust#117588 * rust-lang/rust#117524 * rust-lang/rust#116017 * rust-lang/rust#117504 * rust-lang/rust#117469 * rust-lang/rust#116218 * rust-lang/rust#117589 * rust-lang/rust#117581 * rust-lang/rust#117503 * rust-lang/rust#117590 * rust-lang/rust#117583 * rust-lang/rust#117570 * rust-lang/rust#117562 * rust-lang/rust#117534 * rust-lang/rust#116894 * rust-lang/rust#110340 * rust-lang/rust#113343 * rust-lang/rust#117579 * rust-lang/rust#117094 * rust-lang/rust#117566 * rust-lang/rust#117564 * rust-lang/rust#117554 * rust-lang/rust#117550 * rust-lang/rust#117343 * rust-lang/rust#115274 * rust-lang/rust#117540 * rust-lang/rust#116412 * rust-lang/rust#115333 * rust-lang/rust#117507 * rust-lang/rust#117538 * rust-lang/rust#117533 * rust-lang/rust#117523 * rust-lang/rust#117520 * rust-lang/rust#117505 * rust-lang/rust#117434 * rust-lang/rust#117535 * rust-lang/rust#117510 * rust-lang/rust#116439 * rust-lang/rust#117508 Co-authored-by: Ben Wiederhake <BenWiederhake.GitHub@gmx.de> Co-authored-by: SabrinaJewson <sejewson@gmail.com> Co-authored-by: J-ZhengLi <lizheng135@huawei.com> Co-authored-by: koka <koka.code@gmail.com> Co-authored-by: bjorn3 <17426603+bjorn3@users.noreply.github.com> Co-authored-by: Joshua Liebow-Feeser <joshlf@users.noreply.github.com> Co-authored-by: lengyijun <sjtu5140809011@gmail.com> Co-authored-by: Zalathar <Zalathar@users.noreply.github.com> Co-authored-by: Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> Co-authored-by: Philipp Krones <hello@philkrones.com> Co-authored-by: y21 <30553356+y21@users.noreply.github.com> Co-authored-by: bors <bors@rust-lang.org> Co-authored-by: bohan <bohan-zhang@foxmail.com>
🎉 Experiment
|
No need to re-run crater on the regressions imho, out of the two:
|
We should open a PR to soa_derive I think (At the very least- it does seem like a bit of a rough regression) |
To revert to the old behavior for this, we probably need to change here:
|
HAS_LATE_BOUND necessarily implies HAS_BINDER_VARS, but yeah, I will prepare a PR for that soon. |
Maybe even just In any case, to save 2 minutes for a test, here's a trivial bound that's not using the lifetime and that now trips: struct S;
fn repro()
where
for<'a> S: Clone,
{
} (If the above and Jack's comment sounds right, Michael, I can open a PR) |
open a pr @lqd since I am still in bed!! |
@compiler-errors working on rust while in Bed, Bath, and Beyond. |
Oh right, this needs to be backported to fix a beta regression. This should be backported together with #117637. |
Good call on the crater run here. Nice catch. |
…s, r=compiler-errors Check binders with bound vars for global bounds that don't hold This fixes `soa_derive-0.13.0` from rust-lang#117589's crater run. r? `@compiler-errors`
Rollup merge of rust-lang#117637 - lqd:trivial-bounds-with-binder-vars, r=compiler-errors Check binders with bound vars for global bounds that don't hold This fixes `soa_derive-0.13.0` from rust-lang#117589's crater run. r? `@compiler-errors`
[beta] backports - dropck_outlives check whether generator witness needs_drop rust-lang#117134 - Make sure that predicates with unmentioned bound vars are still considered global in the old solver rust-lang#117589 - Check binders with bound vars for global bounds that don't hold rust-lang#117637 - generator layout: ignore fake borrows rust-lang#117712 r? ghost
[beta] backports - dropck_outlives check whether generator witness needs_drop rust-lang#117134 - Make sure that predicates with unmentioned bound vars are still considered global in the old solver rust-lang#117589 - Check binders with bound vars for global bounds that don't hold rust-lang#117637 - generator layout: ignore fake borrows rust-lang#117712 r? ghost
In the old solver, we consider predicates with late-bound vars to not be "global":
rust/compiler/rustc_trait_selection/src/traits/select/mod.rs
Lines 1840 to 1844 in 9c8a269
The implementation of
has_late_bound_vars
was modified in #115834 so that we'd properly anonymize binders that had late-bound vars but didn't reference them. This fixed an ICE.However, this also led to a behavioral change in #117056 (comment) for a couple of crates, which now consider
for<'a> GL33: Shader
(note the binder var that is not used in the predicate) to not be "global". This forces associated types to not be normalizable due to the old trait solver being dumb.This PR distinguishes types which reference late-bound vars and binders which have late-bound vars. The latter is represented with the new type flag
TypeFlags::HAS_BINDER_VARS
, which is used when we only care about knowing whether binders have vars in their bound var list (even if they're not used, like for binder anonymization).This should fix (after beta backport) the
luminance-gl
andluminance-webgl
crates in #117056.r? types
(priority is kinda high on a review here given beta becomes stable on November 16.)