Skip to content

Commit 5847b81

Browse files
committed
---
yaml --- r: 153566 b: refs/heads/try2 c: 56fafe2 h: refs/heads/master v: v3
1 parent 248aa79 commit 5847b81

File tree

16 files changed

+538
-182
lines changed

16 files changed

+538
-182
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 6f99a27886023acf4d10efb4d56c89c88ffee9be
8+
refs/heads/try2: 56fafe28ee17a4aa48795083ee08be744f068067
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/mk/docs.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ DOCS := index intro tutorial guide guide-ffi guide-macros guide-lifetimes \
3030
guide-tasks guide-container guide-pointers guide-testing \
3131
guide-runtime complement-bugreport \
3232
complement-lang-faq complement-design-faq complement-project-faq rust \
33-
rustdoc guide-unsafe
33+
rustdoc guide-unsafe guide-strings
3434

3535
PDF_DOCS := tutorial rust
3636

branches/try2/src/doc/guide-strings.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
% The Strings Guide
22

3-
# Strings
4-
53
Strings are an important concept to master in any programming language. If you
64
come from a managed language background, you may be surprised at the complexity
75
of string handling in a systems programming language. Efficient access and
@@ -14,7 +12,7 @@ Additionally, strings are not null-terminated and can contain null bytes.
1412

1513
Rust has two main types of strings: `&str` and `String`.
1614

17-
## &str
15+
# &str
1816

1917
The first kind is a `&str`. This is pronounced a 'string slice.' String literals
2018
are of the type `&str`:
@@ -38,7 +36,7 @@ Like vector slices, string slices are simply a pointer plus a length. This
3836
means that they're a 'view' into an already-allocated string, such as a
3937
`&'static str` or a `String`.
4038

41-
## String
39+
# String
4240

4341
A `String` is a heap-allocated string. This string is growable, and is also
4442
guaranteed to be UTF-8.
@@ -73,9 +71,9 @@ let x: &[u8] = &[b'a', b'b'];
7371
let stack_str: &str = str::from_utf8(x).unwrap();
7472
```
7573

76-
## Best Practices
74+
# Best Practices
7775

78-
### `String` vs. `&str`
76+
## `String` vs. `&str`
7977

8078
In general, you should prefer `String` when you need ownership, and `&str` when
8179
you just need to borrow a string. This is very similar to using `Vec<T>` vs. `&[T]`,
@@ -98,7 +96,7 @@ need, and it can make your lifetimes more complex. Furthermore, you can pass
9896
either kind of string into `foo` by using `.as_slice()` on any `String` you
9997
need to pass in, so the `&str` version is more flexible.
10098

101-
### Comparisons
99+
## Comparisons
102100

103101
To compare a String to a constant string, prefer `as_slice()`...
104102

@@ -123,7 +121,7 @@ fn compare(string: String) {
123121
Converting a `String` to a `&str` is cheap, but converting the `&str` to a
124122
`String` involves an allocation.
125123

126-
## Other Documentation
124+
# Other Documentation
127125

128126
* [the `&str` API documentation](/std/str/index.html)
129127
* [the `String` API documentation](std/string/index.html)

branches/try2/src/doc/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ li {list-style-type: none; }
1313

1414
# Guides
1515

16+
* [Strings](guide-strings.html)
1617
* [Pointers](guide-pointers.html)
1718
* [References and Lifetimes](guide-lifetimes.html)
1819
* [Containers and Iterators](guide-container.html)

branches/try2/src/librustc/lib.rs

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -68,42 +68,42 @@ pub mod back {
6868
}
6969

7070
pub mod middle {
71-
pub mod def;
72-
pub mod trans;
73-
pub mod ty;
74-
pub mod ty_fold;
75-
pub mod subst;
76-
pub mod resolve;
77-
pub mod resolve_lifetime;
78-
pub mod typeck;
71+
pub mod astencode;
72+
pub mod borrowck;
73+
pub mod cfg;
74+
pub mod check_const;
7975
pub mod check_loop;
8076
pub mod check_match;
81-
pub mod check_const;
8277
pub mod check_static;
83-
pub mod borrowck;
78+
pub mod const_eval;
8479
pub mod dataflow;
85-
pub mod mem_categorization;
86-
pub mod liveness;
87-
pub mod kind;
80+
pub mod dead;
81+
pub mod def;
82+
pub mod dependency_format;
83+
pub mod effect;
84+
pub mod entry;
85+
pub mod expr_use_visitor;
8886
pub mod freevars;
89-
pub mod pat_util;
90-
pub mod region;
91-
pub mod const_eval;
92-
pub mod astencode;
87+
pub mod graph;
88+
pub mod intrinsicck;
89+
pub mod kind;
9390
pub mod lang_items;
91+
pub mod liveness;
92+
pub mod mem_categorization;
93+
pub mod pat_util;
9494
pub mod privacy;
95-
pub mod entry;
96-
pub mod effect;
9795
pub mod reachable;
98-
pub mod graph;
99-
pub mod cfg;
100-
pub mod dead;
101-
pub mod expr_use_visitor;
102-
pub mod dependency_format;
103-
pub mod weak_lang_items;
96+
pub mod region;
97+
pub mod resolve;
98+
pub mod resolve_lifetime;
10499
pub mod save;
105-
pub mod intrinsicck;
106100
pub mod stability;
101+
pub mod subst;
102+
pub mod trans;
103+
pub mod ty;
104+
pub mod ty_fold;
105+
pub mod typeck;
106+
pub mod weak_lang_items;
107107
}
108108

109109
pub mod front {

0 commit comments

Comments
 (0)