Skip to content

Commit 559f0aa

Browse files
committed
---
yaml --- r: 114523 b: refs/heads/master c: 1fc29ef h: refs/heads/master i: 114521: ce0db70 114519: 93859e1 v: v3
1 parent 0b1a035 commit 559f0aa

File tree

9 files changed

+210
-26
lines changed

9 files changed

+210
-26
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: 0df221e993a1f7f1fc4d80c6a4fa0e43c05c30c7
2+
refs/heads/master: 1fc29ef0c8c35eacf7d72e5eb0e7c961009ab4c9
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: ec0258a381b88b5574e3f8ce72ae553ac3a574b7
55
refs/heads/try: 7c6c492fb2af9a85f21ff952942df3523b22fd17

trunk/src/doc/tutorial.md

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,24 @@ they don't contain references to names that aren't actually defined.
5757
5858
# Getting started
5959

60-
> *Warning:* The tarball and installer links are for the most recent
61-
> release, not master. To use master, you **must** build from [git].
60+
There are two ways to install the Rust compiler: by building from source or
61+
by downloading prebuilt binaries or installers for your platform. The
62+
[install page][rust-install] contains links to download binaries for both
63+
the nightly build and the most current Rust major release. For Windows and
64+
OS X, the install page provides links to native installers.
6265

63-
The Rust compiler currently must be built from a [tarball] or [git], unless
64-
you are on Windows, in which case using the [installer][win-exe] is
65-
recommended. There is a list of community-maintained nightly builds and
66-
packages [on the wiki][wiki-packages].
66+
> *Note:* Windows users should read the detailed
67+
> [Getting started][wiki-start] notes on the wiki. Even when using
68+
> the binary installer, the Windows build requires a MinGW installation,
69+
> the precise details of which are not discussed here.
70+
71+
For Linux and OS X, the install page provides links to binary tarballs.
72+
To install the Rust compiler from the from a binary tarball, download
73+
the binary package, extract it, and execute the `install.sh` script in
74+
the root directory of the package.
75+
76+
To build the Rust compiler from source, you will need to obtain the source through
77+
[Git][git] or by downloading the source package from the [install page][rust-install].
6778

6879
Since the Rust compiler is written in Rust, it must be built by
6980
a precompiled "snapshot" version of itself (made in an earlier state
@@ -79,13 +90,9 @@ Snapshot binaries are currently built and tested on several platforms:
7990
You may find that other platforms work, but these are our "tier 1"
8091
supported build environments that are most likely to work.
8192

82-
> *Note:* Windows users should read the detailed
83-
> [Getting started][wiki-start] notes on the wiki. Even when using
84-
> the binary installer, the Windows build requires a MinGW installation,
85-
> the precise details of which are not discussed here.
86-
8793
[wiki-start]: https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust
8894
[git]: https://github.com/mozilla/rust.git
95+
[rust-install]: http://www.rust-lang.org/install.html
8996

9097
To build from source you will also need the following prerequisite
9198
packages:
@@ -1099,7 +1106,7 @@ let ys = xs;
10991106
11001107
xs = Nil;
11011108
1102-
// `xs` can be used again
1109+
// `xs` can't be used again
11031110
~~~
11041111

11051112
A destructor call will only occur for a variable that has not been moved from,

trunk/src/libcore/tuple.rs

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,55 @@
99
// except according to those terms.
1010

1111
//! Operations on tuples
12-
13-
#![allow(missing_doc)]
12+
//!
13+
//! To access a single element of a tuple one can use the following
14+
//! methods:
15+
//!
16+
//! * `valN` - returns a value of _N_-th element
17+
//! * `refN` - returns a reference to _N_-th element
18+
//! * `mutN` - returns a mutable reference to _N_-th element
19+
//!
20+
//! Indexing starts from zero, so `val0` returns first value, `val1`
21+
//! returns second value, and so on. In general, a tuple with _S_
22+
//! elements provides aforementioned methods suffixed with numbers
23+
//! from `0` to `S-1`. Traits which contain these methods are
24+
//! implemented for tuples with up to 12 elements.
25+
//!
26+
//! If every type inside a tuple implements one of the following
27+
//! traits, then a tuple itself also implements it.
28+
//!
29+
//! * `Clone`
30+
//! * `Eq`
31+
//! * `TotalEq`
32+
//! * `Ord`
33+
//! * `TotalOrd`
34+
//! * `Default`
35+
//!
36+
//! # Examples
37+
//!
38+
//! Using methods:
39+
//!
40+
//! ```
41+
//! let pair = ("pi", 3.14);
42+
//! assert_eq!(pair.val0(), "pi");
43+
//! assert_eq!(pair.val1(), 3.14);
44+
//! ```
45+
//!
46+
//! Using traits implemented for tuples:
47+
//!
48+
//! ```
49+
//! use std::default::Default;
50+
//!
51+
//! let a = (1, 2);
52+
//! let b = (3, 4);
53+
//! assert!(a != b);
54+
//!
55+
//! let c = b.clone();
56+
//! assert!(b == c);
57+
//!
58+
//! let d : (u32, f32) = Default::default();
59+
//! assert_eq!(d, (0u32, 0.0f32));
60+
//! ```
1461
1562
use clone::Clone;
1663
#[cfg(not(test))] use cmp::*;
@@ -26,6 +73,7 @@ macro_rules! tuple_impls {
2673
}
2774
)+) => {
2875
$(
76+
#[allow(missing_doc)]
2977
pub trait $Tuple<$($T),+> {
3078
$(fn $valN(self) -> $T;)+
3179
$(fn $refN<'a>(&'a self) -> &'a $T;)+

trunk/src/librustc/middle/privacy.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,23 @@ impl<'a> Visitor<()> for EmbargoVisitor<'a> {
297297
}
298298
}
299299

300+
ast::ItemTy(ref ty, _) if public_first => {
301+
match ty.node {
302+
ast::TyPath(_, _, id) => {
303+
match self.tcx.def_map.borrow().get_copy(&id) {
304+
ast::DefPrimTy(..) => {},
305+
def => {
306+
let did = def_id_of_def(def);
307+
if is_local(did) {
308+
self.exported_items.insert(did.node);
309+
}
310+
}
311+
}
312+
}
313+
_ => {}
314+
}
315+
}
316+
300317
_ => {}
301318
}
302319

trunk/src/libstd/str.rs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,25 @@ Unicode string manipulation (`str` type)
1616
1717
Rust's string type is one of the core primitive types of the language. While
1818
represented by the name `str`, the name `str` is not actually a valid type in
19-
Rust. Each string must also be decorated with its ownership. This means that
20-
there is one common kind of string in Rust:
19+
Rust. Each string must also be decorated with a pointer. `String` is used
20+
for an owned string, so there is only one commonly-used `str` type in Rust:
21+
`&str`.
2122
22-
* `&str` - This is the borrowed string type. This type of string can only be
23-
created from the other kind of string. As the name "borrowed"
24-
implies, this type of string is owned elsewhere, and this string
25-
cannot be moved out of.
23+
`&str` is the borrowed string type. This type of string can only be created
24+
from other strings, unless it is a static string (see below). As the word
25+
"borrowed" implies, this type of string is owned elsewhere, and this string
26+
cannot be moved out of.
2627
27-
As an example, here's the one kind of string.
28+
As an example, here's some code that uses a string.
2829
2930
```rust
3031
fn main() {
3132
let borrowed_string = "This string is borrowed with the 'static lifetime";
3233
}
3334
```
3435
35-
From the example above, you can see that Rust has 1 different kind of string
36-
literal. The "borrowed literal" is akin to C's concept of a static string.
36+
From the example above, you can see that Rust's string literals have the
37+
`'static` lifetime. This is akin to C's concept of a static string.
3738
3839
String literals are allocated statically in the rodata of the
3940
executable/library. The string then has the type `&'static str` meaning that
@@ -509,7 +510,7 @@ pub fn from_utf8_lossy<'a>(v: &'a [u8]) -> MaybeOwned<'a> {
509510
Section: MaybeOwned
510511
*/
511512

512-
/// A MaybeOwned is a string that can hold either a String or a &str.
513+
/// A `MaybeOwned` is a string that can hold either a `String` or a `&str`.
513514
/// This can be useful as an optimization when an allocation is sometimes
514515
/// needed but not always.
515516
pub enum MaybeOwned<'a> {
@@ -519,7 +520,7 @@ pub enum MaybeOwned<'a> {
519520
Owned(String)
520521
}
521522

522-
/// SendStr is a specialization of `MaybeOwned` to be sendable
523+
/// `SendStr` is a specialization of `MaybeOwned` to be sendable
523524
pub type SendStr = MaybeOwned<'static>;
524525

525526
impl<'a> MaybeOwned<'a> {
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#![crate_type="lib"]
12+
#![deny(warnings)]
13+
14+
pub use src::aliases::B;
15+
pub use src::hidden_core::make;
16+
17+
mod src {
18+
pub mod aliases {
19+
use super::hidden_core::A;
20+
pub type B = A<f32>;
21+
}
22+
23+
pub mod hidden_core {
24+
use super::aliases::B;
25+
26+
pub struct A<T>;
27+
28+
pub fn make() -> B { A }
29+
30+
impl<T> A<T> {
31+
pub fn foo(&mut self) { println!("called foo"); }
32+
}
33+
}
34+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#![crate_type="lib"]
12+
#![deny(warnings)]
13+
14+
pub use src::aliases::B;
15+
pub use src::hidden_core::make;
16+
17+
mod src {
18+
pub mod aliases {
19+
use super::hidden_core::A;
20+
pub type B = A;
21+
}
22+
23+
pub mod hidden_core {
24+
use super::aliases::B;
25+
26+
pub struct A;
27+
28+
pub fn make() -> B { A }
29+
30+
impl A {
31+
pub fn foo(&mut self) { println!("called foo"); }
32+
}
33+
}
34+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// aux-build:issue-14421.rs
12+
13+
extern crate bug_lib = "issue-14421";
14+
15+
use bug_lib::B;
16+
use bug_lib::make;
17+
18+
pub fn main() {
19+
let mut an_A: B = make();
20+
an_A.foo();
21+
}
22+
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// aux-build:issue-14422.rs
12+
13+
extern crate bug_lib = "issue-14422";
14+
15+
use bug_lib::B;
16+
use bug_lib::make;
17+
18+
pub fn main() {
19+
let mut an_A: B = make();
20+
an_A.foo();
21+
}

0 commit comments

Comments
 (0)