Skip to content

Commit 4038dc9

Browse files
committed
Adjusted documentation further
1 parent 18a5598 commit 4038dc9

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

library/core/src/any.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -898,12 +898,11 @@ pub const fn type_name_of_val<T: ?Sized>(_val: &T) -> &'static str {
898898
}
899899

900900

901-
/// Attempts to view `T` as a reference to the trait object `U`.
902-
///
903-
/// Returns `Some(&U)` if the type `T` implements `U`, and `None` otherwise.
901+
902+
/// Returns `Some(&U)` if `T` can be coerced to the trait object type `U`. Otherwise, it returns `None`.
904903
///
905904
/// # Compile-time failures
906-
/// Determining whether `T` implements `U` requires trait resolution by the compiler.
905+
/// Determining whether `T` can be coerced to the trait object type `U` requires compiler trait resolution.
907906
/// In some cases, that resolution can exceed the recursion limit,
908907
/// and compilation will fail *instead of* this function returning `None`.
909908
/// # Examples
@@ -953,12 +952,11 @@ pub const fn try_as_dyn<
953952
}
954953
}
955954

956-
/// Attempts to view `T` as a reference to the trait object `U`.
957-
///
958-
/// Returns `Some(&mut U)` if the type `T` implements `U`, and `None` otherwise.
955+
956+
/// Returns `Some(&mut U)` if `T` can be coerced to the trait object type `U`. Otherwise, it returns `None`.
959957
///
960958
/// # Compile-time failures
961-
/// Determining whether `T` implements `U` requires trait resolution by the compiler.
959+
/// Determining whether `T` can be coerced to the trait object type `U` requires compiler trait resolution.
962960
/// In some cases, that resolution can exceed the recursion limit,
963961
/// and compilation will fail *instead of* this function returning `None`.
964962
/// # Examples

library/core/src/intrinsics/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2657,10 +2657,10 @@ pub unsafe fn vtable_size(ptr: *const ()) -> usize;
26572657
#[rustc_intrinsic]
26582658
pub unsafe fn vtable_align(ptr: *const ()) -> usize;
26592659

2660-
/// The intrinsic returns the vtable of `T` through the lens of `U`.
2660+
/// The intrinsic returns the `U` vtable for `T` if `T` can be coerced to the trait object type `U`.
26612661
///
26622662
/// # Compile-time failures
2663-
/// Determining whether `T` implements `U` requires trait resolution by the compiler.
2663+
/// Determining whether `T` can be coerced to the trait object type `U` requires trait resolution by the compiler.
26642664
/// In some cases, that resolution can exceed the recursion limit,
26652665
/// and compilation will fail *instead of* this function returning `None`.
26662666
///

0 commit comments

Comments
 (0)