2020-01-22 13:42:04 +01:00
|
|
|
use crate::traits;
|
|
|
|
|
|
|
|
use std::fmt;
|
|
|
|
|
|
|
|
// Structural impls for the structs in `traits`.
|
|
|
|
|
2020-05-11 15:25:33 +00:00
|
|
|
impl<'tcx, N: fmt::Debug> fmt::Debug for traits::ImplSource<'tcx, N> {
|
2020-01-22 13:42:04 +01:00
|
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
|
|
match *self {
|
2020-09-24 19:22:36 +02:00
|
|
|
super::ImplSource::UserDefined(ref v) => write!(f, "{:?}", v),
|
2020-01-22 13:42:04 +01:00
|
|
|
|
2020-09-24 19:22:36 +02:00
|
|
|
super::ImplSource::AutoImpl(ref t) => write!(f, "{:?}", t),
|
2020-01-22 13:42:04 +01:00
|
|
|
|
2020-09-24 19:22:36 +02:00
|
|
|
super::ImplSource::Closure(ref d) => write!(f, "{:?}", d),
|
2020-01-22 13:42:04 +01:00
|
|
|
|
2020-09-24 19:22:36 +02:00
|
|
|
super::ImplSource::Generator(ref d) => write!(f, "{:?}", d),
|
2020-01-22 13:42:04 +01:00
|
|
|
|
2020-09-24 19:22:36 +02:00
|
|
|
super::ImplSource::FnPointer(ref d) => write!(f, "({:?})", d),
|
2020-01-22 13:42:04 +01:00
|
|
|
|
2020-09-24 19:22:36 +02:00
|
|
|
super::ImplSource::DiscriminantKind(ref d) => write!(f, "{:?}", d),
|
2020-04-05 19:57:32 +02:00
|
|
|
|
2020-09-24 19:22:36 +02:00
|
|
|
super::ImplSource::Object(ref d) => write!(f, "{:?}", d),
|
2020-01-22 13:42:04 +01:00
|
|
|
|
2020-09-24 19:22:36 +02:00
|
|
|
super::ImplSource::Param(ref n) => write!(f, "ImplSourceParamData({:?})", n),
|
2020-01-22 13:42:04 +01:00
|
|
|
|
2020-09-24 19:22:36 +02:00
|
|
|
super::ImplSource::Builtin(ref d) => write!(f, "{:?}", d),
|
2020-01-22 13:42:04 +01:00
|
|
|
|
2020-09-24 19:22:36 +02:00
|
|
|
super::ImplSource::TraitAlias(ref d) => write!(f, "{:?}", d),
|
2020-01-22 13:42:04 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-02 15:54:24 +00:00
|
|
|
impl<'tcx, N: fmt::Debug> fmt::Debug for traits::ImplSourceUserDefinedData<'tcx, N> {
|
2020-01-22 13:42:04 +01:00
|
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
|
|
write!(
|
|
|
|
f,
|
2020-06-02 15:54:24 +00:00
|
|
|
"ImplSourceUserDefinedData(impl_def_id={:?}, substs={:?}, nested={:?})",
|
2020-01-22 13:42:04 +01:00
|
|
|
self.impl_def_id, self.substs, self.nested
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-11 15:25:33 +00:00
|
|
|
impl<'tcx, N: fmt::Debug> fmt::Debug for traits::ImplSourceGeneratorData<'tcx, N> {
|
2020-01-22 13:42:04 +01:00
|
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
|
|
write!(
|
|
|
|
f,
|
2020-05-11 15:25:33 +00:00
|
|
|
"ImplSourceGeneratorData(generator_def_id={:?}, substs={:?}, nested={:?})",
|
2020-01-22 13:42:04 +01:00
|
|
|
self.generator_def_id, self.substs, self.nested
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-11 15:25:33 +00:00
|
|
|
impl<'tcx, N: fmt::Debug> fmt::Debug for traits::ImplSourceClosureData<'tcx, N> {
|
2020-01-22 13:42:04 +01:00
|
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
|
|
write!(
|
|
|
|
f,
|
2020-05-11 15:25:33 +00:00
|
|
|
"ImplSourceClosureData(closure_def_id={:?}, substs={:?}, nested={:?})",
|
2020-01-22 13:42:04 +01:00
|
|
|
self.closure_def_id, self.substs, self.nested
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-11 15:25:33 +00:00
|
|
|
impl<N: fmt::Debug> fmt::Debug for traits::ImplSourceBuiltinData<N> {
|
2020-01-22 13:42:04 +01:00
|
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
2020-05-11 15:25:33 +00:00
|
|
|
write!(f, "ImplSourceBuiltinData(nested={:?})", self.nested)
|
2020-01-22 13:42:04 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-11 15:25:33 +00:00
|
|
|
impl<N: fmt::Debug> fmt::Debug for traits::ImplSourceAutoImplData<N> {
|
2020-01-22 13:42:04 +01:00
|
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
|
|
write!(
|
|
|
|
f,
|
2020-05-11 15:25:33 +00:00
|
|
|
"ImplSourceAutoImplData(trait_def_id={:?}, nested={:?})",
|
2020-01-22 13:42:04 +01:00
|
|
|
self.trait_def_id, self.nested
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-11 15:25:33 +00:00
|
|
|
impl<'tcx, N: fmt::Debug> fmt::Debug for traits::ImplSourceObjectData<'tcx, N> {
|
2020-01-22 13:42:04 +01:00
|
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
|
|
write!(
|
|
|
|
f,
|
2020-05-11 15:25:33 +00:00
|
|
|
"ImplSourceObjectData(upcast={:?}, vtable_base={}, nested={:?})",
|
2020-01-22 13:42:04 +01:00
|
|
|
self.upcast_trait_ref, self.vtable_base, self.nested
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-11 15:25:33 +00:00
|
|
|
impl<'tcx, N: fmt::Debug> fmt::Debug for traits::ImplSourceFnPointerData<'tcx, N> {
|
2020-01-22 13:42:04 +01:00
|
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
2020-05-11 15:25:33 +00:00
|
|
|
write!(f, "ImplSourceFnPointerData(fn_ty={:?}, nested={:?})", self.fn_ty, self.nested)
|
2020-01-22 13:42:04 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-11 15:25:33 +00:00
|
|
|
impl<'tcx, N: fmt::Debug> fmt::Debug for traits::ImplSourceTraitAliasData<'tcx, N> {
|
2020-01-22 13:42:04 +01:00
|
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
|
|
write!(
|
|
|
|
f,
|
2020-09-24 19:22:36 +02:00
|
|
|
"ImplSourceTraitAliasData(alias_def_id={:?}, substs={:?}, nested={:?})",
|
2020-01-22 13:42:04 +01:00
|
|
|
self.alias_def_id, self.substs, self.nested
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////
|
|
|
|
// Lift implementations
|
|
|
|
|
2020-10-24 09:27:15 +02:00
|
|
|
TrivialTypeFoldableAndLiftImpls! {
|
2020-08-02 15:42:08 +02:00
|
|
|
super::IfExpressionCause,
|
|
|
|
super::ImplSourceDiscriminantKindData,
|
2020-01-22 13:42:04 +01:00
|
|
|
}
|