Skip to content

Commit 06661ba

Browse files
Update to new bootstrap compiler
1 parent 17ea490 commit 06661ba

File tree

25 files changed

+11
-394
lines changed

25 files changed

+11
-394
lines changed

compiler/rustc_ast/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
)]
1111
#![feature(box_syntax)]
1212
#![feature(box_patterns)]
13-
#![cfg_attr(bootstrap, feature(const_fn_unsize))]
1413
#![feature(const_fn_transmute)]
1514
#![feature(crate_visibility_modifier)]
1615
#![feature(iter_zip)]

compiler/rustc_codegen_llvm/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#![feature(bool_to_option)]
99
#![feature(const_cstr_unchecked)]
1010
#![feature(crate_visibility_modifier)]
11-
#![cfg_attr(bootstrap, feature(extended_key_value_attributes))]
1211
#![feature(extern_types)]
1312
#![feature(in_band_lifetimes)]
1413
#![feature(iter_zip)]

compiler/rustc_errors/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
66
#![feature(crate_visibility_modifier)]
77
#![feature(backtrace)]
8-
#![cfg_attr(bootstrap, feature(extended_key_value_attributes))]
98
#![feature(format_args_capture)]
109
#![feature(iter_zip)]
1110
#![feature(nll)]

compiler/rustc_hir/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
//! [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/hir.html
44
55
#![feature(crate_visibility_modifier)]
6-
#![cfg_attr(bootstrap, feature(extended_key_value_attributes))]
76
#![feature(in_band_lifetimes)]
87
#![feature(once_cell)]
98
#![feature(min_specialization)]

library/alloc/src/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,7 @@
136136
#![feature(maybe_uninit_extra, maybe_uninit_slice, maybe_uninit_uninit_array)]
137137
#![feature(alloc_layout_extra)]
138138
#![feature(trusted_random_access)]
139-
#![cfg_attr(bootstrap, feature(try_trait))]
140-
#![cfg_attr(not(bootstrap), feature(try_trait_v2))]
139+
#![feature(try_trait_v2)]
141140
#![feature(min_type_alias_impl_trait)]
142141
#![feature(associated_type_bounds)]
143142
#![feature(slice_group_by)]

library/core/src/iter/adapters/peekable.rs

-23
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ where
130130
}
131131

132132
#[inline]
133-
#[cfg(not(bootstrap))]
134133
fn try_rfold<B, F, R>(&mut self, init: B, mut f: F) -> R
135134
where
136135
Self: Sized,
@@ -150,28 +149,6 @@ where
150149
}
151150
}
152151

153-
#[inline]
154-
#[cfg(bootstrap)]
155-
fn try_rfold<B, F, R>(&mut self, init: B, mut f: F) -> R
156-
where
157-
Self: Sized,
158-
F: FnMut(B, Self::Item) -> R,
159-
R: Try<Output = B>,
160-
{
161-
let _use_the_import: ControlFlow<()>;
162-
match self.peeked.take() {
163-
Some(None) => try { init },
164-
Some(Some(v)) => match self.iter.try_rfold(init, &mut f).into_result() {
165-
Ok(acc) => f(acc, v),
166-
Err(e) => {
167-
self.peeked = Some(Some(v));
168-
R::from_error(e)
169-
}
170-
},
171-
None => self.iter.try_rfold(init, f),
172-
}
173-
}
174-
175152
#[inline]
176153
fn rfold<Acc, Fold>(self, init: Acc, mut fold: Fold) -> Acc
177154
where

library/core/src/iter/traits/iterator.rs

-27
Original file line numberDiff line numberDiff line change
@@ -2439,7 +2439,6 @@ pub trait Iterator {
24392439
/// ```
24402440
#[inline]
24412441
#[unstable(feature = "try_find", reason = "new API", issue = "63178")]
2442-
#[cfg(not(bootstrap))]
24432442
fn try_find<F, R, E>(&mut self, f: F) -> Result<Option<Self::Item>, E>
24442443
where
24452444
Self: Sized,
@@ -2466,32 +2465,6 @@ pub trait Iterator {
24662465
self.try_fold((), check(f)).break_value().transpose()
24672466
}
24682467

2469-
/// We're bootstrapping.
2470-
#[inline]
2471-
#[unstable(feature = "try_find", reason = "new API", issue = "63178")]
2472-
#[cfg(bootstrap)]
2473-
fn try_find<F, R>(&mut self, f: F) -> Result<Option<Self::Item>, R::Error>
2474-
where
2475-
Self: Sized,
2476-
F: FnMut(&Self::Item) -> R,
2477-
R: Try<Output = bool>,
2478-
{
2479-
#[inline]
2480-
fn check<F, T, R>(mut f: F) -> impl FnMut((), T) -> ControlFlow<Result<T, R::Error>>
2481-
where
2482-
F: FnMut(&T) -> R,
2483-
R: Try<Output = bool>,
2484-
{
2485-
move |(), x| match f(&x).into_result() {
2486-
Ok(false) => ControlFlow::CONTINUE,
2487-
Ok(true) => ControlFlow::Break(Ok(x)),
2488-
Err(x) => ControlFlow::Break(Err(x)),
2489-
}
2490-
}
2491-
2492-
self.try_fold((), check(f)).break_value().transpose()
2493-
}
2494-
24952468
/// Searches for an element in an iterator, returning its index.
24962469
///
24972470
/// `position()` takes a closure that returns `true` or `false`. It applies

library/core/src/lib.rs

-3
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@
8787
#![feature(const_fn_floating_point_arithmetic)]
8888
#![feature(const_fn_fn_ptr_basics)]
8989
#![feature(const_fn_trait_bound)]
90-
#![cfg_attr(bootstrap, feature(const_fn))]
9190
#![feature(const_option)]
9291
#![feature(const_precise_live_drops)]
9392
#![feature(const_ptr_offset)]
@@ -112,7 +111,6 @@
112111
#![feature(doc_cfg)]
113112
#![feature(doc_notable_trait)]
114113
#![feature(duration_consts_2)]
115-
#![cfg_attr(bootstrap, feature(extended_key_value_attributes))]
116114
#![feature(extern_types)]
117115
#![feature(fundamental)]
118116
#![feature(intra_doc_pointers)]
@@ -165,7 +163,6 @@
165163
#![feature(slice_ptr_get)]
166164
#![feature(no_niche)] // rust-lang/rust#68303
167165
#![feature(no_coverage)] // rust-lang/rust#84605
168-
#![cfg_attr(bootstrap, feature(target_feature_11))]
169166
#![deny(unsafe_op_in_unsafe_fn)]
170167
#![deny(or_patterns_back_compat)]
171168

library/core/src/marker.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ use crate::hash::Hasher;
3131
/// [ub]: ../../reference/behavior-considered-undefined.html
3232
#[stable(feature = "rust1", since = "1.0.0")]
3333
#[cfg_attr(not(test), rustc_diagnostic_item = "send_trait")]
34-
#[cfg_attr(not(bootstrap), lang = "send")]
34+
#[lang = "send"]
3535
#[rustc_on_unimplemented(
3636
message = "`{Self}` cannot be sent between threads safely",
3737
label = "`{Self}` cannot be sent between threads safely"

library/core/src/ops/control_flow.rs

+2-46
Original file line numberDiff line numberDiff line change
@@ -51,39 +51,17 @@ use crate::{convert, ops};
5151
pub enum ControlFlow<B, C = ()> {
5252
/// Move on to the next phase of the operation as normal.
5353
#[stable(feature = "control_flow_enum_type", since = "1.55.0")]
54-
#[cfg_attr(not(bootstrap), lang = "Continue")]
54+
#[lang = "Continue"]
5555
Continue(C),
5656
/// Exit the operation without running subsequent phases.
5757
#[stable(feature = "control_flow_enum_type", since = "1.55.0")]
58-
#[cfg_attr(not(bootstrap), lang = "Break")]
58+
#[lang = "Break"]
5959
Break(B),
6060
// Yes, the order of the variants doesn't match the type parameters.
6161
// They're in this order so that `ControlFlow<A, B>` <-> `Result<B, A>`
6262
// is a no-op conversion in the `Try` implementation.
6363
}
6464

65-
#[unstable(feature = "control_flow_enum", reason = "new API", issue = "75744")]
66-
#[cfg(bootstrap)]
67-
impl<B, C> ops::TryV1 for ControlFlow<B, C> {
68-
type Output = C;
69-
type Error = B;
70-
#[inline]
71-
fn into_result(self) -> Result<Self::Output, Self::Error> {
72-
match self {
73-
ControlFlow::Continue(y) => Ok(y),
74-
ControlFlow::Break(x) => Err(x),
75-
}
76-
}
77-
#[inline]
78-
fn from_error(v: Self::Error) -> Self {
79-
ControlFlow::Break(v)
80-
}
81-
#[inline]
82-
fn from_ok(v: Self::Output) -> Self {
83-
ControlFlow::Continue(v)
84-
}
85-
}
86-
8765
#[unstable(feature = "try_trait_v2", issue = "84277")]
8866
impl<B, C> ops::TryV2 for ControlFlow<B, C> {
8967
type Output = C;
@@ -184,31 +162,9 @@ impl<B, C> ControlFlow<B, C> {
184162
}
185163
}
186164

187-
#[cfg(bootstrap)]
188-
impl<R: ops::TryV1> ControlFlow<R, R::Output> {
189-
/// Create a `ControlFlow` from any type implementing `Try`.
190-
#[inline]
191-
pub(crate) fn from_try(r: R) -> Self {
192-
match R::into_result(r) {
193-
Ok(v) => ControlFlow::Continue(v),
194-
Err(v) => ControlFlow::Break(R::from_error(v)),
195-
}
196-
}
197-
198-
/// Convert a `ControlFlow` into any type implementing `Try`;
199-
#[inline]
200-
pub(crate) fn into_try(self) -> R {
201-
match self {
202-
ControlFlow::Continue(v) => R::from_ok(v),
203-
ControlFlow::Break(v) => v,
204-
}
205-
}
206-
}
207-
208165
/// These are used only as part of implementing the iterator adapters.
209166
/// They have mediocre names and non-obvious semantics, so aren't
210167
/// currently on a path to potential stabilization.
211-
#[cfg(not(bootstrap))]
212168
impl<R: ops::TryV2> ControlFlow<R, R::Output> {
213169
/// Create a `ControlFlow` from any type implementing `Try`.
214170
#[inline]

library/core/src/ops/mod.rs

-11
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,6 @@ mod function;
147147
mod generator;
148148
mod index;
149149
mod range;
150-
#[cfg(bootstrap)]
151-
mod r#try;
152150
mod try_trait;
153151
mod unsize;
154152

@@ -183,19 +181,10 @@ pub use self::range::{Range, RangeFrom, RangeFull, RangeTo};
183181
#[stable(feature = "inclusive_range", since = "1.26.0")]
184182
pub use self::range::{Bound, RangeBounds, RangeInclusive, RangeToInclusive};
185183

186-
#[unstable(feature = "try_trait", issue = "42327")]
187-
#[cfg(bootstrap)]
188-
pub use self::r#try::Try;
189-
190-
#[unstable(feature = "try_trait_transition", reason = "for bootstrap", issue = "none")]
191-
#[cfg(bootstrap)]
192-
pub(crate) use self::r#try::Try as TryV1;
193-
194184
#[unstable(feature = "try_trait_v2", issue = "84277")]
195185
pub use self::try_trait::FromResidual;
196186

197187
#[unstable(feature = "try_trait_v2", issue = "84277")]
198-
#[cfg(not(bootstrap))]
199188
pub use self::try_trait::Try;
200189

201190
#[unstable(feature = "try_trait_transition", reason = "for bootstrap", issue = "none")]

library/core/src/ops/try.rs

-61
This file was deleted.

library/core/src/ops/try_trait.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ use crate::ops::ControlFlow;
128128
)
129129
)]
130130
#[doc(alias = "?")]
131-
#[cfg_attr(not(bootstrap), lang = "Try")]
131+
#[lang = "Try"]
132132
pub trait Try: FromResidual {
133133
/// The type of the value produced by `?` when *not* short-circuiting.
134134
#[unstable(feature = "try_trait_v2", issue = "84277")]
@@ -186,7 +186,7 @@ pub trait Try: FromResidual {
186186
/// let r = std::iter::empty().try_fold(4, |_, ()| -> Option<_> { unreachable!() });
187187
/// assert_eq!(r, Some(4));
188188
/// ```
189-
#[cfg_attr(not(bootstrap), lang = "from_output")]
189+
#[lang = "from_output"]
190190
#[unstable(feature = "try_trait_v2", issue = "84277")]
191191
fn from_output(output: Self::Output) -> Self;
192192

@@ -213,7 +213,7 @@ pub trait Try: FromResidual {
213213
/// ControlFlow::Break(ControlFlow::Break(3)),
214214
/// );
215215
/// ```
216-
#[cfg_attr(not(bootstrap), lang = "branch")]
216+
#[lang = "branch"]
217217
#[unstable(feature = "try_trait_v2", issue = "84277")]
218218
fn branch(self) -> ControlFlow<Self::Residual, Self::Output>;
219219
}
@@ -334,7 +334,7 @@ pub trait FromResidual<R = <Self as Try>::Residual> {
334334
/// ControlFlow::Break(5),
335335
/// );
336336
/// ```
337-
#[cfg_attr(not(bootstrap), lang = "from_residual")]
337+
#[lang = "from_residual"]
338338
#[unstable(feature = "try_trait_v2", issue = "84277")]
339339
fn from_residual(residual: R) -> Self;
340340
}

library/core/src/option.rs

-32
Original file line numberDiff line numberDiff line change
@@ -1636,38 +1636,6 @@ impl<A, V: FromIterator<A>> FromIterator<Option<A>> for Option<V> {
16361636
}
16371637
}
16381638

1639-
/// The error type that results from applying the try operator (`?`) to a `None` value. If you wish
1640-
/// to allow `x?` (where `x` is an `Option<T>`) to be converted into your error type, you can
1641-
/// implement `impl From<NoneError>` for `YourErrorType`. In that case, `x?` within a function that
1642-
/// returns `Result<_, YourErrorType>` will translate a `None` value into an `Err` result.
1643-
#[rustc_diagnostic_item = "none_error"]
1644-
#[unstable(feature = "try_trait", issue = "42327")]
1645-
#[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Debug, Hash)]
1646-
#[cfg(bootstrap)]
1647-
pub struct NoneError;
1648-
1649-
#[unstable(feature = "try_trait", issue = "42327")]
1650-
#[cfg(bootstrap)]
1651-
impl<T> ops::TryV1 for Option<T> {
1652-
type Output = T;
1653-
type Error = NoneError;
1654-
1655-
#[inline]
1656-
fn into_result(self) -> Result<T, NoneError> {
1657-
self.ok_or(NoneError)
1658-
}
1659-
1660-
#[inline]
1661-
fn from_ok(v: T) -> Self {
1662-
Some(v)
1663-
}
1664-
1665-
#[inline]
1666-
fn from_error(_: NoneError) -> Self {
1667-
None
1668-
}
1669-
}
1670-
16711639
#[unstable(feature = "try_trait_v2", issue = "84277")]
16721640
impl<T> ops::TryV2 for Option<T> {
16731641
type Output = T;

0 commit comments

Comments
 (0)