Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,6 @@ impl<'tcx> QueryTypeOp<'tcx> for ImpliedOutlivesBounds<'tcx> {
) -> Result<CanonicalQueryResponse<'tcx, Self::QueryResponse>, NoSolution> {
tcx.implied_outlives_bounds((canonicalized, false))
}

fn perform_locally_with_next_solver(
ocx: &ObligationCtxt<'_, 'tcx>,
key: ParamEnvAnd<'tcx, Self>,
_span: Span,
) -> Result<Self::QueryResponse, NoSolution> {
query_compute_implied_outlives_bounds(ocx, key.param_env, key.value.ty, false)
}
}

pub fn compute_implied_outlives_bounds_inner<'tcx>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,6 @@ impl<'tcx> super::QueryTypeOp<'tcx> for AscribeUserType<'tcx> {
) -> Result<CanonicalQueryResponse<'tcx, ()>, NoSolution> {
tcx.type_op_ascribe_user_type(canonicalized)
}

fn perform_locally_with_next_solver(
ocx: &ObligationCtxt<'_, 'tcx>,
key: ParamEnvAnd<'tcx, Self>,
span: Span,
) -> Result<Self::QueryResponse, NoSolution> {
type_op_ascribe_user_type_with_span(ocx, key, span)
}
}

/// The core of the `type_op_ascribe_user_type` query: for diagnostics purposes in NLL HRTB errors,
Expand Down
14 changes: 1 addition & 13 deletions compiler/rustc_trait_selection/src/traits/query/type_op/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crate::infer::canonical::{
QueryRegionConstraints,
};
use crate::infer::{InferCtxt, InferOk};
use crate::traits::{ObligationCause, ObligationCtxt};
use crate::traits::ObligationCause;

pub mod ascribe_user_type;
pub mod custom;
Expand Down Expand Up @@ -83,18 +83,6 @@ pub trait QueryTypeOp<'tcx>: fmt::Debug + Copy + TypeFoldable<TyCtxt<'tcx>> + 't
canonicalized: CanonicalQueryInput<'tcx, ParamEnvAnd<'tcx, Self>>,
) -> Result<CanonicalQueryResponse<'tcx, Self::QueryResponse>, NoSolution>;

/// In the new trait solver, we already do caching in the solver itself,
/// so there's no need to canonicalize and cache via the query system.
/// Additionally, even if we were to canonicalize, we'd still need to
/// make sure to feed it predefined opaque types and the defining anchor
/// and that would require duplicating all of the tcx queries. Instead,
/// just perform these ops locally.
fn perform_locally_with_next_solver(
ocx: &ObligationCtxt<'_, 'tcx>,
key: ParamEnvAnd<'tcx, Self>,
span: Span,
) -> Result<Self::QueryResponse, NoSolution>;

fn fully_perform_into(
query_key: ParamEnvAnd<'tcx, Self>,
infcx: &InferCtxt<'tcx>,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
use std::fmt;

use rustc_middle::traits::ObligationCause;
use rustc_middle::traits::query::NoSolution;
pub use rustc_middle::traits::query::type_op::Normalize;
use rustc_middle::ty::{self, Lift, ParamEnvAnd, Ty, TyCtxt, TypeFoldable, TypeVisitableExt};
use rustc_span::Span;

use crate::infer::canonical::{CanonicalQueryInput, CanonicalQueryResponse};
use crate::traits::ObligationCtxt;

impl<'tcx, T> super::QueryTypeOp<'tcx> for Normalize<'tcx, T>
where
Expand All @@ -29,19 +26,6 @@ where
) -> Result<CanonicalQueryResponse<'tcx, Self::QueryResponse>, NoSolution> {
T::type_op_method(tcx, canonicalized)
}

fn perform_locally_with_next_solver(
ocx: &ObligationCtxt<'_, 'tcx>,
key: ParamEnvAnd<'tcx, Self>,
span: Span,
) -> Result<Self::QueryResponse, NoSolution> {
ocx.deeply_normalize(
&ObligationCause::dummy_with_span(span),
key.param_env,
key.value.value,
)
.map_err(|_| NoSolution)
}
}

pub trait Normalizable<'tcx>:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
use rustc_middle::traits::query::{DropckOutlivesResult, NoSolution};
use rustc_middle::ty::{ParamEnvAnd, TyCtxt};
use rustc_span::Span;

use crate::infer::canonical::{CanonicalQueryInput, CanonicalQueryResponse};
use crate::traits::ObligationCtxt;
use crate::traits::query::dropck_outlives::{
compute_dropck_outlives_inner, trivial_dropck_outlives,
};
use crate::traits::query::dropck_outlives::trivial_dropck_outlives;
use crate::traits::query::type_op::DropckOutlives;

impl<'tcx> super::QueryTypeOp<'tcx> for DropckOutlives<'tcx> {
Expand All @@ -25,12 +21,4 @@ impl<'tcx> super::QueryTypeOp<'tcx> for DropckOutlives<'tcx> {
) -> Result<CanonicalQueryResponse<'tcx, Self::QueryResponse>, NoSolution> {
tcx.dropck_outlives(canonicalized)
}

fn perform_locally_with_next_solver(
ocx: &ObligationCtxt<'_, 'tcx>,
key: ParamEnvAnd<'tcx, Self>,
span: Span,
) -> Result<Self::QueryResponse, NoSolution> {
compute_dropck_outlives_inner(ocx, key.param_env.and(key.value), span)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use rustc_middle::traits::ObligationCause;
use rustc_middle::traits::query::NoSolution;
pub use rustc_middle::traits::query::type_op::ProvePredicate;
use rustc_middle::ty::{self, ParamEnvAnd, TyCtxt};
use rustc_span::Span;

use crate::infer::canonical::{CanonicalQueryInput, CanonicalQueryResponse};
use crate::traits::{ObligationCtxt, sizedness_fast_path};
Expand Down Expand Up @@ -35,20 +34,6 @@ impl<'tcx> super::QueryTypeOp<'tcx> for ProvePredicate<'tcx> {
) -> Result<CanonicalQueryResponse<'tcx, ()>, NoSolution> {
tcx.type_op_prove_predicate(canonicalized)
}

fn perform_locally_with_next_solver(
ocx: &ObligationCtxt<'_, 'tcx>,
key: ParamEnvAnd<'tcx, Self>,
span: Span,
) -> Result<Self::QueryResponse, NoSolution> {
ocx.register_obligation(Obligation::new(
ocx.infcx.tcx,
ObligationCause::dummy_with_span(span),
key.param_env,
key.value.predicate,
));
Ok(())
}
}

/// The core of the `type_op_prove_predicate` query: for diagnostics purposes in NLL HRTB errors,
Expand Down
Loading