about summary refs log tree commit diff
path: root/compiler/rustc_borrowck
AgeCommit message (Collapse)AuthorLines
2024-11-04Simplify `LocalUseMapBuild`.Nicholas Nethercote-48/+14
It has four different `insert` methods, with some duplication. This commit finds the commonality and removes them all.
2024-11-04Merge `BorrowCheckContext` into `TypeChecker`.Nicholas Nethercote-173/+88
Because there is no real reason for it to be a separate struct. - It has no methods. - It's easy to confuse with the nearby `BorrowckInferContext` (which does have methods). - The `mut` ref to it in `TypeChecker` makes it seem like any of the fields within might be mutable, but only two (`all_facts` and `constraints`) actually are. - Two of the fields are `pub(crate)` but can be private. This change makes a lot of code more concise and readable.
2024-11-04Remove unnecessary qualifiers.Nicholas Nethercote-3/+3
2024-11-04Remove unnecessary `continue`.Nicholas Nethercote-2/+1
2024-11-04Remove `ToUniverseInfo` impl for `CanonicalQueryInput<CustomTypeOp>`.Nicholas Nethercote-9/+0
It's unused.
2024-11-04Merge `UniverseInfo` and `UniverseInfoInner`.Nicholas Nethercote-25/+13
It's strange to have a struct that contains a single anonymous field that is an enum. This commit merges them. This does require increasing the visibility of `TypeOfInfo` to `pub(crate)`, but that seems worthwhile.
2024-11-04Tidy up comments and some formatting.Nicholas Nethercote-78/+92
Mostly by wrapping overly long comment lines, plus a few other things.
2024-11-04Move some `use` declarations.Nicholas Nethercote-13/+12
So they're all in the one place. Also prepend with `crate::`, à la the `unqualified_local_imports` lint.
2024-11-04ty::BrK -> ty::BoundRegionKind::KMichael Goulet-22/+19
2024-11-04Remove BorrowKind glob, make names longerMichael Goulet-1/+1
2024-11-04Reduce visibilities.Nicholas Nethercote-21/+23
2024-11-02compiler: Replace rustc_target with _abi in _borrowckJubilee Young-7/+7
2024-10-31Auto merge of #132301 - compiler-errors:adjust, r=lcnrbors-1/+0
Remove region from adjustments It's not necessary to store this region, because it's only used in THIR and MemCat/ExprUse, both of which already basically only deal with erased regions anyways.
2024-10-31Try to point out when edition 2024 lifetime capture rules cause borrowck issuesMichael Goulet-1/+232
2024-10-31Encode cross-crate opaque type originMichael Goulet-1/+1
2024-10-30Remap impl-trait lifetimes on HIR instead of AST lowering.Camille GILLOT-1/+1
2024-10-30Rollup merge of #132338 - nnethercote:rm-Engine, r=nnethercoteMatthias Krüger-15/+16
Remove `Engine` It's just unnecessary plumbing. Removing it results in less code, and simpler code. r? ``@cjgillot``
2024-10-30Remove `Analysis::into_engine`.Nicholas Nethercote-15/+16
This is a standard pattern: ``` MyAnalysis.into_engine(tcx, body).iterate_to_fixpoint() ``` `into_engine` and `iterate_to_fixpoint` are always called in pairs, but sometimes with a builder-style `pass_name` call between them. But a builder-style interface is overkill here. This has been bugging me a for a while. This commit: - Merges `Engine::new` and `Engine::iterate_to_fixpoint`. This removes the need for `Engine` to have fields, leaving it as a trivial type that the next commit will remove. - Renames `Analysis::into_engine` as `Analysis::iterate_to_fixpoint`, gives it an extra argument for the optional pass name, and makes it call `Engine::iterate_to_fixpoint` instead of `Engine::new`. This turns the pattern from above into this: ``` MyAnalysis.iterate_to_fixpoint(tcx, body, None) ``` which is shorter at every call site, and there's less plumbing required to support it.
2024-10-29TypingMode :thinking:lcnr-8/+10
2024-10-29Remove region from adjustmentsMichael Goulet-1/+0
2024-10-28fix clippy::clone_on_ref_ptr for compilerklensy-6/+6
2024-10-24Rollup merge of #131756 - compiler-errors:deeply-normalize-type-err, r=lcnrStuart Cook-6/+7
Deeply normalize `TypeTrace` when reporting type error in new solver Normalize the values that come from the `TypeTrace` for various type mismatches. Side-note: We can't normalize the `TypeError` itself bc it may come from instantiated binders, so it may reference values from within the probe... r? lcnr
2024-10-24Plumb through param_env to note_type_errMichael Goulet-6/+7
2024-10-23fix some manual_mapMatthias Krüger-7/+3
2024-10-23nightly feature tracking: get rid of the per-feature bool fieldsRalf Jung-1/+1
2024-10-21Auto merge of #130950 - compiler-errors:yeet-eval, r=BoxyUwUbors-4/+3
Continue to get rid of `ty::Const::{try_}eval*` This PR mostly does: * Removes all of the `try_eval_*` and `eval_*` helpers from `ty::Const`, and replace their usages with `try_to_*`. * Remove `ty::Const::eval`. * Rename `ty::Const::normalize` to `ty::Const::normalize_internal`. This function is still used in the normalization code itself. * Fix some weirdness around the `TransmuteFrom` goal. I'm happy to split it out further; for example, I could probably land the first part which removes the helpers, or the changes to codegen which are more obvious than the changes to tools. r? BoxyUwU Part of https://github.com/rust-lang/rust/issues/130704
2024-10-19Rollup merge of #127675 - chenyukang:yukang-fix-127562-addr, r=petrochenkovMatthias Krüger-12/+21
Remove invalid help diagnostics for const pointer Partially addresses #127562
2024-10-19Get rid of const eval_* and try_eval_* helpersMichael Goulet-4/+3
2024-10-17move `defining_opaque_types` out of `Canonical`lcnr-15/+14
2024-10-17`DropckOutlives` to `rustc_middle`lcnr-3/+2
2024-10-17remove type_op constructorslcnr-5/+5
2024-10-17`ImpliedOutlivesBounds` to `rustc_middle`lcnr-1/+1
2024-10-16Improve duplicate derive Copy/Clone diagnosticsVulnBandit-0/+17
2024-10-16Auto merge of #131481 - nnethercote:rm-GenKillSet, r=cjgillotbors-39/+25
Remove `GenKillAnalysis` There are two kinds of dataflow analysis in the compiler: `Analysis`, which is the basic kind, and `GenKillAnalysis`, which is a more specialized kind for gen/kill analyses that is intended as an optimization. However, it turns out that `GenKillAnalysis` is actually a pessimization! It's faster (and much simpler) to do all the gen/kill analyses via `Analysis`. This lets us remove `GenKillAnalysis`, and `GenKillSet`, and a few other things, and also merge `AnalysisDomain` into `Analysis`. The PR removes 500 lines of code and improves performance. r? `@tmiasko`
2024-10-16Auto merge of #131422 - GnomedDev:smallvec-predicate-obligations, ↵bors-2/+2
r=compiler-errors Use `ThinVec` for PredicateObligation storage ~~I noticed while profiling clippy on a project that a large amount of time is being spent allocating `Vec`s for `PredicateObligation`, and the `Vec`s are often quite small. This is an attempt to optimise this by using SmallVec to avoid heap allocations for these common small Vecs.~~ This PR turns all the `Vec<PredicateObligation>` into a single type alias while avoiding referring to `Vec` around it, then swaps the type over to `ThinVec<PredicateObligation>` and fixes the fallout. This also contains an implementation of `ThinVec::extract_if`, copied from `Vec::extract_if` and currently being upstreamed to https://github.com/Gankra/thin-vec/pull/66. This leads to a small (0.2-0.7%) performance gain in the latest perf run.
2024-10-14Move trait bound modifiers into hir::PolyTraitRefMichael Goulet-3/+3
2024-10-14Add defaults for `Analysis::apply_{call_return_effect,terminator_effect}`.Nicholas Nethercote-11/+1
To avoid some low-value boilerplate code.
2024-10-14Merge `AnalysisDomain` into `Analysis`.Nicholas Nethercote-16/+14
With `GenKillAnalysis` gone, there is no need for them to be separate.
2024-10-14Remove `GenKillAnalysis`.Nicholas Nethercote-12/+6
It's now functionally identical to `Analysis`.
2024-10-14Minimize use of `GenKill`.Nicholas Nethercote-2/+6
Thanks to the previous couple of commits, many uses of the `GenKill` trait can be replaced with a concrete type.
2024-10-14Tweak `GenKillAnalysis` method arguments.Nicholas Nethercote-2/+2
`GenKillAnalysis` has very similar methods to `Analysis`, but the first two have a notable difference: the second argument is `&mut impl GenKill<Self::Idx>` instead of `&mut Self::Domain`. But thanks to the previous commit, this difference is no longer necessary.
2024-10-12Rollup merge of #131626 - matthiaskrgr:dont_string, r=lqdTrevor Gross-1/+1
remove a couple of redundant String to String conversion
2024-10-12remove a couple of redundant String to String conversionMatthias Krüger-1/+1
2024-10-12Swap Vec<PredicateObligation> to type aliasGnomedDev-2/+2
2024-10-12yeet some clonesMatthias Krüger-1/+1
2024-10-10Auto merge of #131444 - onur-ozkan:hotfix-ci, r=Kobzolbors-1/+1
stabilize `ci_rustc_if_unchanged_logic` test Makes `ci_rustc_if_unchanged_logic` test more stable and re-enables it. Previously, it was expecting CI-rustc to be used all the time when there were no changes, which wasn’t always the case. Purpose of this test is making sure we don't use CI-rustc while there are changes in compiler and/or library, but we don't really need to cover cases where CI-rustc is not enabled. Second commit was pushed for making a change in the compiler tree, so `ci_rustc_if_unchanged_logic` can be tested properly in merge CI.
2024-10-10Make super combine into fnsMichael Goulet-4/+4
2024-10-10Uplift super_combineMichael Goulet-0/+1
2024-10-10update `rustc_borrowck::places_conflict` doc-commentonur-ozkan-1/+1
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-10-07Rollup merge of #131225 - nnethercote:rustc_borrowck-mm, r=lqdJubilee-70/+58
`rustc_borrowck` memory management tweaks Minor cleanups in `rustc_borrowck` relating to memory management. r? `@lqd`