From 37332758543182005740e8e6ef2312bbc82576b6 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Sat, 13 Feb 2021 18:05:07 -0500 Subject: [PATCH 1/3] Update the bootstrap compiler Note this does not change `core::derive` since it was merged after the beta bump. --- compiler/rustc_arena/src/lib.rs | 1 - compiler/rustc_data_structures/src/lib.rs | 1 - compiler/rustc_serialize/src/lib.rs | 1 - library/alloc/src/lib.rs | 1 - library/alloc/src/task.rs | 4 - library/alloc/tests/slice.rs | 2 +- library/core/src/lib.rs | 1 - library/core/src/macros/mod.rs | 22 ----- library/core/src/mem/mod.rs | 8 -- library/core/tests/lib.rs | 3 - library/core/tests/mem.rs | 1 - library/std/src/lib.rs | 4 +- library/std/src/macros.rs | 15 ---- src/bootstrap/bootstrap.py | 3 +- src/bootstrap/builder.rs | 7 +- src/stage0.txt | 2 +- ...osure#5}.-------.InstrumentCoverage.0.html | 84 +++++++++---------- 17 files changed, 48 insertions(+), 112 deletions(-) diff --git a/compiler/rustc_arena/src/lib.rs b/compiler/rustc_arena/src/lib.rs index f17c43ceaff73..721cfdd4459e5 100644 --- a/compiler/rustc_arena/src/lib.rs +++ b/compiler/rustc_arena/src/lib.rs @@ -14,7 +14,6 @@ #![feature(dropck_eyepatch)] #![feature(new_uninit)] #![feature(maybe_uninit_slice)] -#![cfg_attr(bootstrap, feature(min_const_generics))] #![feature(min_specialization)] #![cfg_attr(test, feature(test))] diff --git a/compiler/rustc_data_structures/src/lib.rs b/compiler/rustc_data_structures/src/lib.rs index 5880bbd3de44e..4ab493d3cc915 100644 --- a/compiler/rustc_data_structures/src/lib.rs +++ b/compiler/rustc_data_structures/src/lib.rs @@ -26,7 +26,6 @@ #![feature(thread_id_value)] #![feature(extend_one)] #![feature(const_panic)] -#![cfg_attr(bootstrap, feature(min_const_generics))] #![feature(new_uninit)] #![feature(once_cell)] #![feature(maybe_uninit_uninit_array)] diff --git a/compiler/rustc_serialize/src/lib.rs b/compiler/rustc_serialize/src/lib.rs index 53c3adcc20c02..e439ddcdaa9df 100644 --- a/compiler/rustc_serialize/src/lib.rs +++ b/compiler/rustc_serialize/src/lib.rs @@ -13,7 +13,6 @@ Core encoding and decoding interfaces. #![feature(never_type)] #![feature(nll)] #![feature(associated_type_bounds)] -#![cfg_attr(bootstrap, feature(min_const_generics))] #![feature(min_specialization)] #![feature(vec_spare_capacity)] #![feature(core_intrinsics)] diff --git a/library/alloc/src/lib.rs b/library/alloc/src/lib.rs index 99c42a4ba4423..096fdf3fadb3f 100644 --- a/library/alloc/src/lib.rs +++ b/library/alloc/src/lib.rs @@ -118,7 +118,6 @@ #![feature(range_bounds_assert_len)] #![feature(rustc_attrs)] #![feature(receiver_trait)] -#![cfg_attr(bootstrap, feature(min_const_generics))] #![feature(min_specialization)] #![feature(set_ptr_value)] #![feature(slice_ptr_get)] diff --git a/library/alloc/src/task.rs b/library/alloc/src/task.rs index ab7611ae071e7..58a9ae77244fb 100644 --- a/library/alloc/src/task.rs +++ b/library/alloc/src/task.rs @@ -85,8 +85,6 @@ pub trait Wake { } } -#[cfg_attr(bootstrap, allow(rustc::ineffective_unstable_trait_impl))] -#[cfg_attr(not(bootstrap), allow(ineffective_unstable_trait_impl))] #[stable(feature = "wake_trait", since = "1.51.0")] impl From> for Waker { fn from(waker: Arc) -> Waker { @@ -96,8 +94,6 @@ impl From> for Waker { } } -#[cfg_attr(bootstrap, allow(rustc::ineffective_unstable_trait_impl))] -#[cfg_attr(not(bootstrap), allow(ineffective_unstable_trait_impl))] #[stable(feature = "wake_trait", since = "1.51.0")] impl From> for RawWaker { fn from(waker: Arc) -> RawWaker { diff --git a/library/alloc/tests/slice.rs b/library/alloc/tests/slice.rs index 777c10b1bf740..1fb4a51acfd0a 100644 --- a/library/alloc/tests/slice.rs +++ b/library/alloc/tests/slice.rs @@ -1798,7 +1798,7 @@ fn subslice_patterns() { macro_rules! c { ($inp:expr, $typ:ty, $out:expr $(,)?) => { - assert_eq!($out, identity::<$typ>($inp)); + assert_eq!($out, identity::<$typ>($inp)) }; } diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index 7c0e5ab8926ef..0d1a09a528db9 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -128,7 +128,6 @@ #![feature(repr_simd, platform_intrinsics)] #![feature(rustc_attrs)] #![feature(simd_ffi)] -#![cfg_attr(bootstrap, feature(min_const_generics))] #![feature(min_specialization)] #![feature(staged_api)] #![feature(std_internals)] diff --git a/library/core/src/macros/mod.rs b/library/core/src/macros/mod.rs index 97315769957d5..845d43efd6442 100644 --- a/library/core/src/macros/mod.rs +++ b/library/core/src/macros/mod.rs @@ -1,25 +1,3 @@ -#[cfg(bootstrap)] -#[doc(include = "panic.md")] -#[macro_export] -#[allow_internal_unstable(core_panic)] -#[stable(feature = "core", since = "1.6.0")] -#[rustc_diagnostic_item = "core_panic_macro"] -macro_rules! panic { - () => ( - $crate::panic!("explicit panic") - ); - ($msg:literal $(,)?) => ( - $crate::panicking::panic($msg) - ); - ($msg:expr $(,)?) => ( - $crate::panicking::panic_str($msg) - ); - ($fmt:expr, $($arg:tt)+) => ( - $crate::panicking::panic_fmt($crate::format_args!($fmt, $($arg)+)) - ); -} - -#[cfg(not(bootstrap))] #[doc(include = "panic.md")] #[macro_export] #[rustc_builtin_macro = "core_panic"] diff --git a/library/core/src/mem/mod.rs b/library/core/src/mem/mod.rs index 778e34e634f64..87890f9275929 100644 --- a/library/core/src/mem/mod.rs +++ b/library/core/src/mem/mod.rs @@ -4,7 +4,6 @@ //! types, initializing and manipulating memory. #![stable(feature = "rust1", since = "1.0.0")] -#![cfg_attr(bootstrap, allow(unused_unsafe))] use crate::clone; use crate::cmp; @@ -152,13 +151,6 @@ pub const fn forget(t: T) { #[inline] #[unstable(feature = "forget_unsized", issue = "none")] pub fn forget_unsized(t: T) { - #[cfg(bootstrap)] - // SAFETY: the forget intrinsic could be safe, but there's no point in making it safe since - // we'll be implementing this function soon via `ManuallyDrop` - unsafe { - intrinsics::forget(t) - } - #[cfg(not(bootstrap))] intrinsics::forget(t) } diff --git a/library/core/tests/lib.rs b/library/core/tests/lib.rs index 12182accc471a..9692724545f28 100644 --- a/library/core/tests/lib.rs +++ b/library/core/tests/lib.rs @@ -94,10 +94,7 @@ mod cell; mod char; mod clone; mod cmp; - -#[cfg(not(bootstrap))] mod const_ptr; - mod fmt; mod hash; mod intrinsics; diff --git a/library/core/tests/mem.rs b/library/core/tests/mem.rs index 38084f401bce6..c0b75036f4f3e 100644 --- a/library/core/tests/mem.rs +++ b/library/core/tests/mem.rs @@ -284,7 +284,6 @@ fn uninit_write_slice_cloned_no_drop() { } #[test] -#[cfg(not(bootstrap))] fn uninit_const_assume_init_read() { const FOO: u32 = unsafe { MaybeUninit::new(42).assume_init_read() }; assert_eq!(FOO, 42); diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs index 16733b7ccd353..441c68d213c9c 100644 --- a/library/std/src/lib.rs +++ b/library/std/src/lib.rs @@ -185,8 +185,8 @@ //! [other]: #what-is-in-the-standard-library-documentation //! [primitive types]: ../book/ch03-02-data-types.html //! [rust-discord]: https://discord.gg/rust-lang -#![cfg_attr(not(bootstrap), doc = "[array]: prim@array")] -#![cfg_attr(not(bootstrap), doc = "[slice]: prim@slice")] +//! [array]: prim@array +//! [slice]: prim@slice #![cfg_attr(not(feature = "restricted-std"), stable(feature = "rust1", since = "1.0.0"))] #![cfg_attr(feature = "restricted-std", unstable(feature = "restricted_std", issue = "none"))] #![doc( diff --git a/library/std/src/macros.rs b/library/std/src/macros.rs index 0ce6542cb7253..c0750f8c0d1b0 100644 --- a/library/std/src/macros.rs +++ b/library/std/src/macros.rs @@ -4,21 +4,6 @@ //! library. Each macro is available for use when linking against the standard //! library. -#[cfg(bootstrap)] -#[doc(include = "../../core/src/macros/panic.md")] -#[macro_export] -#[stable(feature = "rust1", since = "1.0.0")] -#[allow_internal_unstable(libstd_sys_internals)] -#[cfg_attr(not(test), rustc_diagnostic_item = "std_panic_macro")] -macro_rules! panic { - () => ({ $crate::panic!("explicit panic") }); - ($msg:expr $(,)?) => ({ $crate::rt::begin_panic($msg) }); - ($fmt:expr, $($arg:tt)+) => ({ - $crate::rt::begin_panic_fmt(&$crate::format_args!($fmt, $($arg)+)) - }); -} - -#[cfg(not(bootstrap))] #[doc(include = "../../core/src/macros/panic.md")] #[macro_export] #[rustc_builtin_macro = "std_panic"] diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index a438e920b7bc6..3042a1297b807 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -877,8 +877,7 @@ def build_bootstrap(self): target_linker = self.get_toml("linker", build_section) if target_linker is not None: env["RUSTFLAGS"] += " -C linker=" + target_linker - # cfg(bootstrap): Add `-Wsemicolon_in_expressions_from_macros` after the next beta bump - env["RUSTFLAGS"] += " -Wrust_2018_idioms -Wunused_lifetimes" + env["RUSTFLAGS"] += " -Wrust_2018_idioms -Wunused_lifetimes -Wsemicolon_in_expressions_from_macros" if self.get_toml("deny-warnings", "rust") != "false": env["RUSTFLAGS"] += " -Dwarnings" diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index a9099981e644a..290a334827572 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -1279,12 +1279,7 @@ impl<'a> Builder<'a> { // some code doesn't go through this `rustc` wrapper. lint_flags.push("-Wrust_2018_idioms"); lint_flags.push("-Wunused_lifetimes"); - // cfg(bootstrap): unconditionally enable this warning after the next beta bump - // This is currently disabled for the stage1 libstd, since build scripts - // will end up using the bootstrap compiler (which doesn't yet support this lint) - if compiler.stage != 0 && mode != Mode::Std { - lint_flags.push("-Wsemicolon_in_expressions_from_macros"); - } + lint_flags.push("-Wsemicolon_in_expressions_from_macros"); if self.config.deny_warnings { lint_flags.push("-Dwarnings"); diff --git a/src/stage0.txt b/src/stage0.txt index d3c76eb282a7e..4a53d1a60d174 100644 --- a/src/stage0.txt +++ b/src/stage0.txt @@ -12,7 +12,7 @@ # stable release's version number. `date` is the date where the release we're # bootstrapping off was released. -date: 2020-12-30 +date: 2021-02-14 rustc: beta # We use a nightly rustfmt to format the source because it solves some diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#5}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#5}.-------.InstrumentCoverage.0.html index 8ba7a6187fdb4..1c19aa8eeefaa 100644 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#5}.-------.InstrumentCoverage.0.html +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#5}.-------.InstrumentCoverage.0.html @@ -69,47 +69,47 @@ -
@0,1,2⦊{ - $crate::io::_print($crate::format_args_nl!($($arg)*)); - }⦉@0,1,2
+
@0,1,2⦊{ + $crate::io::_print($crate::format_args_nl!($($arg)*)); + }⦉@0,1,2
From 7179be87899ff7730abccca598e987544132ca67 Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Sun, 14 Feb 2021 08:56:35 -0500 Subject: [PATCH 2/3] Don't apply semicolon in expressions from macros yet std_detect is still using this and as it's in a submodule updating it will be a pain. We can catch this either after a stdarch submodule bump or just on the next cycle. --- src/bootstrap/bootstrap.py | 3 ++- src/bootstrap/builder.rs | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index 3042a1297b807..a438e920b7bc6 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -877,7 +877,8 @@ def build_bootstrap(self): target_linker = self.get_toml("linker", build_section) if target_linker is not None: env["RUSTFLAGS"] += " -C linker=" + target_linker - env["RUSTFLAGS"] += " -Wrust_2018_idioms -Wunused_lifetimes -Wsemicolon_in_expressions_from_macros" + # cfg(bootstrap): Add `-Wsemicolon_in_expressions_from_macros` after the next beta bump + env["RUSTFLAGS"] += " -Wrust_2018_idioms -Wunused_lifetimes" if self.get_toml("deny-warnings", "rust") != "false": env["RUSTFLAGS"] += " -Dwarnings" diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 290a334827572..a9099981e644a 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -1279,7 +1279,12 @@ impl<'a> Builder<'a> { // some code doesn't go through this `rustc` wrapper. lint_flags.push("-Wrust_2018_idioms"); lint_flags.push("-Wunused_lifetimes"); - lint_flags.push("-Wsemicolon_in_expressions_from_macros"); + // cfg(bootstrap): unconditionally enable this warning after the next beta bump + // This is currently disabled for the stage1 libstd, since build scripts + // will end up using the bootstrap compiler (which doesn't yet support this lint) + if compiler.stage != 0 && mode != Mode::Std { + lint_flags.push("-Wsemicolon_in_expressions_from_macros"); + } if self.config.deny_warnings { lint_flags.push("-Dwarnings"); From b1a4bca3e6a03eb59d4ef748a32448226015a2f5 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Tue, 16 Feb 2021 21:34:28 -0500 Subject: [PATCH 3/3] Use the new name for `split-debuginfo` --- src/bootstrap/builder.rs | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index a9099981e644a..bbc216b9e6c48 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -1160,18 +1160,10 @@ impl<'a> Builder<'a> { // itself, we skip it by default since we know it's safe to do so in that case. // See https://github.com/rust-lang/rust/issues/79361 for more info on this flag. if target.contains("apple") { - if stage == 0 { - if self.config.rust_run_dsymutil { - rustflags.arg("-Zrun-dsymutil=yes"); - } else { - rustflags.arg("-Zrun-dsymutil=no"); - } + if self.config.rust_run_dsymutil { + rustflags.arg("-Csplit-debuginfo=packed"); } else { - if self.config.rust_run_dsymutil { - rustflags.arg("-Csplit-debuginfo=packed"); - } else { - rustflags.arg("-Csplit-debuginfo=unpacked"); - } + rustflags.arg("-Csplit-debuginfo=unpacked"); } }