Rollup merge of #68342 - lcnr:type_name_docs, r=Dylan-DPC

improve type_name_of_val docs

suggested by @Globidev in https://github.com/rust-lang/rust/issues/66359#issuecomment-575016612
This commit is contained in:
Mazdak Farrokhzad 2020-01-18 19:36:08 +01:00 committed by GitHub
commit e8819b62b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -476,11 +476,15 @@ pub const fn type_name<T: ?Sized>() -> &'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::<Option<String>>(None)` could return
/// type. For example, `type_name_of_val::<Option<String>>(None)` could return
/// `"Option<String>"` or `"std::option::Option<std::string::String>"`, 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.
///