]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc/traits/fulfill.rs
Revert previous attempt at detecting unsatisfiable predicates
[rust.git] / src / librustc / traits / fulfill.rs
index 9e5abc80822c7cf5d5653355bfc25acc4e7b289f..46ece6fc4059364039f0d72d885d6411476a39b3 100644 (file)
@@ -16,7 +16,6 @@
 use super::{ConstEvalFailure, Unimplemented};
 use super::{FulfillmentError, FulfillmentErrorCode};
 use super::{ObligationCause, PredicateObligation};
-use crate::traits::TraitQueryMode;
 
 impl<'tcx> ForestObligation for PendingPredicateObligation<'tcx> {
     type Predicate = ty::Predicate<'tcx>;
@@ -63,9 +62,6 @@ pub struct FulfillmentContext<'tcx> {
     // a snapshot (they don't *straddle* a snapshot, so there
     // is no trouble there).
     usable_in_snapshot: bool,
-
-    // The `TraitQueryMode` used when constructing a `SelectionContext`
-    query_mode: TraitQueryMode,
 }
 
 #[derive(Clone, Debug)]
@@ -79,26 +75,12 @@ pub struct PendingPredicateObligation<'tcx> {
 static_assert_size!(PendingPredicateObligation<'_>, 136);
 
 impl<'a, 'tcx> FulfillmentContext<'tcx> {
-    /// Creates a new fulfillment context with `TraitQueryMode::Standard`
-    /// You almost always want to use this instead of `with_query_mode`
+    /// Creates a new fulfillment context.
     pub fn new() -> FulfillmentContext<'tcx> {
         FulfillmentContext {
             predicates: ObligationForest::new(),
             register_region_obligations: true,
             usable_in_snapshot: false,
-            query_mode: TraitQueryMode::Standard,
-        }
-    }
-
-    /// Creates a new fulfillment context with the specified query mode.
-    /// This should only be used when you want to ignore overflow,
-    /// rather than reporting it as an error.
-    pub fn with_query_mode(query_mode: TraitQueryMode) -> FulfillmentContext<'tcx> {
-        FulfillmentContext {
-            predicates: ObligationForest::new(),
-            register_region_obligations: true,
-            usable_in_snapshot: false,
-            query_mode,
         }
     }
 
@@ -107,7 +89,6 @@ pub fn new_in_snapshot() -> FulfillmentContext<'tcx> {
             predicates: ObligationForest::new(),
             register_region_obligations: true,
             usable_in_snapshot: true,
-            query_mode: TraitQueryMode::Standard,
         }
     }
 
@@ -116,7 +97,6 @@ pub fn new_ignoring_regions() -> FulfillmentContext<'tcx> {
             predicates: ObligationForest::new(),
             register_region_obligations: false,
             usable_in_snapshot: false,
-            query_mode: TraitQueryMode::Standard,
         }
     }
 
@@ -237,7 +217,7 @@ fn select_where_possible(
         &mut self,
         infcx: &InferCtxt<'_, 'tcx>,
     ) -> Result<(), Vec<FulfillmentError<'tcx>>> {
-        let mut selcx = SelectionContext::with_query_mode(infcx, self.query_mode);
+        let mut selcx = SelectionContext::new(infcx);
         self.select(&mut selcx)
     }