Skip to content

Rollup of 12 pull requests #144876

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 29 commits into from
Aug 4, 2025
Merged

Rollup of 12 pull requests #144876

merged 29 commits into from
Aug 4, 2025

Conversation

Zalathar
Copy link
Contributor

@Zalathar Zalathar commented Aug 4, 2025

Successful merges:

Failed merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

paolobarbolini and others added 29 commits June 8, 2025 18:16
Let's wait with lldb testing until the test works properly with gdb.
Since it's cfg'd instead of type-aliased
Do not write dummy bindings to extern prelude.
Use more precise `Used::Scope` while recording use and remove now redundant `introduced_by_item` check.
Replace commented-out code with link to context for change.

Co-authored-by: Ralf Jung <post@ralfj.de>
Testing ui-fulldeps in "stage 1" actually uses the stage 0 compiler, so that
test programs can link against stage 1 rustc crates.

Unfortunately, using the stage 0 compiler causes problems when compiletest
tries to obtain target information from the compiler, but the output format has
changed since the last bootstrap beta bump.

We can work around this by also providing compiletest with a stage 1 compiler,
and having it use that compiler to query for target information.
…ce-impl, r=Mark-Simulacrum

Mark `slice::swap_with_slice` unstably const

Tracking issue rust-lang#142204
…, r=Mark-Simulacrum

`available_parallelism`: Add documentation for why we don't look at `ulimit`
…oli-obk

Add lint against dangling pointers from local variables

## `dangling_pointers_from_locals`

*warn-by-default*

The `dangling_pointers_from_locals` lint detects getting a pointer to data of a local that will be dropped at the end of the function.

### Example

```rust
fn f() -> *const u8 {
    let x = 0;
    &x // returns a dangling ptr to `x`
}
```

```text
warning: a dangling pointer will be produced because the local variable `x` will be dropped
  --> $DIR/dangling-pointers-from-locals.rs:10:5
   |
LL | fn simple() -> *const u8 {
   |                --------- return type of the function is `*const u8`
LL |     let x = 0;
   |         - `x` is defined inside the function and will be drop at the end of the function
LL |     &x
   |     ^^
   |
   = note: pointers do not have a lifetime; after returning, the `u8` will be deallocated at the end of the function because nothing is referencing it as far as the type system is concerned
   = note: `#[warn(dangling_pointers_from_locals)]` on by default
```

### Explanation

Returning a pointer from a local value will not prolong its lifetime, which means that the value can be dropped and the allocation freed while the pointer still exists, making the pointer dangling.

If you need stronger guarantees, consider using references instead, as they are statically verified by the borrow-checker to never dangle.

------

This is related to GitHub codeql [CWE-825](https://github.com/github/codeql/blob/main/rust/ql/src/queries/security/CWE-825/AccessAfterLifetimeBad.rs) which shows examples of such simple miss-use.

It should be noted that C compilers warns against such patterns even without `-Wall`, https://godbolt.org/z/P7z98arrc.

------

`@rustbot` labels +I-lang-nominated +T-lang
cc `@traviscross`
r? compiler
…ulacrum

tests: Add test for basic line-by-line stepping in a debugger

Let's wait with lldb testing until the test works properly with gdb.

This is a regression test to prevent further regressions of rust-lang#33013 which unfortunately regressed in **nightly-2023-04-24**. See rust-lang#33013 (comment).
… r=Mark-Simulacrum

Enable extract-insert-dyn.rs test on RISC-V (riscv64)

This PR adds support for running the `tests/codegen-llvm/simd/extract-insert-dyn.rs` test on the RISC-V (riscv64) architecture.

Previously, this test would fail on RISC-V targets due to architecture-specific code generation issues. This patch modifies the test to ensure compatibility while preserving its intent.

The change has been tested locally using `./x test` on a riscv64 target, and the test now passes as expected.

### Notes:
- This change is scoped specifically to improve RISC-V compatibility.
- It does not affect behavior or test results on other architectures.
…oss35

`AlignmentEnum` should just be `repr(usize)` now

These used to use specific sizes because they were compiled on all widths.  But now that the types themselves are `#[cfg]`'d, we can save some conversions by having it always be `repr(usize)`.
Do not give function allocations alignment in consteval and Miri.

We do not yet have a (clear and T-lang approved) design for how `#[align(N)]` on functions should affect function pointers' addresses on various platforms, so for now do not give function pointers alignment in consteval and Miri.

----

Old summary:

Not a full solution to <rust-lang#144661>, but fixes the immediate issue by making function allocations all have alignment 1 in consteval, ignoring `#[rustc_align(N)]`, so the compiler doesn't know if any offset other than 0 is non-null.

A more "principlied" solution would probably be to make function pointers to `#[instruction_set(arm::t32)]` functions be at offset 1 of an align-`max(2, align attribute)` allocation instead of at offset 0 of their allocation during consteval, and on wasm to either disallow `#[align(N)]` where N > 1, or to pad the function table such that the function pointer of a `#[align(N)]` function is a multiple of `N` at runtime.
resolve: Cleanups and micro-optimizations to extern prelude

This is what can be done without changing the structure of `ExternPreludeEntry`, like in rust-lang#144737.

See individual commits for details.
Regression test for LLVM error with unsupported expression in static initializer for const pointer in array on macOS.

Regression test for rust-lang#89225, I have shortened the original example as much as i could, while still generating the error.

here is my output on MacOs:
```
rustup run 1.60 cargo build --release
   Compiling rug_int v0.1.0 (/Users/luca/dev/rug_int)
LLVM ERROR: Unsupported expression in static initializer: zext (i64 ptrtoint (<{ [4 x i8] }>* `@anon.fad58de7366495db4650cfefac2fcd61.0` to i64) to i128)
error: could not compile `rug_int`

rustup run 1.61 cargo build --release
   Compiling rug_int v0.1.0 (/Users/luca/dev/rug_int)
    Finished release [optimized] target(s) in 0.60s
```
…=Noratrieb

Stylize `*-lynxos178-*` target maintainer handle to make it easier to copy/paste

Apparently I forgot to submit this branch I had lying around.

Noticed while reviewing Tier 3 target platform support pages. In the same style as rust-lang#139028.
For "stage 1" ui-fulldeps, use the stage 1 compiler to query target info

Testing ui-fulldeps in "stage 1" actually uses the stage 0 compiler, so that test programs can link against stage 1 rustc crates.

Unfortunately, using the stage 0 compiler causes problems when compiletest tries to obtain target information from the compiler, but the output format has changed since the last bootstrap beta bump.

We can work around this by also providing compiletest with a stage 1 compiler, and having it use that compiler to query for target information.

---

This fixes the stage 1 ui-fulldeps failure seen at rust-lang#144443 (comment).
…lacrum

Remove unnecessary `rust_` prefixes

part of rust-lang#116005

Honestly, not sure if this can affect linking somehow, also I didn't touched things like `__rust_panic_cleanup` and `__rust_start_panic` which very likely will break something, so just small cleanup here

also didn't changed `rust_panic_without_hook` because it was renamed here rust-lang#144852

r? libs
@rustbot rustbot added the A-compiletest Area: The compiletest test runner label Aug 4, 2025
@rustbot rustbot added A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. rollup A PR which is a rollup labels Aug 4, 2025
@Zalathar
Copy link
Contributor Author

Zalathar commented Aug 4, 2025

@bors r+ rollup=never p=5

@bors
Copy link
Collaborator

bors commented Aug 4, 2025

📌 Commit 7fbb303 has been approved by Zalathar

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 4, 2025
@bors
Copy link
Collaborator

bors commented Aug 4, 2025

⌛ Testing commit 7fbb303 with merge 07b7dc9...

@bors
Copy link
Collaborator

bors commented Aug 4, 2025

☀️ Test successful - checks-actions
Approved by: Zalathar
Pushing 07b7dc9 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Aug 4, 2025
@bors bors merged commit 07b7dc9 into rust-lang:master Aug 4, 2025
11 checks passed
@rustbot rustbot added this to the 1.91.0 milestone Aug 4, 2025
@Zalathar Zalathar deleted the rollup-jhv9rir branch August 4, 2025 04:41
Copy link
Contributor

github-actions bot commented Aug 4, 2025

What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing 383b9c4 (parent) -> 07b7dc9 (this PR)

Test differences

Show 256 test diffs

Stage 1

  • lints::verify_lint_ambiguous_glob_reexport_144: pass -> [missing] (J0)
  • lints::verify_lint_ambiguous_glob_reexport_145: [missing] -> pass (J0)
  • lints::verify_lint_associated_const_elided_lifetime_149: [missing] -> pass (J0)
  • lints::verify_lint_atomic_ordering_fence_93: pass -> [missing] (J0)
  • lints::verify_lint_atomic_ordering_fence_94: [missing] -> pass (J0)
  • lints::verify_lint_atomic_ordering_invalid_94: pass -> [missing] (J0)
  • lints::verify_lint_atomic_ordering_invalid_95: [missing] -> pass (J0)
  • lints::verify_lint_atomic_ordering_load_91: pass -> [missing] (J0)
  • lints::verify_lint_atomic_ordering_load_92: [missing] -> pass (J0)
  • lints::verify_lint_atomic_ordering_store_92: pass -> [missing] (J0)
  • lints::verify_lint_atomic_ordering_store_93: [missing] -> pass (J0)
  • lints::verify_lint_avoid_att_syntax_116: [missing] -> pass (J0)
  • lints::verify_lint_avoid_intel_syntax_115: [missing] -> pass (J0)
  • lints::verify_lint_byte_slice_in_packed_struct_with_derive_141: pass -> [missing] (J0)
  • lints::verify_lint_byte_slice_in_packed_struct_with_derive_142: [missing] -> pass (J0)
  • lints::verify_lint_confusable_identifier_pair_76: pass -> [missing] (J0)
  • lints::verify_lint_confusable_identifier_pair_77: [missing] -> pass (J0)
  • lints::verify_lint_custom_inner_attribute_unstable_128: [missing] -> pass (J0)
  • lints::verify_lint_dangling_pointers_from_locals_73: [missing] -> pass (J0)
  • lints::verify_lint_duplicate_macro_attribute_118: pass -> [missing] (J0)
  • lints::verify_lint_duplicate_matcher_binding_122: pass -> [missing] (J0)
  • lints::verify_lint_extern_crate_not_idiomatic_143: pass -> [missing] (J0)
  • lints::verify_lint_extern_crate_not_idiomatic_144: [missing] -> pass (J0)
  • lints::verify_lint_hidden_glob_reexport_145: pass -> [missing] (J0)
  • lints::verify_lint_identifier_non_ascii_char_74: pass -> [missing] (J0)
  • lints::verify_lint_identifier_uncommon_codepoints_76: [missing] -> pass (J0)
  • lints::verify_lint_ill_formed_attribute_input_125: pass -> [missing] (J0)
  • lints::verify_lint_ill_formed_attribute_input_126: [missing] -> pass (J0)
  • lints::verify_lint_incomplete_include_116: pass -> [missing] (J0)
  • lints::verify_lint_incomplete_include_117: [missing] -> pass (J0)
  • lints::verify_lint_inner_macro_attribute_unstable_126: pass -> [missing] (J0)
  • lints::verify_lint_inner_macro_attribute_unstable_127: [missing] -> pass (J0)
  • lints::verify_lint_invalid_asm_label_binary_106: [missing] -> pass (J0)
  • lints::verify_lint_legacy_derive_helpers_132: pass -> [missing] (J0)
  • lints::verify_lint_macro_is_private_112: [missing] -> pass (J0)
  • lints::verify_lint_macro_rule_never_used_114: [missing] -> pass (J0)
  • lints::verify_lint_macro_use_deprecated_107: pass -> [missing] (J0)
  • lints::verify_lint_missing_unsafe_on_extern_138: pass -> [missing] (J0)
  • lints::verify_lint_mixed_script_confusables_77: pass -> [missing] (J0)
  • lints::verify_lint_mixed_script_confusables_78: [missing] -> pass (J0)
  • lints::verify_lint_multiple_supertrait_upcastable_74: [missing] -> pass (J0)
  • lints::verify_lint_non_fmt_panic_braces_78: pass -> [missing] (J0)
  • lints::verify_lint_non_fmt_panic_braces_79: [missing] -> pass (J0)
  • lints::verify_lint_noop_method_call_80: [missing] -> pass (J0)
  • lints::verify_lint_only_cast_u8_to_char_83: pass -> [missing] (J0)
  • lints::verify_lint_only_cast_u8_to_char_84: [missing] -> pass (J0)
  • lints::verify_lint_out_of_scope_macro_calls_150: pass -> [missing] (J0)
  • lints::verify_lint_overflowing_literal_86: [missing] -> pass (J0)
  • lints::verify_lint_overflowing_uint_84: pass -> [missing] (J0)
  • lints::verify_lint_overflowing_uint_85: [missing] -> pass (J0)
  • lints::verify_lint_pass_by_value_83: [missing] -> pass (J0)
  • lints::verify_lint_path_statement_no_effect_99: [missing] -> pass (J0)
  • lints::verify_lint_private_extern_crate_reexport_110: [missing] -> pass (J0)
  • lints::verify_lint_proc_macro_derive_resolution_fallback_128: pass -> [missing] (J0)
  • lints::verify_lint_proc_macro_derive_resolution_fallback_129: [missing] -> pass (J0)
  • lints::verify_lint_raw_prefix_136: [missing] -> pass (J0)
  • lints::verify_lint_reexport_private_dependency_146: pass -> [missing] (J0)
  • lints::verify_lint_reexport_private_dependency_147: [missing] -> pass (J0)
  • lints::verify_lint_reserved_multihash_154: [missing] -> pass (J0)
  • lints::verify_lint_reserved_prefix_135: [missing] -> pass (J0)
  • lints::verify_lint_reserved_string_152: pass -> [missing] (J0)
  • lints::verify_lint_reserved_string_153: [missing] -> pass (J0)
  • lints::verify_lint_suspicious_double_ref_clone_82: [missing] -> pass (J0)
  • lints::verify_lint_suspicious_double_ref_deref_81: [missing] -> pass (J0)
  • lints::verify_lint_too_large_char_cast_87: pass -> [missing] (J0)
  • lints::verify_lint_trailing_semi_macro_138: [missing] -> pass (J0)
  • lints::verify_lint_unexpected_builtin_cfg_106: pass -> [missing] (J0)
  • lints::verify_lint_unit_bindings_102: pass -> [missing] (J0)
  • lints::verify_lint_unknown_macro_variable_124: [missing] -> pass (J0)
  • lints::verify_lint_unnecessary_qualification_147: pass -> [missing] (J0)
  • lints::verify_lint_unnecessary_qualification_148: [missing] -> pass (J0)
  • lints::verify_lint_unqualified_local_imports_151: pass -> [missing] (J0)
  • lints::verify_lint_unused_allocation_100: pass -> [missing] (J0)
  • lints::verify_lint_unused_builtin_attribute_136: pass -> [missing] (J0)
  • lints::verify_lint_unused_builtin_attribute_137: [missing] -> pass (J0)
  • lints::verify_lint_unused_closure_96: pass -> [missing] (J0)
  • lints::verify_lint_unused_closure_97: [missing] -> pass (J0)
  • lints::verify_lint_unused_comparisons_89: pass -> [missing] (J0)
  • lints::verify_lint_unused_comparisons_90: [missing] -> pass (J0)
  • lints::verify_lint_unused_coroutine_98: [missing] -> pass (J0)
  • lints::verify_lint_unused_crate_dependency_124: pass -> [missing] (J0)
  • lints::verify_lint_unused_crate_dependency_125: [missing] -> pass (J0)
  • lints::verify_lint_unused_doc_comment_131: [missing] -> pass (J0)
  • lints::verify_lint_unused_extern_crate_143: [missing] -> pass (J0)
  • lints::verify_lint_unused_import_braces_100: [missing] -> pass (J0)
  • lints::verify_lint_unused_import_braces_99: pass -> [missing] (J0)
  • lints::verify_lint_unused_label_110: pass -> [missing] (J0)
  • lints::verify_lint_unused_lifetime_140: [missing] -> pass (J0)
  • lints::verify_lint_unused_macro_definition_112: pass -> [missing] (J0)
  • lints::verify_lint_unused_macro_definition_113: [missing] -> pass (J0)
  • lints::verify_lint_unused_result_96: [missing] -> pass (J0)
  • lints::verify_lint_uses_power_alignment_88: pass -> [missing] (J0)
  • lints::verify_lint_uses_power_alignment_89: [missing] -> pass (J0)
  • lints::verify_lint_variant_size_differences_90: pass -> [missing] (J0)
  • transmute::verify_lint_undefined_transmute_154: pass -> [missing] (J0)
  • transmute::verify_lint_undefined_transmute_155: [missing] -> pass (J0)

Stage 2

  • [debuginfo-lldb] tests/debuginfo/basic-stepping.rs: [missing] -> pass (J1)
  • [debuginfo-gdb] tests/debuginfo/basic-stepping.rs: [missing] -> pass (J2)
  • [ui] tests/ui/lint/dangling-pointers-from-locals.rs: [missing] -> pass (J3)
  • [debuginfo-gdb] tests/debuginfo/basic-stepping.rs: [missing] -> ignore (ignored when the architecture is aarch64 (Doesn't work yet.)) (J4)

(and 76 additional test diffs)

Additionally, 80 doctest diffs were found. These are ignored, as they are noisy.

Job group index

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard 07b7dc90ee4df5815dbb91ef8e98cb93571230f5 --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. dist-x86_64-apple: 17812.7s -> 7661.9s (-57.0%)
  2. x86_64-apple-2: 3675.3s -> 5203.9s (41.6%)
  3. x86_64-apple-1: 6708.1s -> 8993.7s (34.1%)
  4. aarch64-apple: 4261.5s -> 4927.8s (15.6%)
  5. dist-aarch64-apple: 5943.9s -> 6834.9s (15.0%)
  6. i686-gnu-2: 5419.3s -> 6207.5s (14.5%)
  7. tidy: 119.6s -> 102.7s (-14.2%)
  8. dist-android: 2949.2s -> 2532.6s (-14.1%)
  9. dist-apple-various: 4156.7s -> 3710.1s (-10.7%)
  10. x86_64-gnu-debug: 5572.6s -> 6093.5s (9.3%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-timer
Copy link
Collaborator

📌 Perf builds for each rolled up PR:

PR# Message Perf Build Sha
#142205 Mark slice::swap_with_slice unstably const 6ac538453be6185fb147738293602a533b639d59 (link)
#144188 available_parallelism: Add documentation for why we don't… 624c99daf41accb4df3a4c4c202c8f4199fe7912 (link)
#144322 Add lint against dangling pointers from local variables c7ef7d89c8cb731de4160169cd167962a550bd0f (link)
#144497 tests: Add test for basic line-by-line stepping in a debugg… dcb0139795b1e994ea03725d572dce5314eb69de (link)
#144559 Enable extract-insert-dyn.rs test on RISC-V (riscv64) 883a130d4705d7365610da38d3b40f2a1ab7b49f (link)
#144667 AlignmentEnum should just be repr(usize) now c579470436decb60fc5394d127fc5e11fe8207cb (link)
#144706 Do not give function allocations alignment in consteval and… 5eb4cc535667de5448c6f83819641a57bf80230c (link)
#144746 resolve: Cleanups and micro-optimizations to extern prelude 9129a0227b3e35aab5db11073805ba17089b9974 (link)
#144785 Regression test for LLVM error with unsupported expression … 809168fb25189fc6f8d4920befe1a7ac7d3d07d4 (link)
#144811 Stylize *-lynxos178-* target maintainer handle to make it… 5313862734a8b515dd58a6f8fef1aedaee9c8e2b (link)
#144848 For "stage 1" ui-fulldeps, use the stage 1 compiler to quer… acda9c07d95ef6dcf1e16bad7a83e737df0e24c9 (link)
#144853 Remove unnecessary rust_ prefixes 840fe6a0db3571dc0ff4db6cfae678a77e34fa46 (link)

previous master: 383b9c447b

In the case of a perf regression, run the following command for each PR you suspect might be the cause: @rust-timer build $SHA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc merged-by-bors This PR was explicitly merged by bors. rollup A PR which is a rollup S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.