Skip to content

Commit

Permalink
Auto merge of rust-lang#112132 - matthiaskrgr:rollup-x2l75gf, r=matth…
Browse files Browse the repository at this point in the history
…iaskrgr

Rollup of 5 pull requests

Successful merges:

 - rust-lang#111772 (Fix linkage for large binaries on mips64 platforms)
 - rust-lang#111975 (Stop normalizing so many different prefixes)
 - rust-lang#111979 (Respect CARGOFLAGS in bootstrap.py)
 - rust-lang#112089 (Add `--warnings warn` flag to `x.py`)
 - rust-lang#112103 (Bootstrap update to 1.71 beta)

r? `@ghost`
`@rustbot` modify labels: rollup
  • Loading branch information
bors committed May 31, 2023
2 parents e29821f + 2054acb commit e4f7ad8
Show file tree
Hide file tree
Showing 30 changed files with 507 additions and 562 deletions.
4 changes: 2 additions & 2 deletions compiler/rustc_feature/src/accepted.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ declare_features! (
/// Allows `crate` in paths.
(accepted, crate_in_paths, "1.30.0", Some(45477), None),
/// Allows using `#[debugger_visualizer]` attribute.
(accepted, debugger_visualizer, "CURRENT_RUSTC_VERSION", Some(95939), None),
(accepted, debugger_visualizer, "1.71.0", Some(95939), None),
/// Allows rustc to inject a default alloc_error_handler
(accepted, default_alloc_error_handler, "1.68.0", Some(66741), None),
/// Allows using assigning a default type to type parameters in algebraic data type definitions.
Expand Down Expand Up @@ -281,7 +281,7 @@ declare_features! (
/// Allows use of the postfix `?` operator in expressions.
(accepted, question_mark, "1.13.0", Some(31436), None),
/// Allows the use of raw-dylibs (RFC 2627).
(accepted, raw_dylib, "CURRENT_RUSTC_VERSION", Some(58713), None),
(accepted, raw_dylib, "1.71.0", Some(58713), None),
/// Allows keywords to be escaped for use as identifiers.
(accepted, raw_identifiers, "1.30.0", Some(48589), None),
/// Allows relaxing the coherence rules such that
Expand Down
10 changes: 5 additions & 5 deletions compiler/rustc_feature/src/active.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ declare_features! (
/// Allows the `multiple_supertrait_upcastable` lint.
(active, multiple_supertrait_upcastable, "1.69.0", None, None),
/// Allow negative trait bounds. This is an internal-only feature for testing the trait solver!
(incomplete, negative_bounds, "CURRENT_RUSTC_VERSION", None, None),
(incomplete, negative_bounds, "1.71.0", None, None),
/// Allows using `#[omit_gdb_pretty_printer_section]`.
(active, omit_gdb_pretty_printer_section, "1.5.0", None, None),
/// Allows using `#[prelude_import]` on glob `use` items.
Expand Down Expand Up @@ -314,15 +314,15 @@ declare_features! (
/// Allows async functions to be declared, implemented, and used in traits.
(active, async_fn_in_trait, "1.66.0", Some(91611), None),
/// Allows builtin # foo() syntax
(active, builtin_syntax, "CURRENT_RUSTC_VERSION", Some(110680), None),
(active, builtin_syntax, "1.71.0", Some(110680), None),
/// Allows `c"foo"` literals.
(active, c_str_literals, "CURRENT_RUSTC_VERSION", Some(105723), None),
(active, c_str_literals, "1.71.0", Some(105723), None),
/// Treat `extern "C"` function as nounwind.
(active, c_unwind, "1.52.0", Some(74990), None),
/// Allows using C-variadics.
(active, c_variadic, "1.34.0", Some(44930), None),
/// Allows the use of `#[cfg(overflow_checks)` to check if integer overflow behaviour.
(active, cfg_overflow_checks, "CURRENT_RUSTC_VERSION", Some(111466), None),
(active, cfg_overflow_checks, "1.71.0", Some(111466), None),
/// Allows the use of `#[cfg(sanitize = "option")]`; set when -Zsanitizer is used.
(active, cfg_sanitize, "1.41.0", Some(39699), None),
/// Allows `cfg(target_abi = "...")`.
Expand All @@ -338,7 +338,7 @@ declare_features! (
/// Allow conditional compilation depending on rust version
(active, cfg_version, "1.45.0", Some(64796), None),
/// Allows to use the `#[cfi_encoding = ""]` attribute.
(active, cfi_encoding, "CURRENT_RUSTC_VERSION", Some(89653), None),
(active, cfi_encoding, "1.71.0", Some(89653), None),
/// Allows `for<...>` on closures and generators.
(active, closure_lifetime_binder, "1.64.0", Some(97362), None),
/// Allows `#[track_caller]` on closures and generators.
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_session/src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ impl SymbolGallery {

/// Construct a diagnostic for a language feature error due to the given `span`.
/// The `feature`'s `Symbol` is the one you used in `active.rs` and `rustc_span::symbols`.
#[track_caller]
pub fn feature_err(
sess: &ParseSess,
feature: Symbol,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub fn target() -> Target {
endian: Endian::Big,
// NOTE(mips64r2) matches C toolchain
cpu: "mips64r2".into(),
features: "+mips64r2".into(),
features: "+mips64r2,+xgot".into(),
max_atomic_width: Some(64),
mcount: "_mcount".into(),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub fn target() -> Target {
abi: "abi64".into(),
// NOTE(mips64r2) matches C toolchain
cpu: "mips64r2".into(),
features: "+mips64r2".into(),
features: "+mips64r2,+xgot".into(),
max_atomic_width: Some(64),
mcount: "_mcount".into(),

Expand Down
2 changes: 0 additions & 2 deletions library/alloc/src/alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ extern "Rust" {
#[rustc_nounwind]
fn __rust_alloc_zeroed(size: usize, align: usize) -> *mut u8;

#[cfg(not(bootstrap))]
static __rust_no_alloc_shim_is_unstable: u8;
}

Expand Down Expand Up @@ -96,7 +95,6 @@ pub unsafe fn alloc(layout: Layout) -> *mut u8 {
unsafe {
// Make sure we don't accidentally allow omitting the allocator shim in
// stable code until it is actually stabilized.
#[cfg(not(bootstrap))]
core::ptr::read_volatile(&__rust_no_alloc_shim_is_unstable);

__rust_alloc(layout.size(), layout.align())
Expand Down
2 changes: 1 addition & 1 deletion library/alloc/src/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2624,7 +2624,7 @@ impl ToString for String {
}

#[cfg(not(no_global_oom_handling))]
#[stable(feature = "fmt_arguments_to_string_specialization", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "fmt_arguments_to_string_specialization", since = "1.71.0")]
impl ToString for fmt::Arguments<'_> {
#[inline]
fn to_string(&self) -> String {
Expand Down
6 changes: 3 additions & 3 deletions library/core/src/ffi/c_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ use crate::str;
#[derive(Hash)]
#[stable(feature = "core_c_str", since = "1.64.0")]
#[rustc_has_incoherent_inherent_impls]
#[cfg_attr(not(bootstrap), lang = "CStr")]
#[lang = "CStr"]
// FIXME:
// `fn from` in `impl From<&CStr> for Box<CStr>` current implementation relies
// on `CStr` being layout-compatible with `[u8]`.
Expand Down Expand Up @@ -531,8 +531,8 @@ impl CStr {
/// # }
/// ```
#[inline]
#[stable(feature = "cstr_is_empty", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "cstr_is_empty", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "cstr_is_empty", since = "1.71.0")]
#[rustc_const_stable(feature = "cstr_is_empty", since = "1.71.0")]
pub const fn is_empty(&self) -> bool {
// SAFETY: We know there is at least one byte; for empty strings it
// is the NUL terminator.
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/ffi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ mod c_long_definition {
// would be uninhabited and at least dereferencing such pointers would
// be UB.
#[doc = include_str!("c_void.md")]
#[cfg_attr(not(bootstrap), lang = "c_void")]
#[lang = "c_void"]
#[cfg_attr(not(doc), repr(u8))] // work around https://github.com/rust-lang/rust/issues/90435
#[stable(feature = "core_c_void", since = "1.30.0")]
pub enum c_void {
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/hash/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ pub trait BuildHasher {
/// bh.hash_one(&OrderAmbivalentPair(2, 10))
/// );
/// ```
#[stable(feature = "build_hasher_simple_hash_one", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "build_hasher_simple_hash_one", since = "1.71.0")]
fn hash_one<T: Hash>(&self, x: T) -> u64
where
Self: Sized,
Expand Down
33 changes: 1 addition & 32 deletions library/core/src/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1385,7 +1385,6 @@ extern "rust-intrinsic" {
///
/// This is not expected to ever be exposed directly to users, rather it
/// may eventually be exposed through some more-constrained API.
#[cfg(not(bootstrap))]
#[rustc_const_stable(feature = "const_transmute", since = "1.56.0")]
#[rustc_nounwind]
pub fn transmute_unchecked<Src, Dst>(src: Src) -> Dst;
Expand Down Expand Up @@ -1425,19 +1424,11 @@ extern "rust-intrinsic" {
/// returned value will result in undefined behavior.
///
/// The stabilized version of this intrinsic is [`pointer::offset`].
#[cfg(not(bootstrap))]
#[must_use = "returns a new pointer rather than modifying its argument"]
#[rustc_const_stable(feature = "const_ptr_offset", since = "1.61.0")]
#[rustc_nounwind]
pub fn offset<Ptr, Delta>(dst: Ptr, offset: Delta) -> Ptr;

/// The bootstrap version of this is more restricted.
#[cfg(bootstrap)]
#[must_use = "returns a new pointer rather than modifying its argument"]
#[rustc_const_stable(feature = "const_ptr_offset", since = "1.61.0")]
#[rustc_nounwind]
pub fn offset<T>(dst: *const T, offset: isize) -> *const T;

/// Calculates the offset from a pointer, potentially wrapping.
///
/// This is implemented as an intrinsic to avoid converting to and from an
Expand Down Expand Up @@ -2260,7 +2251,7 @@ extern "rust-intrinsic" {
/// This intrinsic can *only* be called where the pointer is a local without
/// projections (`read_via_copy(ptr)`, not `read_via_copy(*ptr)`) so that it
/// trivially obeys runtime-MIR rules about derefs in operands.
#[rustc_const_stable(feature = "const_ptr_read", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "const_ptr_read", since = "1.71.0")]
#[rustc_nounwind]
pub fn read_via_copy<T>(ptr: *const T) -> T;

Expand All @@ -2270,7 +2261,6 @@ extern "rust-intrinsic" {
/// This intrinsic can *only* be called where the pointer is a local without
/// projections (`write_via_move(ptr, x)`, not `write_via_move(*ptr, x)`) so
/// that it trivially obeys runtime-MIR rules about derefs in operands.
#[cfg(not(bootstrap))]
#[rustc_const_unstable(feature = "const_ptr_write", issue = "86302")]
#[rustc_nounwind]
pub fn write_via_move<T>(ptr: *mut T, value: T);
Expand Down Expand Up @@ -2832,24 +2822,3 @@ pub const unsafe fn write_bytes<T>(dst: *mut T, val: u8, count: usize) {
write_bytes(dst, val, count)
}
}

/// Polyfill for bootstrap
#[cfg(bootstrap)]
pub const unsafe fn transmute_unchecked<Src, Dst>(src: Src) -> Dst {
use crate::mem::*;
// SAFETY: It's a transmute -- the caller promised it's fine.
unsafe { transmute_copy(&ManuallyDrop::new(src)) }
}

/// Polyfill for bootstrap
#[cfg(bootstrap)]
pub const unsafe fn write_via_move<T>(ptr: *mut T, value: T) {
use crate::mem::*;
// SAFETY: the caller must guarantee that `dst` is valid for writes.
// `dst` cannot overlap `src` because the caller has mutable access
// to `dst` while `src` is owned by this function.
unsafe {
copy_nonoverlapping::<T>(&value, ptr, 1);
forget(value);
}
}
3 changes: 1 addition & 2 deletions library/core/src/marker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -971,15 +971,14 @@ pub trait Tuple {}
pub trait PointerLike {}

/// A marker for types which can be used as types of `const` generic parameters.
#[cfg_attr(not(bootstrap), lang = "const_param_ty")]
#[lang = "const_param_ty"]
#[unstable(feature = "adt_const_params", issue = "95174")]
#[rustc_on_unimplemented(message = "`{Self}` can't be used as a const parameter type")]
pub trait ConstParamTy: StructuralEq {}

/// Derive macro generating an impl of the trait `ConstParamTy`.
#[rustc_builtin_macro]
#[unstable(feature = "adt_const_params", issue = "95174")]
#[cfg(not(bootstrap))]
pub macro ConstParamTy($item:item) {
/* compiler built-in */
}
Expand Down
3 changes: 1 addition & 2 deletions library/core/src/mem/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -968,7 +968,7 @@ pub const fn replace<T>(dest: &mut T, src: T) -> T {
/// Integers and other types implementing [`Copy`] are unaffected by `drop`.
///
/// ```
/// # #![cfg_attr(not(bootstrap), allow(dropping_copy_types))]
/// # #![allow(dropping_copy_types)]
/// #[derive(Copy, Clone)]
/// struct Foo(u8);
///
Expand Down Expand Up @@ -1316,7 +1316,6 @@ impl<T> SizedTypeProperties for T {}
///
/// assert_eq!(mem::offset_of!(NestedA, b.0), 0);
/// ```
#[cfg(not(bootstrap))]
#[unstable(feature = "offset_of", issue = "106655")]
#[allow_internal_unstable(builtin_syntax)]
pub macro offset_of($Container:ty, $($fields:tt).+ $(,)?) {
Expand Down
28 changes: 14 additions & 14 deletions library/core/src/num/nonzero.rs
Original file line number Diff line number Diff line change
Expand Up @@ -769,8 +769,8 @@ macro_rules! nonzero_signed_operations {
/// ```
#[must_use]
#[inline]
#[stable(feature = "nonzero_negation_ops", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "nonzero_negation_ops", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "nonzero_negation_ops", since = "1.71.0")]
#[rustc_const_stable(feature = "nonzero_negation_ops", since = "1.71.0")]
pub const fn is_positive(self) -> bool {
self.get().is_positive()
}
Expand All @@ -794,8 +794,8 @@ macro_rules! nonzero_signed_operations {
/// ```
#[must_use]
#[inline]
#[stable(feature = "nonzero_negation_ops", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "nonzero_negation_ops", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "nonzero_negation_ops", since = "1.71.0")]
#[rustc_const_stable(feature = "nonzero_negation_ops", since = "1.71.0")]
pub const fn is_negative(self) -> bool {
self.get().is_negative()
}
Expand All @@ -819,8 +819,8 @@ macro_rules! nonzero_signed_operations {
/// # }
/// ```
#[inline]
#[stable(feature = "nonzero_negation_ops", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "nonzero_negation_ops", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "nonzero_negation_ops", since = "1.71.0")]
#[rustc_const_stable(feature = "nonzero_negation_ops", since = "1.71.0")]
pub const fn checked_neg(self) -> Option<$Ty> {
if let Some(result) = self.get().checked_neg() {
// SAFETY: negation of nonzero cannot yield zero values.
Expand Down Expand Up @@ -851,8 +851,8 @@ macro_rules! nonzero_signed_operations {
/// # }
/// ```
#[inline]
#[stable(feature = "nonzero_negation_ops", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "nonzero_negation_ops", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "nonzero_negation_ops", since = "1.71.0")]
#[rustc_const_stable(feature = "nonzero_negation_ops", since = "1.71.0")]
pub const fn overflowing_neg(self) -> ($Ty, bool) {
let (result, overflow) = self.get().overflowing_neg();
// SAFETY: negation of nonzero cannot yield zero values.
Expand Down Expand Up @@ -884,8 +884,8 @@ macro_rules! nonzero_signed_operations {
/// # }
/// ```
#[inline]
#[stable(feature = "nonzero_negation_ops", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "nonzero_negation_ops", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "nonzero_negation_ops", since = "1.71.0")]
#[rustc_const_stable(feature = "nonzero_negation_ops", since = "1.71.0")]
pub const fn saturating_neg(self) -> $Ty {
if let Some(result) = self.checked_neg() {
return result;
Expand Down Expand Up @@ -916,16 +916,16 @@ macro_rules! nonzero_signed_operations {
/// # }
/// ```
#[inline]
#[stable(feature = "nonzero_negation_ops", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "nonzero_negation_ops", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "nonzero_negation_ops", since = "1.71.0")]
#[rustc_const_stable(feature = "nonzero_negation_ops", since = "1.71.0")]
pub const fn wrapping_neg(self) -> $Ty {
let result = self.get().wrapping_neg();
// SAFETY: negation of nonzero cannot yield zero values.
unsafe { $Ty::new_unchecked(result) }
}
}

#[stable(feature = "signed_nonzero_neg", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "signed_nonzero_neg", since = "1.71.0")]
impl Neg for $Ty {
type Output = $Ty;

Expand All @@ -937,7 +937,7 @@ macro_rules! nonzero_signed_operations {
}

forward_ref_unop! { impl Neg, neg for $Ty,
#[stable(feature = "signed_nonzero_neg", since = "CURRENT_RUSTC_VERSION")] }
#[stable(feature = "signed_nonzero_neg", since = "1.71.0")] }
)+
}
}
Expand Down
14 changes: 3 additions & 11 deletions library/core/src/ptr/const_ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -916,16 +916,8 @@ impl<T: ?Sized> *const T {
where
T: Sized,
{
#[cfg(bootstrap)]
// SAFETY: the caller must uphold the safety contract for `offset`.
unsafe {
self.offset(count as isize)
}
#[cfg(not(bootstrap))]
// SAFETY: the caller must uphold the safety contract for `offset`.
unsafe {
intrinsics::offset(self, count)
}
unsafe { intrinsics::offset(self, count) }
}

/// Calculates the offset from a pointer in bytes (convenience for `.byte_offset(count as isize)`).
Expand Down Expand Up @@ -1195,7 +1187,7 @@ impl<T: ?Sized> *const T {
///
/// [`ptr::read`]: crate::ptr::read()
#[stable(feature = "pointer_methods", since = "1.26.0")]
#[rustc_const_stable(feature = "const_ptr_read", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "const_ptr_read", since = "1.71.0")]
#[inline]
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
pub const unsafe fn read(self) -> T
Expand Down Expand Up @@ -1236,7 +1228,7 @@ impl<T: ?Sized> *const T {
///
/// [`ptr::read_unaligned`]: crate::ptr::read_unaligned()
#[stable(feature = "pointer_methods", since = "1.26.0")]
#[rustc_const_stable(feature = "const_ptr_read", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "const_ptr_read", since = "1.71.0")]
#[inline]
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
pub const unsafe fn read_unaligned(self) -> T
Expand Down
4 changes: 2 additions & 2 deletions library/core/src/ptr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1139,7 +1139,7 @@ pub const unsafe fn replace<T>(dst: *mut T, mut src: T) -> T {
/// [valid]: self#safety
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_stable(feature = "const_ptr_read", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "const_ptr_read", since = "1.71.0")]
#[rustc_allow_const_fn_unstable(const_mut_refs, const_maybe_uninit_as_mut_ptr)]
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
pub const unsafe fn read<T>(src: *const T) -> T {
Expand Down Expand Up @@ -1256,7 +1256,7 @@ pub const unsafe fn read<T>(src: *const T) -> T {
/// ```
#[inline]
#[stable(feature = "ptr_unaligned", since = "1.17.0")]
#[rustc_const_stable(feature = "const_ptr_read", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "const_ptr_read", since = "1.71.0")]
#[rustc_allow_const_fn_unstable(const_mut_refs, const_maybe_uninit_as_mut_ptr)]
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
pub const unsafe fn read_unaligned<T>(src: *const T) -> T {
Expand Down
Loading

0 comments on commit e4f7ad8

Please sign in to comment.