Skip to content

Commit

Permalink
Bump cfg(bootstrap)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark-Simulacrum committed Aug 24, 2023
1 parent 068e3d9 commit 0a91606
Show file tree
Hide file tree
Showing 33 changed files with 38 additions and 69 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_abi/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![cfg_attr(feature = "nightly", feature(step_trait, rustc_attrs, min_specialization))]
#![cfg_attr(all(not(bootstrap), feature = "nightly"), allow(internal_features))]
#![cfg_attr(feature = "nightly", allow(internal_features))]

use std::fmt;
#[cfg(feature = "nightly")]
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_arena/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#![deny(unsafe_op_in_unsafe_fn)]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
#![cfg_attr(not(bootstrap), allow(internal_features))]
#![allow(internal_features)]
#![allow(clippy::mut_from_ref)] // Arena allocators are one of the places where this pattern is fine.

use smallvec::SmallVec;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#![feature(trusted_step)]
#![feature(try_blocks)]
#![recursion_limit = "256"]
#![cfg_attr(not(bootstrap), allow(internal_features))]
#![allow(internal_features)]

#[macro_use]
extern crate rustc_middle;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_data_structures/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#![allow(rustc::potential_query_instability)]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
#![cfg_attr(not(bootstrap), allow(internal_features))]
#![allow(internal_features)]
#![deny(unsafe_op_in_unsafe_fn)]

#[macro_use]
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_error_messages/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#![feature(type_alias_impl_trait)]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
#![cfg_attr(not(bootstrap), allow(internal_features))]
#![allow(internal_features)]

#[macro_use]
extern crate tracing;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_errors/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#![feature(box_patterns)]
#![feature(error_reporter)]
#![allow(incomplete_features)]
#![cfg_attr(not(bootstrap), allow(internal_features))]
#![allow(internal_features)]

#[macro_use]
extern crate rustc_macros;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_expand/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#![feature(try_blocks)]
#![recursion_limit = "256"]
#![deny(rustc::untranslatable_diagnostic)]
#![cfg_attr(not(bootstrap), allow(internal_features))]
#![allow(internal_features)]

#[macro_use]
extern crate rustc_macros;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#![recursion_limit = "256"]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
#![cfg_attr(not(bootstrap), allow(internal_features))]
#![allow(internal_features)]

#[macro_use]
extern crate rustc_macros;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_index/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
test
)
)]
#![cfg_attr(all(not(bootstrap), feature = "nightly"), allow(internal_features))]
#![cfg_attr(feature = "nightly", allow(internal_features))]

#[cfg(feature = "nightly")]
pub mod bit_set;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_lint/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#![recursion_limit = "256"]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
#![cfg_attr(not(bootstrap), allow(internal_features))]
#![allow(internal_features)]

#[macro_use]
extern crate rustc_middle;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#![allow(rustc::default_hash_types)]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
#![cfg_attr(not(bootstrap), allow(internal_features))]
#![allow(internal_features)]
#![recursion_limit = "128"]

use synstructure::decl_derive;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
#![feature(macro_metavar_expr)]
#![recursion_limit = "512"]
#![allow(rustc::potential_query_instability)]
#![cfg_attr(not(bootstrap), allow(internal_features))]
#![allow(internal_features)]

#[macro_use]
extern crate bitflags;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_parse/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#![feature(never_type)]
#![feature(rustc_attrs)]
#![recursion_limit = "256"]
#![cfg_attr(not(bootstrap), allow(internal_features))]
#![allow(internal_features)]

#[macro_use]
extern crate tracing;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_query_impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#![allow(rustc::potential_query_instability, unused_parens)]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
#![cfg_attr(not(bootstrap), allow(internal_features))]
#![allow(internal_features)]

#[macro_use]
extern crate rustc_middle;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_resolve/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#![recursion_limit = "256"]
#![allow(rustdoc::private_intra_doc_links)]
#![allow(rustc::potential_query_instability)]
#![cfg_attr(not(bootstrap), allow(internal_features))]
#![allow(internal_features)]

#[macro_use]
extern crate tracing;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_session/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#![allow(rustc::potential_query_instability)]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
#![cfg_attr(not(bootstrap), allow(internal_features))]
#![allow(internal_features)]

#[macro_use]
extern crate rustc_macros;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_span/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#![feature(round_char_boundary)]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
#![cfg_attr(not(bootstrap), allow(internal_features))]
#![allow(internal_features)]

#[macro_use]
extern crate rustc_macros;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_target/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#![feature(step_trait)]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
#![cfg_attr(not(bootstrap), allow(internal_features))]
#![allow(internal_features)]

use std::path::{Path, PathBuf};

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_type_ir/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#![feature(unwrap_infallible)]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
#![cfg_attr(not(bootstrap), allow(internal_features))]
#![allow(internal_features)]

#[macro_use]
extern crate bitflags;
Expand Down
4 changes: 2 additions & 2 deletions library/alloc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@
#![warn(missing_docs)]
#![allow(explicit_outlives_requirements)]
#![warn(multiple_supertrait_upcastable)]
#![cfg_attr(not(bootstrap), allow(internal_features))]
#![cfg_attr(not(bootstrap), allow(rustdoc::redundant_explicit_links))]
#![allow(internal_features)]
#![allow(rustdoc::redundant_explicit_links)]
//
// Library features:
// tidy-alphabetical-start
Expand Down
1 change: 0 additions & 1 deletion library/alloc/tests/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2499,7 +2499,6 @@ fn test_into_flattened_size_overflow() {
let _ = v.into_flattened();
}

#[cfg(not(bootstrap))]
#[test]
fn test_box_zero_allocator() {
use core::{alloc::AllocError, cell::RefCell};
Expand Down
3 changes: 1 addition & 2 deletions library/core/src/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1893,8 +1893,7 @@ impl<T: ?Sized + fmt::Display> fmt::Display for RefMut<'_, T> {
/// on an _exclusive_ `UnsafeCell<T>`. Even though `T` and `UnsafeCell<T>` have the
/// same memory layout, the following is not allowed and undefined behavior:
///
#[cfg_attr(bootstrap, doc = "```rust,no_run")]
#[cfg_attr(not(bootstrap), doc = "```rust,compile_fail")]
/// ```rust,compile_fail
/// # use std::cell::UnsafeCell;
/// unsafe fn not_allowed<T>(ptr: &UnsafeCell<T>) -> &mut T {
/// let t = ptr as *const UnsafeCell<T> as *mut T;
Expand Down
16 changes: 0 additions & 16 deletions library/core/src/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2399,7 +2399,6 @@ extern "rust-intrinsic" {
/// that differs. That allows optimizations that can read in large chunks.
///
/// [valid]: crate::ptr#safety
#[cfg(not(bootstrap))]
#[rustc_const_unstable(feature = "const_intrinsic_compare_bytes", issue = "none")]
#[rustc_nounwind]
pub fn compare_bytes(left: *const u8, right: *const u8, bytes: usize) -> i32;
Expand Down Expand Up @@ -2844,18 +2843,3 @@ pub const unsafe fn write_bytes<T>(dst: *mut T, val: u8, count: usize) {
write_bytes(dst, val, count)
}
}

/// Backfill for bootstrap
#[cfg(bootstrap)]
pub unsafe fn compare_bytes(left: *const u8, right: *const u8, bytes: usize) -> i32 {
extern "C" {
fn memcmp(s1: *const u8, s2: *const u8, n: usize) -> crate::ffi::c_int;
}

if bytes != 0 {
// SAFETY: Since bytes is non-zero, the caller has met `memcmp`'s requirements.
unsafe { memcmp(left, right, bytes).into() }
} else {
0
}
}
6 changes: 3 additions & 3 deletions library/core/src/intrinsics/mir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
//!
//! ```rust
//! #![feature(core_intrinsics, custom_mir)]
#![cfg_attr(not(bootstrap), doc = "#![allow(internal_features)]")]
//! #![allow(internal_features)]
//!
//! use core::intrinsics::mir::*;
//!
Expand Down Expand Up @@ -64,7 +64,7 @@
//!
//! ```rust
//! #![feature(core_intrinsics, custom_mir)]
#![cfg_attr(not(bootstrap), doc = "#![allow(internal_features)]")]
//! #![allow(internal_features)]
//!
//! use core::intrinsics::mir::*;
//!
Expand Down Expand Up @@ -318,7 +318,7 @@ define!(
/// # Examples
///
/// ```rust
#[cfg_attr(not(bootstrap), doc = "#![allow(internal_features)]")]
/// #![allow(internal_features)]
/// #![feature(custom_mir, core_intrinsics)]
///
/// use core::intrinsics::mir::*;
Expand Down
4 changes: 2 additions & 2 deletions library/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@
#![allow(explicit_outlives_requirements)]
#![allow(incomplete_features)]
#![warn(multiple_supertrait_upcastable)]
#![cfg_attr(not(bootstrap), allow(internal_features))]
#![allow(internal_features)]
// Do not check link redundancy on bootstraping phase
#![cfg_attr(not(bootstrap), allow(rustdoc::redundant_explicit_links))]
#![allow(rustdoc::redundant_explicit_links)]
//
// Library features:
// tidy-alphabetical-start
Expand Down
2 changes: 1 addition & 1 deletion library/panic_abort/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#![feature(staged_api)]
#![feature(rustc_attrs)]
#![feature(c_unwind)]
#![cfg_attr(not(bootstrap), allow(internal_features))]
#![allow(internal_features)]

#[cfg(target_os = "android")]
mod android;
Expand Down
3 changes: 1 addition & 2 deletions library/panic_unwind/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,13 @@
#![feature(panic_unwind)]
#![feature(staged_api)]
#![feature(std_internals)]
#![cfg_attr(bootstrap, feature(abi_thiscall))]
#![feature(rustc_attrs)]
#![panic_runtime]
#![feature(panic_runtime)]
#![feature(c_unwind)]
// `real_imp` is unused with Miri, so silence warnings.
#![cfg_attr(miri, allow(dead_code))]
#![cfg_attr(not(bootstrap), allow(internal_features))]
#![allow(internal_features)]

use alloc::boxed::Box;
use core::any::Any;
Expand Down
2 changes: 1 addition & 1 deletion library/proc_macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#![feature(min_specialization)]
#![feature(strict_provenance)]
#![recursion_limit = "256"]
#![cfg_attr(not(bootstrap), allow(internal_features))]
#![allow(internal_features)]

#[unstable(feature = "proc_macro_internals", issue = "27812")]
#[doc(hidden)]
Expand Down
2 changes: 1 addition & 1 deletion library/profiler_builtins/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
issue = "none"
)]
#![allow(unused_features)]
#![cfg_attr(not(bootstrap), allow(internal_features))]
#![allow(internal_features)]
#![feature(staged_api)]
4 changes: 2 additions & 2 deletions library/std/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,10 @@
#![warn(missing_debug_implementations)]
#![allow(explicit_outlives_requirements)]
#![allow(unused_lifetimes)]
#![cfg_attr(not(bootstrap), allow(internal_features))]
#![allow(internal_features)]
#![deny(rustc::existing_doc_keyword)]
#![deny(fuzzy_provenance_casts)]
#![cfg_attr(not(bootstrap), allow(rustdoc::redundant_explicit_links))]
#![allow(rustdoc::redundant_explicit_links)]
// Ensure that std can be linked against panic_abort despite compiled with `-C panic=unwind`
#![deny(ffi_unwind_calls)]
// std may use features in a platform-specific way
Expand Down
2 changes: 1 addition & 1 deletion library/test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#![feature(process_exitcode_internals)]
#![feature(panic_can_unwind)]
#![feature(test)]
#![cfg_attr(not(bootstrap), allow(internal_features))]
#![allow(internal_features)]

// Public reexports
pub use self::bench::{black_box, Bencher};
Expand Down
2 changes: 1 addition & 1 deletion library/unwind/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#![feature(c_unwind)]
#![feature(cfg_target_abi)]
#![cfg_attr(not(target_env = "msvc"), feature(libc))]
#![cfg_attr(not(bootstrap), allow(internal_features))]
#![allow(internal_features)]

cfg_if::cfg_if! {
if #[cfg(target_env = "msvc")] {
Expand Down
18 changes: 3 additions & 15 deletions src/tools/compiletest/src/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2354,14 +2354,7 @@ impl<'test> TestCx<'test> {
// Hide line numbers to reduce churn
rustc.arg("-Zui-testing");
rustc.arg("-Zdeduplicate-diagnostics=no");
// #[cfg(not(bootstrap)] unconditionally pass flag after beta bump
// since `ui-fulldeps --stage=1` builds using the stage 0 compiler,
// which doesn't have this flag.
if !(self.config.stage_id.starts_with("stage1-")
&& self.config.suite == "ui-fulldeps")
{
rustc.arg("-Zwrite-long-types-to-disk=no");
}
rustc.arg("-Zwrite-long-types-to-disk=no");
// FIXME: use this for other modes too, for perf?
rustc.arg("-Cstrip=debuginfo");
}
Expand Down Expand Up @@ -2483,13 +2476,8 @@ impl<'test> TestCx<'test> {
rustc.args(&["-A", "unused"]);
}

// #[cfg(not(bootstrap)] unconditionally pass flag after beta bump
// since `ui-fulldeps --stage=1` builds using the stage 0 compiler,
// which doesn't have this lint.
if !(self.config.stage_id.starts_with("stage1-") && self.config.suite == "ui-fulldeps") {
// Allow tests to use internal features.
rustc.args(&["-A", "internal_features"]);
}
// Allow tests to use internal features.
rustc.args(&["-A", "internal_features"]);

if self.props.force_host {
self.maybe_add_external_args(&mut rustc, &self.config.host_rustcflags);
Expand Down

0 comments on commit 0a91606

Please sign in to comment.