1
Fork 0

Allow inline consts to reference generic params

This commit is contained in:
Gary Guo 2022-04-29 15:27:59 +01:00
parent bf4d7fa43f
commit 6baaa527ce
8 changed files with 91 additions and 6 deletions

View file

@ -3101,6 +3101,13 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
);
}
fn resolve_inline_const(&mut self, constant: &'ast AnonConst) {
debug!("resolve_anon_const {constant:?}");
self.with_constant_rib(IsRepeatExpr::No, HasGenericParams::Yes, None, |this| {
visit::walk_anon_const(this, constant);
});
}
fn resolve_expr(&mut self, expr: &'ast Expr, parent: Option<&'ast Expr>) {
// First, record candidate traits for this expression if it could
// result in the invocation of a method call.
@ -3257,7 +3264,7 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
});
}
ExprKind::ConstBlock(ref ct) => {
self.resolve_anon_const(ct, IsRepeatExpr::No);
self.resolve_inline_const(ct);
}
ExprKind::Index(ref elem, ref idx) => {
self.resolve_expr(elem, Some(expr));