Skip to content

Commit 12b33d3

Browse files
committedJun 16, 2024
Auto merge of #126540 - jhpratt:rollup-fzzz8j3, r=jhpratt
Rollup of 4 pull requests Successful merges: - #125112 (Document behavior of `create_dir_all` wrt. empty path) - #126127 (Spell out other trait diagnostic) - #126309 (unify git command preperation) - #126539 (Update `Arc::try_unwrap()` docs) r? `@ghost` `@rustbot` modify labels: rollup
·
1.88.01.81.0
2 parents 5639c21 + 623cf23 commit 12b33d3

File tree

52 files changed

+447
-452
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+447
-452
lines changed
 

‎compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2068,7 +2068,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
20682068
if all_traits_equal {
20692069
format!("\n {}", c.self_ty())
20702070
} else {
2071-
format!("\n {c}")
2071+
format!("\n `{}` implements `{}`", c.self_ty(), c.print_only_trait_path())
20722072
}
20732073
})
20742074
.collect();

‎library/alloc/src/sync.rs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -940,15 +940,18 @@ impl<T, A: Allocator> Arc<T, A> {
940940
/// This will succeed even if there are outstanding weak references.
941941
///
942942
/// It is strongly recommended to use [`Arc::into_inner`] instead if you don't
943-
/// want to keep the `Arc` in the [`Err`] case.
944-
/// Immediately dropping the [`Err`] payload, like in the expression
945-
/// `Arc::try_unwrap(this).ok()`, can still cause the strong count to
946-
/// drop to zero and the inner value of the `Arc` to be dropped:
947-
/// For instance if two threads each execute this expression in parallel, then
948-
/// there is a race condition. The threads could first both check whether they
949-
/// have the last clone of their `Arc` via `Arc::try_unwrap`, and then
950-
/// both drop their `Arc` in the call to [`ok`][`Result::ok`],
951-
/// taking the strong count from two down to zero.
943+
/// keep the `Arc` in the [`Err`] case.
944+
/// Immediately dropping the [`Err`]-value, as the expression
945+
/// `Arc::try_unwrap(this).ok()` does, can cause the strong count to
946+
/// drop to zero and the inner value of the `Arc` to be dropped.
947+
/// For instance, if two threads execute such an expression in parallel,
948+
/// there is a race condition without the possibility of unsafety:
949+
/// The threads could first both check whether they own the last instance
950+
/// in `Arc::try_unwrap`, determine that they both do not, and then both
951+
/// discard and drop their instance in the call to [`ok`][`Result::ok`].
952+
/// In this scenario, the value inside the `Arc` is safely destroyed
953+
/// by exactly one of the threads, but neither thread will ever be able
954+
/// to use the value.
952955
///
953956
/// # Examples
954957
///

0 commit comments

Comments
 (0)
Please sign in to comment.