Skip to content

Rollup of 11 pull requests #139761

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

Closed
wants to merge 33 commits into from
Closed

Conversation

jhpratt
Copy link
Member

@jhpratt jhpratt commented Apr 13, 2025

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

xizheyin and others added 30 commits March 26, 2025 11:29
Normalization can fail from errors from other items so use a delayed
bug instead of checking the body.
…ross35,RalfJung,WaffleLapkin

Initial `UnsafePinned` implementation [Part 1: Libs]

Initial libs changes necessary to unblock further work on [RFC 3467](https://rust-lang.github.io/rfcs/3467-unsafe-pinned.html).
Tracking issue: rust-lang#125735

This PR is split off from rust-lang#136964, and includes just the libs changes:
- `UnsafePinned` struct
- private `UnsafeUnpin` structural auto trait
- Lang items for both
- Compiler changes necessary to block niches on `UnsafePinned`

This PR does not change codegen, miri, the existing `!Unpin` hack, or anything else. That work is to be split into later PRs.

---

cc `@RalfJung` `@Noratrieb`

`@rustbot` label F-unsafe_pinned T-libs-api
…errors

Expect an array when expected and acutal types are both arrays during cast

Closes rust-lang#138836
…bi, r=traviscross,compiler-errors

add `naked_functions_rustic_abi` feature gate

tracking issue: rust-lang#138997

Because the details of the rust abi are unstable, and a naked function must match its stated ABI, this feature gate keeps naked functions with a rustic abi ("Rust", "rust-cold", "rust-call" and "rust-intrinsic") unstable.

r? ```@traviscross```
…ion, r=compiler-errors

Use delayed bug for normalization errors in drop elaboration

Normalization can fail due to a lot of different earlier errors, so just use span_delayed_bug if normalization failed.

Closes rust-lang#137287
Closes rust-lang#135668

r? compiler-errors
…ler-errors

Various coercion cleanups

I think the commit order is the most reasonable one, but there's probably more ways to get to the same goal.

Essentially I got rid of the `simple` and `identity` helpers by adding a dedicated function for the common `identity` case and getting rid of the callbacks alltogether by realizing that all callbacks were of the pattern "use this fixed prefix list of adjustments, then add another adjustment with the unified type as the target type".

No behavioral changes intended
…rrors

Suggest remove redundant `$()?` around `vis`

Resolves: rust-lang#139480 .
…plify/simplify_primitive_clone, r=compiler-errors

Micro-optimize `InstSimplify`'s `simplify_primitive_clone`

r? ```@compiler-errors``` , since you already did rust-lang#139411 and got randomly selected for rust-lang#139638 (feel free to reassign!)

Another one similar in spirit to rust-lang#139411, but this time for `simplify_primitive_clone`, which is doing a bit of redundant work. Might not show up in benches, but probably worth micro-optimizing since the transformation is run even for debug builds.

See inline comments for my reasoning for making these changes.
Proc macro span API redesign: Replace proc_macro::SourceFile by Span::{file, local_file}

Simplification/redesign of the unstable proc macro span API, tracked in rust-lang#54725:

Before:

```rust
impl Span {
    pub fn line(&self) -> usize;
    pub fn column(&self) -> usize;
    pub fn source_file(&self) -> SourceFile;
}

#[derive(Clone, Debug, PartialEq, Eq)]
pub struct SourceFile { .. }

impl !Send for SourceFile {}
impl !Sync for SourceFile {}

impl SourceFile {
    pub fn path(&self) -> PathBuf;
    pub fn is_real(&self) -> bool;
}
```

After:

```rust
impl Span {
    pub fn line(&self) -> usize;
    pub fn column(&self) -> usize;
    pub fn file(&self) -> String; // Mapped file name, for display purposes.
    pub fn local_file(&self) -> Option<PathBuf>; // Real file name as it exists on disk.
}
```

This resolves the last blocker for stabilizing these methods. (Stabilizing will be a separate PR with FCP.)
jhpratt added 3 commits April 13, 2025 15:31
…terators, r=compiler-errors

In `rustc_mir_transform`, iterate over index newtypes instead of ints

Just makes code more idiomatic/easier to read, IMHO.
Also, some drive-by simplifications and cleanups.
Convert `tests/ui/lint/dead-code/self-assign.rs` to a known-bug test

I did a survey pass over `tests/`, and this test seems like the only candidate suitable for conversion into a known-bug test. (Other tests had varying degrees of other issues that known-bug would not be suitable.)

r? compiler
fix smir's run! doc and import

This PR
* adds missing `extern crate rustc_middle` in `rustc_smir::run!` docstring
* adds missing `use rustc_smir::rustc_internal` in `run_driver!` scope
  * also adjust some tests that don't need to import rustc_internalany more
@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. 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 Apr 13, 2025
@jhpratt
Copy link
Member Author

jhpratt commented Apr 13, 2025

@bors r+ rollup=never p=5

@bors
Copy link
Collaborator

bors commented Apr 13, 2025

📌 Commit d454788 has been approved by jhpratt

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 Apr 13, 2025
@bors
Copy link
Collaborator

bors commented Apr 13, 2025

⌛ Testing commit d454788 with merge 4a9013e...

bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 13, 2025
Rollup of 11 pull requests

Successful merges:

 - rust-lang#137043 (Initial `UnsafePinned` implementation [Part 1: Libs])
 - rust-lang#138962 (Expect an array when expected and acutal types are both arrays during cast)
 - rust-lang#139001 (add `naked_functions_rustic_abi` feature gate)
 - rust-lang#139379 (Use delayed bug for normalization errors in drop elaboration)
 - rust-lang#139582 (Various coercion cleanups)
 - rust-lang#139628 (Suggest remove redundant `$()?` around `vis`)
 - rust-lang#139644 (Micro-optimize `InstSimplify`'s `simplify_primitive_clone`)
 - rust-lang#139671 (Proc macro span API redesign: Replace proc_macro::SourceFile by Span::{file, local_file})
 - rust-lang#139674 (In `rustc_mir_transform`, iterate over index newtypes instead of ints)
 - rust-lang#139740 (Convert `tests/ui/lint/dead-code/self-assign.rs` to a known-bug test)
 - rust-lang#139741 (fix smir's run! doc and import)

r? `@ghost`
`@rustbot` modify labels: rollup
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-19-3 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
stack backtrace:
   0: __rustc::rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::panic
   3: <proc_macro::bridge::api_tags::Method as proc_macro::bridge::rpc::DecodeMut<()>>::decode
   4: <proc_macro::bridge::server::Dispatcher<proc_macro::bridge::server::MarkedTypes<proc_macro_srv::server_impl::token_id::TokenIdServer>> as proc_macro::bridge::server::DispatcherTrait>::dispatch
   5: <proc_macro::bridge::closure::Closure<_, _> as core::convert::From<&mut _>>::from::call::<proc_macro::bridge::buffer::Buffer, proc_macro::bridge::buffer::Buffer, <proc_macro::bridge::server::SameThread as proc_macro::bridge::server::ExecutionStrategy>::run_bridge_and_client<proc_macro::bridge::server::Dispatcher<proc_macro::bridge::server::MarkedTypes<proc_macro_srv::server_impl::token_id::TokenIdServer>>>::{closure#0}>
   6: proc_macro::bridge::closure::Closure<A,R>::call
             at /rustc/45165c82a4c5315ff52c391ad138f41ff40b52d8/library/proc_macro/src/bridge/closure.rs:30:18
   7: proc_macro::bridge::client::Span::join::{{closure}}
             at /rustc/45165c82a4c5315ff52c391ad138f41ff40b52d8/library/proc_macro/src/bridge/client.rs:155:43
   8: proc_macro::bridge::client::Bridge::with::{{closure}}
             at /rustc/45165c82a4c5315ff52c391ad138f41ff40b52d8/library/proc_macro/src/bridge/client.rs:233:13
---
  13: proc_macro_test_impl::fn_like_span_join
             at /checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools/x86_64-unknown-linux-gnu/release/build/proc-macro-test-f26e2e3ee522daca/out/proc-macro-test-imp-staging/src/lib.rs:60:9
  14: core::ops::function::Fn::call
             at /rustc/45165c82a4c5315ff52c391ad138f41ff40b52d8/library/core/src/ops/function.rs:79:5
  15: proc_macro::bridge::client::Client<proc_macro::TokenStream,proc_macro::TokenStream>::expand1::{{closure}}::{{closure}}
             at /rustc/45165c82a4c5315ff52c391ad138f41ff40b52d8/library/proc_macro/src/bridge/client.rs:342:44
  16: proc_macro::bridge::client::run_client::{{closure}}::{{closure}}
             at /rustc/45165c82a4c5315ff52c391ad138f41ff40b52d8/library/proc_macro/src/bridge/client.rs:308:44
  17: proc_macro::bridge::client::state::set
             at /rustc/45165c82a4c5315ff52c391ad138f41ff40b52d8/library/proc_macro/src/bridge/client.rs:207:9
  18: proc_macro::bridge::client::run_client::{{closure}}
             at /rustc/45165c82a4c5315ff52c391ad138f41ff40b52d8/library/proc_macro/src/bridge/client.rs:308:22
  19: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/45165c82a4c5315ff52c391ad138f41ff40b52d8/library/core/src/panic/unwind_safe.rs:272:9
  20: std::panicking::try::do_call
             at /rustc/45165c82a4c5315ff52c391ad138f41ff40b52d8/library/std/src/panicking.rs:589:40
  21: __rust_try
  22: std::panicking::try
             at /rustc/45165c82a4c5315ff52c391ad138f41ff40b52d8/library/std/src/panicking.rs:552:19
  23: std::panic::catch_unwind
             at /rustc/45165c82a4c5315ff52c391ad138f41ff40b52d8/library/std/src/panic.rs:359:14
  24: proc_macro::bridge::client::run_client
             at /rustc/45165c82a4c5315ff52c391ad138f41ff40b52d8/library/proc_macro/src/bridge/client.rs:296:5
  25: proc_macro::bridge::client::Client<proc_macro::TokenStream,proc_macro::TokenStream>::expand1::{{closure}}
             at /rustc/45165c82a4c5315ff52c391ad138f41ff40b52d8/library/proc_macro/src/bridge/client.rs:342:17
  26: proc_macro::bridge::selfless_reify::reify_to_extern_c_fn_hrt_bridge::wrapper
             at /rustc/45165c82a4c5315ff52c391ad138f41ff40b52d8/library/proc_macro/src/bridge/selfless_reify.rs:64:17
  27: proc_macro::bridge::server::run_server::<proc_macro_srv::server_impl::token_id::TokenIdServer, proc_macro::bridge::Marked<proc_macro_srv::server_impl::token_stream::TokenStream<span::TokenId>, proc_macro::bridge::client::TokenStream>, core::option::Option<proc_macro::bridge::Marked<proc_macro_srv::server_impl::token_stream::TokenStream<span::TokenId>, proc_macro::bridge::client::TokenStream>>, proc_macro::bridge::server::SameThread>
  28: <proc_macro::bridge::client::Client<proc_macro::TokenStream, proc_macro::TokenStream>>::run::<proc_macro_srv::server_impl::token_id::TokenIdServer, proc_macro::bridge::server::SameThread>
  29: <proc_macro_srv::dylib::Expander>::expand::<span::TokenId>
  30: proc_macro_srv::tests::utils::assert_expand_impl
  31: proc_macro_srv::tests::test_fn_like_fn_like_span_join
  32: <proc_macro_srv::tests::test_fn_like_fn_like_span_join::{closure#0} as core::ops::function::FnOnce<()>>::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

thread 'tests::test_fn_like_fn_like_span_join' panicked at library/core/src/panicking.rs:218:5:
panic in a function that cannot unwind
stack backtrace:
---
   6:     0x555e818e018a - test::test_main::{{closure}}::h1643975135fdff0f
   7:     0x7efce6b3e052 - std::panicking::rust_panic_with_hook::h20d2932781830898
   8:     0x7efce6b3dc59 - std::panicking::begin_panic_handler::{{closure}}::h8cfa6487ba145c62
   9:     0x7efce6b398c9 - std::sys::backtrace::__rust_end_short_backtrace::h8b4d320fd85a0f41
  10:     0x7efce6b3d896 - __rustc[ec7fb6ce294bfd5b]::rust_begin_unwind
  11:     0x7efce27d637d - core::panicking::panic_nounwind_fmt::hc97dc8d10c7495c3
  12:     0x7efce27d642b - core::panicking::panic_nounwind::h4e94e333a1c10f21
  13:     0x7efce27d6612 - core::panicking::panic_cannot_unwind::hb3bed0ba91dbde16
  14:     0x555e8188ddd2 - <proc_macro[b2367ea8ad1a98d1]::bridge::closure::Closure<_, _> as core[7cbf36d1a8e6186a]::convert::From<&mut _>>::from::call::<proc_macro[b2367ea8ad1a98d1]::bridge::buffer::Buffer, proc_macro[b2367ea8ad1a98d1]::bridge::buffer::Buffer, <proc_macro[b2367ea8ad1a98d1]::bridge::server::SameThread as proc_macro[b2367ea8ad1a98d1]::bridge::server::ExecutionStrategy>::run_bridge_and_client<proc_macro[b2367ea8ad1a98d1]::bridge::server::Dispatcher<proc_macro[b2367ea8ad1a98d1]::bridge::server::MarkedTypes<proc_macro_srv[b5d8c060c24fe26a]::server_impl::token_id::TokenIdServer>>>::{closure#0}>
  15:     0x7efcd791f385 - proc_macro::bridge::closure::Closure<A,R>::call::h87b0da13c0fac538
                               at /rustc/45165c82a4c5315ff52c391ad138f41ff40b52d8/library/proc_macro/src/bridge/closure.rs:30:18
  16:     0x7efcd791f385 - proc_macro::bridge::client::Span::join::{{closure}}::h811f422612923b70
                               at /rustc/45165c82a4c5315ff52c391ad138f41ff40b52d8/library/proc_macro/src/bridge/client.rs:155:43
  17:     0x7efcd791f385 - proc_macro::bridge::client::Bridge::with::{{closure}}::hbe328bab646e9b49
                               at /rustc/45165c82a4c5315ff52c391ad138f41ff40b52d8/library/proc_macro/src/bridge/client.rs:233:13
---
  22:     0x7efcd7914d1d - proc_macro_test_impl::fn_like_span_join::h0531cde72e28e7a5
                               at /checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools/x86_64-unknown-linux-gnu/release/build/proc-macro-test-f26e2e3ee522daca/out/proc-macro-test-imp-staging/src/lib.rs:60:9
  23:     0x7efcd7917886 - core::ops::function::Fn::call::hc014b0fcf4911d89
                               at /rustc/45165c82a4c5315ff52c391ad138f41ff40b52d8/library/core/src/ops/function.rs:79:5
  24:     0x7efcd791061a - proc_macro::bridge::client::Client<proc_macro::TokenStream,proc_macro::TokenStream>::expand1::{{closure}}::{{closure}}::h622cf6f28a07e63a
                               at /rustc/45165c82a4c5315ff52c391ad138f41ff40b52d8/library/proc_macro/src/bridge/client.rs:342:44
  25:     0x7efcd79102e2 - proc_macro::bridge::client::run_client::{{closure}}::{{closure}}::hd3c6b467d24aa5b3
                               at /rustc/45165c82a4c5315ff52c391ad138f41ff40b52d8/library/proc_macro/src/bridge/client.rs:308:44
  26:     0x7efcd7911a25 - proc_macro::bridge::client::state::set::h933d41c5ce16cb16
                               at /rustc/45165c82a4c5315ff52c391ad138f41ff40b52d8/library/proc_macro/src/bridge/client.rs:207:9
  27:     0x7efcd790c9cd - proc_macro::bridge::client::run_client::{{closure}}::h3a7891296847551b
                               at /rustc/45165c82a4c5315ff52c391ad138f41ff40b52d8/library/proc_macro/src/bridge/client.rs:308:22
  28:     0x7efcd79120c0 - <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::hb20ff04c04082416
                               at /rustc/45165c82a4c5315ff52c391ad138f41ff40b52d8/library/core/src/panic/unwind_safe.rs:272:9
  29:     0x7efcd7912a8b - std::panicking::try::do_call::h60a5e8d5a55710a0
                               at /rustc/45165c82a4c5315ff52c391ad138f41ff40b52d8/library/std/src/panicking.rs:589:40
  30:     0x7efcd79108bb - __rust_try
  31:     0x7efcd790c0fb - std::panicking::try::h6cb9bfc1ffeb9050
                               at /rustc/45165c82a4c5315ff52c391ad138f41ff40b52d8/library/std/src/panicking.rs:552:19
  32:     0x7efcd790c0fb - std::panic::catch_unwind::h69fb93f2c580dc93
                               at /rustc/45165c82a4c5315ff52c391ad138f41ff40b52d8/library/std/src/panic.rs:359:14
  33:     0x7efcd790c0fb - proc_macro::bridge::client::run_client::hfdbb61ce7e566163
                               at /rustc/45165c82a4c5315ff52c391ad138f41ff40b52d8/library/proc_macro/src/bridge/client.rs:296:5
  34:     0x7efcd7910521 - proc_macro::bridge::client::Client<proc_macro::TokenStream,proc_macro::TokenStream>::expand1::{{closure}}::h91a699433dddc7ff
                               at /rustc/45165c82a4c5315ff52c391ad138f41ff40b52d8/library/proc_macro/src/bridge/client.rs:342:17
  35:     0x7efcd7916aa2 - proc_macro::bridge::selfless_reify::reify_to_extern_c_fn_hrt_bridge::wrapper::hf8e9ebf09fa9c552
                               at /rustc/45165c82a4c5315ff52c391ad138f41ff40b52d8/library/proc_macro/src/bridge/selfless_reify.rs:64:17
  36:     0x555e81850b5e - proc_macro[b2367ea8ad1a98d1]::bridge::server::run_server::<proc_macro_srv[b5d8c060c24fe26a]::server_impl::token_id::TokenIdServer, proc_macro[b2367ea8ad1a98d1]::bridge::Marked<proc_macro_srv[b5d8c060c24fe26a]::server_impl::token_stream::TokenStream<span[9640d89ad1c9b132]::TokenId>, proc_macro[b2367ea8ad1a98d1]::bridge::client::TokenStream>, core[7cbf36d1a8e6186a]::option::Option<proc_macro[b2367ea8ad1a98d1]::bridge::Marked<proc_macro_srv[b5d8c060c24fe26a]::server_impl::token_stream::TokenStream<span[9640d89ad1c9b132]::TokenId>, proc_macro[b2367ea8ad1a98d1]::bridge::client::TokenStream>>, proc_macro[b2367ea8ad1a98d1]::bridge::server::SameThread>
  37:     0x555e8186f42d - <proc_macro[b2367ea8ad1a98d1]::bridge::client::Client<proc_macro[b2367ea8ad1a98d1]::TokenStream, proc_macro[b2367ea8ad1a98d1]::TokenStream>>::run::<proc_macro_srv[b5d8c060c24fe26a]::server_impl::token_id::TokenIdServer, proc_macro[b2367ea8ad1a98d1]::bridge::server::SameThread>
  38:     0x555e8186e8e9 - <proc_macro_srv[b5d8c060c24fe26a]::dylib::Expander>::expand::<span[9640d89ad1c9b132]::TokenId>
  39:     0x555e818907a3 - proc_macro_srv[b5d8c060c24fe26a]::tests::utils::assert_expand_impl
  40:     0x555e8185b5e6 - proc_macro_srv[b5d8c060c24fe26a]::tests::test_fn_like_fn_like_span_join
  41:     0x555e818995a9 - <proc_macro_srv[b5d8c060c24fe26a]::tests::test_fn_like_fn_like_span_join::{closure#0} as core[7cbf36d1a8e6186a]::ops::function::FnOnce<()>>::call_once
  42:     0x555e818e58fb - test::__rust_begin_short_backtrace::hd287ed22ef0b2e2f
  43:     0x555e818e4768 - test::run_test::{{closure}}::hfff89a49c8c0055a
  44:     0x555e8189da1a - std::sys::backtrace::__rust_begin_short_backtrace::hda0b015fa30e4033
  45:     0x555e818a1fb3 - core::ops::function::FnOnce::call_once{{vtable.shim}}::hc12c6d9a97d6205a
  46:     0x7efce6b42735 - std::sys::pal::unix::thread::Thread::new::thread_start::h32180ed127b64731
  47:     0x7efce1a81e2e - <unknown>
  48:     0x7efce1b13a4c - <unknown>
  49:                0x0 - <unknown>
thread caused non-unwinding panic. aborting.
error: test failed, to rerun pass `--lib`

Caused by:
  process didn't exit successfully: `/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools/x86_64-unknown-linux-gnu/release/deps/proc_macro_srv-d4ff234b5ff8536e -Z unstable-options --format json` (signal: 6, SIGABRT: process abort signal)
Build completed unsuccessfully in 1:24:41
  local time: Sun Apr 13 21:35:04 UTC 2025
  network time: Sun, 13 Apr 2025 21:35:04 GMT
##[error]Process completed with exit code 1.
Post job cleanup.

@bors
Copy link
Collaborator

bors commented Apr 13, 2025

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Apr 13, 2025
@jhpratt jhpratt closed this Apr 13, 2025
@jhpratt jhpratt deleted the rollup-tki77or branch April 13, 2025 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) rollup A PR which is a rollup S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. 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.