about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMara Bos <m-ou.se@m-ou.se>2020-12-28 19:09:34 +0000
committerGitHub <noreply@github.com>2020-12-28 19:09:34 +0000
commit5a081620b012e3fcf670286d06511bbce91e7ecd (patch)
tree6a636cc3c28cdcd2b97123d7b345a835a57474d9
parente351a3b2ec918b43f9ad2713b40861e4ccb97fa0 (diff)
parentb3be9e10926f75740f0a5d126e8c8532d2c76ed2 (diff)
downloadrust-5a081620b012e3fcf670286d06511bbce91e7ecd.tar.gz
rust-5a081620b012e3fcf670286d06511bbce91e7ecd.zip
Rollup merge of #80431 - xfix:add-chr-as-doc-alias, r=steveklabnik
Add "chr" as doc alias to char::from_u32

Many programming languages provide a function called `chr` - Perl, Python, PHP, Visual Basic, SQL. This change makes `char::from_u32` easier to discover in the documentation.

`ord` is not added as its name conflicts with `Ord` trait, and it's not exactly clear what it could point to (`<u32 as From<char>>::from`?). I don't think it's exactly necessary, as `char::from_u32` documentation page says you can do reverse conversion with `as` operator anyway.
-rw-r--r--library/core/src/char/convert.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/library/core/src/char/convert.rs b/library/core/src/char/convert.rs
index 394db5b5917..de05a8c82e8 100644
--- a/library/core/src/char/convert.rs
+++ b/library/core/src/char/convert.rs
@@ -47,6 +47,7 @@ use super::MAX;
 ///
 /// assert_eq!(None, c);
 /// ```
+#[doc(alias = "chr")]
 #[inline]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub fn from_u32(i: u32) -> Option<char> {