Skip to content

Commit 044ce0c

Browse files
committed
remove type_op constructors
1 parent 05dec8f commit 044ce0c

File tree

3 files changed

+6
-30
lines changed

3 files changed

+6
-30
lines changed

compiler/rustc_borrowck/src/type_check/canonical.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
137137
let _: Result<_, ErrorGuaranteed> = self.fully_perform_op(
138138
locations,
139139
category,
140-
param_env.and(type_op::prove_predicate::ProvePredicate::new(predicate)),
140+
param_env.and(type_op::prove_predicate::ProvePredicate { predicate }),
141141
);
142142
}
143143

@@ -162,7 +162,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
162162
let result: Result<_, ErrorGuaranteed> = self.fully_perform_op(
163163
location.to_locations(),
164164
category,
165-
param_env.and(type_op::normalize::Normalize::new(value)),
165+
param_env.and(type_op::normalize::Normalize { value }),
166166
);
167167
result.unwrap_or(value)
168168
}
@@ -223,7 +223,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
223223
let _: Result<_, ErrorGuaranteed> = self.fully_perform_op(
224224
Locations::All(span),
225225
ConstraintCategory::Boring,
226-
self.param_env.and(type_op::ascribe_user_type::AscribeUserType::new(mir_ty, user_ty)),
226+
self.param_env.and(type_op::ascribe_user_type::AscribeUserType { mir_ty, user_ty }),
227227
);
228228
}
229229

compiler/rustc_borrowck/src/type_check/free_region_relations.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ impl<'tcx> UniversalRegionRelationsBuilder<'_, 'tcx> {
280280
}
281281
let TypeOpOutput { output: norm_ty, constraints: constraints_normalize, .. } = self
282282
.param_env
283-
.and(type_op::normalize::Normalize::new(ty))
283+
.and(type_op::normalize::Normalize { value: ty })
284284
.fully_perform(self.infcx, span)
285285
.unwrap_or_else(|guar| TypeOpOutput {
286286
output: Ty::new_error(self.infcx.tcx, guar),
@@ -318,7 +318,7 @@ impl<'tcx> UniversalRegionRelationsBuilder<'_, 'tcx> {
318318
for &(ty, _) in tcx.assumed_wf_types(tcx.local_parent(defining_ty_def_id)) {
319319
let result: Result<_, ErrorGuaranteed> = self
320320
.param_env
321-
.and(type_op::normalize::Normalize::new(ty))
321+
.and(type_op::normalize::Normalize { value: ty })
322322
.fully_perform(self.infcx, span);
323323
let Ok(TypeOpOutput { output: norm_ty, constraints: c, .. }) = result else {
324324
continue;

compiler/rustc_middle/src/traits/query.rs

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,16 @@ use crate::infer::canonical::{Canonical, QueryResponse};
1515
use crate::ty::{self, GenericArg, Ty, TyCtxt};
1616

1717
pub mod type_op {
18-
use std::fmt;
19-
2018
use rustc_macros::{HashStable, TypeFoldable, TypeVisitable};
2119

22-
use crate::ty::fold::TypeFoldable;
23-
use crate::ty::{Predicate, Ty, TyCtxt, UserType};
20+
use crate::ty::{Predicate, Ty, UserType};
2421

2522
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, HashStable, TypeFoldable, TypeVisitable)]
2623
pub struct AscribeUserType<'tcx> {
2724
pub mir_ty: Ty<'tcx>,
2825
pub user_ty: UserType<'tcx>,
2926
}
3027

31-
impl<'tcx> AscribeUserType<'tcx> {
32-
pub fn new(mir_ty: Ty<'tcx>, user_ty: UserType<'tcx>) -> Self {
33-
Self { mir_ty, user_ty }
34-
}
35-
}
36-
3728
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, HashStable, TypeFoldable, TypeVisitable)]
3829
pub struct Eq<'tcx> {
3930
pub a: Ty<'tcx>,
@@ -51,26 +42,11 @@ pub mod type_op {
5142
pub predicate: Predicate<'tcx>,
5243
}
5344

54-
impl<'tcx> ProvePredicate<'tcx> {
55-
pub fn new(predicate: Predicate<'tcx>) -> Self {
56-
ProvePredicate { predicate }
57-
}
58-
}
59-
6045
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, HashStable, TypeFoldable, TypeVisitable)]
6146
pub struct Normalize<T> {
6247
pub value: T,
6348
}
6449

65-
impl<'tcx, T> Normalize<T>
66-
where
67-
T: fmt::Debug + TypeFoldable<TyCtxt<'tcx>>,
68-
{
69-
pub fn new(value: T) -> Self {
70-
Self { value }
71-
}
72-
}
73-
7450
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, HashStable, TypeFoldable, TypeVisitable)]
7551
pub struct ImpliedOutlivesBounds<'tcx> {
7652
pub ty: Ty<'tcx>,

0 commit comments

Comments
 (0)