Skip to content

Commit

Permalink
Auto merge of rust-lang#107297 - Mark-Simulacrum:bump-bootstrap, r=pi…
Browse files Browse the repository at this point in the history
…etroalbini

Bump bootstrap compiler to 1.68

This also changes our stage0.json to include the rustc component for the rustfmt pinned nightly toolchain, which is currently necessary due to rustfmt dynamically linking to that toolchain's librustc_driver and libstd.

r? `@pietroalbini`
  • Loading branch information
bors committed Jan 31, 2023
2 parents f361413 + 652f79e commit dc1d9d5
Show file tree
Hide file tree
Showing 21 changed files with 447 additions and 425 deletions.
18 changes: 9 additions & 9 deletions compiler/rustc_const_eval/src/interpret/intern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ use super::{
use crate::const_eval;

pub trait CompileTimeMachine<'mir, 'tcx, T> = Machine<
'mir,
'tcx,
MemoryKind = T,
Provenance = AllocId,
ExtraFnVal = !,
FrameExtra = (),
AllocExtra = (),
MemoryMap = FxIndexMap<AllocId, (MemoryKind<T>, Allocation)>,
>;
'mir,
'tcx,
MemoryKind = T,
Provenance = AllocId,
ExtraFnVal = !,
FrameExtra = (),
AllocExtra = (),
MemoryMap = FxIndexMap<AllocId, (MemoryKind<T>, Allocation)>,
>;

struct InternVisitor<'rt, 'mir, 'tcx, M: CompileTimeMachine<'mir, 'tcx, const_eval::MemoryKind>> {
/// The ectx from which we intern.
Expand Down
5 changes: 1 addition & 4 deletions compiler/rustc_data_structures/src/obligation_forest/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,7 @@ pub trait ForestObligation: Clone + Debug {
pub trait ObligationProcessor {
type Obligation: ForestObligation;
type Error: Debug;
type OUT: OutcomeTrait<
Obligation = Self::Obligation,
Error = Error<Self::Obligation, Self::Error>,
>;
type OUT: OutcomeTrait<Obligation = Self::Obligation, Error = Error<Self::Obligation, Self::Error>>;

fn needs_process_obligation(&self, obligation: &Self::Obligation) -> bool;

Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_feature/src/accepted.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ declare_features! (
/// Allows `#[target_feature(...)]` on aarch64 platforms
(accepted, aarch64_target_feature, "1.61.0", Some(44839), None),
/// Allows using the `efiapi` ABI.
(accepted, abi_efiapi, "CURRENT_RUSTC_VERSION", Some(65815), None),
(accepted, abi_efiapi, "1.68.0", Some(65815), None),
/// Allows the sysV64 ABI to be specified on all platforms
/// instead of just the platforms on which it is the C ABI.
(accepted, abi_sysv64, "1.24.0", Some(36167), None),
Expand Down Expand Up @@ -129,7 +129,7 @@ declare_features! (
/// Allows `crate` in paths.
(accepted, crate_in_paths, "1.30.0", Some(45477), None),
/// Allows rustc to inject a default alloc_error_handler
(accepted, default_alloc_error_handler, "CURRENT_RUSTC_VERSION", Some(66741), None),
(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.
(accepted, default_type_params, "1.0.0", None, None),
/// Allows `#[deprecated]` attribute.
Expand Down Expand Up @@ -164,7 +164,7 @@ declare_features! (
/// Allows access to crate names passed via `--extern` through prelude.
(accepted, extern_prelude, "1.30.0", Some(44660), None),
/// Allows using F16C intrinsics from `core::arch::{x86, x86_64}`.
(accepted, f16c_target_feature, "CURRENT_RUSTC_VERSION", Some(44839), None),
(accepted, f16c_target_feature, "1.68.0", Some(44839), None),
/// Allows field shorthands (`x` meaning `x: x`) in struct literal expressions.
(accepted, field_init_shorthand, "1.17.0", Some(37340), None),
/// Allows `#[must_use]` on functions, and introduces must-use operators (RFC 1940).
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_feature/src/active.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ declare_features! (
/// Allows `async {}` expressions in const contexts.
(active, const_async_blocks, "1.53.0", Some(85368), None),
/// Allows `const || {}` closures in const contexts.
(incomplete, const_closures, "CURRENT_RUSTC_VERSION", Some(106003), None),
(incomplete, const_closures, "1.68.0", Some(106003), None),
/// Allows limiting the evaluation steps of const expressions
(active, const_eval_limit, "1.43.0", Some(67217), None),
/// Allows the definition of `const extern fn` and `const unsafe extern fn`.
Expand Down
2 changes: 1 addition & 1 deletion library/alloc/src/collections/vec_deque/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ impl<T> VecDeque<T> {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_stable(feature = "const_vec_deque_new", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "const_vec_deque_new", since = "1.68.0")]
#[must_use]
pub const fn new() -> VecDeque<T> {
// FIXME: This should just be `VecDeque::new_in(Global)` once that hits stable.
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 @@ -2549,7 +2549,7 @@ impl ToString for char {
}

#[cfg(not(no_global_oom_handling))]
#[stable(feature = "bool_to_string_specialization", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "bool_to_string_specialization", since = "1.68.0")]
impl ToString for bool {
#[inline]
fn to_string(&self) -> String {
Expand Down
40 changes: 3 additions & 37 deletions library/core/src/cmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -798,16 +798,7 @@ pub trait Ord: Eq + PartialOrd<Self> {
Self: Sized,
Self: ~const Destruct,
{
#[cfg(not(bootstrap))]
{
max_by(self, other, Ord::cmp)
}

#[cfg(bootstrap)]
match self.cmp(&other) {
Ordering::Less | Ordering::Equal => other,
Ordering::Greater => self,
}
max_by(self, other, Ord::cmp)
}

/// Compares and returns the minimum of two values.
Expand All @@ -828,16 +819,7 @@ pub trait Ord: Eq + PartialOrd<Self> {
Self: Sized,
Self: ~const Destruct,
{
#[cfg(not(bootstrap))]
{
min_by(self, other, Ord::cmp)
}

#[cfg(bootstrap)]
match self.cmp(&other) {
Ordering::Less | Ordering::Equal => self,
Ordering::Greater => other,
}
min_by(self, other, Ord::cmp)
}

/// Restrict a value to a certain interval.
Expand Down Expand Up @@ -1234,23 +1216,7 @@ where
F: ~const Destruct,
K: ~const Destruct,
{
cfg_if! {
if #[cfg(bootstrap)] {
const fn imp<T, F: ~const FnMut(&T) -> K, K: ~const Ord>(
f: &mut F,
(v1, v2): (&T, &T),
) -> Ordering
where
T: ~const Destruct,
K: ~const Destruct,
{
f(v1).cmp(&f(v2))
}
min_by(v1, v2, ConstFnMutClosure::new(&mut f, imp))
} else {
min_by(v1, v2, const |v1, v2| f(v1).cmp(&f(v2)))
}
}
min_by(v1, v2, const |v1, v2| f(v1).cmp(&f(v2)))
}

/// Compares and returns the maximum of two values.
Expand Down
4 changes: 2 additions & 2 deletions library/core/src/convert/num.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ impl_from! { u32, f64, #[stable(feature = "lossless_float_conv", since = "1.6.0"
impl_from! { f32, f64, #[stable(feature = "lossless_float_conv", since = "1.6.0")] }

// bool -> Float
#[stable(feature = "float_from_bool", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "float_from_bool", since = "1.68.0")]
#[rustc_const_unstable(feature = "const_num_from_num", issue = "87852")]
impl const From<bool> for f32 {
/// Converts `bool` to `f32` losslessly.
Expand All @@ -178,7 +178,7 @@ impl const From<bool> for f32 {
small as u8 as Self
}
}
#[stable(feature = "float_from_bool", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "float_from_bool", since = "1.68.0")]
#[rustc_const_unstable(feature = "const_num_from_num", issue = "87852")]
impl const From<bool> for f64 {
/// Converts `bool` to `f64` losslessly.
Expand Down
2 changes: 0 additions & 2 deletions library/core/src/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ use crate::marker::DiscriminantKind;
use crate::marker::Tuple;
use crate::mem;

#[cfg(not(bootstrap))]
pub mod mir;

// These imports are used for simplifying intra-doc links
Expand Down Expand Up @@ -963,7 +962,6 @@ extern "rust-intrinsic" {
/// This intrinsic does not have a stable counterpart.
#[rustc_const_unstable(feature = "const_assert_type2", issue = "none")]
#[rustc_safe_intrinsic]
#[cfg(not(bootstrap))]
pub fn assert_mem_uninitialized_valid<T>();

/// Gets a reference to a static `Location` indicating where it was called.
Expand Down
6 changes: 2 additions & 4 deletions library/core/src/intrinsics/mir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@
//!
//! # Examples
//!
#![cfg_attr(bootstrap, doc = "```rust,compile_fail")]
#![cfg_attr(not(bootstrap), doc = "```rust")]
//! ```rust
//! #![feature(core_intrinsics, custom_mir)]
//!
//! extern crate core;
Expand Down Expand Up @@ -300,8 +299,7 @@ define!(
///
/// # Examples
///
#[cfg_attr(bootstrap, doc = "```rust,compile_fail")]
#[cfg_attr(not(bootstrap), doc = "```rust")]
/// ```rust
/// #![feature(custom_mir, core_intrinsics)]
///
/// extern crate core;
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/iter/sources/once_with.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ pub struct OnceWith<F> {
gen: Option<F>,
}

#[stable(feature = "iter_once_with_debug", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "iter_once_with_debug", since = "1.68.0")]
impl<F> fmt::Debug for OnceWith<F> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
if self.gen.is_some() {
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/iter/sources/repeat_with.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ pub struct RepeatWith<F> {
repeater: F,
}

#[stable(feature = "iterator_repeat_with_debug", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "iterator_repeat_with_debug", since = "1.68.0")]
impl<F> fmt::Debug for RepeatWith<F> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("RepeatWith").finish_non_exhaustive()
Expand Down
3 changes: 1 addition & 2 deletions library/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@
#![feature(cfg_sanitize)]
#![feature(cfg_target_has_atomic)]
#![feature(cfg_target_has_atomic_equal_alignment)]
#![cfg_attr(not(bootstrap), feature(const_closures))]
#![feature(const_closures)]
#![feature(const_fn_floating_point_arithmetic)]
#![feature(const_mut_refs)]
#![feature(const_precise_live_drops)]
Expand Down Expand Up @@ -250,7 +250,6 @@
#![feature(sse4a_target_feature)]
#![feature(tbm_target_feature)]
#![feature(wasm_target_feature)]
#![cfg_attr(bootstrap, feature(f16c_target_feature))]

// allow using `core::` in intra-doc links
#[allow(unused_extern_crates)]
Expand Down
1 change: 0 additions & 1 deletion library/core/src/mem/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,6 @@ pub unsafe fn zeroed<T>() -> T {
pub unsafe fn uninitialized<T>() -> T {
// SAFETY: the caller must guarantee that an uninitialized value is valid for `T`.
unsafe {
#[cfg(not(bootstrap))] // If the compiler hits this itself then it deserves the UB.
intrinsics::assert_mem_uninitialized_valid::<T>();
let mut val = MaybeUninit::<T>::uninit();

Expand Down
5 changes: 2 additions & 3 deletions library/core/src/panicking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ pub const fn panic(expr: &'static str) -> ! {
/// Like `panic`, but without unwinding and track_caller to reduce the impact on codesize.
#[cfg_attr(not(feature = "panic_immediate_abort"), inline(never), cold)]
#[cfg_attr(feature = "panic_immediate_abort", inline)]
#[cfg_attr(not(bootstrap), lang = "panic_nounwind")] // needed by codegen for non-unwinding panics
#[lang = "panic_nounwind"] // needed by codegen for non-unwinding panics
#[rustc_nounwind]
pub fn panic_nounwind(expr: &'static str) -> ! {
panic_nounwind_fmt(fmt::Arguments::new_v1(&[expr], &[]));
Expand Down Expand Up @@ -165,8 +165,7 @@ fn panic_bounds_check(index: usize, len: usize) -> ! {
/// any extra arguments (including those synthesized by track_caller).
#[cfg_attr(not(feature = "panic_immediate_abort"), inline(never), cold)]
#[cfg_attr(feature = "panic_immediate_abort", inline)]
#[cfg_attr(bootstrap, lang = "panic_no_unwind")] // needed by codegen for panic in nounwind function
#[cfg_attr(not(bootstrap), lang = "panic_cannot_unwind")] // needed by codegen for panic in nounwind function
#[lang = "panic_cannot_unwind"] // needed by codegen for panic in nounwind function
#[rustc_nounwind]
fn panic_cannot_unwind() -> ! {
panic_nounwind("panic in a function that cannot unwind")
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/pin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1164,7 +1164,7 @@ impl<P, U> DispatchFromDyn<Pin<U>> for Pin<P> where P: DispatchFromDyn<U> {}
/// constructor.
///
/// [`Box::pin`]: ../../std/boxed/struct.Box.html#method.pin
#[stable(feature = "pin_macro", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "pin_macro", since = "1.68.0")]
#[rustc_macro_transparency = "semitransparent"]
#[allow_internal_unstable(unsafe_pin_internals)]
pub macro pin($value:expr $(,)?) {
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/task/wake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ impl RawWakerVTable {
/// Currently, `Context` only serves to provide access to a [`&Waker`](Waker)
/// which can be used to wake the current task.
#[stable(feature = "futures_api", since = "1.36.0")]
#[cfg_attr(not(bootstrap), lang = "Context")]
#[lang = "Context"]
pub struct Context<'a> {
waker: &'a Waker,
// Ensure we future-proof against variance changes by forcing
Expand Down
4 changes: 2 additions & 2 deletions library/std/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ pub const MAIN_SEPARATOR: char = crate::sys::path::MAIN_SEP;
/// The primary separator of path components for the current platform.
///
/// For example, `/` on Unix and `\` on Windows.
#[stable(feature = "main_separator_str", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "main_separator_str", since = "1.68.0")]
pub const MAIN_SEPARATOR_STR: &str = crate::sys::path::MAIN_SEP_STR;

////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -1778,7 +1778,7 @@ impl ops::Deref for PathBuf {
}
}

#[stable(feature = "path_buf_deref_mut", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "path_buf_deref_mut", since = "1.68.0")]
impl ops::DerefMut for PathBuf {
#[inline]
fn deref_mut(&mut self) -> &mut Path {
Expand Down
20 changes: 16 additions & 4 deletions src/bootstrap/download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,15 +318,27 @@ impl Config {
let channel = format!("{version}-{date}");

let host = self.build;
let rustfmt_path = self.initial_rustc.with_file_name(exe("rustfmt", host));
let bin_root = self.out.join(host.triple).join("stage0");
let bin_root = self.out.join(host.triple).join("rustfmt");
let rustfmt_path = bin_root.join("bin").join(exe("rustfmt", host));
let rustfmt_stamp = bin_root.join(".rustfmt-stamp");
if rustfmt_path.exists() && !program_out_of_date(&rustfmt_stamp, &channel) {
return Some(rustfmt_path);
}

let filename = format!("rustfmt-{version}-{build}.tar.xz", build = host.triple);
self.download_component(DownloadSource::Dist, filename, "rustfmt-preview", &date, "stage0");
self.download_component(
DownloadSource::Dist,
format!("rustfmt-{version}-{build}.tar.xz", build = host.triple),
"rustfmt-preview",
&date,
"rustfmt",
);
self.download_component(
DownloadSource::Dist,
format!("rustc-{version}-{build}.tar.xz", build = host.triple),
"rustc",
&date,
"rustfmt",
);

self.fix_bin_or_dylib(&bin_root.join("bin").join("rustfmt"));
self.fix_bin_or_dylib(&bin_root.join("bin").join("cargo-fmt"));
Expand Down
Loading

0 comments on commit dc1d9d5

Please sign in to comment.