Skip to content

Commit fa23628

Browse files
committed
---
yaml --- r: 210546 b: refs/heads/try c: 7ae332c h: refs/heads/master v: v3
1 parent a9304e2 commit fa23628

37 files changed

+173
-288
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 3e561f05c00cd180ec02db4ccab2840a4aba93d2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: ba0e1cd8147d452c356aacb29fb87568ca26f111
5-
refs/heads/try: ae1b64ff7376859b3582441cd41218b5445da148
5+
refs/heads/try: 7ae332c39f3aec88ba6656767cafb174a9180b81
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/src/doc/reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2028,7 +2028,7 @@ makes it possible to declare these operations. For example, the `str` module
20282028
in the Rust standard library defines the string equality function:
20292029

20302030
```{.ignore}
2031-
#[lang="str_eq"]
2031+
#[lang = "str_eq"]
20322032
pub fn eq_slice(a: &str, b: &str) -> bool {
20332033
// details elided
20342034
}

branches/try/src/doc/trpl/error-handling.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ we can use the `unwrap()` method:
214214
io::stdin().read_line(&mut buffer).unwrap();
215215
```
216216

217-
`unwrap()` will `panic!` if the `Option` is `None`. This basically says "Give
217+
`unwrap()` will `panic!` if the `Result` is `Err`. This basically says "Give
218218
me the value, and if something goes wrong, just crash." This is less reliable
219219
than matching the error and attempting to recover, but is also significantly
220220
shorter. Sometimes, just crashing is appropriate.

branches/try/src/doc/trpl/guessing-game.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,9 @@ prints a [string][strings] to the screen.
131131
let mut guess = String::new();
132132
```
133133

134-
Now we’re getting interesting! There’s a lot going on in this little line. The first thing to notice is that this is a [let statement][let], which is used to create ‘variable bindings’. They take this form:
134+
Now we’re getting interesting! There’s a lot going on in this little line.
135+
The first thing to notice is that this is a [let statement][let], which is
136+
used to create ‘variable bindings’. They take this form:
135137

136138
```rust,ignore
137139
let foo = bar;
@@ -171,7 +173,7 @@ bound to: `String::new()`.
171173

172174
[string]: ../std/string/struct.String.html
173175

174-
The `::new()` syntax is uses `::` because this is an ‘associated function’ of
176+
The `::new()` syntax uses `::` because this is an ‘associated function’ of
175177
a particular type. That is to say, it’s associated with `String` itself,
176178
rather than a particular instance of a `String`. Some languages call this a
177179
‘static method’.

branches/try/src/doc/trpl/lang-items.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
The `rustc` compiler has certain pluggable operations, that is,
88
functionality that isn't hard-coded into the language, but is
99
implemented in libraries, with a special marker to tell the compiler
10-
it exists. The marker is the attribute `#[lang="..."]` and there are
10+
it exists. The marker is the attribute `#[lang = "..."]` and there are
1111
various different values of `...`, i.e. various different 'lang
1212
items'.
1313

@@ -28,7 +28,7 @@ extern {
2828
#[lang = "owned_box"]
2929
pub struct Box<T>(*mut T);
3030
31-
#[lang="exchange_malloc"]
31+
#[lang = "exchange_malloc"]
3232
unsafe fn allocate(size: usize, _align: usize) -> *mut u8 {
3333
let p = libc::malloc(size as libc::size_t) as *mut u8;
3434
@@ -39,7 +39,7 @@ unsafe fn allocate(size: usize, _align: usize) -> *mut u8 {
3939
4040
p
4141
}
42-
#[lang="exchange_free"]
42+
#[lang = "exchange_free"]
4343
unsafe fn deallocate(ptr: *mut u8, _size: usize, _align: usize) {
4444
libc::free(ptr as *mut libc::c_void)
4545
}

branches/try/src/doc/trpl/ownership.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ fn foo(v: Vec<i32>) -> Vec<i32> {
174174
}
175175
```
176176

177-
This would get very tedius. It gets worse the more things we want to take ownership of:
177+
This would get very tedious. It gets worse the more things we want to take ownership of:
178178

179179
```rust
180180
fn foo(v1: Vec<i32>, v2: Vec<i32>) -> (Vec<i32>, Vec<i32>, i32) {

branches/try/src/doc/trpl/primitive-types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ Slices have type `&[T]`. We’ll talk about that `T` when we cover
176176

177177
[generics]: generics.html
178178

179-
You can find more documentation for `slices`s [in the standard library
179+
You can find more documentation for slices [in the standard library
180180
documentation][slice].
181181

182182
[slice]: ../std/primitive.slice.html

branches/try/src/doc/trpl/references-and-borrowing.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,7 @@ println!("{}", y);
312312

313313
We get this error:
314314

315+
```text
315316
error: `x` does not live long enough
316317
y = &x;
317318
^
@@ -334,3 +335,37 @@ In other words, `y` is only valid for the scope where `x` exists. As soon as
334335
`x` goes away, it becomes invalid to refer to it. As such, the error says that
335336
the borrow ‘doesn’t live long enough’ because it’s not valid for the right
336337
amount of time.
338+
339+
The same problem occurs when the reference is declared _before_ the variable it refers to:
340+
341+
```rust,ignore
342+
let y: &i32;
343+
let x = 5;
344+
y = &x;
345+
346+
println!("{}", y);
347+
```
348+
349+
We get this error:
350+
351+
```text
352+
error: `x` does not live long enough
353+
y = &x;
354+
^
355+
note: reference must be valid for the block suffix following statement 0 at
356+
2:16...
357+
let y: &i32;
358+
let x = 5;
359+
y = &x;
360+
361+
println!("{}", y);
362+
}
363+
364+
note: ...but borrowed value is only valid for the block suffix following
365+
statement 1 at 3:14
366+
let x = 5;
367+
y = &x;
368+
369+
println!("{}", y);
370+
}
371+
```

branches/try/src/etc/CONFIGS.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
# Configs
22

3-
Here are some links to repos with configs which ease the use of rust:
3+
These are some links to repos with configs which ease the use of rust.
4+
5+
## Officially Maintained Configs
46

57
* [rust.vim](https://github.com/rust-lang/rust.vim)
68
* [emacs rust-mode](https://github.com/rust-lang/rust-mode)
79
* [gedit-config](https://github.com/rust-lang/gedit-config)
810
* [kate-config](https://github.com/rust-lang/kate-config)
911
* [nano-config](https://github.com/rust-lang/nano-config)
1012
* [zsh-config](https://github.com/rust-lang/zsh-config)
13+
14+
## Community-maintained Configs
15+
16+
* [.editorconfig](https://gist.github.com/derhuerst/c9d1b9309e308d9851fa) ([what is this?](http://editorconfig.org/))

branches/try/src/liballoc/heap.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ pub const EMPTY: *mut () = 0x1 as *mut ();
9595

9696
/// The allocator for unique pointers.
9797
#[cfg(not(test))]
98-
#[lang="exchange_malloc"]
98+
#[lang = "exchange_malloc"]
9999
#[inline]
100100
unsafe fn exchange_malloc(size: usize, align: usize) -> *mut u8 {
101101
if size == 0 {
@@ -108,7 +108,7 @@ unsafe fn exchange_malloc(size: usize, align: usize) -> *mut u8 {
108108
}
109109

110110
#[cfg(not(test))]
111-
#[lang="exchange_free"]
111+
#[lang = "exchange_free"]
112112
#[inline]
113113
unsafe fn exchange_free(ptr: *mut u8, old_size: usize, align: usize) {
114114
deallocate(ptr, old_size, align);

branches/try/src/libcollections/string.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,6 +1052,7 @@ impl<T: fmt::Display + ?Sized> ToString for T {
10521052

10531053
#[stable(feature = "rust1", since = "1.0.0")]
10541054
impl AsRef<str> for String {
1055+
#[inline]
10551056
fn as_ref(&self) -> &str {
10561057
self
10571058
}

branches/try/src/libcore/cell.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ impl<'b, T: ?Sized> DerefMut for RefMut<'b, T> {
634634
///
635635
/// **NOTE:** `UnsafeCell<T>`'s fields are public to allow static initializers. It is not
636636
/// recommended to access its fields directly, `get` should be used instead.
637-
#[lang="unsafe_cell"]
637+
#[lang = "unsafe_cell"]
638638
#[stable(feature = "rust1", since = "1.0.0")]
639639
pub struct UnsafeCell<T: ?Sized> {
640640
/// Wrapped value

branches/try/src/libcore/cmp.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ use option::Option::{self, Some, None};
4141
/// PartialEq only requires the `eq` method to be implemented; `ne` is defined in terms of it by
4242
/// default. Any manual implementation of `ne` *must* respect the rule that `eq` is a strict
4343
/// inverse of `ne`; that is, `!(a == b)` if and only if `a != b`.
44-
#[lang="eq"]
44+
#[lang = "eq"]
4545
#[stable(feature = "rust1", since = "1.0.0")]
4646
pub trait PartialEq<Rhs: ?Sized = Self> {
4747
/// This method tests for `self` and `other` values to be equal, and is used by `==`.
@@ -222,7 +222,7 @@ impl PartialOrd for Ordering {
222222
/// However it remains possible to implement the others separately for types which do not have a
223223
/// total order. For example, for floating point numbers, `NaN < 0 == false` and `NaN >= 0 ==
224224
/// false` (cf. IEEE 754-2008 section 5.11).
225-
#[lang="ord"]
225+
#[lang = "ord"]
226226
#[stable(feature = "rust1", since = "1.0.0")]
227227
pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
228228
/// This method returns an ordering between `self` and `other` values if one exists.

branches/try/src/libcore/convert.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ impl<T> AsMut<[T]> for [T] {
173173

174174
#[stable(feature = "rust1", since = "1.0.0")]
175175
impl AsRef<str> for str {
176+
#[inline]
176177
fn as_ref(&self) -> &str {
177178
self
178179
}

branches/try/src/libcore/iter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ fn _assert_is_object_safe(_: &Iterator<Item=()>) {}
8282
/// is returned. A concrete Iterator implementation may choose to behave however
8383
/// it wishes, either by returning `None` infinitely, or by doing something
8484
/// else.
85-
#[lang="iterator"]
85+
#[lang = "iterator"]
8686
#[stable(feature = "rust1", since = "1.0.0")]
8787
#[rustc_on_unimplemented = "`{Self}` is not an iterator; maybe try calling \
8888
`.iter()` or a similar method"]

branches/try/src/libcore/marker.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ use hash::Hasher;
3333

3434
/// Types able to be transferred across thread boundaries.
3535
#[stable(feature = "rust1", since = "1.0.0")]
36-
#[lang="send"]
36+
#[lang = "send"]
3737
#[rustc_on_unimplemented = "`{Self}` cannot be sent between threads safely"]
3838
pub unsafe trait Send {
3939
// empty.
@@ -46,7 +46,7 @@ impl<T> !Send for *mut T { }
4646

4747
/// Types with a constant size known at compile-time.
4848
#[stable(feature = "rust1", since = "1.0.0")]
49-
#[lang="sized"]
49+
#[lang = "sized"]
5050
#[rustc_on_unimplemented = "`{Self}` does not have a constant size known at compile-time"]
5151
#[fundamental] // for Default, for example, which requires that `[T]: !Default` be evaluatable
5252
pub trait Sized {
@@ -154,7 +154,7 @@ pub trait Sized {
154154
/// then it might be prudent to not implement `Copy`. This is because removing `Copy` is a breaking
155155
/// change: that second example would fail to compile if we made `Foo` non-`Copy`.
156156
#[stable(feature = "rust1", since = "1.0.0")]
157-
#[lang="copy"]
157+
#[lang = "copy"]
158158
pub trait Copy : Clone {
159159
// Empty.
160160
}
@@ -201,7 +201,7 @@ pub trait Copy : Clone {
201201
/// reference; not doing this is undefined behaviour (for example,
202202
/// `transmute`-ing from `&T` to `&mut T` is illegal).
203203
#[stable(feature = "rust1", since = "1.0.0")]
204-
#[lang="sync"]
204+
#[lang = "sync"]
205205
#[rustc_on_unimplemented = "`{Self}` cannot be shared between threads safely"]
206206
pub unsafe trait Sync {
207207
// Empty
@@ -217,7 +217,7 @@ impl<T> !Sync for *mut T { }
217217
/// ensure that they are never copied, even if they lack a destructor.
218218
#[unstable(feature = "core",
219219
reason = "likely to change with new variance strategy")]
220-
#[lang="no_copy_bound"]
220+
#[lang = "no_copy_bound"]
221221
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord)]
222222
pub struct NoCopy;
223223

@@ -359,7 +359,7 @@ macro_rules! impls{
359359
/// better to use a reference type, like `PhantomData<&'a T>`
360360
/// (ideally) or `PhantomData<*const T>` (if no lifetime applies), so
361361
/// as not to indicate ownership.
362-
#[lang="phantom_data"]
362+
#[lang = "phantom_data"]
363363
#[stable(feature = "rust1", since = "1.0.0")]
364364
pub struct PhantomData<T:?Sized>;
365365

branches/try/src/libcore/nonzero.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ unsafe impl Zeroable for u64 {}
3131

3232
/// A wrapper type for raw pointers and integers that will never be
3333
/// NULL or 0 that might allow certain optimizations.
34-
#[lang="non_zero"]
34+
#[lang = "non_zero"]
3535
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
3636
#[unstable(feature = "core")]
3737
pub struct NonZero<T: Zeroable>(T);

0 commit comments

Comments
 (0)