Skip to content

Commit b652cb8

Browse files
committed
Auto merge of rust-lang#116408 - matthiaskrgr:rollup-hmolg4m, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - rust-lang#115961 (Replace 'mutex' with 'lock' in RwLock documentation) - rust-lang#116146 (Clarify `arg` and `args` documentation) - rust-lang#116363 (Adapt `todo!` documentation to mention displaying custom values) - rust-lang#116365 (bootstrap: make copying linker binaries conditional) - rust-lang#116388 (rustdoc: fix & clean up handling of cross-crate higher-ranked parameters) - rust-lang#116393 (Emit feature gate *warning* for `auto` traits pre-expansion) - rust-lang#116395 (Mark myself as vacation or whatever) r? `@ghost` `@rustbot` modify labels: rollup
2 parents a8fe525 + c0c76ed commit b652cb8

File tree

3 files changed

+28
-14
lines changed

3 files changed

+28
-14
lines changed

core/src/macros/mod.rs

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,8 @@ macro_rules! unreachable {
719719
/// The difference between `unimplemented!` and [`todo!`] is that while `todo!`
720720
/// conveys an intent of implementing the functionality later and the message is "not yet
721721
/// implemented", `unimplemented!` makes no such claims. Its message is "not implemented".
722-
/// Also some IDEs will mark `todo!`s.
722+
///
723+
/// Also, some IDEs will mark `todo!`s.
723724
///
724725
/// # Panics
725726
///
@@ -805,50 +806,63 @@ macro_rules! unimplemented {
805806
/// The difference between [`unimplemented!`] and `todo!` is that while `todo!` conveys
806807
/// an intent of implementing the functionality later and the message is "not yet
807808
/// implemented", `unimplemented!` makes no such claims. Its message is "not implemented".
808-
/// Also some IDEs will mark `todo!`s.
809+
///
810+
/// Also, some IDEs will mark `todo!`s.
809811
///
810812
/// # Panics
811813
///
812-
/// This will always [`panic!`].
814+
/// This will always [`panic!`] because `todo!` is just a shorthand for `panic!` with a
815+
/// fixed, specific message.
816+
///
817+
/// Like `panic!`, this macro has a second form for displaying custom values.
813818
///
814819
/// # Examples
815820
///
816821
/// Here's an example of some in-progress code. We have a trait `Foo`:
817822
///
818823
/// ```
819824
/// trait Foo {
820-
/// fn bar(&self);
825+
/// fn bar(&self) -> u8;
821826
/// fn baz(&self);
827+
/// fn qux(&self) -> Result<u64, ()>;
822828
/// }
823829
/// ```
824830
///
825831
/// We want to implement `Foo` on one of our types, but we also want to work on
826832
/// just `bar()` first. In order for our code to compile, we need to implement
827-
/// `baz()`, so we can use `todo!`:
833+
/// `baz()` and `qux()`, so we can use `todo!`:
828834
///
829835
/// ```
830836
/// # trait Foo {
831-
/// # fn bar(&self);
837+
/// # fn bar(&self) -> u8;
832838
/// # fn baz(&self);
839+
/// # fn qux(&self) -> Result<u64, ()>;
833840
/// # }
834841
/// struct MyStruct;
835842
///
836843
/// impl Foo for MyStruct {
837-
/// fn bar(&self) {
838-
/// // implementation goes here
844+
/// fn bar(&self) -> u8 {
845+
/// 1 + 1
839846
/// }
840847
///
841848
/// fn baz(&self) {
842-
/// // let's not worry about implementing baz() for now
849+
/// // Let's not worry about implementing baz() for now
843850
/// todo!();
844851
/// }
852+
///
853+
/// fn qux(&self) -> Result<u64, ()> {
854+
/// // We can add a message to todo! to display our omission.
855+
/// // This will display:
856+
/// // "thread 'main' panicked at 'not yet implemented: MyStruct is not yet quxable'".
857+
/// todo!("MyStruct is not yet quxable");
858+
/// }
845859
/// }
846860
///
847861
/// fn main() {
848862
/// let s = MyStruct;
849863
/// s.bar();
850864
///
851-
/// // we aren't even using baz(), so this is fine.
865+
/// // We aren't even using baz() or qux(), so this is fine.
852866
/// }
853867
/// ```
854868
#[macro_export]

std/src/process.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ impl Command {
607607
///
608608
/// Note that the argument is not passed through a shell, but given
609609
/// literally to the program. This means that shell syntax like quotes,
610-
/// escaped characters, word splitting, glob patterns, substitution, etc.
610+
/// escaped characters, word splitting, glob patterns, variable substitution, etc.
611611
/// have no effect.
612612
///
613613
/// # Examples
@@ -637,7 +637,7 @@ impl Command {
637637
///
638638
/// Note that the arguments are not passed through a shell, but given
639639
/// literally to the program. This means that shell syntax like quotes,
640-
/// escaped characters, word splitting, glob patterns, substitution, etc.
640+
/// escaped characters, word splitting, glob patterns, variable substitution, etc.
641641
/// have no effect.
642642
///
643643
/// # Examples

std/src/sync/rwlock.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ impl<T: ?Sized> RwLock<T> {
380380
///
381381
/// If the lock is poisoned, it will remain poisoned until this function is called. This allows
382382
/// recovering from a poisoned state and marking that it has recovered. For example, if the
383-
/// value is overwritten by a known-good value, then the mutex can be marked as un-poisoned. Or
383+
/// value is overwritten by a known-good value, then the lock can be marked as un-poisoned. Or
384384
/// possibly, the value could be inspected to determine if it is in a consistent state, and if
385385
/// so the poison is removed.
386386
///
@@ -397,7 +397,7 @@ impl<T: ?Sized> RwLock<T> {
397397
///
398398
/// let _ = thread::spawn(move || {
399399
/// let _lock = c_lock.write().unwrap();
400-
/// panic!(); // the mutex gets poisoned
400+
/// panic!(); // the lock gets poisoned
401401
/// }).join();
402402
///
403403
/// assert_eq!(lock.is_poisoned(), true);

0 commit comments

Comments
 (0)