move structural_traits into assembly

This commit is contained in:
lcnr 2023-03-29 15:44:23 +02:00
parent 2b0f5721c1
commit 2186847f28
4 changed files with 9 additions and 11 deletions

View File

@ -1,8 +1,6 @@
//! Code shared by trait and projection goals for candidate assembly.
use super::search_graph::OverflowHandler;
#[cfg(doc)]
use super::trait_goals::structural_traits::*;
use super::{EvalCtxt, SolverMode};
use crate::solve::CanonicalResponseExt;
use crate::traits::coherence;
@ -16,6 +14,8 @@
use rustc_middle::ty::{self, Ty, TyCtxt};
use std::fmt::Debug;
pub(super) mod structural_traits;
/// A candidate is a possible way to prove a goal.
///
/// It consists of both the `source`, which describes how that goal would be proven,

View File

@ -11,7 +11,7 @@
//
// For types with an "existential" binder, i.e. generator witnesses, we also
// 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>,
ty: Ty<'tcx>,
) -> 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>,
ty: 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)
}
pub(super) fn instantiate_constituent_tys_for_sized_trait<'tcx>(
pub(crate) fn instantiate_constituent_tys_for_sized_trait<'tcx>(
ecx: &EvalCtxt<'_, 'tcx>,
ty: Ty<'tcx>,
) -> 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>,
ty: Ty<'tcx>,
) -> Result<Vec<Ty<'tcx>>, NoSolution> {

View File

@ -1,7 +1,6 @@
use crate::traits::specialization_graph;
use super::assembly;
use super::trait_goals::structural_traits;
use super::assembly::{self, structural_traits};
use super::EvalCtxt;
use rustc_errors::ErrorGuaranteed;
use rustc_hir::def::DefKind;

View File

@ -1,6 +1,7 @@
//! 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::LangItem;
use rustc_infer::traits::query::NoSolution;
@ -11,8 +12,6 @@
use rustc_middle::ty::{TraitPredicate, TypeVisitableExt};
use rustc_span::DUMMY_SP;
pub mod structural_traits;
impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> {
fn self_ty(self) -> Ty<'tcx> {
self.self_ty()