mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 05:45:12 +00:00
Evaluate constants in array repeat expression
This commit is contained in:
parent
7b7a1ed062
commit
75c2acae6e
5 changed files with 94 additions and 27 deletions
|
@ -799,8 +799,15 @@ impl<'a> InferenceContext<'a> {
|
|||
),
|
||||
);
|
||||
|
||||
let repeat_expr = &self.body.exprs[repeat];
|
||||
consteval::eval_usize(repeat_expr)
|
||||
consteval::eval_usize(
|
||||
repeat,
|
||||
consteval::ConstEvalCtx {
|
||||
exprs: &body.exprs,
|
||||
pats: &body.pats,
|
||||
local_data: Default::default(),
|
||||
infer: &mut |x| self.infer_expr(x, &expected),
|
||||
},
|
||||
)
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue