Skip to content

Commit 9980d0e

Browse files
committed
Use prove_goal to check if the type is int
1 parent 992f4c2 commit 9980d0e

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

crates/formality-check/src/mini_rust_check.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use formality_rust::grammar::minirust::ArgumentExpression::{ByValue, InPlace};
66
use formality_rust::grammar::minirust::PlaceExpression::Local;
77
use formality_rust::grammar::minirust::ValueExpression::{Constant, Fn, Load};
88
use formality_rust::grammar::minirust::{
9-
self, ty_is_int, ArgumentExpression, BasicBlock, BbId, LocalId, PlaceExpression,
9+
self, ArgumentExpression, BasicBlock, BbId, LocalId, PlaceExpression,
1010
ValueExpression,
1111
};
1212
use formality_rust::grammar::FnBoundData;
@@ -229,9 +229,7 @@ impl Check<'_> {
229229
// Check if the value is well-formed.
230230
let value_ty = self.check_value(typeck_env, switch_value).unwrap();
231231

232-
if !ty_is_int(value_ty) {
233-
bail!("The value used for switch must be an int.");
234-
}
232+
self.prove_goal(&typeck_env.env, Wcs::default(), value_ty.is_int())?;
235233

236234
// Ensure all bbid are valid.
237235
for switch_target in switch_targets {

0 commit comments

Comments
 (0)