Skip to content

Commit 046a949

Browse files
committed
stash
1 parent ff3a616 commit 046a949

File tree

3 files changed

+7
-38
lines changed

3 files changed

+7
-38
lines changed

compiler/rustc_type_ir/src/macros.rs

+2-26
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,8 @@
33
macro_rules! TrivialTypeTraversalImpls {
44
($($ty:ty,)+) => {
55
$(
6-
impl<I: $crate::Interner> $crate::fold::TypeFoldable<I> for $ty {
7-
fn try_fold_with<F: $crate::fold::FallibleTypeFolder<I>>(
8-
self,
9-
_: &mut F,
10-
) -> ::std::result::Result<Self, F::Error> {
11-
Ok(self)
12-
}
13-
14-
#[inline]
15-
fn fold_with<F: $crate::fold::TypeFolder<I>>(
16-
self,
17-
_: &mut F,
18-
) -> Self {
19-
self
20-
}
21-
}
22-
23-
impl<I: $crate::Interner> $crate::visit::TypeVisitable<I> for $ty {
24-
#[inline]
25-
fn visit_with<F: $crate::visit::TypeVisitor<I>>(
26-
&self,
27-
_: &mut F)
28-
-> F::Result
29-
{
30-
<F::Result as rustc_ast_ir::visit::VisitorResult>::output()
31-
}
6+
impl<I: $crate::Interner> $crate::traverse::TypeTraversable<I> for $ty {
7+
type Kind = $crate::traverse::NoopTypeTraversal;
328
}
339
)+
3410
};

compiler/rustc_type_ir/src/traverse/mod.rs

+1-10
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,8 @@ pub trait TypeTraversable<I: Interner>: fmt::Debug + Clone {
4040
}
4141
pub struct ImportantTypeTraversal;
4242
pub struct NoopTypeTraversal;
43-
#[inline(always)]
44-
pub fn noop_visit<I, V, T>() -> V::Result
45-
where
46-
I: Interner,
47-
V: TypeVisitor<I>,
48-
T: TypeTraversable<I, Kind = NoopTypeTraversal>,
49-
{
50-
V::Result::output()
51-
}
5243

53-
impl<I: Interner, T: TypeVisitable<I>> TypeTraversable<I> for T {
44+
impl<I: Interner, T: TypeVisitable> TypeTraversable<I> for T {
5445
type Kind = ImportantTypeTraversal;
5546
}
5647

compiler/rustc_type_ir/src/ty_kind.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
88
use rustc_data_structures::unify::{NoError, UnifyKey, UnifyValue};
99
#[cfg(feature = "nightly")]
1010
use rustc_macros::{Decodable, Encodable, HashStable_NoContext, TyDecodable, TyEncodable};
11-
use rustc_type_ir_macros::{Lift_Generic, TypeFoldable_Generic, TypeVisitable_Generic};
11+
use rustc_type_ir_macros::{
12+
Lift_Generic, NoopTypeTraversable_Generic, TypeFoldable_Generic, TypeVisitable_Generic,
13+
};
1214

1315
use self::TyKind::*;
1416
pub use self::closure::*;
@@ -1012,7 +1014,7 @@ impl<I: Interner> ty::Binder<I, FnSigTys<I>> {
10121014

10131015
#[derive_where(Clone, Copy, Debug, PartialEq, Eq, Hash; I: Interner)]
10141016
#[cfg_attr(feature = "nightly", derive(TyEncodable, TyDecodable, HashStable_NoContext))]
1015-
#[derive(TypeVisitable_Generic, TypeFoldable_Generic, Lift_Generic)]
1017+
#[derive(NoopTypeTraversable_Generic, Lift_Generic)]
10161018
pub struct FnHeader<I: Interner> {
10171019
pub c_variadic: bool,
10181020
pub safety: I::Safety,

0 commit comments

Comments
 (0)