diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2022-10-18 20:53:24 +0000 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2022-10-18 21:25:38 +0000 |
| commit | 9c3bf4de5534846b289de626dd4dc78f7dc7d13c (patch) | |
| tree | a92bb34e353a2099d468f9aff838af4c3a035743 /compiler/rustc_resolve/src | |
| parent | 4891d57f7aab37b5d6a84f2901c0bb8903111d53 (diff) | |
| download | rust-9c3bf4de5534846b289de626dd4dc78f7dc7d13c.tar.gz rust-9c3bf4de5534846b289de626dd4dc78f7dc7d13c.zip | |
Consider patterns in fn params in an `Elided(Infer)` lifetime rib.
Diffstat (limited to 'compiler/rustc_resolve/src')
| -rw-r--r-- | compiler/rustc_resolve/src/late.rs | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/compiler/rustc_resolve/src/late.rs b/compiler/rustc_resolve/src/late.rs index 776c8ad528c..1675580bd89 100644 --- a/compiler/rustc_resolve/src/late.rs +++ b/compiler/rustc_resolve/src/late.rs @@ -1853,9 +1853,11 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> { let mut bindings = smallvec![(PatBoundCtx::Product, Default::default())]; for (index, (pat, ty)) in inputs.enumerate() { debug!(?pat, ?ty); - if let Some(pat) = pat { - self.resolve_pattern(pat, PatternSource::FnParam, &mut bindings); - } + self.with_lifetime_rib(LifetimeRibKind::Elided(LifetimeRes::Infer), |this| { + if let Some(pat) = pat { + this.resolve_pattern(pat, PatternSource::FnParam, &mut bindings); + } + }); self.visit_ty(ty); if let Some(ref candidates) = self.lifetime_elision_candidates { @@ -2827,10 +2829,13 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> { fn resolve_params(&mut self, params: &'ast [Param]) { let mut bindings = smallvec![(PatBoundCtx::Product, Default::default())]; - for Param { pat, ty, .. } in params { - self.resolve_pattern(pat, PatternSource::FnParam, &mut bindings); + self.with_lifetime_rib(LifetimeRibKind::Elided(LifetimeRes::Infer), |this| { + for Param { pat, .. } in params { + this.resolve_pattern(pat, PatternSource::FnParam, &mut bindings); + } + }); + for Param { ty, .. } in params { self.visit_ty(ty); - debug!("(resolving function / closure) recorded parameter"); } } |
