about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty/print
AgeCommit message (Collapse)AuthorLines
2022-07-27Rollup merge of #99358 - compiler-errors:issue-99325, r=oli-obkGuillaume Gomez-1/+1
Allow `ValTree::try_to_raw_bytes` on `u8` array Fixes #99325 cc `@b-naber` I think who touched this last in 705d818bd52a6324d5e7693cc4306457395eebc8
2022-07-26Add `Self: ~const Trait` to traits with `#[const_trait]`Deadbeef-1/+1
2022-07-26Allow try_to_raw_bytes on u8 arrayMichael Goulet-1/+1
2022-07-22Rollup merge of #99393 - ↵Dylan DPC-1/+1
Logarithmus:feature/99255-omit-const-generic-suffixes, r=petrochenkov feat: omit suffixes in const generics (e.g. `1_i32`) Closes #99255
2022-07-20consistently use VTable over Vtable (matching stable stdlib API RawWakerVTable)Ralf Jung-1/+1
2022-07-20rename get_global_alloc to try_get_global_allocRalf Jung-2/+3
2022-07-20add a Vtable kind of symbolic allocationsRalf Jung-1/+2
2022-07-19interpret: rename Tag/PointerTag to Prov/ProvenanceRalf Jung-4/+4
Let's avoid using two different terms for the same thing -- let's just call it "provenance" everywhere. In Miri, provenance consists of an AllocId and an SbTag (Stacked Borrows tag), which made this even more confusing.
2022-07-19feat: omit suffixes in const generics (e.g. `1_i32`)Artur Sinila-1/+1
Closes #99255
2022-07-16Rollup merge of #99342 - TaKO8Ki:avoid-symbol-to-string-conversions, ↵Matthias Krüger-6/+6
r=compiler-errors Avoid some `Symbol` to `String` conversions This patch removes some Symbol to String conversions.
2022-07-17avoid some `Symbol` to `String` conversionsTakayuki Maeda-6/+6
2022-07-13Rename `debugging_opts` to `unstable_opts`Joshua Nelson-4/+4
This is no longer used only for debugging options (e.g. `-Zoutput-width`, `-Zallow-features`). Rename it to be more clear.
2022-07-09don't allow ZST in ScalarIntRalf Jung-4/+0
There are several indications that we should not ZST as a ScalarInt: - We had two ways to have ZST valtrees, either an empty `Branch` or a `Leaf` with a ZST in it. `ValTree::zst()` used the former, but the latter could possibly arise as well. - Likewise, the interpreter had `Immediate::Uninit` and `Immediate::Scalar(Scalar::ZST)`. - LLVM codegen already had to special-case ZST ScalarInt. So instead add new ZST variants to those types that did not have other variants which could be used for this purpose.
2022-07-06Update TypeVisitor pathsAlan Egerton-2/+2
2022-07-05Relax constrained generics to TypeVisitableAlan Egerton-2/+2
2022-07-05Add #[derive(TypeVisitable)]Alan Egerton-3/+3
2022-06-28Improve pretty printing of valtrees for referencesDominik Stolz-11/+7
2022-06-24Use write! instead of p! to avoid having to use weird scopingMichael Goulet-25/+12
2022-06-24Fix printing impl trait under bindersMichael Goulet-113/+133
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-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-21Improve suggestion for calling closure on type mismatchMichael Goulet-1/+1
2022-06-19Move RegionKind to rustc_type_irJack Huey-17/+9
2022-06-14rebaseb-naber-11/+3
2022-06-14address reviewb-naber-1/+3
2022-06-14address reviewb-naber-3/+2
2022-06-14implement valtrees as the type-system representation for constant valuesb-naber-71/+54
2022-06-14Rename the `ConstS::val` field as `kind`.Nicholas Nethercote-8/+8
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-08dedup diagnostics default params handlinglcnr-53/+13
2022-06-08Folding revamp.Nicholas Nethercote-1/+4
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-04Fix pretty printing named bound regions under -ZverboseJack Huey-24/+30
2022-05-29Stop pretty-printing anonymous lifetimes.Camille GILLOT-43/+28
2022-05-14Add bound_explicit_item_bounds and bound_item_boundsJack Huey-6/+4
2022-05-13Add bound_impl_trait_refJack Huey-4/+4
2022-05-13Add bound_fn_sigJack Huey-1/+1
2022-05-13Add bound_type_ofJack Huey-8/+11
2022-05-10Introduce EarlyBinderJack Huey-7/+10
2022-05-07Auto merge of #96531 - kckeiks:remove-item-like-visitor-from-rustc-typeck, ↵bors-1/+1
r=cjgillot Remove ItemLikeVisitor impls from rustc_typeck Issue #95004 cc `@cjgillot`
2022-05-06remove all usages of hir().def_kindMiguel Guarniz-1/+1
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-03Hide InlineConst's generic arg during printGary Guo-0/+4
The generic arg is for type inference only and shouldn't be exposed to users.
2022-05-02rustc: Panic by default in `DefIdTree::parent`Vadim Petrochenkov-4/+4
Only crate root def-ids don't have a parent, and in majority of cases the argument of `DefIdTree::parent` cannot be a crate root. So we now panic by default in `parent` and introduce a new non-panicing function `opt_parent` for cases where the argument can be a crate root. Same applies to `local_parent`/`opt_local_parent`.
2022-04-19Rollup merge of #96142 - cjgillot:no-crate-def-index, r=petrochenkovDylan DPC-8/+6
Stop using CRATE_DEF_INDEX outside of metadata encoding. `CRATE_DEF_ID` and `CrateNum::as_def_id` are almost always what we want. We should not manipulate raw `DefIndex` outside of metadata encoding.
2022-04-17Stop using CRATE_DEF_INDEX.Camille GILLOT-8/+6
`CRATE_DEF_ID` and `CrateNum::as_def_id` are almost always what we want.
2022-04-17Auto merge of #95655 - kckeiks:create-hir-crate-items-query, r=cjgillotbors-3/+7
Refactor HIR item-like traversal (part 1) Issue #95004 - Create hir_crate_items query which traverses tcx.hir_crate(()).owners to return a hir::ModuleItems - use tcx.hir_crate_items in tcx.hir().items() to return an iterator of hir::ItemId - use tcx.hir_crate_items to introduce a tcx.hir().par_items(impl Fn(hir::ItemId)) to traverse all items in parallel; Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com> cc `@cjgillot`
2022-04-09avoid accessing the interner by comparing the Symbol directlyMiguel Guarniz-1/+1
2022-04-08remove ItemLikeVisitor impls and add fast paths using DefKindMiguel Guarniz-2/+5
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-04-08Refactor HIR item-like traversal (part 1)Miguel Guarniz-1/+2
- Create hir_crate_items query which traverses tcx.hir_crate(()).owners to return a hir::ModuleItems - use tcx.hir_crate_items in tcx.hir().items() to return an iterator of hir::ItemId - add par_items(impl Fn(hir::ItemId)) to traverse all items in parallel Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-04-08Avoid looking at the internals of Interned directlyOli Scherer-102/+76
2022-04-07Document and rename the new wrapper typeOli Scherer-5/+8
2022-03-31Move stable hash from TyS into a datastructure that can be shared with other ↵Oli Scherer-15/+34
interned types.