Skip to content

Commit d04bff6

Browse files
committed
add inline to TrivialTypeTraversalImpls
1 parent face090 commit d04bff6

File tree

3 files changed

+17
-14
lines changed

3 files changed

+17
-14
lines changed

compiler/rustc_middle/src/macros.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,22 @@ macro_rules! TrivialTypeTraversalImpls {
5454
impl<$tcx> $crate::ty::fold::TypeFoldable<$tcx> for $ty {
5555
fn try_fold_with<F: $crate::ty::fold::FallibleTypeFolder<$tcx>>(
5656
self,
57-
_: &mut F
58-
) -> ::std::result::Result<$ty, F::Error> {
57+
_: &mut F,
58+
) -> ::std::result::Result<Self, F::Error> {
5959
Ok(self)
6060
}
61+
62+
#[inline]
63+
fn fold_with<F: $crate::ty::fold::TypeFolder<$tcx>>(
64+
self,
65+
_: &mut F,
66+
) -> Self {
67+
self
68+
}
6169
}
6270

6371
impl<$tcx> $crate::ty::visit::TypeVisitable<$tcx> for $ty {
72+
#[inline]
6473
fn visit_with<F: $crate::ty::visit::TypeVisitor<$tcx>>(
6574
&self,
6675
_: &mut F)

compiler/rustc_middle/src/mir/type_foldable.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ TrivialTypeTraversalAndLiftImpls! {
2626
GeneratorSavedLocal,
2727
}
2828

29+
TrivialTypeTraversalImpls! {
30+
for <'tcx> {
31+
ConstValue<'tcx>,
32+
}
33+
}
34+
2935
impl<'tcx> TypeFoldable<'tcx> for &'tcx [InlineAsmTemplatePiece] {
3036
fn try_fold_with<F: FallibleTypeFolder<'tcx>>(self, _folder: &mut F) -> Result<Self, F::Error> {
3137
Ok(self)
@@ -49,9 +55,3 @@ impl<'tcx, R: Idx, C: Idx> TypeFoldable<'tcx> for BitMatrix<R, C> {
4955
Ok(self)
5056
}
5157
}
52-
53-
impl<'tcx> TypeFoldable<'tcx> for ConstValue<'tcx> {
54-
fn try_fold_with<F: FallibleTypeFolder<'tcx>>(self, _: &mut F) -> Result<Self, F::Error> {
55-
Ok(self)
56-
}
57-
}

compiler/rustc_middle/src/mir/type_visitable.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,3 @@ impl<'tcx, R: Idx, C: Idx> TypeVisitable<'tcx> for BitMatrix<R, C> {
77
ControlFlow::CONTINUE
88
}
99
}
10-
11-
impl<'tcx> TypeVisitable<'tcx> for ConstValue<'tcx> {
12-
fn visit_with<V: TypeVisitor<'tcx>>(&self, _: &mut V) -> ControlFlow<V::BreakTy> {
13-
ControlFlow::CONTINUE
14-
}
15-
}

0 commit comments

Comments
 (0)