diff options
| author | bors <bors@rust-lang.org> | 2013-12-30 23:11:49 -0800 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-12-30 23:11:49 -0800 |
| commit | d459e805df076ace12ed3f7f57f2b1378f0e2403 (patch) | |
| tree | 5430196a041283ed23343205d30f43085e0a9e6a /src/libstd | |
| parent | b88138a3ec4bb142fa514a863b62f955bf1c44e3 (diff) | |
| parent | ff801d662ebdebee4845dcc825b366215e4b88bf (diff) | |
| download | rust-d459e805df076ace12ed3f7f57f2b1378f0e2403.tar.gz rust-d459e805df076ace12ed3f7f57f2b1378f0e2403.zip | |
auto merge of #11142 : alan-andrade/rust/improve_opts_example, r=cmr
Ran into this in practice, fixing it to improve example correctness.
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/str.rs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/libstd/str.rs b/src/libstd/str.rs index 8e6d8523f77..4516fb85f90 100644 --- a/src/libstd/str.rs +++ b/src/libstd/str.rs @@ -38,11 +38,15 @@ there are three common kinds of strings in rust: As an example, here's a few different kinds of strings. ```rust -let owned_string = ~"I am an owned string"; -let managed_string = @"This string is garbage-collected"; -let borrowed_string1 = "This string is borrowed with the 'static lifetime"; -let borrowed_string2: &str = owned_string; // owned strings can be borrowed -let borrowed_string3: &str = managed_string; // managed strings can also be borrowed +#[feature(managed_boxes)]; + +fn main() { + let owned_string = ~"I am an owned string"; + let managed_string = @"This string is garbage-collected"; + let borrowed_string1 = "This string is borrowed with the 'static lifetime"; + let borrowed_string2: &str = owned_string; // owned strings can be borrowed + let borrowed_string3: &str = managed_string; // managed strings can also be borrowed +} ``` From the example above, you can see that rust has 3 different kinds of string |
