Skip to content

Commit

Permalink
add inline to TrivialTypeTraversalImpls
Browse files Browse the repository at this point in the history
  • Loading branch information
lcnr committed Oct 17, 2022
1 parent face090 commit d04bff6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
13 changes: 11 additions & 2 deletions compiler/rustc_middle/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,22 @@ macro_rules! TrivialTypeTraversalImpls {
impl<$tcx> $crate::ty::fold::TypeFoldable<$tcx> for $ty {
fn try_fold_with<F: $crate::ty::fold::FallibleTypeFolder<$tcx>>(
self,
_: &mut F
) -> ::std::result::Result<$ty, F::Error> {
_: &mut F,
) -> ::std::result::Result<Self, F::Error> {
Ok(self)
}

#[inline]
fn fold_with<F: $crate::ty::fold::TypeFolder<$tcx>>(
self,
_: &mut F,
) -> Self {
self
}
}

impl<$tcx> $crate::ty::visit::TypeVisitable<$tcx> for $ty {
#[inline]
fn visit_with<F: $crate::ty::visit::TypeVisitor<$tcx>>(
&self,
_: &mut F)
Expand Down
12 changes: 6 additions & 6 deletions compiler/rustc_middle/src/mir/type_foldable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ TrivialTypeTraversalAndLiftImpls! {
GeneratorSavedLocal,
}

TrivialTypeTraversalImpls! {
for <'tcx> {
ConstValue<'tcx>,
}
}

impl<'tcx> TypeFoldable<'tcx> for &'tcx [InlineAsmTemplatePiece] {
fn try_fold_with<F: FallibleTypeFolder<'tcx>>(self, _folder: &mut F) -> Result<Self, F::Error> {
Ok(self)
Expand All @@ -49,9 +55,3 @@ impl<'tcx, R: Idx, C: Idx> TypeFoldable<'tcx> for BitMatrix<R, C> {
Ok(self)
}
}

impl<'tcx> TypeFoldable<'tcx> for ConstValue<'tcx> {
fn try_fold_with<F: FallibleTypeFolder<'tcx>>(self, _: &mut F) -> Result<Self, F::Error> {
Ok(self)
}
}
6 changes: 0 additions & 6 deletions compiler/rustc_middle/src/mir/type_visitable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,3 @@ impl<'tcx, R: Idx, C: Idx> TypeVisitable<'tcx> for BitMatrix<R, C> {
ControlFlow::CONTINUE
}
}

impl<'tcx> TypeVisitable<'tcx> for ConstValue<'tcx> {
fn visit_with<V: TypeVisitor<'tcx>>(&self, _: &mut V) -> ControlFlow<V::BreakTy> {
ControlFlow::CONTINUE
}
}

0 comments on commit d04bff6

Please sign in to comment.