diff options
| author | mejrs <> | 2022-09-28 02:36:58 +0200 |
|---|---|---|
| committer | mejrs <> | 2022-09-28 02:36:58 +0200 |
| commit | 4ff83cee95cf73708cc5455f4ecce5eb1c21ffc6 (patch) | |
| tree | 5e6ab4e22a66d9090f919e54537399e58443bbbe /src/test | |
| parent | e9224b37968f8bf56c0bbac206312ef84dad3b74 (diff) | |
| download | rust-4ff83cee95cf73708cc5455f4ecce5eb1c21ffc6.tar.gz rust-4ff83cee95cf73708cc5455f4ecce5eb1c21ffc6.zip | |
Deduplicate some logic
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/suggestions/inner_type.fixed | 10 | ||||
| -rw-r--r-- | src/test/ui/suggestions/inner_type.rs | 10 | ||||
| -rw-r--r-- | src/test/ui/suggestions/inner_type.stderr | 10 |
3 files changed, 15 insertions, 15 deletions
diff --git a/src/test/ui/suggestions/inner_type.fixed b/src/test/ui/suggestions/inner_type.fixed index 811b959b8c0..7af7391ca85 100644 --- a/src/test/ui/suggestions/inner_type.fixed +++ b/src/test/ui/suggestions/inner_type.fixed @@ -16,25 +16,25 @@ fn main() { other_item.borrow().method(); //~^ ERROR no method named `method` found for struct `RefCell` in the current scope [E0599] - //~| HELP use `.borrow()` to borrow the `Struct<u32>`, panicking if any outstanding mutable borrows exist. + //~| HELP use `.borrow()` to borrow the `Struct<u32>`, panicking if a mutable borrow exists other_item.borrow_mut().some_mutable_method(); //~^ ERROR no method named `some_mutable_method` found for struct `RefCell` in the current scope [E0599] - //~| HELP use `.borrow_mut()` to mutably borrow the `Struct<u32>`, panicking if any outstanding borrows exist. + //~| HELP .borrow_mut()` to mutably borrow the `Struct<u32>`, panicking if any borrows exist let another_item = std::sync::Mutex::new(Struct { p: 42_u32 }); another_item.lock().unwrap().method(); //~^ ERROR no method named `method` found for struct `Mutex` in the current scope [E0599] - //~| HELP use `.lock()` to borrow the `Struct<u32>`, blocking the current thread until it can be acquired + //~| HELP use `.lock().unwrap()` to borrow the `Struct<u32>`, blocking the current thread until it can be acquired let another_item = std::sync::RwLock::new(Struct { p: 42_u32 }); another_item.read().unwrap().method(); //~^ ERROR no method named `method` found for struct `RwLock` in the current scope [E0599] - //~| HELP use `.read()` to borrow the `Struct<u32>`, blocking the current thread until it can be acquired + //~| HELP use `.read().unwrap()` to borrow the `Struct<u32>`, blocking the current thread until it can be acquired another_item.write().unwrap().some_mutable_method(); //~^ ERROR no method named `some_mutable_method` found for struct `RwLock` in the current scope [E0599] - //~| HELP use `.write()` to mutably borrow the `Struct<u32>`, blocking the current thread until it can be acquired + //~| HELP use `.write().unwrap()` to mutably borrow the `Struct<u32>`, blocking the current thread until it can be acquired } diff --git a/src/test/ui/suggestions/inner_type.rs b/src/test/ui/suggestions/inner_type.rs index 96c797a6d81..4aca5071625 100644 --- a/src/test/ui/suggestions/inner_type.rs +++ b/src/test/ui/suggestions/inner_type.rs @@ -16,25 +16,25 @@ fn main() { other_item.method(); //~^ ERROR no method named `method` found for struct `RefCell` in the current scope [E0599] - //~| HELP use `.borrow()` to borrow the `Struct<u32>`, panicking if any outstanding mutable borrows exist. + //~| HELP use `.borrow()` to borrow the `Struct<u32>`, panicking if a mutable borrow exists other_item.some_mutable_method(); //~^ ERROR no method named `some_mutable_method` found for struct `RefCell` in the current scope [E0599] - //~| HELP use `.borrow_mut()` to mutably borrow the `Struct<u32>`, panicking if any outstanding borrows exist. + //~| HELP .borrow_mut()` to mutably borrow the `Struct<u32>`, panicking if any borrows exist let another_item = std::sync::Mutex::new(Struct { p: 42_u32 }); another_item.method(); //~^ ERROR no method named `method` found for struct `Mutex` in the current scope [E0599] - //~| HELP use `.lock()` to borrow the `Struct<u32>`, blocking the current thread until it can be acquired + //~| HELP use `.lock().unwrap()` to borrow the `Struct<u32>`, blocking the current thread until it can be acquired let another_item = std::sync::RwLock::new(Struct { p: 42_u32 }); another_item.method(); //~^ ERROR no method named `method` found for struct `RwLock` in the current scope [E0599] - //~| HELP use `.read()` to borrow the `Struct<u32>`, blocking the current thread until it can be acquired + //~| HELP use `.read().unwrap()` to borrow the `Struct<u32>`, blocking the current thread until it can be acquired another_item.some_mutable_method(); //~^ ERROR no method named `some_mutable_method` found for struct `RwLock` in the current scope [E0599] - //~| HELP use `.write()` to mutably borrow the `Struct<u32>`, blocking the current thread until it can be acquired + //~| HELP use `.write().unwrap()` to mutably borrow the `Struct<u32>`, blocking the current thread until it can be acquired } diff --git a/src/test/ui/suggestions/inner_type.stderr b/src/test/ui/suggestions/inner_type.stderr index 00d52f0f1d3..5ac3d04f104 100644 --- a/src/test/ui/suggestions/inner_type.stderr +++ b/src/test/ui/suggestions/inner_type.stderr @@ -9,7 +9,7 @@ note: the method `method` exists on the type `Struct<u32>` | LL | pub fn method(&self) {} | ^^^^^^^^^^^^^^^^^^^^ -help: use `.borrow()` to borrow the `Struct<u32>`, panicking if any outstanding mutable borrows exist. +help: use `.borrow()` to borrow the `Struct<u32>`, panicking if a mutable borrow exists | LL | other_item.borrow().method(); | +++++++++ @@ -25,7 +25,7 @@ note: the method `some_mutable_method` exists on the type `Struct<u32>` | LL | pub fn some_mutable_method(&mut self) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -help: use `.borrow_mut()` to mutably borrow the `Struct<u32>`, panicking if any outstanding borrows exist. +help: use `.borrow_mut()` to mutably borrow the `Struct<u32>`, panicking if any borrows exist | LL | other_item.borrow_mut().some_mutable_method(); | +++++++++++++ @@ -41,7 +41,7 @@ note: the method `method` exists on the type `Struct<u32>` | LL | pub fn method(&self) {} | ^^^^^^^^^^^^^^^^^^^^ -help: use `.lock()` to borrow the `Struct<u32>`, blocking the current thread until it can be acquired +help: use `.lock().unwrap()` to borrow the `Struct<u32>`, blocking the current thread until it can be acquired | LL | another_item.lock().unwrap().method(); | ++++++++++++++++ @@ -57,7 +57,7 @@ note: the method `method` exists on the type `Struct<u32>` | LL | pub fn method(&self) {} | ^^^^^^^^^^^^^^^^^^^^ -help: use `.read()` to borrow the `Struct<u32>`, blocking the current thread until it can be acquired +help: use `.read().unwrap()` to borrow the `Struct<u32>`, blocking the current thread until it can be acquired | LL | another_item.read().unwrap().method(); | ++++++++++++++++ @@ -73,7 +73,7 @@ note: the method `some_mutable_method` exists on the type `Struct<u32>` | LL | pub fn some_mutable_method(&mut self) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -help: use `.write()` to mutably borrow the `Struct<u32>`, blocking the current thread until it can be acquired +help: use `.write().unwrap()` to mutably borrow the `Struct<u32>`, blocking the current thread until it can be acquired | LL | another_item.write().unwrap().some_mutable_method(); | +++++++++++++++++ |
