rust/src/tools
Stuart Cook e5b98a9c21
Rollup merge of #143093 - lqd:polonius-pre-alpha, r=jackh726
Simplify polonius location-sensitive analysis

This PR reworks the location-sensitive analysis into what we think is a worthwhile subset of the datalog analysis. A sort of polonius alpha analysis that handles NLL problem case 3 and more, but is still using the faster "reachability as an approximation of liveness", as well as the same loans-in-scope computation as NLLs -- and thus doesn't handle full flow-sensitivity like the datalog implementation.

In the last few months, we've identified this subset as being actionable:
- we believe we can make a stabilizable version of this analysis
- it is an improvement over the status quo
- it can also be modeled in a-mir-formality, or some other formalism, for assurances about soundness, and I believe ````````@nikomatsakis```````` is interested in looking into this during H2.
- and we've identified the areas of work we wish to explore later to gradually expand the supported cases: the differences between reachability and liveness, support of kills, and considerations of time-traveling, for example.

The approach in this PR is to try less to have the graph only represent live paths, by checking whether we reach a live region during traversal and recording the loan as live there, instead of equating traversal with liveness like today because it has subtleties with the typeck edges in statements (that could forward loans to the successor point without ensuring their liveness). We can then also simplify these typeck stmt edges. And we also can simplify traversal by removing looking at kills, because that's enough to handle a bunch of NLL problem 3 cases -- and we can gradually support them more and more in traversal in the future, to reduce the approximation of liveness.

There's still some in-progress pieces of work w/r/t opaque types that I'm expecting [lcnr's opaque types rework](https://github.com/rust-lang/rust/pull/139587), and [amanda's SCCs rework](https://github.com/rust-lang/rust/pull/130227) to handle. That didn't seem to show up in tests until I rebased today (and shows lack of test coverage once again) when https://github.com/rust-lang/rust/pull/142255 introduced a couple of test failures with the new captures rules from edition 2024. It's not unexpected since we know more work is needed with member constraints (and we're not even using SCCs in this prototype yet)

I'll look into these anyways, both for future work, and checking how these other 2 PRs would change things.

---

I'm not sure the following means a lot until we have some formalism in-place, but:
- I've changed the polonius compare-mode to use this analysis: the tests pass with it, except 2 cases with minor diagnostics differences, and the 2 edition 2024 opaque types one I mentioned above and need to investigate
- things that are expected to work still do work: it bootstraps, can run our rustc-perf benchmarks (and the results are not even that bad), and a crater run didn't find any regressions (forgetting that crater currently fails to test around a quarter of all crates 👼)
- I've added tests with improvements, like the NLL problem case 3 and others, as well as some that behave the same as NLLs today and are thus worse than the datalog implementation

r? ````````@jackh726````````

(no rush I know you're deep in phd work and "implmentating" the new trait solver for r-a :p <3)

This also fixes rust-lang/rust#135646, a diagnostics ICE from the previous implementation.
2025-08-10 19:45:46 +10:00
..
build-manifest Add windows-gnullvm hosts to the manifest 2025-06-26 01:42:44 +02:00
bump-stage0 Remove git_repository field from GitConfig 2025-04-23 10:41:20 +02:00
cargo@840b83a10f Update cargo 2025-07-31 10:03:06 -04:00
cargotest
clippy remove P 2025-08-09 15:47:01 +08:00
collect-license-metadata
compiletest Rollup merge of #143093 - lqd:polonius-pre-alpha, r=jackh726 2025-08-10 19:45:46 +10:00
coverage-dump Update miniz_oxide dependency of coverage_dump 2025-05-10 18:35:20 +02:00
enzyme@58af4e9e6c update enzyme submodule to handle llvm 21 2025-08-07 16:31:00 -07:00
error_index_generator
features-status-dump Remove backtrace dep from anyhow in features status dump tool 2025-05-01 07:45:47 -04:00
generate-copyright bump cargo_metadata 2025-07-27 12:47:39 +03:00
generate-windows-sys
html-checker
jsondocck Compiletest: Simplify {Html,Json}DocCk directive handling 2025-07-13 16:00:23 +02:00
jsondoclint rustdoc_json: represent generic args consistently. 2025-06-21 13:52:46 +10:00
libcxx-version
linkchecker add --link-targets-dir flag to linkchecker 2025-07-28 11:23:11 +02:00
lint-docs Rollup merge of #143631 - hkBst:update-escaper-2, r=compiler-errors 2025-07-17 10:41:45 +02:00
lld-wrapper
llvm-bitcode-linker
miri Auto merge of #145126 - tgross35:rollup-6w87usd, r=tgross35 2025-08-08 20:53:33 +00:00
miropt-test-tools miropt: move to edition 2024 2025-07-22 15:02:34 +00:00
nix-dev-shell
opt-dist Update codegen_{cranelift,gcc} and opt-dist to use build.compiletest-allow-stage0 2025-07-30 19:55:07 +08:00
remote-test-client remote-test-client: Exit code 128 + <signal-number> instead of 3 2025-07-04 20:44:26 +02:00
remote-test-server
replace-version-placeholder
run-make-support Rollup merge of #144931 - dpaoliello:msvc-wholearchive, r=jieyouxu 2025-08-08 12:52:54 +10:00
rust-analyzer remove P 2025-08-09 15:47:01 +08:00
rust-installer Update README.md 2025-06-29 12:29:28 +03:00
rustbook cargo update 2025-08-03 00:27:18 +00:00
rustc-perf@dde879cf10 Update rustc-perf submodule 2025-07-29 16:18:52 +02:00
rustdoc
rustdoc-gui Update browser-ui-test version to 0.21.1 2025-07-03 18:08:23 +02:00
rustdoc-gui-test integrate build_helper::npm into js checks and package.json usage 2025-07-19 14:56:42 -05:00
rustdoc-js Update rustdoc search tester to new alias output 2025-07-16 14:27:22 +02:00
rustdoc-themes
rustfmt remove P 2025-08-09 15:47:01 +08:00
test-float-parse Remove uncessary parens in closure body with unused lint 2025-07-10 09:25:56 +08:00
tidy Rollup merge of #141624 - jyn514:env-var-stubs, r=BoxyUwU 2025-08-10 19:45:45 +10:00
tier-check tiercheck: edition 2024 2025-07-14 08:30:27 +00:00
unicode-table-generator unicode-table-gen: more clippy fixes 2025-07-18 15:03:43 +00:00
unstable-book-gen Rollup merge of #141624 - jyn514:env-var-stubs, r=BoxyUwU 2025-08-10 19:45:45 +10:00
wasm-component-ld Update wasm-component-ld to 0.5.14 2025-06-24 15:59:35 -07:00
x x: use let-else 2025-07-11 05:38:05 +00:00
cherry-pick.sh
publish_toolstate.py