[significant_drop_tightening] Fix #11160
This commit is contained in:
parent
1d33469658
commit
1f82f6ddf3
4 changed files with 24 additions and 7 deletions
|
|
@ -51,6 +51,13 @@ pub fn issue_11128() {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn issue_11160() -> bool {
|
||||
let mutex = Mutex::new(1i32);
|
||||
let lock = mutex.lock().unwrap();
|
||||
let _ = lock.abs();
|
||||
true
|
||||
}
|
||||
|
||||
pub fn path_return_can_be_ignored() -> i32 {
|
||||
let mutex = Mutex::new(1);
|
||||
let lock = mutex.lock().unwrap();
|
||||
|
|
|
|||
|
|
@ -50,6 +50,13 @@ pub fn issue_11128() {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn issue_11160() -> bool {
|
||||
let mutex = Mutex::new(1i32);
|
||||
let lock = mutex.lock().unwrap();
|
||||
let _ = lock.abs();
|
||||
true
|
||||
}
|
||||
|
||||
pub fn path_return_can_be_ignored() -> i32 {
|
||||
let mutex = Mutex::new(1);
|
||||
let lock = mutex.lock().unwrap();
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ LL + drop(lock);
|
|||
|
|
||||
|
||||
error: temporary with significant `Drop` can be early dropped
|
||||
--> $DIR/significant_drop_tightening.rs:79:13
|
||||
--> $DIR/significant_drop_tightening.rs:86:13
|
||||
|
|
||||
LL | / {
|
||||
LL | | let mutex = Mutex::new(1i32);
|
||||
|
|
@ -43,7 +43,7 @@ LL + drop(lock);
|
|||
|
|
||||
|
||||
error: temporary with significant `Drop` can be early dropped
|
||||
--> $DIR/significant_drop_tightening.rs:100:13
|
||||
--> $DIR/significant_drop_tightening.rs:107:13
|
||||
|
|
||||
LL | / {
|
||||
LL | | let mutex = Mutex::new(1i32);
|
||||
|
|
@ -67,7 +67,7 @@ LL +
|
|||
|
|
||||
|
||||
error: temporary with significant `Drop` can be early dropped
|
||||
--> $DIR/significant_drop_tightening.rs:106:17
|
||||
--> $DIR/significant_drop_tightening.rs:113:17
|
||||
|
|
||||
LL | / {
|
||||
LL | | let mutex = Mutex::new(vec![1i32]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue