Rollup merge of #33917 - srinivasreddy:rustfmt_liballoc, r=GuillaumeGomez
rustfmt liballoc folder
This commit is contained in:
commit
0072e6b9e3
@ -72,7 +72,7 @@
|
|||||||
use boxed::Box;
|
use boxed::Box;
|
||||||
|
|
||||||
use core::sync::atomic;
|
use core::sync::atomic;
|
||||||
use core::sync::atomic::Ordering::{Relaxed, Release, Acquire, SeqCst};
|
use core::sync::atomic::Ordering::{Acquire, Relaxed, Release, SeqCst};
|
||||||
use core::borrow;
|
use core::borrow;
|
||||||
use core::fmt;
|
use core::fmt;
|
||||||
use core::cmp::Ordering;
|
use core::cmp::Ordering;
|
||||||
@ -85,7 +85,7 @@ use core::ops::CoerceUnsized;
|
|||||||
use core::ptr::{self, Shared};
|
use core::ptr::{self, Shared};
|
||||||
use core::marker::Unsize;
|
use core::marker::Unsize;
|
||||||
use core::hash::{Hash, Hasher};
|
use core::hash::{Hash, Hasher};
|
||||||
use core::{usize, isize};
|
use core::{isize, usize};
|
||||||
use core::convert::From;
|
use core::convert::From;
|
||||||
use heap::deallocate;
|
use heap::deallocate;
|
||||||
|
|
||||||
@ -608,11 +608,13 @@ impl<T> Weak<T> {
|
|||||||
#[stable(feature = "downgraded_weak", since = "1.10.0")]
|
#[stable(feature = "downgraded_weak", since = "1.10.0")]
|
||||||
pub fn new() -> Weak<T> {
|
pub fn new() -> Weak<T> {
|
||||||
unsafe {
|
unsafe {
|
||||||
Weak { ptr: Shared::new(Box::into_raw(box ArcInner {
|
Weak {
|
||||||
strong: atomic::AtomicUsize::new(0),
|
ptr: Shared::new(Box::into_raw(box ArcInner {
|
||||||
weak: atomic::AtomicUsize::new(1),
|
strong: atomic::AtomicUsize::new(0),
|
||||||
data: uninitialized(),
|
weak: atomic::AtomicUsize::new(1),
|
||||||
}))}
|
data: uninitialized(),
|
||||||
|
})),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -655,7 +657,9 @@ impl<T: ?Sized> Weak<T> {
|
|||||||
|
|
||||||
// See comments in `Arc::clone` for why we do this (for `mem::forget`).
|
// See comments in `Arc::clone` for why we do this (for `mem::forget`).
|
||||||
if n > MAX_REFCOUNT {
|
if n > MAX_REFCOUNT {
|
||||||
unsafe { abort(); }
|
unsafe {
|
||||||
|
abort();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Relaxed is valid for the same reason it is on Arc's Clone impl
|
// Relaxed is valid for the same reason it is on Arc's Clone impl
|
||||||
@ -946,7 +950,7 @@ mod tests {
|
|||||||
use std::mem::drop;
|
use std::mem::drop;
|
||||||
use std::ops::Drop;
|
use std::ops::Drop;
|
||||||
use std::option::Option;
|
use std::option::Option;
|
||||||
use std::option::Option::{Some, None};
|
use std::option::Option::{None, Some};
|
||||||
use std::sync::atomic;
|
use std::sync::atomic;
|
||||||
use std::sync::atomic::Ordering::{Acquire, SeqCst};
|
use std::sync::atomic::Ordering::{Acquire, SeqCst};
|
||||||
use std::thread;
|
use std::thread;
|
||||||
|
@ -64,7 +64,7 @@ use core::hash::{self, Hash};
|
|||||||
use core::marker::{self, Unsize};
|
use core::marker::{self, Unsize};
|
||||||
use core::mem;
|
use core::mem;
|
||||||
use core::ops::{CoerceUnsized, Deref, DerefMut};
|
use core::ops::{CoerceUnsized, Deref, DerefMut};
|
||||||
use core::ops::{Placer, Boxed, Place, InPlace, BoxPlace};
|
use core::ops::{BoxPlace, Boxed, InPlace, Place, Placer};
|
||||||
use core::ptr::{self, Unique};
|
use core::ptr::{self, Unique};
|
||||||
use core::raw::TraitObject;
|
use core::raw::TraitObject;
|
||||||
use core::convert::From;
|
use core::convert::From;
|
||||||
@ -535,7 +535,8 @@ pub trait FnBox<A> {
|
|||||||
|
|
||||||
#[unstable(feature = "fnbox",
|
#[unstable(feature = "fnbox",
|
||||||
reason = "will be deprecated if and when Box<FnOnce> becomes usable", issue = "28796")]
|
reason = "will be deprecated if and when Box<FnOnce> becomes usable", issue = "28796")]
|
||||||
impl<A, F> FnBox<A> for F where F: FnOnce<A>
|
impl<A, F> FnBox<A> for F
|
||||||
|
where F: FnOnce<A>
|
||||||
{
|
{
|
||||||
type Output = F::Output;
|
type Output = F::Output;
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
use core::any::Any;
|
use core::any::Any;
|
||||||
use core::ops::Deref;
|
use core::ops::Deref;
|
||||||
use core::result::Result::{Ok, Err};
|
use core::result::Result::{Err, Ok};
|
||||||
use core::clone::Clone;
|
use core::clone::Clone;
|
||||||
|
|
||||||
use std::boxed::Box;
|
use std::boxed::Box;
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
use core::{isize, usize};
|
use core::{isize, usize};
|
||||||
#[cfg(not(test))]
|
#[cfg(not(test))]
|
||||||
use core::intrinsics::{size_of, min_align_of};
|
use core::intrinsics::{min_align_of, size_of};
|
||||||
|
|
||||||
#[allow(improper_ctypes)]
|
#[allow(improper_ctypes)]
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -159,11 +159,11 @@ use core::borrow;
|
|||||||
use core::cell::Cell;
|
use core::cell::Cell;
|
||||||
use core::cmp::Ordering;
|
use core::cmp::Ordering;
|
||||||
use core::fmt;
|
use core::fmt;
|
||||||
use core::hash::{Hasher, Hash};
|
use core::hash::{Hash, Hasher};
|
||||||
use core::intrinsics::{assume, abort};
|
use core::intrinsics::{abort, assume};
|
||||||
use core::marker;
|
use core::marker;
|
||||||
use core::marker::Unsize;
|
use core::marker::Unsize;
|
||||||
use core::mem::{self, align_of_val, size_of_val, forget, uninitialized};
|
use core::mem::{self, align_of_val, forget, size_of_val, uninitialized};
|
||||||
use core::ops::Deref;
|
use core::ops::Deref;
|
||||||
use core::ops::CoerceUnsized;
|
use core::ops::CoerceUnsized;
|
||||||
use core::ptr::{self, Shared};
|
use core::ptr::{self, Shared};
|
||||||
@ -935,7 +935,7 @@ mod tests {
|
|||||||
use std::boxed::Box;
|
use std::boxed::Box;
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::option::Option;
|
use std::option::Option;
|
||||||
use std::option::Option::{Some, None};
|
use std::option::Option::{None, Some};
|
||||||
use std::result::Result::{Err, Ok};
|
use std::result::Result::{Err, Ok};
|
||||||
use std::mem::drop;
|
use std::mem::drop;
|
||||||
use std::clone::Clone;
|
use std::clone::Clone;
|
||||||
|
Loading…
Reference in New Issue
Block a user