Skip to content

Commit 57ad73a

Browse files
committed
rename query and use NoSolution
1 parent a85b010 commit 57ad73a

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

compiler/rustc_infer/src/infer/combine.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ use rustc_hir::def_id::DefId;
3434
use rustc_middle::infer::canonical::OriginalQueryValues;
3535
use rustc_middle::infer::unify_key::{ConstVarValue, ConstVariableValue};
3636
use rustc_middle::infer::unify_key::{ConstVariableOrigin, ConstVariableOriginKind};
37+
use rustc_middle::traits::query::NoSolution;
3738
use rustc_middle::traits::ObligationCause;
3839
use rustc_middle::ty::error::{ExpectedFound, TypeError};
3940
use rustc_middle::ty::relate::{self, Relate, RelateResult, TypeRelation};
@@ -172,7 +173,8 @@ impl<'tcx> InferCtxt<'tcx> {
172173
(relation.param_env(), a.ty(), b.ty()),
173174
&mut OriginalQueryValues::default(),
174175
);
175-
if let Err(()) = self.tcx.check_const_param_definitely_unequal(canonical) {
176+
177+
if let Err(NoSolution) = self.tcx.check_tys_might_be_eq(canonical) {
176178
self.tcx.sess.delay_span_bug(
177179
DUMMY_SP,
178180
&format!("cannot relate consts of different types (a={:?}, b={:?})", a, b,),

compiler/rustc_middle/src/query/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2172,7 +2172,7 @@ rustc_queries! {
21722172
/// Used in `super_combine_consts` to ICE if the type of the two consts are definitely not going to end up being
21732173
/// equal to eachother. This might return `Ok` even if the types are unequal, but will never return `Err` if
21742174
/// the types might be equal.
2175-
query check_const_param_definitely_unequal(arg: Canonical<'tcx, (ty::ParamEnv<'tcx>, Ty<'tcx>, Ty<'tcx>)>) -> Result<(), ()> {
2175+
query check_tys_might_be_eq(arg: Canonical<'tcx, (ty::ParamEnv<'tcx>, Ty<'tcx>, Ty<'tcx>)>) -> Result<(), NoSolution> {
21762176
desc { "check whether two const param are definitely not equal to eachother"}
21772177
}
21782178
}

compiler/rustc_trait_selection/src/traits/misc.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use rustc_data_structures::fx::FxIndexSet;
66
use rustc_hir as hir;
77
use rustc_infer::infer::canonical::Canonical;
88
use rustc_infer::infer::{RegionResolutionError, TyCtxtInferExt};
9+
use rustc_infer::traits::query::NoSolution;
910
use rustc_infer::{infer::outlives::env::OutlivesEnvironment, traits::FulfillmentError};
1011
use rustc_middle::ty::{self, ParamEnv, Ty, TyCtxt, TypeVisitable};
1112
use rustc_span::DUMMY_SP;
@@ -134,10 +135,10 @@ pub fn type_allowed_to_implement_copy<'tcx>(
134135
Ok(())
135136
}
136137

137-
pub fn check_const_param_definitely_unequal<'tcx>(
138+
pub fn check_tys_might_be_eq<'tcx>(
138139
tcx: TyCtxt<'tcx>,
139140
canonical: Canonical<'tcx, (ParamEnv<'tcx>, Ty<'tcx>, Ty<'tcx>)>,
140-
) -> Result<(), ()> {
141+
) -> Result<(), NoSolution> {
141142
let (infcx, (param_env, ty_a, ty_b), _) =
142143
tcx.infer_ctxt().build_with_canonical(DUMMY_SP, &canonical);
143144
let ocx = ObligationCtxt::new(&infcx);
@@ -147,5 +148,5 @@ pub fn check_const_param_definitely_unequal<'tcx>(
147148
// we don't get errors from obligations being ambiguous.
148149
let errors = ocx.select_where_possible();
149150

150-
if errors.len() > 0 || result.is_err() { Err(()) } else { Ok(()) }
151+
if errors.len() > 0 || result.is_err() { Err(NoSolution) } else { Ok(()) }
151152
}

compiler/rustc_trait_selection/src/traits/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ pub fn provide(providers: &mut ty::query::Providers) {
554554
specialization_graph_of: specialize::specialization_graph_provider,
555555
specializes: specialize::specializes,
556556
subst_and_check_impossible_predicates,
557-
check_const_param_definitely_unequal: misc::check_const_param_definitely_unequal,
557+
check_tys_might_be_eq: misc::check_tys_might_be_eq,
558558
is_impossible_method,
559559
..*providers
560560
};

0 commit comments

Comments
 (0)