rust/tests/ui/traits/next-solver
Matthias Krüger 16a231d8eb
Rollup merge of #119071 - lcnr:overflowo, r=compiler-errors
-Znext-solver: adapt overflow rules to avoid breakage

Do not erase overflow constraints if they are from equating the impl header when normalizing[^1].

This should be the minimal change to not break crates depending on the old project behavior of "apply impl constraints while only lazily evaluating any nested goals".

Fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/70, see https://hackmd.io/ATf4hN0NRY-w2LIVgeFsVg for the reasoning behind this.

Only keeping constraints on overflow for `normalize-to` goals as that's the only thing needed for backcompat. It also allows us to not track the origin of root obligations. The issue with root goals would be something like the following:

```rust
trait Foo {}
trait Bar {}

trait FooBar {}
impl<T: Foo + Bar> FooBar for T {}

// These two should behave the same, rn we can drop constraints for both,
// but if we don't drop `Misc` goals we would only drop the constraints for
// `FooBar` unless we track origins of root obligations.
fn func1<T: Foo + Bar>() {}
fn func2<T: FooBaz>() {}
```

[^1]: mostly, the actual rules are slightly different

r? ``@compiler-errors``
2023-12-20 09:46:11 +01:00
..
alias-relate consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
assembly consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
coherence consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
cycles consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
generalize Unconditionally register alias-relate in projection goal 2023-12-14 18:41:23 +00:00
overflow dont discard overflow from normalizes-to goals 2023-12-18 09:01:54 +01:00
projection Unconditionally register alias-relate in projection goal 2023-12-14 18:41:23 +00:00
alias-bound-preference.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
alias-bound-unsound.rs Use alias-eq in structural normalization 2023-12-18 19:22:43 +00:00
alias-bound-unsound.stderr Use alias-eq in structural normalization 2023-12-18 19:22:43 +00:00
alias-eq-in-canonical-response.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
alias-sub.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
alias_eq_cant_be_furthur_normalized.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
alias_eq_dont_use_normalizes_to_if_substs_eq.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
alias_eq_simple.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
alias_eq_substs_eq_not_intercrate.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
alias_eq_substs_eq_not_intercrate.stderr consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
array-default.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
async.fail.stderr consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
async.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
auto-with-drop_tracking_mir.fail.stderr consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
auto-with-drop_tracking_mir.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
borrowck-error.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
borrowck-error.stderr consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
builtin-fn-must-return-sized.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
builtin-fn-must-return-sized.stderr consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
canonical-int-var-eq-in-response.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
canonical-ty-var-eq-in-response.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
canonicalize-effect-var.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
cast-checks-handling-projections.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
closure-inference-guidance.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
closure-signature-inference-2.rs Unconditionally register alias-relate in projection goal 2023-12-14 18:41:23 +00:00
closure-signature-inference.rs Unconditionally register alias-relate in projection goal 2023-12-14 18:41:23 +00:00
closure-substs-ambiguity.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
coerce-ambig-alias-to-rigid-alias.rs Use alias-eq in structural normalization 2023-12-18 19:22:43 +00:00
const-param-placeholder.fail.stderr consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
const-param-placeholder.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
coroutine.fail.stderr consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
coroutine.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
deduce-closure-signature-after-normalization.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
deduce-ty-from-object.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
dedup-regions.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
destruct.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
dont-coerce-infer-to-dyn.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
dont-elaborate-for-projections.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
dont-ice-on-assoc-projection.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
dont-ice-on-assoc-projection.stderr consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
dont-loop-fulfill-on-region-constraints.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
dont-normalize-proj-with-error.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
dont-normalize-proj-with-error.stderr consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
dont-remap-tait-substs.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
dont-type_of-tait-in-defining-scope.not_send.stderr consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
dont-type_of-tait-in-defining-scope.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
dyn-any-dont-prefer-impl.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
elaborate-item-bounds.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
equating-projection-cyclically.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
escaping-bound-vars-in-writeback-normalization.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
float-canonical.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
fn-trait-closure.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
fn-trait.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
fn-trait.stderr consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
higher-ranked-dyn-bounds.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
int-var-alias-eq.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
int-var-is-send.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
issue-118950-root-region.rs Opportunistically resolve region var in canonicalizer 2023-12-15 05:02:37 +00:00
issue-118950-root-region.stderr Move type relations into submodule in rustc_infer 2023-12-15 18:13:40 +00:00
iter-filter-projection.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
lazy-nested-obligations-1.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
lazy-nested-obligations-2.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
lazy-nested-obligations-3.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
member-constraints-in-root-universe.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
more-object-bound.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
more-object-bound.stderr consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
negative-coherence-bounds.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
negative-coherence-bounds.stderr consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
nested-alias-bound.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
nested-obligations-with-bound-vars-gat.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
normalize-async-closure-in-trait.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
normalize-param-env-1.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
normalize-param-env-2.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
normalize-param-env-3.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
normalize-rcvr-for-inherent.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
normalize-unsize-rhs.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
normalized-const-built-in-op.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
normalizes_to_ignores_unnormalizable_candidate.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
normalizes_to_ignores_unnormalizable_candidate.self_infer.stderr consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
object-soundness-requires-generalization.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
object-unsafety.rs Use alias-eq in structural normalization 2023-12-18 19:22:43 +00:00
object-unsafety.stderr Use alias-eq in structural normalization 2023-12-18 19:22:43 +00:00
opportunistic-region-resolve.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
param-candidate-doesnt-shadow-project.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
param-discr-kind.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
pointee.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
pointer-like.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
pointer-like.stderr consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
prefer-candidate-no-constraints.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
prefer-param-env-on-ambiguity.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
projection-discr-kind.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
projection-discr-kind.stderr consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
slice-match-byte-lit.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
specialization-transmute.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
specialization-transmute.stderr consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
specialization-unconstrained.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
specialization-unconstrained.stderr consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
stall-num-var-auto-trait.fallback.stderr consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
stall-num-var-auto-trait.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
structural-resolve-field.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
tait-eq-proj-2.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
tait-eq-proj.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
tait-eq-tait.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
temporary-ambiguity.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
trait-upcast-lhs-needs-normalization.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
try-example.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
two-projection-param-candidates-are-ambiguous.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
two-projection-param-candidates-are-ambiguous.stderr consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
unevaluated-const-impl-trait-ref.fails.stderr consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
unevaluated-const-impl-trait-ref.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
unsafe-auto-trait-impl.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
unsize-although-ambiguous.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
unsize-good.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
upcast-right-substs.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
upcast-wrong-substs.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
upcast-wrong-substs.stderr consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00
winnow-specializing-impls.rs consistently use "next solver" instead of "new solver" 2023-12-14 15:22:37 +01:00