Rollup merge of #25506 - Wilfred:master, r=alexcrichton

Newcomers to Rust need to learn the distinctinion between `&str` and
`String`, so additonally having `string` in an example risks confusion.
This commit is contained in:
Manish Goregaokar 2015-05-17 11:55:39 +05:30
commit 1fd0a8455b

View File

@ -16,11 +16,11 @@ Rust has two main types of strings: `&str` and `String`. Lets talk about
`&'static str`:
```rust
let string = "Hello there."; // string: &'static str
let greeting = "Hello there."; // greeting: &'static str
```
This string is statically allocated, meaning that its saved inside our
compiled program, and exists for the entire duration it runs. The `string`
compiled program, and exists for the entire duration it runs. The `greeting`
binding is a reference to this statically allocated string. String slices
have a fixed size, and cannot be mutated.