about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/query
AgeCommit message (Collapse)AuthorLines
2022-05-11Gracefully fail to resolve associated items instead of `delay_span_bug`.Camille GILLOT-1/+1
2022-05-10don't encode only locally used attrslcnr-0/+3
2022-05-09only cache `codegen_fn_attrs` on disk if its locallcnr-1/+1
2022-05-09store `codegen_fn_attrs` in crate metadatalcnr-0/+1
2022-05-08Fixed typo in docs and correct doc linksFridtjof Stoldt-3/+3
Co-authored-by: Philipp Krones <hello@philkrones.com>
2022-05-08Move lint expectation checking into a separate query (RFC 2383)xFrednet-0/+19
2022-05-03Add support for a new attribute `#[debugger_visualizer]` to support ↵ridwanabdillahi-0/+6
embedding debugger visualizers into a generated PDB. Cleanup `DebuggerVisualizerFile` type and other minor cleanup of queries. Merge the queries for debugger visualizers into a single query. Revert move of `resolve_path` to `rustc_builtin_macros`. Update dependencies in Cargo.toml for `rustc_passes`. Respond to PR comments. Load visualizer files into opaque bytes `Vec<u8>`. Debugger visualizers for dynamically linked crates should not be embedded in the current crate. Update the unstable book with the new feature. Add the tracking issue for the debugger_visualizer feature. Respond to PR comments and minor cleanups.
2022-04-28Auto merge of #95976 - b-naber:valtree-constval-conversion, r=oli-obkbors-0/+5
Implement Valtree to ConstValue conversion Once we start to use `ValTree`s in the type system we will need to be able to convert them into `ConstValue` instances, which we want to continue to use after MIR construction. r? `@oli-obk` cc `@RalfJung`
2022-04-25Auto merge of #95604 - nbdd0121:used2, r=petrochenkovbors-2/+2
Generate synthetic object file to ensure all exported and used symbols participate in the linking Fix #50007 and #47384 This is the synthetic object file approach that I described in https://github.com/rust-lang/rust/pull/95363#issuecomment-1079932354, allowing all exported and used symbols to be linked while still allowing them to be GCed. Related #93791, #95363 r? `@petrochenkov` cc `@carbotaniuman`
2022-04-21implement (as of now still unused) query for valtree -> constvalue conversionb-naber-0/+5
2022-04-19Rollup merge of #94493 - ↵Dylan DPC-0/+6
oribenshir:feature/ISSUE-78543_async_fn_in_foreign_crate_diag_2, r=davidtwco Improved diagnostic on failure to meet send bound on future in a foreign crate Provide a better diagnostic on failure to meet send bound on futures in a foreign crate. fixes #78543
2022-04-18Add `SymbolExportInfo`Gary Guo-2/+2
This is currently a wrapper to `SymbolExportLevel` but it allows later addition of extra information.
2022-04-17Auto merge of #95655 - kckeiks:create-hir-crate-items-query, r=cjgillotbors-0/+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-16Provide a better diagnostic on failure to meet send bound on futures in a ↵oribenshir-0/+6
foreign crate Adding diagnostic data on generators to the crate metadata and using it to provide a better diagnostic on failure to meet send bound on futures originated from a foreign crate
2022-04-10Store LocalDefId in is_late_bound_map.Camille GILLOT-2/+1
This allows to avoid looking at HIR from borrowck.
2022-04-09Use def_key in `tcx.item_name` when possible.Camille GILLOT-4/+1
2022-04-08Refactor HIR item-like traversal (part 1)Miguel Guarniz-0/+7
- 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-02Auto merge of #95537 - GuillaumeGomez:type_of-doc, r=Dylan-DPCbors-1/+4
Improve TyCtxt::type_of documentation r? `@oli-obk`
2022-04-02Improve TyCtxt::type_of documentationGuillaume Gomez-1/+4
2022-03-31Merge impl_constness and is_const_fn_raw.Camille GILLOT-6/+1
2022-03-30Auto merge of #95436 - cjgillot:static-mut, r=oli-obkbors-6/+0
Remember mutability in `DefKind::Static`. This allows to compute the `BodyOwnerKind` from `DefKind` only, and removes a direct dependency of some MIR queries onto HIR. As a side effect, it also simplifies metadata, since we don't need 4 flavours of `EntryKind::*Static` any more.
2022-03-30rework implementation for inherent impls for builtin typeslcnr-0/+13
2022-03-29Remember mutability in `DefKind::Static`.Camille GILLOT-6/+0
This allows to compute the `BodyOwnerKind` from `DefKind` only, and removes a direct dependency of some MIR queries onto HIR. As a side effect, it also simplifies metadata, since we don't need 4 flavours of `EntryKind::*Static` any more.
2022-03-25Auto merge of #95280 - InfRandomness:infrandomness/Dtorck_clarification, ↵bors-1/+1
r=oli-obk Swap DtorckConstraint to DropckConstraint This change was made as per suspicion that this struct was never renamed after consistent use of DropCk. This also clarifies the meaning behind the name of this structure. Fixes https://github.com/rust-lang/rust/issues/94310
2022-03-25Rollup merge of #95179 - b-naber:eval-in-try-unify, r=lcnrDylan DPC-4/+4
Try to evaluate in try unify and postpone resolution of constants that contain inference variables We want code like that in [`ui/const-generics/generic_const_exprs/eval-try-unify.rs`](https://github.com/rust-lang/rust/compare/master...b-naber:eval-in-try-unify?expand=1#diff-8027038201cf07a6c96abf3cbf0b0f4fdd8a64ce6292435f01c8ed995b87fe9b) to compile. To do that we need to try to evaluate constants in `try_unify_abstract_consts`, this requires us to be more careful about what constants we try to resolve, specifically we cannot try to resolve constants that still contain inference variables. r? `@lcnr`
2022-03-24Swap DtorckConstraint to DropckConstraintInfRandomness-1/+1
This change was made as per suspicion that this struct was never renamed after consistent use of DropCk. This also clarifies the meaning behind the name of this structure.
2022-03-23dont use a query for lit_to_constantb-naber-4/+0
2022-03-23change thir to lazily create constantsb-naber-0/+5
2022-03-21try to evaluate in try_unifyb-naber-4/+4
2022-03-16rustc_error: make ErrorReported impossible to constructmark-1/+3
There are a few places were we have to construct it, though, and a few places that are more invasive to change. To do this, we create a constructor with a long obvious name.
2022-03-12Queryify `is_doc_hidden`Noah Lev-0/+5
It came up hot on some profiling of rustdoc I did, so hopefully turning it into a query will help.
2022-03-11Improve `AdtDef` interning.Nicholas Nethercote-1/+1
This commit makes `AdtDef` use `Interned`. Much the commit is tedious changes to introduce getter functions. The interesting changes are in `compiler/rustc_middle/src/ty/adt.rs`.
2022-03-02rename ErrorReported -> ErrorGuaranteedmark-7/+7
2022-03-01Querify `global_backend_features`Simonas Kazlauskas-0/+9
At the very least this serves to deduplicate the diagnostics that are output about unknown target features provided via CLI.
2022-02-24Auto merge of #94129 - cjgillot:rmeta-table, r=petrochenkovbors-3/+3
Back more metadata using per-query tables r? `@ghost`
2022-02-21Take CodegenFnAttrs into account when validating asm! register operandsAmanieu d'Antras-0/+4
Checking of asm! register operands now properly takes function attributes such as #[target_feature] and #[instruction_set] into account.
2022-02-19Stop interning stability.Camille GILLOT-3/+3
2022-02-17Add module-level docs for `rustc_middle::query`pierwill-0/+6
2022-02-16Support pretty printing of invalid constantsTomasz Miąsko-3/+5
Make it possible to pretty print invalid constants by introducing a fallible variant of `destructure_const` and falling back to debug formatting when it fails.
2022-02-15Overhaul `Const`.Nicholas Nethercote-5/+5
Specifically, rename the `Const` struct as `ConstS` and re-introduce `Const` as this: ``` pub struct Const<'tcx>(&'tcx Interned<ConstS>); ``` This now matches `Ty` and `Predicate` more closely, including using pointer-based `eq` and `hash`. Notable changes: - `mk_const` now takes a `ConstS`. - `Const` was copy, despite being 48 bytes. Now `ConstS` is not, so need a we need separate arena for it, because we can't use the `Dropless` one any more. - Many `&'tcx Const<'tcx>`/`&Const<'tcx>` to `Const<'tcx>` changes - Many `ct.ty` to `ct.ty()` and `ct.val` to `ct.val()` changes. - Lots of tedious sigil fiddling.
2022-02-15Overhaul `TyS` and `Ty`.Nicholas Nethercote-6/+6
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-09Explain &Arc.Camille GILLOT-0/+4
2022-02-09Make FnAbiError Copy.Camille GILLOT-4/+2
2022-02-09Use a slice for object_lifetime_defaults.Camille GILLOT-3/+1
2022-02-09Use a slice in DefIdForest.Camille GILLOT-2/+1
2022-02-09Ensure that queries only return Copy types.Camille GILLOT-15/+33
2022-02-04Rollup merge of #90132 - joshtriplett:stabilize-instrument-coverage, ↵Matthias Krüger-1/+1
r=wesleywiser Stabilize `-Z instrument-coverage` as `-C instrument-coverage` (Tracking issue for `instrument-coverage`: https://github.com/rust-lang/rust/issues/79121) This PR stabilizes support for instrumentation-based code coverage, previously provided via the `-Z instrument-coverage` option. (Continue supporting `-Z instrument-coverage` for compatibility for now, but show a deprecation warning for it.) Many, many people have tested this support, and there are numerous reports of it working as expected. Move the documentation from the unstable book to stable rustc documentation. Update uses and documentation to use the `-C` option. Addressing questions raised in the tracking issue: > If/when stabilized, will the compiler flag be updated to -C instrument-coverage? (If so, the -Z variant could also be supported for some time, to ease migrations for existing users and scripts.) This stabilization PR updates the option to `-C` and keeps the `-Z` variant to ease migration. > The Rust coverage implementation depends on (and automatically turns on) -Z symbol-mangling-version=v0. Will stabilizing this feature depend on stabilizing v0 symbol-mangling first? If so, what is the current status and timeline? This stabilization PR depends on https://github.com/rust-lang/rust/pull/90128 , which stabilizes `-C symbol-mangling-version=v0` (but does not change the default symbol-mangling-version). > The Rust coverage implementation implements the latest version of LLVM's Coverage Mapping Format (version 4), which forces a dependency on LLVM 11 or later. A compiler error is generated if attempting to compile with coverage, and using an older version of LLVM. Given that LLVM 13 has now been released, requiring LLVM 11 for coverage support seems like a reasonable requirement. If people don't have at least LLVM 11, nothing else breaks; they just can't use coverage support. Given that coverage support currently requires a nightly compiler and LLVM 11 or newer, allowing it on a stable compiler built with LLVM 11 or newer seems like an improvement. The [tracking issue](https://github.com/rust-lang/rust/issues/79121) and the [issue label A-code-coverage](https://github.com/rust-lang/rust/labels/A-code-coverage) link to a few open issues related to `instrument-coverage`, but none of them seem like showstoppers. All of them seem like improvements and refinements we can make after stabilization. The original `-Z instrument-coverage` support went through a compiler-team MCP at https://github.com/rust-lang/compiler-team/issues/278 . Based on that, `@pnkfelix` suggested that this needed a stabilization PR and a compiler-team FCP.
2022-02-02Auto merge of #93312 - pierwill:map-all-local-trait-impls, r=cjgillotbors-1/+1
Return an indexmap in `all_local_trait_impls` query The data structure previously used here required that `DefId` be `Ord`. As part of #90317, we do not want `DefId` to implement `Ord`.
2022-02-02Auto merge of #93466 - cjgillot:query-dead, r=nagisabors-0/+16
Make dead code check a query. Dead code check is run for each invocation of the compiler, even if no modifications were involved. This PR makes dead code check a query keyed on the module. This allows to skip the check when a module has not changed. To perform this, a query `live_symbols_and_ignored_derived_traits` is introduced to encapsulate the global analysis of finding live symbols. The second query `check_mod_deathness` outputs diagnostics for each module based on this first query's results.
2022-02-01Make dead code check a query.Camille GILLOT-0/+16