From 99aaccd32fe7b63366fa13b48f485fd1cdcd8660 Mon Sep 17 00:00:00 2001 From: Daan Sprenkels Date: Fri, 4 Nov 2016 22:50:54 +0100 Subject: [PATCH] Add a comment to `Arc::MAX_REFCOUNT` The constant name `MAX_REFCOUNT` suggests that the value is a _hard_ limit on the amount of references to an `Arc`. This is a more soft limit however. This commit adds a comment to the constant to annotate this. See also: PR #37605 --- src/liballoc/arc.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs index 7a07e007ce1c4..d6096d5894772 100644 --- a/src/liballoc/arc.rs +++ b/src/liballoc/arc.rs @@ -36,6 +36,10 @@ use core::{isize, usize}; use core::convert::From; use heap::deallocate; +/// A soft limit on the amount of references that may be made to an `Arc`. +/// +/// Going above this limit will abort your program (although not +/// necessarily) at _exactly_ `MAX_REFCOUNT + 1` references. const MAX_REFCOUNT: usize = (isize::MAX) as usize; /// A thread-safe reference-counting pointer.