about summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2025-07-16Rollup merge of #143968 - Stypox:tracing-FnAbiOf, r=RalfJungSamuel Tardieu-18/+40
Add tracing to `InterpCx::fn_abi_of_instance/fn_abi_of_fn_ptr` This PR adds tracing to the `InterpCx::fn_abi_of_instance`/`::fn_abi_of_fn_ptr` functions by shadowing `FnAbiOf`'s trait methods with inherent methods on `InterpCx`, like done in rust-lang/rust#142721. The reason why I am targeting these two functions is because they are used for Miri interpretation, and they make a `layout_of` query down the line without passing through the `layout_of` that was traced in rust-lang/rust#142721. There are other places where `layout_of` is called without being traced (see the analysis below), but that's because the `Machine` used there is not `MiriMachine` but rather `CompileTimeMachine` which does not implement `enter_trace_span()`. But after discussing with ```````@RalfJung``````` we agreed that the const-eval part should not be traced together with Miri, that's why I am ignoring the other places where `layout_of` is called. r? ```````@RalfJung``````` <details><summary>Analysis of the places where <code>layout_of</code> is called</summary> I did some analysis for https://github.com/rust-lang/rust/pull/142721#discussion_r2171494841, and these are all the places where the query `tcx.layout_of` is called (directly or indirectly) outside of a traced `InterpCx::layout_of` while a program is being interpreted by Miri: ``` adjust_for_rust_scalar at ./compiler/rustc_ty_utils/src/abi.rs:302:35 {closure#2} at ./compiler/rustc_ty_utils/src/abi.rs:522:25 eval_body_using_ecx<> at ./compiler/rustc_const_eval/src/const_eval/eval_queries.rs:49:22 {closure#1}<> at ./compiler/rustc_const_eval/src/interpret/operand.rs:851:76 {closure#0}<> at ./compiler/rustc_const_eval/src/interpret/stack.rs:612:18 size_and_align at ./compiler/rustc_middle/src/mir/interpret/mod.rs:387:38 ``` I got these by: - patching rustc with this patch that adds a span to the `layout_of` query which prints the backtrace: [layout_of_other_places.diff.txt](https://github.com/user-attachments/files/21235523/layout_of_other_places.diff.txt) - adding this to my bootstrap.toml to have debug symbols inside the Miri binary: `rust.debuginfo-level = "line-tables-only"` and also `build.tool.miri.features = ["tracing"]` - obtaining a trace file with `MIRI_TRACING=1 ./x.py run miri --stage 1 --warnings warn --args src/tools/miri/tests/pass/hello.rs` (note: maybe using a file different than "src/tools/miri/tests/pass/hello.rs" would lead to more places where layout_of is called?) - running this query in Perfetto to select all `layout_of` spans that have as a direct parent a span named "frame" (as opposed to the parent being `InterpCx::layout_of`) and extract their backtrace: `select args.string_value from slice left join args on slice.arg_set_id = args.id where slice.name = "tcx.layout_of" and slice.parent_id in (select slice2.id from slice as slice2 where slice2.name = "frame") group by args.string_value` - exporting the data as `.tsv` and processing that file through this Python script. It finds the first path in the backtraces where "layout" isn't mentioned, which imo is a good heuristic to not consider `layout_of` wrappers/friends as call places, but rather go down the backtrace until an actual call place is reached. [layout_of_other_places.py.txt](https://github.com/user-attachments/files/21235529/layout_of_other_places.py.txt) </details>
2025-07-16Rollup merge of #143920 - oli-obk:cg-llvm-safety, r=jieyouxuSamuel Tardieu-253/+221
Make more of codegen_llvm safe Best reviewed commit-by-commit.
2025-07-16Rollup merge of #143692 - RalfJung:miri-oob, r=oli-obkSamuel Tardieu-12/+15
miri: fix out-of-bounds error for ptrs with negative offsets r? ```````@oli-obk```````
2025-07-16Port `#[coverage]` to the new attribute systemSasha Pourcelot-28/+149
2025-07-16simplfy memory kind handling during interningRalf Jung-42/+11
2025-07-16const heap: fix ICE on forgotten make_globalRalf Jung-44/+53
2025-07-16trait_sel: `MetaSized` always holds temporarilyDavid Wood-0/+7
As a temporary measure while a proper fix for `tests/ui/sized-hierarchy/incomplete-inference-issue-143992.rs` is implemented, make `MetaSized` obligations always hold. In effect, temporarily reverting the `sized_hierarchy` feature. This is a small change that can be backported.
2025-07-16future-incompat lints: don't link to the nightly edition-guide versiondianne-24/+24
2025-07-16Make frame spans appear on a separate trace lineStypox-1/+6
This was done by making the tracing_chrome tracing layer check if "tracing_separate_line" was in the arguments of a span, and act accordingly.
2025-07-16type_id_eq: check that the hash fully matches the typeRalf Jung-48/+57
2025-07-16resolve: Optimize `fn traits_in_module`Vadim Petrochenkov-7/+6
2025-07-16resolve: Import `ty::Visibility` everywhereVadim Petrochenkov-42/+39
2025-07-15Improve comments inside `codegen_get_discr`Scott McMurray-2/+46
2025-07-16resolve: Remove trait `ToNameBinding`Vadim Petrochenkov-78/+84
2025-07-16resolve: Merge `NameBindingKind::Module` into `NameBindingKind::Res`Vadim Petrochenkov-99/+61
2025-07-15Use hygenic macros for stable-mirJacob Greenfield-9/+9
2025-07-15Fix ice for feature-gated cfg attributes applied to the crateJonathan Brouwer-38/+74
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-16Comment more code and make tests clearerDeadbeef-21/+25
Co-Authored-By: Ralf Jung <post@ralfj.de>
2025-07-16format pointer later instead of eagerly converting to stringDeadbeef-15/+15
2025-07-16add `const_make_global`; err for `const_allocate` ptrs if didn't callDeadbeef-19/+171
Co-Authored-By: Ralf Jung <post@ralfj.de> Co-Authored-By: Oli Scherer <github333195615777966@oli-obk.de>
2025-07-15Add alias for ArgOutlivesPredicateMichael Goulet-36/+26
2025-07-15Gate things properlyMichael Goulet-10/+17
2025-07-15Consider outlives assumptions when proving auto traits for coroutine interiorsMichael Goulet-42/+285
2025-07-15Deduce outlives obligations from WF of coroutine interior typesMichael Goulet-3/+67
2025-07-15Add outlives to CoroutineWitnessTypesMichael Goulet-2/+15
2025-07-15Fix CItiif-7/+2
2025-07-15Implement other logicstiif-8/+130
2025-07-15Lint against having both #[unstable_feature_bound] and #[stable] on the same ↵tiif-0/+21
item
2025-07-15Make stability attribute not to error when unstable feature bound is in effecttiif-2/+30
2025-07-15Add the core logic in old and new solverstiif-2/+96
2025-07-15Lower the UnstableFeatureBound predicate to UnstableFeature predicatetiif-0/+14
2025-07-15Setup unstable feature bound attributetiif-0/+80
2025-07-15Implement resolver warnings about reexporting private dependenciesDavid Mládek-2/+42
2025-07-15rustc_resolve: rename `check_hidden_glob_reexports` to `lint_reexports`David Mládek-7/+2
2025-07-15Add InterpCx::fn_abi_of_instance/_fn_ptr with tracing, shadowing FnAbiOfStypox-18/+40
2025-07-15Auto merge of #143958 - samueltardieu:rollup-lh1s143, r=samueltardieubors-58/+134
Rollup of 13 pull requests Successful merges: - rust-lang/rust#142301 (tests: Fix duplicated-path-in-error fail with musl) - rust-lang/rust#143630 (Drop `./x suggest`) - rust-lang/rust#143736 (Give all bytes of TypeId provenance) - rust-lang/rust#143752 (Don't panic if WASI_SDK_PATH not set when detecting compiler) - rust-lang/rust#143837 (Adjust `run_make_support::symbols` helpers) - rust-lang/rust#143878 (Port `#[pointee]` to the new attribute parsing infrastructure) - rust-lang/rust#143905 (Recover and suggest to use `;` to construct array type) - rust-lang/rust#143907 (core: make `str::split_at_unchecked()` inline) - rust-lang/rust#143910 (Add experimental `backtrace-trace-only` std feature) - rust-lang/rust#143927 (Preserve constness in trait objects up to hir ty lowering) - rust-lang/rust#143935 (rustc_type_ir/walk: move docstring to `TypeWalker` itself) - rust-lang/rust#143938 (Update books) - rust-lang/rust#143941 (update `cfg_select!` documentation) Failed merges: - rust-lang/rust#143926 (Remove deprecated fields in bootstrap) r? `@ghost` `@rustbot` modify labels: rollup
2025-07-15Rollup merge of #143941 - folkertdev:cfg-select-docs, r=traviscrossSamuel Tardieu-15/+17
update `cfg_select!` documentation tracking issue: https://github.com/rust-lang/rust/issues/115585 After rust-lang/rust#143461, and with an eye on a soon(ish) stabilization, I think the docs need some work. The existing text read more like a motivation for the feature existing to me, so I've tried to now be a bit more descriptive. Still, suggestions are very welcome. I also added a test for an empty `select! {}` because it's just the sort of thing that might break. r? ``@traviscross``
2025-07-15Rollup merge of #143935 - ada4a:walk-docstring, r=compiler-errorsSamuel Tardieu-6/+6
rustc_type_ir/walk: move docstring to `TypeWalker` itself having it on the impl block is a bit weird imo
2025-07-15Rollup merge of #143927 - oli-obk:const-dyn-trait-hir-ty, r=fmeaseSamuel Tardieu-1/+1
Preserve constness in trait objects up to hir ty lowering r? ``@compiler-errors`` While we don't support `dyn const Trait`, we can at least also inform the user that `const Trait` is only legal for `#[const_trait] trait Trait {}`
2025-07-15Rollup merge of #143905 - xizheyin:143828, r=compiler-errorsSamuel Tardieu-2/+57
Recover and suggest to use `;` to construct array type Fixes rust-lang/rust#143828 r? compiler
2025-07-15Rollup merge of #143878 - JonathanBrouwer:pointee_parser, r=jdonszelmannSamuel Tardieu-3/+16
Port `#[pointee]` to the new attribute parsing infrastructure Ports `#[pointee]` to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971351163 r? ``@jdonszelmann``
2025-07-15Rollup merge of #143736 - oli-obk:uninspectable-type-id, r=RalfJungSamuel Tardieu-31/+37
Give all bytes of TypeId provenance This makes all bytes of TypeId uninspectable at compile-time. For context see https://github.com/rust-lang/rust/issues/77125#issuecomment-3057049217 r? ``@RalfJung``
2025-07-15New example for E0536Jonathan Brouwer-9/+7
2025-07-15Changes to diagnosticsJonathan Brouwer-1/+7
2025-07-15Define attribute parser & config evaluatorJonathan Brouwer-264/+325
2025-07-15Move `cfg` -> `cfg_old`Jonathan Brouwer-1/+250
2025-07-15Allow `Early` stage to emit errorsJonathan Brouwer-18/+93
2025-07-15Define datastructures for `#[cfg]` attribute, move StrippedCfgItemJonathan Brouwer-31/+53
2025-07-15Recover and suggest use `;` to construct array typexizheyin-2/+57
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-07-14Port `#[pointee]` to the new attribute parsing infrastructureJonathan Brouwer-3/+16
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>