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 {
164164 }
165165}
166166
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-
180167#[ derive( Debug ) ]
181168pub struct CellBorrow ;
182169impl NonConstOp for CellBorrow {
Original file line number Diff line number Diff line change @@ -207,12 +207,6 @@ impl Validator<'mir, 'tcx> {
207207 }
208208 }
209209
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-
216210 self . visit_body ( & body) ;
217211
218212 // 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 {
4040
4141 let gates: & [ _ ] = match self {
4242 // 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.
4444 // Likewise, `?` desugars to a call to `Try::into_result`.
4545 Self :: Loop ( ForLoop ) | Self :: Match ( ForLoopDesugar | TryDesugar | AwaitDesugar ) => {
4646 return None ;
4747 }
4848
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+ ) => & [ ] ,
5554 } ;
5655
5756 Some ( gates)
You can’t perform that action at this time.
0 commit comments