mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
loop_match: fix 'no terminator on block'
This commit is contained in:
@@ -936,7 +936,9 @@ pub(crate) fn break_const_continuable_scope(
|
||||
|
||||
valtree
|
||||
}
|
||||
Err(ErrorHandled::Reported(..)) => return self.cfg.start_new_block().unit(),
|
||||
Err(ErrorHandled::Reported(..)) => {
|
||||
return block.unit();
|
||||
}
|
||||
Err(ErrorHandled::TooGeneric(_)) => {
|
||||
self.tcx.dcx().emit_fatal(ConstContinueBadConst { span: constant.span });
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
#![allow(incomplete_features)]
|
||||
#![feature(loop_match)]
|
||||
#![crate_type = "lib"]
|
||||
|
||||
const CONST_THAT_PANICS: u8 = panic!("diverge!");
|
||||
//~^ ERROR: evaluation panicked: diverge!
|
||||
|
||||
fn test(mut state: u8) {
|
||||
#[loop_match]
|
||||
loop {
|
||||
state = 'blk: {
|
||||
match state {
|
||||
0 => {
|
||||
#[const_continue]
|
||||
break 'blk CONST_THAT_PANICS;
|
||||
}
|
||||
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
error[E0080]: evaluation panicked: diverge!
|
||||
--> $DIR/panic-in-const.rs:5:31
|
||||
|
|
||||
LL | const CONST_THAT_PANICS: u8 = panic!("diverge!");
|
||||
| ^^^^^^^^^^^^^^^^^^ evaluation of `CONST_THAT_PANICS` failed here
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0080`.
|
||||
Reference in New Issue
Block a user