Rollup of 9 pull requests - #160774
Conversation
* Make `char::is_default_ignorable` unstably public * Add tracking issue Co-authored-by: Jules Bertholet <jules@bertholet.email>
…Simulacrum Introduce a `PinSafePointer` trait that generalizes `PinCoerceUnsized` This PR renames `PinCoerceUnsized` to `PinSafePointer` and adds several new safety requirements about the implementations of various safe traits. Closes: rust-lang#152667 Closes: rust-lang#147794 ~~With this merged, the only remaining soundness issues with `Pin` are:~~ * rust-lang#134407 * The fact that `CoercePointee` may be implemented on `Pin<LocalType>` in downstream crates. (unstable only) For your convenience here are the docs for the new trait: # `PinSafePointer` Trait that indicates that this is a pointer that does not misbehave when combined with `Pin`. Note that for backwards compatibility reasons, it is possible to create a `Pin<P>` for pointer types `P` that do not implement this trait. However, this can only be done safely if `<P as Deref>::Target` implements `Unpin`, which means that pinning has no effect. # Safety Types that implement this trait must not provide "malicious" implementations of any safe traits used by `Pin`. ## The pointer must always reference the same object Calls to [`deref`]/[`deref_mut`] on the same `Pin<P>` instance must always refer to the same object. That is, the address returned by these methods must not change. This applies even if the pointer type is moved. Furthermore, if the pointer type can participate in unsizing coercions or dynamic dispatch, then these coercions must also not change the underlying concrete type. Here, the concrete type of a trait object is the type that the vtable corresponds to. The concrete type of a slice is an array of the same element type and the length specified in the metadata. The concrete type of a sized type is the type itself. As an example, after unsizing coercing a pinned pointer, `deref_mut` must not return a `#[repr(transparent)]` wrapper around the value it referenced before being unsized, even if the address is unchanged. ## The pointer must not move its pointee The [`deref_mut`] method and the pointer type's destructor are called with a `&mut self` receiver, but they must behave as-if it was a `self: Pin<&mut Self>` receiver. That is, they must not move out of the underlying value. As an example, `deref_mut` must not invoke `swap` on the inner value. ## Shared access to the pointer If this pointer type uses `&P` references as evidence that this value is not pinned, then it must not treat the `&self` argument passed to [`Clone`] or the formatting traits (`fmt::Debug`, `fmt::Display`, `fmt::Pointer`) as such evidence. As an example, given a `Pin<Arc<T>>` there is no way to obtain an `&Arc<T>` (note that `Deref` just gives a `&T`). Because of this, the [`Arc`] type can assume that an `&Arc<T>` value can only exist if the `T` is not pinned, which justifies the soundness of the [`Arc::get_mut`] method. ## Cloning pinned pointers When a `Pin<P>` is cloned, the `P` pointer value returned by `clone` is passed to [`Pin::new_unchecked`]. The implementation of [`Clone`] must return a value such that this is sound. For example, when a `Pin<&T>` is cloned, the resulting `&T` points at the same value. The value is known to be pinned since a `Pin<&T>` to it exists, so it is safe to wrap the `&T` returned by `clone` in `Pin`. [`deref`]: https://doc.rust-lang.org/stable/core/ops/trait.Deref.html#tymethod.deref [`deref_mut`]: https://doc.rust-lang.org/stable/core/ops/trait.DerefMut.html#tymethod.deref_mut [`clone`]: https://doc.rust-lang.org/stable/core/clone/trait.Clone.html#tymethod.clone [`Clone`]: https://doc.rust-lang.org/stable/core/clone/trait.Clone.html [`Arc`]: https://doc.rust-lang.org/stable/std/sync/struct.Arc.html [`Arc::get_mut`]: https://doc.rust-lang.org/stable/std/sync/struct.Arc.html#method.get_mut [`Pin::new_unchecked`]: https://doc.rust-lang.org/stable/std/pin/struct.Pin.html#method.new_unchecked r? lcnr
Apply str debugger visualizer to `*const str`, `*mut str` and `Box<str>` Fairly straightforward. Note that the MSVC changes very likely aren't exercised by CI. My GSoC project is actively working on fixing that, but in the meantime i can personally verify that it works (note that the `ref$<str$> *` type name confirms this is MSVC): <img width="318" height="138" alt="image" src="https://github.com/user-attachments/assets/fd868f16-d9a5-438a-a155-a429771bf525" />
…st-async-return-future, r=estebank Suggest add async for function sig with return expr in body Fixes rust-lang#159495 r? @estebank
…ewise-contains, r=joboet Optimize slice::contains for one-byte BytewiseEq types add optimized searches for NonZeroI8, option<NonZeroI8> ordering, and other one-byte types
…le, r=Mark-Simulacrum Make `char::is_default_ignorable` unstably public Similar to rust-lang#154849; this function is used in the implementation of `char::escape_debug()`, and there's no reason to force crates to duplicate a data table that std has to ship anyway. I'll add a tracking issue if this is approved. (I'll do the other data tables from rust-lang#155527 in separate PRs.) @rustbot label A-Unicode T-libs-api Tracking issue: rust-lang#160583 r? @Mark-Simulacrum
…=JonathanBrouwer rustc_passes: lint unused `#[path]` attributes on inline modules Closes rust-lang#157260. This PR emits the `unused_attributes` lint for `#[path]` attributes on inline modules when the attribute is unused. It also adds UI tests covering both linted and non-linted cases. r? @theemathas
…1, r=GuillaumeGomez Rename more diagnostic files to `diagnostics.rs` Renaming diagnostics files to all be `diagnostics.rs`, per the decision in rust-lang/compiler-team#1003 PR was created by doing a file rename using the editor actions of my IDE, and then running `./x fmt` r? @GuillaumeGomez @nnethercote Whoever of you gets to it first :)
…r=GuillaumeGomez Merge `rustc_lint/lints.rs` into `diagnostics.rs` Renaming diagnostics files to all be diagnostics.rs, per the decision in rust-lang/compiler-team#1003 r? @GuillaumeGomez
…ostics, r=GuillaumeGomez Merge `rustc_attr_parsing/session_diagnostics.rs` into `diagnostics.rs` Renaming diagnostics files to all be diagnostics.rs, per the decision in rust-lang/compiler-team#1003 r? @GuillaumeGomez
This comment has been minimized.
This comment has been minimized.
Rollup of 9 pull requests try-job: dist-various-1 try-job: test-various try-job: x86_64-gnu-aux try-job: x86_64-gnu-llvm-21-3 try-job: x86_64-msvc-1 try-job: aarch64-apple-* try-job: x86_64-mingw-1 try-job: i686-msvc-*
This comment has been minimized.
This comment has been minimized.
|
The job Click to see the possible cause of the failure (guessed by this bot)Important For more information how to resolve CI failures of this job, visit this link. |
|
📌 Perf builds for each rolled up PR:
previous master: 771916f902 In the case of a perf regression, run the following command for each PR you suspect might be the cause: |
|
A job failed! Check out the build log: (web) (plain enhanced) (plain) Click to see the possible cause of the failure (guessed by this bot) |
|
Finished benchmarking commit (4667d75): comparison URL. Overall result: ❌✅ regressions and improvements - no action needed@rustbot label: -perf-regression Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (secondary 0.3%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary 0.5%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary 0.2%, secondary 0.2%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 458.289s -> 458.83s (0.12%) |
Successful merges:
PinSafePointertrait that generalizesPinCoerceUnsized#156935 (Introduce aPinSafePointertrait that generalizesPinCoerceUnsized)*const str,*mut strandBox<str>#159834 (Apply str debugger visualizer to*const str,*mut strandBox<str>)char::is_default_ignorableunstably public #157944 (Makechar::is_default_ignorableunstably public)#[path]attributes on inline modules #158835 (rustc_passes: lint unused#[path]attributes on inline modules)diagnostics.rs#160754 (Rename more diagnostic files todiagnostics.rs)rustc_lint/lints.rsintodiagnostics.rs#160755 (Mergerustc_lint/lints.rsintodiagnostics.rs)rustc_attr_parsing/session_diagnostics.rsintodiagnostics.rs#160757 (Mergerustc_attr_parsing/session_diagnostics.rsintodiagnostics.rs)r? @ghost
Create a similar rollup