rust/tests
bors 13c38730d9 Auto merge of #150485 - dianqk:gvn-ssa-borrow, r=cjgillot
GVN: Only propagate borrows from SSA locals

Fixes https://github.com/rust-lang/rust/issues/141313. This is a more principled fix than https://github.com/rust-lang/rust/pull/147886.

Using a reference that is not a borrowing of an SSA local at a new location may be UB.

The PR has two major changes.

The first one, when introducing a new dereference at a new location, is that the reference must point to an SSA local or be an immutable argument. `dereference_address` has handled SSA locals.

The second one, if we cannot guard to the reference point to an SSA local in `visit_assign`, we have to rewrite the value to opaque. This avoids unifying the following dereferences that also are references:

```rust
let b: &T = *a;
// ... `a` is allowed to be modified. `c` and `b` have different borrowing lifetime.
// Unifying them will extend the lifetime of `b`.
let c: &T = *a; 
```

See also https://github.com/rust-lang/rust/issues/130853.

This still allows unifying non-reference dereferences:

```rust
let a: &T = ...;
let b: T = *a;
// ... a is NOT allowed to be modified.
let c: T = *a; 
```

r? @cjgillot
2026-02-08 05:03:48 +00:00
..
assembly-llvm Move bigint helper tracking issues 2026-02-02 18:45:26 -05:00
auxiliary Rollup merge of #150368 - minicore-ordering, r=workingjubilee 2026-01-11 09:56:38 +01:00
build-std/configurations Test that -Zbuild-std=core works on a variety of profiles 2026-01-14 20:39:12 -05:00
codegen-llvm Rollup merge of #151576 - tgross35:stabilize-cold-path, r=jhpratt 2026-02-07 13:06:35 +01:00
codegen-units address review comments; fix CI 2026-01-01 19:17:11 -05:00
coverage coverage: Add a test case for a previously-unknown span mismatch 2026-02-03 22:53:38 +11:00
coverage-run-rustdoc
crashes Reorganize tests that no longer crash 2026-02-06 14:44:04 +09:00
debuginfo Ignore all debuginfo tests for LLDB that we do not run in CI 2026-02-02 18:13:43 -08:00
incremental Port rustc_clean to attribute parser 2026-02-04 20:58:02 +00:00
mir-opt GVN: Do not unify dereferences if they are references 2026-02-04 21:55:57 +08:00
pretty Update uitests 2026-01-19 21:50:29 +01:00
run-make Disable the run-make/translation test for now 2026-02-07 10:30:42 +01:00
run-make-cargo Update cargo submodule 2026-01-30 19:15:24 -05:00
rustdoc-gui Remove the 4 failing tests from rustdoc-gui 2026-02-06 01:13:41 +01:00
rustdoc-html resolve: Mark items under ambigous imports as exported 2026-01-27 16:24:53 +03:00
rustdoc-js
rustdoc-js-std Explicitly export core and std macros 2026-01-13 08:47:48 +01:00
rustdoc-json resolve: Mark items under ambigous imports as exported 2026-01-27 16:24:53 +03:00
rustdoc-ui Fix existing messages in stderrs 2026-02-07 09:13:42 +01:00
ui Rollup merge of #152284 - Zalathar:bogus-thir-let, r=nnethercote 2026-02-08 12:54:00 +11:00
ui-fulldeps Update remaining session-diagnostics tests 2026-02-07 19:34:21 +01:00
COMPILER_TESTS.md