Skip to content

Commit 77fde5d

Browse files
authored
Rollup merge of #104233 - compiler-errors:issue-104209, r=lcnr
Don't ICE when encountering `ConstKind::Error` in `RequiredConstsVisitor` Fixes #104209
2 parents c6595ea + 31157de commit 77fde5d

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

compiler/rustc_mir_transform/src/required_consts.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ impl<'tcx> Visitor<'tcx> for RequiredConstsVisitor<'_, 'tcx> {
1717
let literal = constant.literal;
1818
match literal {
1919
ConstantKind::Ty(c) => match c.kind() {
20-
ConstKind::Param(_) => {}
20+
ConstKind::Param(_) | ConstKind::Error(_) => {}
2121
_ => bug!("only ConstKind::Param should be encountered here, got {:#?}", c),
2222
},
2323
ConstantKind::Unevaluated(..) => self.required_consts.push(*constant),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
fn f() -> impl Sized {
2+
2.0E
3+
//~^ ERROR expected at least one digit in exponent
4+
}
5+
6+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: expected at least one digit in exponent
2+
--> $DIR/invalid-const-in-body.rs:2:5
3+
|
4+
LL | 2.0E
5+
| ^^^^
6+
7+
error: aborting due to previous error
8+

0 commit comments

Comments
 (0)