Skip to content

Commit 17e4aec

Browse files
committed
TypeVisitable doesn't require Clone.
`TypeFoldable` does, because it involves the production of new values. But `TypeVisitable` only involves the visiting of values.
1 parent e08cd3c commit 17e4aec

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

compiler/rustc_type_ir/src/fold.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ type Never = std::convert::Infallible;
7373
/// which means in practice almost every foldable type needs to also be
7474
/// visitable. (However, there are some types that are visitable without being
7575
/// foldable.)
76-
pub trait TypeFoldable<I: Interner>: TypeVisitable<I> {
76+
pub trait TypeFoldable<I: Interner>: TypeVisitable<I> + Clone {
7777
/// The entry point for folding. To fold a value `t` with a folder `f`
7878
/// call: `t.try_fold_with(f)`.
7979
///

compiler/rustc_type_ir/src/visit.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ use crate::{self as ty, Interner, TypeFlags};
5959
///
6060
/// To implement this conveniently, use the derive macro located in
6161
/// `rustc_macros`.
62-
pub trait TypeVisitable<I: Interner>: fmt::Debug + Clone {
62+
pub trait TypeVisitable<I: Interner>: fmt::Debug {
6363
/// The entry point for visiting. To visit a value `t` with a visitor `v`
6464
/// call: `t.visit_with(v)`.
6565
///

0 commit comments

Comments
 (0)