about summary refs log tree commit diff
path: root/compiler/rustc_infer/src/infer/region_constraints/mod.rs
AgeCommit message (Collapse)AuthorLines
2025-07-31Overhaul `Constraint`.Nicholas Nethercote-18/+28
This commit changes it to store a `Region` instead of a `RegionVid` for the `Var` cases: - We avoid having to call `Region::new_var` to re-create `Region`s from `RegionVid`s in a few places, avoiding the interning process, giving a small perf win. (At the cost of the type allowing some invalid combinations of values.) - All the cases now store two `Region`s, so the commit also separates the `ConstraintKind` (a new type) from the `sub` and `sup` arguments in `Constraint`.
2025-07-31Avoid vacuous `Constraint::{VarSubVar,RegSubReg}` constraints.Nicholas Nethercote-2/+6
If the two regions are the same, we can skip it. This is a small perf win.
2025-07-04Fix pretty printing of placeholder typesMichael Goulet-1/+1
2025-06-25rename RegionVariableOrigin::MiscVariable to RegionVariableOrigin::MiscMichael Goulet-1/+1
2025-06-25Remove some glob imports from the type systemMichael Goulet-2/+2
2025-04-14Use `newtype_index!`-generated types more idiomaticallyYotam Ofek-3/+1
2025-04-08clean code: remove Deref<Target=RegionKind> impl for Region and use `.kind()`xizheyin-2/+2
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-02-02Move `unify_key` module.Nicholas Nethercote-1/+1
From `rustc_middle::infer` to `rustc_infer::infer`. Because everything in it is only used within `rustc_infer`, and no longer needs to be `pub`. Plus it's always good to make the huge `rustc_middle` crate smaller.
2024-12-26nit: Remove redundant functionMichael Goulet-4/+0
2024-12-20remove non-borrowck member constraintslcnr-34/+2
2024-12-17`fn member_constraint` to `add_member_constraint`lcnr-1/+1
2024-10-08Use `Default` more in `InferCtxtInner`.Nicholas Nethercote-4/+0
2024-10-08Downgrade a `&mut self` to `&self`.Nicholas Nethercote-1/+1
2024-10-08Remove `Deref`/`DerefMut` impls for `RegionConstraintCollector`.Nicholas Nethercote-32/+18
`Deref`/`DerefMut` can be useful, but they can also obfuscate. I don't think they're worth it for `RegionConstraintCollector`. They're also not present on the similar types `OpaqueTypeTable` and `TypeVariableTable`.
2024-10-08Inline and remove `RegionConstraintStorage::remove_constraint_entry`.Nicholas Nethercote-24/+20
It has a single call site.
2024-10-08Inline and remove `RegionConstraintCollector::into_infos_and_data`.Nicholas Nethercote-10/+2
It's a weird method, and used weirdly: - It's on `RegionConstraintCollector` but operates on `RegionConstraintStorage`. So at both call sites we create a temporary `RegionConstraintCollector`, using `with_log`, to call it. - It `take`s just two of the six fields in `RegionConstraintStorage`. At one of the two call sites we unnecessarily clone the entire `RegionConstraintStorage` just to take those two fields. This commit just inlines and removes it. We no longer need to `take` the two fields, we can just use them directly.
2024-10-07Rollup merge of #131344 - nnethercote:ref-Lrc, r=compiler-errorsMatthias Krüger-2/+2
Avoid `&Lrc<T>` in various places Seeing `&Lrc<T>` is a bit suspicious, and `&T` or `Lrc<T>` is often better. r? `@oli-obk`
2024-10-07Convert a `&Lrc<T>` argument to `Lrc<T>`.Nicholas Nethercote-2/+2
It's slightly simpler.
2024-10-07Reduce visibilities some more.Nicholas Nethercote-1/+1
It helps people reading the code understand how widely things are used.
2024-08-30Remove `#[macro_use] extern crate tracing` from `rustc_infer`.Nicholas Nethercote-0/+1
2024-07-29Reformat `use` declarations.Nicholas Nethercote-11/+7
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-05-13Remove `extern crate rustc_middle` from `rustc_infer`.Nicholas Nethercote-0/+1
2024-04-29Remove `extern crate rustc_macros` from numerous crates.Nicholas Nethercote-0/+1
2024-03-21Stop sorting via `DefId`s in region resolutionOli Scherer-1/+1
2024-03-07move snapshot handling into modlcnr-5/+4
2024-02-22region unification update universe of region varslcnr-38/+69
2023-12-22Auto merge of #118824 - aliemjay:perf-region-cons, r=compiler-errorsbors-13/+8
use Vec for region constraints instead of BTreeMap ~1% perf gain Diagnostic regressions need more investigation. r? `@ghost`
2023-12-17use Vec for region constraintsAli MJ Al-Nasrawy-13/+8
2023-12-15Opportunistically resolve region var in canonicalizerMichael Goulet-5/+0
2023-12-08Uplift canonicalizer into new trait solver crateMichael Goulet-0/+5
2023-11-22Rollup merge of #118147 - Nilstrieb:no-redundant-casts, r=WaffleLapkinMichael Goulet-1/+1
Fix some unnecessary casts `x clippy compiler -Aclippy::all -Wclippy::unnecessary_cast --fix` with some manual review to ensure every fix is correct.
2023-11-21Fix some unnecessary castsNilstrieb-1/+1
`x clippy compiler -Aclippy::all -Wclippy::unnecessary_cast --fix` with some manual review to ensure every fix is correct.
2023-11-19Make regionck care about placeholders in outlives componentsMichael Goulet-0/+4
2023-11-14finish `RegionKind` renamelcnr-2/+2
- `ReFree` -> `ReLateParam` - `ReEarlyBound` -> `ReEarlyParam`
2023-11-13rename `ReLateBound` to `ReBound`lcnr-3/+3
other changes: - `Region::new_late_bound` -> `Region::new_bound` - `Region::is_late_bound` -> `Region::is_bound`
2023-10-13Format all the let chains in compilerMichael Goulet-1/+3
2023-07-30inline format!() args up to and including rustc_codegen_llvmMatthias Krüger-4/+4
2023-05-30rework the leak_check to take the outer_universelcnr-8/+3
clean up coherence to not rely on probes anymore
2023-05-29Rename `tcx.mk_re_*` => `Region::new_*`Maybe Waffle-4/+4
2023-05-07enable `rust_2018_idioms` for doctestsozkanonur-2/+2
Signed-off-by: ozkanonur <work@onurozkan.dev>
2023-04-24Split `{Idx, IndexVec, IndexSlice}` into their own modulesMaybe Waffle-1/+1
2023-03-26remove obsolete `givens` from regionckAli MJ Al-Nasrawy-41/+3
2023-03-15Revert "Auto merge of #107376 - aliemjay:remove-givens, r=lcnr"Rémy Rakic-3/+41
This reverts commit e84e5ff04a647ce28540300244a26ba120642eea, reversing changes made to 1716932743a7b3705cbf0c34db0c4e070ed1930d.
2023-03-09remove obsolete `givens` from regionckAli MJ Al-Nasrawy-41/+3
2023-03-08Auto merge of #108121 - aliemjay:resolve-var-region, r=lcnrbors-24/+21
always resolve to universal regions if possible `RegionConstraintCollector::opportunistic_resolve_var`, which is used in canonicalization and projection logic, doesn't resolve the region var to an equal universal region. So if we have equated `'static == '1 == '2`, it doesn't resolve `'1` or `'2` to `'static`. Now it does! Addresses review comment https://github.com/rust-lang/rust/pull/107376#discussion_r1093233687. r? `@lcnr`
2023-03-08address review commentAli MJ Al-Nasrawy-4/+7
2023-03-05fix the new unsoundnessAli MJ Al-Nasrawy-1/+8
2023-03-05s/unification_table/unification_table_mutAli MJ Al-Nasrawy-7/+8
Give a more clear name.
2023-03-05resolve to universal regions when possibleAli MJ Al-Nasrawy-20/+6
2023-03-03Match unmatched backticks in compiler/ that are part of rustdocest31-1/+1