about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBoxy <supbscripter@gmail.com>2023-02-12 19:32:07 +0000
committerBoxy <supbscripter@gmail.com>2023-02-12 19:32:07 +0000
commit57ad73aa27dcfc1341e62738b3b79690a51beccd (patch)
tree00180c3218add053a74477f459aec025ac562366
parenta85b0101e6a1d7d2a7a51d0e5472c1a1215b3031 (diff)
downloadrust-57ad73aa27dcfc1341e62738b3b79690a51beccd.tar.gz
rust-57ad73aa27dcfc1341e62738b3b79690a51beccd.zip
rename query and use `NoSolution`
-rw-r--r--compiler/rustc_infer/src/infer/combine.rs4
-rw-r--r--compiler/rustc_middle/src/query/mod.rs2
-rw-r--r--compiler/rustc_trait_selection/src/traits/misc.rs7
-rw-r--r--compiler/rustc_trait_selection/src/traits/mod.rs2
4 files changed, 9 insertions, 6 deletions
diff --git a/compiler/rustc_infer/src/infer/combine.rs b/compiler/rustc_infer/src/infer/combine.rs
index 76834c3b368..49567c341d4 100644
--- a/compiler/rustc_infer/src/infer/combine.rs
+++ b/compiler/rustc_infer/src/infer/combine.rs
@@ -34,6 +34,7 @@ use rustc_hir::def_id::DefId;
 use rustc_middle::infer::canonical::OriginalQueryValues;
 use rustc_middle::infer::unify_key::{ConstVarValue, ConstVariableValue};
 use rustc_middle::infer::unify_key::{ConstVariableOrigin, ConstVariableOriginKind};
+use rustc_middle::traits::query::NoSolution;
 use rustc_middle::traits::ObligationCause;
 use rustc_middle::ty::error::{ExpectedFound, TypeError};
 use rustc_middle::ty::relate::{self, Relate, RelateResult, TypeRelation};
@@ -172,7 +173,8 @@ impl<'tcx> InferCtxt<'tcx> {
                 (relation.param_env(), a.ty(), b.ty()),
                 &mut OriginalQueryValues::default(),
             );
-            if let Err(()) = self.tcx.check_const_param_definitely_unequal(canonical) {
+
+            if let Err(NoSolution) = self.tcx.check_tys_might_be_eq(canonical) {
                 self.tcx.sess.delay_span_bug(
                     DUMMY_SP,
                     &format!("cannot relate consts of different types (a={:?}, b={:?})", a, b,),
diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs
index d8f7614c56f..b0660c3d62b 100644
--- a/compiler/rustc_middle/src/query/mod.rs
+++ b/compiler/rustc_middle/src/query/mod.rs
@@ -2172,7 +2172,7 @@ rustc_queries! {
     /// Used in `super_combine_consts` to ICE if the type of the two consts are definitely not going to end up being
     /// equal to eachother. This might return `Ok` even if the types are unequal, but will never return `Err` if
     /// the types might be equal.
-    query check_const_param_definitely_unequal(arg: Canonical<'tcx, (ty::ParamEnv<'tcx>, Ty<'tcx>, Ty<'tcx>)>) -> Result<(), ()> {
+    query check_tys_might_be_eq(arg: Canonical<'tcx, (ty::ParamEnv<'tcx>, Ty<'tcx>, Ty<'tcx>)>) -> Result<(), NoSolution> {
         desc { "check whether two const param are definitely not equal to eachother"}
     }
 }
diff --git a/compiler/rustc_trait_selection/src/traits/misc.rs b/compiler/rustc_trait_selection/src/traits/misc.rs
index 39654258dcd..de730773794 100644
--- a/compiler/rustc_trait_selection/src/traits/misc.rs
+++ b/compiler/rustc_trait_selection/src/traits/misc.rs
@@ -6,6 +6,7 @@ use rustc_data_structures::fx::FxIndexSet;
 use rustc_hir as hir;
 use rustc_infer::infer::canonical::Canonical;
 use rustc_infer::infer::{RegionResolutionError, TyCtxtInferExt};
+use rustc_infer::traits::query::NoSolution;
 use rustc_infer::{infer::outlives::env::OutlivesEnvironment, traits::FulfillmentError};
 use rustc_middle::ty::{self, ParamEnv, Ty, TyCtxt, TypeVisitable};
 use rustc_span::DUMMY_SP;
@@ -134,10 +135,10 @@ pub fn type_allowed_to_implement_copy<'tcx>(
     Ok(())
 }
 
-pub fn check_const_param_definitely_unequal<'tcx>(
+pub fn check_tys_might_be_eq<'tcx>(
     tcx: TyCtxt<'tcx>,
     canonical: Canonical<'tcx, (ParamEnv<'tcx>, Ty<'tcx>, Ty<'tcx>)>,
-) -> Result<(), ()> {
+) -> Result<(), NoSolution> {
     let (infcx, (param_env, ty_a, ty_b), _) =
         tcx.infer_ctxt().build_with_canonical(DUMMY_SP, &canonical);
     let ocx = ObligationCtxt::new(&infcx);
@@ -147,5 +148,5 @@ pub fn check_const_param_definitely_unequal<'tcx>(
     // we don't get errors from obligations being ambiguous.
     let errors = ocx.select_where_possible();
 
-    if errors.len() > 0 || result.is_err() { Err(()) } else { Ok(()) }
+    if errors.len() > 0 || result.is_err() { Err(NoSolution) } else { Ok(()) }
 }
diff --git a/compiler/rustc_trait_selection/src/traits/mod.rs b/compiler/rustc_trait_selection/src/traits/mod.rs
index f34d55531e7..227119ac7ac 100644
--- a/compiler/rustc_trait_selection/src/traits/mod.rs
+++ b/compiler/rustc_trait_selection/src/traits/mod.rs
@@ -554,7 +554,7 @@ pub fn provide(providers: &mut ty::query::Providers) {
         specialization_graph_of: specialize::specialization_graph_provider,
         specializes: specialize::specializes,
         subst_and_check_impossible_predicates,
-        check_const_param_definitely_unequal: misc::check_const_param_definitely_unequal,
+        check_tys_might_be_eq: misc::check_tys_might_be_eq,
         is_impossible_method,
         ..*providers
     };