add safety note to `downcast_into_unchecked`

This commit is contained in:
David Hewitt 2023-12-21 15:51:56 +00:00
parent 3092289020
commit 4ac6a6bf15
1 changed files with 4 additions and 0 deletions

View File

@ -1617,6 +1617,10 @@ pub trait PyAnyMethods<'py> {
unsafe fn downcast_unchecked<T>(&self) -> &Bound<'py, T>;
/// Like `downcast_unchecked` but takes ownership of `self`.
///
/// # Safety
///
/// Callers must ensure that the type is valid or risk type confusion.
unsafe fn downcast_into_unchecked<T>(self) -> Bound<'py, T>;
/// Extracts some type from the Python object.