Skip to content

Commit bccde89

Browse files
Rename unpack to kind
1 parent 95a2212 commit bccde89

File tree

79 files changed

+164
-164
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+164
-164
lines changed

compiler/rustc_borrowck/src/diagnostics/region_name.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ impl<'tcx> MirBorrowckCtxt<'_, '_, 'tcx> {
607607
search_stack: &mut Vec<(Ty<'tcx>, &'hir hir::Ty<'hir>)>,
608608
) -> Option<&'hir hir::Lifetime> {
609609
for (kind, hir_arg) in iter::zip(args, hir_args.args) {
610-
match (kind.unpack(), hir_arg) {
610+
match (kind.kind(), hir_arg) {
611611
(GenericArgKind::Lifetime(r), hir::GenericArg::Lifetime(lt)) => {
612612
if r.as_var() == needle_fr {
613613
return Some(lt);
@@ -997,7 +997,7 @@ impl<'tcx> MirBorrowckCtxt<'_, '_, 'tcx> {
997997
) -> bool {
998998
let tcx = self.infcx.tcx;
999999
ty.walk().any(|arg| {
1000-
if let ty::GenericArgKind::Type(ty) = arg.unpack()
1000+
if let ty::GenericArgKind::Type(ty) = arg.kind()
10011001
&& let ty::Param(_) = ty.kind()
10021002
{
10031003
clauses.iter().any(|pred| {

compiler/rustc_borrowck/src/type_check/constraint_conversion.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ impl<'a, 'tcx> ConstraintConversion<'a, 'tcx> {
148148

149149
let mut next_outlives_predicates = vec![];
150150
for (ty::OutlivesPredicate(k1, r2), constraint_category) in outlives_predicates {
151-
match k1.unpack() {
151+
match k1.kind() {
152152
GenericArgKind::Lifetime(r1) => {
153153
let r1_vid = self.to_region_vid(r1);
154154
let r2_vid = self.to_region_vid(r2);

compiler/rustc_borrowck/src/type_check/opaque_types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ fn register_member_constraints<'tcx>(
221221
.iter()
222222
.enumerate()
223223
.filter(|(i, _)| variances[*i] == ty::Invariant)
224-
.filter_map(|(_, arg)| match arg.unpack() {
224+
.filter_map(|(_, arg)| match arg.kind() {
225225
GenericArgKind::Lifetime(r) => Some(typeck.to_region_vid(r)),
226226
GenericArgKind::Type(_) | GenericArgKind::Const(_) => None,
227227
})

compiler/rustc_codegen_ssa/src/meth.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ fn dyn_trait_in_self<'tcx>(
7777
ty: Ty<'tcx>,
7878
) -> Option<ty::ExistentialTraitRef<'tcx>> {
7979
for arg in ty.peel_refs().walk() {
80-
if let GenericArgKind::Type(ty) = arg.unpack()
80+
if let GenericArgKind::Type(ty) = arg.kind()
8181
&& let ty::Dynamic(data, _, _) = ty.kind()
8282
{
8383
// FIXME(arbitrary_self_types): This is likely broken for receivers which

compiler/rustc_const_eval/src/check_consts/ops.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ fn build_error_for_const_call<'tcx>(
281281
let mut sugg = None;
282282

283283
if ccx.tcx.is_lang_item(trait_id, LangItem::PartialEq) {
284-
match (args[0].unpack(), args[1].unpack()) {
284+
match (args[0].kind(), args[1].kind()) {
285285
(GenericArgKind::Type(self_ty), GenericArgKind::Type(rhs_ty))
286286
if self_ty == rhs_ty
287287
&& self_ty.is_ref()

compiler/rustc_const_eval/src/util/type_name.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ impl<'tcx> Printer<'tcx> for AbsolutePathPrinter<'tcx> {
125125
) -> Result<(), PrintError> {
126126
print_prefix(self)?;
127127
let args =
128-
args.iter().cloned().filter(|arg| !matches!(arg.unpack(), GenericArgKind::Lifetime(_)));
128+
args.iter().cloned().filter(|arg| !matches!(arg.kind(), GenericArgKind::Lifetime(_)));
129129
if args.clone().next().is_some() {
130130
self.generic_delimiters(|cx| cx.comma_sep(args))
131131
} else {

compiler/rustc_hir_analysis/src/check/check.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1575,7 +1575,7 @@ fn check_type_alias_type_params_are_used<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalD
15751575

15761576
let mut params_used = DenseBitSet::new_empty(generics.own_params.len());
15771577
for leaf in ty.walk() {
1578-
if let GenericArgKind::Type(leaf_ty) = leaf.unpack()
1578+
if let GenericArgKind::Type(leaf_ty) = leaf.kind()
15791579
&& let ty::Param(param) = leaf_ty.kind()
15801580
{
15811581
debug!("found use of ty param {:?}", param);
@@ -1700,7 +1700,7 @@ fn opaque_type_cycle_error(tcx: TyCtxt<'_>, opaque_def_id: LocalDefId) -> ErrorG
17001700

17011701
let mut label_match = |ty: Ty<'_>, span| {
17021702
for arg in ty.walk() {
1703-
if let ty::GenericArgKind::Type(ty) = arg.unpack()
1703+
if let ty::GenericArgKind::Type(ty) = arg.kind()
17041704
&& let ty::Alias(
17051705
ty::Opaque,
17061706
ty::AliasTy { def_id: captured_def_id, .. },

compiler/rustc_hir_analysis/src/check/compare_impl_item.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1231,7 +1231,7 @@ fn check_region_late_boundedness<'tcx>(
12311231
for (id_arg, arg) in
12321232
std::iter::zip(ty::GenericArgs::identity_for_item(tcx, impl_m.def_id), impl_m_args)
12331233
{
1234-
if let ty::GenericArgKind::Lifetime(r) = arg.unpack()
1234+
if let ty::GenericArgKind::Lifetime(r) = arg.kind()
12351235
&& let ty::ReVar(vid) = r.kind()
12361236
&& let r = infcx
12371237
.inner
@@ -1256,7 +1256,7 @@ fn check_region_late_boundedness<'tcx>(
12561256
for (id_arg, arg) in
12571257
std::iter::zip(ty::GenericArgs::identity_for_item(tcx, trait_m.def_id), trait_m_args)
12581258
{
1259-
if let ty::GenericArgKind::Lifetime(r) = arg.unpack()
1259+
if let ty::GenericArgKind::Lifetime(r) = arg.kind()
12601260
&& let ty::ReVar(vid) = r.kind()
12611261
&& let r = infcx
12621262
.inner

compiler/rustc_hir_analysis/src/check/compare_impl_item/refine.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ fn report_mismatched_rpitit_captures<'tcx>(
427427
};
428428

429429
trait_captured_args
430-
.sort_by_cached_key(|arg| !matches!(arg.unpack(), ty::GenericArgKind::Lifetime(_)));
430+
.sort_by_cached_key(|arg| !matches!(arg.kind(), ty::GenericArgKind::Lifetime(_)));
431431
let suggestion = format!("use<{}>", trait_captured_args.iter().join(", "));
432432

433433
tcx.emit_node_span_lint(

compiler/rustc_hir_analysis/src/check/wfcheck.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,7 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for GATArgsCollector<'tcx> {
819819
match t.kind() {
820820
ty::Alias(ty::Projection, p) if p.def_id == self.gat => {
821821
for (idx, arg) in p.args.iter().enumerate() {
822-
match arg.unpack() {
822+
match arg.kind() {
823823
GenericArgKind::Lifetime(lt) if !lt.is_bound() => {
824824
self.regions.insert((lt, idx));
825825
}
@@ -1517,7 +1517,7 @@ fn check_where_clauses<'tcx>(wfcx: &WfCheckingCtxt<'_, 'tcx>, span: Span, def_id
15171517
} else {
15181518
// If we've got a generic const parameter we still want to check its
15191519
// type is correct in case both it and the param type are fully concrete.
1520-
let GenericArgKind::Const(ct) = default.unpack() else {
1520+
let GenericArgKind::Const(ct) = default.kind() else {
15211521
continue;
15221522
};
15231523

0 commit comments

Comments
 (0)