Rollup merge of #125705 - oli-obk:const_block_ice, r=compiler-errors

Reintroduce name resolution check for trying to access locals from an inline const

fixes #125676

I removed this without replacement in https://github.com/rust-lang/rust/pull/124650 without considering the consequences
This commit is contained in:
Matthias Krüger 2024-05-29 20:12:34 +02:00 committed by GitHub
commit c09b89ea32
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 22 additions and 0 deletions

View file

@ -4505,6 +4505,11 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
self.visit_expr(elem);
self.resolve_anon_const(ct, AnonConstKind::ConstArg(IsRepeatExpr::Yes));
}
ExprKind::ConstBlock(ref expr) => {
self.resolve_anon_const_manual(false, AnonConstKind::InlineConst, |this| {
this.visit_expr(expr)
});
}
ExprKind::Index(ref elem, ref idx, _) => {
self.resolve_expr(elem, Some(expr));
self.visit_expr(idx);