This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +6
-26
lines changed
librustc_mir/transform/check_consts Expand file tree Collapse file tree 3 files changed +6
-26
lines changed Original file line number Diff line number Diff line change @@ -164,19 +164,6 @@ impl NonConstOp for LiveDrop {
164
164
}
165
165
}
166
166
167
- #[ derive( Debug ) ]
168
- pub struct Loop ;
169
- impl NonConstOp for Loop {
170
- fn feature_gate ( ) -> Option < Symbol > {
171
- Some ( sym:: const_loop)
172
- }
173
-
174
- fn emit_error ( & self , ccx : & ConstCx < ' _ , ' _ > , span : Span ) {
175
- // This should be caught by the HIR const-checker.
176
- ccx. tcx . sess . delay_span_bug ( span, "complex control flow is forbidden in a const context" ) ;
177
- }
178
- }
179
-
180
167
#[ derive( Debug ) ]
181
168
pub struct CellBorrow ;
182
169
impl NonConstOp for CellBorrow {
Original file line number Diff line number Diff line change @@ -207,12 +207,6 @@ impl Validator<'mir, 'tcx> {
207
207
}
208
208
}
209
209
210
- if body. is_cfg_cyclic ( ) {
211
- // We can't provide a good span for the error here, but this should be caught by the
212
- // HIR const-checker anyways.
213
- self . check_op_spanned ( ops:: Loop , body. span ) ;
214
- }
215
-
216
210
self . visit_body ( & body) ;
217
211
218
212
// Ensure that the end result is `Sync` in a non-thread local `static`.
Original file line number Diff line number Diff line change @@ -40,18 +40,17 @@ impl NonConstExpr {
40
40
41
41
let gates: & [ _ ] = match self {
42
42
// A `for` loop's desugaring contains a call to `IntoIterator::into_iter`,
43
- // so they are not yet allowed with `#![feature(const_loop)]` .
43
+ // so they are not yet allowed.
44
44
// Likewise, `?` desugars to a call to `Try::into_result`.
45
45
Self :: Loop ( ForLoop ) | Self :: Match ( ForLoopDesugar | TryDesugar | AwaitDesugar ) => {
46
46
return None ;
47
47
}
48
48
49
- Self :: Loop ( Loop | While | WhileLet ) | Self :: Match ( WhileDesugar | WhileLetDesugar ) => {
50
- & [ sym:: const_loop]
51
- }
52
-
53
- // All other matches are allowed.
54
- Self :: Match ( Normal | IfDesugar { .. } | IfLetDesugar { .. } ) => & [ ] ,
49
+ // All other expressions are allowed.
50
+ Self :: Loop ( Loop | While | WhileLet )
51
+ | Self :: Match (
52
+ WhileDesugar | WhileLetDesugar | Normal | IfDesugar { .. } | IfLetDesugar { .. } ,
53
+ ) => & [ ] ,
55
54
} ;
56
55
57
56
Some ( gates)
You can’t perform that action at this time.
0 commit comments