about summary refs log tree commit diff
path: root/compiler/rustc_const_eval/src/interpret/call.rs
AgeCommit message (Collapse)AuthorLines
2025-09-17Remove `DynKind`León Orell Valerian Liehr-3/+3
2025-08-19Rollup merge of #145585 - RalfJung:miri-inplace-arg-checks, r=compiler-errors许杰友 Jieyou Xu (Joe)-3/+9
Miri: fix handling of in-place argument and return place handling This fixes two separate bugs (in two separate commits): - If the return place is `_local` and not `*ptr`, we didn't always properly protect it if there were other pointers pointing to that return place. - If two in-place arguments are *the same* local variable, we didn't always detect that aliasing.
2025-08-18interpret: fix in-place return place semantics when the return place ↵Ralf Jung-3/+9
expression is a local variable
2025-08-14Rollup merge of #145266 - camsteffen:reduce-queries, r=petrochenkovGuillaume Gomez-1/+1
Reduce some queries around associated items
2025-08-14Rollup merge of #144727 - Stypox:add-tracing-to-resolve, r=RalfJungGuillaume Gomez-8/+15
Add tracing to resolve-related functions Resolve-related functions are not called often but still make up for ~3% of execution time for non-repetitive programs (as seen in the first table below, obtained from running the rust snippet at the bottom with `n=1`). On the other hand, for repetitive programs they become less relevant (I tested the same snippet but with `n=100` and got ~1.5%), and it appears that only `try_resolve` is called more often (see the last two tables). The first table was obtained by opening the trace file in https://ui.perfetto.dev and running the following query: ```sql select "TOTAL PROGRAM DURATION" as name, count(*), max(ts + dur) as "sum(dur)", 100.0 as "%", null as "min(dur)", null as "max(dur)", null as "avg(dur)", null as "stddev(dur)" from slices union select "TOTAL OVER ALL SPANS (excluding events)" as name, count(*), sum(dur), cast(cast(sum(dur) as float) / (select max(ts + dur) from slices) * 1000 as int) / 10.0 as "%", min(dur), max(dur), cast(avg(dur) as int) as "avg(dur)", cast(sqrt(avg(dur*dur)-avg(dur)*avg(dur)) as int) as "stddev(dur)" from slices where parent_id is null and name != "frame" and name != "step" and dur > 0 union select name, count(*), sum(dur), cast(cast(sum(dur) as float) / (select max(ts + dur) from slices) * 1000 as int) / 10.0 as "%", min(dur), max(dur), cast(avg(dur) as int) as "avg(dur)", cast(sqrt(avg(dur*dur)-avg(dur)*avg(dur)) as int) as "stddev(dur)" from slices where parent_id is null and name != "frame" and name != "step" group by name order by sum(dur) desc, count(*) desc ``` <img width="1687" height="242" alt="image" src="https://github.com/user-attachments/assets/4d4bd890-869b-40f3-a473-8e4c42b02da4" /> The following two tables show how many `resolve` spans there per subname/subcategory, and how much time is spent in each. The first is for `n=1` and the second for `n=100`. The query that was used is: ```sql select args.string_value as name, count(*), max(dur), avg(dur), sum(dur) from slices inner join args USING (arg_set_id) where args.key = "args." || slices.name and name = "resolve" group by args.string_value ``` <img width="1688" height="159" alt="image" src="https://github.com/user-attachments/assets/a8749856-c099-492e-a86e-6d67b146af9c" /> <img width="1688" height="159" alt="image" src="https://github.com/user-attachments/assets/ce3ac1b5-5c06-47d9-85a6-9b921aea348e" /> The snippet I tested with Miri to obtain the above traces is: ```rust fn main() { let n: usize = std::env::args().nth(1).unwrap().parse().unwrap(); let mut v = (0..n).into_iter().collect::<Vec<_>>(); for i in &mut v { *i += 1; } } ```
2025-08-13Cleanup assoc parent utilsCameron Steffen-1/+1
2025-08-11Turn _span into _trace as trace span nameStypox-2/+2
_span could possibly be confused with the Span type in rustc
2025-08-11Add tracing to resolve-related functionsStypox-8/+15
2025-08-09rename `TraitRef::from_method` to `from_assoc`Deadbeef-1/+1
also add a note to `GenericArgs::truncate_to`
2025-07-31Add EnteredTraceSpan::or_if_tracing_disabledStypox-2/+3
2025-07-31Add tracing to more functions related to step.rsStypox-1/+6
2025-07-28Rename trait_of_item -> trait_of_assocCameron Steffen-1/+1
2025-07-27miri: for ABI mismatch errors, say which argument is the problemRalf Jung-3/+7
2025-07-15Add InterpCx::fn_abi_of_instance/_fn_ptr with tracing, shadowing FnAbiOfStypox-1/+1
2025-07-06interpret: rename StackPopCleanupRalf Jung-18/+18
2025-07-01Remove support for dyn*Michael Goulet-40/+13
2025-06-27Add InterpCx::layout_of with tracing, shadowing LayoutOfStypox-1/+1
2025-06-05Update `InterpCx::project_field` to take `FieldIdx`Scott McMurray-5/+4
As suggested by Ralf in 142005.
2025-05-22interpret: do not force_allocate all return placesRalf Jung-30/+22
2025-05-17Rollup merge of #135808 - tiif:conv_display, r=workingjubileeMatthias Krüger-2/+2
Implement Display for ``rustc_target::callconv::Conv`` Follow up of https://github.com/rust-lang/rust/pull/133103#discussion_r1885552854
2025-04-28AsyncDrop implementation using shim codegen of ↵Andrew Zhogin-0/+2
async_drop_in_place::{closure}, scoped async drop added.
2025-03-12impl Display for Convtiif-2/+2
2025-02-15add a doc commentRalf Jung-0/+1
2025-02-15made check_argument_compat publicgeetanshjuneja-1/+1
2025-02-08Rustfmtbjorn3-8/+14
2025-01-30More assertions, tests, and miri coverageMichael Goulet-19/+26
2025-01-04rustc_intrinsic: support functions without body; they are implicitly marked ↵Ralf Jung-1/+2
as must-be-overridden
2024-12-25swap_typed_nonoverlapping: properly detect overlap even when swapping scalar ↵Ralf Jung-13/+1
values
2024-12-19Pass FnAbi to find_mir_or_eval_fntiif-2/+2
2024-11-19`InterpCx` store `TypingEnv` instead of a `ParamEnv`lcnr-29/+29
2024-11-18use `TypingEnv` when no `infcx` is availablelcnr-29/+29
the behavior of the type system not only depends on the current assumptions, but also the currentnphase of the compiler. This is mostly necessary as we need to decide whether and how to reveal opaque types. We track this via the `TypingMode`.
2024-11-04miri: update ABI compat checks to accept Option-like typesRalf Jung-18/+35
2024-11-03compiler: Directly use rustc_abi in const_evalJubilee Young-7/+6
2024-10-29compiler: `rustc_abi::Abi` => `BackendRepr`Jubilee Young-2/+2
The initial naming of "Abi" was an awful mistake, conveying wrong ideas about how psABIs worked and even more about what the enum meant. It was only meant to represent the way the value would be described to a codegen backend as it was lowered to that intermediate representation. It was never meant to mean anything about the actual psABI handling! The conflation is because LLVM typically will associate a certain form with a certain ABI, but even that does not hold when the special cases that actually exist arise, plus the IR annotations that modify the ABI. Reframe `rustc_abi::Abi` as the `BackendRepr` of the type, and rename `BackendRepr::Aggregate` as `BackendRepr::Memory`. Unfortunately, due to the persistent misunderstandings, this too is now incorrect: - Scattered ABI-relevant code is entangled with BackendRepr - We do not always pre-compute a correct BackendRepr that reflects how we "actually" want this value to be handled, so we leave the backend interface to also inject various special-cases here - In some cases `BackendRepr::Memory` is a "real" aggregate, but in others it is in fact using memory, and in some cases it is a scalar! Our rustc-to-backend lowering code handles this sort of thing right now. That will eventually be addressed by lifting duplicated lowering code to either rustc_codegen_ssa or rustc_target as appropriate.
2024-10-19interpret errors: add map_err_kind, rename InterpError -> InterpErrorKindRalf Jung-1/+1
2024-10-01make InterpResult a dedicated type to avoid accidentally discarding the errorRalf Jung-30/+28
2024-09-25Compiler: Rename "object safe" to "dyn compatible"León Orell Valerian Liehr-1/+1
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-17/+11
2024-09-22Rollup merge of #130690 - RalfJung:interpret-abi-compat-fixme, r=jieyouxuGuillaume Gomez-1/+0
interpret: remove outdated FIXME The rule about `repr(C)` types with compatible fields got removed from the ABI compat docs before they landed, so this FIXME here is no longer correct. (So this is basically a follow-up to https://github.com/rust-lang/rust/pull/130185, doing some more cleanup around deciding not to guarantee ABI compatibility for structurally compatible `repr(C)` types.)
2024-09-22fix rustc_nonnull_optimization_guaranteed docsRalf Jung-0/+1
2024-09-22interpret: remove outdated FIXMERalf Jung-1/+0
2024-09-12Rollup merge of #130250 - compiler-errors:useless-conversion, r=jieyouxuStuart Cook-1/+1
Fix `clippy::useless_conversion` Self-explanatory. Probably the last clippy change I'll actually put up since this is the only other one I've actually seen in the wild.
2024-09-11clippy::useless_conversionMichael Goulet-1/+1
2024-09-09Remove needless returns detected by clippy in the compilerEduardo Sánchez Muñoz-2/+2
2024-09-06Make `Ty::boxed_ty` return an `Option`Pavel Grigorenko-1/+1
2024-09-02chore: Fix typos in 'compiler' (batch 1)Alexander Cyon-2/+2
2024-08-28Rollup merge of #129613 - RalfJung:interpret-target-feat, r=saethlinMatthias Krüger-37/+7
interpret: do not make const-eval query result depend on tcx.sess The check against calling functions with missing target features uses `tcx.sess` to determine which target features are available. However, this can differ between different crates in a crate graph, so the same const-eval query can come to different conclusions about whether a constant evaluates successfully or not -- which is bad, we should consistently get the same result everywhere.
2024-08-26Stop using a special inner body for the coroutine by-move body for async ↵Michael Goulet-1/+0
closures
2024-08-26interpret: do not make const-eval query result depend on tcx.sessRalf Jung-37/+7
2024-08-11Use assert_matches around the compilerMichael Goulet-1/+2