Skip to content

Commit e66720b

Browse files
Simplify some redundant names
1 parent cc64494 commit e66720b

File tree

6 files changed

+19
-23
lines changed

6 files changed

+19
-23
lines changed

compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ impl<'tcx> BorrowExplanation<'tcx> {
315315
let mut failed = false;
316316

317317
let elaborated_args = std::iter::zip(*args, &generics.params).map(|(arg, param)| {
318-
if let Some(ty::Dynamic(obj, _, ty::DynKind::Dyn)) = arg.as_type().map(Ty::kind) {
318+
if let Some(ty::Dynamic(obj, _, ty::Dyn)) = arg.as_type().map(Ty::kind) {
319319
let default = tcx.object_lifetime_default(param.def_id);
320320

321321
let re_static = tcx.lifetimes.re_static;
@@ -339,7 +339,7 @@ impl<'tcx> BorrowExplanation<'tcx> {
339339

340340
has_dyn = true;
341341

342-
Ty::new_dynamic(tcx, obj, implied_region, ty::DynKind::Dyn).into()
342+
Ty::new_dynamic(tcx, obj, implied_region, ty::Dyn).into()
343343
} else {
344344
arg
345345
}

compiler/rustc_infer/src/infer/combine.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ impl<'infcx, 'tcx> CombineFields<'infcx, 'tcx> {
511511
));
512512
} else {
513513
match a_ty.kind() {
514-
&ty::Alias(ty::AliasKind::Projection, data) => {
514+
&ty::Alias(ty::Projection, data) => {
515515
// FIXME: This does not handle subtyping correctly, we could
516516
// instead create a new inference variable for `a_ty`, emitting
517517
// `Projection(a_ty, a_infer)` and `a_infer <: b_ty`.
@@ -523,10 +523,9 @@ impl<'infcx, 'tcx> CombineFields<'infcx, 'tcx> {
523523
))
524524
}
525525
// The old solver only accepts projection predicates for associated types.
526-
ty::Alias(
527-
ty::AliasKind::Inherent | ty::AliasKind::Weak | ty::AliasKind::Opaque,
528-
_,
529-
) => return Err(TypeError::CyclicTy(a_ty)),
526+
ty::Alias(ty::Inherent | ty::Weak | ty::Opaque, _) => {
527+
return Err(TypeError::CyclicTy(a_ty));
528+
}
530529
_ => bug!("generalizated `{a_ty:?} to infer, not an alias"),
531530
}
532531
}

compiler/rustc_infer/src/infer/error_reporting/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -2349,11 +2349,11 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
23492349
GenericKind::Param(ref p) => format!("the parameter type `{p}`"),
23502350
GenericKind::Placeholder(ref p) => format!("the placeholder type `{p:?}`"),
23512351
GenericKind::Alias(ref p) => match p.kind(self.tcx) {
2352-
ty::AliasKind::Projection | ty::AliasKind::Inherent => {
2352+
ty::Projection | ty::Inherent => {
23532353
format!("the associated type `{p}`")
23542354
}
2355-
ty::AliasKind::Weak => format!("the type alias `{p}`"),
2356-
ty::AliasKind::Opaque => format!("the opaque type `{p}`"),
2355+
ty::Weak => format!("the type alias `{p}`"),
2356+
ty::Opaque => format!("the opaque type `{p}`"),
23572357
},
23582358
};
23592359

compiler/rustc_lint/src/types.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ use rustc_span::{Span, Symbol};
2929
use rustc_target::abi::{Abi, Size, WrappingRange};
3030
use rustc_target::abi::{Integer, TagEncoding, Variants};
3131
use rustc_target::spec::abi::Abi as SpecAbi;
32-
use rustc_type_ir::DynKind;
3332

3433
use std::iter;
3534
use std::ops::ControlFlow;
@@ -675,7 +674,7 @@ fn lint_wide_pointer<'tcx>(
675674
}
676675
match ty.kind() {
677676
ty::RawPtr(TypeAndMut { mutbl: _, ty }) => (!ty.is_sized(cx.tcx, cx.param_env))
678-
.then(|| (refs, matches!(ty.kind(), ty::Dynamic(_, _, DynKind::Dyn)))),
677+
.then(|| (refs, matches!(ty.kind(), ty::Dynamic(_, _, ty::Dyn)))),
679678
_ => None,
680679
}
681680
};

compiler/rustc_middle/src/ty/sty.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1238,7 +1238,7 @@ impl<'tcx> AliasTy<'tcx> {
12381238

12391239
/// Whether this alias type is an opaque.
12401240
pub fn is_opaque(self, tcx: TyCtxt<'tcx>) -> bool {
1241-
matches!(self.opt_kind(tcx), Some(ty::AliasKind::Opaque))
1241+
matches!(self.opt_kind(tcx), Some(ty::Opaque))
12421242
}
12431243

12441244
/// FIXME: rename `AliasTy` to `AliasTerm` and always handle
@@ -2759,7 +2759,7 @@ impl<'tcx> Ty<'tcx> {
27592759
// Extern types have metadata = ().
27602760
| ty::Foreign(..)
27612761
// `dyn*` has no metadata
2762-
| ty::Dynamic(_, _, DynKind::DynStar)
2762+
| ty::Dynamic(_, _, ty::DynStar)
27632763
// If returned by `struct_tail_without_normalization` this is a unit struct
27642764
// without any fields, or not a struct, and therefore is Sized.
27652765
| ty::Adt(..)
@@ -2768,7 +2768,7 @@ impl<'tcx> Ty<'tcx> {
27682768
| ty::Tuple(..) => (tcx.types.unit, false),
27692769

27702770
ty::Str | ty::Slice(_) => (tcx.types.usize, false),
2771-
ty::Dynamic(_, _, DynKind::Dyn) => {
2771+
ty::Dynamic(_, _, ty::Dyn) => {
27722772
let dyn_metadata = tcx.require_lang_item(LangItem::DynMetadata, None);
27732773
(tcx.type_of(dyn_metadata).instantiate(tcx, &[tail.into()]), false)
27742774
},

compiler/rustc_smir/src/rustc_smir/convert/ty.rs

+6-8
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,11 @@ use crate::rustc_smir::{alloc, Stable, Tables};
1212
impl<'tcx> Stable<'tcx> for ty::AliasKind {
1313
type T = stable_mir::ty::AliasKind;
1414
fn stable(&self, _: &mut Tables<'tcx>) -> Self::T {
15-
use rustc_middle::ty::AliasKind::*;
1615
match self {
17-
Projection => stable_mir::ty::AliasKind::Projection,
18-
Inherent => stable_mir::ty::AliasKind::Inherent,
19-
Opaque => stable_mir::ty::AliasKind::Opaque,
20-
Weak => stable_mir::ty::AliasKind::Weak,
16+
ty::Projection => stable_mir::ty::AliasKind::Projection,
17+
ty::Inherent => stable_mir::ty::AliasKind::Inherent,
18+
ty::Opaque => stable_mir::ty::AliasKind::Opaque,
19+
ty::Weak => stable_mir::ty::AliasKind::Weak,
2120
}
2221
}
2322
}
@@ -34,10 +33,9 @@ impl<'tcx> Stable<'tcx> for ty::DynKind {
3433
type T = stable_mir::ty::DynKind;
3534

3635
fn stable(&self, _: &mut Tables<'tcx>) -> Self::T {
37-
use rustc_middle::ty::DynKind;
3836
match self {
39-
DynKind::Dyn => stable_mir::ty::DynKind::Dyn,
40-
DynKind::DynStar => stable_mir::ty::DynKind::DynStar,
37+
ty::Dyn => stable_mir::ty::DynKind::Dyn,
38+
ty::DynStar => stable_mir::ty::DynKind::DynStar,
4139
}
4240
}
4341
}

0 commit comments

Comments
 (0)