rust/tests
bors 37ec98f5d3 Auto merge of #146725 - lcnr:eager-instantiate-binder, r=BoxyUwU
`-Znext-solver` instantiate predicate binder without recanonicalizing goal

This strengthens the leak check to match the old trait solver. The new trait solver now also instantiates higher ranked goals in the same scope as candidate selection, so the leak check in each candidate detects placeholder errors involving this higher ranked goal.

E.g. let's look at tests/ui/higher-ranked/leak-check/leak-check-in-selection-2.rs
```rust
trait Trait<T, U> {}
impl<'a> Trait<&'a str, &'a str> for () {}
impl<'a> Trait<&'a str, String> for () {}
fn impls_trait<T: for<'a> Trait<&'a str, U>, U>() {}

fn main() {
    impls_trait::<(), _>();
}
```
Here proving `(): for<'a> Trait<&'a str, ?u>` via `impl<'a> Trait<&'a str, &'a str> for ()` equates `?u` with `&'!a str` which results in a leak check error as `?u` cannot name `'a`. If this leak check error happens while considering candidates we drop the first impl and infer `?u` to `String`. If not, this remains ambiguous.

This behavior is a bit iffy, see the FCP proposal in rust-lang/rust#119820 for more details on why this current behavior is somewhat undesirable. However, considering placeholders from higher-ranked goals for candidate selection does allow more code to compile and a lot of the code *feels like it should compile*. **This caused us to revert the change of rust-lang/rust#119820 in rust-lang/rust#127568.**

I originally expected that we can avoid breakage with the new solver differently here, e.g. by considering OR-region constraints. However, doing so is a significant change and I don't have a great idea for how that should work. Matching the old solver behavior for now should not make this cleaner approach any more difficult in the future, so let's just go with what actually allows us to stabilize the new solver for now.

This PR changing the new solver to match the behavior of the old one wrt the leak check. As the new solver is already used by default in coherence, this allows more code to compile, see `tests/ui/higher-ranked/leak-check/leak-check-in-selection-7-coherence.rs`:
```rust
struct W<T, U>(T, U);

trait Trait<T> {}
// using this impl results in a higher-ranked region error.
impl<'a> Trait<W<&'a str, &'a str>> for () {}
impl<'a> Trait<W<&'a str, String>> for () {}

trait NotString {}
impl NotString for &str {}
impl NotString for u32 {}

trait Overlap<U> {}
impl<T: for<'a> Trait<W<&'a str, U>>, U> Overlap<U> for T {}
impl<U: NotString> Overlap<U> for () {}

fn main() {}
```

This behavior is quite arbitrary and not something I expect users to rely on in practice, however, it should still go through an FCP imo.

r? `@BoxyUwU` originally implemented by `@compiler-errors` in https://github.com/rust-lang/rust/pull/136997. Closes https://github.com/rust-lang/trait-system-refactor-initiative/issues/120.
2025-10-21 21:09:46 +00:00
..
assembly-llvm Add support for //@ ignore-i586 2025-10-21 12:39:49 +11:00
auxiliary Add test for addrspacecasting global vars 2025-09-03 08:40:51 +02:00
codegen-llvm Auto merge of #147476 - ehuss:cold-attribute-test, r=chenyukang 2025-10-21 07:41:32 +00:00
codegen-units pub async fn implementation coroutine (func::{closure#0}) is monomorphized, when func itself is monomorphized 2025-09-01 13:45:00 +07:00
coverage Auto merge of #145882 - m-ou-se:format-args-extend-1-arg, r=petrochenkov 2025-09-26 04:34:09 +00:00
coverage-run-rustdoc
crashes instantiate predicate binder without recanonicalizing goal in new solver 2025-10-20 10:31:08 +02:00
debuginfo Auto merge of #146414 - GuillaumeGomez:run-test-with-gcc-backend, r=Kobzol 2025-10-14 09:21:23 +00:00
incremental Ignore failing incremental tests for GCC backend 2025-10-13 15:20:49 +02:00
mir-opt GVN: Preserve derefs at terminators that cannot write to memory 2025-10-16 23:03:05 +08:00
pretty Update autodiff tests for the new intrinsics impl 2025-08-14 18:33:43 +00:00
run-make Rollup merge of #147526 - bjorn3:alloc_shim_weak_shape, r=petrochenkov,RalfJung 2025-10-14 19:47:29 +02:00
run-make-cargo Skip the panic-immediate-abort-works test when cross-compiling 2025-09-22 21:13:38 -04:00
rustdoc Add regression test for doc cfg applied on public items inside private items 2025-09-29 18:08:51 +02:00
rustdoc-gui rustdoc-search: add test case for throbber 2025-10-07 12:59:58 -07:00
rustdoc-js rustdoc: add testcase for traitParent deduplication 2025-10-02 15:29:22 -05:00
rustdoc-js-std rustdoc search: relax rules for identifiers 2025-10-20 12:58:55 -05:00
rustdoc-json Add tests for doc(attribute = "...") attribute 2025-08-28 15:56:30 +02:00
rustdoc-ui Rollup merge of #147734 - fmease:tighten-relaxed, r=lcnr 2025-10-20 22:30:53 +11:00
ui Auto merge of #146725 - lcnr:eager-instantiate-binder, r=BoxyUwU 2025-10-21 21:09:46 +00:00
ui-fulldeps use declarative macro for #[derive(TryFromU32)] 2025-10-06 14:54:38 +00:00
COMPILER_TESTS.md