Skip to content

Commit 201ec7c

Browse files
committed
Update cfg(bootstrap)
1 parent 315e9d8 commit 201ec7c

File tree

29 files changed

+26
-142
lines changed

29 files changed

+26
-142
lines changed

compiler/rustc_builtin_macros/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
#![allow(internal_features)]
66
#![allow(rustc::diagnostic_outside_of_impl)]
77
#![allow(rustc::untranslatable_diagnostic)]
8-
#![cfg_attr(not(bootstrap), feature(autodiff))]
98
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
109
#![doc(rust_logo)]
1110
#![feature(assert_matches)]
11+
#![feature(autodiff)]
1212
#![feature(box_patterns)]
1313
#![feature(decl_macro)]
1414
#![feature(if_let_guard)]

compiler/rustc_data_structures/src/aligned.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1+
use std::marker::PointeeSized;
12
use std::ptr::Alignment;
23

3-
use rustc_serialize::PointeeSized;
4-
54
/// Returns the ABI-required minimum alignment of a type in bytes.
65
///
76
/// This is equivalent to [`align_of`], but also works for some unsized

compiler/rustc_data_structures/src/flock.rs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,7 @@
44
//! green/native threading. This is just a bare-bones enough solution for
55
//! librustdoc, it is not production quality at all.
66
7-
// cfg(bootstrap)
8-
macro_rules! cfg_select_dispatch {
9-
($($tokens:tt)*) => {
10-
#[cfg(bootstrap)]
11-
cfg_match! { $($tokens)* }
12-
13-
#[cfg(not(bootstrap))]
14-
cfg_select! { $($tokens)* }
15-
};
16-
}
17-
18-
cfg_select_dispatch! {
7+
cfg_select! {
198
target_os = "linux" => {
209
mod linux;
2110
use linux as imp;

compiler/rustc_data_structures/src/lib.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
#![allow(internal_features)]
1111
#![allow(rustc::default_hash_types)]
1212
#![allow(rustc::potential_query_instability)]
13-
#![cfg_attr(bootstrap, feature(cfg_match))]
14-
#![cfg_attr(not(bootstrap), feature(cfg_select))]
15-
#![cfg_attr(not(bootstrap), feature(sized_hierarchy))]
1613
#![deny(unsafe_op_in_unsafe_fn)]
1714
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
1815
#![doc(rust_logo)]
@@ -22,6 +19,7 @@
2219
#![feature(ascii_char_variants)]
2320
#![feature(assert_matches)]
2421
#![feature(auto_traits)]
22+
#![feature(cfg_select)]
2523
#![feature(core_intrinsics)]
2624
#![feature(dropck_eyepatch)]
2725
#![feature(extend_one)]
@@ -33,6 +31,7 @@
3331
#![feature(ptr_alignment_type)]
3432
#![feature(rustc_attrs)]
3533
#![feature(rustdoc_internals)]
34+
#![feature(sized_hierarchy)]
3635
#![feature(test)]
3736
#![feature(thread_id_value)]
3837
#![feature(type_alias_impl_trait)]
@@ -44,9 +43,6 @@ use std::fmt;
4443
pub use atomic_ref::AtomicRef;
4544
pub use ena::{snapshot_vec, undo_log, unify};
4645
pub use rustc_index::static_assert_size;
47-
// re-exported for `rustc_smir`
48-
// FIXME(sized_hierarchy): remove with `cfg(bootstrap)`, see `rustc_serialize/src/lib.rs`
49-
pub use rustc_serialize::PointeeSized;
5046

5147
pub mod aligned;
5248
pub mod base_n;

compiler/rustc_data_structures/src/marker.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use std::alloc::Allocator;
2-
3-
use rustc_serialize::PointeeSized;
2+
use std::marker::PointeeSized;
43

54
#[diagnostic::on_unimplemented(message = "`{Self}` doesn't implement `DynSend`. \
65
Add it to `rustc_data_structures::marker` or use `IntoDynSyncSend` if it's already `Send`")]

compiler/rustc_data_structures/src/profiling.rs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -859,19 +859,8 @@ fn get_thread_id() -> u32 {
859859
std::thread::current().id().as_u64().get() as u32
860860
}
861861

862-
// cfg(bootstrap)
863-
macro_rules! cfg_select_dispatch {
864-
($($tokens:tt)*) => {
865-
#[cfg(bootstrap)]
866-
cfg_match! { $($tokens)* }
867-
868-
#[cfg(not(bootstrap))]
869-
cfg_select! { $($tokens)* }
870-
};
871-
}
872-
873862
// Memory reporting
874-
cfg_select_dispatch! {
863+
cfg_select! {
875864
windows => {
876865
pub fn get_resident_set_size() -> Option<usize> {
877866
use windows::{

compiler/rustc_errors/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
#![allow(incomplete_features)]
77
#![allow(internal_features)]
88
#![allow(rustc::diagnostic_outside_of_impl)]
9+
#![allow(rustc::direct_use_of_rustc_type_ir)]
910
#![allow(rustc::untranslatable_diagnostic)]
10-
#![cfg_attr(not(bootstrap), allow(rustc::direct_use_of_rustc_type_ir))]
1111
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
1212
#![doc(rust_logo)]
1313
#![feature(array_windows)]

compiler/rustc_infer/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
// tidy-alphabetical-start
1616
#![allow(internal_features)]
1717
#![allow(rustc::diagnostic_outside_of_impl)]
18+
#![allow(rustc::direct_use_of_rustc_type_ir)]
1819
#![allow(rustc::untranslatable_diagnostic)]
19-
#![cfg_attr(not(bootstrap), allow(rustc::direct_use_of_rustc_type_ir))]
2020
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
2121
#![doc(rust_logo)]
2222
#![feature(assert_matches)]

compiler/rustc_middle/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,8 @@
2727
// tidy-alphabetical-start
2828
#![allow(internal_features)]
2929
#![allow(rustc::diagnostic_outside_of_impl)]
30+
#![allow(rustc::direct_use_of_rustc_type_ir)]
3031
#![allow(rustc::untranslatable_diagnostic)]
31-
#![cfg_attr(not(bootstrap), allow(rustc::direct_use_of_rustc_type_ir))]
32-
#![cfg_attr(not(bootstrap), feature(sized_hierarchy))]
3332
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
3433
#![doc(rust_logo)]
3534
#![feature(allocator_api)]
@@ -56,6 +55,7 @@
5655
#![feature(round_char_boundary)]
5756
#![feature(rustc_attrs)]
5857
#![feature(rustdoc_internals)]
58+
#![feature(sized_hierarchy)]
5959
#![feature(try_blocks)]
6060
#![feature(try_trait_v2)]
6161
#![feature(try_trait_v2_yeet)]

compiler/rustc_middle/src/ty/codec.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
99
use std::hash::Hash;
1010
use std::intrinsics;
11-
use std::marker::DiscriminantKind;
11+
use std::marker::{DiscriminantKind, PointeeSized};
1212

1313
use rustc_abi::{FieldIdx, VariantIdx};
1414
use rustc_data_structures::fx::FxHashMap;
1515
use rustc_hir::def_id::LocalDefId;
16-
use rustc_serialize::{Decodable, Encodable, PointeeSized};
16+
use rustc_serialize::{Decodable, Encodable};
1717
use rustc_span::source_map::Spanned;
1818
use rustc_span::{Span, SpanDecoder, SpanEncoder};
1919

compiler/rustc_middle/src/ty/context.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use std::cmp::Ordering;
1010
use std::env::VarError;
1111
use std::ffi::OsStr;
1212
use std::hash::{Hash, Hasher};
13-
use std::marker::PhantomData;
13+
use std::marker::{PhantomData, PointeeSized};
1414
use std::ops::{Bound, Deref};
1515
use std::sync::{Arc, OnceLock};
1616
use std::{fmt, iter, mem};
@@ -43,7 +43,6 @@ use rustc_macros::{HashStable, TyDecodable, TyEncodable};
4343
use rustc_query_system::cache::WithDepNode;
4444
use rustc_query_system::dep_graph::DepNodeIndex;
4545
use rustc_query_system::ich::StableHashingContext;
46-
use rustc_serialize::PointeeSized;
4746
use rustc_serialize::opaque::{FileEncodeResult, FileEncoder};
4847
use rustc_session::config::CrateType;
4948
use rustc_session::cstore::{CrateStoreDyn, Untracked};

compiler/rustc_next_trait_solver/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
//! So if you got to this crate from the old solver, it's totally normal.
66
77
// tidy-alphabetical-start
8+
#![allow(rustc::direct_use_of_rustc_type_ir)]
89
#![allow(rustc::usage_of_type_ir_inherent)]
910
#![allow(rustc::usage_of_type_ir_traits)]
10-
#![cfg_attr(not(bootstrap), allow(rustc::direct_use_of_rustc_type_ir))]
1111
// tidy-alphabetical-end
1212

1313
pub mod canonicalizer;

compiler/rustc_serialize/src/lib.rs

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// tidy-alphabetical-start
44
#![allow(internal_features)]
55
#![allow(rustc::internal)]
6-
#![cfg_attr(not(bootstrap), feature(sized_hierarchy))]
76
#![cfg_attr(test, feature(test))]
87
#![doc(
98
html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/",
@@ -15,6 +14,7 @@
1514
#![feature(min_specialization)]
1615
#![feature(never_type)]
1716
#![feature(rustdoc_internals)]
17+
#![feature(sized_hierarchy)]
1818
// tidy-alphabetical-end
1919

2020
// Allows macros to refer to this crate as `::rustc_serialize`.
@@ -28,19 +28,3 @@ mod serialize;
2828
pub mod int_overflow;
2929
pub mod leb128;
3030
pub mod opaque;
31-
32-
// This has nothing to do with `rustc_serialize` but it is convenient to define it in one place
33-
// for the rest of the compiler so that `cfg(bootstrap)` doesn't need to be littered throughout
34-
// the compiler wherever `PointeeSized` would be used. `rustc_serialize` happens to be the deepest
35-
// crate in the crate graph which uses `PointeeSized`.
36-
//
37-
// When bootstrap bumps, remove both the `cfg(not(bootstrap))` and `cfg(bootstrap)` lines below
38-
// and just import `std::marker::PointeeSized` whereever this item was used.
39-
40-
#[cfg(not(bootstrap))]
41-
pub use std::marker::PointeeSized;
42-
43-
#[cfg(bootstrap)]
44-
pub trait PointeeSized {}
45-
#[cfg(bootstrap)]
46-
impl<T: ?Sized> PointeeSized for T {}

compiler/rustc_serialize/src/serialize.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::borrow::Cow;
44
use std::cell::{Cell, RefCell};
55
use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet, VecDeque};
66
use std::hash::{BuildHasher, Hash};
7-
use std::marker::PhantomData;
7+
use std::marker::{PhantomData, PointeeSized};
88
use std::num::NonZero;
99
use std::path;
1010
use std::rc::Rc;
@@ -142,7 +142,7 @@ pub trait Decoder {
142142
/// `rustc_metadata::rmeta::Lazy`.
143143
/// * `TyEncodable` should be used for types that are only serialized in crate
144144
/// metadata or the incremental cache. This is most types in `rustc_middle`.
145-
pub trait Encodable<S: Encoder>: crate::PointeeSized {
145+
pub trait Encodable<S: Encoder>: PointeeSized {
146146
fn encode(&self, s: &mut S);
147147
}
148148

@@ -198,7 +198,7 @@ direct_serialize_impls! {
198198
char emit_char read_char
199199
}
200200

201-
impl<S: Encoder, T: ?Sized + crate::PointeeSized> Encodable<S> for &T
201+
impl<S: Encoder, T: ?Sized + PointeeSized> Encodable<S> for &T
202202
where
203203
T: Encodable<S>,
204204
{

compiler/rustc_smir/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
// tidy-alphabetical-start
1010
#![allow(internal_features)]
1111
#![allow(rustc::usage_of_ty_tykind)]
12-
#![cfg_attr(not(bootstrap), feature(sized_hierarchy))]
1312
#![doc(
1413
html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/",
1514
test(attr(allow(unused_variables), deny(warnings)))
1615
)]
1716
#![doc(rust_logo)]
1817
#![feature(rustdoc_internals)]
18+
#![feature(sized_hierarchy)]
1919
// tidy-alphabetical-end
2020

2121
pub mod rustc_internal;

compiler/rustc_smir/src/rustc_smir/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
//!
88
//! For now, we are developing everything inside `rustc`, thus, we keep this module private.
99
10+
use std::marker::PointeeSized;
1011
use std::ops::RangeInclusive;
1112

12-
use rustc_data_structures::PointeeSized;
1313
use rustc_hir::def::DefKind;
1414
use rustc_middle::mir;
1515
use rustc_middle::mir::interpret::AllocId;

compiler/rustc_span/src/analyze_source_file.rs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,7 @@ pub(crate) fn analyze_source_file(src: &str) -> (Vec<RelativeBytePos>, Vec<Multi
2929
(lines, multi_byte_chars)
3030
}
3131

32-
// cfg(bootstrap)
33-
macro_rules! cfg_select_dispatch {
34-
($($tokens:tt)*) => {
35-
#[cfg(bootstrap)]
36-
cfg_match! { $($tokens)* }
37-
38-
#[cfg(not(bootstrap))]
39-
cfg_select! { $($tokens)* }
40-
};
41-
}
42-
43-
cfg_select_dispatch! {
32+
cfg_select! {
4433
any(target_arch = "x86", target_arch = "x86_64") => {
4534
fn analyze_source_file_dispatch(
4635
src: &str,

compiler/rustc_span/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,10 @@
1717
1818
// tidy-alphabetical-start
1919
#![allow(internal_features)]
20-
#![cfg_attr(bootstrap, feature(cfg_match))]
21-
#![cfg_attr(not(bootstrap), feature(cfg_select))]
2220
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
2321
#![doc(rust_logo)]
2422
#![feature(array_windows)]
23+
#![feature(cfg_select)]
2524
#![feature(core_io_borrowed_buf)]
2625
#![feature(if_let_guard)]
2726
#![feature(map_try_insert)]

compiler/rustc_type_ir/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#![cfg_attr(feature = "nightly", rustc_diagnostic_item = "type_ir")]
22
// tidy-alphabetical-start
3+
#![allow(rustc::direct_use_of_rustc_type_ir)]
34
#![allow(rustc::usage_of_ty_tykind)]
45
#![allow(rustc::usage_of_type_ir_inherent)]
56
#![allow(rustc::usage_of_type_ir_traits)]
@@ -8,7 +9,6 @@
89
feature(associated_type_defaults, never_type, rustc_attrs, negative_impls)
910
)]
1011
#![cfg_attr(feature = "nightly", allow(internal_features))]
11-
#![cfg_attr(not(bootstrap), allow(rustc::direct_use_of_rustc_type_ir))]
1212
// tidy-alphabetical-end
1313

1414
extern crate self as rustc_type_ir;

library/core/Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ debug_typeid = []
2929
[lints.rust.unexpected_cfgs]
3030
level = "warn"
3131
check-cfg = [
32-
# #[cfg(bootstrap)] loongarch32
33-
'cfg(target_arch, values("loongarch32"))',
3432
'cfg(no_fp_fmt_parse)',
3533
# core use #[path] imports to portable-simd `core_simd` crate
3634
# and to stdarch `core_arch` crate which messes-up with Cargo list

library/rtstartup/rsbegin.rs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,12 @@
2121
#![allow(internal_features)]
2222
#![warn(unreachable_pub)]
2323

24-
#[cfg(not(bootstrap))]
2524
#[lang = "pointee_sized"]
2625
pub trait PointeeSized {}
2726

28-
#[cfg(not(bootstrap))]
2927
#[lang = "meta_sized"]
3028
pub trait MetaSized: PointeeSized {}
3129

32-
#[cfg(bootstrap)]
33-
#[lang = "sized"]
34-
pub trait Sized {}
35-
#[cfg(not(bootstrap))]
3630
#[lang = "sized"]
3731
pub trait Sized: MetaSized {}
3832

@@ -43,19 +37,8 @@ trait Copy {}
4337
#[lang = "freeze"]
4438
auto trait Freeze {}
4539

46-
#[cfg(bootstrap)]
47-
impl<T: ?Sized> Copy for *mut T {}
48-
#[cfg(not(bootstrap))]
4940
impl<T: PointeeSized> Copy for *mut T {}
5041

51-
#[cfg(bootstrap)]
52-
#[lang = "drop_in_place"]
53-
#[inline]
54-
#[allow(unconditional_recursion)]
55-
pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
56-
drop_in_place(to_drop);
57-
}
58-
#[cfg(not(bootstrap))]
5942
#[lang = "drop_in_place"]
6043
#[inline]
6144
#[allow(unconditional_recursion)]

0 commit comments

Comments
 (0)