move structural_traits
into assembly
This commit is contained in:
parent
2b0f5721c1
commit
2186847f28
@ -1,8 +1,6 @@
|
|||||||
//! Code shared by trait and projection goals for candidate assembly.
|
//! Code shared by trait and projection goals for candidate assembly.
|
||||||
|
|
||||||
use super::search_graph::OverflowHandler;
|
use super::search_graph::OverflowHandler;
|
||||||
#[cfg(doc)]
|
|
||||||
use super::trait_goals::structural_traits::*;
|
|
||||||
use super::{EvalCtxt, SolverMode};
|
use super::{EvalCtxt, SolverMode};
|
||||||
use crate::solve::CanonicalResponseExt;
|
use crate::solve::CanonicalResponseExt;
|
||||||
use crate::traits::coherence;
|
use crate::traits::coherence;
|
||||||
@ -16,6 +14,8 @@ use rustc_middle::ty::TypeFoldable;
|
|||||||
use rustc_middle::ty::{self, Ty, TyCtxt};
|
use rustc_middle::ty::{self, Ty, TyCtxt};
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
|
|
||||||
|
pub(super) mod structural_traits;
|
||||||
|
|
||||||
/// A candidate is a possible way to prove a goal.
|
/// A candidate is a possible way to prove a goal.
|
||||||
///
|
///
|
||||||
/// It consists of both the `source`, which describes how that goal would be proven,
|
/// It consists of both the `source`, which describes how that goal would be proven,
|
@ -11,7 +11,7 @@ use crate::solve::EvalCtxt;
|
|||||||
//
|
//
|
||||||
// For types with an "existential" binder, i.e. generator witnesses, we also
|
// For types with an "existential" binder, i.e. generator witnesses, we also
|
||||||
// instantiate the binder with placeholders eagerly.
|
// instantiate the binder with placeholders eagerly.
|
||||||
pub(super) fn instantiate_constituent_tys_for_auto_trait<'tcx>(
|
pub(crate) fn instantiate_constituent_tys_for_auto_trait<'tcx>(
|
||||||
ecx: &EvalCtxt<'_, 'tcx>,
|
ecx: &EvalCtxt<'_, 'tcx>,
|
||||||
ty: Ty<'tcx>,
|
ty: Ty<'tcx>,
|
||||||
) -> Result<Vec<Ty<'tcx>>, NoSolution> {
|
) -> Result<Vec<Ty<'tcx>>, NoSolution> {
|
||||||
@ -87,7 +87,7 @@ pub(super) fn instantiate_constituent_tys_for_auto_trait<'tcx>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn replace_erased_lifetimes_with_bound_vars<'tcx>(
|
pub(crate) fn replace_erased_lifetimes_with_bound_vars<'tcx>(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
ty: Ty<'tcx>,
|
ty: Ty<'tcx>,
|
||||||
) -> ty::Binder<'tcx, Ty<'tcx>> {
|
) -> ty::Binder<'tcx, Ty<'tcx>> {
|
||||||
@ -108,7 +108,7 @@ fn replace_erased_lifetimes_with_bound_vars<'tcx>(
|
|||||||
ty::Binder::bind_with_vars(ty, bound_vars)
|
ty::Binder::bind_with_vars(ty, bound_vars)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn instantiate_constituent_tys_for_sized_trait<'tcx>(
|
pub(crate) fn instantiate_constituent_tys_for_sized_trait<'tcx>(
|
||||||
ecx: &EvalCtxt<'_, 'tcx>,
|
ecx: &EvalCtxt<'_, 'tcx>,
|
||||||
ty: Ty<'tcx>,
|
ty: Ty<'tcx>,
|
||||||
) -> Result<Vec<Ty<'tcx>>, NoSolution> {
|
) -> Result<Vec<Ty<'tcx>>, NoSolution> {
|
||||||
@ -158,7 +158,7 @@ pub(super) fn instantiate_constituent_tys_for_sized_trait<'tcx>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn instantiate_constituent_tys_for_copy_clone_trait<'tcx>(
|
pub(crate) fn instantiate_constituent_tys_for_copy_clone_trait<'tcx>(
|
||||||
ecx: &EvalCtxt<'_, 'tcx>,
|
ecx: &EvalCtxt<'_, 'tcx>,
|
||||||
ty: Ty<'tcx>,
|
ty: Ty<'tcx>,
|
||||||
) -> Result<Vec<Ty<'tcx>>, NoSolution> {
|
) -> Result<Vec<Ty<'tcx>>, NoSolution> {
|
@ -1,7 +1,6 @@
|
|||||||
use crate::traits::specialization_graph;
|
use crate::traits::specialization_graph;
|
||||||
|
|
||||||
use super::assembly;
|
use super::assembly::{self, structural_traits};
|
||||||
use super::trait_goals::structural_traits;
|
|
||||||
use super::EvalCtxt;
|
use super::EvalCtxt;
|
||||||
use rustc_errors::ErrorGuaranteed;
|
use rustc_errors::ErrorGuaranteed;
|
||||||
use rustc_hir::def::DefKind;
|
use rustc_hir::def::DefKind;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
//! Dealing with trait goals, i.e. `T: Trait<'a, U>`.
|
//! Dealing with trait goals, i.e. `T: Trait<'a, U>`.
|
||||||
|
|
||||||
use super::{assembly, EvalCtxt, SolverMode};
|
use super::assembly::{self, structural_traits};
|
||||||
|
use super::{EvalCtxt, SolverMode};
|
||||||
use rustc_hir::def_id::DefId;
|
use rustc_hir::def_id::DefId;
|
||||||
use rustc_hir::LangItem;
|
use rustc_hir::LangItem;
|
||||||
use rustc_infer::traits::query::NoSolution;
|
use rustc_infer::traits::query::NoSolution;
|
||||||
@ -11,8 +12,6 @@ use rustc_middle::ty::{self, ToPredicate, Ty, TyCtxt};
|
|||||||
use rustc_middle::ty::{TraitPredicate, TypeVisitableExt};
|
use rustc_middle::ty::{TraitPredicate, TypeVisitableExt};
|
||||||
use rustc_span::DUMMY_SP;
|
use rustc_span::DUMMY_SP;
|
||||||
|
|
||||||
pub mod structural_traits;
|
|
||||||
|
|
||||||
impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> {
|
impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> {
|
||||||
fn self_ty(self) -> Ty<'tcx> {
|
fn self_ty(self) -> Ty<'tcx> {
|
||||||
self.self_ty()
|
self.self_ty()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user