Skip to content

Commit

Permalink
Merge from rustc
Browse files Browse the repository at this point in the history
  • Loading branch information
The Miri Cronjob Bot committed Jul 27, 2024
2 parents 0d63614 + a66bc79 commit 0d6a7dd
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 10 deletions.
3 changes: 3 additions & 0 deletions core/src/clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ pub trait Clone: Sized {
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[must_use = "cloning is often expensive and is not expected to have side effects"]
// Clone::clone is special because the compiler generates MIR to implement it for some types.
// See InstanceKind::CloneShim.
#[cfg_attr(not(bootstrap), lang = "clone_fn")]
fn clone(&self) -> Self;

/// Performs copy-assignment from `source`.
Expand Down
12 changes: 8 additions & 4 deletions core/src/fmt/builders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,7 @@ impl<'a, 'b: 'a> DebugTuple<'a, 'b> {
}
}

/// A helper used to print list-like items with no special formatting.
struct DebugInner<'a, 'b: 'a> {
fmt: &'a mut fmt::Formatter<'b>,
result: fmt::Result,
Expand Down Expand Up @@ -578,7 +579,8 @@ impl<'a, 'b: 'a> DebugSet<'a, 'b> {
/// ```
#[stable(feature = "debug_builders", since = "1.2.0")]
pub fn finish(&mut self) -> fmt::Result {
self.inner.result.and_then(|_| self.inner.fmt.write_str("}"))
self.inner.result = self.inner.result.and_then(|_| self.inner.fmt.write_str("}"));
self.inner.result
}
}

Expand Down Expand Up @@ -721,7 +723,8 @@ impl<'a, 'b: 'a> DebugList<'a, 'b> {
/// ```
#[stable(feature = "debug_builders", since = "1.2.0")]
pub fn finish(&mut self) -> fmt::Result {
self.inner.result.and_then(|_| self.inner.fmt.write_str("]"))
self.inner.result = self.inner.result.and_then(|_| self.inner.fmt.write_str("]"));
self.inner.result
}
}

Expand Down Expand Up @@ -1002,11 +1005,12 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> {
/// ```
#[stable(feature = "debug_builders", since = "1.2.0")]
pub fn finish(&mut self) -> fmt::Result {
self.result.and_then(|_| {
self.result = self.result.and_then(|_| {
assert!(!self.has_key, "attempted to finish a map with a partial entry");

self.fmt.write_str("}")
})
});
self.result
}

fn is_pretty(&self) -> bool {
Expand Down
2 changes: 1 addition & 1 deletion core/src/iter/traits/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@ pub trait Iterator {
///
/// Given an element the closure must return `true` or `false`. The returned
/// iterator will yield only the elements for which the closure returns
/// true.
/// `true`.
///
/// # Examples
///
Expand Down
1 change: 0 additions & 1 deletion core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@
#![feature(const_hash)]
#![feature(const_heap)]
#![feature(const_index_range_slice_index)]
#![feature(const_int_from_str)]
#![feature(const_intrinsic_copy)]
#![feature(const_intrinsic_forget)]
#![feature(const_ipv4)]
Expand Down
2 changes: 1 addition & 1 deletion core/src/num/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ pub enum IntErrorKind {
impl ParseIntError {
/// Outputs the detailed cause of parsing an integer failing.
#[must_use]
#[rustc_const_unstable(feature = "const_int_from_str", issue = "59133")]
#[rustc_const_stable(feature = "const_int_from_str", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "int_error_matching", since = "1.55.0")]
pub const fn kind(&self) -> &IntErrorKind {
&self.kind
Expand Down
5 changes: 3 additions & 2 deletions core/src/num/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1386,6 +1386,7 @@ from_str_radix_int_impl! { isize i8 i16 i32 i64 i128 usize u8 u16 u32 u64 u128 }
#[doc(hidden)]
#[inline(always)]
#[unstable(issue = "none", feature = "std_internals")]
#[rustc_const_stable(feature = "const_int_from_str", since = "CURRENT_RUSTC_VERSION")]
pub const fn can_not_overflow<T>(radix: u32, is_signed_ty: bool, digits: &[u8]) -> bool {
radix <= 16 && digits.len() <= mem::size_of::<T>() * 2 - is_signed_ty as usize
}
Expand Down Expand Up @@ -1435,7 +1436,7 @@ macro_rules! from_str_radix {
#[doc = concat!("assert_eq!(", stringify!($int_ty), "::from_str_radix(\"A\", 16), Ok(10));")]
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_int_from_str", issue = "59133")]
#[rustc_const_stable(feature = "const_int_from_str", since = "CURRENT_RUSTC_VERSION")]
pub const fn from_str_radix(src: &str, radix: u32) -> Result<$int_ty, ParseIntError> {
use self::IntErrorKind::*;
use self::ParseIntError as PIE;
Expand Down Expand Up @@ -1565,7 +1566,7 @@ macro_rules! from_str_radix_size_impl {
#[doc = concat!("assert_eq!(", stringify!($size), "::from_str_radix(\"A\", 16), Ok(10));")]
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_int_from_str", issue = "59133")]
#[rustc_const_stable(feature = "const_int_from_str", since = "CURRENT_RUSTC_VERSION")]
pub const fn from_str_radix(src: &str, radix: u32) -> Result<$size, ParseIntError> {
match <$t>::from_str_radix(src, radix) {
Ok(x) => Ok(x as $size),
Expand Down
1 change: 0 additions & 1 deletion core/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#![feature(const_hash)]
#![feature(const_heap)]
#![feature(const_intrinsic_copy)]
#![feature(const_int_from_str)]
#![feature(const_maybe_uninit_as_mut_ptr)]
#![feature(const_nonnull_new)]
#![feature(const_pointer_is_aligned)]
Expand Down
2 changes: 2 additions & 0 deletions rtstartup/rsbegin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ trait Copy {}
#[lang = "freeze"]
auto trait Freeze {}

impl<T: ?Sized> Copy for *mut T {}

#[lang = "drop_in_place"]
#[inline]
#[allow(unconditional_recursion)]
Expand Down
2 changes: 2 additions & 0 deletions rtstartup/rsend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ trait Copy {}
#[lang = "freeze"]
auto trait Freeze {}

impl<T: ?Sized> Copy for *mut T {}

#[lang = "drop_in_place"]
#[inline]
#[allow(unconditional_recursion)]
Expand Down

0 comments on commit 0d6a7dd

Please sign in to comment.