1
Fork 0

TypeVisitable doesn't require Clone.

`TypeFoldable` does, because it involves the production of new values.
But `TypeVisitable` only involves the visiting of values.
This commit is contained in:
Nicholas Nethercote 2025-02-03 09:02:34 +11:00
parent e08cd3cf05
commit 17e4aec449
2 changed files with 2 additions and 2 deletions

View file

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

View file

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