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