summary refs log tree commit diff
path: root/compiler/rustc_middle/src/query/mod.rs
AgeCommit message (Collapse)AuthorLines
2023-07-06get rid of a bit more calls to poly_selectMichael Goulet-1/+1
2023-07-05Name the destructure_mir_constant query appropriatelyOli Scherer-1/+1
2023-07-05Specialize `try_destructure_mir_constant` for its sole userOli Scherer-2/+4
2023-07-05Don't require associated types with `Self: Sized` bounds in `dyn Trait` objectsOli Scherer-0/+4
2023-07-03Remove chalk from the compilerMichael Goulet-11/+2
2023-07-03use `deeply_normalize` for `assumed_wf_types`lcnr-1/+1
2023-07-01Put `FnAbiError` behind reference to shrink resultNilstrieb-2/+2
The `FnAbi` is just a pointer, so the error type should not be bigger.
2023-07-01Put `LayoutError` behind reference to shrink resultNilstrieb-2/+2
`LayoutError` is 24 bytes, which is bigger than the `Ok` types, so let's shrink that.
2023-06-26Migrate predicates_of and caller_bounds to ClauseMichael Goulet-4/+4
2023-06-22migrate inferred_outlives_of to ClauseMichael Goulet-1/+1
2023-06-22Migrate item_bounds to ty::ClauseMichael Goulet-2/+2
2023-06-21Rollup merge of #112772 - compiler-errors:clauses-1, r=lcnrNilstrieb-1/+1
Add a fully fledged `Clause` type, rename old `Clause` to `ClauseKind` Does two basic things before I put up a more delicate set of PRs (along the lines of #112714, but hopefully much cleaner) that migrate existing usages of `ty::Predicate` to `ty::Clause` (`predicates_of`/`item_bounds`/`ParamEnv::caller_bounds`). 1. Rename `Clause` to `ClauseKind`, so it's parallel with `PredicateKind`. 2. Add a new `Clause` type which is parallel to `Predicate`. * This type exposes `Clause::kind(self) -> Binder<'tcx, ClauseKind<'tcx>>` which is parallel to `Predicate::kind` 😸 The new `Clause` type essentially acts as a newtype wrapper around `Predicate` that asserts that it is specifically a `PredicateKind::Clause`. Turns out from experimentation[^1] that this is not negative performance-wise, which is wonderful, since this a much simpler design than something that requires encoding the discriminant into the alignment bits of a predicate kind, or something else like that... r? ``@lcnr`` or ``@oli-obk`` [^1]: https://github.com/rust-lang/rust/pull/112714#issuecomment-1595653910
2023-06-19Make closure_saved_names_of_captured_variables a query.Camille GILLOT-0/+13
2023-06-19s/Clause/ClauseKindMichael Goulet-1/+1
2023-06-16Add `AliasKind::Weak` for type aliases.Oli Scherer-0/+10
Only use it when the type alias contains an opaque type. Also does wf-checking on such type aliases.
2023-06-07Auto merge of #109005 - Nilstrieb:dont-forgor-too-much-from-cfg, r=petrochenkovbors-1/+10
Remember names of `cfg`-ed out items to mention them in diagnostics # Examples ## `serde::Deserialize` without the `derive` feature (a classic beginner mistake) I had to slightly modify serde so that it uses explicit re-exports instead of a glob re-export. (Update: a serde PR was merged that adds the manual re-exports) ``` error[E0433]: failed to resolve: could not find `Serialize` in `serde` --> src/main.rs:1:17 | 1 | #[derive(serde::Serialize)] | ^^^^^^^^^ could not find `Serialize` in `serde` | note: crate `serde` has an item named `Serialize` but it is inactive because its cfg predicate evaluated to false --> /home/gh-Nilstrieb/.cargo/registry/src/index.crates.io-6f17d22bba15001f/serde-1.0.160/src/lib.rs:343:1 | 343 | #[cfg(feature = "serde_derive")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 344 | pub use serde_derive::{Deserialize, Serialize}; | ^^^^^^^^^ = note: the item is gated behind the `serde_derive` feature = note: see https://doc.rust-lang.org/cargo/reference/features.html for how to activate a crate's feature ``` (the suggestion is not ideal but that's serde's fault) I already tested the metadata size impact locally by compiling the `windows` crate without any features. `800k` -> `809k` r? `@ghost`
2023-06-01Remember names of `cfg`-ed out items to mention them in diagnosticsNilstrieb-1/+10
`#[cfg]`s are frequently used to gate crate content behind cargo features. This can lead to very confusing errors when features are missing. For example, `serde` doesn't have the `derive` feature by default. Therefore, `serde::Serialize` fails to resolve with a generic error, even though the macro is present in the docs. This commit adds a list of all stripped item names to metadata. This is filled during macro expansion and then, through a fed query, persisted in metadata. The downstream resolver can then access the metadata to look at possible candidates for mentioning in the errors. This slightly increases metadata (800k->809k for the feature-heavy windows crate), but not enough to really matter.
2023-06-01Rename `impl_defaultness` to `defaultness`Deadbeef-2/+3
2023-05-31Remove `lit_to_mir_constant` queryOli Scherer-4/+0
2023-05-31Remove `deref_mir_constant`Oli Scherer-8/+0
2023-05-24Rollup merge of #111870 - WaffleLapkin:just_🌟traits🌟_query, ↵Matthias Krüger-9/+11
r=compiler-errors Rename `traits_in_crate` query to `traits` > NOTE: Not named just `traits` due to a naming conflict. This can, in fact, be easily avoided.
2023-05-23Rename `traits_in_crate` query to `traits`Maybe Waffle-9/+11
2023-05-19Auto merge of #111641 - michaelwoerister:debugger-visualizer-fixes, r=cjgillotbors-1/+8
Fix dependency tracking for debugger visualizers This PR fixes dependency tracking for debugger visualizer files by changing the `debugger_visualizers` query to an `eval_always` query that scans the AST while it is still available. This way the set of visualizer files is already available when dep-info is emitted. Since the query is turned into an `eval_always` query, dependency tracking will now reliably detect changes to the visualizer script files themselves. TODO: - [x] perf.rlo - [x] Needs a bit more documentation in some places - [x] Needs regression test for the incr. comp. case Fixes https://github.com/rust-lang/rust/issues/111226 Fixes https://github.com/rust-lang/rust/issues/111227 Fixes https://github.com/rust-lang/rust/issues/111295 r? `@wesleywiser` cc `@gibbyfree`
2023-05-18Rollup merge of #111686 - cjgillot:no-foreign-item, r=compiler-errorsDylan DPC-6/+0
Retire is_foreign_item query. This can be written in terms of `DefKind`. This does not deserve the cost of a query.
2023-05-17Retire is_foreign_item query.Camille GILLOT-6/+0
2023-05-17Finish move of query.rsJohn KÃ¥re Alsaker-5/+5
2023-05-16Move DebuggerVisualizerFile types from rustc_span to rustc_middleMichael Woerister-1/+2
2023-05-16Rollup merge of #111533 - clubby789:drop-tracking-error, r=oli-obkMatthias Krüger-1/+1
Handle error body in generator layout Fixes #111468 I feel like making this query return `Option<GeneratorLayout>` might be better but had some issues with that approach
2023-05-16Turn debugger_visualizers from feed- into regular query.Michael Woerister-1/+6
2023-05-16Fix dependency tracking for debugger visualizersMichael Woerister-0/+1
2023-05-15Move expansion of query macros in rustc_middle to rustc_middle::queryJohn KÃ¥re Alsaker-1/+85
2023-05-13Handle error body when in generator layoutclubby789-1/+1
2023-05-12add `query opaque_types_defined_by`lcnr-0/+9
2023-05-11Rollup merge of #108705 - clubby789:refutable-let-closure-borrow, r=cjgillotMatthias Krüger-1/+1
Prevent ICE with broken borrow in closure r? `@Nilstrieb` Fixes #108683 This solution isn't ideal, I'm hoping to find a way to continue compilation without ICEing.
2023-05-09add EarlyBinder to thir_abstract_const; remove tcx.bound_abstract_constKyle Matsuda-1/+1
2023-05-08Rollup merge of #109410 - fmease:iat-alias-kind-inherent, r=compiler-errorsMichael Goulet-0/+10
Introduce `AliasKind::Inherent` for inherent associated types Allows us to check (possibly generic) inherent associated types for well-formedness. Type inference now also works properly. Follow-up to #105961. Supersedes #108430. Fixes #106722. Fixes #108957. Fixes #109768. Fixes #109789. Fixes #109790. ~Not to be merged before #108860 (`AliasKind::Weak`).~ CC `@jackh726` r? `@compiler-errors` `@rustbot` label T-types F-inherent_associated_types
2023-05-04IAT: Introduce AliasKind::InherentLeón Orell Valerian Liehr-0/+10
2023-05-03Rename things to reflect that they're not item specificMichael Goulet-1/+1
2023-05-02Auto merge of #111028 - compiler-errors:attr-query-no-caching, r=cjgillotbors-10/+0
Make some simple queries no longer cache on disk I don't think we need to cache queries with really simple local providers, like loading hir and accessing an attr r? `@ghost`
2023-05-01Make some simple queries no longer cache on diskMichael Goulet-10/+0
2023-04-30Only cache typeck results if it's the typeck rootMichael Goulet-1/+1
2023-04-30Bail out of MIR construction if `check_match` failsclubby789-1/+1
2023-04-26Remove QueryEngine traitJohn KÃ¥re Alsaker-0/+1
2023-04-25Rollup merge of #110556 - kylematsuda:earlybinder-explicit-item-bounds, ↵Matthias Krüger-1/+1
r=compiler-errors Switch to `EarlyBinder` for `explicit_item_bounds` Part of the work to finish https://github.com/rust-lang/rust/issues/105779. This PR adds `EarlyBinder` to the return type of the `explicit_item_bounds` query and removes `bound_explicit_item_bounds`. r? `@compiler-errors` (hope it's okay to request you, since you reviewed #110299 and #110498 :smiley:)
2023-04-25Revert "Remove #[alloc_error_handler] from the compiler and library"Matthias Krüger-0/+11
This reverts commit abc0660118cc95f47445fd33502a11dd448f5968.
2023-04-23Auto merge of #108118 - oli-obk:lazy_typeck, r=cjgillotbors-39/+35
Run various queries from other queries instead of explicitly in phases These are just legacy leftovers from when rustc didn't have a query system. While there are more cleanups of this sort that can be done here, I want to land them in smaller steps. This phased order of query invocations was already a lie, as any query that looks at types (e.g. the wf checks run before) can invoke e.g. const eval which invokes borrowck, which invokes typeck, ...
2023-04-22Auto merge of #109507 - Amanieu:panic-oom-payload, r=davidtwcobors-11/+0
Report allocation errors as panics OOM is now reported as a panic but with a custom payload type (`AllocErrorPanicPayload`) which holds the layout that was passed to `handle_alloc_error`. This should be review one commit at a time: - The first commit adds `AllocErrorPanicPayload` and changes allocation errors to always be reported as panics. - The second commit removes `#[alloc_error_handler]` and the `alloc_error_hook` API. ACP: https://github.com/rust-lang/libs-team/issues/192 Closes #51540 Closes #51245
2023-04-21Make `check_match` and `check_liveness` take a `LocalDefId`Oli Scherer-2/+2
2023-04-21Allow `LocalDefId` as the argument to `def_path_str`Oli Scherer-33/+33
2023-04-21Leave it to the query system to invoke the typeck query instead of invoking ↵Oli Scherer-4/+0
it eagerly. Later queries that are run on all body owners will invoke typeck as they need information from its result to perform their own logic