From 6b7f3e50df3b4235756df9354ea90cf821460a8b Mon Sep 17 00:00:00 2001 From: lcnr/Bastian Kauschke Date: Sat, 18 Jan 2020 14:43:08 +0100 Subject: [PATCH] improve type_name_of_val docs --- src/libcore/any.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libcore/any.rs b/src/libcore/any.rs index 7935c9b1b392d..c5dcdfed12ae0 100644 --- a/src/libcore/any.rs +++ b/src/libcore/any.rs @@ -476,11 +476,15 @@ pub const fn type_name() -> &'static str { /// /// This is intended for diagnostic use. The exact contents and format of the /// string are not specified, other than being a best-effort description of the -/// type. For example, `type_name_of::>(None)` could return +/// type. For example, `type_name_of_val::>(None)` could return /// `"Option"` or `"std::option::Option"`, but not /// `"foobar"`. In addition, the output may change between versions of the /// compiler. /// +/// This function does not resolve trait objects, +/// meaning that `type_name_of_val(&7u32 as &dyn Debug)` +/// may return `"dyn Debug"`, but not `"u32"`. +/// /// The type name should not be considered a unique identifier of a type; /// multiple types may share the same type name. ///