Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardRustObject safety rulesSingle-choice MCQ

Why does adding this method make the trait dyn-incompatible, so `&dyn Source` is rejected even though the method takes `&self`?

trait Source { fn stream(&self) -> impl Iterator<Item = u8>; } fn use_it(s: &dyn Source) { let _ = s.stream(); }