Skip to content

Commit dfa4756

Browse files
committed
---
yaml --- r: 236430 b: refs/heads/auto c: e7a7388 h: refs/heads/master v: v3
1 parent b2adcca commit dfa4756

Some content is hidden

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

62 files changed

+202
-331
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
88
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
99
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1010
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
11-
refs/heads/auto: 459f7720b99db16f3b9017820b1979698ba8c90b
11+
refs/heads/auto: e7a73881e916d08c3edd97369c127e451b4717c8
1212
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1313
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336
1414
refs/tags/0.2: 1754d02027f2924bed83b0160ee340c7f41d5ea1

branches/auto/src/doc/grammar.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ provides only one kind of material:
99

1010
This document does not serve as an introduction to the language. Background
1111
familiarity with the language is assumed. A separate [guide] is available to
12-
help acquire such background familiarity.
12+
help acquire such background.
1313

1414
This document also does not serve as a reference to the [standard] library
1515
included in the language distribution. Those libraries are documented

branches/auto/src/doc/reference.md

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ There are several kinds of item:
674674
* [modules](#modules)
675675
* [functions](#functions)
676676
* [type definitions](grammar.html#type-definitions)
677-
* [structures](#structures)
677+
* [structs](#structs)
678678
* [enumerations](#enumerations)
679679
* [constant items](#constant-items)
680680
* [static items](#static-items)
@@ -900,9 +900,10 @@ fn main() {}
900900

901901
### Functions
902902

903-
A _function item_ defines a sequence of [statements](#statements) and an
904-
optional final [expression](#expressions), along with a name and a set of
905-
parameters. Functions are declared with the keyword `fn`. Functions declare a
903+
A _function item_ defines a sequence of [statements](#statements) and a
904+
final [expression](#expressions), along with a name and a set of
905+
parameters. Other than a name, all these are optional.
906+
Functions are declared with the keyword `fn`. Functions may declare a
906907
set of *input* [*variables*](#variables) as parameters, through which the caller
907908
passes arguments into the function, and the *output* [*type*](#types)
908909
of the value the function will return to its caller on completion.
@@ -921,7 +922,7 @@ An example of a function:
921922

922923
```
923924
fn add(x: i32, y: i32) -> i32 {
924-
return x + y;
925+
x + y
925926
}
926927
```
927928

@@ -1155,7 +1156,7 @@ type Point = (u8, u8);
11551156
let p: Point = (41, 68);
11561157
```
11571158

1158-
### Structures
1159+
### Structs
11591160

11601161
A _structure_ is a nominal [structure type](#structure-types) defined with the
11611162
keyword `struct`.
@@ -2614,21 +2615,21 @@ comma:
26142615
### Structure expressions
26152616

26162617
There are several forms of structure expressions. A _structure expression_
2617-
consists of the [path](#paths) of a [structure item](#structures), followed by
2618+
consists of the [path](#paths) of a [structure item](#structs), followed by
26182619
a brace-enclosed list of one or more comma-separated name-value pairs,
26192620
providing the field values of a new instance of the structure. A field name
26202621
can be any identifier, and is separated from its value expression by a colon.
26212622
The location denoted by a structure field is mutable if and only if the
26222623
enclosing structure is mutable.
26232624

26242625
A _tuple structure expression_ consists of the [path](#paths) of a [structure
2625-
item](#structures), followed by a parenthesized list of one or more
2626+
item](#structs), followed by a parenthesized list of one or more
26262627
comma-separated expressions (in other words, the path of a structure item
26272628
followed by a tuple expression). The structure item must be a tuple structure
26282629
item.
26292630

26302631
A _unit-like structure expression_ consists only of the [path](#paths) of a
2631-
[structure item](#structures).
2632+
[structure item](#structs).
26322633

26332634
The following are examples of structure expressions:
26342635

@@ -3145,7 +3146,7 @@ if` condition is evaluated. If all `if` and `else if` conditions evaluate to
31453146

31463147
A `match` expression branches on a *pattern*. The exact form of matching that
31473148
occurs depends on the pattern. Patterns consist of some combination of
3148-
literals, destructured arrays or enum constructors, structures and tuples,
3149+
literals, destructured arrays or enum constructors, structs and tuples,
31493150
variable binding specifications, wildcards (`..`), and placeholders (`_`). A
31503151
`match` expression has a *head expression*, which is the value to compare to
31513152
the patterns. The type of the patterns must equal the type of the head
@@ -3469,7 +3470,7 @@ named reference to an [`enum` item](#enumerations).
34693470
### Recursive types
34703471

34713472
Nominal types — [enumerations](#enumerated-types) and
3472-
[structures](#structure-types) — may be recursive. That is, each `enum`
3473+
[structs](#structure-types) — may be recursive. That is, each `enum`
34733474
constructor or `struct` field may refer, directly or indirectly, to the
34743475
enclosing `enum` or `struct` type itself. Such recursion has restrictions:
34753476

@@ -3497,7 +3498,7 @@ let a: List<i32> = List::Cons(7, Box::new(List::Cons(13, Box::new(List::Nil))));
34973498
### Pointer types
34983499

34993500
All pointers in Rust are explicit first-class values. They can be copied,
3500-
stored into data structures, and returned from functions. There are two
3501+
stored into data structs, and returned from functions. There are two
35013502
varieties of pointer in Rust:
35023503

35033504
* References (`&`)
@@ -3897,7 +3898,7 @@ references to boxes are dropped.
38973898
### Variables
38983899

38993900
A _variable_ is a component of a stack frame, either a named function parameter,
3900-
an anonymous [temporary](#lvalues,-rvalues-and-temporaries), or a named local
3901+
an anonymous [temporary](#lvalues-rvalues-and-temporaries), or a named local
39013902
variable.
39023903

39033904
A _local variable_ (or *stack-local* allocation) holds a value directly,
@@ -4036,10 +4037,6 @@ In general, `--crate-type=bin` or `--crate-type=lib` should be sufficient for
40364037
all compilation needs, and the other options are just available if more
40374038
fine-grained control is desired over the output format of a Rust crate.
40384039

4039-
# Appendix: Rationales and design trade-offs
4040-
4041-
*TODO*.
4042-
40434040
# Appendix: Influences
40444041

40454042
Rust is not a particularly original language, with design elements coming from

branches/auto/src/liballoc/boxed.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,10 @@ use core::raw::TraitObject;
8080
/// use std::boxed::HEAP;
8181
///
8282
/// fn main() {
83-
/// let foo = box(HEAP) 5;
83+
/// let foo: Box<i32> = in HEAP { 5 };
8484
/// let foo = box 5;
8585
/// }
8686
/// ```
87-
#[lang = "exchange_heap"]
8887
#[unstable(feature = "box_heap",
8988
reason = "may be renamed; uncertain about custom allocator design",
9089
issue = "27779")]

branches/auto/src/libcollections/binary_heap.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,12 +167,22 @@ use vec::{self, Vec};
167167
/// item's ordering relative to any other item, as determined by the `Ord`
168168
/// trait, changes while it is in the heap. This is normally only possible
169169
/// through `Cell`, `RefCell`, global state, I/O, or unsafe code.
170-
#[derive(Clone)]
171170
#[stable(feature = "rust1", since = "1.0.0")]
172171
pub struct BinaryHeap<T> {
173172
data: Vec<T>,
174173
}
175174

175+
#[stable(feature = "rust1", since = "1.0.0")]
176+
impl<T: Clone> Clone for BinaryHeap<T> {
177+
fn clone(&self) -> Self {
178+
BinaryHeap { data: self.data.clone() }
179+
}
180+
181+
fn clone_from(&mut self, source: &Self) {
182+
self.data.clone_from(&source.data);
183+
}
184+
}
185+
176186
#[stable(feature = "rust1", since = "1.0.0")]
177187
impl<T: Ord> Default for BinaryHeap<T> {
178188
#[inline]

branches/auto/src/libcollections/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
#![feature(unsafe_no_drop_flag, filling_drop)]
6363
#![feature(decode_utf16)]
6464
#![feature(utf8_error)]
65-
#![cfg_attr(test, feature(rand, test))]
65+
#![cfg_attr(test, feature(clone_from_slice, rand, test))]
6666

6767
#![feature(no_std)]
6868
#![no_std]

branches/auto/src/libcollections/str.rs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -715,8 +715,7 @@ impl str {
715715
/// Returns `None` if it doesn't exist.
716716
///
717717
/// The pattern can be a simple `&str`, `char`, or a closure that
718-
/// determines the
719-
/// split.
718+
/// determines if a character matches.
720719
///
721720
/// # Examples
722721
///
@@ -760,7 +759,7 @@ impl str {
760759
/// Returns `None` if it doesn't exist.
761760
///
762761
/// The pattern can be a simple `&str`, `char`,
763-
/// or a closure that determines the split.
762+
/// or a closure that determines if a character matches.
764763
///
765764
/// # Examples
766765
///
@@ -1096,7 +1095,7 @@ impl str {
10961095
/// An iterator over the matches of a pattern within `self`.
10971096
///
10981097
/// The pattern can be a simple `&str`, `char`, or a closure that
1099-
/// determines the split.
1098+
/// determines if a character matches.
11001099
/// Additional libraries might provide more complex patterns like
11011100
/// regular expressions.
11021101
///
@@ -1129,7 +1128,7 @@ impl str {
11291128
/// reverse order.
11301129
///
11311130
/// The pattern can be a simple `&str`, `char`, or a closure that
1132-
/// determines the split.
1131+
/// determines if a character matches.
11331132
/// Additional libraries might provide more complex patterns like
11341133
/// regular expressions.
11351134
///
@@ -1166,8 +1165,7 @@ impl str {
11661165
/// match are returned.
11671166
///
11681167
/// The pattern can be a simple `&str`, `char`, or a closure that
1169-
/// determines
1170-
/// the split.
1168+
/// determines if a character matches.
11711169
/// Additional libraries might provide more complex patterns like
11721170
/// regular expressions.
11731171
///
@@ -1214,8 +1212,7 @@ impl str {
12141212
/// match are returned.
12151213
///
12161214
/// The pattern can be a simple `&str`, `char`, or a closure that
1217-
/// determines
1218-
/// the split.
1215+
/// determines if a character matches.
12191216
/// Additional libraries might provide more complex patterns like
12201217
/// regular expressions.
12211218
///
@@ -1296,7 +1293,7 @@ impl str {
12961293
/// repeatedly removed.
12971294
///
12981295
/// The pattern can be a simple `char`, or a closure that determines
1299-
/// the split.
1296+
/// if a character matches.
13001297
///
13011298
/// # Examples
13021299
///
@@ -1326,7 +1323,7 @@ impl str {
13261323
/// repeatedly removed.
13271324
///
13281325
/// The pattern can be a simple `&str`, `char`, or a closure that
1329-
/// determines the split.
1326+
/// determines if a character matches.
13301327
///
13311328
/// # Examples
13321329
///
@@ -1346,7 +1343,7 @@ impl str {
13461343
/// repeatedly removed.
13471344
///
13481345
/// The pattern can be a simple `&str`, `char`, or a closure that
1349-
/// determines the split.
1346+
/// determines if a character matches.
13501347
///
13511348
/// # Examples
13521349
///

branches/auto/src/libcollections/string.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use vec::Vec;
3030
use boxed::Box;
3131

3232
/// A growable string stored as a UTF-8 encoded buffer.
33-
#[derive(Clone, PartialOrd, Eq, Ord)]
33+
#[derive(PartialOrd, Eq, Ord)]
3434
#[stable(feature = "rust1", since = "1.0.0")]
3535
pub struct String {
3636
vec: Vec<u8>,
@@ -765,6 +765,17 @@ impl fmt::Display for FromUtf16Error {
765765
}
766766
}
767767

768+
#[stable(feature = "rust1", since = "1.0.0")]
769+
impl Clone for String {
770+
fn clone(&self) -> Self {
771+
String { vec: self.vec.clone() }
772+
}
773+
774+
fn clone_from(&mut self, source: &Self) {
775+
self.vec.clone_from(&source.vec);
776+
}
777+
}
778+
768779
#[stable(feature = "rust1", since = "1.0.0")]
769780
impl FromIterator<char> for String {
770781
fn from_iter<I: IntoIterator<Item=char>>(iterable: I) -> String {

branches/auto/src/libcollections/vec.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,19 +1007,15 @@ impl<T:Clone> Clone for Vec<T> {
10071007

10081008
fn clone_from(&mut self, other: &Vec<T>) {
10091009
// drop anything in self that will not be overwritten
1010-
if self.len() > other.len() {
1011-
self.truncate(other.len())
1012-
}
1010+
self.truncate(other.len());
1011+
let len = self.len();
10131012

10141013
// reuse the contained values' allocations/resources.
1015-
for (place, thing) in self.iter_mut().zip(other) {
1016-
place.clone_from(thing)
1017-
}
1014+
self.clone_from_slice(&other[..len]);
10181015

10191016
// self.len <= other.len due to the truncate above, so the
10201017
// slice here is always in-bounds.
1021-
let slice = &other[self.len()..];
1022-
self.push_all(slice);
1018+
self.push_all(&other[len..]);
10231019
}
10241020
}
10251021

branches/auto/src/libcore/array.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,23 @@ use slice::{Iter, IterMut, SliceExt};
3535
///
3636
/// This trait can be used to implement other traits on fixed-size arrays
3737
/// without causing much metadata bloat.
38-
pub trait FixedSizeArray<T> {
38+
///
39+
/// The trait is marked unsafe in order to restrict implementors to fixed-size
40+
/// arrays. User of this trait can assume that implementors have the exact
41+
/// layout in memory of a fixed size array (for example, for unsafe
42+
/// initialization).
43+
///
44+
/// Note that the traits AsRef and AsMut provide similar methods for types that
45+
/// may not be fixed-size arrays. Implementors should prefer those traits
46+
/// instead.
47+
pub unsafe trait FixedSizeArray<T> {
3948
/// Converts the array to immutable slice
4049
fn as_slice(&self) -> &[T];
4150
/// Converts the array to mutable slice
4251
fn as_mut_slice(&mut self) -> &mut [T];
4352
}
4453

45-
impl<T, A: Unsize<[T]>> FixedSizeArray<T> for A {
54+
unsafe impl<T, A: Unsize<[T]>> FixedSizeArray<T> for A {
4655
#[inline]
4756
fn as_slice(&self) -> &[T] {
4857
self

branches/auto/src/liblibc/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1683,10 +1683,12 @@ pub mod types {
16831683
pub mod posix01 {
16841684
use types::common::c95::{c_void};
16851685
use types::common::c99::{uint32_t, uint64_t};
1686-
use types::os::arch::c95::{c_int, c_uint, c_long, time_t};
1686+
use types::os::arch::c95::{c_long, time_t};
16871687
use types::os::arch::posix88::{dev_t, gid_t};
16881688
use types::os::arch::posix88::{mode_t, off_t};
16891689
use types::os::arch::posix88::{uid_t};
1690+
#[cfg(target_os = "netbsd")]
1691+
use types::os::arch::c95::{c_int, c_uint};
16901692

16911693
pub type nlink_t = uint32_t;
16921694
pub type blksize_t = uint32_t;

branches/auto/src/librustc/middle/cfg/construct.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,13 +344,12 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
344344
self.straightline(expr, pred, [r, l].iter().map(|&e| &**e))
345345
}
346346

347-
hir::ExprBox(Some(ref l), ref r) |
348347
hir::ExprIndex(ref l, ref r) |
349348
hir::ExprBinary(_, ref l, ref r) => { // NB: && and || handled earlier
350349
self.straightline(expr, pred, [l, r].iter().map(|&e| &**e))
351350
}
352351

353-
hir::ExprBox(None, ref e) |
352+
hir::ExprBox(ref e) |
354353
hir::ExprAddrOf(_, ref e) |
355354
hir::ExprCast(ref e, _) |
356355
hir::ExprUnary(_, ref e) |

branches/auto/src/librustc/middle/check_const.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -568,8 +568,7 @@ fn check_expr<'a, 'tcx>(v: &mut CheckCrateVisitor<'a, 'tcx>,
568568
"user-defined operators are not allowed in {}s", v.msg());
569569
}
570570
}
571-
hir::ExprBox(..) |
572-
hir::ExprUnary(hir::UnUniq, _) => {
571+
hir::ExprBox(_) => {
573572
v.add_qualif(ConstQualif::NOT_CONST);
574573
if v.mode != Mode::Var {
575574
span_err!(v.tcx.sess, e.span, E0010,

0 commit comments

Comments
 (0)