Skip to content

Commit 4797370

Browse files
committed
---
yaml --- r: 44878 b: refs/heads/master c: 2f90112 h: refs/heads/master v: v3
1 parent bad100d commit 4797370

Some content is hidden

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

66 files changed

+854
-628
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: a4175c34c3e7ebeee69417abb03953fb81875165
2+
refs/heads/master: 2f901126d4c2c19334842e539561b15e7e74159d
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a6d9689399d091c3265f00434a69c551a61c28dc
55
refs/heads/try: ef355f6332f83371e4acf04fc4eb940ab41d78d3

trunk/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ You're not off the hook even if you just stick to documentation; code examples i
1111
Pull requests will be treated as "review requests",
1212
and we will give feedback we expect to see corrected on [style](https://github.com/mozilla/rust/wiki/Note-style-guide) and substance before pulling.
1313
Changes contributed via pull request should focus on a single issue at a time, like any other.
14-
We will not look accept pull-requests that try to "sneak" unrelated changes in.
14+
We will not accept pull-requests that try to "sneak" unrelated changes in.
1515

1616
Normally, all pull requests must include regression tests (see [Note-testsuite](https://github.com/mozilla/rust/wiki/Note-testsuite)) that test your change.
1717
Occasionally, a change will be very difficult to test for.

trunk/doc/rust.md

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -908,6 +908,11 @@ function defined above on `[1, 2]` will instantiate type parameter `T`
908908
with `int`, and require the closure parameter to have type
909909
`fn(int)`.
910910

911+
The type parameters can also be explicitly supplied in a trailing
912+
[path](#paths) component after the function name. This might be necessary
913+
if there is not sufficient context to determine the type parameters. For
914+
example, `sys::size_of::<u32>() == 4`.
915+
911916
Since a parameter type is opaque to the generic function, the set of
912917
operations that can be performed on it is limited. Values of parameter
913918
type can always be moved, but they can only be copied when the
@@ -1085,6 +1090,15 @@ let p = Point(10, 11);
10851090
let px: int = match p { Point(x, _) => x };
10861091
~~~~
10871092

1093+
A _unit-like struct_ is a structure without any fields, defined by leaving off the fields list entirely.
1094+
Such types will have a single value, just like the [unit value `()`](#unit-and-boolean-literals) of the unit type.
1095+
For example:
1096+
1097+
~~~~
1098+
struct Cookie;
1099+
let c = [Cookie, Cookie, Cookie, Cookie];
1100+
~~~~
1101+
10881102
### Enumerations
10891103

10901104
An _enumeration_ is a simultaneous definition of a nominal [enumerated type](#enumerated-types) as well as a set of *constructors*,
@@ -1590,7 +1604,8 @@ struct_expr : expr_path '{' ident ':' expr
15901604
[ ',' ident ':' expr ] *
15911605
[ ".." expr ] '}' |
15921606
expr_path '(' expr
1593-
[ ',' expr ] * ')'
1607+
[ ',' expr ] * ')' |
1608+
expr_path
15941609
~~~~~~~~
15951610

15961611
There are several forms of structure expressions.
@@ -1600,23 +1615,28 @@ providing the field values of a new instance of the structure.
16001615
A field name can be any identifier, and is separated from its value expression by a colon.
16011616
To indicate that a field is mutable, the `mut` keyword is written before its name.
16021617

1603-
A _tuple structure expression_ constists of the [path](#paths) of a [structure item](#structures),
1618+
A _tuple structure expression_ consists of the [path](#paths) of a [structure item](#structures),
16041619
followed by a parenthesized list of one or more comma-separated expressions
16051620
(in other words, the path of a structured item followed by a tuple expression).
16061621
The structure item must be a tuple structure item.
16071622

1623+
A _unit-like structure expression_ consists only of the [path](#paths) of a [structure item](#structures).
1624+
16081625
The following are examples of structure expressions:
16091626

16101627
~~~~
16111628
# struct Point { x: float, y: float }
16121629
# struct TuplePoint(float, float);
16131630
# mod game { pub struct User { name: &str, age: uint, score: uint } }
1631+
# struct Cookie; fn some_fn<T>(t: T) {}
16141632
Point {x: 10f, y: 20f};
16151633
TuplePoint(10f, 20f);
16161634
let u = game::User {name: "Joe", age: 35u, score: 100_000};
1635+
some_fn::<Cookie>(Cookie);
16171636
~~~~
16181637

16191638
A structure expression forms a new value of the named structure type.
1639+
Note that for a given *unit-like* structure type, this will always be the same value.
16201640

16211641
A structure expression can terminate with the syntax `..` followed by an expression to denote a functional update.
16221642
The expression following `..` (the base) must be of the same structure type as the new structure type being formed.
@@ -2040,12 +2060,14 @@ an optional reference slot to serve as the function's output, bound to the
20402060
`lval` on the right hand side of the call. If the function eventually returns,
20412061
then the expression completes.
20422062

2043-
An example of a call expression:
2063+
Some examples of call expressions:
20442064

20452065
~~~~
20462066
# fn add(x: int, y: int) -> int { 0 }
2067+
# use core::from_str::FromStr::from_str;
20472068
20482069
let x: int = add(1, 2);
2070+
let pi = from_str::<f32>("3.14");
20492071
~~~~
20502072

20512073
### Lambda expressions
@@ -2643,7 +2665,10 @@ the resulting `struct` value will always be laid out in memory in the order spec
26432665
The fields of a `struct` may be qualified by [visibility modifiers](#visibility-modifiers),
26442666
to restrict access to implementation-private data in a structure.
26452667

2646-
A `tuple struct` type is just like a structure type, except that the fields are anonymous.
2668+
A _tuple struct_ type is just like a structure type, except that the fields are anonymous.
2669+
2670+
A _unit-like struct_ type is like a structure type, except that it has no fields.
2671+
The one value constructed by the associated [structure expression](#structure-expression) is the only value that inhabits such a type.
26472672

26482673
### Enumerated types
26492674

trunk/src/libcore/at_vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ pub mod raw {
183183
use at_vec::{capacity, rustrt};
184184
use cast::transmute;
185185
use libc;
186-
use private::intrinsics::{move_val_init};
186+
use unstable::intrinsics::{move_val_init};
187187
use ptr::addr_of;
188188
use ptr;
189189
use sys;

trunk/src/libcore/cleanup.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ fn debug_mem() -> bool {
154154
#[cfg(notest)]
155155
#[lang="annihilate"]
156156
pub unsafe fn annihilate() {
157-
use rt::local_free;
157+
use unstable::lang::local_free;
158158
use io::WriterUtil;
159159
use io;
160160
use libc;

trunk/src/libcore/comm.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ use either::{Either, Left, Right};
1212
use kinds::Owned;
1313
use option;
1414
use option::{Option, Some, None, unwrap};
15-
use private;
15+
use unstable;
1616
use vec;
1717

1818
use pipes::{recv, try_recv, wait_many, peek, PacketHeader};
1919

20-
// NOTE Making this public exposes some plumbing from pipes. Needs
21-
// some refactoring
20+
// FIXME #5160: Making this public exposes some plumbing from
21+
// pipes. Needs some refactoring
2222
pub use pipes::Selectable;
2323

2424
/// A trait for things that can send multiple messages.
@@ -242,7 +242,7 @@ impl<T: Owned> Peekable<T> for PortSet<T> {
242242
}
243243
244244
/// A channel that can be shared between many senders.
245-
pub type SharedChan<T> = private::Exclusive<Chan<T>>;
245+
pub type SharedChan<T> = unstable::Exclusive<Chan<T>>;
246246
247247
impl<T: Owned> GenericChan<T> for SharedChan<T> {
248248
fn send(x: T) {
@@ -268,7 +268,7 @@ impl<T: Owned> GenericSmartChan<T> for SharedChan<T> {
268268
269269
/// Converts a `chan` into a `shared_chan`.
270270
pub fn SharedChan<T:Owned>(c: Chan<T>) -> SharedChan<T> {
271-
private::exclusive(c)
271+
unstable::exclusive(c)
272272
}
273273
274274
/// Receive a message from one of two endpoints.

trunk/src/libcore/core.rc

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -41,7 +41,7 @@ Implicitly, all crates behave as if they included the following prologue:
4141
url = "https://github.com/mozilla/rust/tree/master/src/libcore")];
4242

4343
#[comment = "The Rust core library"];
44-
#[license = "MIT"];
44+
#[license = "MIT/ASL2"];
4545
#[crate_type = "lib"];
4646

4747

@@ -225,11 +225,13 @@ pub const debug : u32 = 4_u32;
225225

226226
/* Unsupported interfaces */
227227

228-
// The runtime interface used by the compiler
229-
#[cfg(notest)] pub mod rt;
230228
// Private APIs
231-
pub mod private;
232-
229+
pub mod unstable;
230+
// NOTE: Remove after snapshot
231+
#[cfg(stage0)]
232+
pub mod private {
233+
pub use super::unstable::extfmt;
234+
}
233235

234236
/* For internal use, not exported */
235237

0 commit comments

Comments
 (0)