Skip to content

Commit 6ba6d22

Browse files
committed
Auto merge of rust-lang#107052 - compiler-errors:rollup-vxr22g5, r=compiler-errors
Rollup of 8 pull requests Successful merges: - rust-lang#105796 (rustdoc: simplify JS search routine by not messing with lev distance) - rust-lang#106753 (Make sure that RPITITs are not considered suggestable) - rust-lang#106917 (Encode const mir for closures if they're const) - rust-lang#107004 (Implement some candidates for the new solver (redux)) - rust-lang#107023 (Stop using `BREAK` & `CONTINUE` in compiler) - rust-lang#107030 (Correct typo) - rust-lang#107042 (rustdoc: fix corner cases with "?" JS keyboard command) - rust-lang#107045 (rustdoc: remove redundant CSS rule `#settings .setting-line`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 8b11574 + e12c6b2 commit 6ba6d22

File tree

58 files changed

+736
-239
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+736
-239
lines changed

compiler/rustc_const_eval/src/const_eval/machine.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ impl<'mir, 'tcx: 'mir> CompileTimeEvalContext<'mir, 'tcx> {
225225
/// `align_offset(ptr, target_align)` needs special handling in const eval, because the pointer
226226
/// may not have an address.
227227
///
228-
/// If `ptr` does have a known address, then we return `CONTINUE` and the function call should
228+
/// If `ptr` does have a known address, then we return `Continue(())` and the function call should
229229
/// proceed as normal.
230230
///
231231
/// If `ptr` doesn't have an address, but its underlying allocation's alignment is at most
@@ -273,18 +273,18 @@ impl<'mir, 'tcx: 'mir> CompileTimeEvalContext<'mir, 'tcx> {
273273
ret,
274274
StackPopUnwind::NotAllowed,
275275
)?;
276-
Ok(ControlFlow::BREAK)
276+
Ok(ControlFlow::Break(()))
277277
} else {
278278
// Not alignable in const, return `usize::MAX`.
279279
let usize_max = Scalar::from_machine_usize(self.machine_usize_max(), self);
280280
self.write_scalar(usize_max, dest)?;
281281
self.return_to_block(ret)?;
282-
Ok(ControlFlow::BREAK)
282+
Ok(ControlFlow::Break(()))
283283
}
284284
}
285285
Err(_addr) => {
286286
// The pointer has an address, continue with function call.
287-
Ok(ControlFlow::CONTINUE)
287+
Ok(ControlFlow::Continue(()))
288288
}
289289
}
290290
}

compiler/rustc_const_eval/src/interpret/util.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ where
2626

2727
fn visit_ty(&mut self, ty: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
2828
if !ty.needs_subst() {
29-
return ControlFlow::CONTINUE;
29+
return ControlFlow::Continue(());
3030
}
3131

3232
match *ty.kind() {
@@ -48,7 +48,7 @@ where
4848
return subst.visit_with(self);
4949
}
5050
}
51-
ControlFlow::CONTINUE
51+
ControlFlow::Continue(())
5252
}
5353
_ => ty.super_visit_with(self),
5454
}

compiler/rustc_const_eval/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ Rust MIR: a lowered representation of Rust.
66

77
#![feature(assert_matches)]
88
#![feature(box_patterns)]
9-
#![feature(control_flow_enum)]
109
#![feature(decl_macro)]
1110
#![feature(exact_size_is_empty)]
1211
#![feature(let_chains)]

compiler/rustc_data_structures/src/graph/iterate/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -317,12 +317,12 @@ where
317317
_node: G::Node,
318318
_prior_status: Option<NodeStatus>,
319319
) -> ControlFlow<Self::BreakVal> {
320-
ControlFlow::CONTINUE
320+
ControlFlow::Continue(())
321321
}
322322

323323
/// Called after all nodes reachable from this one have been examined.
324324
fn node_settled(&mut self, _node: G::Node) -> ControlFlow<Self::BreakVal> {
325-
ControlFlow::CONTINUE
325+
ControlFlow::Continue(())
326326
}
327327

328328
/// Behave as if no edges exist from `source` to `target`.
@@ -346,8 +346,8 @@ where
346346
prior_status: Option<NodeStatus>,
347347
) -> ControlFlow<Self::BreakVal> {
348348
match prior_status {
349-
Some(NodeStatus::Visited) => ControlFlow::BREAK,
350-
_ => ControlFlow::CONTINUE,
349+
Some(NodeStatus::Visited) => ControlFlow::Break(()),
350+
_ => ControlFlow::Continue(()),
351351
}
352352
}
353353
}

compiler/rustc_data_structures/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#![feature(associated_type_bounds)]
1212
#![feature(auto_traits)]
1313
#![feature(cell_leak)]
14-
#![feature(control_flow_enum)]
1514
#![feature(extend_one)]
1615
#![feature(hash_raw_entry)]
1716
#![feature(hasher_prefixfree_extras)]

compiler/rustc_hir_analysis/src/check/check.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ pub(super) fn check_opaque_for_inheriting_lifetimes(
267267
fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
268268
debug!(?t, "root_visit_ty");
269269
if t == self.opaque_identity_ty {
270-
ControlFlow::CONTINUE
270+
ControlFlow::Continue(())
271271
} else {
272272
t.visit_with(&mut ConstrainOpaqueTypeRegionVisitor {
273273
tcx: self.tcx,
@@ -282,7 +282,7 @@ pub(super) fn check_opaque_for_inheriting_lifetimes(
282282
if self.references_parent_regions {
283283
ControlFlow::Break(t)
284284
} else {
285-
ControlFlow::CONTINUE
285+
ControlFlow::Continue(())
286286
}
287287
}
288288
}
@@ -1439,7 +1439,7 @@ fn opaque_type_cycle_error(tcx: TyCtxt<'_>, def_id: LocalDefId, span: Span) -> E
14391439
match *t.kind() {
14401440
ty::Alias(ty::Opaque, ty::AliasTy { def_id: def, .. }) => {
14411441
self.0.push(def);
1442-
ControlFlow::CONTINUE
1442+
ControlFlow::Continue(())
14431443
}
14441444
_ => t.super_visit_with(self),
14451445
}

compiler/rustc_hir_analysis/src/check/wfcheck.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1428,7 +1428,7 @@ fn check_where_clauses<'tcx>(wfcx: &WfCheckingCtxt<'_, 'tcx>, span: Span, def_id
14281428
}
14291429

14301430
fn visit_region(&mut self, _: ty::Region<'tcx>) -> ControlFlow<Self::BreakTy> {
1431-
ControlFlow::BREAK
1431+
ControlFlow::Break(())
14321432
}
14331433

14341434
fn visit_const(&mut self, c: ty::Const<'tcx>) -> ControlFlow<Self::BreakTy> {

compiler/rustc_hir_analysis/src/coherence/orphan.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -416,13 +416,13 @@ fn fast_reject_auto_impl<'tcx>(tcx: TyCtxt<'tcx>, trait_def_id: DefId, self_ty:
416416
if t != self.self_ty_root {
417417
for impl_def_id in tcx.non_blanket_impls_for_ty(self.trait_def_id, t) {
418418
match tcx.impl_polarity(impl_def_id) {
419-
ImplPolarity::Negative => return ControlFlow::BREAK,
419+
ImplPolarity::Negative => return ControlFlow::Break(()),
420420
ImplPolarity::Reservation => {}
421421
// FIXME(@lcnr): That's probably not good enough, idk
422422
//
423423
// We might just want to take the rustdoc code and somehow avoid
424424
// explicit impls for `Self`.
425-
ImplPolarity::Positive => return ControlFlow::CONTINUE,
425+
ImplPolarity::Positive => return ControlFlow::Continue(()),
426426
}
427427
}
428428
}
@@ -440,7 +440,7 @@ fn fast_reject_auto_impl<'tcx>(tcx: TyCtxt<'tcx>, trait_def_id: DefId, self_ty:
440440
}
441441
}
442442

443-
ControlFlow::CONTINUE
443+
ControlFlow::Continue(())
444444
}
445445
_ => t.super_visit_with(self),
446446
}

compiler/rustc_hir_analysis/src/constrained_generic_params.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ impl<'tcx> TypeVisitor<'tcx> for ParameterCollector {
6161
match *t.kind() {
6262
ty::Alias(ty::Projection, ..) if !self.include_nonconstraining => {
6363
// projections are not injective
64-
return ControlFlow::CONTINUE;
64+
return ControlFlow::Continue(());
6565
}
6666
ty::Param(data) => {
6767
self.parameters.push(Parameter::from(data));
@@ -76,7 +76,7 @@ impl<'tcx> TypeVisitor<'tcx> for ParameterCollector {
7676
if let ty::ReEarlyBound(data) = *r {
7777
self.parameters.push(Parameter::from(data));
7878
}
79-
ControlFlow::CONTINUE
79+
ControlFlow::Continue(())
8080
}
8181

8282
fn visit_const(&mut self, c: ty::Const<'tcx>) -> ControlFlow<Self::BreakTy> {

compiler/rustc_hir_analysis/src/variance/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ fn variance_of_opaque(tcx: TyCtxt<'_>, item_def_id: LocalDefId) -> &[ty::Varianc
9292
a.visit_with(self)?;
9393
}
9494
}
95-
ControlFlow::CONTINUE
95+
ControlFlow::Continue(())
9696
} else {
9797
substs.visit_with(self)
9898
}

compiler/rustc_hir_typeck/src/closure.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
236236

237237
fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
238238
if t == self.expected_ty {
239-
ControlFlow::BREAK
239+
ControlFlow::Break(())
240240
} else {
241241
t.super_visit_with(self)
242242
}

compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ impl<'tcx> TypeVisitor<'tcx> for TraitObjectVisitor {
543543
if let Some(def_id) = preds.principal_def_id() {
544544
self.0.insert(def_id);
545545
}
546-
ControlFlow::CONTINUE
546+
ControlFlow::Continue(())
547547
}
548548
_ => t.super_visit_with(self),
549549
}

compiler/rustc_infer/src/infer/nll_relate/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,7 @@ impl<'me, 'tcx> TypeVisitor<'tcx> for ScopeInstantiator<'me, 'tcx> {
849849
t.super_visit_with(self);
850850
self.target_index.shift_out(1);
851851

852-
ControlFlow::CONTINUE
852+
ControlFlow::Continue(())
853853
}
854854

855855
fn visit_region(&mut self, r: ty::Region<'tcx>) -> ControlFlow<Self::BreakTy> {
@@ -863,7 +863,7 @@ impl<'me, 'tcx> TypeVisitor<'tcx> for ScopeInstantiator<'me, 'tcx> {
863863
_ => {}
864864
}
865865

866-
ControlFlow::CONTINUE
866+
ControlFlow::Continue(())
867867
}
868868
}
869869

compiler/rustc_infer/src/infer/opaque_types.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -440,24 +440,24 @@ where
440440
t: &ty::Binder<'tcx, T>,
441441
) -> ControlFlow<Self::BreakTy> {
442442
t.super_visit_with(self);
443-
ControlFlow::CONTINUE
443+
ControlFlow::Continue(())
444444
}
445445

446446
fn visit_region(&mut self, r: ty::Region<'tcx>) -> ControlFlow<Self::BreakTy> {
447447
match *r {
448448
// ignore bound regions, keep visiting
449-
ty::ReLateBound(_, _) => ControlFlow::CONTINUE,
449+
ty::ReLateBound(_, _) => ControlFlow::Continue(()),
450450
_ => {
451451
(self.op)(r);
452-
ControlFlow::CONTINUE
452+
ControlFlow::Continue(())
453453
}
454454
}
455455
}
456456

457457
fn visit_ty(&mut self, ty: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
458458
// We're only interested in types involving regions
459459
if !ty.flags().intersects(ty::TypeFlags::HAS_FREE_REGIONS) {
460-
return ControlFlow::CONTINUE;
460+
return ControlFlow::Continue(());
461461
}
462462

463463
match ty.kind() {
@@ -507,7 +507,7 @@ where
507507
}
508508
}
509509

510-
ControlFlow::CONTINUE
510+
ControlFlow::Continue(())
511511
}
512512
}
513513

compiler/rustc_infer/src/infer/resolve.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ impl<'a, 'tcx> TypeVisitor<'tcx> for UnresolvedTypeOrConstFinder<'a, 'tcx> {
147147
} else if !t.has_non_region_infer() {
148148
// All const/type variables in inference types must already be resolved,
149149
// no need to visit the contents.
150-
ControlFlow::CONTINUE
150+
ControlFlow::Continue(())
151151
} else {
152152
// Otherwise, keep visiting.
153153
t.super_visit_with(self)
@@ -178,7 +178,7 @@ impl<'a, 'tcx> TypeVisitor<'tcx> for UnresolvedTypeOrConstFinder<'a, 'tcx> {
178178
} else if !ct.has_non_region_infer() {
179179
// All const/type variables in inference types must already be resolved,
180180
// no need to visit the contents.
181-
ControlFlow::CONTINUE
181+
ControlFlow::Continue(())
182182
} else {
183183
// Otherwise, keep visiting.
184184
ct.super_visit_with(self)

compiler/rustc_lint/src/types.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1147,7 +1147,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
11471147

11481148
fn visit_ty(&mut self, ty: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
11491149
if !ty.has_opaque_types() {
1150-
return ControlFlow::CONTINUE;
1150+
return ControlFlow::Continue(());
11511151
}
11521152

11531153
if let ty::Alias(ty::Opaque, ..) = ty.kind() {

compiler/rustc_macros/src/type_visitable.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub fn type_visitable_derive(mut s: synstructure::Structure<'_>) -> proc_macro2:
2626
__visitor: &mut __V
2727
) -> ::std::ops::ControlFlow<__V::BreakTy> {
2828
match *self { #body_visit }
29-
::std::ops::ControlFlow::CONTINUE
29+
::std::ops::ControlFlow::Continue(())
3030
}
3131
},
3232
)

compiler/rustc_metadata/src/rmeta/encoder.rs

+2-11
Original file line numberDiff line numberDiff line change
@@ -888,8 +888,8 @@ fn should_encode_mir(tcx: TyCtxt<'_>, def_id: LocalDefId) -> (bool, bool) {
888888
| DefKind::AssocConst
889889
| DefKind::Static(..)
890890
| DefKind::Const => (true, false),
891-
// Full-fledged functions
892-
DefKind::AssocFn | DefKind::Fn => {
891+
// Full-fledged functions + closures
892+
DefKind::AssocFn | DefKind::Fn | DefKind::Closure => {
893893
let generics = tcx.generics_of(def_id);
894894
let needs_inline = (generics.requires_monomorphization(tcx)
895895
|| tcx.codegen_fn_attrs(def_id).requests_inline())
@@ -900,15 +900,6 @@ fn should_encode_mir(tcx: TyCtxt<'_>, def_id: LocalDefId) -> (bool, bool) {
900900
let always_encode_mir = tcx.sess.opts.unstable_opts.always_encode_mir;
901901
(is_const_fn, needs_inline || always_encode_mir)
902902
}
903-
// Closures can't be const fn.
904-
DefKind::Closure => {
905-
let generics = tcx.generics_of(def_id);
906-
let needs_inline = (generics.requires_monomorphization(tcx)
907-
|| tcx.codegen_fn_attrs(def_id).requests_inline())
908-
&& tcx.sess.opts.output_types.should_codegen();
909-
let always_encode_mir = tcx.sess.opts.unstable_opts.always_encode_mir;
910-
(false, needs_inline || always_encode_mir)
911-
}
912903
// Generators require optimized MIR to compute layout.
913904
DefKind::Generator => (false, true),
914905
// The others don't have MIR.

compiler/rustc_middle/src/macros.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ macro_rules! TrivialTypeTraversalImpls {
9393
_: &mut F)
9494
-> ::std::ops::ControlFlow<F::BreakTy>
9595
{
96-
::std::ops::ControlFlow::CONTINUE
96+
::std::ops::ControlFlow::Continue(())
9797
}
9898
}
9999
)+
@@ -219,7 +219,7 @@ macro_rules! EnumTypeTraversalImpl {
219219
$($crate::ty::visit::TypeVisitable::visit_with(
220220
$variant_arg, $visitor
221221
)?;)*
222-
::std::ops::ControlFlow::CONTINUE
222+
::std::ops::ControlFlow::Continue(())
223223
}
224224
$($output)*
225225
)
@@ -237,7 +237,7 @@ macro_rules! EnumTypeTraversalImpl {
237237
$($crate::ty::visit::TypeVisitable::visit_with(
238238
$variant_arg, $visitor
239239
)?;)*
240-
::std::ops::ControlFlow::CONTINUE
240+
::std::ops::ControlFlow::Continue(())
241241
}
242242
$($output)*
243243
)
@@ -251,7 +251,7 @@ macro_rules! EnumTypeTraversalImpl {
251251
@VisitVariants($this, $visitor)
252252
input($($input)*)
253253
output(
254-
$variant => { ::std::ops::ControlFlow::CONTINUE }
254+
$variant => { ::std::ops::ControlFlow::Continue(()) }
255255
$($output)*
256256
)
257257
)

compiler/rustc_middle/src/mir/type_visitable.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ use super::*;
44

55
impl<'tcx, R: Idx, C: Idx> TypeVisitable<'tcx> for BitMatrix<R, C> {
66
fn visit_with<V: TypeVisitor<'tcx>>(&self, _: &mut V) -> ControlFlow<V::BreakTy> {
7-
ControlFlow::CONTINUE
7+
ControlFlow::Continue(())
88
}
99
}

0 commit comments

Comments
 (0)