Skip to content

Conversation

@zachs18
Copy link
Contributor

@zachs18 zachs18 commented Nov 10, 2025

Allows the compiler to build with the debug_refcell stdlib cargo feature.

With rust.std-features = ["debug_refcell"] in bootstrap.toml, ./x.py build --stage 2 fails before this patch, and succeeds afterwards.

error for `./x.py build --stage 2` before this patch
error[E0277]: `NonNull<str>` doesn't implement `DynSync`. Add it to `rustc_data_structures::marker` or use `IntoDynSyncSend` if it's already `Sync`
    --> compiler/rustc_query_system/src/dep_graph/serialized.rs:719:33
     |
 719 |           let results = broadcast(|_| {
     |  _______________________---------_^
     | |                       |
     | |                       required by a bound introduced by this call
 720 | |             let mut local = self.local.borrow_mut();
...    |
 734 | |         });
     | |_________^ within `Location<'static>`, the trait `DynSync` is not implemented for `NonNull<str>`
     |
note: required because it appears within the type `Location<'static>`
    --> /home/zachary/opt_mount/zachary/Programming/rust-compiler-2/library/core/src/panic/location.rs:39:12
     |
  39 | pub struct Location<'a> {
     |            ^^^^^^^^
     = note: required for `&'static Location<'static>` to implement `DynSend`
note: required because it appears within the type `std::option::Option<&'static Location<'static>>`
    --> /home/zachary/opt_mount/zachary/Programming/rust-compiler-2/library/core/src/option.rs:599:10
     |
 599 | pub enum Option<T> {
     |          ^^^^^^
note: required because it appears within the type `std::cell::UnsafeCell<std::option::Option<&'static Location<'static>>>`
    --> /home/zachary/opt_mount/zachary/Programming/rust-compiler-2/library/core/src/cell.rs:2289:12
     |
2289 | pub struct UnsafeCell<T: ?Sized> {
     |            ^^^^^^^^^^
note: required because it appears within the type `Cell<std::option::Option<&'static Location<'static>>>`
    --> /home/zachary/opt_mount/zachary/Programming/rust-compiler-2/library/core/src/cell.rs:313:12
     |
 313 | pub struct Cell<T: ?Sized> {
     |            ^^^^
note: required because it appears within the type `RefCell<LocalEncoderState>`
    --> /home/zachary/opt_mount/zachary/Programming/rust-compiler-2/library/core/src/cell.rs:822:12
     |
 822 | pub struct RefCell<T: ?Sized> {
     |            ^^^^^^^
     = note: required for `rustc_data_structures::sync::WorkerLocal<RefCell<LocalEncoderState>>` to implement `DynSync`
note: required because it appears within the type `EncoderState<D>`
    --> compiler/rustc_query_system/src/dep_graph/serialized.rs:546:8
     |
 546 | struct EncoderState<D: Deps> {
     |        ^^^^^^^^^^^^
     = note: required because it appears within the type `&EncoderState<D>`
note: required because it's used within this closure
    --> compiler/rustc_query_system/src/dep_graph/serialized.rs:719:33
     |
 719 |         let results = broadcast(|_| {
     |                                 ^^^
note: required by a bound in `rustc_data_structures::sync::broadcast`
    --> /home/zachary/opt_mount/zachary/Programming/rust-compiler-2/compiler/rustc_data_structures/src/sync/parallel.rs:239:56
     |
 239 | pub fn broadcast<R: DynSend>(op: impl Fn(usize) -> R + DynSync) -> Vec<R> {
     |                                                        ^^^^^^^ required by this bound in `broadcast`

For more information about this error, try `rustc --explain E0277`.
error: could not compile `rustc_query_system` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
Build completed unsuccessfully in 0:02:04

Required to allow the compiler to build with the debug_refcell stdlib cargo feature.
@rustbot rustbot added 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. labels Nov 10, 2025
@rustbot
Copy link
Collaborator

rustbot commented Nov 10, 2025

r? @nnethercote

rustbot has assigned @nnethercote.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@nnethercote
Copy link
Contributor

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Nov 10, 2025

📌 Commit 6bfb876 has been approved by nnethercote

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 Nov 10, 2025
ChrisDenton added a commit to ChrisDenton/rust that referenced this pull request Nov 10, 2025
…, r=nnethercote

Implement DynSend and DynSync for std::panic::Location.

Allows the compiler to build with the `debug_refcell` stdlib cargo feature.

With `rust.std-features = ["debug_refcell"]` in bootstrap.toml, `./x.py build --stage 2` fails before this patch, and succeeds afterwards.

<details> <summary>error for `./x.py build --stage 2` before this patch</summary>

```Rust
error[E0277]: `NonNull<str>` doesn't implement `DynSync`. Add it to `rustc_data_structures::marker` or use `IntoDynSyncSend` if it's already `Sync`
    --> compiler/rustc_query_system/src/dep_graph/serialized.rs:719:33
     |
 719 |           let results = broadcast(|_| {
     |  _______________________---------_^
     | |                       |
     | |                       required by a bound introduced by this call
 720 | |             let mut local = self.local.borrow_mut();
...    |
 734 | |         });
     | |_________^ within `Location<'static>`, the trait `DynSync` is not implemented for `NonNull<str>`
     |
note: required because it appears within the type `Location<'static>`
    --> /home/zachary/opt_mount/zachary/Programming/rust-compiler-2/library/core/src/panic/location.rs:39:12
     |
  39 | pub struct Location<'a> {
     |            ^^^^^^^^
     = note: required for `&'static Location<'static>` to implement `DynSend`
note: required because it appears within the type `std::option::Option<&'static Location<'static>>`
    --> /home/zachary/opt_mount/zachary/Programming/rust-compiler-2/library/core/src/option.rs:599:10
     |
 599 | pub enum Option<T> {
     |          ^^^^^^
note: required because it appears within the type `std::cell::UnsafeCell<std::option::Option<&'static Location<'static>>>`
    --> /home/zachary/opt_mount/zachary/Programming/rust-compiler-2/library/core/src/cell.rs:2289:12
     |
2289 | pub struct UnsafeCell<T: ?Sized> {
     |            ^^^^^^^^^^
note: required because it appears within the type `Cell<std::option::Option<&'static Location<'static>>>`
    --> /home/zachary/opt_mount/zachary/Programming/rust-compiler-2/library/core/src/cell.rs:313:12
     |
 313 | pub struct Cell<T: ?Sized> {
     |            ^^^^
note: required because it appears within the type `RefCell<LocalEncoderState>`
    --> /home/zachary/opt_mount/zachary/Programming/rust-compiler-2/library/core/src/cell.rs:822:12
     |
 822 | pub struct RefCell<T: ?Sized> {
     |            ^^^^^^^
     = note: required for `rustc_data_structures::sync::WorkerLocal<RefCell<LocalEncoderState>>` to implement `DynSync`
note: required because it appears within the type `EncoderState<D>`
    --> compiler/rustc_query_system/src/dep_graph/serialized.rs:546:8
     |
 546 | struct EncoderState<D: Deps> {
     |        ^^^^^^^^^^^^
     = note: required because it appears within the type `&EncoderState<D>`
note: required because it's used within this closure
    --> compiler/rustc_query_system/src/dep_graph/serialized.rs:719:33
     |
 719 |         let results = broadcast(|_| {
     |                                 ^^^
note: required by a bound in `rustc_data_structures::sync::broadcast`
    --> /home/zachary/opt_mount/zachary/Programming/rust-compiler-2/compiler/rustc_data_structures/src/sync/parallel.rs:239:56
     |
 239 | pub fn broadcast<R: DynSend>(op: impl Fn(usize) -> R + DynSync) -> Vec<R> {
     |                                                        ^^^^^^^ required by this bound in `broadcast`

For more information about this error, try `rustc --explain E0277`.
error: could not compile `rustc_query_system` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
Build completed unsuccessfully in 0:02:04
```

</details>
bors added a commit that referenced this pull request Nov 10, 2025
Rollup of 9 pull requests

Successful merges:

 - #148480 (Add `Steal::risky_hack_borrow_mut`)
 - #148608 (Add test for --test-builder success path)
 - #148667 (a few small clippy fixes)
 - #148712 (Port `cfg_select!` to the new attribute parsing system)
 - #148760 (rustc_target: hide TargetOptions::vendor)
 - #148775 (Fix a typo in the documentation for the strict_shr function)
 - #148779 (Implement DynSend and DynSync for std::panic::Location.)
 - #148781 ([rustdoc] Remove unneeded `allow(rustc::potential_query_instability)`)
 - #148791 (fix "is_closure_like" doc comment)

r? `@ghost`
`@rustbot` modify labels: rollup
Zalathar added a commit to Zalathar/rust that referenced this pull request Nov 11, 2025
…, r=nnethercote

Implement DynSend and DynSync for std::panic::Location.

Allows the compiler to build with the `debug_refcell` stdlib cargo feature.

With `rust.std-features = ["debug_refcell"]` in bootstrap.toml, `./x.py build --stage 2` fails before this patch, and succeeds afterwards.

<details> <summary>error for `./x.py build --stage 2` before this patch</summary>

```Rust
error[E0277]: `NonNull<str>` doesn't implement `DynSync`. Add it to `rustc_data_structures::marker` or use `IntoDynSyncSend` if it's already `Sync`
    --> compiler/rustc_query_system/src/dep_graph/serialized.rs:719:33
     |
 719 |           let results = broadcast(|_| {
     |  _______________________---------_^
     | |                       |
     | |                       required by a bound introduced by this call
 720 | |             let mut local = self.local.borrow_mut();
...    |
 734 | |         });
     | |_________^ within `Location<'static>`, the trait `DynSync` is not implemented for `NonNull<str>`
     |
note: required because it appears within the type `Location<'static>`
    --> /home/zachary/opt_mount/zachary/Programming/rust-compiler-2/library/core/src/panic/location.rs:39:12
     |
  39 | pub struct Location<'a> {
     |            ^^^^^^^^
     = note: required for `&'static Location<'static>` to implement `DynSend`
note: required because it appears within the type `std::option::Option<&'static Location<'static>>`
    --> /home/zachary/opt_mount/zachary/Programming/rust-compiler-2/library/core/src/option.rs:599:10
     |
 599 | pub enum Option<T> {
     |          ^^^^^^
note: required because it appears within the type `std::cell::UnsafeCell<std::option::Option<&'static Location<'static>>>`
    --> /home/zachary/opt_mount/zachary/Programming/rust-compiler-2/library/core/src/cell.rs:2289:12
     |
2289 | pub struct UnsafeCell<T: ?Sized> {
     |            ^^^^^^^^^^
note: required because it appears within the type `Cell<std::option::Option<&'static Location<'static>>>`
    --> /home/zachary/opt_mount/zachary/Programming/rust-compiler-2/library/core/src/cell.rs:313:12
     |
 313 | pub struct Cell<T: ?Sized> {
     |            ^^^^
note: required because it appears within the type `RefCell<LocalEncoderState>`
    --> /home/zachary/opt_mount/zachary/Programming/rust-compiler-2/library/core/src/cell.rs:822:12
     |
 822 | pub struct RefCell<T: ?Sized> {
     |            ^^^^^^^
     = note: required for `rustc_data_structures::sync::WorkerLocal<RefCell<LocalEncoderState>>` to implement `DynSync`
note: required because it appears within the type `EncoderState<D>`
    --> compiler/rustc_query_system/src/dep_graph/serialized.rs:546:8
     |
 546 | struct EncoderState<D: Deps> {
     |        ^^^^^^^^^^^^
     = note: required because it appears within the type `&EncoderState<D>`
note: required because it's used within this closure
    --> compiler/rustc_query_system/src/dep_graph/serialized.rs:719:33
     |
 719 |         let results = broadcast(|_| {
     |                                 ^^^
note: required by a bound in `rustc_data_structures::sync::broadcast`
    --> /home/zachary/opt_mount/zachary/Programming/rust-compiler-2/compiler/rustc_data_structures/src/sync/parallel.rs:239:56
     |
 239 | pub fn broadcast<R: DynSend>(op: impl Fn(usize) -> R + DynSync) -> Vec<R> {
     |                                                        ^^^^^^^ required by this bound in `broadcast`

For more information about this error, try `rustc --explain E0277`.
error: could not compile `rustc_query_system` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
Build completed unsuccessfully in 0:02:04
```

</details>
bors added a commit that referenced this pull request Nov 11, 2025
Rollup of 13 pull requests

Successful merges:

 - #148694 (std: support `RwLock` and thread parking on TEEOS)
 - #148712 (Port `cfg_select!` to the new attribute parsing system)
 - #148760 (rustc_target: hide TargetOptions::vendor)
 - #148771 (IAT: Reinstate early bailout)
 - #148775 (Fix a typo in the documentation for the strict_shr function)
 - #148779 (Implement DynSend and DynSync for std::panic::Location.)
 - #148781 ([rustdoc] Remove unneeded `allow(rustc::potential_query_instability)`)
 - #148783 (add test for assoc type norm wf check)
 - #148785 (Replace `master` branch references with `main`)
 - #148791 (fix "is_closure_like" doc comment)
 - #148792 (Prefer to use file.stable_id over file.name from source map)
 - #148805 (rustc-dev-guide subtree update)
 - #148807 (Document (and test) a problem with `Clone`/`Copy` deriving.)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 58b44fc into rust-lang:main Nov 11, 2025
11 checks passed
@rustbot rustbot added this to the 1.93.0 milestone Nov 11, 2025
rust-timer added a commit that referenced this pull request Nov 11, 2025
Rollup merge of #148779 - zachs18:panic-location-dynsendsync, r=nnethercote

Implement DynSend and DynSync for std::panic::Location.

Allows the compiler to build with the `debug_refcell` stdlib cargo feature.

With `rust.std-features = ["debug_refcell"]` in bootstrap.toml, `./x.py build --stage 2` fails before this patch, and succeeds afterwards.

<details> <summary>error for `./x.py build --stage 2` before this patch</summary>

```Rust
error[E0277]: `NonNull<str>` doesn't implement `DynSync`. Add it to `rustc_data_structures::marker` or use `IntoDynSyncSend` if it's already `Sync`
    --> compiler/rustc_query_system/src/dep_graph/serialized.rs:719:33
     |
 719 |           let results = broadcast(|_| {
     |  _______________________---------_^
     | |                       |
     | |                       required by a bound introduced by this call
 720 | |             let mut local = self.local.borrow_mut();
...    |
 734 | |         });
     | |_________^ within `Location<'static>`, the trait `DynSync` is not implemented for `NonNull<str>`
     |
note: required because it appears within the type `Location<'static>`
    --> /home/zachary/opt_mount/zachary/Programming/rust-compiler-2/library/core/src/panic/location.rs:39:12
     |
  39 | pub struct Location<'a> {
     |            ^^^^^^^^
     = note: required for `&'static Location<'static>` to implement `DynSend`
note: required because it appears within the type `std::option::Option<&'static Location<'static>>`
    --> /home/zachary/opt_mount/zachary/Programming/rust-compiler-2/library/core/src/option.rs:599:10
     |
 599 | pub enum Option<T> {
     |          ^^^^^^
note: required because it appears within the type `std::cell::UnsafeCell<std::option::Option<&'static Location<'static>>>`
    --> /home/zachary/opt_mount/zachary/Programming/rust-compiler-2/library/core/src/cell.rs:2289:12
     |
2289 | pub struct UnsafeCell<T: ?Sized> {
     |            ^^^^^^^^^^
note: required because it appears within the type `Cell<std::option::Option<&'static Location<'static>>>`
    --> /home/zachary/opt_mount/zachary/Programming/rust-compiler-2/library/core/src/cell.rs:313:12
     |
 313 | pub struct Cell<T: ?Sized> {
     |            ^^^^
note: required because it appears within the type `RefCell<LocalEncoderState>`
    --> /home/zachary/opt_mount/zachary/Programming/rust-compiler-2/library/core/src/cell.rs:822:12
     |
 822 | pub struct RefCell<T: ?Sized> {
     |            ^^^^^^^
     = note: required for `rustc_data_structures::sync::WorkerLocal<RefCell<LocalEncoderState>>` to implement `DynSync`
note: required because it appears within the type `EncoderState<D>`
    --> compiler/rustc_query_system/src/dep_graph/serialized.rs:546:8
     |
 546 | struct EncoderState<D: Deps> {
     |        ^^^^^^^^^^^^
     = note: required because it appears within the type `&EncoderState<D>`
note: required because it's used within this closure
    --> compiler/rustc_query_system/src/dep_graph/serialized.rs:719:33
     |
 719 |         let results = broadcast(|_| {
     |                                 ^^^
note: required by a bound in `rustc_data_structures::sync::broadcast`
    --> /home/zachary/opt_mount/zachary/Programming/rust-compiler-2/compiler/rustc_data_structures/src/sync/parallel.rs:239:56
     |
 239 | pub fn broadcast<R: DynSend>(op: impl Fn(usize) -> R + DynSync) -> Vec<R> {
     |                                                        ^^^^^^^ required by this bound in `broadcast`

For more information about this error, try `rustc --explain E0277`.
error: could not compile `rustc_query_system` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
Build completed unsuccessfully in 0:02:04
```

</details>
@zachs18 zachs18 deleted the panic-location-dynsendsync branch November 11, 2025 23:19
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Nov 12, 2025
Rollup of 13 pull requests

Successful merges:

 - rust-lang/rust#148694 (std: support `RwLock` and thread parking on TEEOS)
 - rust-lang/rust#148712 (Port `cfg_select!` to the new attribute parsing system)
 - rust-lang/rust#148760 (rustc_target: hide TargetOptions::vendor)
 - rust-lang/rust#148771 (IAT: Reinstate early bailout)
 - rust-lang/rust#148775 (Fix a typo in the documentation for the strict_shr function)
 - rust-lang/rust#148779 (Implement DynSend and DynSync for std::panic::Location.)
 - rust-lang/rust#148781 ([rustdoc] Remove unneeded `allow(rustc::potential_query_instability)`)
 - rust-lang/rust#148783 (add test for assoc type norm wf check)
 - rust-lang/rust#148785 (Replace `master` branch references with `main`)
 - rust-lang/rust#148791 (fix "is_closure_like" doc comment)
 - rust-lang/rust#148792 (Prefer to use file.stable_id over file.name from source map)
 - rust-lang/rust#148805 (rustc-dev-guide subtree update)
 - rust-lang/rust#148807 (Document (and test) a problem with `Clone`/`Copy` deriving.)

r? `@ghost`
`@rustbot` modify labels: rollup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants