summary refs log tree commit diff
path: root/compiler/rustc_middle/src/query/mod.rs
AgeCommit message (Collapse)AuthorLines
2024-01-31Auto merge of #120346 - petrochenkov:ownodes, r=oli-obkbors-2/+2
hir: Refactor getters for owner nodes
2024-01-30hir: Simplify `hir_owner_nodes` queryVadim Petrochenkov-2/+2
The query accept arbitrary DefIds, not just owner DefIds. The return can be an `Option` because if there are no nodes, then it doesn't matter whether it's due to NonOwner or Phantom. Also rename the query to `opt_hir_owner_nodes`.
2024-01-27Remove unnecessary unit returns in query declarationsDaniPopes-14/+14
For consistency with normal functions.
2024-01-26Auto merge of #116167 - RalfJung:structural-eq, r=lcnrbors-2/+2
remove StructuralEq trait The documentation given for the trait is outdated: *all* function pointers implement `PartialEq` and `Eq` these days. So the `StructuralEq` trait doesn't really seem to have any reason to exist any more. One side-effect of this PR is that we allow matching on some consts that do not implement `Eq`. However, we already allowed matching on floats and consts containing floats, so this is not new, it is just allowed in more cases now. IMO it makes no sense at all to allow float matching but also sometimes require an `Eq` instance. If we want to require `Eq` we should adjust https://github.com/rust-lang/rust/pull/115893 to check for `Eq`, and rule out float matching for good. Fixes https://github.com/rust-lang/rust/issues/115881
2024-01-25Rollup merge of #119895 - oli-obk:track_errors_3, r=matthewjasperMatthias Krüger-2/+6
Remove `track_errors` entirely follow up to https://github.com/rust-lang/rust/pull/119869 r? `@matthewjasper` There are some diagnostic changes adding new diagnostics or not emitting some anymore. We can improve upon that in follow-up work imo.
2024-01-24remove StructuralEq traitRalf Jung-2/+2
2024-01-23Remove track_errors entirelyOli Scherer-2/+6
2024-01-22Add a simpler and more targetted code path for impl trait in assoc itemsOli Scherer-0/+9
2024-01-19Auto merge of #120112 - matthiaskrgr:rollup-48o3919, r=matthiaskrgrbors-7/+9
Rollup of 9 pull requests Successful merges: - #119582 (bootstrap: handle vendored sources when remapping crate paths) - #119730 (docs: fix typos) - #119828 (Improved collapse_debuginfo attribute, added command-line flag) - #119869 (replace `track_errors` usages with bubbling up `ErrorGuaranteed`) - #120037 (Remove `next_root_ty_var`) - #120094 (tests/ui/asm/inline-syntax: adapt for LLVM 18) - #120096 (Set RUSTC_BOOTSTRAP=1 consistently) - #120101 (change `.unwrap()` to `?` on write where `fmt::Result` is returned) - #120102 (Fix typo in munmap_partial.rs) r? `@ghost` `@rustbot` modify labels: rollup
2024-01-19Auto merge of #120006 - cjgillot:no-hir-owner, r=wesleywiserbors-8/+0
Get rid of the hir_owner query. This query was meant as a firewall between `hir_owner_nodes` which is supposed to change often, and the queries that only depend on the item signature. That firewall was inefficient, leaking the contents of the HIR body through `HirId`s. `hir_owner` incurs a significant cost, as we need to hash HIR twice in multiple modes. This PR proposes to remove it, and simplify the hashing scheme. For the future, `def_kind`, `def_span`... are much more efficient for incremental decoupling, and should be preferred.
2024-01-18Rollup merge of #119869 - oli-obk:track_errors2, r=matthewjasperMatthias Krüger-7/+9
replace `track_errors` usages with bubbling up `ErrorGuaranteed` more of the same as https://github.com/rust-lang/rust/pull/117449 (removing `track_errors`)
2024-01-17Correctly handle normalization in implied boundsAli MJ Al-Nasrawy-1/+10
Special-case Bevy dependents to not error
2024-01-17Make crate_inherent_impls fallible and stop using `track_errors` for itOli Scherer-5/+5
2024-01-17Make crate_inherent_impls_overlap_check bubble up its errorsOli Scherer-1/+2
2024-01-17Move `check_mod_impl_wf` query call out of track_errors and bubble errors up ↵Oli Scherer-1/+2
instead.
2024-01-16Get rid of the hir_owner query.Camille GILLOT-8/+0
2024-01-11`specialization_graph_of`'s `errored` field is used in the only call site, ↵Oli Scherer-2/+1
and used to immediately throw away the rest of the value. Let's use `Result` to statically signal that this is happening
2024-01-08Don't check for recursion in generator witness fieldsMichael Goulet-0/+2
2024-01-05Auto merge of #119192 - michaelwoerister:mcp533-push, r=cjgillotbors-11/+11
Replace a number of FxHashMaps/Sets with stable-iteration-order alternatives This PR replaces almost all of the remaining `FxHashMap`s in query results with either `FxIndexMap` or `UnordMap`. The only case that is missing is the `EffectiveVisibilities` struct which turned out to not be straightforward to transform. Once that is done too, we can remove the `HashStable` implementation from `HashMap`. The first commit adds the `StableCompare` trait which is a companion trait to `StableOrd`. Some types like `Symbol` can be compared in a cross-session stable way, but their `Ord` implementation is not stable. In such cases, a `StableCompare` implementation can be provided to offer a lightweight way for stable sorting. The more heavyweight option is to sort via `ToStableHashKey`, but then sorting needs to have access to a stable hashing context and `ToStableHashKey` can also be expensive as in the case of `Symbol` where it has to allocate a `String`. The rest of the commits are rather mechanical and don't overlap, so they are best reviewed individually. Part of [MCP 533](https://github.com/rust-lang/compiler-team/issues/533).
2024-01-05Stabilize THIR unsafeckMatthew Jasper-5/+4
2024-01-04Make iteration order of collect_return_position_impl_trait_in_trait_tys ↵Michael Woerister-2/+2
query stable
2024-01-04Make iteration order of supported_target_features query stableMichael Woerister-1/+1
2024-01-04Make iteration order of trimmed_def_paths query stableMichael Woerister-1/+1
2024-01-04Make iteration order of named_variable_map, late_bound_vars_map, and ↵Michael Woerister-2/+2
resolve_bound_vars queries stable
2024-01-04Make iteration order of wasm_import_module_map query stableMichael Woerister-1/+1
2024-01-04Make iteration order of upstream_monomorphizations query stableMichael Woerister-2/+2
2024-01-04Replace a number of FxHashMaps/Sets with stable-iteration-order alternatives.Michael Woerister-2/+2
2024-01-02Merge check_for_entry_fn fully into check_mod_type_wfOli Scherer-4/+0
2024-01-02Reorder `check_item_type` diagnostics so they occur next to the ↵Oli Scherer-2/+2
corresponding `check_well_formed` diagnostics
2023-12-18Replace some instances of FxHashMap/FxHashSet with stable alternatives ↵Michael Woerister-2/+2
(mostly in rustc_hir and rustc_ast_lowering) Part of https://github.com/rust-lang/compiler-team/issues/533
2023-12-13global param_env canonicalization cacheAli MJ Al-Nasrawy-1/+3
2023-12-02Rename `HandlerInner::delay_span_bug` as `HandlerInner::span_delayed_bug`.Nicholas Nethercote-3/+3
Because the corresponding `Level` is `DelayedBug` and `span_delayed_bug` follows the pattern used everywhere else: `span_err`, `span_warning`, etc.
2023-11-25rustc: Make `def_kind` mandatory for all `DefId`sVadim Petrochenkov-1/+1
2023-11-23Move WorkerLocal out of QueryArenasMark Rousskov-1/+0
This cuts librustc_driver.so code size by ~85 kilobytes.
2023-11-22Allow defining opaques in check_coroutine_obligationsMichael Goulet-1/+1
2023-11-21Auto merge of #118107 - matthiaskrgr:rollup-k5bfkfr, r=matthiaskrgrbors-1/+11
Rollup of 8 pull requests Successful merges: - #117327 (Add documentation for some queries) - #117835 (Note about object lifetime defaults in does not live long enough error) - #117851 (Uplift `InferConst` to `rustc_type_ir`) - #117973 (test: Add test for async-move in 2015 Rust proc macro) - #117992 (Don't require intercrate mode for negative coherence) - #118010 (Typeck break expr even if break is illegal) - #118026 (Don't consider regions in `deref_into_dyn_supertrait` lint) - #118089 (intercrate_ambiguity_causes: handle self ty infer + reservation impls) r? `@ghost` `@rustbot` modify labels: rollup
2023-11-20Unify defined_lib_features and lib_features queriesMichael Goulet-5/+2
2023-11-19Add documentation for some queriesNilstrieb-1/+11
2023-10-31Turn const_caller_location from a query to a hookOli Scherer-4/+0
2023-10-26Stash and cancel cycle errors for auto trait leakage in opaquesMichael Goulet-0/+1
2023-10-25Rollup merge of #117136 - compiler-errors:defid-list, r=oli-obkMatthias Krüger-1/+1
Intern `LocalDefId` list from `opaque_types_defined_by` query r? oli-obk
2023-10-24Intern LocalDefId list from opaque queryMichael Goulet-1/+1
2023-10-23Auto merge of #116849 - oli-obk:error_shenanigans, r=cjgillotbors-3/+7
Avoid a `track_errors` by bubbling up most errors from `check_well_formed` I believe `track_errors` is mostly papering over issues that a sufficiently convoluted query graph can hit. I made this change, while the actual change I want to do is to stop bailing out early on errors, and instead use this new `ErrorGuaranteed` to invoke `check_well_formed` for individual items before doing all the `typeck` logic on them. This works towards resolving https://github.com/rust-lang/rust/issues/97477 and various other ICEs, as well as allowing us to use parallel rustc more (which is currently rather limited/bottlenecked due to the very sequential nature in which we do `rustc_hir_analysis::check_crate`) cc `@SparrowLii` `@Zoxc` for the new `try_par_for_each_in` function
2023-10-23Allow `ensure` queries to return `Result<(), ErrorGuaranteed>`Oli Scherer-1/+5
2023-10-21coverage: Change query `codegened_and_inlined_items` to a plain functionZalathar-6/+0
This query has a name that sounds general-purpose, but in fact it has coverage-specific semantics, and (fortunately) is only used by coverage code. Because it is only ever called once (from one designated CGU), it doesn't need to be a query, and we can change it to a regular function instead.
2023-10-20s/generator/coroutine/Oli Scherer-9/+9
2023-10-20s/Generator/Coroutine/Oli Scherer-2/+2
2023-10-20Avoid a `track_errors` by bubbling up most errors from `check_well_formed`Oli Scherer-2/+2
2023-10-18coverage: Store all of a function's mappings in function coverage infoZalathar-11/+0
Previously, mappings were attached to individual coverage statements in MIR. That necessitated special handling in MIR optimizations to avoid deleting those statements, since otherwise codegen would be unable to reassemble the original list of mappings. With this change, a function's list of mappings is now attached to its MIR body, and survives intact even if individual statements are deleted by optimizations.
2023-10-18coverage: Store the number of counters/expressions in function coverage infoZalathar-4/+5
Coverage codegen can now allocate arrays based on the number of counters/expressions originally used by the instrumentor. The existing query that inspects coverage statements is still used for determining the number of counters passed to `llvm.instrprof.increment`. If some high-numbered counters were removed by MIR optimizations, the instrumented binary can potentially use less memory and disk space at runtime.