Skip to content

Commit cf00fc4

Browse files
committed
Auto merge of rust-lang#23963 - alexcrichton:rollup, r=alexcrichton
2 parents 2e3b0c0 + e3b7e6c commit cf00fc4

File tree

264 files changed

+967
-736
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

264 files changed

+967
-736
lines changed

RELEASES.md

+99
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,102 @@
1+
Version 1.0.0-beta (April 2015)
2+
-------------------------------------
3+
4+
* ~1100 changes, numerous bugfixes
5+
6+
* Highlights
7+
8+
* The big news is that the vast majority of the standard library
9+
is now `#[stable]` -- 75% of the non-deprecated API surface at
10+
last count. Numerous crates are now running on stable
11+
Rust. Starting with this release, it is not possible to use
12+
unstable features on a stable build.
13+
* Arithmetic on basic integer types now
14+
[checks for overflow in debug builds][overflow].
15+
16+
* Language
17+
18+
* [`Send` no longer implies `'static`][send-rfc], which made
19+
possible the [`thread::scoped` API][scoped]. Scoped threads can
20+
borrow data from their parent's stack frame -- safely!
21+
* [UFCS now supports trait-less associated paths][moar-ufcs] like
22+
`MyType::default()`.
23+
* Primitive types [now have inherent methods][prim-inherent],
24+
obviating the need for extension traits like `SliceExt`.
25+
* Methods with `Self: Sized` in their `where` clause are
26+
[considered object-safe][self-sized], allowing many extension
27+
traits like `IteratorExt` to be merged into the traits they
28+
extended.
29+
* You can now [refer to associated types][assoc-where] whose
30+
corresponding trait bounds appear only in a `where` clause.
31+
* The final bits of [OIBIT landed][oibit-final], meaning that
32+
traits like `Send` and `Sync` are now library-defined.
33+
* A [Reflect trait][reflect] was introduced, which means that
34+
downcasting via the `Any` trait is effectively limited to
35+
concrete types. This helps retain the potentially-important
36+
"parametricity" property: generic code cannot behave differently
37+
for different type arguments except in minor ways.
38+
* The `unsafe_destructor` feature is now deprecated in favor of
39+
the [new `dropck`][dropck]. This change is a major reduction in
40+
unsafe code.
41+
* Trait coherence was [revised again][fundamental], this time with
42+
an eye toward API evolution over time.
43+
44+
* Libraries
45+
46+
* The new path and IO modules are complete and `#[stable]`. This
47+
was the major library focus for this cycle.
48+
* The path API was [revised][path-normalize] to normalize `.`,
49+
adjusting the tradeoffs in favor of the most common usage.
50+
* A large number of remaining APIs in `std` were also stabilized
51+
during this cycle; about 75% of the non-deprecated API surface
52+
is now stable.
53+
* The new [string pattern API][string-pattern] landed, which makes
54+
the string slice API much more internally consistent and flexible.
55+
* A shiny [framework for Debug implementations][debug-builder] landed.
56+
This makes it possible to opt in to "pretty-printed" debugging output.
57+
* A new set of [generic conversion traits][conversion] replaced
58+
many existing ad hoc traits.
59+
* Generic numeric traits were
60+
[completely removed][num-traits]. This was made possible thanks
61+
to inherent methods for primitive types, and the removal gives
62+
maximal flexibility for designing a numeric hierarchy in the future.
63+
* The `Fn` traits are now related via [inheritance][fn-inherit]
64+
and provide ergonomic [blanket implementations][fn-blanket].
65+
* The `Index` and `IndexMut` traits were changed to
66+
[take the index by value][index-value], enabling code like
67+
`hash_map["string"]` to work.
68+
* `Copy` now [inherits][copy-clone] from `Clone`, meaning that all
69+
`Copy` data is known to be `Clone` as well.
70+
71+
* Infrastructure
72+
73+
* Metadata was tuned, shrinking binaries [by 27%][metadata-shrink].
74+
* Much headway was made on ecosystem-wide CI, making it possible
75+
to [compare builds for breakage][ci-compare].
76+
77+
[send-rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0458-send-improvements.md
78+
[scoped]: http://static.rust-lang.org/doc/master/std/thread/fn.scoped.html
79+
[moar-ufcs]: https://github.com/rust-lang/rust/pull/22172
80+
[prim-inherent]: https://github.com/rust-lang/rust/pull/23104
81+
[overflow]: https://github.com/rust-lang/rfcs/blob/master/text/0560-integer-overflow.md
82+
[metadata-shrink]: https://github.com/rust-lang/rust/pull/22971
83+
[self-sized]: https://github.com/rust-lang/rust/pull/22301
84+
[assoc-where]: https://github.com/rust-lang/rust/pull/22512
85+
[string-pattern]: https://github.com/rust-lang/rust/pull/22466
86+
[oibit-final]: https://github.com/rust-lang/rust/pull/21689
87+
[reflect]: https://github.com/rust-lang/rust/pull/23712
88+
[debug-builder]: https://github.com/rust-lang/rfcs/blob/master/text/0640-debug-improvements.md
89+
[conversion]: https://github.com/rust-lang/rfcs/pull/529
90+
[num-traits]: https://github.com/rust-lang/rust/pull/23549
91+
[index-value]: https://github.com/rust-lang/rust/pull/23601
92+
[dropck]: https://github.com/rust-lang/rfcs/pull/769
93+
[fundamental]: https://github.com/rust-lang/rfcs/pull/1023
94+
[ci-compare]: https://gist.github.com/brson/a30a77836fbec057cbee
95+
[fn-inherit]: https://github.com/rust-lang/rust/pull/23282
96+
[fn-blanket]: https://github.com/rust-lang/rust/pull/23895
97+
[copy-clone]: https://github.com/rust-lang/rust/pull/23860
98+
[path-normalize]: https://github.com/rust-lang/rust/pull/23229
99+
1100
Version 1.0.0-alpha.2 (February 2015)
2101
-------------------------------------
3102

src/doc/reference.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -1648,7 +1648,7 @@ specific type.
16481648
Implementations are defined with the keyword `impl`.
16491649

16501650
```
1651-
# #[derive(Copy)]
1651+
# #[derive(Copy, Clone)]
16521652
# struct Point {x: f64, y: f64};
16531653
# type Surface = i32;
16541654
# struct BoundingBox {x: f64, y: f64, width: f64, height: f64};
@@ -1661,6 +1661,10 @@ struct Circle {
16611661
16621662
impl Copy for Circle {}
16631663
1664+
impl Clone for Circle {
1665+
fn clone(&self) -> Circle { *self }
1666+
}
1667+
16641668
impl Shape for Circle {
16651669
fn draw(&self, s: Surface) { do_draw_circle(s, *self); }
16661670
fn bounding_box(&self) -> BoundingBox {

src/liballoc/arc.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ impl<T> Deref for Arc<T> {
321321
}
322322
}
323323

324-
impl<T: Send + Sync + Clone> Arc<T> {
324+
impl<T: Clone> Arc<T> {
325325
/// Make a mutable reference from the given `Arc<T>`.
326326
///
327327
/// This is also referred to as a copy-on-write operation because the inner
@@ -465,7 +465,7 @@ impl<T> Weak<T> {
465465

466466
#[unstable(feature = "alloc",
467467
reason = "Weak pointers may not belong in this module.")]
468-
impl<T: Sync + Send> Clone for Weak<T> {
468+
impl<T> Clone for Weak<T> {
469469
/// Makes a clone of the `Weak<T>`.
470470
///
471471
/// This increases the weak reference count.

src/libcollections/binary_heap.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
//! use std::collections::BinaryHeap;
3131
//! use std::usize;
3232
//!
33-
//! #[derive(Copy, Eq, PartialEq)]
33+
//! #[derive(Copy, Clone, Eq, PartialEq)]
3434
//! struct State {
3535
//! cost: usize,
3636
//! position: usize,

src/libcollections/btree/node.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ impl<K: Clone, V: Clone> Clone for Node<K, V> {
526526
/// println!("Uninitialized memory: {:?}", handle.into_kv());
527527
/// }
528528
/// ```
529-
#[derive(Copy)]
529+
#[derive(Copy, Clone)]
530530
pub struct Handle<NodeRef, Type, NodeType> {
531531
node: NodeRef,
532532
index: usize,

src/libcollections/enum_set.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use core::ops::{Sub, BitOr, BitAnd, BitXor};
2121

2222
// FIXME(contentions): implement union family of methods? (general design may be wrong here)
2323

24-
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
24+
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash)]
2525
/// A specialized set implementation to use enum types.
2626
///
2727
/// It is a logic error for an item to be modified in such a way that the transformation of the
@@ -37,6 +37,10 @@ pub struct EnumSet<E> {
3737

3838
impl<E> Copy for EnumSet<E> {}
3939

40+
impl<E> Clone for EnumSet<E> {
41+
fn clone(&self) -> EnumSet<E> { *self }
42+
}
43+
4044
#[stable(feature = "rust1", since = "1.0.0")]
4145
impl<E:CLike + fmt::Debug> fmt::Debug for EnumSet<E> {
4246
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {

src/libcollections/slice.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1135,7 +1135,7 @@ impl Iterator for ElementSwaps {
11351135
// #[inline]
11361136
fn next(&mut self) -> Option<(usize, usize)> {
11371137
fn new_pos_wrapping(i: usize, s: Direction) -> usize {
1138-
i.wrapping_add(match s { Pos => 1, Neg => -1 })
1138+
i.wrapping_add(match s { Pos => 1, Neg => !0 /* aka -1 */ })
11391139
}
11401140

11411141
fn new_pos(i: usize, s: Direction) -> usize {

src/libcollectionstest/enum_set.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use collections::enum_set::{CLike, EnumSet};
1414

1515
use self::Foo::*;
1616

17-
#[derive(Copy, PartialEq, Debug)]
17+
#[derive(Copy, Clone, PartialEq, Debug)]
1818
#[repr(usize)]
1919
enum Foo {
2020
A, B, C
@@ -218,7 +218,7 @@ fn test_operators() {
218218
#[should_panic]
219219
fn test_overflow() {
220220
#[allow(dead_code)]
221-
#[derive(Copy)]
221+
#[derive(Copy, Clone)]
222222
#[repr(usize)]
223223
enum Bar {
224224
V00, V01, V02, V03, V04, V05, V06, V07, V08, V09,

src/libcollectionstest/slice.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1089,7 +1089,7 @@ fn test_bytes_set_memory() {
10891089
#[should_panic]
10901090
fn test_overflow_does_not_cause_segfault() {
10911091
let mut v = vec![];
1092-
v.reserve_exact(-1);
1092+
v.reserve_exact(!0);
10931093
v.push(1);
10941094
v.push(2);
10951095
}
@@ -1098,7 +1098,7 @@ fn test_overflow_does_not_cause_segfault() {
10981098
#[should_panic]
10991099
fn test_overflow_does_not_cause_segfault_managed() {
11001100
let mut v = vec![Rc::new(1)];
1101-
v.reserve_exact(-1);
1101+
v.reserve_exact(!0);
11021102
v.push(Rc::new(2));
11031103
}
11041104

src/libcore/atomic.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ unsafe impl<T> Sync for AtomicPtr<T> {}
122122
/// Rust's memory orderings are [the same as
123123
/// C++'s](http://gcc.gnu.org/wiki/Atomic/GCCMM/AtomicSync).
124124
#[stable(feature = "rust1", since = "1.0.0")]
125-
#[derive(Copy)]
125+
#[derive(Copy, Clone)]
126126
pub enum Ordering {
127127
/// No ordering constraints, only atomic operations.
128128
#[stable(feature = "rust1", since = "1.0.0")]
@@ -161,7 +161,7 @@ pub const ATOMIC_USIZE_INIT: AtomicUsize =
161161
AtomicUsize { v: UnsafeCell { value: 0, } };
162162

163163
// NB: Needs to be -1 (0b11111111...) to make fetch_nand work correctly
164-
const UINT_TRUE: usize = -1;
164+
const UINT_TRUE: usize = !0;
165165

166166
impl AtomicBool {
167167
/// Creates a new `AtomicBool`.

src/libcore/cell.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ pub enum BorrowState {
287287
// (will not outgrow its range since `usize` is the size of the address space)
288288
type BorrowFlag = usize;
289289
const UNUSED: BorrowFlag = 0;
290-
const WRITING: BorrowFlag = -1;
290+
const WRITING: BorrowFlag = !0;
291291

292292
impl<T> RefCell<T> {
293293
/// Creates a new `RefCell` containing `value`.

src/libcore/fmt/mod.rs

+10-3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
use cell::{Cell, RefCell, Ref, RefMut, BorrowState};
1616
use char::CharExt;
17+
use clone::Clone;
1718
use iter::Iterator;
1819
use marker::{Copy, PhantomData, Sized};
1920
use mem;
@@ -53,7 +54,7 @@ pub type Result = result::Result<(), Error>;
5354
/// occurred. Any extra information must be arranged to be transmitted through
5455
/// some other means.
5556
#[stable(feature = "rust1", since = "1.0.0")]
56-
#[derive(Copy, Debug)]
57+
#[derive(Copy, Clone, Debug)]
5758
pub struct Error;
5859

5960
/// A collection of methods that are required to format a message into a stream.
@@ -140,6 +141,12 @@ pub struct ArgumentV1<'a> {
140141
formatter: fn(&Void, &mut Formatter) -> Result,
141142
}
142143

144+
impl<'a> Clone for ArgumentV1<'a> {
145+
fn clone(&self) -> ArgumentV1<'a> {
146+
*self
147+
}
148+
}
149+
143150
impl<'a> ArgumentV1<'a> {
144151
#[inline(never)]
145152
fn show_usize(x: &usize, f: &mut Formatter) -> Result {
@@ -174,7 +181,7 @@ impl<'a> ArgumentV1<'a> {
174181
}
175182

176183
// flags available in the v1 format of format_args
177-
#[derive(Copy)]
184+
#[derive(Copy, Clone)]
178185
#[allow(dead_code)] // SignMinus isn't currently used
179186
enum FlagV1 { SignPlus, SignMinus, Alternate, SignAwareZeroPad, }
180187

@@ -221,7 +228,7 @@ impl<'a> Arguments<'a> {
221228
/// macro validates the format string at compile-time so usage of the `write`
222229
/// and `format` functions can be safely performed.
223230
#[stable(feature = "rust1", since = "1.0.0")]
224-
#[derive(Copy)]
231+
#[derive(Copy, Clone)]
225232
pub struct Arguments<'a> {
226233
// Format string pieces to print.
227234
pieces: &'a [&'a str],

src/libcore/fmt/num.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ impl GenericRadix for Radix {
139139
/// A helper type for formatting radixes.
140140
#[unstable(feature = "core",
141141
reason = "may be renamed or move to a different module")]
142-
#[derive(Copy)]
142+
#[derive(Copy, Clone)]
143143
pub struct RadixFmt<T, R>(T, R);
144144

145145
/// Constructs a radix formatter in the range of `2..36`.

src/libcore/fmt/rt/v1.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
1717
#![stable(feature = "rust1", since = "1.0.0")]
1818

19-
#[derive(Copy)]
19+
#[derive(Copy, Clone)]
2020
#[stable(feature = "rust1", since = "1.0.0")]
2121
pub struct Argument {
2222
#[stable(feature = "rust1", since = "1.0.0")]
@@ -25,7 +25,7 @@ pub struct Argument {
2525
pub format: FormatSpec,
2626
}
2727

28-
#[derive(Copy)]
28+
#[derive(Copy, Clone)]
2929
#[stable(feature = "rust1", since = "1.0.0")]
3030
pub struct FormatSpec {
3131
#[stable(feature = "rust1", since = "1.0.0")]
@@ -41,7 +41,7 @@ pub struct FormatSpec {
4141
}
4242

4343
/// Possible alignments that can be requested as part of a formatting directive.
44-
#[derive(Copy, PartialEq)]
44+
#[derive(Copy, Clone, PartialEq)]
4545
#[stable(feature = "rust1", since = "1.0.0")]
4646
pub enum Alignment {
4747
/// Indication that contents should be left-aligned.
@@ -58,7 +58,7 @@ pub enum Alignment {
5858
Unknown,
5959
}
6060

61-
#[derive(Copy)]
61+
#[derive(Copy, Clone)]
6262
#[stable(feature = "rust1", since = "1.0.0")]
6363
pub enum Count {
6464
#[stable(feature = "rust1", since = "1.0.0")]
@@ -71,7 +71,7 @@ pub enum Count {
7171
Implied,
7272
}
7373

74-
#[derive(Copy)]
74+
#[derive(Copy, Clone)]
7575
#[stable(feature = "rust1", since = "1.0.0")]
7676
pub enum Position {
7777
#[stable(feature = "rust1", since = "1.0.0")]

src/libcore/marker.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ pub trait Sized : MarkerTrait {
7676
///
7777
/// ```
7878
/// // we can just derive a `Copy` implementation
79-
/// #[derive(Debug, Copy)]
79+
/// #[derive(Debug, Copy, Clone)]
8080
/// struct Foo;
8181
///
8282
/// let x = Foo;
@@ -125,7 +125,7 @@ pub trait Sized : MarkerTrait {
125125
/// There are two ways to implement `Copy` on your type:
126126
///
127127
/// ```
128-
/// #[derive(Copy)]
128+
/// #[derive(Copy, Clone)]
129129
/// struct MyStruct;
130130
/// ```
131131
///
@@ -134,6 +134,7 @@ pub trait Sized : MarkerTrait {
134134
/// ```
135135
/// struct MyStruct;
136136
/// impl Copy for MyStruct {}
137+
/// impl Clone for MyStruct { fn clone(&self) -> MyStruct { *self } }
137138
/// ```
138139
///
139140
/// There is a small difference between the two: the `derive` strategy will also place a `Copy`
@@ -155,7 +156,7 @@ pub trait Sized : MarkerTrait {
155156
/// change: that second example would fail to compile if we made `Foo` non-`Copy`.
156157
#[stable(feature = "rust1", since = "1.0.0")]
157158
#[lang="copy"]
158-
pub trait Copy : MarkerTrait {
159+
pub trait Copy : Clone {
159160
// Empty.
160161
}
161162

0 commit comments

Comments
 (0)