Trait objects in Rust automatically handle lifetimes through the reference they contain, requiring no explicit annotation.
Trait objects (dyn Trait) do not require explicit lifetime annotations because the reference inside the object carries its own lifetime.
fn process(obj: &dyn std::fmt::Display) {
println!("{obj}");
}
The compiler infers the lifetime of the reference & automatically, ensuring the data behind the trait object outlives the function call.
Trait objects let you treat different types as the same thing if they share a common behavior. You don't need to manually track how long these objects last because the system automatically ensures the data stays alive while you are using it. Think of it like a universal remote: you don't need to know the battery life of every TV it controls, you just know it works as long as the remote is in your hand.