about summary refs log tree commit diff
path: root/compiler/rustc_borrowck/src/lib.rs
AgeCommit message (Collapse)AuthorLines
2025-07-08Expose nested bodies in rustc_borrowck::consumersNico Lehmann-24/+19
2025-06-22Init local_names lazily for borrowck diagnosticsKornel-25/+5
2025-06-13use `MixedBitSet` for borrows-in-scope computationRémy Rakic-3/+3
Some code can have a few thousand loans, and this bitset is better suited to these somewhat sparse cases. That includes a couple of rustc-perf benchmarks.
2025-06-05Auto merge of #140466 - amandasystems:move-to-preprocessing-step, r=lcnrbors-0/+1
Move placeholder handling to a proper preprocessing step This commit breaks out the logic of placheolder rewriting into its own preprocessing step. It's one of the more boring parts of #130227. 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. This should be reviewable by anyone in the compiler team, so r? rust-lang/compiler
2025-06-04Use an enum for SCC representatives, plus other code reviewAmanda Stjerna-1/+1
Co-authored-by: lcnr <rust@lcnr.de>
2025-06-03Move placeholder handling to a proper preprocessing stepAmanda Stjerna-0/+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-05-27move `MaybeInitializedPlaces` computation to where it's usedRémy Rakic-8/+1
This dataflow analysis is only used by `liveness::trace`. We move it there to make it lazy.
2025-05-12update cfg(bootstrap)Pietro Albini-1/+0
2025-05-07Auto merge of #140751 - GuillaumeGomez:rollup-eahw4ta, r=GuillaumeGomezbors-12/+14
Rollup of 8 pull requests Successful merges: - #140234 (Separate dataflow analysis and results) - #140614 (Correct warning message in restricted visibility) - #140671 (Parser: Recover error from named params while parse_path) - #140700 (Don't crash on error codes passed to `--explain` which exceed our internal limit of 9999 ) - #140706 ([rustdoc] Ensure that temporary doctest folder is correctly removed even if doctests failed) - #140734 (Fix regression from #140393 for espidf / horizon / nuttx / vita) - #140741 (add armv5te-unknown-linux-gnueabi target maintainer) - #140745 (run-make-support: set rustc dylib path for cargo wrapper) r? `@ghost` `@rustbot` modify labels: rollup
2025-05-07Rollup merge of #140234 - nnethercote:separate-Analysis-and-Results, r=davidtwcoGuillaume Gomez-12/+14
Separate dataflow analysis and results `Analysis` gets put into `Results` with `EntryStates`, by `iterate_to_fixpoint`. This has two problems: - `Results` is passed various places where only `Analysis` is needed. - `EntryStates` is passed around mutably everywhere even though it is immutable. This commit mostly separates `Analysis` from `Results` and fixes these two problems. r? `@davidtwco`
2025-05-02borrowck nested items in dead codelcnr-0/+8
2025-04-28AsyncDrop implementation using shim codegen of ↵Andrew Zhogin-1/+8
async_drop_in_place::{closure}, scoped async drop added.
2025-04-25Rollup merge of #140202 - est31:let_chains_feature_compiler, r=lcnrMatthias Krüger-1/+1
Make #![feature(let_chains)] bootstrap conditional in compiler/ Let chains have been stabilized recently in #132833, so we can remove the gating from our uses in the compiler (as the compiler uses edition 2024).
2025-04-24Separate `Analysis` and `Results`.Nicholas Nethercote-9/+11
`Results` contains and `Analysis` and an `EntryStates`. The unfortunate thing about this is that the analysis needs to be mutable everywhere (`&mut Analysis`) which forces the `Results` to be mutable everywhere, even though `EntryStates` is immutable everywhere. To fix this, this commit renames `Results` as `AnalysisAndResults`, renames `EntryStates` as `Results`, and separates the analysis and results as much as possible. (`AnalysisAndResults` doesn't get much use, it's mostly there to facilitate method chaining of `iterate_to_fixpoint`.) `Results` is immutable everywhere, which: - is a bit clearer on how the data is used, - avoids an unnecessary clone of entry states in `locals_live_across_suspend_points`, and - moves the results outside the `RefCell` in Formatter. The commit also reformulates `ResultsHandle` as the generic `CowMut`, which is simpler than `ResultsHandle` because it doesn't need the `'tcx` lifetime and the trait bounds. It also which sits nicely alongside the new use of `Cow` in `ResultsCursor`.
2025-04-24Pass `Analysis` to `visit_*` instead of `Results`.Nicholas Nethercote-3/+3
Every `Results` contains an `Analysis`, but these methods only need the `Analysis`. No point passing them more data than they need.
2025-04-23Make #![feature(let_chains)] bootstrap conditional in compiler/est31-1/+1
2025-04-22Remove unnecessary lifetime on `ResultsVisitor`.Nicholas Nethercote-6/+6
2025-04-14Rollup merge of #139767 - compiler-errors:www, r=oli-obkMatthias Krüger-1/+1
Visit place in `BackwardIncompatibleDropHint` statement Remove a weird hack from the `LocalUpdater` where we were manually visiting the place stored in a `StatementKind::BackwardIncompatibleDropHint` because the MIR visitor impls weren't doing so. Also, clean up `BackwardIncompatibleDropHint`s in `CleanupPostBorrowck`, since they're not needed for runtime MIR.
2025-04-14Auto merge of #139781 - jhpratt:rollup-qadsjvb, r=jhprattbors-84/+63
Rollup of 9 pull requests Successful merges: - #138336 (Improve `-Z crate-attr` diagnostics) - #139636 (Encode dep node edge count as u32 instead of usize) - #139666 (cleanup `mir_borrowck`) - #139695 (compiletest: consistently use `camino::{Utf8Path,Utf8PathBuf}` throughout) - #139699 (Proactively update coroutine drop shim's phase to account for later passes applied during shim query) - #139718 (enforce unsafe attributes in pre-2024 editions by default) - #139722 (Move some things to rustc_type_ir) - #139760 (UI tests: migrate remaining compile time `error-pattern`s to line annotations when possible) - #139776 (Switch attrs to `diagnostic::on_unimplemented`) r? `@ghost` `@rustbot` modify labels: rollup
2025-04-14Auto merge of #124141 - ↵bors-1/+0
nnethercote:rm-Nonterminal-and-TokenKind-Interpolated, r=petrochenkov Remove `Nonterminal` and `TokenKind::Interpolated` A third attempt at this; the first attempt was #96724 and the second was #114647. r? `@ghost`
2025-04-13Visit place in BackwardIncompatibleDropHint statementMichael Goulet-1/+1
2025-04-11don't rely on `locals_are_invalidated_at_exit`lcnr-32/+24
2025-04-11move `dump_polonius_mir`lcnr-10/+8
2025-04-11`MirBorrowckCtxt::polonius_output` to reflcnr-6/+4
2025-04-11do not buffer `#[rustc_regions]` dumplcnr-2/+2
2025-04-11`local_names` creation to `mbcx` creationlcnr-20/+20
2025-04-11use input `def_id` to compute `movable_coroutine`lcnr-11/+2
This previously incorrectly returned `true` for parent functions whose first statement was `let local = <coroutine>;`. While that didn't cause any bugs as we only ever access `movable_coroutine` for `yield` terminators. It was still wrong.
2025-04-11consistent name for `UniversalRegions`lcnr-2/+2
2025-04-08add negative impllcnr-4/+8
2025-04-08move `ClosureRegionRequirements` to `rustc_borrowck`lcnr-1/+138
2025-04-08borrowck typeck children together with their parentlcnr-49/+68
2025-04-03add `TypingMode::Borrowck`lcnr-31/+7
2025-04-02Remove `recursion_limit` increases.Nicholas Nethercote-1/+0
These are no longer needed now that `Nonterminal` is gone.
2025-04-01simplify Interner opaque types APIlcnr-1/+2
2025-04-01call `mir_promoted` inside of `do_mir_borrowck`lcnr-9/+7
2025-03-19merge opaque types of nested bodieslcnr-3/+4
2025-03-17Flatten and simplify some control flowYotam Ofek-10/+6
2025-03-15Squash fold into tyMichael Goulet-2/+1
2025-03-12Auto merge of #138414 - matthiaskrgr:rollup-9ablqdb, r=matthiaskrgrbors-1/+0
Rollup of 7 pull requests Successful merges: - #137314 (change definitely unproductive cycles to error) - #137701 (Convert `ShardedHashMap` to use `hashbrown::HashTable`) - #138269 (uefi: fs: Implement FileType, FilePermissions and FileAttr) - #138331 (Use `RUSTC_LINT_FLAGS` more) - #138345 (Some autodiff cleanups) - #138387 (intrinsics: remove unnecessary leading underscore from argument names) - #138390 (fix incorrect tracing log) r? `@ghost` `@rustbot` modify labels: rollup
2025-03-12Auto merge of #138083 - nnethercote:rm-NtItem-NtStmt, r=petrochenkovbors-0/+1
Remove `NtItem` and `NtStmt` Another piece of #124141. r? `@petrochenkov`
2025-03-11Remove `#![warn(unreachable_pub)]` from all `compiler/` crates.Nicholas Nethercote-1/+0
It's no longer necessary now that `-Wunreachable_pub` is being passed.
2025-03-10Revert "Use workspace lints for crates in `compiler/` #138084"许杰友 Jieyou Xu (Joe)-0/+1
Revert <https://github.com/rust-lang/rust/pull/138084> to buy time to consider options that avoids breaking downstream usages of cargo on distributed `rustc-src` artifacts, where such cargo invocations fail due to inability to inherit `lints` from workspace root manifest's `workspace.lints` (this is only valid for the source rust-lang/rust workspace, but not really the distributed `rustc-src` artifacts). This breakage was reported in <https://github.com/rust-lang/rust/issues/138304>. This reverts commit 48caf81484b50dca5a5cebb614899a3df81ca898, reversing changes made to c6662879b27f5161e95f39395e3c9513a7b97028.
2025-03-09Rollup merge of #138084 - nnethercote:workspace-lints, r=jieyouxuMatthias Krüger-1/+0
Use workspace lints for crates in `compiler/` This is nicer and hopefully less error prone than specifying lints via bootstrap. r? ``@jieyouxu``
2025-03-08Remove `#![warn(unreachable_pub)]` from all `compiler/` crates.Nicholas Nethercote-1/+0
(Except for `rustc_codegen_cranelift`.) It's no longer necessary now that `unreachable_pub` is in the workspace lints.
2025-03-07Increase recursion_limit in numerous crates.Nicholas Nethercote-0/+1
This is temporarily needed for `x doc compiler` to work. They can be removed once the `Nonterminal` is removed (#124141).
2025-03-06Allow to mutate use capturesSantiago Pastorino-7/+13
2025-02-24cleanup few unused argsklensy-2/+2
2025-02-19Rollup merge of #137213 - nnethercote:rm-rustc_middle-mir-tcx, r=compiler-errorsMatthias Krüger-1/+0
Remove `rustc_middle::mir::tcx` module. This is a really weird module. For example, what does `tcx` in `rustc_middle::mir::tcx::PlaceTy` mean? The answer is "not much". The top-level module comment says: > Methods for the various MIR types. These are intended for use after > building is complete. Awfully broad for a module that has a handful of impl blocks for some MIR types, none of which really relates to `TyCtxt`. `git blame` indicates the comment is ancient, from 2015, and made sense then. This module is now vestigial. This commit removes it and moves all the code within into `rustc_middle::mir::statement`. Some specifics: - `Place`, `PlaceRef`, `Rvalue`, `Operand`, `BorrowKind`: they all have `impl` blocks in both the `tcx` and `statement` modules. The commit merges the former into the latter. - `BinOp`, `UnOp`: they only have `impl` blocks in `tcx`. The commit moves these into `statement`. - `PlaceTy`, `RvalueInitializationState`: they are defined in `tcx`. This commit moves them into `statement` *and* makes them available in `mir::*`, like many other MIR types. r? `@tmandry`
2025-02-19Remove `rustc_middle::mir::tcx` module.Nicholas Nethercote-1/+0
This is a really weird module. For example, what does `tcx` in `rustc_middle::mir::tcx::PlaceTy` mean? The answer is "not much". The top-level module comment says: > Methods for the various MIR types. These are intended for use after > building is complete. Awfully broad for a module that has a handful of impl blocks for some MIR types, none of which really relates to `TyCtxt`. `git blame` indicates the comment is ancient, from 2015, and made sense then. This module is now vestigial. This commit removes it and moves all the code within into `rustc_middle::mir::statement`. Some specifics: - `Place`, `PlaceRef`, `Rvalue`, `Operand`, `BorrowKind`: they all have `impl` blocks in both the `tcx` and `statement` modules. The commit merges the former into the latter. - `BinOp`, `UnOp`: they only have `impl` blocks in `tcx`. The commit moves these into `statement`. - `PlaceTy`, `RvalueInitializationState`: they are defined in `tcx`. This commit moves them into `statement` *and* makes them available in `mir::*`, like many other MIR types.
2025-02-18Move methods from `Map` to `TyCtxt`, part 2.Nicholas Nethercote-1/+1
Continuing the work started in #136466. Every method gains a `hir_` prefix, though for the ones that already have a `par_` or `try_par_` prefix I added the `hir_` after that.