summary refs log tree commit diff
path: root/compiler/rustc_borrowck/src/dataflow.rs
AgeCommit message (Collapse)AuthorLines
2023-12-10remove redundant importssurechen-1/+1
detects redundant imports that can be eliminated. for #117772 : In order to facilitate review and modification, split the checking code and removing redundant imports code into two PR.
2023-12-08Tweak `GenKillAnalysis`.Nicholas Nethercote-2/+2
`GenKillAnalysis` has five methods that take a transfer function arg: - `statement_effect` - `before_statement_effect` - `terminator_effect` - `before_terminator_effect` - `call_return_effect` All the transfer function args have type `&mut impl GenKill<Self::Idx>`, except for `terminator_effect`, which takes the simpler `Self::Domain`. But only the first two need to be `impl GenKill`. The other three can all be `Self::Domain`, just like `Analysis`. So this commit changes the last two to take `Self::Domain`, making `GenKillAnalysis` and `Analysis` more similar. (Another idea would be to make all these methods `impl GenKill`. But that doesn't work: `MaybeInitializedPlaces::terminator_effect` requires the arg be `Self::Domain` so that `self_is_unwind_dead(place, state)` can be called on it.)
2023-12-08Remove `BorrowckAnalyses`.Nicholas Nethercote-28/+18
This results in two non-generic types being used: `BorrowckResults` and `BorrowckFlowState`. It's a net reduction in lines of code, and a little easier to read.
2023-12-08Remove `impl_visitable!`.Nicholas Nethercote-65/+62
It is used just once. With it removed, the relevant code is a little boilerplate-y but much easier to read, and is the same length. Overall I think it's an improvement.
2023-12-01improve NLL/polonius scope equality assertionRémy Rakic-1/+2
2023-11-25Auto merge of #118203 - nnethercote:rustc_mir_dataflow, r=cjgillotbors-17/+17
Minor `rustc_mir_dataflow` cleanups r? `@cjgillot`
2023-11-23Use `'mir` lifetime name more.Nicholas Nethercote-17/+17
Some types have a `body: &'mir Body<'tcx>` and some have `body: &'a Body<'tcx>`. The former is more readable, so this commit converts some fo the latter to the former.
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-11-04traverse region graph instead of SCCs to compute polonius loan scopesRémy Rakic-3/+3
By using SCC for better performance, we also have to take into account SCCs whose representative is an existential region but also contains a placeholder. By only checking the representative, we may miss that the loan escapes the function. This can be fixed by picking a better representative, or removing placeholders from the main path. This is the simplest fix: forgo efficiency and traverse the region graph instead of the SCCs.
2023-10-20consider a loan escapes the function via applied member constraintsRémy Rakic-7/+14
2023-10-05compute NLL loan scopes with liveness in `-Zpolonius=next`Rémy Rakic-1/+183
2023-10-05add note why a function is pubRémy Rakic-0/+1
2023-10-04document Borrows dataflow analysisRémy Rakic-0/+7
2023-10-04rename ancient regioncxRémy Rakic-2/+2
2023-08-16Make TerminatorEdge plural.Camille GILLOT-2/+2
2023-08-16Allow apply_terminator_effect to customize edges.Camille GILLOT-6/+9
2023-08-16Move domain_size to GenKillAnalysis.Camille GILLOT-0/+4
2023-07-25inline format!() args from rustc_codegen_llvm to the end (4)Matthias Krüger-1/+1
r? @WaffleLapkin
2023-06-28Rollup merge of #112236 - cjgillot:interval-kill, r=davidtwcoDylan DPC-51/+43
Simplify computation of killed borrows Follow-up to https://github.com/rust-lang/rust/pull/111759 Processing the first block manually once makes the pre-order walk simpler.
2023-06-08Auto merge of #108293 - Jarcho:mut_analyses, r=eholkbors-9/+9
Take MIR dataflow analyses by mutable reference The main motivation here is any analysis requiring dynamically sized scratch memory to work. One concrete example would be pointer target tracking, where tracking the results of a dereference can result in multiple possible targets. This leads to processing multi-level dereferences requiring the ability to handle a changing number of potential targets per step. A (simplified) function for this would be `fn apply_deref(potential_targets: &mut Vec<Target>)` which would use the scratch space contained in the analysis to send arguments and receive the results. The alternative to this would be to wrap everything in a `RefCell`, which is what `MaybeRequiresStorage` currently does. This comes with a small perf cost and loses the compiler's guarantee that we don't try to take multiple borrows at the same time. For the implementation: * `AnalysisResults` is an unfortunate requirement to avoid an unconstrained type parameter error. * `CloneAnalysis` could just be `Clone` instead, but that would result in more work than is required to have multiple cursors over the same result set. * `ResultsVisitor` now takes the results type on in each function as there's no other way to have access to the analysis without cloning it. This could use an associated type rather than a type parameter, but the current approach makes it easier to not care about the type when it's not necessary. * `MaybeRequiresStorage` now no longer uses a `RefCell`, but the graphviz formatter now does. It could be removed, but that would require even more changes and doesn't really seem necessary.
2023-06-02Simplify pre-order algorithm.Camille GILLOT-51/+43
2023-05-25Auto merge of #111925 - Manishearth:rollup-z6z6l2v, r=Manishearthbors-15/+20
Rollup of 5 pull requests Successful merges: - #111741 (Use `ObligationCtxt` in custom type ops) - #111840 (Expose more information in `get_body_with_borrowck_facts`) - #111876 (Roll compiler_builtins to 0.1.92) - #111912 (Use `Option::is_some_and` and `Result::is_ok_and` in the compiler ) - #111915 (libtest: Improve error when missing `-Zunstable-options`) r? `@ghost` `@rustbot` modify labels: rollup
2023-05-23Allow consumers to retrieve borrowck outputJonáš Fiala-15/+20
2023-05-19Leverage the interval property to precompute borrow kill points.Camille GILLOT-49/+46
2023-05-18Take MIR dataflow analyses by mutable reference.Jason Newcomb-9/+9
2023-05-09Reduce BitSet size used in `Borrows` dataflow analysisvlad20012-1/+1
2023-04-13Remove `impl ToRegionVid for RegionVid`.Nicholas Nethercote-4/+2
It's weird and unnecessary.
2023-03-15unequal → not equalgimbles-1/+1
2023-03-09Introduce a no-op PlaceMention statement for `let _ =`.Camille GILLOT-0/+1
2023-03-05Remove `allow(potential_query_instability)` from `borrowck`clubby789-4/+4
2023-01-23Create stable metric to measure long computation in Const EvalBryan Garza-0/+1
This patch adds a `MirPass` that tracks the number of back-edges and function calls in the CFG, adds a new MIR instruction to increment a counter every time they are encountered during Const Eval, and emit a warning if a configured limit is breached.
2022-12-18A few small cleanups for `newtype_index`Nilstrieb-2/+1
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-1/+1
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-06`rustc_borrowck`: remove `ref` patternsMaybe Waffle-5/+5
2022-11-09lint auto passAndyJado-0/+2
Revert "lint auto pass" This reverts commit e58e4466384924c491a932d3f18ef50ffa5a5065.
2022-09-06Generalize the Assume intrinsic statement to a general Intrinsic statementOli Scherer-2/+1
2022-09-06Lower the assume intrinsic to a MIR statementOli Scherer-0/+1
2022-08-26Replace `Body::basic_blocks()` with field accessTomasz Miąsko-1/+1
2022-05-20Remove `crate` visibility usage in compilerJacob Pratt-1/+1
2022-05-17Change `Successors` to `impl Iterator<Item = BasicBlock>`SparrowLii-1/+1
2022-04-11Add new `Deinit` statement kindJakob Degen-0/+1
2022-03-30Spellchecking compiler codeYuri Astrakhan-2/+2
Address some spelling mistakes in strings, private function names, and function params.
2022-01-12Remove deprecated LLVM-style inline assemblyTomasz Miąsko-9/+0
2021-12-03Add initial AST and MIR support for unwinding from inline assemblyAmanieu d'Antras-4/+2
2021-10-08clippy::complexity fixesMatthias Krüger-1/+1
2021-09-07Move the dataflow framework to its own crate.Camille GILLOT-6/+6
2021-09-07Move rustc_mir::borrow_check to new crate rustc_borrowck.Camille GILLOT-0/+448