File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed
compiler/rustc_mir/src/transform/check_consts Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -216,14 +216,12 @@ impl NonConstOp for FnPtrCast {
216
216
#[ derive( Debug ) ]
217
217
pub struct Generator ;
218
218
impl NonConstOp for Generator {
219
- fn status_in_item ( & self , ccx : & ConstCx < ' _ , ' _ > ) -> Status {
220
- // FIXME: This means generator-only MIR is only forbidden in const fn. This is for
221
- // compatibility with the old code. Such MIR should be forbidden everywhere.
222
- mcf_status_in_item ( ccx)
219
+ fn status_in_item ( & self , _: & ConstCx < ' _ , ' _ > ) -> Status {
220
+ Status :: Forbidden
223
221
}
224
222
225
223
fn emit_error ( & self , ccx : & ConstCx < ' _ , ' _ > , span : Span ) {
226
- mcf_emit_error ( ccx, span, "const fn generators are unstable" ) ;
224
+ ccx. tcx . sess . struct_span_err ( span, "Generators and `async` functions cannot be `const`" ) . emit ( ) ;
227
225
}
228
226
}
229
227
You can’t perform that action at this time.
0 commit comments