#Rust downcast trait object code
The compatibility considerations here arise in nightly-only code that used the short-circuiting behavior of all to write something like cfg(all(feature = "nightly", syntax-requiring-nightly)), which will now fail to compile.
Make std::io::stdio::lock() return 'static handles.
#Rust downcast trait object windows
Consistently show absent stdio handles on Windows as NULL handles.# messages are printed when running tests.ManuallyDrop is now documented to have the same layout as T.The # attribute can now be used with aarch64 features.The char type is now described as UTF-32 in debuginfo.Linking modifier syntax in # attributes and on the command line, as well as the whole-archive modifier specifically, are now supported.Recursive calls can now set the value of a function's opaque impl Trait return type.Function pointers can now be created, cast, and passed around in a const fn.const fn signatures can now use impl Trait in argument and return position.const fn signatures can now include generic trait bounds.This goes against the concept of separation of concerns and can make your code difficult to understand.Īlternatives to this approach are discussed in my blog post Don't use boxed trait objects for struct internals. Traits exist to create a boundary between the different levels of abstraction, they're not supposed to be able to see outside their own little world. There's a reason why this is so tedious to do and why there's not many usages of this trait in the standard library - it's almost always a bad idea. Meaning you couldn't downcast from traits from the standard library. Unfortunately, much like using Any, these crates only enable downcasting of traits that you own, There's a few crates for making this process easier. Voilà! You can now freely and carelessly convert between levels of abstraction.