Skip to content

Commit f9f5840

Browse files
committed
update cfg(bootstrap)s
1 parent bcdaa0d commit f9f5840

File tree

17 files changed

+24
-452
lines changed

17 files changed

+24
-452
lines changed

compiler/rustc_codegen_cranelift/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#![cfg_attr(all(doc, not(bootstrap)), allow(internal_features))]
2-
#![cfg_attr(all(doc, not(bootstrap)), feature(rustdoc_internals))]
3-
#![cfg_attr(all(doc, not(bootstrap)), doc(rust_logo))]
1+
#![cfg_attr(doc, allow(internal_features))]
2+
#![cfg_attr(doc, feature(rustdoc_internals))]
3+
#![cfg_attr(doc, doc(rust_logo))]
44
#![feature(rustc_private)]
55
// Note: please avoid adding other feature gates where possible
66
#![warn(rust_2018_idioms)]

compiler/rustc_codegen_llvm/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#![feature(rustdoc_internals)]
99
#![doc(rust_logo)]
1010
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
11-
#![cfg_attr(bootstrap, feature(c_str_literals))]
1211
#![feature(exact_size_is_empty)]
1312
#![feature(extern_types)]
1413
#![feature(hash_raw_entry)]

compiler/rustc_data_structures/src/tagged_ptr/impl_tag.rs

-144
Original file line numberDiff line numberDiff line change
@@ -81,150 +81,6 @@
8181
/// E::A,
8282
/// }
8383
/// ```
84-
#[cfg(bootstrap)]
85-
#[macro_export]
86-
macro_rules! impl_tag {
87-
(
88-
impl Tag for $Self:ty;
89-
$(
90-
$($path:ident)::* $( { $( $fields:tt )* })?,
91-
)*
92-
) => {
93-
// Safety:
94-
// `bits_for_tags` is called on the same `${index()}`-es as
95-
// `into_usize` returns, thus `BITS` constant is correct.
96-
unsafe impl $crate::tagged_ptr::Tag for $Self {
97-
const BITS: u32 = $crate::tagged_ptr::bits_for_tags(&[
98-
$(
99-
${index()},
100-
$( ${ignore(path)} )*
101-
)*
102-
]);
103-
104-
#[inline]
105-
fn into_usize(self) -> usize {
106-
// This forbids use of repeating patterns (`Enum::V`&`Enum::V`, etc)
107-
// (or at least it should, see <https://github.com/rust-lang/rust/issues/110613>)
108-
#[forbid(unreachable_patterns)]
109-
match self {
110-
// `match` is doing heavy lifting here, by requiring exhaustiveness
111-
$(
112-
$($path)::* $( { $( $fields )* } )? => ${index()},
113-
)*
114-
}
115-
}
116-
117-
#[inline]
118-
unsafe fn from_usize(tag: usize) -> Self {
119-
match tag {
120-
$(
121-
${index()} => $($path)::* $( { $( $fields )* } )?,
122-
)*
123-
124-
// Safety:
125-
// `into_usize` only returns `${index()}` of the same
126-
// repetition as we are filtering above, thus if this is
127-
// reached, the safety contract of this function was
128-
// already breached.
129-
_ => unsafe {
130-
debug_assert!(
131-
false,
132-
"invalid tag: {tag}\
133-
(this is a bug in the caller of `from_usize`)"
134-
);
135-
std::hint::unreachable_unchecked()
136-
},
137-
}
138-
}
139-
140-
}
141-
};
142-
}
143-
144-
/// Implements [`Tag`] for a given type.
145-
///
146-
/// You can use `impl_tag` on structs and enums.
147-
/// You need to specify the type and all its possible values,
148-
/// which can only be paths with optional fields.
149-
///
150-
/// [`Tag`]: crate::tagged_ptr::Tag
151-
///
152-
/// # Examples
153-
///
154-
/// Basic usage:
155-
///
156-
/// ```
157-
/// #![feature(macro_metavar_expr)]
158-
/// use rustc_data_structures::{impl_tag, tagged_ptr::Tag};
159-
///
160-
/// #[derive(Copy, Clone, PartialEq, Debug)]
161-
/// enum SomeTag {
162-
/// A,
163-
/// B,
164-
/// X { v: bool },
165-
/// Y(bool, bool),
166-
/// }
167-
///
168-
/// impl_tag! {
169-
/// // The type for which the `Tag` will be implemented
170-
/// impl Tag for SomeTag;
171-
/// // You need to specify all possible tag values:
172-
/// SomeTag::A, // 0
173-
/// SomeTag::B, // 1
174-
/// // For variants with fields, you need to specify the fields:
175-
/// SomeTag::X { v: true }, // 2
176-
/// SomeTag::X { v: false }, // 3
177-
/// // For tuple variants use named syntax:
178-
/// SomeTag::Y { 0: true, 1: true }, // 4
179-
/// SomeTag::Y { 0: false, 1: true }, // 5
180-
/// SomeTag::Y { 0: true, 1: false }, // 6
181-
/// SomeTag::Y { 0: false, 1: false }, // 7
182-
/// }
183-
///
184-
/// // Tag values are assigned in order:
185-
/// assert_eq!(SomeTag::A.into_usize(), 0);
186-
/// assert_eq!(SomeTag::X { v: false }.into_usize(), 3);
187-
/// assert_eq!(SomeTag::Y(false, true).into_usize(), 5);
188-
///
189-
/// assert_eq!(unsafe { SomeTag::from_usize(1) }, SomeTag::B);
190-
/// assert_eq!(unsafe { SomeTag::from_usize(2) }, SomeTag::X { v: true });
191-
/// assert_eq!(unsafe { SomeTag::from_usize(7) }, SomeTag::Y(false, false));
192-
/// ```
193-
///
194-
/// Structs are supported:
195-
///
196-
/// ```
197-
/// #![feature(macro_metavar_expr)]
198-
/// # use rustc_data_structures::impl_tag;
199-
/// #[derive(Copy, Clone)]
200-
/// struct Flags { a: bool, b: bool }
201-
///
202-
/// impl_tag! {
203-
/// impl Tag for Flags;
204-
/// Flags { a: true, b: true },
205-
/// Flags { a: false, b: true },
206-
/// Flags { a: true, b: false },
207-
/// Flags { a: false, b: false },
208-
/// }
209-
/// ```
210-
///
211-
/// Not specifying all values results in a compile error:
212-
///
213-
/// ```compile_fail,E0004
214-
/// #![feature(macro_metavar_expr)]
215-
/// # use rustc_data_structures::impl_tag;
216-
/// #[derive(Copy, Clone)]
217-
/// enum E {
218-
/// A,
219-
/// B,
220-
/// }
221-
///
222-
/// impl_tag! {
223-
/// impl Tag for E;
224-
/// E::A,
225-
/// }
226-
/// ```
227-
#[cfg(not(bootstrap))]
22884
#[macro_export]
22985
macro_rules! impl_tag {
23086
(

compiler/rustc_expand/src/expand.rs

-126
Original file line numberDiff line numberDiff line change
@@ -41,132 +41,6 @@ use std::path::PathBuf;
4141
use std::rc::Rc;
4242
use std::{iter, mem};
4343

44-
#[cfg(bootstrap)]
45-
macro_rules! ast_fragments {
46-
(
47-
$($Kind:ident($AstTy:ty) {
48-
$kind_name:expr;
49-
$(one fn $mut_visit_ast:ident; fn $visit_ast:ident;)?
50-
$(many fn $flat_map_ast_elt:ident; fn $visit_ast_elt:ident($($args:tt)*);)?
51-
fn $make_ast:ident;
52-
})*
53-
) => {
54-
/// A fragment of AST that can be produced by a single macro expansion.
55-
/// Can also serve as an input and intermediate result for macro expansion operations.
56-
pub enum AstFragment {
57-
OptExpr(Option<P<ast::Expr>>),
58-
MethodReceiverExpr(P<ast::Expr>),
59-
$($Kind($AstTy),)*
60-
}
61-
62-
/// "Discriminant" of an AST fragment.
63-
#[derive(Copy, Clone, PartialEq, Eq)]
64-
pub enum AstFragmentKind {
65-
OptExpr,
66-
MethodReceiverExpr,
67-
$($Kind,)*
68-
}
69-
70-
impl AstFragmentKind {
71-
pub fn name(self) -> &'static str {
72-
match self {
73-
AstFragmentKind::OptExpr => "expression",
74-
AstFragmentKind::MethodReceiverExpr => "expression",
75-
$(AstFragmentKind::$Kind => $kind_name,)*
76-
}
77-
}
78-
79-
fn make_from<'a>(self, result: Box<dyn MacResult + 'a>) -> Option<AstFragment> {
80-
match self {
81-
AstFragmentKind::OptExpr =>
82-
result.make_expr().map(Some).map(AstFragment::OptExpr),
83-
AstFragmentKind::MethodReceiverExpr =>
84-
result.make_expr().map(AstFragment::MethodReceiverExpr),
85-
$(AstFragmentKind::$Kind => result.$make_ast().map(AstFragment::$Kind),)*
86-
}
87-
}
88-
}
89-
90-
impl AstFragment {
91-
pub fn add_placeholders(&mut self, placeholders: &[NodeId]) {
92-
if placeholders.is_empty() {
93-
return;
94-
}
95-
match self {
96-
$($(AstFragment::$Kind(ast) => ast.extend(placeholders.iter().flat_map(|id| {
97-
${ignore(flat_map_ast_elt)}
98-
placeholder(AstFragmentKind::$Kind, *id, None).$make_ast()
99-
})),)?)*
100-
_ => panic!("unexpected AST fragment kind")
101-
}
102-
}
103-
104-
pub fn make_opt_expr(self) -> Option<P<ast::Expr>> {
105-
match self {
106-
AstFragment::OptExpr(expr) => expr,
107-
_ => panic!("AstFragment::make_* called on the wrong kind of fragment"),
108-
}
109-
}
110-
111-
pub fn make_method_receiver_expr(self) -> P<ast::Expr> {
112-
match self {
113-
AstFragment::MethodReceiverExpr(expr) => expr,
114-
_ => panic!("AstFragment::make_* called on the wrong kind of fragment"),
115-
}
116-
}
117-
118-
$(pub fn $make_ast(self) -> $AstTy {
119-
match self {
120-
AstFragment::$Kind(ast) => ast,
121-
_ => panic!("AstFragment::make_* called on the wrong kind of fragment"),
122-
}
123-
})*
124-
125-
fn make_ast<T: InvocationCollectorNode>(self) -> T::OutputTy {
126-
T::fragment_to_output(self)
127-
}
128-
129-
pub fn mut_visit_with<F: MutVisitor>(&mut self, vis: &mut F) {
130-
match self {
131-
AstFragment::OptExpr(opt_expr) => {
132-
visit_clobber(opt_expr, |opt_expr| {
133-
if let Some(expr) = opt_expr {
134-
vis.filter_map_expr(expr)
135-
} else {
136-
None
137-
}
138-
});
139-
}
140-
AstFragment::MethodReceiverExpr(expr) => vis.visit_method_receiver_expr(expr),
141-
$($(AstFragment::$Kind(ast) => vis.$mut_visit_ast(ast),)?)*
142-
$($(AstFragment::$Kind(ast) =>
143-
ast.flat_map_in_place(|ast| vis.$flat_map_ast_elt(ast)),)?)*
144-
}
145-
}
146-
147-
pub fn visit_with<'a, V: Visitor<'a>>(&'a self, visitor: &mut V) {
148-
match self {
149-
AstFragment::OptExpr(Some(expr)) => visitor.visit_expr(expr),
150-
AstFragment::OptExpr(None) => {}
151-
AstFragment::MethodReceiverExpr(expr) => visitor.visit_method_receiver_expr(expr),
152-
$($(AstFragment::$Kind(ast) => visitor.$visit_ast(ast),)?)*
153-
$($(AstFragment::$Kind(ast) => for ast_elt in &ast[..] {
154-
visitor.$visit_ast_elt(ast_elt, $($args)*);
155-
})?)*
156-
}
157-
}
158-
}
159-
160-
impl<'a> MacResult for crate::mbe::macro_rules::ParserAnyMacro<'a> {
161-
$(fn $make_ast(self: Box<crate::mbe::macro_rules::ParserAnyMacro<'a>>)
162-
-> Option<$AstTy> {
163-
Some(self.make(AstFragmentKind::$Kind).$make_ast())
164-
})*
165-
}
166-
}
167-
}
168-
169-
#[cfg(not(bootstrap))]
17044
macro_rules! ast_fragments {
17145
(
17246
$($Kind:ident($AstTy:ty) {

compiler/rustc_lint/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
#![feature(min_specialization)]
4040
#![feature(never_type)]
4141
#![feature(rustc_attrs)]
42-
#![cfg_attr(bootstrap, feature(trait_upcasting))]
4342
#![recursion_limit = "256"]
4443
#![deny(rustc::untranslatable_diagnostic)]
4544
#![deny(rustc::diagnostic_outside_of_impl)]

compiler/rustc_middle/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
#![feature(associated_type_bounds)]
5050
#![feature(rustc_attrs)]
5151
#![feature(control_flow_enum)]
52-
#![cfg_attr(bootstrap, feature(trait_upcasting))]
5352
#![feature(trusted_step)]
5453
#![feature(try_blocks)]
5554
#![feature(try_reserve_kind)]

library/core/src/async_iter/async_iter.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use crate::task::{Context, Poll};
1313
#[unstable(feature = "async_iterator", issue = "79024")]
1414
#[must_use = "async iterators do nothing unless polled"]
1515
#[doc(alias = "Stream")]
16-
#[cfg_attr(not(bootstrap), lang = "async_iterator")]
16+
#[lang = "async_iterator"]
1717
pub trait AsyncIterator {
1818
/// The type of items yielded by the async iterator.
1919
type Item;
@@ -116,21 +116,21 @@ impl<T> Poll<Option<T>> {
116116
/// A helper function for internal desugaring -- produces `Ready(Some(t))`,
117117
/// which corresponds to the async iterator yielding a value.
118118
#[unstable(feature = "async_gen_internals", issue = "none")]
119-
#[cfg_attr(not(bootstrap), lang = "AsyncGenReady")]
119+
#[lang = "AsyncGenReady"]
120120
pub fn async_gen_ready(t: T) -> Self {
121121
Poll::Ready(Some(t))
122122
}
123123

124124
/// A helper constant for internal desugaring -- produces `Pending`,
125125
/// which corresponds to the async iterator pending on an `.await`.
126126
#[unstable(feature = "async_gen_internals", issue = "none")]
127-
#[cfg_attr(not(bootstrap), lang = "AsyncGenPending")]
127+
#[lang = "AsyncGenPending"]
128128
// FIXME(gen_blocks): This probably could be deduplicated.
129129
pub const PENDING: Self = Poll::Pending;
130130

131131
/// A helper constant for internal desugaring -- produces `Ready(None)`,
132132
/// which corresponds to the async iterator finishing its iteration.
133133
#[unstable(feature = "async_gen_internals", issue = "none")]
134-
#[cfg_attr(not(bootstrap), lang = "AsyncGenFinished")]
134+
#[lang = "AsyncGenFinished"]
135135
pub const FINISHED: Self = Poll::Ready(None);
136136
}

library/core/src/cmp.rs

+3-13
Original file line numberDiff line numberDiff line change
@@ -224,21 +224,21 @@ use self::Ordering::*;
224224
append_const_msg
225225
)]
226226
#[rustc_diagnostic_item = "PartialEq"]
227-
#[cfg_attr(not(bootstrap), const_trait)]
227+
#[const_trait]
228228
pub trait PartialEq<Rhs: ?Sized = Self> {
229229
/// This method tests for `self` and `other` values to be equal, and is used
230230
/// by `==`.
231231
#[must_use]
232232
#[stable(feature = "rust1", since = "1.0.0")]
233-
#[cfg_attr(not(bootstrap), rustc_diagnostic_item = "cmp_partialeq_eq")]
233+
#[rustc_diagnostic_item = "cmp_partialeq_eq"]
234234
fn eq(&self, other: &Rhs) -> bool;
235235

236236
/// This method tests for `!=`. The default implementation is almost always
237237
/// sufficient, and should not be overridden without very good reason.
238238
#[inline]
239239
#[must_use]
240240
#[stable(feature = "rust1", since = "1.0.0")]
241-
#[cfg_attr(not(bootstrap), rustc_diagnostic_item = "cmp_partialeq_ne")]
241+
#[rustc_diagnostic_item = "cmp_partialeq_ne"]
242242
fn ne(&self, other: &Rhs) -> bool {
243243
!self.eq(other)
244244
}
@@ -1416,18 +1416,8 @@ mod impls {
14161416

14171417
macro_rules! partial_eq_impl {
14181418
($($t:ty)*) => ($(
1419-
#[stable(feature = "rust1", since = "1.0.0")]
1420-
#[cfg(bootstrap)]
1421-
impl PartialEq for $t {
1422-
#[inline]
1423-
fn eq(&self, other: &$t) -> bool { (*self) == (*other) }
1424-
#[inline]
1425-
fn ne(&self, other: &$t) -> bool { (*self) != (*other) }
1426-
}
1427-
14281419
#[stable(feature = "rust1", since = "1.0.0")]
14291420
#[rustc_const_unstable(feature = "const_cmp", issue = "92391")]
1430-
#[cfg(not(bootstrap))]
14311421
impl const PartialEq for $t {
14321422
#[inline]
14331423
fn eq(&self, other: &$t) -> bool { (*self) == (*other) }

0 commit comments

Comments
 (0)