Skip to content

Commit 8ec98cf

Browse files
committed
---
yaml --- r: 212799 b: refs/heads/tmp c: fa0de66 h: refs/heads/master i: 212797: cf7dbe0 212795: 07e036a 212791: 2d70fce 212783: 3322f26 212767: e521c17 212735: 2d83987 v: v3
1 parent 67d6e9d commit 8ec98cf

File tree

17 files changed

+110
-362
lines changed

17 files changed

+110
-362
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
3232
refs/heads/beta: 4efc4ec178f6ddf3c8cd268b011f3a04056f9d16
3333
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3434
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
35-
refs/heads/tmp: 95407cc627bfd2c0cda7c41a1d8dba301b215bca
35+
refs/heads/tmp: fa0de66dfe7058bad6376b93ffffb682050d8805
3636
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3737
refs/tags/homu-tmp: bea1c4a78e5233ea6f85a2028a26e08c26635fca
3838
refs/heads/gate: 97c84447b65164731087ea82685580cc81424412

branches/tmp/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

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

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -324,34 +324,37 @@ 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) -> i32) {
328-
let num = 5;
327+
fn factory() -> (Fn(i32) -> Vec<i32>) {
328+
let vec = vec![1, 2, 3];
329329
330-
|x| x + num
330+
|n| vec.push(n)
331331
}
332332
333333
let f = factory();
334334
335-
let answer = f(1);
336-
assert_eq!(6, answer);
335+
let answer = f(4);
336+
assert_eq!(vec![1, 2, 3, 4], 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) -> 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-
^
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+
355358
```
356359

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

363366
```rust,ignore
364-
fn factory() -> &(Fn(i32) -> i32) {
365-
let num = 5;
367+
fn factory() -> &(Fn(i32) -> Vec<i32>) {
368+
let vec = vec![1, 2, 3];
366369
367-
|x| x + num
370+
|n| vec.push(n)
368371
}
369372
370373
let f = factory();
371374
372-
let answer = f(1);
373-
assert_eq!(6, answer);
375+
let answer = f(4);
376+
assert_eq!(vec![1, 2, 3, 4], answer);
374377
```
375378

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

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

branches/tmp/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
}

0 commit comments

Comments
 (0)