update cfg(bootstrap)
This commit is contained in:
parent
82ad08ea7f
commit
3c45324e67
@ -4,31 +4,6 @@
|
||||
//! green/native threading. This is just a bare-bones enough solution for
|
||||
//! librustdoc, it is not production quality at all.
|
||||
|
||||
#[cfg(bootstrap)]
|
||||
cfg_match! {
|
||||
cfg(target_os = "linux") => {
|
||||
mod linux;
|
||||
use linux as imp;
|
||||
}
|
||||
cfg(target_os = "redox") => {
|
||||
mod linux;
|
||||
use linux as imp;
|
||||
}
|
||||
cfg(unix) => {
|
||||
mod unix;
|
||||
use unix as imp;
|
||||
}
|
||||
cfg(windows) => {
|
||||
mod windows;
|
||||
use self::windows as imp;
|
||||
}
|
||||
_ => {
|
||||
mod unsupported;
|
||||
use unsupported as imp;
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(bootstrap))]
|
||||
cfg_match! {
|
||||
target_os = "linux" => {
|
||||
mod linux;
|
||||
|
@ -860,69 +860,6 @@ fn get_thread_id() -> u32 {
|
||||
}
|
||||
|
||||
// Memory reporting
|
||||
#[cfg(bootstrap)]
|
||||
cfg_match! {
|
||||
cfg(windows) => {
|
||||
pub fn get_resident_set_size() -> Option<usize> {
|
||||
use std::mem;
|
||||
|
||||
use windows::{
|
||||
Win32::System::ProcessStatus::{K32GetProcessMemoryInfo, PROCESS_MEMORY_COUNTERS},
|
||||
Win32::System::Threading::GetCurrentProcess,
|
||||
};
|
||||
|
||||
let mut pmc = PROCESS_MEMORY_COUNTERS::default();
|
||||
let pmc_size = mem::size_of_val(&pmc);
|
||||
unsafe {
|
||||
K32GetProcessMemoryInfo(
|
||||
GetCurrentProcess(),
|
||||
&mut pmc,
|
||||
pmc_size as u32,
|
||||
)
|
||||
}
|
||||
.ok()
|
||||
.ok()?;
|
||||
|
||||
Some(pmc.WorkingSetSize)
|
||||
}
|
||||
}
|
||||
cfg(target_os = "macos") => {
|
||||
pub fn get_resident_set_size() -> Option<usize> {
|
||||
use libc::{c_int, c_void, getpid, proc_pidinfo, proc_taskinfo, PROC_PIDTASKINFO};
|
||||
use std::mem;
|
||||
const PROC_TASKINFO_SIZE: c_int = mem::size_of::<proc_taskinfo>() as c_int;
|
||||
|
||||
unsafe {
|
||||
let mut info: proc_taskinfo = mem::zeroed();
|
||||
let info_ptr = &mut info as *mut proc_taskinfo as *mut c_void;
|
||||
let pid = getpid() as c_int;
|
||||
let ret = proc_pidinfo(pid, PROC_PIDTASKINFO, 0, info_ptr, PROC_TASKINFO_SIZE);
|
||||
if ret == PROC_TASKINFO_SIZE {
|
||||
Some(info.pti_resident_size as usize)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
cfg(unix) => {
|
||||
pub fn get_resident_set_size() -> Option<usize> {
|
||||
let field = 1;
|
||||
let contents = fs::read("/proc/self/statm").ok()?;
|
||||
let contents = String::from_utf8(contents).ok()?;
|
||||
let s = contents.split_whitespace().nth(field)?;
|
||||
let npages = s.parse::<usize>().ok()?;
|
||||
Some(npages * 4096)
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
pub fn get_resident_set_size() -> Option<usize> {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(bootstrap))]
|
||||
cfg_match! {
|
||||
windows => {
|
||||
pub fn get_resident_set_size() -> Option<usize> {
|
||||
|
@ -21,7 +21,6 @@
|
||||
|
||||
// tidy-alphabetical-start
|
||||
#![allow(internal_features)]
|
||||
#![cfg_attr(bootstrap, feature(trait_upcasting))]
|
||||
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
|
||||
#![doc(rust_logo)]
|
||||
#![feature(array_windows)]
|
||||
|
@ -29,7 +29,6 @@
|
||||
#![allow(rustc::diagnostic_outside_of_impl)]
|
||||
#![allow(rustc::potential_query_instability)]
|
||||
#![allow(rustc::untranslatable_diagnostic)]
|
||||
#![cfg_attr(bootstrap, feature(trait_upcasting))]
|
||||
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
|
||||
#![doc(rust_logo)]
|
||||
#![feature(allocator_api)]
|
||||
|
@ -29,132 +29,6 @@ pub(crate) fn analyze_source_file(src: &str) -> (Vec<RelativeBytePos>, Vec<Multi
|
||||
(lines, multi_byte_chars)
|
||||
}
|
||||
|
||||
#[cfg(bootstrap)]
|
||||
cfg_match! {
|
||||
cfg(any(target_arch = "x86", target_arch = "x86_64")) => {
|
||||
fn analyze_source_file_dispatch(
|
||||
src: &str,
|
||||
lines: &mut Vec<RelativeBytePos>,
|
||||
multi_byte_chars: &mut Vec<MultiByteChar>,
|
||||
) {
|
||||
if is_x86_feature_detected!("sse2") {
|
||||
unsafe {
|
||||
analyze_source_file_sse2(src, lines, multi_byte_chars);
|
||||
}
|
||||
} else {
|
||||
analyze_source_file_generic(
|
||||
src,
|
||||
src.len(),
|
||||
RelativeBytePos::from_u32(0),
|
||||
lines,
|
||||
multi_byte_chars,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Checks 16 byte chunks of text at a time. If the chunk contains
|
||||
/// something other than printable ASCII characters and newlines, the
|
||||
/// function falls back to the generic implementation. Otherwise it uses
|
||||
/// SSE2 intrinsics to quickly find all newlines.
|
||||
#[target_feature(enable = "sse2")]
|
||||
unsafe fn analyze_source_file_sse2(
|
||||
src: &str,
|
||||
lines: &mut Vec<RelativeBytePos>,
|
||||
multi_byte_chars: &mut Vec<MultiByteChar>,
|
||||
) {
|
||||
#[cfg(target_arch = "x86")]
|
||||
use std::arch::x86::*;
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
use std::arch::x86_64::*;
|
||||
|
||||
const CHUNK_SIZE: usize = 16;
|
||||
|
||||
let src_bytes = src.as_bytes();
|
||||
|
||||
let chunk_count = src.len() / CHUNK_SIZE;
|
||||
|
||||
// This variable keeps track of where we should start decoding a
|
||||
// chunk. If a multi-byte character spans across chunk boundaries,
|
||||
// we need to skip that part in the next chunk because we already
|
||||
// handled it.
|
||||
let mut intra_chunk_offset = 0;
|
||||
|
||||
for chunk_index in 0..chunk_count {
|
||||
let ptr = src_bytes.as_ptr() as *const __m128i;
|
||||
// We don't know if the pointer is aligned to 16 bytes, so we
|
||||
// use `loadu`, which supports unaligned loading.
|
||||
let chunk = unsafe { _mm_loadu_si128(ptr.add(chunk_index)) };
|
||||
|
||||
// For character in the chunk, see if its byte value is < 0, which
|
||||
// indicates that it's part of a UTF-8 char.
|
||||
let multibyte_test = unsafe { _mm_cmplt_epi8(chunk, _mm_set1_epi8(0)) };
|
||||
// Create a bit mask from the comparison results.
|
||||
let multibyte_mask = unsafe { _mm_movemask_epi8(multibyte_test) };
|
||||
|
||||
// If the bit mask is all zero, we only have ASCII chars here:
|
||||
if multibyte_mask == 0 {
|
||||
assert!(intra_chunk_offset == 0);
|
||||
|
||||
// Check for newlines in the chunk
|
||||
let newlines_test = unsafe { _mm_cmpeq_epi8(chunk, _mm_set1_epi8(b'\n' as i8)) };
|
||||
let mut newlines_mask = unsafe { _mm_movemask_epi8(newlines_test) };
|
||||
|
||||
let output_offset = RelativeBytePos::from_usize(chunk_index * CHUNK_SIZE + 1);
|
||||
|
||||
while newlines_mask != 0 {
|
||||
let index = newlines_mask.trailing_zeros();
|
||||
|
||||
lines.push(RelativeBytePos(index) + output_offset);
|
||||
|
||||
// Clear the bit, so we can find the next one.
|
||||
newlines_mask &= newlines_mask - 1;
|
||||
}
|
||||
} else {
|
||||
// The slow path.
|
||||
// There are multibyte chars in here, fallback to generic decoding.
|
||||
let scan_start = chunk_index * CHUNK_SIZE + intra_chunk_offset;
|
||||
intra_chunk_offset = analyze_source_file_generic(
|
||||
&src[scan_start..],
|
||||
CHUNK_SIZE - intra_chunk_offset,
|
||||
RelativeBytePos::from_usize(scan_start),
|
||||
lines,
|
||||
multi_byte_chars,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// There might still be a tail left to analyze
|
||||
let tail_start = chunk_count * CHUNK_SIZE + intra_chunk_offset;
|
||||
if tail_start < src.len() {
|
||||
analyze_source_file_generic(
|
||||
&src[tail_start..],
|
||||
src.len() - tail_start,
|
||||
RelativeBytePos::from_usize(tail_start),
|
||||
lines,
|
||||
multi_byte_chars,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
// The target (or compiler version) does not support SSE2 ...
|
||||
fn analyze_source_file_dispatch(
|
||||
src: &str,
|
||||
lines: &mut Vec<RelativeBytePos>,
|
||||
multi_byte_chars: &mut Vec<MultiByteChar>,
|
||||
) {
|
||||
analyze_source_file_generic(
|
||||
src,
|
||||
src.len(),
|
||||
RelativeBytePos::from_u32(0),
|
||||
lines,
|
||||
multi_byte_chars,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(bootstrap))]
|
||||
cfg_match! {
|
||||
any(target_arch = "x86", target_arch = "x86_64") => {
|
||||
fn analyze_source_file_dispatch(
|
||||
|
@ -237,7 +237,6 @@ pub struct Box<
|
||||
/// the newly allocated memory. This is an intrinsic to avoid unnecessary copies.
|
||||
///
|
||||
/// This is the surface syntax for `box <expr>` expressions.
|
||||
#[cfg(not(bootstrap))]
|
||||
#[rustc_intrinsic]
|
||||
#[rustc_intrinsic_must_be_overridden]
|
||||
#[unstable(feature = "liballoc_internals", issue = "none")]
|
||||
@ -245,15 +244,6 @@ pub fn box_new<T>(_x: T) -> Box<T> {
|
||||
unreachable!()
|
||||
}
|
||||
|
||||
/// Transition function for the next bootstrap bump.
|
||||
#[cfg(bootstrap)]
|
||||
#[unstable(feature = "liballoc_internals", issue = "none")]
|
||||
#[inline(always)]
|
||||
pub fn box_new<T>(x: T) -> Box<T> {
|
||||
#[rustc_box]
|
||||
Box::new(x)
|
||||
}
|
||||
|
||||
impl<T> Box<T> {
|
||||
/// Allocates memory on the heap and then places `x` into it.
|
||||
///
|
||||
|
@ -1,5 +1,4 @@
|
||||
//! Unstable module containing the unstable contracts lang items and attribute macros.
|
||||
#![cfg(not(bootstrap))]
|
||||
|
||||
pub use crate::macros::builtin::{contracts_ensures as ensures, contracts_requires as requires};
|
||||
|
||||
|
@ -78,11 +78,7 @@ pub mod simd;
|
||||
use crate::sync::atomic::{self, AtomicBool, AtomicI32, AtomicIsize, AtomicU32, Ordering};
|
||||
|
||||
#[stable(feature = "drop_in_place", since = "1.8.0")]
|
||||
#[cfg_attr(bootstrap, rustc_allowed_through_unstable_modules)]
|
||||
#[cfg_attr(
|
||||
not(bootstrap),
|
||||
rustc_allowed_through_unstable_modules = "import this function via `std::ptr` instead"
|
||||
)]
|
||||
#[rustc_allowed_through_unstable_modules = "import this function via `std::ptr` instead"]
|
||||
#[deprecated(note = "no longer an intrinsic - use `ptr::drop_in_place` directly", since = "1.52.0")]
|
||||
#[inline]
|
||||
pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
|
||||
@ -1901,11 +1897,7 @@ pub const fn forget<T: ?Sized>(_: T) {
|
||||
/// }
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[cfg_attr(bootstrap, rustc_allowed_through_unstable_modules)]
|
||||
#[cfg_attr(
|
||||
not(bootstrap),
|
||||
rustc_allowed_through_unstable_modules = "import this function via `std::mem` instead"
|
||||
)]
|
||||
#[rustc_allowed_through_unstable_modules = "import this function via `std::mem` instead"]
|
||||
#[rustc_const_stable(feature = "const_transmute", since = "1.56.0")]
|
||||
#[rustc_diagnostic_item = "transmute"]
|
||||
#[rustc_nounwind]
|
||||
@ -3260,7 +3252,7 @@ pub const fn three_way_compare<T: Copy>(_lhs: T, _rhss: T) -> crate::cmp::Orderi
|
||||
/// Otherwise it's immediate UB.
|
||||
#[rustc_const_unstable(feature = "disjoint_bitor", issue = "135758")]
|
||||
#[rustc_nounwind]
|
||||
#[cfg_attr(not(bootstrap), rustc_intrinsic)]
|
||||
#[rustc_intrinsic]
|
||||
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
|
||||
#[miri::intrinsic_fallback_is_spec] // the fallbacks all `assume` to tell Miri
|
||||
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)
|
||||
/// of not prematurely commiting at compile-time to whether contract
|
||||
/// checking is turned on, so that we can specify contracts in libstd
|
||||
/// and let an end user opt into turning them on.
|
||||
#[cfg(not(bootstrap))]
|
||||
#[rustc_const_unstable(feature = "contracts_internals", issue = "128044" /* compiler-team#759 */)]
|
||||
#[unstable(feature = "contracts_internals", issue = "128044" /* compiler-team#759 */)]
|
||||
#[inline(always)]
|
||||
@ -4086,7 +4077,6 @@ pub const fn contract_checks() -> bool {
|
||||
///
|
||||
/// By default, if `contract_checks` is enabled, this will panic with no unwind if the condition
|
||||
/// returns false.
|
||||
#[cfg(not(bootstrap))]
|
||||
#[unstable(feature = "contracts_internals", issue = "128044" /* compiler-team#759 */)]
|
||||
#[lang = "contract_check_requires"]
|
||||
#[rustc_intrinsic]
|
||||
@ -4101,7 +4091,6 @@ pub fn contract_check_requires<C: Fn() -> bool>(cond: C) {
|
||||
///
|
||||
/// By default, if `contract_checks` is enabled, this will panic with no unwind if the condition
|
||||
/// returns false.
|
||||
#[cfg(not(bootstrap))]
|
||||
#[unstable(feature = "contracts_internals", issue = "128044" /* compiler-team#759 */)]
|
||||
#[rustc_intrinsic]
|
||||
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
|
||||
/// [`Vec::append`]: ../../std/vec/struct.Vec.html#method.append
|
||||
#[doc(alias = "memcpy")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[cfg_attr(bootstrap, rustc_allowed_through_unstable_modules)]
|
||||
#[cfg_attr(
|
||||
not(bootstrap),
|
||||
rustc_allowed_through_unstable_modules = "import this function via `std::mem` instead"
|
||||
)]
|
||||
#[rustc_allowed_through_unstable_modules = "import this function via `std::mem` instead"]
|
||||
#[rustc_const_stable(feature = "const_intrinsic_copy", since = "1.83.0")]
|
||||
#[inline(always)]
|
||||
#[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
|
||||
/// ```
|
||||
#[doc(alias = "memmove")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[cfg_attr(bootstrap, rustc_allowed_through_unstable_modules)]
|
||||
#[cfg_attr(
|
||||
not(bootstrap),
|
||||
rustc_allowed_through_unstable_modules = "import this function via `std::mem` instead"
|
||||
)]
|
||||
#[rustc_allowed_through_unstable_modules = "import this function via `std::mem` instead"]
|
||||
#[rustc_const_stable(feature = "const_intrinsic_copy", since = "1.83.0")]
|
||||
#[inline(always)]
|
||||
#[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) {
|
||||
/// ```
|
||||
#[doc(alias = "memset")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[cfg_attr(bootstrap, rustc_allowed_through_unstable_modules)]
|
||||
#[cfg_attr(
|
||||
not(bootstrap),
|
||||
rustc_allowed_through_unstable_modules = "import this function via `std::mem` instead"
|
||||
)]
|
||||
#[rustc_allowed_through_unstable_modules = "import this function via `std::mem` instead"]
|
||||
#[rustc_const_stable(feature = "const_ptr_write", since = "1.83.0")]
|
||||
#[inline(always)]
|
||||
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
|
||||
|
@ -247,7 +247,6 @@ pub mod autodiff {
|
||||
pub use crate::macros::builtin::autodiff;
|
||||
}
|
||||
|
||||
#[cfg(not(bootstrap))]
|
||||
#[unstable(feature = "contracts", issue = "128044")]
|
||||
pub mod contracts;
|
||||
|
||||
|
@ -196,95 +196,6 @@ pub macro assert_matches {
|
||||
},
|
||||
}
|
||||
|
||||
/// A macro for defining `#[cfg]` match-like statements.
|
||||
///
|
||||
/// It is similar to the `if/elif` C preprocessor macro by allowing definition of a cascade of
|
||||
/// `#[cfg]` cases, emitting the implementation which matches first.
|
||||
///
|
||||
/// This allows you to conveniently provide a long list `#[cfg]`'d blocks of code
|
||||
/// without having to rewrite each clause multiple times.
|
||||
///
|
||||
/// Trailing `_` wildcard match arms are **optional** and they indicate a fallback branch when
|
||||
/// all previous declarations do not evaluate to true.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(cfg_match)]
|
||||
///
|
||||
/// cfg_match! {
|
||||
/// cfg(unix) => {
|
||||
/// fn foo() { /* unix specific functionality */ }
|
||||
/// }
|
||||
/// cfg(target_pointer_width = "32") => {
|
||||
/// fn foo() { /* non-unix, 32-bit functionality */ }
|
||||
/// }
|
||||
/// _ => {
|
||||
/// fn foo() { /* fallback implementation */ }
|
||||
/// }
|
||||
/// }
|
||||
/// ```
|
||||
#[cfg(bootstrap)]
|
||||
#[unstable(feature = "cfg_match", issue = "115585")]
|
||||
#[rustc_diagnostic_item = "cfg_match"]
|
||||
pub macro cfg_match {
|
||||
// with a final wildcard
|
||||
(
|
||||
$(cfg($initial_meta:meta) => { $($initial_tokens:tt)* })+
|
||||
_ => { $($extra_tokens:tt)* }
|
||||
) => {
|
||||
cfg_match! {
|
||||
@__items ();
|
||||
$((($initial_meta) ($($initial_tokens)*)),)+
|
||||
(() ($($extra_tokens)*)),
|
||||
}
|
||||
},
|
||||
|
||||
// without a final wildcard
|
||||
(
|
||||
$(cfg($extra_meta:meta) => { $($extra_tokens:tt)* })*
|
||||
) => {
|
||||
cfg_match! {
|
||||
@__items ();
|
||||
$((($extra_meta) ($($extra_tokens)*)),)*
|
||||
}
|
||||
},
|
||||
|
||||
// Internal and recursive macro to emit all the items
|
||||
//
|
||||
// Collects all the previous cfgs in a list at the beginning, so they can be
|
||||
// negated. After the semicolon is all the remaining items.
|
||||
(@__items ($($_:meta,)*);) => {},
|
||||
(
|
||||
@__items ($($no:meta,)*);
|
||||
(($($yes:meta)?) ($($tokens:tt)*)),
|
||||
$($rest:tt,)*
|
||||
) => {
|
||||
// Emit all items within one block, applying an appropriate #[cfg]. The
|
||||
// #[cfg] will require all `$yes` matchers specified and must also negate
|
||||
// all previous matchers.
|
||||
#[cfg(all(
|
||||
$($yes,)?
|
||||
not(any($($no),*))
|
||||
))]
|
||||
cfg_match! { @__identity $($tokens)* }
|
||||
|
||||
// Recurse to emit all other items in `$rest`, and when we do so add all
|
||||
// our `$yes` matchers to the list of `$no` matchers as future emissions
|
||||
// will have to negate everything we just matched as well.
|
||||
cfg_match! {
|
||||
@__items ($($no,)* $($yes,)?);
|
||||
$($rest,)*
|
||||
}
|
||||
},
|
||||
|
||||
// Internal macro to make __apply work out right for different match types,
|
||||
// because of how macros match/expand stuff.
|
||||
(@__identity $($tokens:tt)*) => {
|
||||
$($tokens)*
|
||||
}
|
||||
}
|
||||
|
||||
/// A macro for defining `#[cfg]` match-like statements.
|
||||
///
|
||||
/// It is similar to the `if/elif` C preprocessor macro by allowing definition of a cascade of
|
||||
@ -324,7 +235,6 @@ pub macro cfg_match {
|
||||
/// _ => { "Behind every successful diet is an unwatched pizza" }
|
||||
/// }};
|
||||
/// ```
|
||||
#[cfg(not(bootstrap))]
|
||||
#[unstable(feature = "cfg_match", issue = "115585")]
|
||||
#[rustc_diagnostic_item = "cfg_match"]
|
||||
pub macro cfg_match {
|
||||
@ -1782,7 +1692,6 @@ pub(crate) mod builtin {
|
||||
/// The attribute carries an argument token-tree which is
|
||||
/// eventually parsed as a unary closure expression that is
|
||||
/// invoked on a reference to the return value.
|
||||
#[cfg(not(bootstrap))]
|
||||
#[unstable(feature = "contracts", issue = "128044")]
|
||||
#[allow_internal_unstable(contracts_internals)]
|
||||
#[rustc_builtin_macro]
|
||||
@ -1795,7 +1704,6 @@ pub(crate) mod builtin {
|
||||
/// The attribute carries an argument token-tree which is
|
||||
/// eventually parsed as an boolean expression with access to the
|
||||
/// function's formal parameters
|
||||
#[cfg(not(bootstrap))]
|
||||
#[unstable(feature = "contracts", issue = "128044")]
|
||||
#[allow_internal_unstable(contracts_internals)]
|
||||
#[rustc_builtin_macro]
|
||||
|
@ -467,7 +467,7 @@ impl<T: ?Sized> Copy for &T {}
|
||||
///
|
||||
/// Bikeshed name for now.
|
||||
#[unstable(feature = "bikeshed_guaranteed_no_drop", issue = "none")]
|
||||
#[cfg_attr(not(bootstrap), lang = "bikeshed_guaranteed_no_drop")]
|
||||
#[lang = "bikeshed_guaranteed_no_drop"]
|
||||
pub trait BikeshedGuaranteedNoDrop {}
|
||||
|
||||
/// Types for which it is safe to share references between threads.
|
||||
@ -1313,7 +1313,6 @@ pub macro CoercePointee($item:item) {
|
||||
///
|
||||
/// This trait is not intended to be implemented by users or used other than
|
||||
/// validation, so it should never be stabilized.
|
||||
#[cfg(not(bootstrap))]
|
||||
#[lang = "coerce_pointee_validated"]
|
||||
#[unstable(feature = "coerce_pointee_validated", issue = "none")]
|
||||
#[doc(hidden)]
|
||||
|
@ -294,7 +294,7 @@ fn panic_misaligned_pointer_dereference(required: usize, found: usize) -> ! {
|
||||
#[cfg_attr(not(feature = "panic_immediate_abort"), inline(never), cold, optimize(size))]
|
||||
#[cfg_attr(feature = "panic_immediate_abort", inline)]
|
||||
#[track_caller]
|
||||
#[cfg_attr(not(bootstrap), lang = "panic_null_pointer_dereference")] // needed by codegen for panic on null pointer deref
|
||||
#[lang = "panic_null_pointer_dereference"] // needed by codegen for panic on null pointer deref
|
||||
#[rustc_nounwind] // `CheckNull` MIR pass requires this function to never unwind
|
||||
fn panic_null_pointer_dereference() -> ! {
|
||||
if cfg!(feature = "panic_immediate_abort") {
|
||||
|
@ -50,7 +50,7 @@ pub use crate::ops::{
|
||||
/// assert_eq!(Range::from(3..5), Range { start: 3, end: 5 });
|
||||
/// assert_eq!(3 + 4 + 5, Range::from(3..6).into_iter().sum());
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), lang = "RangeCopy")]
|
||||
#[lang = "RangeCopy"]
|
||||
#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
|
||||
#[unstable(feature = "new_range_api", issue = "125687")]
|
||||
pub struct Range<Idx> {
|
||||
@ -216,7 +216,7 @@ impl<T> From<legacy::Range<T>> for Range<T> {
|
||||
/// assert_eq!(RangeInclusive::from(3..=5), RangeInclusive { start: 3, end: 5 });
|
||||
/// assert_eq!(3 + 4 + 5, RangeInclusive::from(3..=5).into_iter().sum());
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), lang = "RangeInclusiveCopy")]
|
||||
#[lang = "RangeInclusiveCopy"]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash)]
|
||||
#[unstable(feature = "new_range_api", issue = "125687")]
|
||||
pub struct RangeInclusive<Idx> {
|
||||
@ -408,7 +408,7 @@ impl<T> From<legacy::RangeInclusive<T>> for RangeInclusive<T> {
|
||||
/// assert_eq!(RangeFrom::from(2..), core::range::RangeFrom { start: 2 });
|
||||
/// assert_eq!(2 + 3 + 4, RangeFrom::from(2..).into_iter().take(3).sum());
|
||||
/// ```
|
||||
#[cfg_attr(not(bootstrap), lang = "RangeFromCopy")]
|
||||
#[lang = "RangeFromCopy"]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash)]
|
||||
#[unstable(feature = "new_range_api", issue = "125687")]
|
||||
pub struct RangeFrom<Idx> {
|
||||
|
@ -153,10 +153,7 @@ mod intrinsics;
|
||||
mod io;
|
||||
mod iter;
|
||||
mod lazy;
|
||||
#[cfg(not(bootstrap))]
|
||||
mod macros;
|
||||
#[cfg(bootstrap)]
|
||||
mod macros_bootstrap;
|
||||
mod manually_drop;
|
||||
mod mem;
|
||||
mod net;
|
||||
|
@ -1,193 +0,0 @@
|
||||
#![allow(unused_must_use)]
|
||||
|
||||
#[allow(dead_code)]
|
||||
trait Trait {
|
||||
fn blah(&self);
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
struct Struct;
|
||||
|
||||
impl Trait for Struct {
|
||||
cfg_match! {
|
||||
cfg(feature = "blah") => {
|
||||
fn blah(&self) {
|
||||
unimplemented!();
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
fn blah(&self) {
|
||||
unimplemented!();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn assert_eq_trailing_comma() {
|
||||
assert_eq!(1, 1,);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn assert_escape() {
|
||||
assert!(r#"☃\backslash"#.contains("\\"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn assert_ne_trailing_comma() {
|
||||
assert_ne!(1, 2,);
|
||||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[test]
|
||||
fn matches_leading_pipe() {
|
||||
matches!(1, | 1 | 2 | 3);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cfg_match_basic() {
|
||||
cfg_match! {
|
||||
cfg(target_pointer_width = "64") => { fn f0_() -> bool { true }}
|
||||
}
|
||||
|
||||
cfg_match! {
|
||||
cfg(unix) => { fn f1_() -> bool { true }}
|
||||
cfg(any(target_os = "macos", target_os = "linux")) => { fn f1_() -> bool { false }}
|
||||
}
|
||||
|
||||
cfg_match! {
|
||||
cfg(target_pointer_width = "32") => { fn f2_() -> bool { false }}
|
||||
cfg(target_pointer_width = "64") => { fn f2_() -> bool { true }}
|
||||
}
|
||||
|
||||
cfg_match! {
|
||||
cfg(target_pointer_width = "16") => { fn f3_() -> i32 { 1 }}
|
||||
_ => { fn f3_() -> i32 { 2 }}
|
||||
}
|
||||
|
||||
#[cfg(target_pointer_width = "64")]
|
||||
assert!(f0_());
|
||||
|
||||
#[cfg(unix)]
|
||||
assert!(f1_());
|
||||
|
||||
#[cfg(target_pointer_width = "32")]
|
||||
assert!(!f2_());
|
||||
#[cfg(target_pointer_width = "64")]
|
||||
assert!(f2_());
|
||||
|
||||
#[cfg(not(target_pointer_width = "16"))]
|
||||
assert_eq!(f3_(), 2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cfg_match_debug_assertions() {
|
||||
cfg_match! {
|
||||
cfg(debug_assertions) => {
|
||||
assert!(cfg!(debug_assertions));
|
||||
assert_eq!(4, 2+2);
|
||||
}
|
||||
_ => {
|
||||
assert!(cfg!(not(debug_assertions)));
|
||||
assert_eq!(10, 5+5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_pointer_width = "64")]
|
||||
#[test]
|
||||
fn cfg_match_no_duplication_on_64() {
|
||||
cfg_match! {
|
||||
cfg(windows) => {
|
||||
fn foo() {}
|
||||
}
|
||||
cfg(unix) => {
|
||||
fn foo() {}
|
||||
}
|
||||
cfg(target_pointer_width = "64") => {
|
||||
fn foo() {}
|
||||
}
|
||||
}
|
||||
foo();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cfg_match_options() {
|
||||
cfg_match! {
|
||||
cfg(test) => {
|
||||
use core::option::Option as Option2;
|
||||
fn works1() -> Option2<u32> { Some(1) }
|
||||
}
|
||||
_ => { fn works1() -> Option<u32> { None } }
|
||||
}
|
||||
|
||||
cfg_match! {
|
||||
cfg(feature = "foo") => { fn works2() -> bool { false } }
|
||||
cfg(test) => { fn works2() -> bool { true } }
|
||||
_ => { fn works2() -> bool { false } }
|
||||
}
|
||||
|
||||
cfg_match! {
|
||||
cfg(feature = "foo") => { fn works3() -> bool { false } }
|
||||
_ => { fn works3() -> bool { true } }
|
||||
}
|
||||
|
||||
cfg_match! {
|
||||
cfg(test) => {
|
||||
use core::option::Option as Option3;
|
||||
fn works4() -> Option3<u32> { Some(1) }
|
||||
}
|
||||
}
|
||||
|
||||
cfg_match! {
|
||||
cfg(feature = "foo") => { fn works5() -> bool { false } }
|
||||
cfg(test) => { fn works5() -> bool { true } }
|
||||
}
|
||||
|
||||
assert!(works1().is_some());
|
||||
assert!(works2());
|
||||
assert!(works3());
|
||||
assert!(works4().is_some());
|
||||
assert!(works5());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cfg_match_two_functions() {
|
||||
cfg_match! {
|
||||
cfg(target_pointer_width = "64") => {
|
||||
fn foo1() {}
|
||||
fn bar1() {}
|
||||
}
|
||||
_ => {
|
||||
fn foo2() {}
|
||||
fn bar2() {}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_pointer_width = "64")]
|
||||
{
|
||||
foo1();
|
||||
bar1();
|
||||
}
|
||||
#[cfg(not(target_pointer_width = "64"))]
|
||||
{
|
||||
foo2();
|
||||
bar2();
|
||||
}
|
||||
}
|
||||
|
||||
fn _accepts_expressions() -> i32 {
|
||||
cfg_match! {
|
||||
cfg(unix) => { 1 }
|
||||
_ => { 2 }
|
||||
}
|
||||
}
|
||||
|
||||
fn _allows_stmt_expr_attributes() {
|
||||
let one = 1;
|
||||
let two = 2;
|
||||
cfg_match! {
|
||||
cfg(unix) => { one * two; }
|
||||
_ => { one + two; }
|
||||
}
|
||||
}
|
@ -14,6 +14,7 @@
|
||||
#![no_std]
|
||||
#![unstable(feature = "panic_unwind", issue = "32837")]
|
||||
#![doc(issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/")]
|
||||
#![feature(cfg_emscripten_wasm_eh)]
|
||||
#![feature(core_intrinsics)]
|
||||
#![feature(lang_items)]
|
||||
#![feature(panic_unwind)]
|
||||
@ -25,7 +26,6 @@
|
||||
// `real_imp` is unused with Miri, so silence warnings.
|
||||
#![cfg_attr(miri, allow(dead_code))]
|
||||
#![allow(internal_features)]
|
||||
#![cfg_attr(not(bootstrap), feature(cfg_emscripten_wasm_eh))]
|
||||
#![warn(unreachable_pub)]
|
||||
#![deny(unsafe_op_in_unsafe_fn)]
|
||||
|
||||
|
@ -274,7 +274,6 @@
|
||||
// tidy-alphabetical-start
|
||||
|
||||
// stabilization was reverted after it hit beta
|
||||
#![cfg_attr(not(bootstrap), feature(extended_varargs_abi_support))]
|
||||
#![feature(alloc_error_handler)]
|
||||
#![feature(allocator_internals)]
|
||||
#![feature(allow_internal_unsafe)]
|
||||
@ -292,6 +291,7 @@
|
||||
#![feature(doc_masked)]
|
||||
#![feature(doc_notable_trait)]
|
||||
#![feature(dropck_eyepatch)]
|
||||
#![feature(extended_varargs_abi_support)]
|
||||
#![feature(f128)]
|
||||
#![feature(f16)]
|
||||
#![feature(formatting_options)]
|
||||
|
@ -1,5 +1,6 @@
|
||||
#![no_std]
|
||||
#![unstable(feature = "panic_unwind", issue = "32837")]
|
||||
#![feature(cfg_emscripten_wasm_eh)]
|
||||
#![feature(link_cfg)]
|
||||
#![feature(staged_api)]
|
||||
#![cfg_attr(not(target_env = "msvc"), feature(libc))]
|
||||
@ -8,7 +9,6 @@
|
||||
feature(simd_wasm64, wasm_exception_handling_intrinsics)
|
||||
)]
|
||||
#![allow(internal_features)]
|
||||
#![cfg_attr(not(bootstrap), feature(cfg_emscripten_wasm_eh))]
|
||||
#![deny(unsafe_op_in_unsafe_fn)]
|
||||
|
||||
// Force libc to be included even if unused. This is required by many platforms.
|
||||
|
@ -1847,10 +1847,7 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
|
||||
}
|
||||
|
||||
// FIXME(136096): on macOS, we get linker warnings about duplicate `-lm` flags.
|
||||
// NOTE: `stage > 1` here because `test --stage 1 ui-fulldeps` is a hack that compiles
|
||||
// with stage 0, but links the tests against stage 1.
|
||||
// cfg(bootstrap) - remove only the `stage > 1` check, leave everything else.
|
||||
if suite == "ui-fulldeps" && compiler.stage > 1 && target.ends_with("darwin") {
|
||||
if suite == "ui-fulldeps" && target.ends_with("darwin") {
|
||||
flags.push("-Alinker_messages".into());
|
||||
}
|
||||
|
||||
|
@ -285,10 +285,7 @@ impl Cargo {
|
||||
|
||||
// Ignore linker warnings for now. These are complicated to fix and don't affect the build.
|
||||
// FIXME: we should really investigate these...
|
||||
// cfg(bootstrap)
|
||||
if compiler.stage != 0 {
|
||||
self.rustflags.arg("-Alinker-messages");
|
||||
}
|
||||
self.rustflags.arg("-Alinker-messages");
|
||||
|
||||
// Throughout the build Cargo can execute a number of build scripts
|
||||
// compiling C/C++ code and we need to pass compilers, archivers, flags, etc
|
||||
@ -1071,10 +1068,7 @@ impl Builder<'_> {
|
||||
|
||||
if mode == Mode::Rustc {
|
||||
rustflags.arg("-Wrustc::internal");
|
||||
// cfg(bootstrap) - remove this check when lint is in bootstrap compiler
|
||||
if stage != 0 {
|
||||
rustflags.arg("-Drustc::symbol_intern_string_literal");
|
||||
}
|
||||
rustflags.arg("-Drustc::symbol_intern_string_literal");
|
||||
// FIXME(edition_2024): Change this to `-Wrust_2024_idioms` when all
|
||||
// of the individual lints are satisfied.
|
||||
rustflags.arg("-Wkeyword_idents_2024");
|
||||
|
@ -891,8 +891,6 @@ fn test_needs_target_has_atomic() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
// FIXME: this test will fail against stage 0 until #137037 changes reach beta.
|
||||
#[cfg_attr(bootstrap, ignore)]
|
||||
fn test_rustc_abi() {
|
||||
let config = cfg().target("i686-unknown-linux-gnu").build();
|
||||
assert_eq!(config.target_cfg().rustc_abi, Some("x86-sse2".to_string()));
|
||||
|
@ -1,4 +1,3 @@
|
||||
#![cfg_attr(bootstrap, feature(trait_upcasting))]
|
||||
#![feature(rustc_private)]
|
||||
#![feature(cell_update)]
|
||||
#![feature(float_gamma)]
|
||||
|
Loading…
x
Reference in New Issue
Block a user