Difference between these two trait defs?

⚓ Rust    📅 2026-03-14    👤 surdeus    👁️ 4      

surdeus

Came across them in this topic

trait Env<'arena> {
    type Arena: 'static;
    fn init() -> Self::Arena;
}
trait HasArena {
    type Arena;
}

trait Env<'arena>: HasArena {
    fn init() -> Self::Arena;
}

Ignoring the different places the associated type is defined in, do they behave differently? (It's known that they behave differently from this definition; see the linked topic)

trait Env<'arena> {
    type Arena;
    fn init() -> Self::Arena;
}

2 posts - 2 participants

Read full topic

🏷️ Rust_feed