about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty/print
AgeCommit message (Collapse)AuthorLines
2022-01-09rustc_metadata: Optimize and document module children decodingVadim Petrochenkov-1/+3
2021-12-22When obligation is a sized predicate, prefer projection or object candidates ↵Jack Huey-4/+10
instead of param_env candidates
2021-12-20Bail if printing item named `_` in `try_print_visible_def_path`Michael Goulet-16/+28
2021-12-19Auto merge of #92099 - matthiaskrgr:rollup-4gwv67m, r=matthiaskrgrbors-13/+14
Rollup of 7 pull requests Successful merges: - #91141 (Revert "Temporarily rename int_roundings functions to avoid conflicts") - #91984 (Remove `in_band_lifetimes` from `rustc_middle`) - #92028 (Sync portable-simd to fix libcore build for AVX-512 enabled targets) - #92042 (Enable `#[thread_local]` for all windows-msvc targets) - #92071 (Update example code for Vec::splice to change the length) - #92077 (rustdoc: Remove unused `collapsed` field) - #92081 (rustdoc: Remove unnecessary `need_backline` function) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-12-19Rollup merge of #91984 - Aaron1011:rustc-middle-lifetime, r=oli-obkMatthias Krüger-13/+14
Remove `in_band_lifetimes` from `rustc_middle` 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.
2021-12-19Auto merge of #91957 - nnethercote:rm-SymbolStr, r=oli-obkbors-1/+1
Remove `SymbolStr` This was originally proposed in https://github.com/rust-lang/rust/pull/74554#discussion_r466203544. As well as removing the icky `SymbolStr` type, it allows the removal of a lot of `&` and `*` occurrences. Best reviewed one commit at a time. r? `@oli-obk`
2021-12-18hir: Do not introduce dummy type names for `extern` blocks in def pathsVadim Petrochenkov-16/+12
Use a separate nameless `DefPathData` variant instead
2021-12-15Remove `in_band_lifetimes` from `rustc_middle`Aaron Hill-13/+14
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.
2021-12-15Remove unnecessary sigils around `Symbol::as_str()` calls.Nicholas Nethercote-1/+1
2021-12-02Reduce boilerplate around infallible foldersAlan Egerton-8/+8
2021-11-26Unwrap the results of type foldersLeSeulArtichaut-1/+1
Co-authored-by: Alan Egerton <eggyal@gmail.com>
2021-11-26Adapt `TypeFolder` implementors to return a `Result`LeSeulArtichaut-7/+7
Co-authored-by: Alan Egerton <eggyal@gmail.com>
2021-11-23Fix printing unit return ty, don't elaborate FnOnce unless we see itMichael Goulet-7/+16
2021-11-23Suppress noisy generator associated typeMichael Goulet-4/+14
2021-11-23Elaborate trait generics and associated typesMichael Goulet-74/+210
2021-11-20Add space in opaque `impl Trait`Michael Goulet-3/+3
2021-11-18Print output ty for opaque future tyMichael Goulet-11/+55
2021-11-09Add `ty::Visibility::is_public()`inquisitivecrystal-1/+1
2021-10-18Normalize obligations for closure confirmationjackh726-0/+1
2021-10-10ty::pretty: prevent infinite recursion for `extern crate` paths.Eduard-Mihai Burtescu-1/+8
2021-10-10ty::pretty: document "dummy Span extern crate" special-case in ↵Eduard-Mihai Burtescu-10/+11
`try_print_visible_def_path_recur`.
2021-10-08Auto merge of #89619 - michaelwoerister:incr-vtables, r=nagisabors-0/+1
Turn vtable_allocation() into a query This PR removes the untracked vtable-const-allocation cache from the `tcx` and turns the `vtable_allocation()` method into a query. The change is pretty straightforward and should be backportable without too much effort. Fixes https://github.com/rust-lang/rust/issues/89598.
2021-10-07Turn tcx.vtable_allocation() into a query.Michael Woerister-0/+1
2021-10-06Auto merge of #89323 - estebank:derive-binop, r=petrochenkovbors-0/+21
Consider unfulfilled obligations in binop errors When encountering a binop where the types would have been accepted, if all the predicates had been fulfilled, include information about the predicates and suggest appropriate `#[derive]`s if possible. Fix #84515.
2021-10-05Consider unfulfilled obligations in binop errorsEsteban Kuber-0/+21
When encountering a binop where the types would have been accepted, if all the predicates had been fulfilled, include information about the predicates and suggest appropriate `#[derive]`s if possible. Point at trait(s) that needs to be `impl`emented.
2021-10-03Move rustc_middle::middle::cstore to rustc_session.Camille GILLOT-1/+1
2021-10-02Auto merge of #89408 - Mark-Simulacrum:fix-query-nondet, r=petrochenkovbors-2/+23
Avoid nondeterminism in trimmed_def_paths Previously this query depended on the global interning order of Symbols, which meant that irrelevant changes could influence the query and cause recompilations. This commit ensures that the return set is stable and will not be affected by the global order by deterministically (in lexicographic order) choosing a name to use if there are multiple names for a single DefId. This should fix the cause of the [regressions] in #83343. [regressions]: https://perf.rust-lang.org/compare.html?start=9620f3a84b079decfdc2e557be007580b097fe43&end=addb4da686a97da46159f0123cb6cdc2ce3d7fdb
2021-09-30Avoid nondeterminism in trimmed_def_pathsMark Rousskov-2/+23
Previously this query depended on the global interning order of Symbols, which meant that irrelevant changes could influence the query and cause recompilations. This commit ensures that the return set is stable and will not be affected by the global order by deterministically (in lexicographic order) choosing a name to use if there are multiple names for a single DefId.
2021-09-29Avoid more invocations of hir_crate query.Camille GILLOT-1/+1
2021-09-28More tracing instrumentationOli Scherer-6/+6
2021-09-21Disable visible path calculation for PrettyPrinter in Ok path of compilerAlik Aslanyan-0/+15
2021-08-26Auto merge of #87280 - lcnr:lazy-anon-const-default-substs, r=nikomatsakisbors-24/+31
lazily "compute" anon const default substs Continuing the work of #83086, this implements the discussed solution for the [unused substs problem](https://github.com/rust-lang/project-const-generics/blob/master/design-docs/anon-const-substs.md#unused-substs). As of now, anonymous constants inherit all of their parents generics, even if they do not use them, e.g. in `fn foo<T, const N: usize>() -> [T; N + 1]`, the array length has `T` as a generic parameter even though it doesn't use it. These *unused substs* cause some backwards incompatible, and imo incorrect behavior, e.g. #78369. --- We do not actually filter any generic parameters here and the `default_anon_const_substs` query still a dummy which only checks that - we now prevent the previously existing query cycles and are able to call `predicates_of(parent)` when computing the substs of anonymous constants - the default anon consts substs only include the typeflags we assume it does. Implementing that filtering will be left as future work. --- The idea of this PR is to delay the creation of the anon const substs until after we've computed `predicates_of` for the parent of the anon const. As the predicates of the parent can however contain the anon const we still have to create a `ty::Const` for it. We do this by changing the substs field of `ty::Unevaluated` to an option and modifying accesses to instead call the method `unevaluated.substs(tcx)` which returns the substs as before. If the substs - now `substs_` - of `ty::Unevaluated` are `None`, it means that the anon const currently has its default substs, i.e. the substs it has when first constructed, which are the generic parameters it has available. To be able to call `unevaluated.substs(tcx)` in a `TypeVisitor`, we add the non-defaulted method `fn tcx_for_anon_const_substs(&self) -> Option<TyCtxt<'tcx>>`. In case `tcx_for_anon_const_substs` returns `None`, unknown anon const default substs are skipped entirely. Even when `substs_` is `None` we still have to treat the constant as if it has its default substs. To do this, `TypeFlags` are modified so that it is clear whether they can still change when *exposing* any anon const default substs. A new flag, `HAS_UNKNOWN_DEFAULT_CONST_SUBSTS`, is added in case some default flags are missing. The rest of this PR are some smaller changes to either not cause cycles by trying to access the default anon const substs too early or to be able to access the `tcx` in previously unused locations. cc `@rust-lang/project-const-generics` r? `@nikomatsakis`
2021-08-26Auto merge of #87194 - eddyb:const-value-mangling, r=michaelwoerister,oli-obkbors-5/+12
rustc_symbol_mangling: support structural constants and &str in v0. This PR should unblock #85530 (except for float `const` generics, which AFAIK should've never worked). (cc `@tmiasko` could the https://github.com/rust-lang/rust/pull/85530#issuecomment-857855379 failures be retried with a quick crater "subset" run of this PR + changing the default to `v0`? Just to make sure I didn't miss anything other than the floats) The encoding is the one suggested before in e.g. https://github.com/rust-lang/rust/issues/61486#issuecomment-878932102, tho this PR won't by itself finish #61486, before closing that we'd likely want to move to `@oli-obk's` "valtrees" (i.e. #83234 and other associated work). <hr> **EDITs**: 1. switched unit/tuple/braced-with-named-fields `<const-fields>` prefixes from `"u"`/`"T"`/`""` to `"U"`/`"T"`/`"S"` to avoid the ambiguity reported by `@tmiasko` in https://github.com/rust-lang/rust/pull/87194#issuecomment-884279921. 2. `rustc-demangle` PR: https://github.com/alexcrichton/rustc-demangle/pull/55 3. RFC amendment PR: https://github.com/rust-lang/rfcs/pull/3161 * also removed the grammar changes included in that PR, from this description 4. added tests (temporarily using my fork of `rustc-demangle`) <hr> r? `@michaelwoerister`
2021-08-26reviewlcnr-2/+2
2021-08-26use `ty::Unevaluated` instead of def substs pairlcnr-2/+2
2021-08-26update `TypeFlags` to deal with missing ct substslcnr-1/+3
2021-08-26make unevaluated const substs optionallcnr-22/+21
2021-08-26require a `tcx` for `TypeVisitor`lcnr-0/+6
2021-08-25Various pattern cleanupsLéo Lanteri Thauvin-18/+20
2021-08-24Fix typo (variant_id should've been variant_idx).Eduard-Mihai Burtescu-3/+3
2021-08-24Pretty-print uninhabited const values more explicitly.Eduard-Mihai Burtescu-2/+9
2021-08-19introduce a Coerce predicateNiko Matsakis-0/+5
2021-08-13move Constness into TraitPredicateDeadbeef-5/+2
2021-07-25Merge the BTreeMap in hir::Crate.Camille GILLOT-1/+1
2021-07-18When pretty printing, name placeholders as bound regionsjackh726-35/+107
2021-07-16get rid of incorrect erase_for_fmtRalf Jung-5/+5
2021-07-14consistently treat None-tagged pointers as ints; get rid of some deprecated ↵Ralf Jung-1/+1
Scalar methods
2021-07-14CTFE/Miri engine Pointer type overhaul: make Scalar-to-Pointer conversion ↵Ralf Jung-5/+6
infallible This resolves all the problems we had around "normalizing" the representation of a Scalar in case it carries a Pointer value: we can just use Pointer if we want to have a value taht we are sure is already normalized.
2021-07-06Make resolutions a query.Camille GILLOT-1/+1
2021-07-04Combine individual limit queries into single `limits` queryAaron Hill-1/+1