diff options
| author | Ralf Jung <post@ralfj.de> | 2020-05-17 11:06:59 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2020-05-17 11:23:42 +0200 |
| commit | 5980d972d1911225e38e98fe81974973349793a0 (patch) | |
| tree | d4cdd2bd9701a3673cbe0aab4925877627497134 /src/liballoc | |
| parent | af6d8865fe0e1f6338c32cb3370802f2ebca0dc4 (diff) | |
| download | rust-5980d972d1911225e38e98fe81974973349793a0.tar.gz rust-5980d972d1911225e38e98fe81974973349793a0.zip | |
make abort intrinsic safe, and correct its documentation
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/rc.rs | 4 | ||||
| -rw-r--r-- | src/liballoc/sync.rs | 5 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index 2f9505ec79f..0b2622b6ce3 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -2035,6 +2035,8 @@ trait RcBoxPtr<T: ?Sized> { // nevertheless, we insert an abort here to hint LLVM at // an otherwise missed optimization. if strong == 0 || strong == usize::max_value() { + // remove `unsafe` on bootstrap bump + #[cfg_attr(not(bootstrap), allow(unused_unsafe))] unsafe { abort(); } @@ -2061,6 +2063,8 @@ trait RcBoxPtr<T: ?Sized> { // nevertheless, we insert an abort here to hint LLVM at // an otherwise missed optimization. if weak == 0 || weak == usize::max_value() { + // remove `unsafe` on bootstrap bump + #[cfg_attr(not(bootstrap), allow(unused_unsafe))] unsafe { abort(); } diff --git a/src/liballoc/sync.rs b/src/liballoc/sync.rs index dbee9d27d8a..12232520ef4 100644 --- a/src/liballoc/sync.rs +++ b/src/liballoc/sync.rs @@ -1096,6 +1096,8 @@ impl<T: ?Sized> Clone for Arc<T> { // We abort because such a program is incredibly degenerate, and we // don't care to support it. if old_size > MAX_REFCOUNT { + // remove `unsafe` on bootstrap bump + #[cfg_attr(not(bootstrap), allow(unused_unsafe))] unsafe { abort(); } @@ -1614,6 +1616,8 @@ impl<T: ?Sized> Weak<T> { // See comments in `Arc::clone` for why we do this (for `mem::forget`). if n > MAX_REFCOUNT { + // remove `unsafe` on bootstrap bump + #[cfg_attr(not(bootstrap), allow(unused_unsafe))] unsafe { abort(); } @@ -1753,6 +1757,7 @@ impl<T: ?Sized> Clone for Weak<T> { // See comments in Arc::clone() for why we do this (for mem::forget). if old_size > MAX_REFCOUNT { + #[cfg_attr(not(bootstrap), allow(unused_unsafe))] // remove `unsafe` on bootstrap bump unsafe { abort(); } |
