Skip to content

Commit 788ac84

Browse files
---
yaml --- r: 218190 b: refs/heads/tmp c: 3c76163 h: refs/heads/master v: v3
1 parent 210ddcb commit 788ac84

File tree

11 files changed

+44
-201
lines changed

11 files changed

+44
-201
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
2626
refs/heads/beta: 18adf6230e2e229d4d73391cebff060afc5e5aaa
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
28-
refs/heads/tmp: b6c7dff72864f91e5256f7d50b6d0a3f03ee3733
28+
refs/heads/tmp: 3c76163e1dc410db525bfaa7157726bd7a8a7dfe
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: e6596d0052e79e6393bbee3538bb122930d89887
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828

branches/tmp/src/doc/trpl/concurrency.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,11 @@ system is up to the task, and gives you powerful ways to reason about
1010
concurrent code at compile time.
1111

1212
Before we talk about the concurrency features that come with Rust, it's important
13-
to understand something: Rust is low-level enough that the vast majority of
14-
this is provided by the standard library, not by the language. This means that
15-
if you don't like some aspect of the way Rust handles concurrency, you can
16-
implement an alternative way of doing things.
17-
[mio](https://github.com/carllerche/mio) is a real-world example of this
18-
principle in action.
13+
to understand something: Rust is low-level enough that all of this is provided
14+
by the standard library, not by the language. This means that if you don't like
15+
some aspect of the way Rust handles concurrency, you can implement an alternative
16+
way of doing things. [mio](https://github.com/carllerche/mio) is a real-world
17+
example of this principle in action.
1918

2019
## Background: `Send` and `Sync`
2120

branches/tmp/src/doc/trpl/lifetimes.md

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,6 @@ the lifetime `'a` has snuck in between the `&` and the `mut i32`. We read `&mut
101101
i32` as ‘a mutable reference to an i32’ and `&'a mut i32` as ‘a mutable
102102
reference to an `i32` with the lifetime `'a`’.
103103

104-
# In `struct`s
105-
106104
You’ll also need explicit lifetimes when working with [`struct`][structs]s:
107105

108106
```rust
@@ -139,33 +137,6 @@ x: &'a i32,
139137
uses it. So why do we need a lifetime here? We need to ensure that any reference
140138
to a `Foo` cannot outlive the reference to an `i32` it contains.
141139

142-
## `impl` blocks
143-
144-
Let’s implement a method on `Foo`:
145-
146-
```rust
147-
struct Foo<'a> {
148-
x: &'a i32,
149-
}
150-
151-
impl<'a> Foo<'a> {
152-
fn x(&self) -> &'a i32 { self.x }
153-
}
154-
155-
fn main() {
156-
let y = &5; // this is the same as `let _y = 5; let y = &_y;`
157-
let f = Foo { x: y };
158-
159-
println!("x is: {}", f.x());
160-
}
161-
```
162-
163-
As you can see, we need to declare a lifetime for `Foo` in the `impl` line. We repeat
164-
`'a` twice, just like on functions: `impl<'a>` defines a lifetime `'a`, and `Foo<'a>`
165-
uses it.
166-
167-
## Multiple lifetimes
168-
169140
If you have multiple references, you can use the same lifetime multiple times:
170141

171142
```rust

branches/tmp/src/doc/trpl/unsafe.md

Lines changed: 15 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ this, Rust has a keyword, `unsafe`. Code using `unsafe` has less restrictions
88
than normal code does.
99

1010
Let’s go over the syntax, and then we’ll talk semantics. `unsafe` is used in
11-
four contexts. The first one is to mark a function as unsafe:
11+
two contexts. The first one is to mark a function as unsafe:
1212

1313
```rust
1414
unsafe fn danger_will_robinson() {
@@ -27,40 +27,15 @@ unsafe {
2727
}
2828
```
2929

30-
The third is for unsafe traits:
31-
32-
```rust
33-
unsafe trait Scary { }
34-
```
35-
36-
And the fourth is for `impl`ementing one of those traits:
37-
38-
```rust
39-
# unsafe trait Scary { }
40-
unsafe impl Scary for i32 {}
41-
```
42-
4330
It’s important to be able to explicitly delineate code that may have bugs that
4431
cause big problems. If a Rust program segfaults, you can be sure it’s somewhere
4532
in the sections marked `unsafe`.
4633

4734
# What does ‘safe’ mean?
4835

49-
Safe, in the context of Rust, means ‘doesn’t do anything unsafe’. It’s also
50-
important to know that there are certain behaviors that are probably not
51-
desirable in your code, but are expressly _not_ unsafe:
36+
Safe, in the context of Rust, means “doesn’t do anything unsafe.” Easy!
5237

53-
* Deadlocks
54-
* Leaks of memory or other resources
55-
* Exiting without calling destructors
56-
* Integer overflow
57-
58-
Rust cannot prevent all kinds of software problems. Buggy code can and will be
59-
written in Rust. These things aren’t great, but they don’t qualify as `unsafe`
60-
specifically.
61-
62-
In addition, the following are all undefined behaviors in Rust, and must be
63-
avoided, even when writing `unsafe` code:
38+
Okay, let’s try again: what is not safe to do? Here’s a list:
6439

6540
* Data races
6641
* Dereferencing a null/dangling raw pointer
@@ -89,6 +64,18 @@ avoided, even when writing `unsafe` code:
8964
[undef]: http://llvm.org/docs/LangRef.html#undefined-values
9065
[aliasing]: http://llvm.org/docs/LangRef.html#pointer-aliasing-rules
9166

67+
Whew! That’s a bunch of stuff. It’s also important to notice all kinds of
68+
behaviors that are certainly bad, but are expressly _not_ unsafe:
69+
70+
* Deadlocks
71+
* Leaks of memory or other resources
72+
* Exiting without calling destructors
73+
* Integer overflow
74+
75+
Rust cannot prevent all kinds of software problems. Buggy code can and will be
76+
written in Rust. These things aren’t great, but they don’t qualify as `unsafe`
77+
specifically.
78+
9279
# Unsafe Superpowers
9380

9481
In both unsafe functions and unsafe blocks, Rust will let you do three things

branches/tmp/src/librustc_driver/driver.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ pub fn phase_2_configure_and_expand(sess: &Session,
547547
sess.diagnostic()));
548548

549549
krate = time(time_passes, "prelude injection", krate, |krate|
550-
syntax::std_inject::maybe_inject_prelude(&sess.parse_sess, krate));
550+
syntax::std_inject::maybe_inject_prelude(krate));
551551

552552
time(time_passes, "checking that all macro invocations are gone", &krate, |krate|
553553
syntax::ext::expand::check_for_macros(&sess.parse_sess, krate));

branches/tmp/src/librustc_typeck/diagnostics.rs

Lines changed: 4 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1368,62 +1368,6 @@ struct Foo {
13681368
```
13691369
"##,
13701370

1371-
E0128: r##"
1372-
Type parameter defaults can only use parameters that occur before them.
1373-
Erroneous code example:
1374-
1375-
```
1376-
pub struct Foo<T=U, U=()> {
1377-
field1: T,
1378-
filed2: U,
1379-
}
1380-
// error: type parameters with a default cannot use forward declared
1381-
// identifiers
1382-
```
1383-
1384-
Since type parameters are evaluated in-order, you may be able to fix this issue
1385-
by doing:
1386-
1387-
```
1388-
pub struct Foo<U=(), T=U> {
1389-
field1: T,
1390-
filed2: U,
1391-
}
1392-
```
1393-
1394-
Please also verify that this wasn't because of a name-clash and rename the type
1395-
parameter if so.
1396-
"##,
1397-
1398-
E0130: r##"
1399-
You declared a pattern as an argument in a foreign function declaration.
1400-
Erroneous code example:
1401-
1402-
```
1403-
extern {
1404-
fn foo((a, b): (u32, u32)); // error: patterns aren't allowed in foreign
1405-
// function declarations
1406-
}
1407-
```
1408-
1409-
Please replace the pattern argument with a regular one. Example:
1410-
1411-
```
1412-
struct SomeStruct {
1413-
a: u32,
1414-
b: u32,
1415-
}
1416-
1417-
extern {
1418-
fn foo(s: SomeStruct); // ok!
1419-
}
1420-
// or
1421-
extern {
1422-
fn foo(a: (u32, u32)); // ok!
1423-
}
1424-
```
1425-
"##,
1426-
14271371
E0131: r##"
14281372
It is not possible to define `main` with type parameters, or even with function
14291373
parameters. When `main` is present, it must take no arguments and return `()`.
@@ -1438,30 +1382,6 @@ fn(isize, *const *const u8) -> isize
14381382
```
14391383
"##,
14401384

1441-
E0159: r##"
1442-
You tried to use a trait as a struct constructor. Erroneous code example:
1443-
1444-
```
1445-
trait TraitNotAStruct {}
1446-
1447-
TraitNotAStruct{ value: 0 }; // error: use of trait `TraitNotAStruct` as a
1448-
// struct constructor
1449-
```
1450-
1451-
Please verify you used the correct type name or please implement the trait
1452-
on a struct and use this struct constructor. Example:
1453-
1454-
```
1455-
trait TraitNotAStruct {}
1456-
1457-
struct Foo {
1458-
value: i32
1459-
}
1460-
1461-
Foo{ value: 0 }; // ok!
1462-
```
1463-
"##,
1464-
14651385
E0166: r##"
14661386
This error means that the compiler found a return expression in a function
14671387
marked as diverging. A function diverges if it has `!` in the place of the
@@ -1547,6 +1467,7 @@ impl Foo for Bar {
15471467
// the impl
15481468
fn foo() {}
15491469
}
1470+
```
15501471
"##,
15511472

15521473
E0192: r##"
@@ -2058,8 +1979,11 @@ register_diagnostics! {
20581979
E0122,
20591980
E0123,
20601981
E0127,
1982+
E0128,
20611983
E0129,
1984+
E0130,
20621985
E0141,
1986+
E0159,
20631987
E0163,
20641988
E0164,
20651989
E0167,

branches/tmp/src/libsyntax/feature_gate.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,6 @@ const KNOWN_FEATURES: &'static [(&'static str, &'static str, Status)] = &[
155155

156156
// Allows the definition of `const fn` functions.
157157
("const_fn", "1.2.0", Active),
158-
159-
// Allows using #[prelude_import] on glob `use` items.
160-
("prelude_import", "1.2.0", Active),
161158
];
162159
// (changing above list without updating src/doc/reference.md makes @cmr sad)
163160

@@ -268,8 +265,7 @@ pub const KNOWN_ATTRIBUTES: &'static [(&'static str, AttributeType)] = &[
268265
and may be removed in the future")),
269266

270267
// used in resolve
271-
("prelude_import", Gated("prelude_import",
272-
"`#[prelude_import]` is for use by rustc only")),
268+
("prelude_import", Whitelisted),
273269

274270
// FIXME: #14407 these are only looked at on-demand so we can't
275271
// guarantee they'll have already been checked

branches/tmp/src/libsyntax/print/pprust.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,11 @@ pub fn print_crate<'a>(cm: &'a CodeMap,
120120
// of the feature gate, so we fake them up here.
121121

122122
let no_std_meta = attr::mk_word_item(InternedString::new("no_std"));
123-
let prelude_import_meta = attr::mk_word_item(InternedString::new("prelude_import"));
124123

125124
// #![feature(no_std)]
126125
let fake_attr = attr::mk_attr_inner(attr::mk_attr_id(),
127126
attr::mk_list_item(InternedString::new("feature"),
128-
vec![no_std_meta.clone(),
129-
prelude_import_meta]));
127+
vec![no_std_meta.clone()]));
130128
try!(s.print_attribute(&fake_attr));
131129

132130
// #![no_std]

0 commit comments

Comments
 (0)