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 e2cad12 commit 0348628Copy full SHA for 0348628
library/core/src/any.rs
@@ -920,6 +920,8 @@ pub const fn downcast_trait<
920
match vtable {
921
Some(dyn_metadata) => {
922
let pointer = ptr::from_raw_parts(t, dyn_metadata);
923
+ // SAFETY: `t` is a reference to a type, so we know it is valid.
924
+ // `dyn_metadata` is a vtable for T, implementing the trait of `U`.
925
Some(unsafe { &*pointer })
926
}
927
None => None,
0 commit comments