Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions library/std/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ macro_rules! panic {
/// io::stdout().flush().unwrap();
/// ```
#[macro_export]
#[doc(alias = "echo")]
#[doc(alias = "print")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kinda useless no? :p

#[doc(alias = "printf")]
#[doc(alias = "console.log")]
#[doc(alias = "log")]
#[doc(alias = "puts")]
#[stable(feature = "rust1", since = "1.0.0")]
#[allow_internal_unstable(print_internals)]
macro_rules! print {
Expand Down Expand Up @@ -88,6 +94,12 @@ macro_rules! print {
/// println!("format {} arguments", "some");
/// ```
#[macro_export]
#[doc(alias = "echo")]
#[doc(alias = "print")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's a good idea to add this alias. They'll find the print macro which talks about the println one.

#[doc(alias = "printf")]
#[doc(alias = "console.log")]
#[doc(alias = "log")]
#[doc(alias = "puts")]
#[stable(feature = "rust1", since = "1.0.0")]
#[allow_internal_unstable(print_internals, format_args_nl)]
macro_rules! println {
Expand Down Expand Up @@ -119,6 +131,12 @@ macro_rules! println {
/// eprint!("Error: Could not complete task");
/// ```
#[macro_export]
#[doc(alias = "echo")]
#[doc(alias = "print")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't add it.

#[doc(alias = "printf")]
#[doc(alias = "console.log")]
#[doc(alias = "log")]
#[doc(alias = "puts")]
#[stable(feature = "eprint", since = "1.19.0")]
#[allow_internal_unstable(print_internals)]
macro_rules! eprint {
Expand Down Expand Up @@ -147,6 +165,12 @@ macro_rules! eprint {
/// eprintln!("Error: Could not complete task");
/// ```
#[macro_export]
#[doc(alias = "echo")]
#[doc(alias = "print")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't add it.

#[doc(alias = "printf")]
#[doc(alias = "console.log")]
#[doc(alias = "log")]
#[doc(alias = "puts")]
#[stable(feature = "eprint", since = "1.19.0")]
#[allow_internal_unstable(print_internals, format_args_nl)]
macro_rules! eprintln {
Expand Down Expand Up @@ -280,6 +304,13 @@ macro_rules! eprintln {
/// [`debug!`]: https://docs.rs/log/*/log/macro.debug.html
/// [`log`]: https://crates.io/crates/log
#[macro_export]
#[doc(alias = "echo")]
#[doc(alias = "print")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't add it.

#[doc(alias = "printf")]
#[doc(alias = "console.log")]
#[doc(alias = "log")]
#[doc(alias = "puts")]
#[doc(alias = "println")]
#[stable(feature = "dbg_macro", since = "1.32.0")]
macro_rules! dbg {
() => {
Expand Down
1 change: 1 addition & 0 deletions src/test/rustdoc-js-std/macro-print.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const QUERY = 'macro:print';
const EXPECTED = {
'others': [
{ 'path': 'std', 'name': 'print' },
{ 'path': 'std', 'name': 'dbg' },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change?

{ 'path': 'std', 'name': 'eprint' },
{ 'path': 'std', 'name': 'println' },
{ 'path': 'std', 'name': 'eprintln' },
Expand Down