File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -476,11 +476,15 @@ pub const fn type_name<T: ?Sized>() -> &'static str {
476476///
477477/// This is intended for diagnostic use. The exact contents and format of the
478478/// string are not specified, other than being a best-effort description of the
479- /// type. For example, `type_name_of ::<Option<String>>(None)` could return
479+ /// type. For example, `type_name_of_val ::<Option<String>>(None)` could return
480480/// `"Option<String>"` or `"std::option::Option<std::string::String>"`, but not
481481/// `"foobar"`. In addition, the output may change between versions of the
482482/// compiler.
483483///
484+ /// This function does not resolve trait objects,
485+ /// meaning that `type_name_of_val(&7u32 as &dyn Debug)`
486+ /// may return `"dyn Debug"`, but not `"u32"`.
487+ ///
484488/// The type name should not be considered a unique identifier of a type;
485489/// multiple types may share the same type name.
486490///
You can’t perform that action at this time.
0 commit comments