Skip to content

Commit 6ee5a40

Browse files
committed
Auto merge of #95061 - cuviper:beta-stage0, r=Mark-Simulacrum
[beta] backports + bootstrap bump Add pending backports: * Revert accidental stabilization #94805 * Do not recover from Ty? in macro parsing #94593 * Fix cmake build. #95050 And updates the bootstrap compiler to 1.59.0.
2 parents 99f967e + 113631b commit 6ee5a40

File tree

11 files changed

+353
-361
lines changed

11 files changed

+353
-361
lines changed

compiler/rustc_parse/src/parser/diagnostics.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use super::pat::Expected;
2-
use super::ty::{AllowPlus, IsAsCast};
2+
use super::ty::{AllowPlus, RecoverQuestionMark};
33
use super::{
44
BlockMode, Parser, PathStyle, RecoverColon, RecoverComma, Restrictions, SemiColonMode, SeqSep,
55
TokenExpectType, TokenType,
@@ -1037,9 +1037,9 @@ impl<'a> Parser<'a> {
10371037
pub(super) fn maybe_recover_from_question_mark(
10381038
&mut self,
10391039
ty: P<Ty>,
1040-
is_as_cast: IsAsCast,
1040+
recover_question_mark: RecoverQuestionMark,
10411041
) -> P<Ty> {
1042-
if let IsAsCast::Yes = is_as_cast {
1042+
if let RecoverQuestionMark::No = recover_question_mark {
10431043
return ty;
10441044
}
10451045
if self.token == token::Question {

compiler/rustc_parse/src/parser/nonterminal.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ impl<'a> Parser<'a> {
140140
}
141141

142142
NonterminalKind::Ty => {
143-
token::NtTy(self.collect_tokens_no_attrs(|this| this.parse_ty())?)
143+
token::NtTy(self.collect_tokens_no_attrs(|this| this.parse_no_question_mark_recover())?)
144144
}
145145
// this could be handled like a token, since it is one
146146
NonterminalKind::Ident

compiler/rustc_parse/src/parser/ty.rs

+23-11
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ pub(super) enum RecoverQPath {
4444
No,
4545
}
4646

47-
pub(super) enum IsAsCast {
47+
pub(super) enum RecoverQuestionMark {
4848
Yes,
4949
No,
5050
}
@@ -105,7 +105,7 @@ impl<'a> Parser<'a> {
105105
RecoverQPath::Yes,
106106
RecoverReturnSign::Yes,
107107
None,
108-
IsAsCast::No,
108+
RecoverQuestionMark::Yes,
109109
)
110110
}
111111

@@ -119,7 +119,7 @@ impl<'a> Parser<'a> {
119119
RecoverQPath::Yes,
120120
RecoverReturnSign::Yes,
121121
Some(ty_params),
122-
IsAsCast::No,
122+
RecoverQuestionMark::Yes,
123123
)
124124
}
125125

@@ -133,7 +133,7 @@ impl<'a> Parser<'a> {
133133
RecoverQPath::Yes,
134134
RecoverReturnSign::Yes,
135135
None,
136-
IsAsCast::No,
136+
RecoverQuestionMark::Yes,
137137
)
138138
}
139139

@@ -150,7 +150,7 @@ impl<'a> Parser<'a> {
150150
RecoverQPath::Yes,
151151
RecoverReturnSign::Yes,
152152
None,
153-
IsAsCast::No,
153+
RecoverQuestionMark::Yes,
154154
)
155155
}
156156

@@ -163,9 +163,21 @@ impl<'a> Parser<'a> {
163163
RecoverQPath::Yes,
164164
RecoverReturnSign::Yes,
165165
None,
166-
IsAsCast::Yes,
166+
RecoverQuestionMark::No,
167167
)
168168
}
169+
170+
pub(super) fn parse_no_question_mark_recover(&mut self) -> PResult<'a, P<Ty>> {
171+
self.parse_ty_common(
172+
AllowPlus::Yes,
173+
AllowCVariadic::No,
174+
RecoverQPath::Yes,
175+
RecoverReturnSign::Yes,
176+
None,
177+
RecoverQuestionMark::No,
178+
)
179+
}
180+
169181
/// Parse a type without recovering `:` as `->` to avoid breaking code such as `where fn() : for<'a>`
170182
pub(super) fn parse_ty_for_where_clause(&mut self) -> PResult<'a, P<Ty>> {
171183
self.parse_ty_common(
@@ -174,7 +186,7 @@ impl<'a> Parser<'a> {
174186
RecoverQPath::Yes,
175187
RecoverReturnSign::OnlyFatArrow,
176188
None,
177-
IsAsCast::No,
189+
RecoverQuestionMark::Yes,
178190
)
179191
}
180192

@@ -193,7 +205,7 @@ impl<'a> Parser<'a> {
193205
recover_qpath,
194206
recover_return_sign,
195207
None,
196-
IsAsCast::No,
208+
RecoverQuestionMark::Yes,
197209
)?;
198210
FnRetTy::Ty(ty)
199211
} else if recover_return_sign.can_recover(&self.token.kind) {
@@ -214,7 +226,7 @@ impl<'a> Parser<'a> {
214226
recover_qpath,
215227
recover_return_sign,
216228
None,
217-
IsAsCast::No,
229+
RecoverQuestionMark::Yes,
218230
)?;
219231
FnRetTy::Ty(ty)
220232
} else {
@@ -229,7 +241,7 @@ impl<'a> Parser<'a> {
229241
recover_qpath: RecoverQPath,
230242
recover_return_sign: RecoverReturnSign,
231243
ty_generics: Option<&Generics>,
232-
is_as_cast: IsAsCast,
244+
recover_question_mark: RecoverQuestionMark,
233245
) -> PResult<'a, P<Ty>> {
234246
let allow_qpath_recovery = recover_qpath == RecoverQPath::Yes;
235247
maybe_recover_from_interpolated_ty_qpath!(self, allow_qpath_recovery);
@@ -305,7 +317,7 @@ impl<'a> Parser<'a> {
305317
// Try to recover from use of `+` with incorrect priority.
306318
self.maybe_report_ambiguous_plus(allow_plus, impl_dyn_multi, &ty);
307319
self.maybe_recover_from_bad_type_plus(allow_plus, &ty)?;
308-
let ty = self.maybe_recover_from_question_mark(ty, is_as_cast);
320+
let ty = self.maybe_recover_from_question_mark(ty, recover_question_mark);
309321
self.maybe_recover_from_bad_qpath(ty, allow_qpath_recovery)
310322
}
311323

library/alloc/src/boxed.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1170,8 +1170,7 @@ impl<T: ?Sized, A: Allocator> Box<T, A> {
11701170
}
11711171

11721172
#[stable(feature = "rust1", since = "1.0.0")]
1173-
#[rustc_const_unstable(feature = "const_box", issue = "92521")]
1174-
unsafe impl<#[may_dangle] T: ?Sized, A: Allocator> const Drop for Box<T, A> {
1173+
unsafe impl<#[may_dangle] T: ?Sized, A: Allocator> Drop for Box<T, A> {
11751174
fn drop(&mut self) {
11761175
// FIXME: Do nothing, drop is currently performed by compiler.
11771176
}

library/alloc/tests/boxed.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ fn const_box() {
160160
*boxed = 42;
161161
assert!(*boxed == 42);
162162

163-
*boxed
163+
*Box::leak(boxed)
164164
};
165165

166166
assert!(VALUE == 42);

src/ci/docker/scripts/cmake.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ hide_output() {
55
set +x
66
on_err="
77
echo ERROR: An error was encountered with the build.
8-
cat /tmp/build.log
8+
cat /tmp/cmake_build.log
99
exit 1
1010
"
1111
trap "$on_err" ERR
1212
bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
1313
PING_LOOP_PID=$!
14-
"$@" &> /tmp/build.log
14+
"$@" &> /tmp/cmake_build.log
1515
trap - ERR
1616
kill $PING_LOOP_PID
17-
rm /tmp/build.log
17+
rm /tmp/cmake_build.log
1818
set -x
1919
}
2020

0 commit comments

Comments
 (0)