-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Only prefer param-env candidates if they remain non-global after norm #140260
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
base: master
Are you sure you want to change the base?
Only prefer param-env candidates if they remain non-global after norm #140260
Conversation
HIR ty lowering was modified cc @fmease Some changes occurred to the core trait solver cc @rust-lang/initiative-trait-system-refactor Some changes occurred in src/tools/clippy cc @rust-lang/clippy |
574fcaa
to
a154981
Compare
This comment has been minimized.
This comment has been minimized.
pls add test trait With {
type Assoc;
}
impl<T> With for T {
type Assoc = T;
}
trait Incomplete<T> {}
impl<T> Incomplete<T> for () {}
fn impls_incomplete<T: Incomplete<U>, U>() {}
fn foo<T>()
where
u32: With<Assoc = T>,
(): Incomplete<<u32 as With>::Assoc>,
{
impls_incomplete::<(), _>();
}
fn main() {} edit: actually, added as part of #140313 |
☔ The latest upstream changes (presumably #140324) made this pull request unmergeable. Please resolve the merge conflicts. |
[DO NOT MERGE] bootstrap with `-Znext-solver=globally` A revival of rust-lang#124812. Current status: ~~`./x.py b --stage 2` passes 🎉~~ `try` builds succeed 🎉 🎉 🎉 ~~[top 100 most downloaded crates on crates.io compile](rust-lang#133502 (comment) [top 1000 most downloaded crates on crates.io compile](rust-lang#133502 (comment)) [first perf run](rust-lang#133502 (comment)) 👻 ### in-flight changes - rust-lang#124852, unsure whether I actually want to land this PR for now - rust-lang#139587 - https://github.com/lcnr/rust/tree/opaque-type-method-call - rust-lang#140302 - rust-lang#140276 - rust-lang#140260 - rust-lang#140405 r? `@ghost`
[DO NOT MERGE] bootstrap with `-Znext-solver=globally` A revival of rust-lang#124812. Current status: ~~`./x.py b --stage 2` passes 🎉~~ `try` builds succeed 🎉 🎉 🎉 ~~[top 100 most downloaded crates on crates.io compile](rust-lang#133502 (comment) [top 1000 most downloaded crates on crates.io compile](rust-lang#133502 (comment)) [first perf run](rust-lang#133502 (comment)) 👻 ### in-flight changes - rust-lang#124852, unsure whether I actually want to land this PR for now - rust-lang#139587 - https://github.com/lcnr/rust/tree/opaque-type-method-call - rust-lang#140302 - rust-lang#140276 - rust-lang#140260 - rust-lang#140405 r? `@ghost`
[DO NOT MERGE] bootstrap with `-Znext-solver=globally` A revival of rust-lang#124812. Current status: ~~`./x.py b --stage 2` passes 🎉~~ `try` builds succeed 🎉 🎉 🎉 ~~[top 100 most downloaded crates on crates.io compile](rust-lang#133502 (comment) [top 1000 most downloaded crates on crates.io compile](rust-lang#133502 (comment)) [first perf run](rust-lang#133502 (comment)) 👻 ### in-flight changes - rust-lang#139587 - rust-lang#140497 - rust-lang#124852, unsure whether I actually want to land this PR for now - https://github.com/lcnr/rust/tree/opaque-type-method-call - rust-lang#140260 - rust-lang#140375 - rust-lang#140405 - rust-lang#140496 r? `@ghost`
[DO NOT MERGE] bootstrap with `-Znext-solver=globally` A revival of rust-lang#124812. Current status: ~~`./x.py b --stage 2` passes 🎉~~ `try` builds succeed 🎉 🎉 🎉 ~~[top 100 most downloaded crates on crates.io compile](rust-lang#133502 (comment) [top 1000 most downloaded crates on crates.io compile](rust-lang#133502 (comment)) [first perf run](rust-lang#133502 (comment)) 👻 ### in-flight changes - rust-lang#139587 - rust-lang#140497 - rust-lang#124852, unsure whether I actually want to land this PR for now - https://github.com/lcnr/rust/tree/opaque-type-method-call - rust-lang#140260 - rust-lang#140375 - rust-lang#140405 - rust-lang#140496 r? `@ghost`
[DO NOT MERGE] bootstrap with `-Znext-solver=globally` A revival of rust-lang#124812. Current status: ~~`./x.py b --stage 2` passes 🎉~~ `try` builds succeed 🎉 🎉 🎉 [first perf run](rust-lang#133502 (comment)) 👻 ### crater This does not detect hangs or memory issues. | date | #crates | #regressions | | ---- | ------- | ------------ | | 2025.04.11 | 100 | 2 | | 2025.04.11 | 1000 | 27 | | 2025.04.17 | 10000 | 456 | | 2025.04.18 | 10000 | 437 | | 2025.04.24 | 10000 | 164 | | 2025.04.26 | 10000 | 108 | | 2025.04.28 | 10000 | 91 | | 2025.05.01 | 10000 | 145 woops | ### in-flight changes - rust-lang#139587 - rust-lang#140497 - rust-lang#124852, unsure whether I actually want to land this PR for now - https://github.com/lcnr/rust/tree/opaque-type-method-call - rust-lang#140260 - rust-lang#140375 - rust-lang#140405 - rust-lang#140496 r? `@ghost`
[DO NOT MERGE] bootstrap with `-Znext-solver=globally` A revival of rust-lang#124812. Current status: ~~`./x.py b --stage 2` passes 🎉~~ `try` builds succeed 🎉 🎉 🎉 [first perf run](rust-lang#133502 (comment)) 👻 ### crater This does not detect hangs or memory issues. | date | #crates | #regressions | | ---- | ------- | ------------ | | 2025.04.11 | 100 | 2 | | 2025.04.11 | 1000 | 27 | | 2025.04.17 | 10000 | 456 | | 2025.04.18 | 10000 | 437 | | 2025.04.24 | 10000 | 164 | | 2025.04.26 | 10000 | 108 | | 2025.04.28 | 10000 | 91 | | 2025.05.01 | 10000 | 145 woops | | 2025.05.03 | 624228[^1] | 1585 | [^1]: a complete crater run ### in-flight changes - rust-lang#139587 - rust-lang#140497 - rust-lang#124852, unsure whether I actually want to land this PR for now - https://github.com/lcnr/rust/tree/opaque-type-method-call - rust-lang#140260 - rust-lang#140375 - rust-lang#140405 - rust-lang#140496 r? `@ghost`
[DO NOT MERGE] bootstrap with `-Znext-solver=globally` A revival of rust-lang#124812. Current status: ~~`./x.py b --stage 2` passes 🎉~~ `try` builds succeed 🎉 🎉 🎉 [first perf run](rust-lang#133502 (comment)) 👻 ### crater This does not detect hangs or memory issues. | date | #crates | #regressions | | ---- | ------- | ------------ | | 2025.04.11 | 100 | 2 | | 2025.04.11 | 1000 | 27 | | 2025.04.17 | 10000 | 456 | | 2025.04.18 | 10000 | 437 | | 2025.04.24 | 10000 | 164 | | 2025.04.26 | 10000 | 108 | | 2025.04.28 | 10000 | 91 | | 2025.05.01 | 10000 | 145 woops | | 2025.05.03 | 624228[^1] | 1585 | [^1]: a complete crater run ### in-flight changes - rust-lang#139587 - rust-lang#140497 - rust-lang#124852, unsure whether I actually want to land this PR for now - https://github.com/lcnr/rust/tree/opaque-type-method-call - rust-lang#140260 - rust-lang#140375 - rust-lang#140405 - rust-lang#140496 - double recursion limit in the new solver r? `@ghost`
[DO NOT MERGE] bootstrap with `-Znext-solver=globally` A revival of rust-lang#124812. Current status: ~~`./x.py b --stage 2` passes 🎉~~ `try` builds succeed 🎉 🎉 🎉 [first perf run](rust-lang#133502 (comment)) 👻 ### crater This does not detect hangs or memory issues. | date | #crates | #regressions | | ---- | ------- | ------------ | | 2025.04.11 | 100 | 2 | | 2025.04.11 | 1000 | 27 | | 2025.04.17 | 10000 | 456 | | 2025.04.18 | 10000 | 437 | | 2025.04.24 | 10000 | 164 | | 2025.04.26 | 10000 | 108 | | 2025.04.28 | 10000 | 91 | | 2025.05.01 | 10000 | 145 woops | | 2025.05.03 | 624228[^1] | 1585 | [^1]: a complete crater run ### in-flight changes - rust-lang#139587 - rust-lang#140497 - rust-lang#124852, unsure whether I actually want to land this PR for now - https://github.com/lcnr/rust/tree/opaque-type-method-call - rust-lang#140260 - rust-lang#140375 - rust-lang#140405 - rust-lang#140496 - double recursion limit in the new solver r? `@ghost`
[DO NOT MERGE] bootstrap with `-Znext-solver=globally` A revival of rust-lang#124812. Current status: ~~`./x.py b --stage 2` passes 🎉~~ `try` builds succeed 🎉 🎉 🎉 [first perf run](rust-lang#133502 (comment)) 👻 ### crater This does not detect hangs or memory issues. | date | #crates | #regressions | | ---- | ------- | ------------ | | 2025.04.11 | 100 | 2 | | 2025.04.11 | 1000 | 27 | | 2025.04.17 | 10000 | 456 | | 2025.04.18 | 10000 | 437 | | 2025.04.24 | 10000 | 164 | | 2025.04.26 | 10000 | 108 | | 2025.04.28 | 10000 | 91 | | 2025.05.01 | 10000 | 145 woops | | 2025.05.03 | 624228[^1] | 1585 | | 2025.05.05 | 8964[^2] | 931 | [^1]: a complete crater run [^2]: only testing crates which may have regressed from the above run ### in-flight changes - rust-lang#140561 - rust-lang#140672 - rust-lang#140678 - rust-lang#136997 - rust-lang#139587 - rust-lang#140497 - rust-lang#124852, unsure whether I actually want to land this PR for now - https://github.com/lcnr/rust/tree/opaque-type-method-call - rust-lang#140260 - rust-lang#140375 - rust-lang#140405 - rust-lang#140496 - double recursion limit in the new solver r? `@ghost`
[DO NOT MERGE] bootstrap with `-Znext-solver=globally` A revival of rust-lang#124812. Current status: ~~`./x.py b --stage 2` passes 🎉~~ `try` builds succeed 🎉 🎉 🎉 [first perf run](rust-lang#133502 (comment)) 👻 ### crater This does not detect hangs or memory issues. | date | #crates | #regressions | | ---- | ------- | ------------ | | 2025.04.11 | 100 | 2 | | 2025.04.11 | 1000 | 27 | | 2025.04.17 | 10000 | 456 | | 2025.04.18 | 10000 | 437 | | 2025.04.24 | 10000 | 164 | | 2025.04.26 | 10000 | 108 | | 2025.04.28 | 10000 | 91 | | 2025.05.01 | 10000 | 145 woops | | 2025.05.03 | 624228[^1] | 1585 | | 2025.05.05 | 8964[^2] | 931 | [^1]: a complete crater run [^2]: only testing crates which may have regressed from the above run ### in-flight changes - rust-lang#140561 - rust-lang#140672 - rust-lang#140678 - rust-lang#136997 - rust-lang#139587 - rust-lang#140497 - rust-lang#124852, unsure whether I actually want to land this PR for now - https://github.com/lcnr/rust/tree/opaque-type-method-call - rust-lang#140260 - rust-lang#140375 - rust-lang#140405 - rust-lang#140496 - double recursion limit in the new solver r? `@ghost`
[DO NOT MERGE] bootstrap with `-Znext-solver=globally` A revival of rust-lang#124812. Current status: ~~`./x.py b --stage 2` passes 🎉~~ `try` builds succeed 🎉 🎉 🎉 [first perf run](rust-lang#133502 (comment)) 👻 ### crater This does not detect hangs or memory issues. | date | #crates | #regressions | | ---- | ------- | ------------ | | 2025.04.11 | 100 | 2 | | 2025.04.11 | 1000 | 27 | | 2025.04.17 | 10000 | 456 | | 2025.04.18 | 10000 | 437 | | 2025.04.24 | 10000 | 164 | | 2025.04.26 | 10000 | 108 | | 2025.04.28 | 10000 | 91 | | 2025.05.01 | 10000 | 145 woops | | 2025.05.03 | 624228[^1] | 1585 | | 2025.05.05 | 8964[^2] | 931 | | 2025.05.06 | 4401[^2] | 726 | [^1]: a complete crater run [^2]: only testing crates which may have regressed from the above run ### in-flight changes - rust-lang#140561 - rust-lang#140672 - rust-lang#140678 - rust-lang#136997 - rust-lang#139587 - rust-lang#140497 - rust-lang#124852, unsure whether I actually want to land this PR for now - https://github.com/lcnr/rust/tree/opaque-type-method-call - rust-lang#140260 - rust-lang#140375 - rust-lang#140405 - rust-lang#140496 - double recursion limit in the new solver r? `@ghost`
[DO NOT MERGE] bootstrap with `-Znext-solver=globally` A revival of rust-lang#124812. Current status: ~~`./x.py b --stage 2` passes 🎉~~ `try` builds succeed 🎉 🎉 🎉 [first perf run](rust-lang#133502 (comment)) 👻 ### crater This does not detect hangs or memory issues. | date | #crates | #regressions | | ---- | ------- | ------------ | | 2025.04.11 | 100 | 2 | | 2025.04.11 | 1000 | 27 | | 2025.04.17 | 10000 | 456 | | 2025.04.18 | 10000 | 437 | | 2025.04.24 | 10000 | 164 | | 2025.04.26 | 10000 | 108 | | 2025.04.28 | 10000 | 91 | | 2025.05.01 | 10000 | 145 woops | | 2025.05.03 | 624228[^1] | 1585 | | 2025.05.05 | 8964[^2] | 931 | | 2025.05.06 | 4401[^2] | 726 | [^1]: a complete crater run [^2]: only testing crates which may have regressed from the above run ### in-flight changes - rust-lang#140561 - rust-lang#140672 - rust-lang#140678 - rust-lang#136997 - rust-lang#139587 - rust-lang#140497 - rust-lang#124852, unsure whether I actually want to land this PR for now - https://github.com/lcnr/rust/tree/opaque-type-method-call - rust-lang#140260 - rust-lang#140375 - rust-lang#140405 - rust-lang#140496 - double recursion limit in the new solver r? `@ghost`
c20c569
to
4750eaf
Compare
This comment has been minimized.
This comment has been minimized.
compiler/rustc_next_trait_solver/src/solve/normalizes_to/mod.rs
Outdated
Show resolved
Hide resolved
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.
nits, then r=me
[DO NOT MERGE] bootstrap with `-Znext-solver=globally` A revival of rust-lang#124812. Current status: ~~`./x.py b --stage 2` passes 🎉~~ `try` builds succeed 🎉 🎉 🎉 [first perf run](rust-lang#133502 (comment)) 👻 ### crater This does not detect hangs or memory issues. | date | #crates | #regressions | | ---- | ------- | ------------ | | 2025.04.11 | 100 | 2 | | 2025.04.11 | 1000 | 27 | | 2025.04.17 | 10000 | 456 | | 2025.04.18 | 10000 | 437 | | 2025.04.24 | 10000 | 164 | | 2025.04.26 | 10000 | 108 | | 2025.04.28 | 10000 | 91 | | 2025.05.01 | 10000 | 145 woops | | 2025.05.03 | 624228[^1] | 1585 | | 2025.05.05 | 8964[^2] | 931 | | 2025.05.06 | 4401[^2] | 726 | [^1]: a complete crater run [^2]: only testing crates which may have regressed from the above run ### in-flight changes - rust-lang#140711 - rust-lang#140713 - rust-lang#140712 - rust-lang#136997 - rust-lang#139587 - rust-lang#140497 - rust-lang#124852, unsure whether I actually want to land this PR for now - https://github.com/lcnr/rust/tree/opaque-type-method-call - rust-lang#140260 - rust-lang#140375 - rust-lang#140405 - look into blanket impls for opaque type infer vars as well - rust-lang#140496 - double recursion limit in the new solver r? `@ghost`
4750eaf
to
454f6c6
Compare
454f6c6
to
8a21d1b
Compare
@bors r+ rollup |
…orm, r=lcnr Only prefer param-env candidates if they remain non-global after norm Introduce `CandidateSource::GlobalParamEnv`, and dynamically compute the `CandidateSource` based on whether the predicate contains params *post-normalization*. This code needs some cleanup and documentation. I'm just putting this up for review. cc rust-lang/trait-system-refactor-initiative#179 r? lcnr
Rollup of 15 pull requests Successful merges: - rust-lang#138736 (Sanitizers target modificators) - rust-lang#140260 (Only prefer param-env candidates if they remain non-global after norm) - rust-lang#140523 (Better error message for late/early lifetime param mismatch) - rust-lang#140579 (Remove estebank from automated review assignment) - rust-lang#140641 (detect additional uses of opaques after writeback) - rust-lang#140711 (Do not discard constraints on overflow if there was candidate ambiguity) - rust-lang#140716 (Improve `-Zremap-path-scope` tests with dependency) - rust-lang#140755 ([win][arm64] Disable various DebugInfo tests that don't work on Arm64 Windows) - rust-lang#140756 ([arm64] Pointer auth test should link with C static library statically) - rust-lang#140758 ([win][arm64] Disable MSVC Linker 'Arm Hazard' warning) - rust-lang#140759 ([win][arm64] Disable std::fs tests that require symlinks) - rust-lang#140762 (rustdoc-json: Remove newlines from attributes) - rust-lang#140764 (style: Never break within a nullary function call `func()` or a unit literal `()`) - rust-lang#140769 (Add `DefPathData::OpaqueLifetime` to avoid conflicts for remapped opaque lifetimes) - rust-lang#140773 (triagebot: Better message for changes to `tests/rustdoc-json`) r? `@ghost` `@rustbot` modify labels: rollup
…orm, r=lcnr Only prefer param-env candidates if they remain non-global after norm Introduce `CandidateSource::GlobalParamEnv`, and dynamically compute the `CandidateSource` based on whether the predicate contains params *post-normalization*. This code needs some cleanup and documentation. I'm just putting this up for review. cc rust-lang/trait-system-refactor-initiative#179 r? lcnr
…iaskrgr Rollup of 9 pull requests Successful merges: - rust-lang#140260 (Only prefer param-env candidates if they remain non-global after norm) - rust-lang#140523 (Better error message for late/early lifetime param mismatch) - rust-lang#140579 (Remove estebank from automated review assignment) - rust-lang#140641 (detect additional uses of opaques after writeback) - rust-lang#140711 (Do not discard constraints on overflow if there was candidate ambiguity) - rust-lang#140762 (rustdoc-json: Remove newlines from attributes) - rust-lang#140764 (style: Never break within a nullary function call `func()` or a unit literal `()`) - rust-lang#140769 (Add `DefPathData::OpaqueLifetime` to avoid conflicts for remapped opaque lifetimes) - rust-lang#140773 (triagebot: Better message for changes to `tests/rustdoc-json`) r? `@ghost` `@rustbot` modify labels: rollup
Introduce
CandidateSource::GlobalParamEnv
, and dynamically compute theCandidateSource
based on whether the predicate contains params post-normalization.This code needs some cleanup and documentation. I'm just putting this up for review.
cc rust-lang/trait-system-refactor-initiative#179
r? lcnr