about summary refs log tree commit diff
path: root/compiler/rustc_borrowck/src/constraints
AgeCommit message (Collapse)AuthorLines
2025-06-03Move placeholder handling to a proper preprocessing stepAmanda Stjerna-109/+1
This commit breaks out the logic of placheolder rewriting into its own preprocessing step. The only functional change from this is that the preprocessing step (where extra `r: 'static` constraints are added) is performed upstream of Polonius legacy, finally affecting Polonius. That is mostly a by-product, though.
2025-04-28Decouple SCC annotations from SCCsAmanda Stjerna-11/+13
This rewires SCC annotations to have them be a separate, visitor-type data structure. It was broken out of #130227, which needed them to be able to remove unused annotations after computation without recomputing the SCCs themselves. As a drive-by it also removes some redundant code from the hot loop in SCC construction for a performance improvement.
2025-02-28Split the `Edges` iterator.Nicholas Nethercote-49/+57
The `Edges` iterator returns `OutlivesConstraint` elements, which are 72 bytes. This is big enough to affect performance. Return `&OutlivesConstraint` would be better. However, each `Edges` iterator is really one of two different iterators. The "from graph" case does a graph traversal and could return `&OutlivesConstraint`. But the "from static" case just does a `0..n` iteration and constructs a new `OutlivesConstraint` from that, so it can't return a reference. This commit splits `Edges into `EdgesFromGraph` and `EdgesFromStatic`, which allows them to have different return types. This is a perf win for the `wg-grammar` benchmark.
2025-02-28Adjust `ConstraintGraphDirection` methods.Nicholas Nethercote-12/+12
This facilitates the next commit.
2024-11-04Reduce visibilities.Nicholas Nethercote-1/+1
2024-09-13Rename and reorder lots of lifetimes.Nicholas Nethercote-20/+20
- Replace non-standard names like 's, 'p, 'rg, 'ck, 'parent, 'this, and 'me with vanilla 'a. These are cases where the original name isn't really any more informative than 'a. - Replace names like 'cx, 'mir, and 'body with vanilla 'a when the lifetime applies to multiple fields and so the original lifetime name isn't really accurate. - Put 'tcx last in lifetime lists, and 'a before 'b.
2024-08-30Remove `#[macro_use] extern crate tracing` from `rustc_borrowck`.Nicholas Nethercote-0/+1
2024-07-29Reformat `use` declarations.Nicholas Nethercote-10/+9
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-01Add description for why this PR was madeAmanda Stjerna-3/+25
2024-07-01Handle universe leaks by rewriting the constraint graphAmanda Stjerna-0/+84
This version is a squash-rebased version of a series of exiermental commits, since large parts of them were broken out into PR #125069. It explicitly handles universe violations in higher-kinded outlives constraints by adding extra outlives static constraints.
2024-06-12Move `RegionTracker` to `region_infer`Amanda Stjerna-94/+1
In terms of code organisation, this is a lot cleaner and allows tighter access modifiers.
2024-06-12Formatting, weird because I just did thatAmanda Stjerna-2/+2
2024-06-12Simplify path compression logicAmanda Stjerna-3/+10
2024-06-12Extend SCC construction to enable extra functionalityAmanda Stjerna-16/+88
This patch has been extracted from #123720. It specifically enhances `Sccs` to allow tracking arbitrary commutative properties of SCCs, including - reachable values (max/min) - SCC-internal values (max/min) This helps with among other things universe computation: we can now identify SCC universes as a straightforward "find max/min" operation during SCC construction. It's also more or less zero-cost; don't use the new features, don't pay for them. This commit also vastly extends the documentation of the SCCs module, which I had a very hard time following.
2024-06-06Uplift TypeRelation and RelateMichael Goulet-2/+2
2024-04-15Use RPITIT for `Successors` and `Predecessors` traitsMaybe Waffle-3/+1
Now with RPITIT instead of GAT!
2024-04-14Merge `{With,Graph}{Successors,Predecessors}` into `{Successors,Predecessors}`Maybe Waffle-9/+4
Now with GAT!
2024-04-14Merge `WithNumNodes` into DirectedGraphMaybe Waffle-2/+0
2024-02-06Invert diagnostic lints.Nicholas Nethercote-3/+0
That is, change `diagnostic_outside_of_impl` and `untranslatable_diagnostic` from `allow` to `deny`, because more than half of the compiler has be converted to use translated diagnostics. This commit removes more `deny` attributes than it adds `allow` attributes, which proves that this change is warranted.
2023-11-22Replace `no_ord_impl` with `orderable`.Nicholas Nethercote-0/+1
Similar to the previous commit, this replaces `newtype_index`'s opt-out `no_ord_impl` attribute with the opt-in `orderable` attribute.
2023-04-24Split `{Idx, IndexVec, IndexSlice}` into their own modulesMaybe Waffle-2/+2
2023-04-10Fix typos in compilerDaniPopes-15/+17
2023-04-02Use `&IndexSlice` instead of `&IndexVec` where possibleScott McMurray-2/+4
All the same reasons as for `[T]`: more general, less pointer chasing, and `&mut IndexSlice` emphasizes that it doesn't change *length*.
2023-02-19sccs infob-naber-1/+1
2022-12-20Auto merge of #105880 - Nilstrieb:make-newtypes-less-not-rust, r=oli-obkbors-6/+4
Improve syntax of `newtype_index` This makes it more like proper Rust and also makes the implementation a lot simpler. Mostly just turns weird flags in the body into proper attributes. It should probably also be converted to an attribute macro instead of function-like, but that can be done in a future PR.
2022-12-18A few small cleanups for `newtype_index`Nilstrieb-4/+2
Remove the `..` from the body, only a few invocations used it and it's inconsistent with rust syntax. Use `;` instead of `,` between consts. As the Rust syntax gods inteded.
2022-12-18Make `#[debug_format]` an attribute in `newtype_index`Nilstrieb-2/+2
This removes the `custom` format functionality as its only user was trivially migrated to using a normal format. If a new use case for a custom formatting impl pops up, you can add it back.
2022-12-18don't clone Copy typesMatthias Krüger-1/+1
2022-11-09lint auto passAndyJado-0/+3
Revert "lint auto pass" This reverts commit e58e4466384924c491a932d3f18ef50ffa5a5065.
2022-11-05simplify applying closure requirementsAli MJ Al-Nasrawy-0/+4
Don't use `ConstraintCategory::ClosureBounds`! Set the category and the span for the promoted constraints to that of the original constraint earlier than before. This eliminates the need for `closure_bounds_mapping`.
2022-10-27Revert "Make ClosureOutlivesRequirement not rely on an unresolved type"Michael Goulet-1/+1
This reverts commit a6b5f95fb028f9feb4a2957c06b35035be2c6155.
2022-10-19Make ClosureOutlivesRequirement not rely on an unresolved typeMichael Goulet-1/+1
2022-09-17Use Predicate ConstraintCategory when normalizingJack Huey-4/+1
2022-09-16Revert "Use Predicate ConstraintCategory when normalizing"Jack Huey-1/+4
This reverts commit aae37f87632dd74856d55c0cd45d2c192379c990.
2022-09-13Use Predicate ConstraintCategory when normalizingJack Huey-4/+1
2022-09-13Cleanup retrieve_closure_constraint_infoJack Huey-1/+1
2022-08-29Various changes to logging of borrowck-related codeJack Huey-2/+2
2022-05-25add def_id and substs to ConstraintCategory::CallArgumentb-naber-1/+1
2022-05-20Remove `crate` visibility usage in compilerJacob Pratt-21/+25
2022-04-22Make the lifetime accurate which is used in the region constraints partSparrowLii-6/+3
2022-04-19Add an explicit `Span` field to `OutlivesConstraint`Aaron Hill-0/+8
Previously, we would retrieve the span from the `Body` using the `locations` field. However, we may end up changing the `locations` field when moving a constraint from a promoted to a different body. We now store the original `Span` in a dedication field, so that changes to the `locations` do not affect the quality of our diagnostics.
2022-01-19Remove ordering traits from `rustc_borrowck::constraints::OutlivesConstraint`pierwill-1/+1
In two cases where this ordering was used, I've replaced the sorting to use a key that does not include DefId. I'm not sure this is correct in terms of our goals from #90317, or otherwise.
2021-09-07Move rustc_mir::borrow_check to new crate rustc_borrowck.Camille GILLOT-0/+350