Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 96a7c6a

Browse files
committed
fix: mir for range pattern
1 parent ece18fe commit 96a7c6a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

crates/hir-ty/src/mir/lower.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1364,10 +1364,14 @@ impl<'ctx> MirLowerCtx<'ctx> {
13641364
match loc {
13651365
LiteralOrConst::Literal(l) => self.lower_literal_to_operand(ty, l),
13661366
LiteralOrConst::Const(c) => {
1367-
let unresolved_name = || MirLowerError::unresolved_path(self.db, c);
1367+
let c = match &self.body.pats[*c] {
1368+
Pat::Path(p) => p,
1369+
_ => not_supported!("only `char` and numeric types are allowed in range patterns"),
1370+
};
1371+
let unresolved_name = || MirLowerError::unresolved_path(self.db, c.as_ref());
13681372
let resolver = self.owner.resolver(self.db.upcast());
13691373
let pr = resolver
1370-
.resolve_path_in_value_ns(self.db.upcast(), c)
1374+
.resolve_path_in_value_ns(self.db.upcast(), c.as_ref())
13711375
.ok_or_else(unresolved_name)?;
13721376
match pr {
13731377
ResolveValueResult::ValueNs(v, _) => {

0 commit comments

Comments
 (0)