rust/compiler/rustc_middle/src
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
..
dep_graph Reduce exposure of things. 2023-11-16 16:49:22 +11:00
hir resolve: Replace visibility table in resolver outputs with query feeding 2023-12-18 02:26:55 +03:00
hooks Rename hook. 2023-11-01 16:49:18 +00:00
infer NFC: do not clone types that are copy 2023-12-15 23:19:51 +01:00
middle Don't pass lint back out of lint decorator 2023-12-15 16:05:36 +00:00
mir Don't pass lint back out of lint decorator 2023-12-15 16:05:36 +00:00
query Replace some instances of FxHashMap/FxHashSet with stable alternatives (mostly in rustc_hir and rustc_ast_lowering) 2023-12-18 21:03:32 +01:00
thir Add never_patterns feature gate 2023-11-29 03:58:29 +01:00
traits Rollup merge of #119071 - lcnr:overflowo, r=compiler-errors 2023-12-20 09:46:11 +01:00
ty Remove param env from relation altogether 2023-12-19 17:13:10 +00:00
util Rename Session::span_diagnostic as Session::dcx. 2023-12-18 16:06:21 +11:00
arena.rs Make ConstKind and TyKind Copy 2023-12-12 01:09:12 +00:00
error.rs don't point at const usage site for resolution-time errors 2023-09-14 22:34:05 +02:00
lib.rs Use rustc_fluent_macro::fluent_messages! directly. 2023-11-26 08:38:40 +11:00
lint.rs Rename Session::span_diagnostic as Session::dcx. 2023-12-18 16:06:21 +11:00
macros.rs Rename HandlerInner::delay_span_bug as HandlerInner::span_delayed_bug. 2023-12-02 09:01:19 +11:00
metadata.rs rustc_metadata: Remove Span from ModChild 2023-04-18 17:25:04 +03:00
tests.rs
thir.rs Don't include destruction scopes in THIR 2023-12-04 16:31:13 +00:00
values.rs Move some methods from tcx.hir() to tcx 2023-12-12 06:40:29 -08:00