Skip to content

Commit 0c78395

Browse files
committed
Auto merge of rust-lang#142442 - matthiaskrgr:rollup-6yodjfx, r=matthiaskrgr
Rollup of 10 pull requests Successful merges: - rust-lang#134847 (Implement asymmetrical precedence for closures and jumps) - rust-lang#141491 (Delegate `<CStr as Debug>` to `ByteStr`) - rust-lang#141770 (Merge `Cfg::render_long_html` and `Cfg::render_long_plain` methods common code) - rust-lang#142069 (Introduce `-Zmacro-stats`) - rust-lang#142158 (Tracking the old name of renamed unstable library features) - rust-lang#142221 ([AIX] strip underlying xcoff object) - rust-lang#142340 (miri: we can use apfloat's mul_add now) - rust-lang#142379 (Add bootstrap option to compile a tool with features) - rust-lang#142410 (intrinsics: rename min_align_of to align_of) - rust-lang#142413 (rustc-dev-guide subtree update) r? `@ghost` `@rustbot` modify labels: rollup
2 parents eadae1c + 2d34b82 commit 0c78395

File tree

11 files changed

+34
-38
lines changed

11 files changed

+34
-38
lines changed

alloc/src/ffi/c_str.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,8 @@ impl ops::Deref for CString {
714714
}
715715
}
716716

717+
/// Delegates to the [`CStr`] implementation of [`fmt::Debug`],
718+
/// showing invalid UTF-8 as hex escapes.
717719
#[stable(feature = "rust1", since = "1.0.0")]
718720
impl fmt::Debug for CString {
719721
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {

core/src/ffi/c_str.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,12 @@ impl fmt::Display for FromBytesUntilNulError {
162162
}
163163
}
164164

165+
/// Shows the underlying bytes as a normal string, with invalid UTF-8
166+
/// presented as hex escape sequences.
165167
#[stable(feature = "cstr_debug", since = "1.3.0")]
166168
impl fmt::Debug for CStr {
167169
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
168-
write!(f, "\"{}\"", self.to_bytes().escape_ascii())
170+
fmt::Debug::fmt(crate::bstr::ByteStr::from_bytes(self.to_bytes()), f)
169171
}
170172
}
171173

core/src/intrinsics/mod.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -926,8 +926,7 @@ pub const unsafe fn slice_get_unchecked<
926926
pub fn ptr_mask<T>(ptr: *const T, mask: usize) -> *const T;
927927

928928
/// Equivalent to the appropriate `llvm.memcpy.p0i8.0i8.*` intrinsic, with
929-
/// a size of `count` * `size_of::<T>()` and an alignment of
930-
/// `min_align_of::<T>()`
929+
/// a size of `count` * `size_of::<T>()` and an alignment of `align_of::<T>()`.
931930
///
932931
/// This intrinsic does not have a stable counterpart.
933932
/// # Safety
@@ -941,8 +940,7 @@ pub fn ptr_mask<T>(ptr: *const T, mask: usize) -> *const T;
941940
#[rustc_nounwind]
942941
pub unsafe fn volatile_copy_nonoverlapping_memory<T>(dst: *mut T, src: *const T, count: usize);
943942
/// Equivalent to the appropriate `llvm.memmove.p0i8.0i8.*` intrinsic, with
944-
/// a size of `count * size_of::<T>()` and an alignment of
945-
/// `min_align_of::<T>()`
943+
/// a size of `count * size_of::<T>()` and an alignment of `align_of::<T>()`.
946944
///
947945
/// The volatile parameter is set to `true`, so it will not be optimized out
948946
/// unless size is equal to zero.
@@ -952,8 +950,7 @@ pub unsafe fn volatile_copy_nonoverlapping_memory<T>(dst: *mut T, src: *const T,
952950
#[rustc_nounwind]
953951
pub unsafe fn volatile_copy_memory<T>(dst: *mut T, src: *const T, count: usize);
954952
/// Equivalent to the appropriate `llvm.memset.p0i8.*` intrinsic, with a
955-
/// size of `count * size_of::<T>()` and an alignment of
956-
/// `min_align_of::<T>()`.
953+
/// size of `count * size_of::<T>()` and an alignment of `align_of::<T>()`.
957954
///
958955
/// This intrinsic does not have a stable counterpart.
959956
/// # Safety
@@ -2649,7 +2646,7 @@ pub const fn size_of<T>() -> usize;
26492646
#[unstable(feature = "core_intrinsics", issue = "none")]
26502647
#[rustc_intrinsic_const_stable_indirect]
26512648
#[rustc_intrinsic]
2652-
pub const fn min_align_of<T>() -> usize;
2649+
pub const fn align_of<T>() -> usize;
26532650

26542651
/// Returns the number of variants of the type `T` cast to a `usize`;
26552652
/// if `T` has no variants, returns `0`. Uninhabited variants will be counted.
@@ -2689,7 +2686,7 @@ pub const unsafe fn size_of_val<T: ?Sized>(ptr: *const T) -> usize;
26892686
#[unstable(feature = "core_intrinsics", issue = "none")]
26902687
#[rustc_intrinsic]
26912688
#[rustc_intrinsic_const_stable_indirect]
2692-
pub const unsafe fn min_align_of_val<T: ?Sized>(ptr: *const T) -> usize;
2689+
pub const unsafe fn align_of_val<T: ?Sized>(ptr: *const T) -> usize;
26932690

26942691
/// Gets a static string slice containing the name of a type.
26952692
///

core/src/mem/mod.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ pub const unsafe fn size_of_val_raw<T: ?Sized>(val: *const T) -> usize {
412412
#[stable(feature = "rust1", since = "1.0.0")]
413413
#[deprecated(note = "use `align_of` instead", since = "1.2.0", suggestion = "align_of")]
414414
pub fn min_align_of<T>() -> usize {
415-
intrinsics::min_align_of::<T>()
415+
intrinsics::align_of::<T>()
416416
}
417417

418418
/// Returns the [ABI]-required minimum alignment of the type of the value that `val` points to in
@@ -436,7 +436,7 @@ pub fn min_align_of<T>() -> usize {
436436
#[deprecated(note = "use `align_of_val` instead", since = "1.2.0", suggestion = "align_of_val")]
437437
pub fn min_align_of_val<T: ?Sized>(val: &T) -> usize {
438438
// SAFETY: val is a reference, so it's a valid raw pointer
439-
unsafe { intrinsics::min_align_of_val(val) }
439+
unsafe { intrinsics::align_of_val(val) }
440440
}
441441

442442
/// Returns the [ABI]-required minimum alignment of a type in bytes.
@@ -458,7 +458,7 @@ pub fn min_align_of_val<T: ?Sized>(val: &T) -> usize {
458458
#[rustc_promotable]
459459
#[rustc_const_stable(feature = "const_align_of", since = "1.24.0")]
460460
pub const fn align_of<T>() -> usize {
461-
intrinsics::min_align_of::<T>()
461+
intrinsics::align_of::<T>()
462462
}
463463

464464
/// Returns the [ABI]-required minimum alignment of the type of the value that `val` points to in
@@ -477,10 +477,9 @@ pub const fn align_of<T>() -> usize {
477477
#[must_use]
478478
#[stable(feature = "rust1", since = "1.0.0")]
479479
#[rustc_const_stable(feature = "const_align_of_val", since = "1.85.0")]
480-
#[allow(deprecated)]
481480
pub const fn align_of_val<T: ?Sized>(val: &T) -> usize {
482481
// SAFETY: val is a reference, so it's a valid raw pointer
483-
unsafe { intrinsics::min_align_of_val(val) }
482+
unsafe { intrinsics::align_of_val(val) }
484483
}
485484

486485
/// Returns the [ABI]-required minimum alignment of the type of the value that `val` points to in
@@ -527,7 +526,7 @@ pub const fn align_of_val<T: ?Sized>(val: &T) -> usize {
527526
#[unstable(feature = "layout_for_ptr", issue = "69835")]
528527
pub const unsafe fn align_of_val_raw<T: ?Sized>(val: *const T) -> usize {
529528
// SAFETY: the caller must provide a valid raw pointer
530-
unsafe { intrinsics::min_align_of_val(val) }
529+
unsafe { intrinsics::align_of_val(val) }
531530
}
532531

533532
/// Returns `true` if dropping values of type `T` matters.
@@ -637,8 +636,6 @@ pub const fn needs_drop<T: ?Sized>() -> bool {
637636
#[inline(always)]
638637
#[must_use]
639638
#[stable(feature = "rust1", since = "1.0.0")]
640-
#[allow(deprecated_in_future)]
641-
#[allow(deprecated)]
642639
#[rustc_diagnostic_item = "mem_zeroed"]
643640
#[track_caller]
644641
#[rustc_const_stable(feature = "const_mem_zeroed", since = "1.75.0")]
@@ -677,8 +674,6 @@ pub const unsafe fn zeroed<T>() -> T {
677674
#[must_use]
678675
#[deprecated(since = "1.39.0", note = "use `mem::MaybeUninit` instead")]
679676
#[stable(feature = "rust1", since = "1.0.0")]
680-
#[allow(deprecated_in_future)]
681-
#[allow(deprecated)]
682677
#[rustc_diagnostic_item = "mem_uninitialized"]
683678
#[track_caller]
684679
pub unsafe fn uninitialized<T>() -> T {

core/src/ops/control_flow.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ pub enum ControlFlow<B, C = ()> {
9898
// is a no-op conversion in the `Try` implementation.
9999
}
100100

101-
#[unstable(feature = "try_trait_v2", issue = "84277")]
101+
#[unstable(feature = "try_trait_v2", issue = "84277", old_name = "try_trait")]
102102
impl<B, C> ops::Try for ControlFlow<B, C> {
103103
type Output = C;
104104
type Residual = ControlFlow<B, convert::Infallible>;
@@ -117,7 +117,7 @@ impl<B, C> ops::Try for ControlFlow<B, C> {
117117
}
118118
}
119119

120-
#[unstable(feature = "try_trait_v2", issue = "84277")]
120+
#[unstable(feature = "try_trait_v2", issue = "84277", old_name = "try_trait")]
121121
// Note: manually specifying the residual type instead of using the default to work around
122122
// https://github.com/rust-lang/rust/issues/99940
123123
impl<B, C> ops::FromResidual<ControlFlow<B, convert::Infallible>> for ControlFlow<B, C> {

core/src/ops/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ pub use self::try_trait::Residual;
194194
#[unstable(feature = "try_trait_v2_yeet", issue = "96374")]
195195
pub use self::try_trait::Yeet;
196196
pub(crate) use self::try_trait::{ChangeOutputType, NeverShortCircuit};
197-
#[unstable(feature = "try_trait_v2", issue = "84277")]
197+
#[unstable(feature = "try_trait_v2", issue = "84277", old_name = "try_trait")]
198198
pub use self::try_trait::{FromResidual, Try};
199199
#[unstable(feature = "coerce_unsized", issue = "18598")]
200200
pub use self::unsize::CoerceUnsized;

core/src/ops/try_trait.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ use crate::ops::ControlFlow;
112112
/// R::from_output(accum)
113113
/// }
114114
/// ```
115-
#[unstable(feature = "try_trait_v2", issue = "84277")]
115+
#[unstable(feature = "try_trait_v2", issue = "84277", old_name = "try_trait")]
116116
#[rustc_on_unimplemented(
117117
on(
118118
all(from_desugaring = "TryBlock"),
@@ -130,7 +130,7 @@ use crate::ops::ControlFlow;
130130
#[lang = "Try"]
131131
pub trait Try: FromResidual {
132132
/// The type of the value produced by `?` when *not* short-circuiting.
133-
#[unstable(feature = "try_trait_v2", issue = "84277")]
133+
#[unstable(feature = "try_trait_v2", issue = "84277", old_name = "try_trait")]
134134
type Output;
135135

136136
/// The type of the value passed to [`FromResidual::from_residual`]
@@ -154,7 +154,7 @@ pub trait Try: FromResidual {
154154
/// then typically you can use `Foo<std::convert::Infallible>` as its `Residual`
155155
/// type: that type will have a "hole" in the correct place, and will maintain the
156156
/// "foo-ness" of the residual so other types need to opt-in to interconversion.
157-
#[unstable(feature = "try_trait_v2", issue = "84277")]
157+
#[unstable(feature = "try_trait_v2", issue = "84277", old_name = "try_trait")]
158158
type Residual;
159159

160160
/// Constructs the type from its `Output` type.
@@ -186,7 +186,7 @@ pub trait Try: FromResidual {
186186
/// assert_eq!(r, Some(4));
187187
/// ```
188188
#[lang = "from_output"]
189-
#[unstable(feature = "try_trait_v2", issue = "84277")]
189+
#[unstable(feature = "try_trait_v2", issue = "84277", old_name = "try_trait")]
190190
fn from_output(output: Self::Output) -> Self;
191191

192192
/// Used in `?` to decide whether the operator should produce a value
@@ -213,7 +213,7 @@ pub trait Try: FromResidual {
213213
/// );
214214
/// ```
215215
#[lang = "branch"]
216-
#[unstable(feature = "try_trait_v2", issue = "84277")]
216+
#[unstable(feature = "try_trait_v2", issue = "84277", old_name = "try_trait")]
217217
fn branch(self) -> ControlFlow<Self::Residual, Self::Output>;
218218
}
219219

@@ -303,7 +303,7 @@ pub trait Try: FromResidual {
303303
),
304304
)]
305305
#[rustc_diagnostic_item = "FromResidual"]
306-
#[unstable(feature = "try_trait_v2", issue = "84277")]
306+
#[unstable(feature = "try_trait_v2", issue = "84277", old_name = "try_trait")]
307307
pub trait FromResidual<R = <Self as Try>::Residual> {
308308
/// Constructs the type from a compatible `Residual` type.
309309
///
@@ -326,7 +326,7 @@ pub trait FromResidual<R = <Self as Try>::Residual> {
326326
/// );
327327
/// ```
328328
#[lang = "from_residual"]
329-
#[unstable(feature = "try_trait_v2", issue = "84277")]
329+
#[unstable(feature = "try_trait_v2", issue = "84277", old_name = "try_trait")]
330330
fn from_residual(residual: R) -> Self;
331331
}
332332

core/src/option.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2532,7 +2532,7 @@ impl<A, V: FromIterator<A>> FromIterator<Option<A>> for Option<V> {
25322532
}
25332533
}
25342534

2535-
#[unstable(feature = "try_trait_v2", issue = "84277")]
2535+
#[unstable(feature = "try_trait_v2", issue = "84277", old_name = "try_trait")]
25362536
impl<T> ops::Try for Option<T> {
25372537
type Output = T;
25382538
type Residual = Option<convert::Infallible>;
@@ -2551,7 +2551,7 @@ impl<T> ops::Try for Option<T> {
25512551
}
25522552
}
25532553

2554-
#[unstable(feature = "try_trait_v2", issue = "84277")]
2554+
#[unstable(feature = "try_trait_v2", issue = "84277", old_name = "try_trait")]
25552555
// Note: manually specifying the residual type instead of using the default to work around
25562556
// https://github.com/rust-lang/rust/issues/99940
25572557
impl<T> ops::FromResidual<Option<convert::Infallible>> for Option<T> {

core/src/result.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2051,7 +2051,7 @@ impl<A, E, V: FromIterator<A>> FromIterator<Result<A, E>> for Result<V, E> {
20512051
}
20522052
}
20532053

2054-
#[unstable(feature = "try_trait_v2", issue = "84277")]
2054+
#[unstable(feature = "try_trait_v2", issue = "84277", old_name = "try_trait")]
20552055
impl<T, E> ops::Try for Result<T, E> {
20562056
type Output = T;
20572057
type Residual = Result<convert::Infallible, E>;
@@ -2070,7 +2070,7 @@ impl<T, E> ops::Try for Result<T, E> {
20702070
}
20712071
}
20722072

2073-
#[unstable(feature = "try_trait_v2", issue = "84277")]
2073+
#[unstable(feature = "try_trait_v2", issue = "84277", old_name = "try_trait")]
20742074
impl<T, E, F: From<E>> ops::FromResidual<Result<convert::Infallible, E>> for Result<T, F> {
20752075
#[inline]
20762076
#[track_caller]

core/src/task/poll.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ impl<T> From<T> for Poll<T> {
229229
}
230230
}
231231

232-
#[unstable(feature = "try_trait_v2", issue = "84277")]
232+
#[unstable(feature = "try_trait_v2", issue = "84277", old_name = "try_trait")]
233233
impl<T, E> ops::Try for Poll<Result<T, E>> {
234234
type Output = Poll<T>;
235235
type Residual = Result<convert::Infallible, E>;
@@ -249,7 +249,7 @@ impl<T, E> ops::Try for Poll<Result<T, E>> {
249249
}
250250
}
251251

252-
#[unstable(feature = "try_trait_v2", issue = "84277")]
252+
#[unstable(feature = "try_trait_v2", issue = "84277", old_name = "try_trait")]
253253
impl<T, E, F: From<E>> ops::FromResidual<Result<convert::Infallible, E>> for Poll<Result<T, F>> {
254254
#[inline]
255255
fn from_residual(x: Result<convert::Infallible, E>) -> Self {
@@ -259,7 +259,7 @@ impl<T, E, F: From<E>> ops::FromResidual<Result<convert::Infallible, E>> for Pol
259259
}
260260
}
261261

262-
#[unstable(feature = "try_trait_v2", issue = "84277")]
262+
#[unstable(feature = "try_trait_v2", issue = "84277", old_name = "try_trait")]
263263
impl<T, E> ops::Try for Poll<Option<Result<T, E>>> {
264264
type Output = Poll<Option<T>>;
265265
type Residual = Result<convert::Infallible, E>;
@@ -280,7 +280,7 @@ impl<T, E> ops::Try for Poll<Option<Result<T, E>>> {
280280
}
281281
}
282282

283-
#[unstable(feature = "try_trait_v2", issue = "84277")]
283+
#[unstable(feature = "try_trait_v2", issue = "84277", old_name = "try_trait")]
284284
impl<T, E, F: From<E>> ops::FromResidual<Result<convert::Infallible, E>>
285285
for Poll<Option<Result<T, F>>>
286286
{

coretests/tests/ffi/cstr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ fn compares_as_u8s() {
1717
#[test]
1818
fn debug() {
1919
let s = c"abc\x01\x02\n\xE2\x80\xA6\xFF";
20-
assert_eq!(format!("{s:?}"), r#""abc\x01\x02\n\xe2\x80\xa6\xff""#);
20+
assert_eq!(format!("{s:?}"), r#""abc\x01\x02\n\xff""#);
2121
}
2222

2323
#[test]

0 commit comments

Comments
 (0)