X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=compiler%2Frustc_middle%2Fsrc%2Fty%2Fstructural_impls.rs;h=6311f401b0492b3a9cdb8f6657c0809aa3750fb1;hb=976348603485b216b0d5314eca674a2b24df4c73;hp=1c5bc7860db2de7280f0446399e3f3ec796fa051;hpb=d54195db22421c51fd14560aba3bbf9b79a52677;p=rust.git diff --git a/compiler/rustc_middle/src/ty/structural_impls.rs b/compiler/rustc_middle/src/ty/structural_impls.rs index 1c5bc7860db..6311f401b04 100644 --- a/compiler/rustc_middle/src/ty/structural_impls.rs +++ b/compiler/rustc_middle/src/ty/structural_impls.rs @@ -21,9 +21,9 @@ 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(()) }) } @@ -32,9 +32,9 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 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(()) }) } @@ -49,7 +49,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 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)) } } @@ -125,13 +125,13 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 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)) } } @@ -253,6 +253,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { crate::ty::UniverseIndex, crate::ty::Variance, ::rustc_span::Span, + ::rustc_errors::ErrorReported, } /////////////////////////////////////////////////////////////////////////// @@ -1077,7 +1078,7 @@ fn super_visit_with>(&self, visitor: &mut V) -> ControlFlow } fn visit_with>(&self, visitor: &mut V) -> ControlFlow { - visitor.visit_ty(self) + visitor.visit_ty(*self) } } @@ -1111,12 +1112,12 @@ fn try_super_fold_with>( self, folder: &mut F, ) -> Result { - 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>(&self, visitor: &mut V) -> ControlFlow { - self.inner.kind.visit_with(visitor) + self.kind().visit_with(visitor) } fn visit_with>(&self, visitor: &mut V) -> ControlFlow { @@ -1124,11 +1125,11 @@ fn visit_with>(&self, visitor: &mut V) -> ControlFlow 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) } } @@ -1158,15 +1159,15 @@ fn super_visit_with>(&self, visitor: &mut V) -> ControlFlow } } -impl<'tcx> TypeFoldable<'tcx> for &'tcx ty::Const<'tcx> { +impl<'tcx> TypeFoldable<'tcx> for ty::Const<'tcx> { fn try_super_fold_with>( self, folder: &mut F, ) -> Result { - 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) } @@ -1177,12 +1178,12 @@ fn try_fold_with>(self, folder: &mut F) -> Result>(&self, visitor: &mut V) -> ControlFlow { - self.ty.visit_with(visitor)?; - self.val.visit_with(visitor) + self.ty().visit_with(visitor)?; + self.val().visit_with(visitor) } fn visit_with>(&self, visitor: &mut V) -> ControlFlow { - visitor.visit_const(self) + visitor.visit_const(*self) } }