diff options
| author | Michael Goulet <michael@errs.io> | 2025-04-11 04:17:19 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2025-07-04 18:14:22 +0000 |
| commit | 42c9bfd2b96f2e6cd0e4e6fab21c2d5499883089 (patch) | |
| tree | 7ce9fcacfe304104d232cb1a1091c1131e465a44 /compiler/rustc_lint/src | |
| parent | 0c4fa2690de945f062668acfc36b3f8cfbd013e2 (diff) | |
| download | rust-42c9bfd2b96f2e6cd0e4e6fab21c2d5499883089.tar.gz rust-42c9bfd2b96f2e6cd0e4e6fab21c2d5499883089.zip | |
Remove Symbol for Named LateParam/Bound variants
Diffstat (limited to 'compiler/rustc_lint/src')
| -rw-r--r-- | compiler/rustc_lint/src/impl_trait_overcaptures.rs | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/compiler/rustc_lint/src/impl_trait_overcaptures.rs b/compiler/rustc_lint/src/impl_trait_overcaptures.rs index aa6f36a67f0..c8338044793 100644 --- a/compiler/rustc_lint/src/impl_trait_overcaptures.rs +++ b/compiler/rustc_lint/src/impl_trait_overcaptures.rs @@ -136,7 +136,7 @@ enum ParamKind { // Early-bound var. Early(Symbol, u32), // Late-bound var on function, not within a binder. We can capture these. - Free(DefId, Symbol), + Free(DefId), // Late-bound var in a binder. We can't capture these yet. Late, } @@ -156,12 +156,11 @@ fn check_fn(tcx: TyCtxt<'_>, parent_def_id: LocalDefId) { } for bound_var in sig.bound_vars() { - let ty::BoundVariableKind::Region(ty::BoundRegionKind::Named(def_id, name)) = bound_var - else { + let ty::BoundVariableKind::Region(ty::BoundRegionKind::Named(def_id)) = bound_var else { span_bug!(tcx.def_span(parent_def_id), "unexpected non-lifetime binder on fn sig"); }; - in_scope_parameters.insert(def_id, ParamKind::Free(def_id, name)); + in_scope_parameters.insert(def_id, ParamKind::Free(def_id)); } let sig = tcx.liberate_late_bound_regions(parent_def_id.to_def_id(), sig); @@ -215,7 +214,7 @@ where for arg in t.bound_vars() { let arg: ty::BoundVariableKind = arg; match arg { - ty::BoundVariableKind::Region(ty::BoundRegionKind::Named(def_id, ..)) + ty::BoundVariableKind::Region(ty::BoundRegionKind::Named(def_id)) | ty::BoundVariableKind::Ty(ty::BoundTyKind::Param(def_id, _)) => { added.push(def_id); let unique = self.in_scope_parameters.insert(def_id, ParamKind::Late); @@ -316,10 +315,10 @@ where self.tcx, ty::EarlyParamRegion { name, index }, ), - ParamKind::Free(def_id, name) => ty::Region::new_late_param( + ParamKind::Free(def_id) => ty::Region::new_late_param( self.tcx, self.parent_def_id.to_def_id(), - ty::LateParamRegionKind::Named(def_id, name), + ty::LateParamRegionKind::Named(def_id), ), // Totally ignore late bound args from binders. ParamKind::Late => return true, @@ -463,13 +462,10 @@ fn extract_def_id_from_arg<'tcx>( match arg.kind() { ty::GenericArgKind::Lifetime(re) => match re.kind() { ty::ReEarlyParam(ebr) => generics.region_param(ebr, tcx).def_id, - ty::ReBound( - _, - ty::BoundRegion { kind: ty::BoundRegionKind::Named(def_id, ..), .. }, - ) + ty::ReBound(_, ty::BoundRegion { kind: ty::BoundRegionKind::Named(def_id), .. }) | ty::ReLateParam(ty::LateParamRegion { scope: _, - kind: ty::LateParamRegionKind::Named(def_id, ..), + kind: ty::LateParamRegionKind::Named(def_id), }) => def_id, _ => unreachable!(), }, @@ -532,13 +528,10 @@ impl<'tcx> TypeRelation<TyCtxt<'tcx>> for FunctionalVariances<'tcx> { ) -> RelateResult<'tcx, ty::Region<'tcx>> { let def_id = match a.kind() { ty::ReEarlyParam(ebr) => self.generics.region_param(ebr, self.tcx).def_id, - ty::ReBound( - _, - ty::BoundRegion { kind: ty::BoundRegionKind::Named(def_id, ..), .. }, - ) + ty::ReBound(_, ty::BoundRegion { kind: ty::BoundRegionKind::Named(def_id), .. }) | ty::ReLateParam(ty::LateParamRegion { scope: _, - kind: ty::LateParamRegionKind::Named(def_id, ..), + kind: ty::LateParamRegionKind::Named(def_id), }) => def_id, _ => { return Ok(a); |
