Skip to content

Commit ce31cbc

Browse files
committed
use generic params for arc_new_cyclic
1 parent ef472f1 commit ce31cbc

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

library/alloc/src/rc.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,10 @@ impl<T> Rc<T> {
415415
/// [`upgrade`]: Weak::upgrade
416416
#[cfg(not(no_global_oom_handling))]
417417
#[stable(feature = "arc_new_cyclic", since = "1.59.0")]
418-
pub fn new_cyclic(data_fn: impl FnOnce(&Weak<T>) -> T) -> Rc<T> {
418+
pub fn new_cyclic<F>(data_fn: F) -> Rc<T>
419+
where
420+
F: FnOnce(&Weak<T>) -> T,
421+
{
419422
// Construct the inner in the "uninitialized" state with a single
420423
// weak reference.
421424
let uninit_ptr: NonNull<_> = Box::leak(box RcBox {

library/alloc/src/sync.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,10 @@ impl<T> Arc<T> {
392392
#[cfg(not(no_global_oom_handling))]
393393
#[inline]
394394
#[stable(feature = "arc_new_cyclic", since = "1.59.0")]
395-
pub fn new_cyclic(data_fn: impl FnOnce(&Weak<T>) -> T) -> Arc<T> {
395+
pub fn new_cyclic<F>(data_fn: F) -> Arc<T>
396+
where
397+
F: FnOnce(&Weak<T>) -> T,
398+
{
396399
// Construct the inner in the "uninitialized" state with a single
397400
// weak reference.
398401
let uninit_ptr: NonNull<_> = Box::leak(box ArcInner {

0 commit comments

Comments
 (0)