Open
Description
What it does
Functions taking &dyn Any will accept any 'static
argument. Passing a &Box<dyn Any>
(or other smart pointer, or upcasting another trait object that implies Any
) is therefore possible, but probably not intended.
Advantage
Probably the intended effect.
Drawbacks
In rare cases someone might do this on purpose, but that's weird enough to merit explicit documentation.
Example
let x: &Box<dyn Any>;
frob(x)
Could be written as:
let x: &Box<dyn Any>;
frob(&**x)