mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
remove type_op constructors
This commit is contained in:
parent
401f9b4e0a
commit
9334d85e69
@ -137,7 +137,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
|||||||
let _: Result<_, ErrorGuaranteed> = self.fully_perform_op(
|
let _: Result<_, ErrorGuaranteed> = self.fully_perform_op(
|
||||||
locations,
|
locations,
|
||||||
category,
|
category,
|
||||||
param_env.and(type_op::prove_predicate::ProvePredicate::new(predicate)),
|
param_env.and(type_op::prove_predicate::ProvePredicate { predicate }),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,7 +162,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
|||||||
let result: Result<_, ErrorGuaranteed> = self.fully_perform_op(
|
let result: Result<_, ErrorGuaranteed> = self.fully_perform_op(
|
||||||
location.to_locations(),
|
location.to_locations(),
|
||||||
category,
|
category,
|
||||||
param_env.and(type_op::normalize::Normalize::new(value)),
|
param_env.and(type_op::normalize::Normalize { value }),
|
||||||
);
|
);
|
||||||
result.unwrap_or(value)
|
result.unwrap_or(value)
|
||||||
}
|
}
|
||||||
@ -223,7 +223,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
|||||||
let _: Result<_, ErrorGuaranteed> = self.fully_perform_op(
|
let _: Result<_, ErrorGuaranteed> = self.fully_perform_op(
|
||||||
Locations::All(span),
|
Locations::All(span),
|
||||||
ConstraintCategory::Boring,
|
ConstraintCategory::Boring,
|
||||||
self.param_env.and(type_op::ascribe_user_type::AscribeUserType::new(mir_ty, user_ty)),
|
self.param_env.and(type_op::ascribe_user_type::AscribeUserType { mir_ty, user_ty }),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,7 +280,7 @@ impl<'tcx> UniversalRegionRelationsBuilder<'_, 'tcx> {
|
|||||||
}
|
}
|
||||||
let TypeOpOutput { output: norm_ty, constraints: constraints_normalize, .. } = self
|
let TypeOpOutput { output: norm_ty, constraints: constraints_normalize, .. } = self
|
||||||
.param_env
|
.param_env
|
||||||
.and(type_op::normalize::Normalize::new(ty))
|
.and(type_op::normalize::Normalize { value: ty })
|
||||||
.fully_perform(self.infcx, span)
|
.fully_perform(self.infcx, span)
|
||||||
.unwrap_or_else(|guar| TypeOpOutput {
|
.unwrap_or_else(|guar| TypeOpOutput {
|
||||||
output: Ty::new_error(self.infcx.tcx, guar),
|
output: Ty::new_error(self.infcx.tcx, guar),
|
||||||
@ -318,7 +318,7 @@ impl<'tcx> UniversalRegionRelationsBuilder<'_, 'tcx> {
|
|||||||
for &(ty, _) in tcx.assumed_wf_types(tcx.local_parent(defining_ty_def_id)) {
|
for &(ty, _) in tcx.assumed_wf_types(tcx.local_parent(defining_ty_def_id)) {
|
||||||
let result: Result<_, ErrorGuaranteed> = self
|
let result: Result<_, ErrorGuaranteed> = self
|
||||||
.param_env
|
.param_env
|
||||||
.and(type_op::normalize::Normalize::new(ty))
|
.and(type_op::normalize::Normalize { value: ty })
|
||||||
.fully_perform(self.infcx, span);
|
.fully_perform(self.infcx, span);
|
||||||
let Ok(TypeOpOutput { output: norm_ty, constraints: c, .. }) = result else {
|
let Ok(TypeOpOutput { output: norm_ty, constraints: c, .. }) = result else {
|
||||||
continue;
|
continue;
|
||||||
|
@ -15,12 +15,9 @@ use crate::infer::canonical::{Canonical, QueryResponse};
|
|||||||
use crate::ty::{self, GenericArg, Ty, TyCtxt};
|
use crate::ty::{self, GenericArg, Ty, TyCtxt};
|
||||||
|
|
||||||
pub mod type_op {
|
pub mod type_op {
|
||||||
use std::fmt;
|
|
||||||
|
|
||||||
use rustc_macros::{HashStable, TypeFoldable, TypeVisitable};
|
use rustc_macros::{HashStable, TypeFoldable, TypeVisitable};
|
||||||
|
|
||||||
use crate::ty::fold::TypeFoldable;
|
use crate::ty::{Predicate, Ty, UserType};
|
||||||
use crate::ty::{Predicate, Ty, TyCtxt, UserType};
|
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, HashStable, TypeFoldable, TypeVisitable)]
|
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, HashStable, TypeFoldable, TypeVisitable)]
|
||||||
pub struct AscribeUserType<'tcx> {
|
pub struct AscribeUserType<'tcx> {
|
||||||
@ -28,12 +25,6 @@ pub mod type_op {
|
|||||||
pub user_ty: UserType<'tcx>,
|
pub user_ty: UserType<'tcx>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> AscribeUserType<'tcx> {
|
|
||||||
pub fn new(mir_ty: Ty<'tcx>, user_ty: UserType<'tcx>) -> Self {
|
|
||||||
Self { mir_ty, user_ty }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, HashStable, TypeFoldable, TypeVisitable)]
|
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, HashStable, TypeFoldable, TypeVisitable)]
|
||||||
pub struct Eq<'tcx> {
|
pub struct Eq<'tcx> {
|
||||||
pub a: Ty<'tcx>,
|
pub a: Ty<'tcx>,
|
||||||
@ -51,26 +42,11 @@ pub mod type_op {
|
|||||||
pub predicate: Predicate<'tcx>,
|
pub predicate: Predicate<'tcx>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> ProvePredicate<'tcx> {
|
|
||||||
pub fn new(predicate: Predicate<'tcx>) -> Self {
|
|
||||||
ProvePredicate { predicate }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, HashStable, TypeFoldable, TypeVisitable)]
|
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, HashStable, TypeFoldable, TypeVisitable)]
|
||||||
pub struct Normalize<T> {
|
pub struct Normalize<T> {
|
||||||
pub value: T,
|
pub value: T,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx, T> Normalize<T>
|
|
||||||
where
|
|
||||||
T: fmt::Debug + TypeFoldable<TyCtxt<'tcx>>,
|
|
||||||
{
|
|
||||||
pub fn new(value: T) -> Self {
|
|
||||||
Self { value }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, HashStable, TypeFoldable, TypeVisitable)]
|
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, HashStable, TypeFoldable, TypeVisitable)]
|
||||||
pub struct ImpliedOutlivesBounds<'tcx> {
|
pub struct ImpliedOutlivesBounds<'tcx> {
|
||||||
pub ty: Ty<'tcx>,
|
pub ty: Ty<'tcx>,
|
||||||
|
Loading…
Reference in New Issue
Block a user