about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty/print
AgeCommit message (Collapse)AuthorLines
2022-11-18Only use `...` instead of `_` for type elisionEsteban Küber-5/+1
`_` might confuse people into believing that the type isn't known, while `...` is not used anywhere else for types and is not valid syntax, making it more likely to convey the right understanding.
2022-11-18Make "long type" printing type awareEsteban Küber-3/+16
Instead of simple string cutting, use a custom printer to hide parts of long printed types.
2022-11-18couple of clippy::perf fixesMatthias Krüger-3/+1
2022-11-13Auto merge of #104282 - cjgillot:intern-span, r=compiler-errorsbors-39/+5
Hash spans when interning types Ignoring hash for spans creates an inconsistency between the `Hash` impl for `WithStableHash`, which takes them into account, and the `HashStable` impl which does not. cc `@compiler-errors` Fixes https://github.com/rust-lang/rust/issues/104271 Fixes https://github.com/rust-lang/rust/issues/104255 Fixes https://github.com/rust-lang/rust/issues/104238
2022-11-11Do not rename bound variables when verbose-printing binders.Camille GILLOT-39/+5
2022-11-10Auto merge of #101990 - clubby789:dont-machine-apply-placeholder-method, ↵bors-0/+6
r=compiler-errors Fix auto-application of associated generic functions with placeholders Fixes #101920
2022-11-07Add an optional Span to BrAnon and use it to print better error for HRTB ↵Jack Huey-4/+4
error from generator interior
2022-11-05Use `FmtPrinter` instead of creating `Instance`clubby789-0/+6
2022-11-01Format dyn Trait better in type_name intrinsicMichael Goulet-1/+1
2022-10-30All verbosity checks in `PrettyPrinter` now go through ↵Sarthak Singh-17/+17
`PrettyPrinter::should_print_verbose`
2022-10-29Rename some `OwnerId` fields.Nicholas Nethercote-2/+2
spastorino noticed some silly expressions like `item_id.def_id.def_id`. This commit renames several `def_id: OwnerId` fields as `owner_id`, so those expressions become `item_id.owner_id.def_id`. `item_id.owner_id.local_def_id` would be even clearer, but the use of `def_id` for values of type `LocalDefId` is *very* widespread, so I left that alone.
2022-10-25Added helper to prevent verbose printing from the `PrettyPrinter` when ↵Sarthak Singh-3/+7
printing constants
2022-10-23Rollup merge of #103414 - compiler-errors:rpit-print-lt, r=cjgillotMichael Howell-0/+10
Pretty print lifetimes captured by RPIT This specifically makes the output in #103409 change from: ```diff error: `impl` item signature doesn't match `trait` item signature --> $DIR/signature-mismatch.rs:15:5 | LL | fn async_fn(&self, buff: &[u8]) -> impl Future<Output = Vec<u8>>; | ----------------------------------------------------------------- expected `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>>` ... LL | fn async_fn<'a>(&self, buff: &'a [u8]) -> impl Future<Output = Vec<u8>> + 'a { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>>` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>> + '2` | = note: expected `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>>` - found `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>>` + found `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>> + '2` = help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait` = help: verify the lifetime relationships in the `trait` and `impl` between the `self` argument, the other inputs and its output error: aborting due to previous error ``` Along with the UI tests in this PR, which I think are all improvements! r? `@oli-obk` though feel free to re-roll
2022-10-23Annotate static lifetimes tooMichael Goulet-9/+3
2022-10-23Rollup merge of #103123 - compiler-errors:early-binder-iter, r=cjgillotMatthias Krüger-2/+1
Introduce `subst_iter` and `subst_iter_copied` on `EarlyBinder` Makes working with bounds lists a bit easier, which I seem to do a lot. Specifically, means that we don't need to do `.transpose_iter().map(|(pred, _)| *pred)` every time we want to iterate through an `EarlyBinder<&'tcx [(Predicate, Span)]>` (and even then, still have to call `subst` later), which was a very awkward idiom imo.
2022-10-22Pretty print lifetimes captured by RPITMichael Goulet-0/+16
2022-10-22Introduce subst_iter and subst_iter_copied on EarlyBinderMichael Goulet-2/+1
2022-10-18change `ConstEvaluatable` to use `ty::Const`lcnr-2/+2
2022-10-14Get rid of `rustc_query_description!`Nilstrieb-1/+10
Queries can provide an arbitrary expression for their description and their caching behavior. Before, these expressions where stored in a `rustc_query_description` macro emitted by the `rustc_queries` macro, and then used in `rustc_query_impl` to fill out the methods for the `QueryDescription` trait. Instead, we now emit two new modules from `rustc_queries` containing the functions with the expressions. `rustc_query_impl` calls these functions now instead of invoking the macro. Since we are now defining some of the functions in `rustc_middle::query`, we now need all the imports for the key types there as well.
2022-10-13Print RPITIT verbosely if -ZverboseMichael Goulet-1/+3
2022-10-08Rollup merge of #102514 - b-naber:binder-print-fixes, r=jackh726Michael Howell-12/+63
Don't repeat lifetime names from outer binder in print Fixes https://github.com/rust-lang/rust/issues/102392 Fixes https://github.com/rust-lang/rust/issues/102414 r? ```@lcnr```
2022-10-08handle late-bound vars from inner binders correctly and add testb-naber-1/+1
2022-10-03re-name params + add commentsb-naber-10/+16
2022-10-02Avoid ICE in printing RPITIT typeMichael Goulet-1/+1
2022-09-30don't repeat lifetime names from outer binder in printb-naber-12/+57
2022-09-28account for use of index-based lifetime names in print of binderb-naber-4/+10
2022-09-26address reviewb-naber-2/+3
2022-09-26don't duplicate late-bound region names in print of Binderb-naber-27/+53
2022-09-24Auto merge of #102068 - cjgillot:erased-lifetime-print, r=eholkbors-22/+3
Always print '_, even for erased lifetimes. Explicit lifetime arguments are now the recommended syntax in rust 2018 and rust 2021. This PR applies this discipline to rustc itself.
2022-09-23Always print '_, even for erased lifetimes.Camille GILLOT-22/+3
2022-09-23rename Unevaluated to UnevaluatedConstb-naber-1/+1
2022-09-22introduce mir::Unevaluatedb-naber-3/+1
2022-09-19remove the `Subst` trait, always use `EarlyBinder`lcnr-2/+2
2022-09-17Auto merge of #98588 - b-naber:valtrees-cleanup, r=lcnrbors-9/+3
Use only ty::Unevaluated<'tcx, ()> in type system r? `@lcnr`
2022-09-13use ty::Unevaluated<'tcx, ()> in type systemb-naber-9/+3
2022-09-12Rename some variantsMichael Goulet-3/+2
2022-09-12Plumb dyn trait representation through ty::DynamicEric Holk-2/+7
2022-09-12Rollup merge of #100767 - kadiwa4:escape_ascii, r=jackh726Dylan DPC-8/+1
Remove manual <[u8]>::escape_ascii `@rustbot` label: +C-cleanup
2022-09-10Auto merge of #98559 - jackh726:remove-reempty, r=oli-obkbors-9/+1
Remove ReEmpty r? rust-lang/types
2022-09-09Auto merge of #101603 - matthiaskrgr:rollup-8y6kf20, r=matthiaskrgrbors-3/+5
Rollup of 6 pull requests Successful merges: - #99207 (Enable eager checks for memory sanitizer) - #101253 (fix the suggestion of format for asm_sub_register) - #101450 (Add `const_extern_fn` to 1.62 release notes.) - #101556 (Tweak future opaque ty pretty printing) - #101563 (Link UEFI target documentation from target list) - #101593 (Cleanup themes (tooltip)) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-09-09Adjust pretty printing of RPITITsMichael Goulet-1/+7
2022-09-08Remove ReEmptyJack Huey-9/+1
2022-09-08We can print futures with {integer} tooMichael Goulet-1/+1
2022-09-08Generator return doesn't need to be a lang itemMichael Goulet-2/+4
2022-09-05Pack `Term` in the same way as `GenericArg`.Nicholas Nethercote-12/+8
This shrinks the `PredicateS` type, which is instanted frequently.
2022-08-30Rollup merge of #101101 - RalfJung:read-pointer-as-bytes, r=oli-obkDylan DPC-1/+1
interpret: make read-pointer-as-bytes a CTFE-only error with extra information Next step in the reaction to https://github.com/rust-lang/rust/issues/99923. Also teaches Miri to implicitly strip provenance in more situations when transmuting pointers to integers, which fixes https://github.com/rust-lang/miri/issues/2456. Pointer-to-int transmutation during CTFE now produces a message like this: ``` = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported ``` r? ``@oli-obk``
2022-08-27interpret: make read-pointer-as-bytes *always* work in MiriRalf Jung-1/+1
and show some extra information when it happens in CTFE
2022-08-26Suggest returning closure as impl FnMichael Goulet-0/+37
2022-08-19use <[u8]>::escape_ascii instead of core::ascii::escape_defaultKaDiWa-8/+1
2022-08-09fixb-naber-0/+4