move traits structural impls to traits::structural_impls
This commit is contained in:
parent
5f564fbbe4
commit
2ad5a61fe2
6 changed files with 238 additions and 226 deletions
|
@ -11,7 +11,6 @@
|
|||
use middle::infer::InferCtxt;
|
||||
use middle::ty::{self, RegionEscape, Ty, HasTypeFlags};
|
||||
|
||||
use std::fmt;
|
||||
use syntax::ast;
|
||||
use util::common::ErrorReported;
|
||||
use util::nodemap::{FnvHashSet, NodeMap};
|
||||
|
@ -509,14 +508,6 @@ fn process_predicate<'a,'tcx>(selcx: &mut SelectionContext<'a,'tcx>,
|
|||
}
|
||||
}
|
||||
|
||||
impl<'tcx> fmt::Debug for RegionObligation<'tcx> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "RegionObligation(sub_region={:?}, sup_type={:?})",
|
||||
self.sub_region,
|
||||
self.sup_type)
|
||||
}
|
||||
}
|
||||
|
||||
fn register_region_obligation<'tcx>(t_a: Ty<'tcx>,
|
||||
r_b: ty::Region,
|
||||
cause: ObligationCause<'tcx>,
|
||||
|
|
|
@ -63,6 +63,7 @@ mod fulfill;
|
|||
mod project;
|
||||
mod object_safety;
|
||||
mod select;
|
||||
mod structural_impls;
|
||||
mod util;
|
||||
|
||||
/// An `Obligation` represents some trait reference (e.g. `int:Eq`) for
|
||||
|
|
|
@ -28,8 +28,6 @@ use middle::ty::fold::{TypeFoldable, TypeFolder};
|
|||
use syntax::parse::token;
|
||||
use util::common::FN_OUTPUT_NAME;
|
||||
|
||||
use std::fmt;
|
||||
|
||||
pub type PolyProjectionObligation<'tcx> =
|
||||
Obligation<'tcx, ty::PolyProjectionPredicate<'tcx>>;
|
||||
|
||||
|
@ -917,27 +915,3 @@ fn confirm_impl_candidate<'cx,'tcx>(
|
|||
&format!("No associated type for {:?}",
|
||||
trait_ref));
|
||||
}
|
||||
|
||||
impl<'tcx, T: TypeFoldable<'tcx>> TypeFoldable<'tcx> for Normalized<'tcx, T> {
|
||||
fn fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> Normalized<'tcx, T> {
|
||||
Normalized {
|
||||
value: self.value.fold_with(folder),
|
||||
obligations: self.obligations.fold_with(folder),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx, T: HasTypeFlags> HasTypeFlags for Normalized<'tcx, T> {
|
||||
fn has_type_flags(&self, flags: ty::TypeFlags) -> bool {
|
||||
self.value.has_type_flags(flags) ||
|
||||
self.obligations.has_type_flags(flags)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx, T:fmt::Debug> fmt::Debug for Normalized<'tcx, T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "Normalized({:?},{:?})",
|
||||
self.value,
|
||||
self.obligations)
|
||||
}
|
||||
}
|
||||
|
|
235
src/librustc/middle/traits/structural_impls.rs
Normal file
235
src/librustc/middle/traits/structural_impls.rs
Normal file
|
@ -0,0 +1,235 @@
|
|||
// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use middle::traits;
|
||||
use middle::traits::project::Normalized;
|
||||
use middle::ty::{HasTypeFlags, TypeFlags, RegionEscape};
|
||||
use middle::ty::fold::{TypeFoldable, TypeFolder};
|
||||
|
||||
use std::fmt;
|
||||
|
||||
// structural impls for the structs in middle::traits
|
||||
|
||||
impl<'tcx, T: fmt::Debug> fmt::Debug for Normalized<'tcx, T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "Normalized({:?},{:?})",
|
||||
self.value,
|
||||
self.obligations)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> fmt::Debug for traits::RegionObligation<'tcx> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "RegionObligation(sub_region={:?}, sup_type={:?})",
|
||||
self.sub_region,
|
||||
self.sup_type)
|
||||
}
|
||||
}
|
||||
impl<'tcx, O: fmt::Debug> fmt::Debug for traits::Obligation<'tcx, O> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "Obligation(predicate={:?},depth={})",
|
||||
self.predicate,
|
||||
self.recursion_depth)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx, N: fmt::Debug> fmt::Debug for traits::Vtable<'tcx, N> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match *self {
|
||||
super::VtableImpl(ref v) =>
|
||||
write!(f, "{:?}", v),
|
||||
|
||||
super::VtableDefaultImpl(ref t) =>
|
||||
write!(f, "{:?}", t),
|
||||
|
||||
super::VtableClosure(ref d) =>
|
||||
write!(f, "{:?}", d),
|
||||
|
||||
super::VtableFnPointer(ref d) =>
|
||||
write!(f, "VtableFnPointer({:?})", d),
|
||||
|
||||
super::VtableObject(ref d) =>
|
||||
write!(f, "{:?}", d),
|
||||
|
||||
super::VtableParam(ref n) =>
|
||||
write!(f, "VtableParam({:?})", n),
|
||||
|
||||
super::VtableBuiltin(ref d) =>
|
||||
write!(f, "{:?}", d)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx, N: fmt::Debug> fmt::Debug for traits::VtableImplData<'tcx, N> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "VtableImpl(impl_def_id={:?}, substs={:?}, nested={:?})",
|
||||
self.impl_def_id,
|
||||
self.substs,
|
||||
self.nested)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx, N: fmt::Debug> fmt::Debug for traits::VtableClosureData<'tcx, N> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "VtableClosure(closure_def_id={:?}, substs={:?}, nested={:?})",
|
||||
self.closure_def_id,
|
||||
self.substs,
|
||||
self.nested)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx, N: fmt::Debug> fmt::Debug for traits::VtableBuiltinData<N> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "VtableBuiltin(nested={:?})", self.nested)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx, N: fmt::Debug> fmt::Debug for traits::VtableDefaultImplData<N> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "VtableDefaultImplData(trait_def_id={:?}, nested={:?})",
|
||||
self.trait_def_id,
|
||||
self.nested)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> fmt::Debug for traits::VtableObjectData<'tcx> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "VtableObject(upcast={:?}, vtable_base={})",
|
||||
self.upcast_trait_ref,
|
||||
self.vtable_base)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> fmt::Debug for traits::FulfillmentError<'tcx> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "FulfillmentError({:?},{:?})",
|
||||
self.obligation,
|
||||
self.code)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> fmt::Debug for traits::FulfillmentErrorCode<'tcx> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match *self {
|
||||
super::CodeSelectionError(ref e) => write!(f, "{:?}", e),
|
||||
super::CodeProjectionError(ref e) => write!(f, "{:?}", e),
|
||||
super::CodeAmbiguity => write!(f, "Ambiguity")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> fmt::Debug for traits::MismatchedProjectionTypes<'tcx> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "MismatchedProjectionTypes({:?})", self.err)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx, P: RegionEscape> RegionEscape for traits::Obligation<'tcx,P> {
|
||||
fn has_regions_escaping_depth(&self, depth: u32) -> bool {
|
||||
self.predicate.has_regions_escaping_depth(depth)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx, T: HasTypeFlags> HasTypeFlags for traits::Obligation<'tcx, T> {
|
||||
fn has_type_flags(&self, flags: TypeFlags) -> bool {
|
||||
self.predicate.has_type_flags(flags)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx, T: HasTypeFlags> HasTypeFlags for Normalized<'tcx, T> {
|
||||
fn has_type_flags(&self, flags: TypeFlags) -> bool {
|
||||
self.value.has_type_flags(flags) ||
|
||||
self.obligations.has_type_flags(flags)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx, O: TypeFoldable<'tcx>> TypeFoldable<'tcx> for traits::Obligation<'tcx, O>
|
||||
{
|
||||
fn fold_with<F:TypeFolder<'tcx>>(&self, folder: &mut F) -> traits::Obligation<'tcx, O> {
|
||||
traits::Obligation {
|
||||
cause: self.cause.clone(),
|
||||
recursion_depth: self.recursion_depth,
|
||||
predicate: self.predicate.fold_with(folder),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx, N: TypeFoldable<'tcx>> TypeFoldable<'tcx> for traits::VtableImplData<'tcx, N> {
|
||||
fn fold_with<F:TypeFolder<'tcx>>(&self, folder: &mut F) -> traits::VtableImplData<'tcx, N> {
|
||||
traits::VtableImplData {
|
||||
impl_def_id: self.impl_def_id,
|
||||
substs: self.substs.fold_with(folder),
|
||||
nested: self.nested.fold_with(folder),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx, N: TypeFoldable<'tcx>> TypeFoldable<'tcx> for traits::VtableClosureData<'tcx, N> {
|
||||
fn fold_with<F:TypeFolder<'tcx>>(&self, folder: &mut F) -> traits::VtableClosureData<'tcx, N> {
|
||||
traits::VtableClosureData {
|
||||
closure_def_id: self.closure_def_id,
|
||||
substs: self.substs.fold_with(folder),
|
||||
nested: self.nested.fold_with(folder),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx, N: TypeFoldable<'tcx>> TypeFoldable<'tcx> for traits::VtableDefaultImplData<N> {
|
||||
fn fold_with<F:TypeFolder<'tcx>>(&self, folder: &mut F) -> traits::VtableDefaultImplData<N> {
|
||||
traits::VtableDefaultImplData {
|
||||
trait_def_id: self.trait_def_id,
|
||||
nested: self.nested.fold_with(folder),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx, N: TypeFoldable<'tcx>> TypeFoldable<'tcx> for traits::VtableBuiltinData<N> {
|
||||
fn fold_with<F:TypeFolder<'tcx>>(&self, folder: &mut F) -> traits::VtableBuiltinData<N> {
|
||||
traits::VtableBuiltinData {
|
||||
nested: self.nested.fold_with(folder),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx, N: TypeFoldable<'tcx>> TypeFoldable<'tcx> for traits::Vtable<'tcx, N> {
|
||||
fn fold_with<F:TypeFolder<'tcx>>(&self, folder: &mut F) -> traits::Vtable<'tcx, N> {
|
||||
match *self {
|
||||
traits::VtableImpl(ref v) => traits::VtableImpl(v.fold_with(folder)),
|
||||
traits::VtableDefaultImpl(ref t) => traits::VtableDefaultImpl(t.fold_with(folder)),
|
||||
traits::VtableClosure(ref d) => {
|
||||
traits::VtableClosure(d.fold_with(folder))
|
||||
}
|
||||
traits::VtableFnPointer(ref d) => {
|
||||
traits::VtableFnPointer(d.fold_with(folder))
|
||||
}
|
||||
traits::VtableParam(ref n) => traits::VtableParam(n.fold_with(folder)),
|
||||
traits::VtableBuiltin(ref d) => traits::VtableBuiltin(d.fold_with(folder)),
|
||||
traits::VtableObject(ref d) => traits::VtableObject(d.fold_with(folder)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> TypeFoldable<'tcx> for traits::VtableObjectData<'tcx> {
|
||||
fn fold_with<F:TypeFolder<'tcx>>(&self, folder: &mut F) -> traits::VtableObjectData<'tcx> {
|
||||
traits::VtableObjectData {
|
||||
upcast_trait_ref: self.upcast_trait_ref.fold_with(folder),
|
||||
vtable_base: self.vtable_base
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx, T: TypeFoldable<'tcx>> TypeFoldable<'tcx> for Normalized<'tcx, T> {
|
||||
fn fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> Normalized<'tcx, T> {
|
||||
Normalized {
|
||||
value: self.value.fold_with(folder),
|
||||
obligations: self.obligations.fold_with(folder),
|
||||
}
|
||||
}
|
||||
}
|
|
@ -11,14 +11,12 @@
|
|||
use middle::def_id::DefId;
|
||||
use middle::infer::InferCtxt;
|
||||
use middle::subst::Substs;
|
||||
use middle::ty::{self, HasTypeFlags, Ty, ToPredicate, ToPolyTraitRef};
|
||||
use std::fmt;
|
||||
use middle::ty::{self, Ty, ToPredicate, ToPolyTraitRef};
|
||||
use syntax::codemap::Span;
|
||||
use util::common::ErrorReported;
|
||||
use util::nodemap::FnvHashSet;
|
||||
|
||||
use super::{Obligation, ObligationCause, PredicateObligation,
|
||||
VtableImpl, VtableParam, VtableImplData, VtableDefaultImplData};
|
||||
use super::{Obligation, ObligationCause, PredicateObligation};
|
||||
|
||||
struct PredicateSet<'a,'tcx:'a> {
|
||||
tcx: &'a ty::ctxt<'tcx>,
|
||||
|
@ -477,108 +475,3 @@ pub fn closure_trait_ref_and_return_type<'tcx>(
|
|||
};
|
||||
ty::Binder((trait_ref, sig.0.output.unwrap_or(tcx.mk_nil())))
|
||||
}
|
||||
|
||||
impl<'tcx,O:fmt::Debug> fmt::Debug for super::Obligation<'tcx, O> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "Obligation(predicate={:?},depth={})",
|
||||
self.predicate,
|
||||
self.recursion_depth)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx, N:fmt::Debug> fmt::Debug for super::Vtable<'tcx, N> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match *self {
|
||||
super::VtableImpl(ref v) =>
|
||||
write!(f, "{:?}", v),
|
||||
|
||||
super::VtableDefaultImpl(ref t) =>
|
||||
write!(f, "{:?}", t),
|
||||
|
||||
super::VtableClosure(ref d) =>
|
||||
write!(f, "{:?}", d),
|
||||
|
||||
super::VtableFnPointer(ref d) =>
|
||||
write!(f, "VtableFnPointer({:?})", d),
|
||||
|
||||
super::VtableObject(ref d) =>
|
||||
write!(f, "{:?}", d),
|
||||
|
||||
super::VtableParam(ref n) =>
|
||||
write!(f, "VtableParam({:?})", n),
|
||||
|
||||
super::VtableBuiltin(ref d) =>
|
||||
write!(f, "{:?}", d)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx, N:fmt::Debug> fmt::Debug for super::VtableImplData<'tcx, N> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "VtableImpl(impl_def_id={:?}, substs={:?}, nested={:?})",
|
||||
self.impl_def_id,
|
||||
self.substs,
|
||||
self.nested)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx, N:fmt::Debug> fmt::Debug for super::VtableClosureData<'tcx, N> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "VtableClosure(closure_def_id={:?}, substs={:?}, nested={:?})",
|
||||
self.closure_def_id,
|
||||
self.substs,
|
||||
self.nested)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx, N:fmt::Debug> fmt::Debug for super::VtableBuiltinData<N> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "VtableBuiltin(nested={:?})", self.nested)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx, N:fmt::Debug> fmt::Debug for super::VtableDefaultImplData<N> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "VtableDefaultImplData(trait_def_id={:?}, nested={:?})",
|
||||
self.trait_def_id,
|
||||
self.nested)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> fmt::Debug for super::VtableObjectData<'tcx> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "VtableObject(upcast={:?}, vtable_base={})",
|
||||
self.upcast_trait_ref,
|
||||
self.vtable_base)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> fmt::Debug for super::FulfillmentError<'tcx> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "FulfillmentError({:?},{:?})",
|
||||
self.obligation,
|
||||
self.code)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> fmt::Debug for super::FulfillmentErrorCode<'tcx> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match *self {
|
||||
super::CodeSelectionError(ref e) => write!(f, "{:?}", e),
|
||||
super::CodeProjectionError(ref e) => write!(f, "{:?}", e),
|
||||
super::CodeAmbiguity => write!(f, "Ambiguity")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> fmt::Debug for super::MismatchedProjectionTypes<'tcx> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "MismatchedProjectionTypes({:?})", self.err)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx, T: HasTypeFlags> HasTypeFlags for Obligation<'tcx, T> {
|
||||
fn has_type_flags(&self, flags: ty::TypeFlags) -> bool {
|
||||
self.predicate.has_type_flags(flags)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -116,12 +116,6 @@ impl<'tcx> RegionEscape for ty::Predicate<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'tcx,P:RegionEscape> RegionEscape for traits::Obligation<'tcx,P> {
|
||||
fn has_regions_escaping_depth(&self, depth: u32) -> bool {
|
||||
self.predicate.has_regions_escaping_depth(depth)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> RegionEscape for TraitRef<'tcx> {
|
||||
fn has_regions_escaping_depth(&self, depth: u32) -> bool {
|
||||
self.substs.types.iter().any(|t| t.has_regions_escaping_depth(depth)) ||
|
||||
|
@ -770,82 +764,6 @@ impl<'tcx> TypeFoldable<'tcx> for ty::InstantiatedPredicates<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'tcx,O> TypeFoldable<'tcx> for traits::Obligation<'tcx,O>
|
||||
where O : TypeFoldable<'tcx>
|
||||
{
|
||||
fn fold_with<F:TypeFolder<'tcx>>(&self, folder: &mut F) -> traits::Obligation<'tcx, O> {
|
||||
traits::Obligation {
|
||||
cause: self.cause.clone(),
|
||||
recursion_depth: self.recursion_depth,
|
||||
predicate: self.predicate.fold_with(folder),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx, N: TypeFoldable<'tcx>> TypeFoldable<'tcx> for traits::VtableImplData<'tcx, N> {
|
||||
fn fold_with<F:TypeFolder<'tcx>>(&self, folder: &mut F) -> traits::VtableImplData<'tcx, N> {
|
||||
traits::VtableImplData {
|
||||
impl_def_id: self.impl_def_id,
|
||||
substs: self.substs.fold_with(folder),
|
||||
nested: self.nested.fold_with(folder),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx, N: TypeFoldable<'tcx>> TypeFoldable<'tcx> for traits::VtableClosureData<'tcx, N> {
|
||||
fn fold_with<F:TypeFolder<'tcx>>(&self, folder: &mut F) -> traits::VtableClosureData<'tcx, N> {
|
||||
traits::VtableClosureData {
|
||||
closure_def_id: self.closure_def_id,
|
||||
substs: self.substs.fold_with(folder),
|
||||
nested: self.nested.fold_with(folder),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx, N: TypeFoldable<'tcx>> TypeFoldable<'tcx> for traits::VtableDefaultImplData<N> {
|
||||
fn fold_with<F:TypeFolder<'tcx>>(&self, folder: &mut F) -> traits::VtableDefaultImplData<N> {
|
||||
traits::VtableDefaultImplData {
|
||||
trait_def_id: self.trait_def_id,
|
||||
nested: self.nested.fold_with(folder),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx, N: TypeFoldable<'tcx>> TypeFoldable<'tcx> for traits::VtableBuiltinData<N> {
|
||||
fn fold_with<F:TypeFolder<'tcx>>(&self, folder: &mut F) -> traits::VtableBuiltinData<N> {
|
||||
traits::VtableBuiltinData {
|
||||
nested: self.nested.fold_with(folder),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx, N: TypeFoldable<'tcx>> TypeFoldable<'tcx> for traits::Vtable<'tcx, N> {
|
||||
fn fold_with<F:TypeFolder<'tcx>>(&self, folder: &mut F) -> traits::Vtable<'tcx, N> {
|
||||
match *self {
|
||||
traits::VtableImpl(ref v) => traits::VtableImpl(v.fold_with(folder)),
|
||||
traits::VtableDefaultImpl(ref t) => traits::VtableDefaultImpl(t.fold_with(folder)),
|
||||
traits::VtableClosure(ref d) => {
|
||||
traits::VtableClosure(d.fold_with(folder))
|
||||
}
|
||||
traits::VtableFnPointer(ref d) => {
|
||||
traits::VtableFnPointer(d.fold_with(folder))
|
||||
}
|
||||
traits::VtableParam(ref n) => traits::VtableParam(n.fold_with(folder)),
|
||||
traits::VtableBuiltin(ref d) => traits::VtableBuiltin(d.fold_with(folder)),
|
||||
traits::VtableObject(ref d) => traits::VtableObject(d.fold_with(folder)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> TypeFoldable<'tcx> for traits::VtableObjectData<'tcx> {
|
||||
fn fold_with<F:TypeFolder<'tcx>>(&self, folder: &mut F) -> traits::VtableObjectData<'tcx> {
|
||||
traits::VtableObjectData {
|
||||
upcast_trait_ref: self.upcast_trait_ref.fold_with(folder),
|
||||
vtable_base: self.vtable_base
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> TypeFoldable<'tcx> for ty::EquatePredicate<'tcx> {
|
||||
fn fold_with<F:TypeFolder<'tcx>>(&self, folder: &mut F) -> ty::EquatePredicate<'tcx> {
|
||||
ty::EquatePredicate(self.0.fold_with(folder),
|
||||
|
|
Loading…
Reference in a new issue