about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty/inhabitedness
AgeCommit message (Collapse)AuthorLines
2025-07-20Don't consider unstable fields always-inhabitedNadrieril-16/+0
This reverts the hack in https://github.com/rust-lang/rust/pull/133889 now that `Pin`'s field is no longer public.
2025-06-17Don't build `ParamEnv` and do trait solving in `ItemCtxt`sBoxy-7/+3
2025-04-24Remove `weak` alias terminologyBoxy-1/+1
2025-03-20Auto merge of #133889 - compiler-errors:inh-unstable, r=Nadrierilbors-0/+16
Consider fields to be inhabited if they are unstable Fixes #133885 with a simple heuristic r? Nadrieril Not totally certain if this needs T-lang approval or a crater run.
2025-03-18Dont consider fields that are forced unstable due to ↵Michael Goulet-1/+8
-Zforce-unstable-if-unmarked to be uninhabited
2025-03-18Consider fields to be inhabited if they are unstableMichael Goulet-0/+9
2025-03-07Add helper methods checking for "#[non_exhaustive] that's active"Maja Kądziołka-1/+1
A check for `#[non_exhaustive]` is often done in combination with checking whether the type is local to the crate, in a variety of ways. Create a helper method and standardize on it as the way to check for this.
2025-03-04InhabitedPredicate: avoid using a wildcard branchMaja Kądziołka-1/+4
This is error-prone. Explicitly write down which cases don't need anything substituted. Turn the `OpaqueType` case, which currently seems to be unreachable, into a `bug!`.
2025-03-04Clarify why InhabitedPredicate::instantiate_opt existsMaja Kądziołka-0/+5
At first glance, the extra casework seems pointless and needlessly error-prone. Clarify that there is a reason for it being there.
2024-11-18use `TypingEnv` when no `infcx` is availablelcnr-20/+25
the behavior of the type system not only depends on the current assumptions, but also the currentnphase of the compiler. This is mostly necessary as we need to decide whether and how to reveal opaque types. We track this via the `TypingMode`.
2024-10-19Get rid of const eval_* and try_eval_* helpersMichael Goulet-1/+1
2024-09-02Non-exhaustive structs may be emptyNadrieril-4/+0
2024-07-29Reformat `use` declarations.Nicholas Nethercote-3/+3
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-05-23Remove `#[macro_use] extern crate tracing` from `rustc_middle`.Nicholas Nethercote-0/+2
2024-04-29Remove `extern crate rustc_macros` from `rustc_middle`.Nicholas Nethercote-0/+1
2024-03-14make `Representability::Infinite` carry `ErrorGuaranteed`Lukas Markeffsky-1/+1
2023-12-23Reveal empty opaques in depthNadrieril-18/+73
2023-12-09Detect cycles in `InhabitedPredicate::apply`Nadrieril-10/+31
This is for post-monomorphization cycles. These are only caught later (in drop elaboration for the example that I saw), so we need to handle them here. This issue wasn't noticed before because exhaustiveness only checked inhabitedness when `exhaustive_patterns` was on. The preceding commit now check inhabitedness always, which revealed the problem.
2023-10-20Adjust importsMichael Goulet-1/+1
2023-07-14refactor(rustc_middle): Substs -> GenericArgMahdi Dibaiee-17/+17
2023-07-05Deal with falloutBoxy-2/+2
2023-06-27Normalize types when applying uninhabited predicate.Camille GILLOT-1/+12
2023-05-29EarlyBinder::new -> EarlyBinder::bindlcnr-2/+2
2023-05-28Replace EarlyBinder(x) with EarlyBinder::new(x)Kyle Matsuda-2/+2
2023-05-15Move expansion of query macros in rustc_middle to rustc_middle::queryJohn Kåre Alsaker-3/+3
2023-05-04IAT: Introduce AliasKind::InherentLeón Orell Valerian Liehr-0/+6
2023-03-05Auto merge of #108351 - petrochenkov:rmdit, r=cjgillotbors-1/+1
rustc_middle: Remove trait `DefIdTree` This trait was a way to generalize over both `TyCtxt` and `Resolver`, but now `Resolver` has access to `TyCtxt`, so this trait is no longer necessary.
2023-03-03Match unmatched backticks in comments in compiler/est31-1/+1
2023-03-02rustc_middle: Remove trait `DefIdTree`Vadim Petrochenkov-1/+1
This trait was a way to generalize over both `TyCtxt` and `Resolver`, but now `Resolver` has access to `TyCtxt`, so this trait is no longer necessary.
2023-02-16remove bound_type_of query; make type_of return EarlyBinder; change type_of ↵Kyle Matsuda-1/+1
in metadata
2023-02-16change usages of type_of to bound_type_ofKyle Matsuda-1/+1
2023-02-15Use target instead of machine for mir interpreter integer handling.Oli Scherer-2/+2
The naming of `machine` only makes sense from a mir interpreter internals perspective, but outside users talk about the `target` platform
2023-02-14s/eval_usize/eval_target_usize/ for clarityOli Scherer-1/+1
2022-12-13Combine projection and opaque into aliasMichael Goulet-1/+1
2022-11-20Factor out conservative_is_privately_uninhabitedCameron Steffen-0/+16
2022-11-20Change to Ty::is_inhabited_fromCameron Steffen-51/+49
2022-11-20Fix typoCameron Steffen-1/+1
2022-11-20Fix doctest errors related to rustc_middlereez12g-2/+3
2022-10-22Introduce InhabitedPredicateCameron Steffen-292/+315
2022-08-27rustc_middle: Remove `Visibility::Invisible`Vadim Petrochenkov-4/+0
2022-05-28Move things to rustc_type_irWilco Kusee-1/+2
2022-05-02fix most compiler/ doctestsElliot Roberts-2/+5
2022-04-13couple of clippy::complexity fixesMatthias Krüger-1/+1
2022-03-11Improve `AdtDef` interning.Nicholas Nethercote-4/+4
This commit makes `AdtDef` use `Interned`. Much the commit is tedious changes to introduce getter functions. The interesting changes are in `compiler/rustc_middle/src/ty/adt.rs`.
2022-02-21use `List<Ty<'tcx>>` for tupleslcnr-4/+3
2022-02-15Overhaul `TyS` and `Ty`.Nicholas Nethercote-3/+3
Specifically, change `Ty` from this: ``` pub type Ty<'tcx> = &'tcx TyS<'tcx>; ``` to this ``` pub struct Ty<'tcx>(Interned<'tcx, TyS<'tcx>>); ``` There are two benefits to this. - It's now a first class type, so we can define methods on it. This means we can move a lot of methods away from `TyS`, leaving `TyS` as a barely-used type, which is appropriate given that it's not meant to be used directly. - The uniqueness requirement is now explicit, via the `Interned` type. E.g. the pointer-based `Eq` and `Hash` comes from `Interned`, rather than via `TyS`, which wasn't obvious at all. Much of this commit is boring churn. The interesting changes are in these files: - compiler/rustc_middle/src/arena.rs - compiler/rustc_middle/src/mir/visit.rs - compiler/rustc_middle/src/ty/context.rs - compiler/rustc_middle/src/ty/mod.rs Specifically: - Most mentions of `TyS` are removed. It's very much a dumb struct now; `Ty` has all the smarts. - `TyS` now has `crate` visibility instead of `pub`. - `TyS::make_for_test` is removed in favour of the static `BOOL_TY`, which just works better with the new structure. - The `Eq`/`Ord`/`Hash` impls are removed from `TyS`. `Interned`s impls of `Eq`/`Hash` now suffice. `Ord` is now partly on `Interned` (pointer-based, for the `Equal` case) and partly on `TyS` (contents-based, for the other cases). - There are many tedious sigil adjustments, i.e. adding or removing `*` or `&`. They seem to be unavoidable.
2022-02-09Use a slice in DefIdForest.Camille GILLOT-23/+21
2022-02-09Ensure that queries only return Copy types.Camille GILLOT-1/+1
2022-01-15Simplify DefIdForest.Camille GILLOT-5/+5
2021-12-15Remove `in_band_lifetimes` from `rustc_middle`Aaron Hill-1/+1
See #91867 This was mostly straightforward. In several places, I take advantage of the fact that lifetimes are non-hygenic: a macro declares the 'tcx' lifetime, which is then used in types passed in as macro arguments.