Skip to content

Commit 0b7be33

Browse files
committed
---
yaml --- r: 212635 b: refs/heads/auto c: e50675d h: refs/heads/master i: 212633: ff85fd9 212631: a36850a v: v3
1 parent d0bb262 commit 0b7be33

File tree

14 files changed

+295
-101
lines changed

14 files changed

+295
-101
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1010
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1111
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1212
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
13-
refs/heads/auto: a297651607a884a134d4a38b4044ffbf472c54ce
13+
refs/heads/auto: e50675d549edfcb49f712ee3915155cf1cc8f1a2
1414
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1515
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1616
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/doc/complement-lang-faq.md

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

3131
## Is anyone using Rust in production?
3232

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:
33+
Yes. For example (incomplete):
3734

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

4341
## Does it run on Windows?
4442

branches/auto/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
```

branches/auto/src/libcollections/borrow.rs

Lines changed: 9 additions & 1 deletion
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::{rc, arc};
24+
use alloc::{boxed, rc, arc};
2525

2626
use self::Cow::*;
2727

@@ -116,6 +116,14 @@ 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+
119127
impl<T: ?Sized> Borrow<T> for rc::Rc<T> {
120128
fn borrow(&self) -> &T { &**self }
121129
}

0 commit comments

Comments
 (0)