mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-26 20:09:19 +00:00
fix: mir for range pattern
This commit is contained in:
parent
ece18fecfa
commit
96a7c6ae3c
1 changed files with 6 additions and 2 deletions
|
@ -1364,10 +1364,14 @@ impl<'ctx> MirLowerCtx<'ctx> {
|
||||||
match loc {
|
match loc {
|
||||||
LiteralOrConst::Literal(l) => self.lower_literal_to_operand(ty, l),
|
LiteralOrConst::Literal(l) => self.lower_literal_to_operand(ty, l),
|
||||||
LiteralOrConst::Const(c) => {
|
LiteralOrConst::Const(c) => {
|
||||||
let unresolved_name = || MirLowerError::unresolved_path(self.db, c);
|
let c = match &self.body.pats[*c] {
|
||||||
|
Pat::Path(p) => p,
|
||||||
|
_ => not_supported!("only `char` and numeric types are allowed in range patterns"),
|
||||||
|
};
|
||||||
|
let unresolved_name = || MirLowerError::unresolved_path(self.db, c.as_ref());
|
||||||
let resolver = self.owner.resolver(self.db.upcast());
|
let resolver = self.owner.resolver(self.db.upcast());
|
||||||
let pr = resolver
|
let pr = resolver
|
||||||
.resolve_path_in_value_ns(self.db.upcast(), c)
|
.resolve_path_in_value_ns(self.db.upcast(), c.as_ref())
|
||||||
.ok_or_else(unresolved_name)?;
|
.ok_or_else(unresolved_name)?;
|
||||||
match pr {
|
match pr {
|
||||||
ResolveValueResult::ValueNs(v, _) => {
|
ResolveValueResult::ValueNs(v, _) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue