about summary refs log tree commit diff
path: root/compiler/rustc_const_eval/src/util/caller_location.rs
AgeCommit message (Collapse)AuthorLines
2025-09-25const_caller_location: edit FIXME to explain use of `DUMMY_SP`Akrm Al-Hakimi-1/+1
Co-authored-by: Ralf Jung <post@ralfj.de>
2025-08-04add `project_fields` helper functionWaffle Lapkin-5/+5
2025-07-23Remove useless lifetime parameter.Camille GILLOT-1/+1
2025-06-28Rollup merge of #142708 - Darksonn:location-len-without-nul, r=Mark-SimulacrumMatthias Krüger-7/+5
Do not include NUL-terminator in computed length This PR contains just the first commit of rust-lang/rust#142579 which changes it so that the string length stored in the `Location` is the length of the `&str` rather than the length of the `&CStr`. Since most users will want the `&str` length, it seems better to optimize for that use-case. There should be no visible changes in the behavior or API.
2025-06-27Add InterpCx::layout_of with tracing, shadowing LayoutOfStypox-1/+0
2025-06-19Do not include NUL-terminator in computed lengthAlice Ryhl-7/+5
2025-06-06Rollup merge of #142103 - scottmcm:fieldidx-in-interp, r=oli-obkGuillaume Gomez-4/+8
Update `InterpCx::project_field` to take `FieldIdx` As suggested by Ralf in https://github.com/rust-lang/rust/pull/142005#discussion_r2125839015
2025-06-05Update `InterpCx::project_field` to take `FieldIdx`Scott McMurray-4/+8
As suggested by Ralf in 142005.
2025-06-06Rollup merge of #142012 - oli-obk:no-optional-spans, r=fee1-deadMatthias Krüger-1/+1
Replace some `Option<Span>` with `Span` and use DUMMY_SP instead of None Turns out many locations actually have a span available that we could use, so I used it
2025-06-05Replace some `Option<Span>` with `Span` and use DUMMY_SP instead of NoneOli Scherer-1/+1
2025-06-04Add Location::file_with_nulTaylor Cramer-8/+13
This is useful for C/C++ APIs which expect the const char* returned from __FILE__ or std::source_location::file_name.
2025-02-03Remove hook calling via `TyCtxtAt`.Nicholas Nethercote-5/+4
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.
2024-12-18Re-export more `rustc_span::symbol` things from `rustc_span`.Nicholas Nethercote-1/+1
`rustc_span::symbol` defines some things that are re-exported from `rustc_span`, such as `Symbol` and `sym`. But it doesn't re-export some closely related things such as `Ident` and `kw`. So you can do `use rustc_span::{Symbol, sym}` but you have to do `use rustc_span::symbol::{Ident, kw}`, which is inconsistent for no good reason. This commit re-exports `Ident`, `kw`, and `MacroRulesNormalizedIdent`, and changes many `rustc_span::symbol::` qualifiers in `compiler/` to `rustc_span::`. This is a 200+ net line of code reduction, mostly because many files with two `use rustc_span` items can be reduced to one.
2024-12-09interpret: clean up deduplicating allocation functionsRalf Jung-6/+3
2024-11-19`InterpCx` store `TypingEnv` instead of a `ParamEnv`lcnr-1/+1
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-1/+1
2024-07-29Reformat `use` declarations.Nicholas Nethercote-2/+1
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-06-13rename CompileTimeInterpreter -> CompileTimeMachine, CompileTimeEvalContext ↵Ralf Jung-2/+2
-> CompileTimeInterpCx to match the terms used in the shared interpreter infrastructure
2024-05-27interpret: get rid of 'mir lifetime everywhereRalf Jung-2/+2
2024-05-23Remove `#[macro_use] extern crate tracing` from `rustc_const_eval`.Nicholas Nethercote-0/+1
2024-05-13Remove `extern crate rustc_middle` from `rustc_const_eval`.Nicholas Nethercote-0/+1
This requires exporting the interpreter macros so they can be used with `use crate::interpret::*`.
2024-02-27Split rustc_type_ir to avoid rustc_ast from depending on itOli Scherer-2/+1
2024-02-21make it possible for outside crates to inspect a mir::ConstValue with the ↵Ralf Jung-2/+7
interpreter
2024-02-10unstably allow constants to refer to statics and read from immutable staticsRalf Jung-2/+2
2024-01-22const-eval interner: from-scratch rewrite using mutability information from ↵Ralf Jung-0/+1
provenance rather than types
2023-10-31Turn const_caller_location from a query to a hookOli Scherer-5/+8
2023-10-28interpret: call caller_location logic the same way codegen does, and share ↵Ralf Jung-0/+63
some code