Skip to content

Commit 4d5ca47

Browse files
committed
---
yaml --- r: 212474 b: refs/heads/master c: 7d298d1 h: refs/heads/master v: v3
1 parent a0ac352 commit 4d5ca47

Some content is hidden

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

48 files changed

+160
-484
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: ea4949d44924444c29e9266708ba18f344487577
2+
refs/heads/master: 7d298d1acecbd866be7b9e2c60ef86032bb2a502
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: ba0e1cd8147d452c356aacb29fb87568ca26f111
55
refs/heads/try: 1864973ae17213c5a58c4dd3f9af6d1b6c7d2e05

trunk/src/doc/complement-lang-faq.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,15 @@ You may also be interested in browsing [trending Rust repositories][github-rust]
3030

3131
## Is anyone using Rust in production?
3232

33-
Yes. For example (incomplete):
33+
Currently, Rust is still pre-1.0, and so we don't recommend that you use Rust
34+
in production unless you know exactly what you're getting into.
35+
36+
That said, there are two production deployments of Rust that we're aware of:
3437

3538
* [OpenDNS](http://labs.opendns.com/2013/10/04/zeromq-helping-us-block-malicious-domains/)
3639
* [Skylight](http://skylight.io)
37-
* [wit.ai](https://github.com/wit-ai/witd)
38-
* [Codius](https://codius.org/blog/codius-rust/)
39-
* [MaidSafe](http://maidsafe.net/)
40+
41+
Let the fact that this is an easily countable number be a warning.
4042

4143
## Does it run on Windows?
4244

trunk/src/doc/trpl/closures.md

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -324,37 +324,34 @@ first, it may seem strange, but we’ll figure it out. Here’s how you’d prob
324324
try to return a closure from a function:
325325

326326
```rust,ignore
327-
fn factory() -> (Fn(i32) -> Vec<i32>) {
328-
let vec = vec![1, 2, 3];
327+
fn factory() -> (Fn(i32) -> i32) {
328+
let num = 5;
329329
330-
|n| vec.push(n)
330+
|x| x + num
331331
}
332332
333333
let f = factory();
334334
335-
let answer = f(4);
336-
assert_eq!(vec![1, 2, 3, 4], answer);
335+
let answer = f(1);
336+
assert_eq!(6, answer);
337337
```
338338

339339
This gives us these long, related errors:
340340

341341
```text
342342
error: the trait `core::marker::Sized` is not implemented for the type
343-
`core::ops::Fn(i32) -> collections::vec::Vec<i32>` [E0277]
344-
f = factory();
345-
^
346-
note: `core::ops::Fn(i32) -> collections::vec::Vec<i32>` does not have a
347-
constant size known at compile-time
348-
f = factory();
349-
^
350-
error: the trait `core::marker::Sized` is not implemented for the type
351-
`core::ops::Fn(i32) -> collections::vec::Vec<i32>` [E0277]
352-
factory() -> (Fn(i32) -> Vec<i32>) {
353-
^~~~~~~~~~~~~~~~~~~~~
354-
note: `core::ops::Fn(i32) -> collections::vec::Vec<i32>` does not have a constant size known at compile-time
355-
factory() -> (Fn(i32) -> Vec<i32>) {
356-
^~~~~~~~~~~~~~~~~~~~~
357-
343+
`core::ops::Fn(i32) -> i32` [E0277]
344+
fn factory() -> (Fn(i32) -> i32) {
345+
^~~~~~~~~~~~~~~~
346+
note: `core::ops::Fn(i32) -> i32` does not have a constant size known at compile-time
347+
fn factory() -> (Fn(i32) -> i32) {
348+
^~~~~~~~~~~~~~~~
349+
error: the trait `core::marker::Sized` is not implemented for the type `core::ops::Fn(i32) -> i32` [E0277]
350+
let f = factory();
351+
^
352+
note: `core::ops::Fn(i32) -> i32` does not have a constant size known at compile-time
353+
let f = factory();
354+
^
358355
```
359356

360357
In order to return something from a function, Rust needs to know what
@@ -364,16 +361,16 @@ way to give something a size is to take a reference to it, as references
364361
have a known size. So we’d write this:
365362

366363
```rust,ignore
367-
fn factory() -> &(Fn(i32) -> Vec<i32>) {
368-
let vec = vec![1, 2, 3];
364+
fn factory() -> &(Fn(i32) -> i32) {
365+
let num = 5;
369366
370-
|n| vec.push(n)
367+
|x| x + num
371368
}
372369
373370
let f = factory();
374371
375-
let answer = f(4);
376-
assert_eq!(vec![1, 2, 3, 4], answer);
372+
let answer = f(1);
373+
assert_eq!(6, answer);
377374
```
378375

379376
But we get another error:
@@ -448,7 +445,8 @@ assert_eq!(6, answer);
448445
We use a trait object, by `Box`ing up the `Fn`. There’s just one last problem:
449446

450447
```text
451-
error: `num` does not live long enough
448+
error: closure may outlive the current function, but it borrows `num`,
449+
which is owned by the current function [E0373]
452450
Box::new(|x| x + num)
453451
^~~~~~~~~~~
454452
```

trunk/src/doc/trpl/enums.md

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -64,45 +64,3 @@ equality yet, but we’ll find out in the [`traits`][traits] section.
6464
[match]: match.html
6565
[if-let]: if-let.html
6666
[traits]: traits.html
67-
68-
# Constructors as functions
69-
70-
An enum’s constructors can also be used like functions. For example:
71-
72-
```rust
73-
# enum Message {
74-
# Write(String),
75-
# }
76-
let m = Message::Write("Hello, world".to_string());
77-
```
78-
79-
Is the same as
80-
81-
```rust
82-
# enum Message {
83-
# Write(String),
84-
# }
85-
fn foo(x: String) -> Message {
86-
Message::Write(x)
87-
}
88-
89-
let x = foo("Hello, world".to_string());
90-
```
91-
92-
This is not immediately useful to us, but when we get to
93-
[`closures`][closures], we’ll talk about passing functions as arguments to
94-
other functions. For example, with [`iterators`][iterators], we can do this
95-
to convert a vector of `String`s into a vector of `Message::Write`s:
96-
97-
```rust
98-
# enum Message {
99-
# Write(String),
100-
# }
101-
102-
let v = vec!["Hello".to_string(), "World".to_string()];
103-
104-
let v1: Vec<Message> = v.into_iter().map(Message::Write).collect();
105-
```
106-
107-
[closures]: closures.html
108-
[iterators]: iterators.html

trunk/src/doc/trpl/ffi.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ However it is often desired that the callback is targeted to a special
238238
Rust object. This could be the object that represents the wrapper for the
239239
respective C object.
240240
241-
This can be achieved by passing an raw pointer to the object down to the
241+
This can be achieved by passing an unsafe pointer to the object down to the
242242
C library. The C library can then include the pointer to the Rust object in
243243
the notification. This will allow the callback to unsafely access the
244244
referenced Rust object.
@@ -370,7 +370,7 @@ On OSX, frameworks behave with the same semantics as a dynamic library.
370370
371371
# Unsafe blocks
372372
373-
Some operations, like dereferencing raw pointers or calling functions that have been marked
373+
Some operations, like dereferencing unsafe pointers or calling functions that have been marked
374374
unsafe are only allowed inside unsafe blocks. Unsafe blocks isolate unsafety and are a promise to
375375
the compiler that the unsafety does not leak out of the block.
376376

trunk/src/doc/trpl/functions.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,7 @@ an expression, and a `let` can only begin a statement, not an expression.
144144
Note that assigning to an already-bound variable (e.g. `y = 5`) is still an
145145
expression, although its value is not particularly useful. Unlike other
146146
languages where an assignment evaluates to the assigned value (e.g. `5` in the
147-
previous example), in Rust the value of an assignment is an empty tuple `()`
148-
because the assigned value can have [just one owner](ownership.html), and any
149-
other returned value would be too surprising:
147+
previous example), in Rust the value of an assignment is an empty tuple `()`:
150148

151149
```rust
152150
let mut y = 5;

trunk/src/doc/trpl/raw-pointers.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ println!("raw points at {}", *raw);
5252
It gives this error:
5353

5454
```text
55-
error: dereference of raw pointer requires unsafe function or block [E0133]
56-
println!("raw points at {}", *raw);
57-
^~~~
55+
error: dereference of unsafe pointer requires unsafe function or block [E0133]
56+
println!("raw points at{}", *raw);
57+
^~~~
5858
```
5959

6060
When you dereference a raw pointer, you’re taking responsibility that it’s not

trunk/src/doc/trpl/strings.md

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -117,30 +117,6 @@ let dog = hachiko.chars().nth(1); // kinda like hachiko[1]
117117

118118
This emphasizes that we have to go through the whole list of `chars`.
119119

120-
## Slicing
121-
122-
You can get a slice of a string with slicing syntax:
123-
124-
```rust
125-
let dog = "hachiko";
126-
let hachi = &dog[0..5];
127-
```
128-
129-
But note that these are _byte_ offsets, not _character_ offsets. So
130-
this will fail at runtime:
131-
132-
```rust,should_panic
133-
let dog = "忠犬ハチ公";
134-
let hachi = &dog[0..2];
135-
```
136-
137-
with this error:
138-
139-
```text
140-
thread '<main>' panicked at 'index 0 and/or 2 in `忠犬ハチ公` do not lie on
141-
character boundary'
142-
```
143-
144120
## Concatenation
145121

146122
If you have a `String`, you can concatenate a `&str` to the end of it:

trunk/src/liballoc/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
//!
2323
//! ## Boxed values
2424
//!
25-
//! The [`Box`](boxed/index.html) type is a smart pointer type. There can
26-
//! only be one owner of a `Box`, and the owner can decide to mutate the
27-
//! contents, which live on the heap.
25+
//! The [`Box`](boxed/index.html) type is the core owned pointer type in Rust.
26+
//! There can only be one owner of a `Box`, and the owner can decide to mutate
27+
//! the contents, which live on the heap.
2828
//!
2929
//! This type can be sent among threads efficiently as the size of a `Box` value
3030
//! is the same as that of a pointer. Tree-like data structures are often built

trunk/src/libcollections/borrow.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use core::ops::Deref;
2121
use core::option::Option;
2222

2323
use fmt;
24-
use alloc::{boxed, rc, arc};
24+
use alloc::{rc, arc};
2525

2626
use self::Cow::*;
2727

@@ -116,14 +116,6 @@ impl<'a, T: ?Sized> BorrowMut<T> for &'a mut T {
116116
fn borrow_mut(&mut self) -> &mut T { &mut **self }
117117
}
118118

119-
impl<T: ?Sized> Borrow<T> for boxed::Box<T> {
120-
fn borrow(&self) -> &T { &**self }
121-
}
122-
123-
impl<T: ?Sized> BorrowMut<T> for boxed::Box<T> {
124-
fn borrow_mut(&mut self) -> &mut T { &mut **self }
125-
}
126-
127119
impl<T: ?Sized> Borrow<T> for rc::Rc<T> {
128120
fn borrow(&self) -> &T { &**self }
129121
}

trunk/src/libcollections/slice.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ impl<T> [T] {
370370
core_slice::SliceExt::get_unchecked_mut(self, index)
371371
}
372372

373-
/// Returns an raw pointer to the slice's buffer
373+
/// Returns an unsafe pointer to the slice's buffer
374374
///
375375
/// The caller must ensure that the slice outlives the pointer this
376376
/// function returns, or else it will end up pointing to garbage.

0 commit comments

Comments
 (0)