-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add doc aliases for a lot of the C standard library #81988
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -887,6 +887,7 @@ pub const fn replace<T>(dest: &mut T, src: T) -> T { | |
/// | ||
/// [`RefCell`]: crate::cell::RefCell | ||
#[doc(alias = "delete")] | ||
#[doc(alias = "free")] | ||
Comment on lines
889
to
+890
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm very surprised someone added There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This alias does seem very reasonable to add. |
||
#[inline] | ||
#[stable(feature = "rust1", since = "1.0.0")] | ||
pub fn drop<T>(_x: T) {} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -782,6 +782,10 @@ macro_rules! from_str_radix_int_impl { | |
#[stable(feature = "rust1", since = "1.0.0")] | ||
impl FromStr for $t { | ||
type Err = ParseIntError; | ||
#[doc(alias = "atoi")] | ||
#[doc(alias = "atol")] | ||
#[doc(alias = "strtod")] | ||
#[doc(alias = "strtol")] | ||
Comment on lines
+785
to
+788
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I figured these were all "close enough" since |
||
fn from_str(src: &str) -> Result<Self, ParseIntError> { | ||
from_str_radix(src, 10) | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -162,6 +162,8 @@ pub enum Option<T> { | |
/// No value | ||
#[lang = "None"] | ||
#[stable(feature = "rust1", since = "1.0.0")] | ||
#[doc(alias = "null")] | ||
#[doc(alias = "nil")] | ||
Comment on lines
+165
to
+166
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. C does not have There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can separate this into a separate PR if you like, but I think the aliases are useful.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Still, writing the original name would be better, no? Otherwise we should change e.g. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mean, I guess you want to keep |
||
None, | ||
/// Some value `T` | ||
#[lang = "Some"] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1034,6 +1034,8 @@ impl str { | |
/// assert_eq!(s.find(x), None); | ||
/// ``` | ||
#[stable(feature = "rust1", since = "1.0.0")] | ||
#[doc(alias = "strstr")] | ||
#[doc(alias = "strchr")] | ||
#[inline] | ||
pub fn find<'a, P: Pattern<'a>>(&'a self, pat: P) -> Option<usize> { | ||
pat.into_searcher(self).next_match().map(|(i, _)| i) | ||
|
@@ -1080,6 +1082,7 @@ impl str { | |
/// assert_eq!(s.rfind(x), None); | ||
/// ``` | ||
#[stable(feature = "rust1", since = "1.0.0")] | ||
#[doc(alias = "strrchr")] | ||
#[inline] | ||
pub fn rfind<'a, P>(&'a self, pat: P) -> Option<usize> | ||
where | ||
|
@@ -1202,6 +1205,7 @@ impl str { | |
/// | ||
/// [`split_whitespace`]: str::split_whitespace | ||
#[stable(feature = "rust1", since = "1.0.0")] | ||
#[doc(alias = "strtok")] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one is iffy, but C doesn't really have a split function and I didn't know where else to put strtok. |
||
#[inline] | ||
pub fn split<'a, P: Pattern<'a>>(&'a self, pat: P) -> Split<'a, P> { | ||
Split(SplitInternal { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -881,6 +881,7 @@ impl Command { | |
/// assert!(output.status.success()); | ||
/// ``` | ||
#[stable(feature = "process", since = "1.0.0")] | ||
#[doc(alias = "system")] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This could also go under |
||
pub fn output(&mut self) -> io::Result<Output> { | ||
self.inner | ||
.spawn(imp::Stdio::MakePipe, false) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is moderately iffy because you have to pass a radix of 16, but it's close enough.