Skip to content

Commit 93c1506

Browse files
committed
---
yaml --- r: 206655 b: refs/heads/beta c: 5160bf8 h: refs/heads/master i: 206653: ee17c1a 206651: b6b9b76 206647: d9b5a51 206639: 8880929 206623: 284eeec 206591: 53c93c3 v: v3
1 parent 55b1e1f commit 93c1506

File tree

8 files changed

+65
-4
lines changed

8 files changed

+65
-4
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
2929
refs/heads/automation-fail: 1bf06495443584539b958873e04cc2f864ab10e4
3030
refs/heads/batch: b7fd822592a4fb577552d93010c4a4e14f314346
3131
refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
32-
refs/heads/beta: ffc0d0448917c1f225a3500bf3a1dc6fc40029d7
32+
refs/heads/beta: 5160bf80cdcf538e1a31c15eaa6a040a8fbc3b80
3333
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3434
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
3535
refs/heads/tmp: 579e31929feff51dcaf8d444648eff8de735f91a

branches/beta/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/beta/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/beta/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/beta/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/beta/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/beta/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/beta/src/libstd/collections/hash/map.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -916,6 +916,24 @@ impl<K, V, S> HashMap<K, V, S>
916916
}
917917

918918
/// Gets the given key's corresponding entry in the map for in-place manipulation.
919+
///
920+
/// # Examples
921+
///
922+
/// ```
923+
/// use std::collections::HashMap;
924+
///
925+
/// let mut letters = HashMap::new();
926+
///
927+
/// for ch in "a short treatise on fungi".chars() {
928+
/// let counter = letters.entry(ch).or_insert(0);
929+
/// *counter += 1;
930+
/// }
931+
///
932+
/// assert_eq!(letters[&'s'], 2);
933+
/// assert_eq!(letters[&'t'], 3);
934+
/// assert_eq!(letters[&'u'], 1);
935+
/// assert_eq!(letters.get(&'y'), None);
936+
/// ```
919937
#[stable(feature = "rust1", since = "1.0.0")]
920938
pub fn entry(&mut self, key: K) -> Entry<K, V> {
921939
// Gotta resize now.

0 commit comments

Comments
 (0)