summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty
AgeCommit message (Collapse)AuthorLines
2022-07-09Only register hidden types for opaque types from the current crate, nothing ↵Oli Scherer-0/+1
else would work anyway.
2022-07-09Make `evaluate_obligation` not succeed unconditionally if it registered new ↵Oli Scherer-5/+0
hidden types for opaque types
2022-07-09pessimistically treat all function items as containing an opaque typeOli Scherer-0/+5
2022-06-24Rollup merge of #98280 - compiler-errors:better-call-closure-on-type-err, ↵Yuki Okushi-1/+1
r=estebank Improve suggestion for calling fn-like expr on type mismatch 1.) Suggest calling values of with RPIT types (and probably TAIT) when we expect `Ty` and have `impl Fn() -> Ty` 2.) Suggest calling closures even when they're not assigned to a local variable first 3.) Drive-by fix of a pretty-printing bug (`impl Fn()-> Ty` => `impl Fn() -> Ty`) r? ```@estebank```
2022-06-24Rollup merge of #96955 - Aaron1011:pretty-print-sort, r=petrochenkovYuki Okushi-11/+10
Remove (transitive) reliance on sorting by DefId in pretty-printer This moves us a step closer to removing the `PartialOrd/`Ord` impls for `DefId`. See #90317
2022-06-23Rollup merge of #98365 - jyn514:improve-obligation-errors-review-comments, ↵Michael Goulet-1/+15
r=eholk Address review comments from #98259 It got approved so fast I didn't have time to make changes xD r? ``@eholk``
2022-06-22Remove (transitive) reliance on sorting by DefId in pretty-printerAaron Hill-11/+10
This moves us a step closer to removing the `PartialOrd/`Ord` impls for `DefId`. See #90317
2022-06-22Rollup merge of #97895 - nbdd0121:unlikely, r=estebankYuki Okushi-1/+1
Simplify `likely!` and `unlikely!` macro The corresponding intrinsics have long been safe-to-call, so the unsafe block is no longer needed.
2022-06-21Improve suggestion for calling closure on type mismatchMichael Goulet-1/+1
2022-06-21Address review comments from #98259Joshua Nelson-1/+15
It got merged so fast I didn't have time to make changes xD
2022-06-20`try_fold_unevaluated` for infallible foldersAlan Egerton-0/+7
#97447 added folding of unevaluated constants, but did not include an override of the default (fallible) operation in the blanket impl of `FallibleTypeFolder` for infallible folders. Here we provide that missing override. r? @nnethercote
2022-06-19Auto merge of #98247 - jackh726:regionkind-rustc-type-ir, r=compiler-errorsbors-311/+40
Move RegionKind to rustc_type_ir (Also UniverseIndex) r? rust-lang/types
2022-06-19Rollup merge of #98136 - fee1-dead-contrib:rename_impl_constness, r=oli-obkDylan DPC-2/+2
Rename `impl_constness` to `constness` The current code is a basis for `is_const_fn_raw`, and `impl_constness` is no longer a valid name, which is previously used for determining the constness of impls, and not items in general. r? `@oli-obk`
2022-06-19Move RegionKind to rustc_type_irJack Huey-311/+40
2022-06-18Remove `likely!` and `unlikely!` macro from compilerGary Guo-1/+1
2022-06-17Auto merge of #98106 - cjgillot:split-definitions, r=michaelwoeristerbors-38/+104
Split up `Definitions` and `ResolverAstLowering`. Split off https://github.com/rust-lang/rust/pull/95573 r? `@michaelwoerister`
2022-06-15Consume resolutions for lowering separately.Camille GILLOT-0/+5
2022-06-15Remove unused item_generics_num_lifetimes.Camille GILLOT-1/+0
2022-06-15Rename `impl_constness` to `constness`Deadbeef-2/+2
The current code is a basis for `is_const_fn_raw`, and `impl_constness` is no longer a valid name, which is previously used for determining the constness of impls, and not items in general.
2022-06-15Rollup merge of #98110 - cjgillot:closure-brace, r=Aaron1011Yuki Okushi-1/+1
Make `ExprKind::Closure` a struct variant. Simple refactor since we both need it to introduce additional fields in `ExprKind::Closure`. r? ``@Aaron1011``
2022-06-14Separate `source_span` and `expn_that_defined` from `Definitions`.Camille GILLOT-7/+49
2022-06-14Make ResolverAstLowering a struct.Camille GILLOT-1/+28
2022-06-14Separate Definitions and CrateStore from ResolverOutputs.Camille GILLOT-42/+35
2022-06-14rebaseb-naber-58/+24
2022-06-14rebaseb-naber-1/+1
2022-06-14address reviewb-naber-1/+3
2022-06-14address reviewb-naber-4/+10
2022-06-14fix clippy test failuresb-naber-0/+8
2022-06-14implement valtrees as the type-system representation for constant valuesb-naber-193/+275
2022-06-14Rename the `ConstS::val` field as `kind`.Nicholas Nethercote-51/+51
And likewise for the `Const::val` method. Because its type is called `ConstKind`. Also `val` is a confusing name because `ConstKind` is an enum with seven variants, one of which is called `Value`. Also, this gives consistency with `TyS` and `PredicateS` which have `kind` fields. The commit also renames a few `Const` variables from `val` to `c`, to avoid confusion with the `ConstKind::Value` variant.
2022-06-13Rollup merge of #97709 - compiler-errors:normalize-const-param-ty, r=oli-obkMatthias Krüger-4/+9
Normalize consts' tys when relating with `adt_const_params` Fixes #97007
2022-06-11Address commentsMichael Goulet-17/+24
2022-06-11Make is_suggestable work on all TypeFoldableMichael Goulet-14/+47
2022-06-11Handle empty where-clause betterMichael Goulet-9/+4
2022-06-11Make Ty::is_suggestable use a visitorMichael Goulet-69/+69
2022-06-12Make `ExprKind::Closure` a struct variant.Camille GILLOT-1/+1
2022-06-11Rollup merge of #97703 - lcnr:post-89862, r=estebankDylan DPC-55/+54
some additional `need_type_info.rs` cleanup also fixes #97698, fixes #97806 cc `@estebank`
2022-06-10don't always cache bound ltslcnr-9/+18
2022-06-10replace bound vars: make caching explicitlcnr-9/+6
2022-06-10`BoundVarReplacer` remove `Option`lcnr-45/+36
2022-06-08Auto merge of #94732 - nnethercote:infallible-encoder, r=bjorn3bors-35/+30
Make `Encodable` and `Encoder` infallible. A follow-up to #93066. r? `@ghost`
2022-06-08note that methods should only be used for diagslcnr-0/+4
2022-06-08dedup diagnostics default params handlinglcnr-54/+49
2022-06-08publicly export `ty::subst` in `ty`lcnr-1/+1
it feels arbitrary to have `Ty` and `Const` directly in that module and to not have `GenericArg` and `GenericArgKind` there. Writing `ty::GenericArg` can also feel clearer than importing it. Using `ty::subst::GenericArg` however is ugly.
2022-06-08Folding revamp.Nicholas Nethercote-209/+191
This commit makes type folding more like the way chalk does it. Currently, `TypeFoldable` has `fold_with` and `super_fold_with` methods. - `fold_with` is the standard entry point, and defaults to calling `super_fold_with`. - `super_fold_with` does the actual work of traversing a type. - For a few types of interest (`Ty`, `Region`, etc.) `fold_with` instead calls into a `TypeFolder`, which can then call back into `super_fold_with`. With the new approach, `TypeFoldable` has `fold_with` and `TypeSuperFoldable` has `super_fold_with`. - `fold_with` is still the standard entry point, *and* it does the actual work of traversing a type, for all types except types of interest. - `super_fold_with` is only implemented for the types of interest. Benefits of the new model. - I find it easier to understand. The distinction between types of interest and other types is clearer, and `super_fold_with` doesn't exist for most types. - With the current model is easy to get confused and implement a `super_fold_with` method that should be left defaulted. (Some of the precursor commits fixed such cases.) - With the current model it's easy to call `super_fold_with` within `TypeFolder` impls where `fold_with` should be called. The new approach makes this mistake impossible, and this commit fixes a number of such cases. - It's potentially faster, because it avoids the `fold_with` -> `super_fold_with` call in all cases except types of interest. A lot of the time the compile would inline those away, but not necessarily always.
2022-06-08Add `try_fold_uenevaluted`.Nicholas Nethercote-10/+20
We already have `visit_unevaluated`, so this improves consistency. Also, define `TypeFoldable for Unevaluated<'tcx, ()>` in terms of `TypeFoldable for Unevaluated<'tcx>`, which is neater.
2022-06-08Add `TypeVisitor::visit_mir_const`.Nicholas Nethercote-0/+4
Because `TypeFoldable::try_fold_mir_const` exists, and even though `visit_mir_const` isn't needed right now, the consistency makes the code easier to understand.
2022-06-08Remove `EarlyBinder::{try_fold_with,visit_with}`.Nicholas Nethercote-8/+0
For most types the default impls of these methods are good enough, and `EarlyBinder` is one such type.
2022-06-08Use `super_visit_with` in a couple of `visit_binder` methods.Nicholas Nethercote-1/+1
Because it's equivalent but simpler to what's currently there.
2022-06-08Rename `TypeVisitor::visit_unevaluated_const`.Nicholas Nethercote-4/+4
To match the corresponding type name.