1
Fork 0

Change ty.kind to a method

This commit is contained in:
LeSeulArtichaut 2020-08-03 00:49:11 +02:00
parent ef55a0a92f
commit 3e14b684dd
189 changed files with 947 additions and 899 deletions

View file

@ -291,7 +291,7 @@ impl<'tcx> chalk_solve::RustIrDatabase<RustInterner<'tcx>> for RustIrDatabase<'t
for impl_def_id in all_impls {
let trait_ref = self.tcx.impl_trait_ref(impl_def_id).unwrap();
let self_ty = trait_ref.self_ty();
match self_ty.kind {
match *self_ty.kind() {
ty::Adt(impl_adt_def, _) => {
if impl_adt_def == adt_def {
return true;

View file

@ -217,7 +217,7 @@ impl<'tcx> LowerInto<'tcx, chalk_ir::GoalData<RustInterner<'tcx>>> for ty::Predi
ty::Binder::bind(predicate).lower_into(interner)
}
ty::PredicateAtom::WellFormed(arg) => match arg.unpack() {
GenericArgKind::Type(ty) => match ty.kind {
GenericArgKind::Type(ty) => match ty.kind() {
// FIXME(chalk): In Chalk, a placeholder is WellFormed if it
// `FromEnv`. However, when we "lower" Params, we don't update
// the environment.
@ -340,7 +340,7 @@ impl<'tcx> LowerInto<'tcx, chalk_ir::Ty<RustInterner<'tcx>>> for Ty<'tcx> {
let uint = |i| apply(chalk_ir::TypeName::Scalar(chalk_ir::Scalar::Uint(i)), empty());
let float = |f| apply(chalk_ir::TypeName::Scalar(chalk_ir::Scalar::Float(f)), empty());
match self.kind {
match *self.kind() {
Bool => apply(chalk_ir::TypeName::Scalar(chalk_ir::Scalar::Bool), empty()),
Char => apply(chalk_ir::TypeName::Scalar(chalk_ir::Scalar::Char), empty()),
Int(ty) => match ty {
@ -692,7 +692,7 @@ impl<'tcx> TypeVisitor<'tcx> for BoundVarsCollector<'tcx> {
}
fn visit_ty(&mut self, t: Ty<'tcx>) -> bool {
match t.kind {
match *t.kind() {
ty::Bound(debruijn, bound_ty) if debruijn == self.binder_index => {
match self.parameters.entry(bound_ty.var.as_u32()) {
Entry::Vacant(entry) => {
@ -836,7 +836,7 @@ impl<'tcx> TypeFolder<'tcx> for ParamsSubstitutor<'tcx> {
}
fn fold_ty(&mut self, t: Ty<'tcx>) -> Ty<'tcx> {
match t.kind {
match *t.kind() {
// FIXME(chalk): currently we convert params to placeholders starting at
// index `0`. To support placeholders, we'll actually need to do a
// first pass to collect placeholders. Then we can insert params after.

View file

@ -112,7 +112,7 @@ fn dropck_outlives<'tcx>(
debug!("dropck_outlives: ty from dtorck_types = {:?}", ty);
match ty.kind {
match ty.kind() {
// All parameters live for the duration of the
// function.
ty::Param(..) => {}
@ -172,7 +172,7 @@ fn dtorck_constraint_for_ty<'tcx>(
return Ok(());
}
match ty.kind {
match ty.kind() {
ty::Bool
| ty::Char
| ty::Int(_)