Skip to content

Rollup of 7 pull requests #29090

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
82ec343
Rustfmt-ing libarena.
Oct 13, 2015
4f16396
Rustfmt-ing librustc_driver.
Oct 13, 2015
59a3518
Manual fixups done.
Oct 14, 2015
00c4f06
Manual fixups.
Oct 14, 2015
605fef2
Added attributes to allow custom attibutes in librustc_driver.
goyox86 Oct 15, 2015
e7be2c3
Fixed comment.
goyox86 Oct 15, 2015
b8e8561
std: add into_inner and get_mut to mutex
cristicbz Oct 13, 2015
90ccefd
std: add into_inner and get_mut to RwLock
cristicbz Oct 15, 2015
48c90a3
Remove outdated Changing directory.
Havvy Oct 15, 2015
11e65eb
Fix minor error in Arc docs
mbrubeck Oct 15, 2015
6aa5237
Add unused modules to libcoretest
fhahn Oct 15, 2015
6cdf31b
Auto merge of #29031 - cristicbz:mtx_inner, r=alexcrichton
bors Oct 15, 2015
128ded7
Make NonZero::new const function
petrochenkov Oct 15, 2015
d979743
Rollup merge of #29020 - goyox86:goyox86/rustfmting-libarena, r=nrc
Manishearth Oct 16, 2015
bc7a22d
Rollup merge of #29033 - goyox86:goyox86/rustfmting-librustc_driver, …
Manishearth Oct 16, 2015
ef72046
Rollup merge of #29079 - fhahn:remove-unused-files-libcoretest, r=ale…
Manishearth Oct 16, 2015
5fab28a
Rollup merge of #29080 - Havvy:remove_doc_style_changing, r=alexcrichton
Manishearth Oct 16, 2015
694d756
Rollup merge of #29081 - rust-lang:arc-example-edit, r=alexcrichton
Manishearth Oct 16, 2015
75a6725
Rollup merge of #29085 - petrochenkov:nonzero, r=alexcrichton
Manishearth Oct 16, 2015
9726149
Rollup merge of #29086 - fhahn:book-update-lint-plugin-example, r=ale…
Manishearth Oct 16, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/doc/style/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,3 @@
* [Testing](testing/README.md)
* [Unit testing](testing/unit.md)
* [FFI, platform-specific code](platform.md)
* [APIs for a changing Rust](changing/README.md)
* [Pre-1.0 changes](changing/pre-1-0.md)
* [Post-1.0 changes](changing/post-1-0.md)
* [Timing unclear](changing/unclear.md)
5 changes: 0 additions & 5 deletions src/doc/style/changing/README.md

This file was deleted.

12 changes: 0 additions & 12 deletions src/doc/style/changing/post-1-0.md

This file was deleted.

17 changes: 0 additions & 17 deletions src/doc/style/changing/pre-1-0.md

This file was deleted.

28 changes: 0 additions & 28 deletions src/doc/style/changing/unclear.md

This file was deleted.

2 changes: 1 addition & 1 deletion src/liballoc/arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const MAX_REFCOUNT: usize = (isize::MAX) as usize;
///
/// # Examples
///
/// In this example, a large vector of floats is shared between several threads.
/// In this example, a large vector is shared between several threads.
/// With simple pipes, without `Arc`, a copy would have to be made for each
/// thread.
///
Expand Down
12 changes: 9 additions & 3 deletions src/libarena/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,9 @@ impl<'longer_than_self> Arena<'longer_than_self> {
}

#[inline]
fn alloc_copy<T, F>(&self, op: F) -> &mut T where F: FnOnce() -> T {
fn alloc_copy<T, F>(&self, op: F) -> &mut T
where F: FnOnce() -> T
{
unsafe {
let ptr = self.alloc_copy_inner(mem::size_of::<T>(), mem::align_of::<T>());
let ptr = ptr as *mut T;
Expand Down Expand Up @@ -296,7 +298,9 @@ impl<'longer_than_self> Arena<'longer_than_self> {
}

#[inline]
fn alloc_noncopy<T, F>(&self, op: F) -> &mut T where F: FnOnce() -> T {
fn alloc_noncopy<T, F>(&self, op: F) -> &mut T
where F: FnOnce() -> T
{
unsafe {
let tydesc = get_tydesc::<T>();
let (ty_ptr, ptr) = self.alloc_noncopy_inner(mem::size_of::<T>(), mem::align_of::<T>());
Expand All @@ -318,7 +322,9 @@ impl<'longer_than_self> Arena<'longer_than_self> {
/// Allocates a new item in the arena, using `op` to initialize the value,
/// and returns a reference to it.
#[inline]
pub fn alloc<T:'longer_than_self, F>(&self, op: F) -> &mut T where F: FnOnce() -> T {
pub fn alloc<T: 'longer_than_self, F>(&self, op: F) -> &mut T
where F: FnOnce() -> T
{
unsafe {
if intrinsics::needs_drop::<T>() {
self.alloc_noncopy(op)
Expand Down
30 changes: 24 additions & 6 deletions src/libcore/nonzero.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,31 @@ unsafe impl Zeroable for u64 {}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub struct NonZero<T: Zeroable>(T);

#[cfg(stage0)]
macro_rules! nonzero_new {
() => (
/// Creates an instance of NonZero with the provided value.
/// You must indeed ensure that the value is actually "non-zero".
#[inline(always)]
pub unsafe fn new(inner: T) -> NonZero<T> {
NonZero(inner)
}
)
}
#[cfg(not(stage0))]
macro_rules! nonzero_new {
() => (
/// Creates an instance of NonZero with the provided value.
/// You must indeed ensure that the value is actually "non-zero".
#[inline(always)]
pub unsafe const fn new(inner: T) -> NonZero<T> {
NonZero(inner)
}
)
}

impl<T: Zeroable> NonZero<T> {
/// Creates an instance of NonZero with the provided value.
/// You must indeed ensure that the value is actually "non-zero".
#[inline(always)]
pub unsafe fn new(inner: T) -> NonZero<T> {
NonZero(inner)
}
nonzero_new!{}
}

impl<T: Zeroable> Deref for NonZero<T> {
Expand Down
20 changes: 3 additions & 17 deletions src/libcoretest/clone.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
Expand All @@ -11,8 +11,8 @@
#[test]
fn test_borrowed_clone() {
let x = 5;
let y: &int = &x;
let z: &int = (&y).clone();
let y: &i32 = &x;
let z: &i32 = (&y).clone();
assert_eq!(*z, 5);
}

Expand All @@ -23,17 +23,3 @@ fn test_clone_from() {
b.clone_from(&a);
assert_eq!(*b, 5);
}

#[test]
fn test_extern_fn_clone() {
trait Empty {}
impl Empty for int {}

fn test_fn_a() -> f64 { 1.0 }
fn test_fn_b<T: Empty>(x: T) -> T { x }
fn test_fn_c(_: int, _: f64, _: int, _: int, _: int) {}

let _ = test_fn_a.clone();
let _ = test_fn_b::<int>.clone();
let _ = test_fn_c.clone();
}
3 changes: 2 additions & 1 deletion src/libcoretest/fmt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

mod num;
mod builders;
mod float;
mod num;

#[test]
fn test_format_flags() {
Expand Down
2 changes: 1 addition & 1 deletion src/libcoretest/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use core::any::TypeId;

#[test]
fn test_typeid_sized_types() {
struct X; struct Y(uint);
struct X; struct Y(u32);

assert_eq!(TypeId::of::<X>(), TypeId::of::<X>());
assert_eq!(TypeId::of::<Y>(), TypeId::of::<Y>());
Expand Down
2 changes: 2 additions & 0 deletions src/libcoretest/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,11 @@ mod array;
mod atomic;
mod cell;
mod char;
mod clone;
mod cmp;
mod fmt;
mod hash;
mod intrinsics;
mod iter;
mod mem;
mod nonzero;
Expand Down
Loading