Skip to content

Commit 3c45324

Browse files
committed
update cfg(bootstrap)
1 parent 82ad08e commit 3c45324

File tree

22 files changed

+17
-569
lines changed

22 files changed

+17
-569
lines changed

compiler/rustc_data_structures/src/flock.rs

-25
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,6 @@
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-
cfg_match! {
9-
cfg(target_os = "linux") => {
10-
mod linux;
11-
use linux as imp;
12-
}
13-
cfg(target_os = "redox") => {
14-
mod linux;
15-
use linux as imp;
16-
}
17-
cfg(unix) => {
18-
mod unix;
19-
use unix as imp;
20-
}
21-
cfg(windows) => {
22-
mod windows;
23-
use self::windows as imp;
24-
}
25-
_ => {
26-
mod unsupported;
27-
use unsupported as imp;
28-
}
29-
}
30-
31-
#[cfg(not(bootstrap))]
327
cfg_match! {
338
target_os = "linux" => {
349
mod linux;

compiler/rustc_data_structures/src/profiling.rs

-63
Original file line numberDiff line numberDiff line change
@@ -860,69 +860,6 @@ fn get_thread_id() -> u32 {
860860
}
861861

862862
// Memory reporting
863-
#[cfg(bootstrap)]
864-
cfg_match! {
865-
cfg(windows) => {
866-
pub fn get_resident_set_size() -> Option<usize> {
867-
use std::mem;
868-
869-
use windows::{
870-
Win32::System::ProcessStatus::{K32GetProcessMemoryInfo, PROCESS_MEMORY_COUNTERS},
871-
Win32::System::Threading::GetCurrentProcess,
872-
};
873-
874-
let mut pmc = PROCESS_MEMORY_COUNTERS::default();
875-
let pmc_size = mem::size_of_val(&pmc);
876-
unsafe {
877-
K32GetProcessMemoryInfo(
878-
GetCurrentProcess(),
879-
&mut pmc,
880-
pmc_size as u32,
881-
)
882-
}
883-
.ok()
884-
.ok()?;
885-
886-
Some(pmc.WorkingSetSize)
887-
}
888-
}
889-
cfg(target_os = "macos") => {
890-
pub fn get_resident_set_size() -> Option<usize> {
891-
use libc::{c_int, c_void, getpid, proc_pidinfo, proc_taskinfo, PROC_PIDTASKINFO};
892-
use std::mem;
893-
const PROC_TASKINFO_SIZE: c_int = mem::size_of::<proc_taskinfo>() as c_int;
894-
895-
unsafe {
896-
let mut info: proc_taskinfo = mem::zeroed();
897-
let info_ptr = &mut info as *mut proc_taskinfo as *mut c_void;
898-
let pid = getpid() as c_int;
899-
let ret = proc_pidinfo(pid, PROC_PIDTASKINFO, 0, info_ptr, PROC_TASKINFO_SIZE);
900-
if ret == PROC_TASKINFO_SIZE {
901-
Some(info.pti_resident_size as usize)
902-
} else {
903-
None
904-
}
905-
}
906-
}
907-
}
908-
cfg(unix) => {
909-
pub fn get_resident_set_size() -> Option<usize> {
910-
let field = 1;
911-
let contents = fs::read("/proc/self/statm").ok()?;
912-
let contents = String::from_utf8(contents).ok()?;
913-
let s = contents.split_whitespace().nth(field)?;
914-
let npages = s.parse::<usize>().ok()?;
915-
Some(npages * 4096)
916-
}
917-
}
918-
_ => {
919-
pub fn get_resident_set_size() -> Option<usize> {
920-
None
921-
}
922-
}
923-
}
924-
925-
#[cfg(not(bootstrap))]
926863
cfg_match! {
927864
windows => {
928865
pub fn get_resident_set_size() -> Option<usize> {

compiler/rustc_lint/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
2222
// tidy-alphabetical-start
2323
#![allow(internal_features)]
24-
#![cfg_attr(bootstrap, feature(trait_upcasting))]
2524
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
2625
#![doc(rust_logo)]
2726
#![feature(array_windows)]

compiler/rustc_middle/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
#![allow(rustc::diagnostic_outside_of_impl)]
3030
#![allow(rustc::potential_query_instability)]
3131
#![allow(rustc::untranslatable_diagnostic)]
32-
#![cfg_attr(bootstrap, feature(trait_upcasting))]
3332
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
3433
#![doc(rust_logo)]
3534
#![feature(allocator_api)]

compiler/rustc_span/src/analyze_source_file.rs

-126
Original file line numberDiff line numberDiff line change
@@ -29,132 +29,6 @@ pub(crate) fn analyze_source_file(src: &str) -> (Vec<RelativeBytePos>, Vec<Multi
2929
(lines, multi_byte_chars)
3030
}
3131

32-
#[cfg(bootstrap)]
33-
cfg_match! {
34-
cfg(any(target_arch = "x86", target_arch = "x86_64")) => {
35-
fn analyze_source_file_dispatch(
36-
src: &str,
37-
lines: &mut Vec<RelativeBytePos>,
38-
multi_byte_chars: &mut Vec<MultiByteChar>,
39-
) {
40-
if is_x86_feature_detected!("sse2") {
41-
unsafe {
42-
analyze_source_file_sse2(src, lines, multi_byte_chars);
43-
}
44-
} else {
45-
analyze_source_file_generic(
46-
src,
47-
src.len(),
48-
RelativeBytePos::from_u32(0),
49-
lines,
50-
multi_byte_chars,
51-
);
52-
}
53-
}
54-
55-
/// Checks 16 byte chunks of text at a time. If the chunk contains
56-
/// something other than printable ASCII characters and newlines, the
57-
/// function falls back to the generic implementation. Otherwise it uses
58-
/// SSE2 intrinsics to quickly find all newlines.
59-
#[target_feature(enable = "sse2")]
60-
unsafe fn analyze_source_file_sse2(
61-
src: &str,
62-
lines: &mut Vec<RelativeBytePos>,
63-
multi_byte_chars: &mut Vec<MultiByteChar>,
64-
) {
65-
#[cfg(target_arch = "x86")]
66-
use std::arch::x86::*;
67-
#[cfg(target_arch = "x86_64")]
68-
use std::arch::x86_64::*;
69-
70-
const CHUNK_SIZE: usize = 16;
71-
72-
let src_bytes = src.as_bytes();
73-
74-
let chunk_count = src.len() / CHUNK_SIZE;
75-
76-
// This variable keeps track of where we should start decoding a
77-
// chunk. If a multi-byte character spans across chunk boundaries,
78-
// we need to skip that part in the next chunk because we already
79-
// handled it.
80-
let mut intra_chunk_offset = 0;
81-
82-
for chunk_index in 0..chunk_count {
83-
let ptr = src_bytes.as_ptr() as *const __m128i;
84-
// We don't know if the pointer is aligned to 16 bytes, so we
85-
// use `loadu`, which supports unaligned loading.
86-
let chunk = unsafe { _mm_loadu_si128(ptr.add(chunk_index)) };
87-
88-
// For character in the chunk, see if its byte value is < 0, which
89-
// indicates that it's part of a UTF-8 char.
90-
let multibyte_test = unsafe { _mm_cmplt_epi8(chunk, _mm_set1_epi8(0)) };
91-
// Create a bit mask from the comparison results.
92-
let multibyte_mask = unsafe { _mm_movemask_epi8(multibyte_test) };
93-
94-
// If the bit mask is all zero, we only have ASCII chars here:
95-
if multibyte_mask == 0 {
96-
assert!(intra_chunk_offset == 0);
97-
98-
// Check for newlines in the chunk
99-
let newlines_test = unsafe { _mm_cmpeq_epi8(chunk, _mm_set1_epi8(b'\n' as i8)) };
100-
let mut newlines_mask = unsafe { _mm_movemask_epi8(newlines_test) };
101-
102-
let output_offset = RelativeBytePos::from_usize(chunk_index * CHUNK_SIZE + 1);
103-
104-
while newlines_mask != 0 {
105-
let index = newlines_mask.trailing_zeros();
106-
107-
lines.push(RelativeBytePos(index) + output_offset);
108-
109-
// Clear the bit, so we can find the next one.
110-
newlines_mask &= newlines_mask - 1;
111-
}
112-
} else {
113-
// The slow path.
114-
// There are multibyte chars in here, fallback to generic decoding.
115-
let scan_start = chunk_index * CHUNK_SIZE + intra_chunk_offset;
116-
intra_chunk_offset = analyze_source_file_generic(
117-
&src[scan_start..],
118-
CHUNK_SIZE - intra_chunk_offset,
119-
RelativeBytePos::from_usize(scan_start),
120-
lines,
121-
multi_byte_chars,
122-
);
123-
}
124-
}
125-
126-
// There might still be a tail left to analyze
127-
let tail_start = chunk_count * CHUNK_SIZE + intra_chunk_offset;
128-
if tail_start < src.len() {
129-
analyze_source_file_generic(
130-
&src[tail_start..],
131-
src.len() - tail_start,
132-
RelativeBytePos::from_usize(tail_start),
133-
lines,
134-
multi_byte_chars,
135-
);
136-
}
137-
}
138-
}
139-
_ => {
140-
// The target (or compiler version) does not support SSE2 ...
141-
fn analyze_source_file_dispatch(
142-
src: &str,
143-
lines: &mut Vec<RelativeBytePos>,
144-
multi_byte_chars: &mut Vec<MultiByteChar>,
145-
) {
146-
analyze_source_file_generic(
147-
src,
148-
src.len(),
149-
RelativeBytePos::from_u32(0),
150-
lines,
151-
multi_byte_chars,
152-
);
153-
}
154-
}
155-
}
156-
157-
#[cfg(not(bootstrap))]
15832
cfg_match! {
15933
any(target_arch = "x86", target_arch = "x86_64") => {
16034
fn analyze_source_file_dispatch(

library/alloc/src/boxed.rs

-10
Original file line numberDiff line numberDiff line change
@@ -237,23 +237,13 @@ pub struct Box<
237237
/// the newly allocated memory. This is an intrinsic to avoid unnecessary copies.
238238
///
239239
/// This is the surface syntax for `box <expr>` expressions.
240-
#[cfg(not(bootstrap))]
241240
#[rustc_intrinsic]
242241
#[rustc_intrinsic_must_be_overridden]
243242
#[unstable(feature = "liballoc_internals", issue = "none")]
244243
pub fn box_new<T>(_x: T) -> Box<T> {
245244
unreachable!()
246245
}
247246

248-
/// Transition function for the next bootstrap bump.
249-
#[cfg(bootstrap)]
250-
#[unstable(feature = "liballoc_internals", issue = "none")]
251-
#[inline(always)]
252-
pub fn box_new<T>(x: T) -> Box<T> {
253-
#[rustc_box]
254-
Box::new(x)
255-
}
256-
257247
impl<T> Box<T> {
258248
/// Allocates memory on the heap and then places `x` into it.
259249
///

library/core/src/contracts.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//! Unstable module containing the unstable contracts lang items and attribute macros.
2-
#![cfg(not(bootstrap))]
32
43
pub use crate::macros::builtin::{contracts_ensures as ensures, contracts_requires as requires};
54

library/core/src/intrinsics/mod.rs

+6-29
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,7 @@ pub mod simd;
7878
use crate::sync::atomic::{self, AtomicBool, AtomicI32, AtomicIsize, AtomicU32, Ordering};
7979

8080
#[stable(feature = "drop_in_place", since = "1.8.0")]
81-
#[cfg_attr(bootstrap, rustc_allowed_through_unstable_modules)]
82-
#[cfg_attr(
83-
not(bootstrap),
84-
rustc_allowed_through_unstable_modules = "import this function via `std::ptr` instead"
85-
)]
81+
#[rustc_allowed_through_unstable_modules = "import this function via `std::ptr` instead"]
8682
#[deprecated(note = "no longer an intrinsic - use `ptr::drop_in_place` directly", since = "1.52.0")]
8783
#[inline]
8884
pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
@@ -1901,11 +1897,7 @@ pub const fn forget<T: ?Sized>(_: T) {
19011897
/// }
19021898
/// ```
19031899
#[stable(feature = "rust1", since = "1.0.0")]
1904-
#[cfg_attr(bootstrap, rustc_allowed_through_unstable_modules)]
1905-
#[cfg_attr(
1906-
not(bootstrap),
1907-
rustc_allowed_through_unstable_modules = "import this function via `std::mem` instead"
1908-
)]
1900+
#[rustc_allowed_through_unstable_modules = "import this function via `std::mem` instead"]
19091901
#[rustc_const_stable(feature = "const_transmute", since = "1.56.0")]
19101902
#[rustc_diagnostic_item = "transmute"]
19111903
#[rustc_nounwind]
@@ -3260,7 +3252,7 @@ pub const fn three_way_compare<T: Copy>(_lhs: T, _rhss: T) -> crate::cmp::Orderi
32603252
/// Otherwise it's immediate UB.
32613253
#[rustc_const_unstable(feature = "disjoint_bitor", issue = "135758")]
32623254
#[rustc_nounwind]
3263-
#[cfg_attr(not(bootstrap), rustc_intrinsic)]
3255+
#[rustc_intrinsic]
32643256
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
32653257
#[miri::intrinsic_fallback_is_spec] // the fallbacks all `assume` to tell Miri
32663258
pub const unsafe fn disjoint_bitor<T: ~const fallback::DisjointBitOr>(a: T, b: T) -> T {
@@ -4070,7 +4062,6 @@ pub const unsafe fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize)
40704062
/// of not prematurely commiting at compile-time to whether contract
40714063
/// checking is turned on, so that we can specify contracts in libstd
40724064
/// and let an end user opt into turning them on.
4073-
#[cfg(not(bootstrap))]
40744065
#[rustc_const_unstable(feature = "contracts_internals", issue = "128044" /* compiler-team#759 */)]
40754066
#[unstable(feature = "contracts_internals", issue = "128044" /* compiler-team#759 */)]
40764067
#[inline(always)]
@@ -4086,7 +4077,6 @@ pub const fn contract_checks() -> bool {
40864077
///
40874078
/// By default, if `contract_checks` is enabled, this will panic with no unwind if the condition
40884079
/// returns false.
4089-
#[cfg(not(bootstrap))]
40904080
#[unstable(feature = "contracts_internals", issue = "128044" /* compiler-team#759 */)]
40914081
#[lang = "contract_check_requires"]
40924082
#[rustc_intrinsic]
@@ -4101,7 +4091,6 @@ pub fn contract_check_requires<C: Fn() -> bool>(cond: C) {
41014091
///
41024092
/// By default, if `contract_checks` is enabled, this will panic with no unwind if the condition
41034093
/// returns false.
4104-
#[cfg(not(bootstrap))]
41054094
#[unstable(feature = "contracts_internals", issue = "128044" /* compiler-team#759 */)]
41064095
#[rustc_intrinsic]
41074096
pub fn contract_check_ensures<'a, Ret, C: Fn(&'a Ret) -> bool>(ret: &'a Ret, cond: C) {
@@ -4400,11 +4389,7 @@ pub const fn ptr_metadata<P: ptr::Pointee<Metadata = M> + ?Sized, M>(_ptr: *cons
44004389
/// [`Vec::append`]: ../../std/vec/struct.Vec.html#method.append
44014390
#[doc(alias = "memcpy")]
44024391
#[stable(feature = "rust1", since = "1.0.0")]
4403-
#[cfg_attr(bootstrap, rustc_allowed_through_unstable_modules)]
4404-
#[cfg_attr(
4405-
not(bootstrap),
4406-
rustc_allowed_through_unstable_modules = "import this function via `std::mem` instead"
4407-
)]
4392+
#[rustc_allowed_through_unstable_modules = "import this function via `std::mem` instead"]
44084393
#[rustc_const_stable(feature = "const_intrinsic_copy", since = "1.83.0")]
44094394
#[inline(always)]
44104395
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
@@ -4508,11 +4493,7 @@ pub const unsafe fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: us
45084493
/// ```
45094494
#[doc(alias = "memmove")]
45104495
#[stable(feature = "rust1", since = "1.0.0")]
4511-
#[cfg_attr(bootstrap, rustc_allowed_through_unstable_modules)]
4512-
#[cfg_attr(
4513-
not(bootstrap),
4514-
rustc_allowed_through_unstable_modules = "import this function via `std::mem` instead"
4515-
)]
4496+
#[rustc_allowed_through_unstable_modules = "import this function via `std::mem` instead"]
45164497
#[rustc_const_stable(feature = "const_intrinsic_copy", since = "1.83.0")]
45174498
#[inline(always)]
45184499
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
@@ -4595,11 +4576,7 @@ pub const unsafe fn copy<T>(src: *const T, dst: *mut T, count: usize) {
45954576
/// ```
45964577
#[doc(alias = "memset")]
45974578
#[stable(feature = "rust1", since = "1.0.0")]
4598-
#[cfg_attr(bootstrap, rustc_allowed_through_unstable_modules)]
4599-
#[cfg_attr(
4600-
not(bootstrap),
4601-
rustc_allowed_through_unstable_modules = "import this function via `std::mem` instead"
4602-
)]
4579+
#[rustc_allowed_through_unstable_modules = "import this function via `std::mem` instead"]
46034580
#[rustc_const_stable(feature = "const_ptr_write", since = "1.83.0")]
46044581
#[inline(always)]
46054582
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces

library/core/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,6 @@ pub mod autodiff {
247247
pub use crate::macros::builtin::autodiff;
248248
}
249249

250-
#[cfg(not(bootstrap))]
251250
#[unstable(feature = "contracts", issue = "128044")]
252251
pub mod contracts;
253252

0 commit comments

Comments
 (0)