We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent db579d3 commit 852c332Copy full SHA for 852c332
library/core/src/any.rs
@@ -910,6 +910,8 @@ pub const fn downcast_trait<
910
match vtable {
911
Some(dyn_metadata) => {
912
let pointer = ptr::from_raw_parts(t, dyn_metadata);
913
+ // SAFETY: `t` is a reference to a type, so we know it is valid.
914
+ // `dyn_metadata` is a vtable for T, implementing the trait of `U`.
915
Some(unsafe { &*pointer })
916
}
917
None => None,
0 commit comments