diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2025-02-12 06:07:37 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-12 06:07:37 +0100 |
| commit | 516dd06a2524bdc7620087e61fe97ff1d9f85d66 (patch) | |
| tree | 9719817aae81b805ee6ea9a3346469d7ec58e6a1 /compiler/rustc_resolve/src | |
| parent | 2f3f83a4a34cf2c75143be939648ce77763b01db (diff) | |
| parent | 6d7ce4e893003cc652428ec02eb752bba63645e2 (diff) | |
| download | rust-516dd06a2524bdc7620087e61fe97ff1d9f85d66.tar.gz rust-516dd06a2524bdc7620087e61fe97ff1d9f85d66.zip | |
Rollup merge of #136646 - oli-obk:pattern-types-ast, r=BoxyUwU
Add a TyPat in the AST to reuse the generic arg lowering logic This simplifies ast lowering significantly with little cost to the pattern types parser. Also fixes any problems we've had with generic args (well, pushes any problems onto the `generic_const_exprs` feature gate) follow-up to https://github.com/rust-lang/rust/pull/136284#discussion_r1939292367 r? ``@BoxyUwU``
Diffstat (limited to 'compiler/rustc_resolve/src')
| -rw-r--r-- | compiler/rustc_resolve/src/late.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/compiler/rustc_resolve/src/late.rs b/compiler/rustc_resolve/src/late.rs index 508bd831ccb..03aeb8720ca 100644 --- a/compiler/rustc_resolve/src/late.rs +++ b/compiler/rustc_resolve/src/late.rs @@ -923,6 +923,21 @@ impl<'ra: 'ast, 'ast, 'tcx> Visitor<'ast> for LateResolutionVisitor<'_, 'ast, 'r self.diag_metadata.current_trait_object = prev; self.diag_metadata.current_type_path = prev_ty; } + + fn visit_ty_pat(&mut self, t: &'ast TyPat) -> Self::Result { + match &t.kind { + TyPatKind::Range(start, end, _) => { + if let Some(start) = start { + self.resolve_anon_const(start, AnonConstKind::ConstArg(IsRepeatExpr::No)); + } + if let Some(end) = end { + self.resolve_anon_const(end, AnonConstKind::ConstArg(IsRepeatExpr::No)); + } + } + TyPatKind::Err(_) => {} + } + } + fn visit_poly_trait_ref(&mut self, tref: &'ast PolyTraitRef) { let span = tref.span.shrink_to_lo().to(tref.trait_ref.path.span.shrink_to_lo()); self.with_generic_param_rib( |
