impl fmt::Debug for ty::TraitDef {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
ty::tls::with(|tcx| {
- with_no_trimmed_paths(|| {
- FmtPrinter::new(tcx, f, Namespace::TypeNS).print_def_path(self.def_id, &[])
- })?;
+ with_no_trimmed_paths!(
+ FmtPrinter::new(tcx, f, Namespace::TypeNS).print_def_path(self.def_id, &[])?
+ );
Ok(())
})
}
impl fmt::Debug for ty::AdtDef {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
ty::tls::with(|tcx| {
- with_no_trimmed_paths(|| {
- FmtPrinter::new(tcx, f, Namespace::TypeNS).print_def_path(self.did, &[])
- })?;
+ with_no_trimmed_paths!(
+ FmtPrinter::new(tcx, f, Namespace::TypeNS).print_def_path(self.did, &[])?
+ );
Ok(())
})
}
impl<'tcx> fmt::Debug for ty::ExistentialTraitRef<'tcx> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- with_no_trimmed_paths(|| fmt::Display::fmt(self, f))
+ with_no_trimmed_paths!(fmt::Display::fmt(self, f))
}
}
impl<'tcx> fmt::Debug for ty::TraitRef<'tcx> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- with_no_trimmed_paths(|| fmt::Display::fmt(self, f))
+ with_no_trimmed_paths!(fmt::Display::fmt(self, f))
}
}
impl<'tcx> fmt::Debug for Ty<'tcx> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- with_no_trimmed_paths(|| fmt::Display::fmt(self, f))
+ with_no_trimmed_paths!(fmt::Display::fmt(self, f))
}
}
crate::ty::UniverseIndex,
crate::ty::Variance,
::rustc_span::Span,
+ ::rustc_errors::ErrorReported,
}
///////////////////////////////////////////////////////////////////////////
}
fn visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> ControlFlow<V::BreakTy> {
- visitor.visit_ty(self)
+ visitor.visit_ty(*self)
}
}
self,
folder: &mut F,
) -> Result<Self, F::Error> {
- let new = self.inner.kind.try_fold_with(folder)?;
+ let new = self.kind().try_fold_with(folder)?;
Ok(folder.tcx().reuse_or_mk_predicate(self, new))
}
fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> ControlFlow<V::BreakTy> {
- self.inner.kind.visit_with(visitor)
+ self.kind().visit_with(visitor)
}
fn visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> ControlFlow<V::BreakTy> {
}
fn has_vars_bound_at_or_above(&self, binder: ty::DebruijnIndex) -> bool {
- self.inner.outer_exclusive_binder > binder
+ self.outer_exclusive_binder() > binder
}
fn has_type_flags(&self, flags: ty::TypeFlags) -> bool {
- self.inner.flags.intersects(flags)
+ self.flags().intersects(flags)
}
}
}
}
-impl<'tcx> TypeFoldable<'tcx> for &'tcx ty::Const<'tcx> {
+impl<'tcx> TypeFoldable<'tcx> for ty::Const<'tcx> {
fn try_super_fold_with<F: FallibleTypeFolder<'tcx>>(
self,
folder: &mut F,
) -> Result<Self, F::Error> {
- let ty = self.ty.try_fold_with(folder)?;
- let val = self.val.try_fold_with(folder)?;
- if ty != self.ty || val != self.val {
- Ok(folder.tcx().mk_const(ty::Const { ty, val }))
+ let ty = self.ty().try_fold_with(folder)?;
+ let val = self.val().try_fold_with(folder)?;
+ if ty != self.ty() || val != self.val() {
+ Ok(folder.tcx().mk_const(ty::ConstS { ty, val }))
} else {
Ok(self)
}
}
fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> ControlFlow<V::BreakTy> {
- self.ty.visit_with(visitor)?;
- self.val.visit_with(visitor)
+ self.ty().visit_with(visitor)?;
+ self.val().visit_with(visitor)
}
fn visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> ControlFlow<V::BreakTy> {
- visitor.visit_const(self)
+ visitor.visit_const(*self)
}
}