Skip to content

Commit 1fd0a84

Browse files
committed
Rollup merge of rust-lang#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.
2 parents b3706de + ba02739 commit 1fd0a84

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/doc/trpl/strings.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ Rust has two main types of strings: `&str` and `String`. Let’s talk about
1616
`&'static str`:
1717

1818
```rust
19-
let string = "Hello there."; // string: &'static str
19+
let greeting = "Hello there."; // greeting: &'static str
2020
```
2121

2222
This string is statically allocated, meaning that it’s saved inside our
23-
compiled program, and exists for the entire duration it runs. The `string`
23+
compiled program, and exists for the entire duration it runs. The `greeting`
2424
binding is a reference to this statically allocated string. String slices
2525
have a fixed size, and cannot be mutated.
2626

0 commit comments

Comments
 (0)