diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-04-30 01:14:59 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-30 01:14:59 +0200 |
| commit | a656a2019acf9dbcdf1a27c8d8c64cbc7198a937 (patch) | |
| tree | d84644990104a3cb232936afc7624388d699ef64 /compiler/rustc_resolve/src | |
| parent | 549b3a13a15b5727846ef9ad24ab70ce970d794c (diff) | |
| parent | 63028ac3a1cdad56e4a61b8fcb260456efc2b71e (diff) | |
| download | rust-a656a2019acf9dbcdf1a27c8d8c64cbc7198a937.tar.gz rust-a656a2019acf9dbcdf1a27c8d8c64cbc7198a937.zip | |
Rollup merge of #110984 - cjgillot:const-infer-lifetime, r=compiler-errors
Do not resolve anonymous lifetimes in consts to be static. Fixes https://github.com/rust-lang/rust/issues/110931
Diffstat (limited to 'compiler/rustc_resolve/src')
| -rw-r--r-- | compiler/rustc_resolve/src/late.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_resolve/src/late.rs b/compiler/rustc_resolve/src/late.rs index 5c02e7193a2..511ae8516a8 100644 --- a/compiler/rustc_resolve/src/late.rs +++ b/compiler/rustc_resolve/src/late.rs @@ -656,7 +656,7 @@ impl<'a: 'ast, 'ast, 'tcx> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast, fn visit_anon_const(&mut self, constant: &'ast AnonConst) { // We deal with repeat expressions explicitly in `resolve_expr`. self.with_lifetime_rib(LifetimeRibKind::AnonConst, |this| { - this.with_lifetime_rib(LifetimeRibKind::Elided(LifetimeRes::Static), |this| { + this.with_lifetime_rib(LifetimeRibKind::Elided(LifetimeRes::Infer), |this| { this.resolve_anon_const(constant, IsRepeatExpr::No); }) }) @@ -4126,7 +4126,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> { ExprKind::Repeat(ref elem, ref ct) => { self.visit_expr(elem); self.with_lifetime_rib(LifetimeRibKind::AnonConst, |this| { - this.with_lifetime_rib(LifetimeRibKind::Elided(LifetimeRes::Static), |this| { + this.with_lifetime_rib(LifetimeRibKind::Elided(LifetimeRes::Infer), |this| { this.resolve_anon_const(ct, IsRepeatExpr::Yes) }) }); |
