about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorlcnr/Bastian Kauschke <bastian_kauschke@hotmail.de>2020-01-18 14:43:08 +0100
committerlcnr/Bastian Kauschke <bastian_kauschke@hotmail.de>2020-01-18 14:43:08 +0100
commit6b7f3e50df3b4235756df9354ea90cf821460a8b (patch)
treeff0256b9082ad102387f6f76614617d5e36b9ab0 /src/libcore
parente28153e7a60f2ba62aa438e68cf086f07f0d3894 (diff)
downloadrust-6b7f3e50df3b4235756df9354ea90cf821460a8b.tar.gz
rust-6b7f3e50df3b4235756df9354ea90cf821460a8b.zip
improve type_name_of_val docs
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/any.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/libcore/any.rs b/src/libcore/any.rs
index 7935c9b1b39..c5dcdfed12a 100644
--- a/src/libcore/any.rs
+++ b/src/libcore/any.rs
@@ -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.
 ///