mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-21 22:34:05 +00:00
Remove the trivial constkind imports
This commit is contained in:
parent
43c78051ea
commit
8e6af16192
@ -49,10 +49,6 @@ pub use rustc_session::lint::RegisteredTools;
|
||||
use rustc_span::hygiene::MacroKind;
|
||||
use rustc_span::symbol::{Ident, Symbol, kw, sym};
|
||||
use rustc_span::{ExpnId, ExpnKind, Span};
|
||||
pub use rustc_type_ir::ConstKind::{
|
||||
Bound as BoundCt, Error as ErrorCt, Expr as ExprCt, Infer as InferCt, Param as ParamCt,
|
||||
Placeholder as PlaceholderCt, Unevaluated, Value,
|
||||
};
|
||||
pub use rustc_type_ir::relate::VarianceDiagInfo;
|
||||
pub use rustc_type_ir::*;
|
||||
use tracing::{debug, instrument};
|
||||
|
@ -418,7 +418,7 @@ pub(crate) fn mir_const_from_ty_const<'tcx>(
|
||||
ty: Ty<'tcx>,
|
||||
) -> stable_mir::ty::MirConst {
|
||||
let kind = match ty_const.kind() {
|
||||
ty::Value(ty, val) => {
|
||||
ty::ConstKind::Value(ty, val) => {
|
||||
let val = match val {
|
||||
ty::ValTree::Leaf(scalar) => ty::ValTree::Leaf(scalar),
|
||||
ty::ValTree::Branch(branch) => {
|
||||
@ -435,19 +435,19 @@ pub(crate) fn mir_const_from_ty_const<'tcx>(
|
||||
))
|
||||
}
|
||||
}
|
||||
ty::ParamCt(param) => stable_mir::ty::ConstantKind::Param(param.stable(tables)),
|
||||
ty::ErrorCt(_) => unreachable!(),
|
||||
ty::InferCt(_) => unreachable!(),
|
||||
ty::BoundCt(_, _) => unimplemented!(),
|
||||
ty::PlaceholderCt(_) => unimplemented!(),
|
||||
ty::Unevaluated(uv) => {
|
||||
ty::ConstKind::Param(param) => stable_mir::ty::ConstantKind::Param(param.stable(tables)),
|
||||
ty::ConstKind::Error(_) => unreachable!(),
|
||||
ty::ConstKind::Infer(_) => unreachable!(),
|
||||
ty::ConstKind::Bound(_, _) => unimplemented!(),
|
||||
ty::ConstKind::Placeholder(_) => unimplemented!(),
|
||||
ty::ConstKind::Unevaluated(uv) => {
|
||||
stable_mir::ty::ConstantKind::Unevaluated(stable_mir::ty::UnevaluatedConst {
|
||||
def: tables.const_def(uv.def),
|
||||
args: uv.args.stable(tables),
|
||||
promoted: None,
|
||||
})
|
||||
}
|
||||
ty::ExprCt(_) => unimplemented!(),
|
||||
ty::ConstKind::Expr(_) => unimplemented!(),
|
||||
};
|
||||
let stable_ty = tables.intern_ty(ty);
|
||||
let id = tables.intern_mir_const(mir::Const::Ty(ty, ty_const));
|
||||
@ -459,7 +459,7 @@ impl<'tcx> Stable<'tcx> for ty::Const<'tcx> {
|
||||
|
||||
fn stable(&self, tables: &mut Tables<'_>) -> Self::T {
|
||||
let kind = match self.kind() {
|
||||
ty::Value(ty, val) => {
|
||||
ty::ConstKind::Value(ty, val) => {
|
||||
let val = match val {
|
||||
ty::ValTree::Leaf(scalar) => ty::ValTree::Leaf(scalar),
|
||||
ty::ValTree::Branch(branch) => {
|
||||
@ -478,16 +478,16 @@ impl<'tcx> Stable<'tcx> for ty::Const<'tcx> {
|
||||
)
|
||||
}
|
||||
}
|
||||
ty::ParamCt(param) => stable_mir::ty::TyConstKind::Param(param.stable(tables)),
|
||||
ty::Unevaluated(uv) => stable_mir::ty::TyConstKind::Unevaluated(
|
||||
ty::ConstKind::Param(param) => stable_mir::ty::TyConstKind::Param(param.stable(tables)),
|
||||
ty::ConstKind::Unevaluated(uv) => stable_mir::ty::TyConstKind::Unevaluated(
|
||||
tables.const_def(uv.def),
|
||||
uv.args.stable(tables),
|
||||
),
|
||||
ty::ErrorCt(_) => unreachable!(),
|
||||
ty::InferCt(_) => unreachable!(),
|
||||
ty::BoundCt(_, _) => unimplemented!(),
|
||||
ty::PlaceholderCt(_) => unimplemented!(),
|
||||
ty::ExprCt(_) => unimplemented!(),
|
||||
ty::ConstKind::Error(_) => unreachable!(),
|
||||
ty::ConstKind::Infer(_) => unreachable!(),
|
||||
ty::ConstKind::Bound(_, _) => unimplemented!(),
|
||||
ty::ConstKind::Placeholder(_) => unimplemented!(),
|
||||
ty::ConstKind::Expr(_) => unimplemented!(),
|
||||
};
|
||||
let id = tables.intern_ty_const(tables.tcx.lift(*self).unwrap());
|
||||
stable_mir::ty::TyConst::new(kind, id)
|
||||
|
@ -568,7 +568,7 @@ impl<'tcx> Printer<'tcx> for SymbolMangler<'tcx> {
|
||||
|
||||
// We may still encounter unevaluated consts due to the printing
|
||||
// logic sometimes passing identity-substituted impl headers.
|
||||
ty::Unevaluated(ty::UnevaluatedConst { def, args, .. }) => {
|
||||
ty::ConstKind::Unevaluated(ty::UnevaluatedConst { def, args, .. }) => {
|
||||
return self.print_def_path(def, args);
|
||||
}
|
||||
|
||||
|
@ -624,9 +624,8 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
|
||||
debug!("equating consts:\nc1= {:?}\nc2= {:?}", c1, c2);
|
||||
|
||||
use rustc_hir::def::DefKind;
|
||||
use ty::Unevaluated;
|
||||
match (c1.kind(), c2.kind()) {
|
||||
(Unevaluated(a), Unevaluated(b))
|
||||
(ty::ConstKind::Unevaluated(a), ty::ConstKind::Unevaluated(b))
|
||||
if a.def == b.def && tcx.def_kind(a.def) == DefKind::AssocConst =>
|
||||
{
|
||||
if let Ok(new_obligations) = infcx
|
||||
@ -644,7 +643,8 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
|
||||
));
|
||||
}
|
||||
}
|
||||
(_, Unevaluated(_)) | (Unevaluated(_), _) => (),
|
||||
(_, ty::ConstKind::Unevaluated(_))
|
||||
| (ty::ConstKind::Unevaluated(_), _) => (),
|
||||
(_, _) => {
|
||||
if let Ok(new_obligations) = infcx
|
||||
.at(&obligation.cause, obligation.param_env)
|
||||
|
@ -890,9 +890,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
);
|
||||
|
||||
use rustc_hir::def::DefKind;
|
||||
use ty::Unevaluated;
|
||||
match (c1.kind(), c2.kind()) {
|
||||
(Unevaluated(a), Unevaluated(b))
|
||||
(ty::ConstKind::Unevaluated(a), ty::ConstKind::Unevaluated(b))
|
||||
if a.def == b.def && tcx.def_kind(a.def) == DefKind::AssocConst =>
|
||||
{
|
||||
if let Ok(InferOk { obligations, value: () }) = self
|
||||
@ -912,7 +911,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
);
|
||||
}
|
||||
}
|
||||
(_, Unevaluated(_)) | (Unevaluated(_), _) => (),
|
||||
(_, ty::ConstKind::Unevaluated(_))
|
||||
| (ty::ConstKind::Unevaluated(_), _) => (),
|
||||
(_, _) => {
|
||||
if let Ok(InferOk { obligations, value: () }) = self
|
||||
.infcx
|
||||
|
Loading…
Reference in New Issue
Block a user