about summary refs log tree commit diff
path: root/compiler/rustc_resolve/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-12-20 09:46:11 +0100
committerGitHub <noreply@github.com>2023-12-20 09:46:11 +0100
commit16a231d8eba175eb7f51ea5c39509b0965c9a23b (patch)
tree2d484b81d535ad21538d3bdfa06c24543ee4c0f5 /compiler/rustc_resolve/src
parentdf4d56307b6fb32a1c2a2ce919df90d5920be6d8 (diff)
parent17705ea0a85237969d29f63a3d828d6fbaba8e2f (diff)
downloadrust-16a231d8eba175eb7f51ea5c39509b0965c9a23b.tar.gz
rust-16a231d8eba175eb7f51ea5c39509b0965c9a23b.zip
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``
Diffstat (limited to 'compiler/rustc_resolve/src')
0 files changed, 0 insertions, 0 deletions