diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2021-02-19 02:49:13 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-19 02:49:13 +0100 |
| commit | 36a348bdc085543c4f6d3cf27b9ddd156c950e2e (patch) | |
| tree | f08a2fc9dd3079148301e2bcd0186e8730a59dc5 | |
| parent | d9bc16cf368f1a8701295ed83f0337461acd6963 (diff) | |
| parent | 1605af015c493c4800be9b56d7eb8d759f9a7d3c (diff) | |
| download | rust-36a348bdc085543c4f6d3cf27b9ddd156c950e2e.tar.gz rust-36a348bdc085543c4f6d3cf27b9ddd156c950e2e.zip | |
Rollup merge of #82274 - andersk:test-unwrap, r=Mark-Simulacrum
libtest: Fix unwrap panic on duplicate TestDesc It is possible for different tests to collide to the same `TestDesc` when macros are involved. That is a bug, but it didn’t cause a panic until #81367. For now, change the code to ignore this problem. Fixes #81852. This will need to be applied to `beta` too.
| -rw-r--r-- | library/test/src/lib.rs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/library/test/src/lib.rs b/library/test/src/lib.rs index ae38030d497..f9e65be9b0d 100644 --- a/library/test/src/lib.rs +++ b/library/test/src/lib.rs @@ -353,12 +353,13 @@ where } let mut completed_test = res.unwrap(); - let running_test = running_tests.remove(&completed_test.desc).unwrap(); - if let Some(join_handle) = running_test.join_handle { - if let Err(_) = join_handle.join() { - if let TrOk = completed_test.result { - completed_test.result = - TrFailedMsg("panicked after reporting success".to_string()); + if let Some(running_test) = running_tests.remove(&completed_test.desc) { + if let Some(join_handle) = running_test.join_handle { + if let Err(_) = join_handle.join() { + if let TrOk = completed_test.result { + completed_test.result = + TrFailedMsg("panicked after reporting success".to_string()); + } } } } |
