Don't ICE when encountering ConstKind::Error in RequiredConstsVisitor
This commit is contained in:
parent
34115d040b
commit
31157def1a
3 changed files with 15 additions and 1 deletions
|
@ -17,7 +17,7 @@ impl<'tcx> Visitor<'tcx> for RequiredConstsVisitor<'_, 'tcx> {
|
|||
let literal = constant.literal;
|
||||
match literal {
|
||||
ConstantKind::Ty(c) => match c.kind() {
|
||||
ConstKind::Param(_) => {}
|
||||
ConstKind::Param(_) | ConstKind::Error(_) => {}
|
||||
_ => bug!("only ConstKind::Param should be encountered here, got {:#?}", c),
|
||||
},
|
||||
ConstantKind::Unevaluated(..) => self.required_consts.push(*constant),
|
||||
|
|
6
src/test/ui/consts/invalid-const-in-body.rs
Normal file
6
src/test/ui/consts/invalid-const-in-body.rs
Normal file
|
@ -0,0 +1,6 @@
|
|||
fn f() -> impl Sized {
|
||||
2.0E
|
||||
//~^ ERROR expected at least one digit in exponent
|
||||
}
|
||||
|
||||
fn main() {}
|
8
src/test/ui/consts/invalid-const-in-body.stderr
Normal file
8
src/test/ui/consts/invalid-const-in-body.stderr
Normal file
|
@ -0,0 +1,8 @@
|
|||
error: expected at least one digit in exponent
|
||||
--> $DIR/invalid-const-in-body.rs:2:5
|
||||
|
|
||||
LL | 2.0E
|
||||
| ^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
Loading…
Add table
Reference in a new issue