about summary refs log tree commit diff
path: root/compiler/rustc_ty_utils/src
AgeCommit message (Collapse)AuthorLines
2022-03-02rename ErrorReported -> ErrorGuaranteedmark-7/+7
2022-02-24Restrict query recursion in `needs_significant_drop`Jakob Degen-19/+17
Overly aggressive use of the query system to improve caching lead to query cycles and consequently ICEs. This patch fixes this by restricting the use of the query system as a cache to those cases where it is definitely correct.
2022-02-21use `List<Ty<'tcx>>` for tupleslcnr-5/+5
2022-02-19Adopt let else in more placesest31-4/+2
2022-02-15Overhaul `RegionKind` and `Region`.Nicholas Nethercote-3/+3
Specifically, change `Region` from this: ``` pub type Region<'tcx> = &'tcx RegionKind; ``` to this: ``` pub struct Region<'tcx>(&'tcx Interned<RegionKind>); ``` This now matches `Ty` and `Predicate` more closely. Things to note - Regions have always been interned, but we haven't been using pointer-based `Eq` and `Hash`. This is now happening. - I chose to impl `Deref` for `Region` because it makes pattern matching a lot nicer, and `Region` can be viewed as just a smart wrapper for `RegionKind`. - Various methods are moved from `RegionKind` to `Region`. - There is a lot of tedious sigil changes. - A couple of types like `HighlightBuilder`, `RegionHighlightMode` now have a `'tcx` lifetime because they hold a `Ty<'tcx>`, so they can call `mk_region`. - A couple of test outputs change slightly, I'm not sure why, but the new outputs are a little better.
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-01remove `TyS::same_type`lcnr-1/+1
it ignored regions and constants in adts, but didn't do so for references or any other types. This seemed quite weird
2022-01-31Rollup merge of #90277 - pierwill:fix-70258-inference-terms, r=jackh726Matthias Krüger-1/+1
Improve terminology around "after typeck" Closes #70258.
2022-01-19Store a `Symbol` instead of an `Ident` in `AssocItem`Aaron Hill-2/+2
This is the same idea as #92533, but for `AssocItem` instead of `VariantDef`/`FieldDef`. With this change, we no longer have any uses of `#[stable_hasher(project(...))]`
2022-01-16Auto merge of #92805 - BoxyUwU:revert-lazy-anon-const-substs, r=lcnrbors-16/+2
partially revertish `lazily "compute" anon const default substs` reverts #87280 except for some of the changes around `ty::Unevaluated` having a visitor and a generic for promoted why revert: <https://github.com/rust-lang/rust/pull/92805#issuecomment-1010736049> r? `@lcnr`
2022-01-15Reduce use of local_def_id_to_hir_id.Camille GILLOT-11/+3
2022-01-15Return a LocalDefId in get_parent_item.Camille GILLOT-2/+1
2022-01-15initial revertEllen-16/+2
2022-01-08Link impl items to corresponding trait items in late resolver.Camille GILLOT-104/+2
2022-01-07Add query to avoid name comparison in `leaf_def`Matthew Jasper-24/+28
2022-01-07Move associated_item* providers to their own moduleMatthew Jasper-225/+234
2022-01-07Add `trait_item_def_id` to `AssocItem`Matthew Jasper-1/+107
This allows avoiding some lookups by name
2021-12-17Use a const ParamEnv when in default_method_body_is_constDeadbeef-1/+7
2021-12-12Revert "Auto merge of #91491 - spastorino:revert-91354, r=oli-obk"Deadbeef-12/+73
This reverts commit ff2439b7b9bafcfdff86b7847128014699df8442, reversing changes made to 2a9e0831d6603d87220cedd1b1293e2eb82ef55c.
2021-12-07Store impl_trait_fn inside OpaqueTyOrigin.Camille GILLOT-2/+2
2021-12-03Revert "Auto merge of #91354 - fee1-dead:const_env, r=spastorino"Santiago Pastorino-73/+12
This reverts commit 18bb8c61a975fff6424cda831ace5b0404277145, reversing changes made to d9baa361902b172be716f96619b909f340802dea.
2021-12-03Rollup merge of #91462 - b-naber:use-try-normalize-erasing-regions, r=jackh726Matthias Krüger-2/+4
Use try_normalize_erasing_regions in needs_drop Fixes https://github.com/rust-lang/rust/issues/81199 r? ``@jackh726``
2021-12-02use try_normalize_erasing_regions in needs_dropb-naber-2/+4
2021-12-02Auto merge of #91354 - fee1-dead:const_env, r=spastorinobors-12/+73
Cleanup: Eliminate ConstnessAnd This is almost a behaviour-free change and purely a refactoring. "almost" because we appear to be using the wrong ParamEnv somewhere already, and this is now exposed by failing a test using the unstable `~const` feature. We most definitely need to review all `without_const` and at some point should probably get rid of many of them by using `TraitPredicate` instead of `TraitRef`. This is a continuation of https://github.com/rust-lang/rust/pull/90274. r? `@oli-obk` cc `@spastorino` `@ecstatic-morse`
2021-12-01FormatDeadbeef-6/+26
2021-11-29`ParamEnv` should be const when `ImplItem` is within a const impl.Deadbeef-1/+37
2021-11-29Completely remove ConstnessAndOli Scherer-3/+1
2021-11-29Re-use `constness_for_typeck` instead of rolling it ourselvesOli Scherer-11/+1
2021-11-29Add constness to ParamEnvOli Scherer-10/+27
This now causes a lot of queries to be executed twice, as reveal_all forces NotConst
2021-11-28Take a LocalDefId in expect_*item.Camille GILLOT-7/+4
2021-11-13Recurse through query system when checking ADT drop types, hopefully ↵Jakob Degen-23/+61
improving perf
2021-11-08impl Copy/Clone for arrays in std, not in compilerbstrie-1/+1
2021-11-06Improve terminology around "after typeck"pierwill-1/+1
2021-10-28Auto merge of #90218 - JakobDegen:adt_significant_drop_fix, r=nikomatsakisbors-45/+56
Fixes incorrect handling of ADT's drop requirements Fixes #90024 and a bunch of duplicates. The main issue was just that the contract of `NeedsDropTypes::adt_components` was inconsistent; the list of types it might return were the generic parameters themselves or the fields of the ADT, depending on the nature of the drop impl. This meant that the caller could not determine whether a `.subst()` call was still needed on those types; it called `.subst()` in all cases, and this led to ICEs when the returned types were the generic params. First contribution of more than a few lines, so feedback definitely appreciated.
2021-10-25Clean up debug statements in needs_dropJakob Degen-7/+5
2021-10-25expose default substs in param_envb-naber-0/+12
2021-10-23Fixes incorrect handling of ADT's drop requirementsJakob Degen-41/+54
See https://github.com/rust-lang/rust/issues/90024#issuecomment-950105433
2021-10-19Replace FnLikeNode by FnKind.Camille GILLOT-3/+2
2021-10-02Remove various unused feature gatesbjorn3-2/+0
2021-09-26Auto merge of #89144 - sexxi-goose:insig_stdlib, r=nikomatsakisbors-18/+57
2229: Mark insignificant dtor in stdlib I looked at all public [stdlib Drop implementations](https://doc.rust-lang.org/stable/std/ops/trait.Drop.html#implementors) and categorized them into Insigificant/Maybe/Significant Drop. Reasons are noted here: https://docs.google.com/spreadsheets/d/19edb9r5lo2UqMrCOVjV0fwcSdS-R7qvKNL76q7tO8VA/edit#gid=1838773501 One thing missing from this PR is tagging HashMap as insigificant destructor as that needs some discussion. r? `@Mark-Simulacrum` cc `@nikomatsakis`
2021-09-22PR fixupAman Arora-7/+16
2021-09-21Handle type params in insig dtorsAman Arora-10/+16
2021-09-212229: Early exit when we see an insigificant dropAman Arora-9/+33
2021-09-20Do not store visibility in *ItemRef.Camille GILLOT-1/+1
2021-09-09Remove the queriesDeadbeef-75/+13
2021-09-09Const drop selection candidatesDeadbeef-1/+2
2021-09-09Const droppingDeadbeef-11/+76
2021-08-27Auto merge of #88371 - Manishearth:rollup-pkkjsme, r=Manishearthbors-1/+12
Rollup of 11 pull requests Successful merges: - #87832 (Fix debugger stepping behavior with `match` expressions) - #88123 (Make spans for tuple patterns in E0023 more precise) - #88215 (Reland #83738: "rustdoc: Don't load all extern crates unconditionally") - #88216 (Don't stabilize creation of TryReserveError instances) - #88270 (Handle type ascription type ops in NLL HRTB diagnostics) - #88289 (Fixes for LLVM change 0f45c16f2caa7c035e5c3edd40af9e0d51ad6ba7) - #88320 (type_implements_trait consider obligation failure on overflow) - #88332 (Add argument types tait tests) - #88340 (Add `c_size_t` and `c_ssize_t` to `std::os::raw`.) - #88346 (Revert "Add type of a let tait test impl trait straight in let") - #88348 (Add field types tait tests) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-08-26Rollup merge of #88123 - camelid:tup-pat-precise-spans, r=estebankManish Goregaokar-1/+12
Make spans for tuple patterns in E0023 more precise As suggested in #86307. Closes #86307. r? ````@estebank````
2021-08-26add `tcx` to `fn walk`lcnr-2/+2