Skip to content

Commit 8e6af16

Browse files
Remove the trivial constkind imports
1 parent 43c7805 commit 8e6af16

File tree

5 files changed

+23
-27
lines changed

5 files changed

+23
-27
lines changed

compiler/rustc_middle/src/ty/mod.rs

-4
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,6 @@ pub use rustc_session::lint::RegisteredTools;
4949
use rustc_span::hygiene::MacroKind;
5050
use rustc_span::symbol::{Ident, Symbol, kw, sym};
5151
use rustc_span::{ExpnId, ExpnKind, Span};
52-
pub use rustc_type_ir::ConstKind::{
53-
Bound as BoundCt, Error as ErrorCt, Expr as ExprCt, Infer as InferCt, Param as ParamCt,
54-
Placeholder as PlaceholderCt, Unevaluated, Value,
55-
};
5652
pub use rustc_type_ir::relate::VarianceDiagInfo;
5753
pub use rustc_type_ir::*;
5854
use tracing::{debug, instrument};

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

+16-16
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ pub(crate) fn mir_const_from_ty_const<'tcx>(
418418
ty: Ty<'tcx>,
419419
) -> stable_mir::ty::MirConst {
420420
let kind = match ty_const.kind() {
421-
ty::Value(ty, val) => {
421+
ty::ConstKind::Value(ty, val) => {
422422
let val = match val {
423423
ty::ValTree::Leaf(scalar) => ty::ValTree::Leaf(scalar),
424424
ty::ValTree::Branch(branch) => {
@@ -435,19 +435,19 @@ pub(crate) fn mir_const_from_ty_const<'tcx>(
435435
))
436436
}
437437
}
438-
ty::ParamCt(param) => stable_mir::ty::ConstantKind::Param(param.stable(tables)),
439-
ty::ErrorCt(_) => unreachable!(),
440-
ty::InferCt(_) => unreachable!(),
441-
ty::BoundCt(_, _) => unimplemented!(),
442-
ty::PlaceholderCt(_) => unimplemented!(),
443-
ty::Unevaluated(uv) => {
438+
ty::ConstKind::Param(param) => stable_mir::ty::ConstantKind::Param(param.stable(tables)),
439+
ty::ConstKind::Error(_) => unreachable!(),
440+
ty::ConstKind::Infer(_) => unreachable!(),
441+
ty::ConstKind::Bound(_, _) => unimplemented!(),
442+
ty::ConstKind::Placeholder(_) => unimplemented!(),
443+
ty::ConstKind::Unevaluated(uv) => {
444444
stable_mir::ty::ConstantKind::Unevaluated(stable_mir::ty::UnevaluatedConst {
445445
def: tables.const_def(uv.def),
446446
args: uv.args.stable(tables),
447447
promoted: None,
448448
})
449449
}
450-
ty::ExprCt(_) => unimplemented!(),
450+
ty::ConstKind::Expr(_) => unimplemented!(),
451451
};
452452
let stable_ty = tables.intern_ty(ty);
453453
let id = tables.intern_mir_const(mir::Const::Ty(ty, ty_const));
@@ -459,7 +459,7 @@ impl<'tcx> Stable<'tcx> for ty::Const<'tcx> {
459459

460460
fn stable(&self, tables: &mut Tables<'_>) -> Self::T {
461461
let kind = match self.kind() {
462-
ty::Value(ty, val) => {
462+
ty::ConstKind::Value(ty, val) => {
463463
let val = match val {
464464
ty::ValTree::Leaf(scalar) => ty::ValTree::Leaf(scalar),
465465
ty::ValTree::Branch(branch) => {
@@ -478,16 +478,16 @@ impl<'tcx> Stable<'tcx> for ty::Const<'tcx> {
478478
)
479479
}
480480
}
481-
ty::ParamCt(param) => stable_mir::ty::TyConstKind::Param(param.stable(tables)),
482-
ty::Unevaluated(uv) => stable_mir::ty::TyConstKind::Unevaluated(
481+
ty::ConstKind::Param(param) => stable_mir::ty::TyConstKind::Param(param.stable(tables)),
482+
ty::ConstKind::Unevaluated(uv) => stable_mir::ty::TyConstKind::Unevaluated(
483483
tables.const_def(uv.def),
484484
uv.args.stable(tables),
485485
),
486-
ty::ErrorCt(_) => unreachable!(),
487-
ty::InferCt(_) => unreachable!(),
488-
ty::BoundCt(_, _) => unimplemented!(),
489-
ty::PlaceholderCt(_) => unimplemented!(),
490-
ty::ExprCt(_) => unimplemented!(),
486+
ty::ConstKind::Error(_) => unreachable!(),
487+
ty::ConstKind::Infer(_) => unreachable!(),
488+
ty::ConstKind::Bound(_, _) => unimplemented!(),
489+
ty::ConstKind::Placeholder(_) => unimplemented!(),
490+
ty::ConstKind::Expr(_) => unimplemented!(),
491491
};
492492
let id = tables.intern_ty_const(tables.tcx.lift(*self).unwrap());
493493
stable_mir::ty::TyConst::new(kind, id)

compiler/rustc_symbol_mangling/src/v0.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ impl<'tcx> Printer<'tcx> for SymbolMangler<'tcx> {
568568

569569
// We may still encounter unevaluated consts due to the printing
570570
// logic sometimes passing identity-substituted impl headers.
571-
ty::Unevaluated(ty::UnevaluatedConst { def, args, .. }) => {
571+
ty::ConstKind::Unevaluated(ty::UnevaluatedConst { def, args, .. }) => {
572572
return self.print_def_path(def, args);
573573
}
574574

compiler/rustc_trait_selection/src/traits/fulfill.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -624,9 +624,8 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
624624
debug!("equating consts:\nc1= {:?}\nc2= {:?}", c1, c2);
625625

626626
use rustc_hir::def::DefKind;
627-
use ty::Unevaluated;
628627
match (c1.kind(), c2.kind()) {
629-
(Unevaluated(a), Unevaluated(b))
628+
(ty::ConstKind::Unevaluated(a), ty::ConstKind::Unevaluated(b))
630629
if a.def == b.def && tcx.def_kind(a.def) == DefKind::AssocConst =>
631630
{
632631
if let Ok(new_obligations) = infcx
@@ -644,7 +643,8 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
644643
));
645644
}
646645
}
647-
(_, Unevaluated(_)) | (Unevaluated(_), _) => (),
646+
(_, ty::ConstKind::Unevaluated(_))
647+
| (ty::ConstKind::Unevaluated(_), _) => (),
648648
(_, _) => {
649649
if let Ok(new_obligations) = infcx
650650
.at(&obligation.cause, obligation.param_env)

compiler/rustc_trait_selection/src/traits/select/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -890,9 +890,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
890890
);
891891

892892
use rustc_hir::def::DefKind;
893-
use ty::Unevaluated;
894893
match (c1.kind(), c2.kind()) {
895-
(Unevaluated(a), Unevaluated(b))
894+
(ty::ConstKind::Unevaluated(a), ty::ConstKind::Unevaluated(b))
896895
if a.def == b.def && tcx.def_kind(a.def) == DefKind::AssocConst =>
897896
{
898897
if let Ok(InferOk { obligations, value: () }) = self
@@ -912,7 +911,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
912911
);
913912
}
914913
}
915-
(_, Unevaluated(_)) | (Unevaluated(_), _) => (),
914+
(_, ty::ConstKind::Unevaluated(_))
915+
| (ty::ConstKind::Unevaluated(_), _) => (),
916916
(_, _) => {
917917
if let Ok(InferOk { obligations, value: () }) = self
918918
.infcx

0 commit comments

Comments
 (0)