1
Fork 0
rust/compiler/rustc_borrowck/src
bors 426d173423 Auto merge of #134268 - lqd:polonius-next, r=jackh726
Foundations of location-sensitive polonius

I'd like to land the prototype I'm describing in the [polonius project goal](https://github.com/rust-lang/rust-project-goals/issues/118). It still is incomplete and naive and terrible but it's working "well enough" to consider landing.

I'd also like to make review easier by not opening a huge PR, but have a couple small-ish ones (the +/- line change summary of this PR looks big, but >80% is moving datalog to a single place).

This PR starts laying the foundation for that work:
- it refactors and collects 99% of the old datalog fact gen, which was spread around everywhere, into a single dedicated module. It's still present at 3 small places (one of which we should revert anyways) that are kinda deep within localized components and are not as easily extractable into the rest of fact gen, so it's fine for now.
- starts introducing the localized constraints, the building blocks of the naive way of implementing the location-sensitive analysis in-tree, which is roughly sketched out in https://smallcultfollowing.com/babysteps/blog/2023/09/22/polonius-part-1/ and https://smallcultfollowing.com/babysteps/blog/2023/09/29/polonius-part-2/ but with a different vibe than per-point environments described in these posts, just `r1@p: r2@q` constraints.
- sets up the skeleton of generating these localized constraints: converting NLL typeck constraints, and creating liveness constraints
- introduces the polonius dual to NLL MIR to help development and debugging. It doesn't do much currently but is a way to see these localized constraints: it's an NLL MIR dump + a dumb listing of the constraints, that can be dumped with `-Zdump-mir=polonius -Zpolonius=next`. Its current state is not intended to be a long-term thing, just for testing purposes -- I will replace its contents in the future with a different approach (an HTML+js file where we can more easily explore/filter/trace these constraints and loan reachability, have mermaid graphs of the usual graphviz dumps, etc).

I've started documenting the approach in this PR, I'll add more in the future. It's quite simple, and should be very clear when more constraints are introduced anyways.

r? `@matthewjasper`

Best reviewed per commit so that the datalog move is less bothersome to read, but if you'd prefer we separate that into a different PR, I can do that (and michael has offered to review these more mechanical changes if it'd help).
2024-12-21 21:15:31 +00:00
..
constraints Reduce visibilities. 2024-11-04 15:43:45 +11:00
diagnostics introduce LateParamRegionKind 2024-12-18 16:05:44 +01:00
polonius address review comments 2024-12-18 07:33:26 +00:00
region_infer Auto merge of #134268 - lqd:polonius-next, r=jackh726 2024-12-21 21:15:31 +00:00
type_check remove non-borrowck member constraints 2024-12-20 10:04:01 +01:00
util Add warn(unreachable_pub) to rustc_borrowck. 2024-08-16 08:46:57 +10:00
borrow_set.rs Make BorrowSet/BorrowData fields accessible via public getters 2024-12-12 12:34:43 -08:00
borrowck_errors.rs Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
consumers.rs Make some types and methods related to Polonius + Miri public. 2024-12-11 17:28:49 -08:00
dataflow.rs Simplify dataflow SwitchInt handling. 2024-12-16 09:36:07 +11:00
def_use.rs Rollup merge of #126013 - nnethercote:unreachable_pub, r=Urgau 2024-08-27 00:41:57 +02:00
facts.rs Dogfood feature(file_buffered) 2024-09-24 14:25:16 -07:00
lib.rs Auto merge of #134268 - lqd:polonius-next, r=jackh726 2024-12-21 21:15:31 +00:00
location.rs Remove #[macro_use] extern crate tracing from rustc_borrowck. 2024-08-30 17:14:53 +10:00
member_constraints.rs remove non-borrowck member constraints 2024-12-20 10:04:01 +01:00
nll.rs address review comments 2024-12-18 07:33:26 +00:00
path_utils.rs compiler: Replace rustc_target with _abi in _borrowck 2024-11-02 20:31:47 -07:00
place_ext.rs Remove #[macro_use] extern crate tracing from rustc_borrowck. 2024-08-30 17:14:53 +10:00
places_conflict.rs update rustc_borrowck::places_conflict doc-comment 2024-10-10 10:33:29 +03:00
prefixes.rs Remove unnecessary continue. 2024-11-04 17:36:25 +11:00
renumber.rs uplift fold_regions to rustc_type_ir 2024-11-28 10:40:58 +01:00
session_diagnostics.rs Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
universal_regions.rs Auto merge of #134501 - lcnr:member-constraints-yeet, r=oli-obk 2024-12-21 12:37:40 +00:00
used_muts.rs Remove unnecessary lifetimes in dataflow structs. 2024-09-09 16:14:18 +10:00