Skip to content

Commit

Permalink
step cfgs
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark-Simulacrum committed Mar 20, 2024
1 parent e4c58eb commit 90e6154
Show file tree
Hide file tree
Showing 35 changed files with 48 additions and 145 deletions.
1 change: 0 additions & 1 deletion compiler/rustc_ast/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#![feature(box_patterns)]
#![feature(if_let_guard)]
#![feature(let_chains)]
#![cfg_attr(bootstrap, feature(min_specialization))]
#![feature(never_type)]
#![feature(negative_impls)]
#![feature(stmt_expr_attributes)]
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_errors/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#![allow(internal_features)]
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)]
#![cfg_attr(bootstrap, feature(min_specialization))]
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
#![doc(rust_logo)]
#![feature(array_windows)]
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_hir/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#![feature(associated_type_defaults)]
#![feature(closure_track_caller)]
#![feature(let_chains)]
#![cfg_attr(bootstrap, feature(min_specialization))]
#![feature(never_type)]
#![feature(rustc_attrs)]
#![feature(variant_count)]
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_hir_analysis/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ This API is completely unstable and subject to change.
#![feature(is_sorted)]
#![feature(iter_intersperse)]
#![feature(let_chains)]
#![cfg_attr(bootstrap, feature(min_specialization))]
#![feature(never_type)]
#![feature(lazy_cell)]
#![feature(slice_partition_dedup)]
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_hir_typeck/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#![feature(try_blocks)]
#![feature(never_type)]
#![feature(box_patterns)]
#![cfg_attr(bootstrap, feature(min_specialization))]
#![feature(control_flow_enum)]

#[macro_use]
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_infer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#![feature(let_chains)]
#![feature(if_let_guard)]
#![feature(iterator_try_collect)]
#![cfg_attr(bootstrap, feature(min_specialization))]
#![feature(try_blocks)]
#![recursion_limit = "512"] // For rustdoc

Expand Down
3 changes: 1 addition & 2 deletions compiler/rustc_middle/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
#![doc(rust_logo)]
#![cfg_attr(bootstrap, feature(exhaustive_patterns))]
#![cfg_attr(not(bootstrap), feature(min_exhaustive_patterns))]
#![feature(min_exhaustive_patterns)]
#![feature(rustdoc_internals)]
#![feature(allocator_api)]
#![feature(array_windows)]
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_mir_build/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#![feature(box_patterns)]
#![feature(if_let_guard)]
#![feature(let_chains)]
#![cfg_attr(bootstrap, feature(min_specialization))]
#![feature(try_blocks)]

#[macro_use]
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_mir_dataflow/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#![feature(box_patterns)]
#![feature(exact_size_is_empty)]
#![feature(let_chains)]
#![cfg_attr(bootstrap, feature(min_specialization))]
#![feature(try_blocks)]

#[macro_use]
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_mir_transform/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#![feature(is_sorted)]
#![feature(let_chains)]
#![feature(map_try_insert)]
#![cfg_attr(bootstrap, feature(min_specialization))]
#![feature(never_type)]
#![feature(option_get_or_insert_default)]
#![feature(round_char_boundary)]
Expand Down
4 changes: 1 addition & 3 deletions compiler/rustc_target/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
#![doc(rust_logo)]
#![cfg_attr(bootstrap, feature(exhaustive_patterns))]
#![cfg_attr(not(bootstrap), feature(min_exhaustive_patterns))]
#![feature(min_exhaustive_patterns)]
#![feature(rustdoc_internals)]
#![feature(assert_matches)]
#![feature(iter_intersperse)]
#![feature(let_chains)]
#![cfg_attr(bootstrap, feature(min_specialization))]
#![feature(rustc_attrs)]
#![feature(step_trait)]
#![allow(internal_features)]
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_trait_selection/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#![feature(option_take_if)]
#![feature(never_type)]
#![feature(type_alias_impl_trait)]
#![cfg_attr(bootstrap, feature(min_specialization))]
#![recursion_limit = "512"] // For rustdoc

#[macro_use]
Expand Down
5 changes: 2 additions & 3 deletions library/alloc/src/alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ extern "Rust" {
#[derive(Copy, Clone, Default, Debug)]
#[cfg(not(test))]
// the compiler needs to know when a Box uses the global allocator vs a custom one
#[cfg_attr(not(bootstrap), lang = "global_alloc_ty")]
#[lang = "global_alloc_ty"]
pub struct Global;

#[cfg(test)]
Expand Down Expand Up @@ -387,8 +387,7 @@ pub const fn handle_alloc_error(layout: Layout) -> ! {
}

#[cfg(not(feature = "panic_immediate_abort"))]
#[cfg_attr(not(bootstrap), allow(unused_unsafe))] // on bootstrap bump, remove unsafe block
unsafe {
{
core::intrinsics::const_eval_select((layout,), ct_error, rt_error)
}

Expand Down
2 changes: 1 addition & 1 deletion library/core/src/convert/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ pub trait AsMut<T: ?Sized> {
/// For example, take this code:
///
/// ```
/// # #![cfg_attr(not(bootstrap), allow(non_local_definitions))]
/// # #![allow(non_local_definitions)]
/// struct Wrapper<T>(Vec<T>);
/// impl<T> From<Wrapper<T>> for Vec<T> {
/// fn from(w: Wrapper<T>) -> Vec<T> {
Expand Down
10 changes: 2 additions & 8 deletions library/core/src/ffi/c_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -438,13 +438,7 @@ impl CStr {
unsafe { &*(bytes as *const [u8] as *const CStr) }
}

#[cfg_attr(not(bootstrap), allow(unused_unsafe))] // on bootstrap bump, remove unsafe block
// SAFETY: The const and runtime versions have identical behavior
// unless the safety contract of `from_bytes_with_nul_unchecked` is
// violated, which is UB.
unsafe {
intrinsics::const_eval_select((bytes,), const_impl, rt_impl)
}
intrinsics::const_eval_select((bytes,), const_impl, rt_impl)
}

/// Returns the inner pointer to this C string.
Expand Down Expand Up @@ -759,7 +753,7 @@ const unsafe fn const_strlen(ptr: *const c_char) -> usize {
unsafe { strlen(s) }
}

#[cfg_attr(not(bootstrap), allow(unused_unsafe))] // on bootstrap bump, remove unsafe block
#[allow(unused_unsafe)] // on bootstrap bump, remove unsafe block
// SAFETY: the two functions always provide equivalent functionality
unsafe {
intrinsics::const_eval_select((ptr,), strlen_ct, strlen_rt)
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 @@ -454,7 +454,7 @@ pub trait Hasher {
/// ```
/// #![feature(hasher_prefixfree_extras)]
/// # // Stubs to make the `impl` below pass the compiler
/// # #![cfg_attr(not(bootstrap), allow(non_local_definitions))]
/// # #![allow(non_local_definitions)]
/// # struct MyCollection<T>(Option<T>);
/// # impl<T> MyCollection<T> {
/// # fn len(&self) -> usize { todo!() }
Expand Down
Loading

0 comments on commit 90e6154

Please sign in to comment.