about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/hooks
AgeCommit message (Collapse)AuthorLines
2025-09-26Make `def_path_hash_to_def_id` not panic when passed an invalid hashLi-yao Xia-1/+1
2025-07-23Remove useless lifetime parameter.Camille GILLOT-2/+2
2025-02-05Pretty print pattern type values with `transmute` if they don't satisfy ↵Oli Scherer-0/+4
their pattern
2025-02-03Remove hook calling via `TyCtxtAt`.Nicholas Nethercote-17/+3
All hooks receive a `TyCtxtAt` argument. Currently hooks can be called through `TyCtxtAt` or `TyCtxt`. In the latter case, a `TyCtxtAt` is constructed with a dummy span and passed to the hook. However, in practice hooks are never called through `TyCtxtAt`, and always receive a dummy span. (I confirmed this via code inspection, and double-checked it by temporarily making the `TyCtxtAt` code path panic and running all the tests.) This commit removes all the `TyCtxtAt` machinery for hooks. All hooks now receive `TyCtxt` instead of `TyCtxtAt`. There are two existing hooks that use `TyCtxtAt::span`: `const_caller_location_provider` and `try_destructure_mir_constant_for_user_output`. For both hooks the span is always a dummy span, probably unintentionally. This dummy span use is now explicit. If a non-dummy span is needed for these two hooks it would be easy to add it as an extra argument because hooks are less constrained than queries.
2025-01-31Remove the `mir_build` hook.Nicholas Nethercote-6/+0
It was downgraded from a query in #122721 but it can just be a vanilla function because it's not called in `rustc_middle`.
2025-01-31Remove the `thir_{tree,flat}` hooks.Nicholas Nethercote-6/+0
They were downgraded from queries in #123995 but they can just be vanilla functions because they are not called in `rustc_middle`.
2025-01-31Add/clarify comments about hooks.Nicholas Nethercote-4/+7
Explaining things that weren't clear to me at first.
2024-11-09Move some code from Compiler::enter to GlobalCtxt::finishbjorn3-0/+13
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-1/+1
2024-07-29Reformat `use` declarations.Nicholas Nethercote-3/+4
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-15Introduce and provide a hook for `should_codegen_locally`Mohammad Omidvar-0/+4
2024-05-23Remove `#[macro_use] extern crate tracing` from `rustc_middle`.Nicholas Nethercote-0/+1
2024-04-16Rollup merge of #124016 - DaniPopes:dedup-default-providers, r=lcnrGuillaume Gomez-7/+8
Outline default query and hook provider function implementations The default query and hook provider functions call `bug!` with a decently long message. Due to argument inlining in `format_args!` ([`flatten_format_args`](https://github.com/rust-lang/rust/issues/78356)), this ends up duplicating the message for each query, adding ~90KB to `librustc_driver.so` of unreachable panic messages. To avoid this, we can outline the common `bug!` logic.
2024-04-16Outline default query and hook provider function implementationsDaniPopes-7/+8
2024-04-15Make thir_tree and thir_flat into hooksMichael Goulet-0/+6
2024-03-27Make `def_path_hash_to_def_id` a hookOli Scherer-0/+8
2024-03-27Move `CrateStore::expn_hash_to_expn_id` to a hookOli Scherer-1/+7
2024-03-27Start replacing `CStore` trait methods with hooks.Oli Scherer-3/+8
This also avoids the cyclic definition issues with CrateStore being defined after TyCtxt, but needing to be used in TyCtxt.
2024-03-20Rename mir_const query to mir_builtOli Scherer-1/+1
2024-03-20Replace `mir_built` query with a hook and use mir_const everywhere insteadOli Scherer-0/+6
2024-03-13coverage: Make `is_eligible_for_coverage` a hook methodZalathar-0/+7
This will allow MIR building to check whether a function is eligible for coverage instrumentation, and avoid collecting branch coverage info if it is not.
2023-11-01Rename hook.Camille GILLOT-1/+1
2023-10-31Turn const_caller_location from a query to a hookOli Scherer-0/+3
2023-09-30add some docs to hooks/mod.rsRalf Jung-0/+5
2023-09-22Add tracing instrumentation, just like queries automatically add itOli Scherer-0/+1
2023-09-22Add a way to decouple the implementation and the declaration of a TyCtxt method.Oli Scherer-0/+64