Skip to content

Commit 0a35db5

Browse files
Fallible<_> -> Result<_, NoSolution>
1 parent 91525a4 commit 0a35db5

File tree

17 files changed

+55
-53
lines changed

17 files changed

+55
-53
lines changed

compiler/rustc_borrowck/src/type_check/mod.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ use rustc_middle::mir::tcx::PlaceTy;
2727
use rustc_middle::mir::visit::{NonMutatingUseContext, PlaceContext, Visitor};
2828
use rustc_middle::mir::AssertKind;
2929
use rustc_middle::mir::*;
30+
use rustc_middle::traits::query::NoSolution;
3031
use rustc_middle::ty::adjustment::PointerCast;
3132
use rustc_middle::ty::cast::CastTy;
3233
use rustc_middle::ty::subst::{SubstsRef, UserSubsts};
@@ -42,7 +43,7 @@ use rustc_target::abi::{FieldIdx, FIRST_VARIANT};
4243
use rustc_trait_selection::traits::query::type_op::custom::scrape_region_constraints;
4344
use rustc_trait_selection::traits::query::type_op::custom::CustomTypeOp;
4445
use rustc_trait_selection::traits::query::type_op::{TypeOp, TypeOpOutput};
45-
use rustc_trait_selection::traits::query::Fallible;
46+
4647
use rustc_trait_selection::traits::PredicateObligation;
4748

4849
use rustc_mir_dataflow::impls::MaybeInitializedPlaces;
@@ -1133,7 +1134,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
11331134
sup: Ty<'tcx>,
11341135
locations: Locations,
11351136
category: ConstraintCategory<'tcx>,
1136-
) -> Fallible<()> {
1137+
) -> Result<(), NoSolution> {
11371138
// Use this order of parameters because the sup type is usually the
11381139
// "expected" type in diagnostics.
11391140
self.relate_types(sup, ty::Variance::Contravariant, sub, locations, category)
@@ -1146,7 +1147,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
11461147
found: Ty<'tcx>,
11471148
locations: Locations,
11481149
category: ConstraintCategory<'tcx>,
1149-
) -> Fallible<()> {
1150+
) -> Result<(), NoSolution> {
11501151
self.relate_types(expected, ty::Variance::Invariant, found, locations, category)
11511152
}
11521153

@@ -1158,7 +1159,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
11581159
user_ty: &UserTypeProjection,
11591160
locations: Locations,
11601161
category: ConstraintCategory<'tcx>,
1161-
) -> Fallible<()> {
1162+
) -> Result<(), NoSolution> {
11621163
let annotated_type = self.user_type_annotations[user_ty.base].inferred_ty;
11631164
trace!(?annotated_type);
11641165
let mut curr_projected_ty = PlaceTy::from_ty(annotated_type);

compiler/rustc_borrowck/src/type_check/relate_tys.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ use rustc_infer::infer::nll_relate::{TypeRelating, TypeRelatingDelegate};
33
use rustc_infer::infer::NllRegionVariableOrigin;
44
use rustc_infer::traits::PredicateObligations;
55
use rustc_middle::mir::ConstraintCategory;
6+
use rustc_middle::traits::query::NoSolution;
67
use rustc_middle::ty::relate::TypeRelation;
78
use rustc_middle::ty::{self, Ty};
89
use rustc_span::symbol::sym;
910
use rustc_span::{Span, Symbol};
10-
use rustc_trait_selection::traits::query::Fallible;
1111

1212
use crate::constraints::OutlivesConstraint;
1313
use crate::diagnostics::UniverseInfo;
@@ -31,7 +31,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
3131
b: Ty<'tcx>,
3232
locations: Locations,
3333
category: ConstraintCategory<'tcx>,
34-
) -> Fallible<()> {
34+
) -> Result<(), NoSolution> {
3535
TypeRelating::new(
3636
self.infcx,
3737
NllTypeRelatingDelegate::new(self, locations, category, UniverseInfo::relate(a, b)),
@@ -48,7 +48,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
4848
b: ty::SubstsRef<'tcx>,
4949
locations: Locations,
5050
category: ConstraintCategory<'tcx>,
51-
) -> Fallible<()> {
51+
) -> Result<(), NoSolution> {
5252
TypeRelating::new(
5353
self.infcx,
5454
NllTypeRelatingDelegate::new(self, locations, category, UniverseInfo::other()),

compiler/rustc_infer/src/infer/canonical/query_response.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use crate::infer::canonical::{
1515
use crate::infer::nll_relate::{TypeRelating, TypeRelatingDelegate};
1616
use crate::infer::region_constraints::{Constraint, RegionConstraintData};
1717
use crate::infer::{DefineOpaqueTypes, InferCtxt, InferOk, InferResult, NllRegionVariableOrigin};
18-
use crate::traits::query::{Fallible, NoSolution};
18+
use crate::traits::query::NoSolution;
1919
use crate::traits::{Obligation, ObligationCause, PredicateObligation};
2020
use crate::traits::{PredicateObligations, TraitEngine, TraitEngineExt};
2121
use rustc_data_structures::captures::Captures;
@@ -57,7 +57,7 @@ impl<'tcx> InferCtxt<'tcx> {
5757
inference_vars: CanonicalVarValues<'tcx>,
5858
answer: T,
5959
fulfill_cx: &mut dyn TraitEngine<'tcx>,
60-
) -> Fallible<CanonicalQueryResponse<'tcx, T>>
60+
) -> Result<CanonicalQueryResponse<'tcx, T>, NoSolution>
6161
where
6262
T: Debug + TypeFoldable<TyCtxt<'tcx>>,
6363
Canonical<'tcx, QueryResponse<'tcx, T>>: ArenaAllocatable<'tcx>,

compiler/rustc_middle/src/traits/query.rs

-2
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,6 @@ pub type CanonicalTypeOpNormalizeGoal<'tcx, T> =
9595
#[derive(Copy, Clone, Debug, HashStable, PartialEq, Eq)]
9696
pub struct NoSolution;
9797

98-
pub type Fallible<T> = Result<T, NoSolution>;
99-
10098
impl<'tcx> From<TypeError<'tcx>> for NoSolution {
10199
fn from(_: TypeError<'tcx>) -> NoSolution {
102100
NoSolution

compiler/rustc_trait_selection/src/infer.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use rustc_hir::def_id::DefId;
55
use rustc_hir::lang_items::LangItem;
66
use rustc_middle::arena::ArenaAllocatable;
77
use rustc_middle::infer::canonical::{Canonical, CanonicalQueryResponse, QueryResponse};
8-
use rustc_middle::traits::query::Fallible;
8+
use rustc_middle::traits::query::NoSolution;
99
use rustc_middle::ty::{self, Ty, TyCtxt, TypeFoldable, TypeVisitableExt};
1010
use rustc_middle::ty::{GenericArg, ToPredicate};
1111
use rustc_span::DUMMY_SP;
@@ -82,8 +82,8 @@ pub trait InferCtxtBuilderExt<'tcx> {
8282
fn enter_canonical_trait_query<K, R>(
8383
&mut self,
8484
canonical_key: &Canonical<'tcx, K>,
85-
operation: impl FnOnce(&ObligationCtxt<'_, 'tcx>, K) -> Fallible<R>,
86-
) -> Fallible<CanonicalQueryResponse<'tcx, R>>
85+
operation: impl FnOnce(&ObligationCtxt<'_, 'tcx>, K) -> Result<R, NoSolution>,
86+
) -> Result<CanonicalQueryResponse<'tcx, R>, NoSolution>
8787
where
8888
K: TypeFoldable<TyCtxt<'tcx>>,
8989
R: Debug + TypeFoldable<TyCtxt<'tcx>>,
@@ -110,8 +110,8 @@ impl<'tcx> InferCtxtBuilderExt<'tcx> for InferCtxtBuilder<'tcx> {
110110
fn enter_canonical_trait_query<K, R>(
111111
&mut self,
112112
canonical_key: &Canonical<'tcx, K>,
113-
operation: impl FnOnce(&ObligationCtxt<'_, 'tcx>, K) -> Fallible<R>,
114-
) -> Fallible<CanonicalQueryResponse<'tcx, R>>
113+
operation: impl FnOnce(&ObligationCtxt<'_, 'tcx>, K) -> Result<R, NoSolution>,
114+
) -> Result<CanonicalQueryResponse<'tcx, R>, NoSolution>
115115
where
116116
K: TypeFoldable<TyCtxt<'tcx>>,
117117
R: Debug + TypeFoldable<TyCtxt<'tcx>>,

compiler/rustc_trait_selection/src/traits/engine.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ use rustc_infer::infer::canonical::{
1414
};
1515
use rustc_infer::infer::outlives::env::OutlivesEnvironment;
1616
use rustc_infer::infer::{DefineOpaqueTypes, InferCtxt, InferOk};
17-
use rustc_infer::traits::query::Fallible;
1817
use rustc_infer::traits::{
1918
FulfillmentError, Obligation, ObligationCause, PredicateObligation, TraitEngineExt as _,
2019
};
2120
use rustc_middle::arena::ArenaAllocatable;
21+
use rustc_middle::traits::query::NoSolution;
2222
use rustc_middle::ty::error::TypeError;
2323
use rustc_middle::ty::ToPredicate;
2424
use rustc_middle::ty::TypeFoldable;
@@ -235,7 +235,7 @@ impl<'a, 'tcx> ObligationCtxt<'a, 'tcx> {
235235
&self,
236236
inference_vars: CanonicalVarValues<'tcx>,
237237
answer: T,
238-
) -> Fallible<CanonicalQueryResponse<'tcx, T>>
238+
) -> Result<CanonicalQueryResponse<'tcx, T>, NoSolution>
239239
where
240240
T: Debug + TypeFoldable<TyCtxt<'tcx>>,
241241
Canonical<'tcx, QueryResponse<'tcx, T>>: ArenaAllocatable<'tcx>,

compiler/rustc_trait_selection/src/traits/query/type_op/ascribe_user_type.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::infer::canonical::{Canonical, CanonicalQueryResponse};
2-
use crate::traits::query::Fallible;
2+
use rustc_middle::traits::query::NoSolution;
33
use rustc_middle::ty::{ParamEnvAnd, TyCtxt};
44

55
pub use rustc_middle::traits::query::type_op::AscribeUserType;
@@ -17,7 +17,7 @@ impl<'tcx> super::QueryTypeOp<'tcx> for AscribeUserType<'tcx> {
1717
fn perform_query(
1818
tcx: TyCtxt<'tcx>,
1919
canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, Self>>,
20-
) -> Fallible<CanonicalQueryResponse<'tcx, ()>> {
20+
) -> Result<CanonicalQueryResponse<'tcx, ()>, NoSolution> {
2121
tcx.type_op_ascribe_user_type(canonicalized)
2222
}
2323
}

compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
use crate::infer::canonical::query_response;
22
use crate::infer::InferCtxt;
33
use crate::traits::query::type_op::TypeOpOutput;
4-
use crate::traits::query::Fallible;
54
use crate::traits::ObligationCtxt;
65
use rustc_errors::ErrorGuaranteed;
76
use rustc_infer::infer::region_constraints::RegionConstraintData;
7+
use rustc_middle::traits::query::NoSolution;
88
use rustc_span::source_map::DUMMY_SP;
99
use rustc_span::Span;
1010

@@ -18,15 +18,15 @@ pub struct CustomTypeOp<F> {
1818
impl<F> CustomTypeOp<F> {
1919
pub fn new<'tcx, R>(closure: F, description: &'static str) -> Self
2020
where
21-
F: FnOnce(&ObligationCtxt<'_, 'tcx>) -> Fallible<R>,
21+
F: FnOnce(&ObligationCtxt<'_, 'tcx>) -> Result<R, NoSolution>,
2222
{
2323
CustomTypeOp { closure, description }
2424
}
2525
}
2626

2727
impl<'tcx, F, R: fmt::Debug> super::TypeOp<'tcx> for CustomTypeOp<F>
2828
where
29-
F: FnOnce(&ObligationCtxt<'_, 'tcx>) -> Fallible<R>,
29+
F: FnOnce(&ObligationCtxt<'_, 'tcx>) -> Result<R, NoSolution>,
3030
{
3131
type Output = R;
3232
/// We can't do any custom error reporting for `CustomTypeOp`, so
@@ -59,7 +59,7 @@ impl<F> fmt::Debug for CustomTypeOp<F> {
5959
/// constraints that result, creating query-region-constraints.
6060
pub fn scrape_region_constraints<'tcx, Op: super::TypeOp<'tcx, Output = R>, R>(
6161
infcx: &InferCtxt<'tcx>,
62-
op: impl FnOnce(&ObligationCtxt<'_, 'tcx>) -> Fallible<R>,
62+
op: impl FnOnce(&ObligationCtxt<'_, 'tcx>) -> Result<R, NoSolution>,
6363
name: &'static str,
6464
span: Span,
6565
) -> Result<(TypeOpOutput<'tcx, Op>, RegionConstraintData<'tcx>), ErrorGuaranteed> {

compiler/rustc_trait_selection/src/traits/query/type_op/eq.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::infer::canonical::{Canonical, CanonicalQueryResponse};
2-
use crate::traits::query::Fallible;
2+
use rustc_middle::traits::query::NoSolution;
33
use rustc_middle::ty::{ParamEnvAnd, TyCtxt};
44

55
pub use rustc_middle::traits::query::type_op::Eq;
@@ -17,7 +17,7 @@ impl<'tcx> super::QueryTypeOp<'tcx> for Eq<'tcx> {
1717
fn perform_query(
1818
tcx: TyCtxt<'tcx>,
1919
canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, Self>>,
20-
) -> Fallible<CanonicalQueryResponse<'tcx, ()>> {
20+
) -> Result<CanonicalQueryResponse<'tcx, ()>, NoSolution> {
2121
tcx.type_op_eq(canonicalized)
2222
}
2323
}

compiler/rustc_trait_selection/src/traits/query/type_op/implied_outlives_bounds.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::infer::canonical::{Canonical, CanonicalQueryResponse};
2-
use crate::traits::query::Fallible;
32
use rustc_infer::traits::query::OutlivesBound;
3+
use rustc_middle::traits::query::NoSolution;
44
use rustc_middle::ty::{self, ParamEnvAnd, Ty, TyCtxt};
55

66
#[derive(Copy, Clone, Debug, HashStable, TypeFoldable, TypeVisitable, Lift)]
@@ -28,7 +28,7 @@ impl<'tcx> super::QueryTypeOp<'tcx> for ImpliedOutlivesBounds<'tcx> {
2828
fn perform_query(
2929
tcx: TyCtxt<'tcx>,
3030
canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, Self>>,
31-
) -> Fallible<CanonicalQueryResponse<'tcx, Self::QueryResponse>> {
31+
) -> Result<CanonicalQueryResponse<'tcx, Self::QueryResponse>, NoSolution> {
3232
// FIXME this `unchecked_map` is only necessary because the
3333
// query is defined as taking a `ParamEnvAnd<Ty>`; it should
3434
// take an `ImpliedOutlivesBounds` instead

compiler/rustc_trait_selection/src/traits/query/type_op/mod.rs

+11-8
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ use crate::infer::canonical::{
22
Canonical, CanonicalQueryResponse, OriginalQueryValues, QueryRegionConstraints,
33
};
44
use crate::infer::{InferCtxt, InferOk};
5-
use crate::traits::query::Fallible;
65
use crate::traits::ObligationCause;
76
use rustc_errors::ErrorGuaranteed;
87
use rustc_infer::infer::canonical::Certainty;
98
use rustc_infer::traits::PredicateObligations;
9+
use rustc_middle::traits::query::NoSolution;
1010
use rustc_middle::ty::fold::TypeFoldable;
1111
use rustc_middle::ty::{ParamEnvAnd, TyCtxt};
1212
use rustc_span::Span;
@@ -79,18 +79,21 @@ pub trait QueryTypeOp<'tcx>: fmt::Debug + Copy + TypeFoldable<TyCtxt<'tcx>> + 't
7979
fn perform_query(
8080
tcx: TyCtxt<'tcx>,
8181
canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, Self>>,
82-
) -> Fallible<CanonicalQueryResponse<'tcx, Self::QueryResponse>>;
82+
) -> Result<CanonicalQueryResponse<'tcx, Self::QueryResponse>, NoSolution>;
8383

8484
fn fully_perform_into(
8585
query_key: ParamEnvAnd<'tcx, Self>,
8686
infcx: &InferCtxt<'tcx>,
8787
output_query_region_constraints: &mut QueryRegionConstraints<'tcx>,
88-
) -> Fallible<(
89-
Self::QueryResponse,
90-
Option<Canonical<'tcx, ParamEnvAnd<'tcx, Self>>>,
91-
PredicateObligations<'tcx>,
92-
Certainty,
93-
)> {
88+
) -> Result<
89+
(
90+
Self::QueryResponse,
91+
Option<Canonical<'tcx, ParamEnvAnd<'tcx, Self>>>,
92+
PredicateObligations<'tcx>,
93+
Certainty,
94+
),
95+
NoSolution,
96+
> {
9497
if let Some(result) = QueryTypeOp::try_fast_path(infcx.tcx, &query_key) {
9598
return Ok((result, None, vec![], Certainty::Proven));
9699
}

compiler/rustc_trait_selection/src/traits/query/type_op/normalize.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::infer::canonical::{Canonical, CanonicalQueryResponse};
2-
use crate::traits::query::Fallible;
2+
use rustc_middle::traits::query::NoSolution;
33
use rustc_middle::ty::fold::TypeFoldable;
44
use rustc_middle::ty::{self, Lift, ParamEnvAnd, Ty, TyCtxt, TypeVisitableExt};
55
use std::fmt;
@@ -19,7 +19,7 @@ where
1919
fn perform_query(
2020
tcx: TyCtxt<'tcx>,
2121
canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, Self>>,
22-
) -> Fallible<CanonicalQueryResponse<'tcx, Self::QueryResponse>> {
22+
) -> Result<CanonicalQueryResponse<'tcx, Self::QueryResponse>, NoSolution> {
2323
T::type_op_method(tcx, canonicalized)
2424
}
2525
}
@@ -28,14 +28,14 @@ pub trait Normalizable<'tcx>: fmt::Debug + TypeFoldable<TyCtxt<'tcx>> + Lift<'tc
2828
fn type_op_method(
2929
tcx: TyCtxt<'tcx>,
3030
canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, Normalize<Self>>>,
31-
) -> Fallible<CanonicalQueryResponse<'tcx, Self>>;
31+
) -> Result<CanonicalQueryResponse<'tcx, Self>, NoSolution>;
3232
}
3333

3434
impl<'tcx> Normalizable<'tcx> for Ty<'tcx> {
3535
fn type_op_method(
3636
tcx: TyCtxt<'tcx>,
3737
canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, Normalize<Self>>>,
38-
) -> Fallible<CanonicalQueryResponse<'tcx, Self>> {
38+
) -> Result<CanonicalQueryResponse<'tcx, Self>, NoSolution> {
3939
tcx.type_op_normalize_ty(canonicalized)
4040
}
4141
}
@@ -44,7 +44,7 @@ impl<'tcx> Normalizable<'tcx> for ty::Predicate<'tcx> {
4444
fn type_op_method(
4545
tcx: TyCtxt<'tcx>,
4646
canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, Normalize<Self>>>,
47-
) -> Fallible<CanonicalQueryResponse<'tcx, Self>> {
47+
) -> Result<CanonicalQueryResponse<'tcx, Self>, NoSolution> {
4848
tcx.type_op_normalize_predicate(canonicalized)
4949
}
5050
}
@@ -53,7 +53,7 @@ impl<'tcx> Normalizable<'tcx> for ty::PolyFnSig<'tcx> {
5353
fn type_op_method(
5454
tcx: TyCtxt<'tcx>,
5555
canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, Normalize<Self>>>,
56-
) -> Fallible<CanonicalQueryResponse<'tcx, Self>> {
56+
) -> Result<CanonicalQueryResponse<'tcx, Self>, NoSolution> {
5757
tcx.type_op_normalize_poly_fn_sig(canonicalized)
5858
}
5959
}
@@ -62,7 +62,7 @@ impl<'tcx> Normalizable<'tcx> for ty::FnSig<'tcx> {
6262
fn type_op_method(
6363
tcx: TyCtxt<'tcx>,
6464
canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, Normalize<Self>>>,
65-
) -> Fallible<CanonicalQueryResponse<'tcx, Self>> {
65+
) -> Result<CanonicalQueryResponse<'tcx, Self>, NoSolution> {
6666
tcx.type_op_normalize_fn_sig(canonicalized)
6767
}
6868
}

compiler/rustc_trait_selection/src/traits/query/type_op/outlives.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::infer::canonical::{Canonical, CanonicalQueryResponse};
22
use crate::traits::query::dropck_outlives::{trivial_dropck_outlives, DropckOutlivesResult};
3-
use crate::traits::query::Fallible;
3+
use rustc_middle::traits::query::NoSolution;
44
use rustc_middle::ty::{ParamEnvAnd, Ty, TyCtxt};
55

66
#[derive(Copy, Clone, Debug, HashStable, TypeFoldable, TypeVisitable, Lift)]
@@ -27,7 +27,7 @@ impl<'tcx> super::QueryTypeOp<'tcx> for DropckOutlives<'tcx> {
2727
fn perform_query(
2828
tcx: TyCtxt<'tcx>,
2929
canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, Self>>,
30-
) -> Fallible<CanonicalQueryResponse<'tcx, Self::QueryResponse>> {
30+
) -> Result<CanonicalQueryResponse<'tcx, Self::QueryResponse>, NoSolution> {
3131
// Subtle: note that we are not invoking
3232
// `infcx.at(...).dropck_outlives(...)` here, but rather the
3333
// underlying `dropck_outlives` query. This same underlying

compiler/rustc_trait_selection/src/traits/query/type_op/prove_predicate.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::infer::canonical::{Canonical, CanonicalQueryResponse};
2-
use crate::traits::query::Fallible;
2+
use rustc_middle::traits::query::NoSolution;
33
use rustc_middle::ty::{self, ParamEnvAnd, TyCtxt};
44

55
pub use rustc_middle::traits::query::type_op::ProvePredicate;
@@ -33,7 +33,7 @@ impl<'tcx> super::QueryTypeOp<'tcx> for ProvePredicate<'tcx> {
3333
fn perform_query(
3434
tcx: TyCtxt<'tcx>,
3535
canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, Self>>,
36-
) -> Fallible<CanonicalQueryResponse<'tcx, ()>> {
36+
) -> Result<CanonicalQueryResponse<'tcx, ()>, NoSolution> {
3737
tcx.type_op_prove_predicate(canonicalized)
3838
}
3939
}

compiler/rustc_trait_selection/src/traits/query/type_op/subtype.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::infer::canonical::{Canonical, CanonicalQueryResponse};
2-
use crate::traits::query::Fallible;
2+
use rustc_middle::traits::query::NoSolution;
33
use rustc_middle::ty::{ParamEnvAnd, TyCtxt};
44

55
pub use rustc_middle::traits::query::type_op::Subtype;
@@ -14,7 +14,7 @@ impl<'tcx> super::QueryTypeOp<'tcx> for Subtype<'tcx> {
1414
fn perform_query(
1515
tcx: TyCtxt<'tcx>,
1616
canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, Self>>,
17-
) -> Fallible<CanonicalQueryResponse<'tcx, ()>> {
17+
) -> Result<CanonicalQueryResponse<'tcx, ()>, NoSolution> {
1818
tcx.type_op_subtype(canonicalized)
1919
}
2020
}

0 commit comments

Comments
 (0)