Skip to content

Commit d339b89

Browse files
committed
Use consistent phrasing for all macro summaries
1 parent fbd34ef commit d339b89

File tree

2 files changed

+46
-44
lines changed

2 files changed

+46
-44
lines changed

src/libcore/macros.rs

+23-22
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
/// Entry point of thread panic. For details, see `std::macros`.
1+
/// Panics the current thread.
2+
///
3+
/// For details, see `std::macros`.
24
#[macro_export]
35
#[allow_internal_unstable(core_panic, __rust_unstable_column)]
46
#[stable(feature = "core", since = "1.6.0")]
@@ -132,7 +134,7 @@ macro_rules! assert_ne {
132134
});
133135
}
134136

135-
/// Ensure that a boolean expression is `true` at runtime.
137+
/// Asserts that a boolean expression is `true` at runtime.
136138
///
137139
/// This will invoke the [`panic!`] macro if the provided expression cannot be
138140
/// evaluated to `true` at runtime.
@@ -236,8 +238,7 @@ macro_rules! debug_assert_ne {
236238
($($arg:tt)*) => (if cfg!(debug_assertions) { assert_ne!($($arg)*); })
237239
}
238240

239-
/// Helper macro for reducing boilerplate code for matching `Result` together
240-
/// with converting downstream errors.
241+
/// Unwraps a result or propagates its error.
241242
///
242243
/// The `?` operator was added to replace `try!` and should be used instead.
243244
/// Furthermore, `try` is a reserved word in Rust 2018, so if you must use
@@ -312,7 +313,7 @@ macro_rules! r#try {
312313
($expr:expr,) => (r#try!($expr));
313314
}
314315

315-
/// Write formatted data into a buffer.
316+
/// Writes formatted data into a buffer.
316317
///
317318
/// This macro accepts a format string, a list of arguments, and a 'writer'. Arguments will be
318319
/// formatted according to the specified format string and the result will be passed to the writer.
@@ -434,7 +435,7 @@ macro_rules! writeln {
434435
);
435436
}
436437

437-
/// A utility macro for indicating unreachable code.
438+
/// Indicates unreachable code.
438439
///
439440
/// This is useful any time that the compiler can't determine that some code is unreachable. For
440441
/// example:
@@ -502,7 +503,7 @@ macro_rules! unreachable {
502503
});
503504
}
504505

505-
/// A standardized placeholder for marking unfinished code.
506+
/// Indicates unfinished code.
506507
///
507508
/// This can be useful if you are prototyping and are just looking to have your
508509
/// code type-check, or if you're implementing a trait that requires multiple
@@ -559,10 +560,10 @@ macro_rules! unimplemented {
559560
($($arg:tt)+) => (panic!("not yet implemented: {}", format_args!($($arg)*)));
560561
}
561562

562-
/// A standardized placeholder for marking unfinished code.
563+
/// Indicates unfinished code.
563564
///
564565
/// This can be useful if you are prototyping and are just looking to have your
565-
/// code typecheck. `todo!` works exactly like `unimplemented!`, there only
566+
/// code typecheck. `todo!` works exactly like `unimplemented!`. The only
566567
/// difference between the two macros is the name.
567568
///
568569
/// # Panics
@@ -618,7 +619,7 @@ macro_rules! todo {
618619
($($arg:tt)+) => (panic!("not yet implemented: {}", format_args!($($arg)*)));
619620
}
620621

621-
/// A macro to create an array of [`MaybeUninit`]
622+
/// Creates an array of [`MaybeUninit`].
622623
///
623624
/// This macro constructs an uninitialized array of the type `[MaybeUninit<K>; N]`.
624625
///
@@ -645,7 +646,7 @@ macro_rules! uninitialized_array {
645646
#[cfg(rustdoc)]
646647
mod builtin {
647648

648-
/// Unconditionally causes compilation to fail with the given error message when encountered.
649+
/// Causes compilation to fail with the given error message when encountered.
649650
///
650651
/// For more information, see the documentation for [`std::compile_error!`].
651652
///
@@ -657,7 +658,7 @@ mod builtin {
657658
($msg:expr,) => ({ /* compiler built-in */ });
658659
}
659660

660-
/// The core macro for formatted string creation & output.
661+
/// Constructs parameters for the other string-formatting macros.
661662
///
662663
/// For more information, see the documentation for [`std::format_args!`].
663664
///
@@ -669,7 +670,7 @@ mod builtin {
669670
($fmt:expr, $($args:tt)*) => ({ /* compiler built-in */ });
670671
}
671672

672-
/// Inspect an environment variable at compile time.
673+
/// Inspects an environment variable at compile time.
673674
///
674675
/// For more information, see the documentation for [`std::env!`].
675676
///
@@ -681,7 +682,7 @@ mod builtin {
681682
($name:expr,) => ({ /* compiler built-in */ });
682683
}
683684

684-
/// Optionally inspect an environment variable at compile time.
685+
/// Optionally inspects an environment variable at compile time.
685686
///
686687
/// For more information, see the documentation for [`std::option_env!`].
687688
///
@@ -693,7 +694,7 @@ mod builtin {
693694
($name:expr,) => ({ /* compiler built-in */ });
694695
}
695696

696-
/// Concatenate identifiers into one identifier.
697+
/// Concatenates identifiers into one identifier.
697698
///
698699
/// For more information, see the documentation for [`std::concat_idents!`].
699700
///
@@ -717,7 +718,7 @@ mod builtin {
717718
($($e:expr,)*) => ({ /* compiler built-in */ });
718719
}
719720

720-
/// A macro which expands to the line number on which it was invoked.
721+
/// Expands to the line number on which it was invoked.
721722
///
722723
/// For more information, see the documentation for [`std::line!`].
723724
///
@@ -726,7 +727,7 @@ mod builtin {
726727
#[rustc_doc_only_macro]
727728
macro_rules! line { () => ({ /* compiler built-in */ }) }
728729

729-
/// A macro which expands to the column number on which it was invoked.
730+
/// Expands to the column number on which it was invoked.
730731
///
731732
/// For more information, see the documentation for [`std::column!`].
732733
///
@@ -735,7 +736,7 @@ mod builtin {
735736
#[rustc_doc_only_macro]
736737
macro_rules! column { () => ({ /* compiler built-in */ }) }
737738

738-
/// A macro which expands to the file name from which it was invoked.
739+
/// Expands to the file name from which it was invoked.
739740
///
740741
/// For more information, see the documentation for [`std::file!`].
741742
///
@@ -744,7 +745,7 @@ mod builtin {
744745
#[rustc_doc_only_macro]
745746
macro_rules! file { () => ({ /* compiler built-in */ }) }
746747

747-
/// A macro which stringifies its arguments.
748+
/// Stringifies its arguments.
748749
///
749750
/// For more information, see the documentation for [`std::stringify!`].
750751
///
@@ -786,7 +787,7 @@ mod builtin {
786787
#[rustc_doc_only_macro]
787788
macro_rules! module_path { () => ({ /* compiler built-in */ }) }
788789

789-
/// Boolean evaluation of configuration flags, at compile-time.
790+
/// Evaluates boolean combinations of configuration flags, at compile-time.
790791
///
791792
/// For more information, see the documentation for [`std::cfg!`].
792793
///
@@ -795,7 +796,7 @@ mod builtin {
795796
#[rustc_doc_only_macro]
796797
macro_rules! cfg { ($($cfg:tt)*) => ({ /* compiler built-in */ }) }
797798

798-
/// Parse a file as an expression or an item according to the context.
799+
/// Parses a file as an expression or an item according to the context.
799800
///
800801
/// For more information, see the documentation for [`std::include!`].
801802
///
@@ -807,7 +808,7 @@ mod builtin {
807808
($file:expr,) => ({ /* compiler built-in */ });
808809
}
809810

810-
/// Ensure that a boolean expression is `true` at runtime.
811+
/// Asserts that a boolean expression is `true` at runtime.
811812
///
812813
/// For more information, see the documentation for [`std::assert!`].
813814
///

src/libstd/macros.rs

+23-22
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//! library. Each macro is available for use when linking against the standard
55
//! library.
66
7-
/// The entry point for panic of Rust threads.
7+
/// Panics the current thread.
88
///
99
/// This allows a program to terminate immediately and provide feedback
1010
/// to the caller of the program. `panic!` should be used when a program reaches
@@ -70,7 +70,7 @@ macro_rules! panic {
7070
});
7171
}
7272

73-
/// Macro for printing to the standard output.
73+
/// Prints to the standard output.
7474
///
7575
/// Equivalent to the [`println!`] macro except that a newline is not printed at
7676
/// the end of the message.
@@ -116,7 +116,7 @@ macro_rules! print {
116116
($($arg:tt)*) => ($crate::io::_print(format_args!($($arg)*)));
117117
}
118118

119-
/// Macro for printing to the standard output, with a newline.
119+
/// Prints to the standard output, with a newline.
120120
///
121121
/// On all platforms, the newline is the LINE FEED character (`\n`/`U+000A`) alone
122122
/// (no additional CARRIAGE RETURN (`\r`/`U+000D`).
@@ -151,7 +151,7 @@ macro_rules! println {
151151
})
152152
}
153153

154-
/// Macro for printing to the standard error.
154+
/// Prints to the standard error.
155155
///
156156
/// Equivalent to the [`print!`] macro, except that output goes to
157157
/// [`io::stderr`] instead of `io::stdout`. See [`print!`] for
@@ -179,7 +179,7 @@ macro_rules! eprint {
179179
($($arg:tt)*) => ($crate::io::_eprint(format_args!($($arg)*)));
180180
}
181181

182-
/// Macro for printing to the standard error, with a newline.
182+
/// Prints to the standard error, with a newline.
183183
///
184184
/// Equivalent to the [`println!`] macro, except that output goes to
185185
/// [`io::stderr`] instead of `io::stdout`. See [`println!`] for
@@ -210,8 +210,9 @@ macro_rules! eprintln {
210210
})
211211
}
212212

213-
/// A macro for quick and dirty debugging with which you can inspect
214-
/// the value of a given expression. An example:
213+
/// Prints the value of a given expression for quick and dirty debugging.
214+
///
215+
/// An example:
215216
///
216217
/// ```rust
217218
/// let a = 2;
@@ -328,7 +329,7 @@ macro_rules! dbg {
328329
}
329330
}
330331

331-
/// A macro to await on an async call.
332+
/// Awaits the completion of an async call.
332333
#[macro_export]
333334
#[unstable(feature = "await_macro", issue = "50547")]
334335
#[allow_internal_unstable(gen_future, generators)]
@@ -351,7 +352,7 @@ macro_rules! r#await {
351352
} }
352353
}
353354

354-
/// A macro to select an event from a number of receivers.
355+
/// Selects the first successful receive event from a number of receivers.
355356
///
356357
/// This macro is used to wait for the first event to occur on a number of
357358
/// receivers. It places no restrictions on the types of receivers given to
@@ -423,7 +424,7 @@ macro_rules! assert_approx_eq {
423424
#[cfg(rustdoc)]
424425
mod builtin {
425426

426-
/// Unconditionally causes compilation to fail with the given error message when encountered.
427+
/// Causes compilation to fail with the given error message when encountered.
427428
///
428429
/// This macro should be used when a crate uses a conditional compilation strategy to provide
429430
/// better error messages for erroneous conditions. It's the compiler-level form of [`panic!`],
@@ -465,7 +466,7 @@ mod builtin {
465466
($msg:expr,) => ({ /* compiler built-in */ });
466467
}
467468

468-
/// The core macro for formatted string creation & output.
469+
/// Constructs parameters for the other string-formatting macros.
469470
///
470471
/// This macro functions by taking a formatting string literal containing
471472
/// `{}` for each additional argument passed. `format_args!` prepares the
@@ -517,7 +518,7 @@ mod builtin {
517518
($fmt:expr, $($args:tt)*) => ({ /* compiler built-in */ });
518519
}
519520

520-
/// Inspect an environment variable at compile time.
521+
/// Inspects an environment variable at compile time.
521522
///
522523
/// This macro will expand to the value of the named environment variable at
523524
/// compile time, yielding an expression of type `&'static str`.
@@ -555,7 +556,7 @@ mod builtin {
555556
($name:expr,) => ({ /* compiler built-in */ });
556557
}
557558

558-
/// Optionally inspect an environment variable at compile time.
559+
/// Optionally inspects an environment variable at compile time.
559560
///
560561
/// If the named environment variable is present at compile time, this will
561562
/// expand into an expression of type `Option<&'static str>` whose value is
@@ -581,7 +582,7 @@ mod builtin {
581582
($name:expr,) => ({ /* compiler built-in */ });
582583
}
583584

584-
/// Concatenate identifiers into one identifier.
585+
/// Concatenates identifiers into one identifier.
585586
///
586587
/// This macro takes any number of comma-separated identifiers, and
587588
/// concatenates them all into one, yielding an expression which is a new
@@ -634,7 +635,7 @@ mod builtin {
634635
($($e:expr,)*) => ({ /* compiler built-in */ });
635636
}
636637

637-
/// A macro which expands to the line number on which it was invoked.
638+
/// Expands to the line number on which it was invoked.
638639
///
639640
/// With [`column!`] and [`file!`], these macros provide debugging information for
640641
/// developers about the location within the source.
@@ -659,7 +660,7 @@ mod builtin {
659660
#[rustc_doc_only_macro]
660661
macro_rules! line { () => ({ /* compiler built-in */ }) }
661662

662-
/// A macro which expands to the column number on which it was invoked.
663+
/// Expands to the column number at which it was invoked.
663664
///
664665
/// With [`line!`] and [`file!`], these macros provide debugging information for
665666
/// developers about the location within the source.
@@ -684,7 +685,7 @@ mod builtin {
684685
#[rustc_doc_only_macro]
685686
macro_rules! column { () => ({ /* compiler built-in */ }) }
686687

687-
/// A macro which expands to the file name from which it was invoked.
688+
/// Expands to the file name in which it was invoked.
688689
///
689690
/// With [`line!`] and [`column!`], these macros provide debugging information for
690691
/// developers about the location within the source.
@@ -708,7 +709,7 @@ mod builtin {
708709
#[rustc_doc_only_macro]
709710
macro_rules! file { () => ({ /* compiler built-in */ }) }
710711

711-
/// A macro which stringifies its arguments.
712+
/// Stringifies its arguments.
712713
///
713714
/// This macro will yield an expression of type `&'static str` which is the
714715
/// stringification of all the tokens passed to the macro. No restrictions
@@ -822,7 +823,7 @@ mod builtin {
822823
#[rustc_doc_only_macro]
823824
macro_rules! module_path { () => ({ /* compiler built-in */ }) }
824825

825-
/// Boolean evaluation of configuration flags, at compile-time.
826+
/// Evaluates boolean combinations of configuration flags at compile-time.
826827
///
827828
/// In addition to the `#[cfg]` attribute, this macro is provided to allow
828829
/// boolean expression evaluation of configuration flags. This frequently
@@ -844,7 +845,7 @@ mod builtin {
844845
#[rustc_doc_only_macro]
845846
macro_rules! cfg { ($($cfg:tt)*) => ({ /* compiler built-in */ }) }
846847

847-
/// Parse a file as an expression or an item according to the context.
848+
/// Parses a file as an expression or an item according to the context.
848849
///
849850
/// The file is located relative to the current file (similarly to how
850851
/// modules are found).
@@ -890,7 +891,7 @@ mod builtin {
890891
($file:expr,) => ({ /* compiler built-in */ });
891892
}
892893

893-
/// Ensure that a boolean expression is `true` at runtime.
894+
/// Asserts that a boolean expression is `true` at runtime.
894895
///
895896
/// This will invoke the [`panic!`] macro if the provided expression cannot be
896897
/// evaluated to `true` at runtime.
@@ -944,7 +945,7 @@ mod builtin {
944945
}
945946
}
946947

947-
/// A macro for defining `#[cfg]` if-else statements.
948+
/// Defines `#[cfg]` if-else statements.
948949
///
949950
/// This is similar to the `if/elif` C preprocessor macro by allowing definition
950951
/// of a cascade of `#[cfg]` cases, emitting the implementation which matches

0 commit comments

Comments
 (0)