mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-21 22:34:05 +00:00
Account for ExpandedConstant
in parse_match
This commit is contained in:
parent
912ee65ccd
commit
29acf8b422
@ -144,12 +144,20 @@ impl<'a, 'tcx> ParseCtxt<'a, 'tcx> {
|
|||||||
let mut targets = Vec::new();
|
let mut targets = Vec::new();
|
||||||
for arm in rest {
|
for arm in rest {
|
||||||
let arm = &self.thir[*arm];
|
let arm = &self.thir[*arm];
|
||||||
let PatKind::Constant { value } = arm.pattern.kind else {
|
let value = match arm.pattern.kind {
|
||||||
return Err(ParseError {
|
PatKind::Constant { value } => value,
|
||||||
span: arm.pattern.span,
|
PatKind::ExpandedConstant { ref subpattern, def_id: _, is_inline: false }
|
||||||
item_description: format!("{:?}", arm.pattern.kind),
|
if let PatKind::Constant { value } = subpattern.kind =>
|
||||||
expected: "constant pattern".to_string(),
|
{
|
||||||
});
|
value
|
||||||
|
}
|
||||||
|
_ => {
|
||||||
|
return Err(ParseError {
|
||||||
|
span: arm.pattern.span,
|
||||||
|
item_description: format!("{:?}", arm.pattern.kind),
|
||||||
|
expected: "constant pattern".to_string(),
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
values.push(value.eval_bits(self.tcx, self.param_env));
|
values.push(value.eval_bits(self.tcx, self.param_env));
|
||||||
targets.push(self.parse_block(arm.body)?);
|
targets.push(self.parse_block(arm.body)?);
|
||||||
|
Loading…
Reference in New Issue
Block a user