Skip to content

Commit 248aa79

Browse files
committed
---
yaml --- r: 153565 b: refs/heads/try2 c: 6f99a27 h: refs/heads/master i: 153563: b21bcc8 v: v3
1 parent b6de370 commit 248aa79

File tree

87 files changed

+485
-706
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+485
-706
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: 5e0a597a1a15e36ac7d855ca400e5add9d86716b
8+
refs/heads/try2: 6f99a27886023acf4d10efb4d56c89c88ffee9be
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 guide-strings
33+
rustdoc guide-unsafe
3434

3535
PDF_DOCS := tutorial rust
3636

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

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

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

1315
Rust has two main types of strings: `&str` and `String`.
1416

15-
# &str
17+
## &str
1618

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

39-
# String
41+
## String
4042

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

74-
# Best Practices
76+
## Best Practices
7577

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

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

99-
## Comparisons
101+
### Comparisons
100102

101103
To compare a String to a constant string, prefer `as_slice()`...
102104

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

124-
# Other Documentation
126+
## Other Documentation
125127

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

branches/try2/src/doc/index.md

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

1414
# Guides
1515

16-
* [Strings](guide-strings.html)
1716
* [Pointers](guide-pointers.html)
1817
* [References and Lifetimes](guide-lifetimes.html)
1918
* [Containers and Iterators](guide-container.html)

branches/try2/src/libcollections/dlist.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,14 @@ impl<T> Rawlink<T> {
8787
}
8888

8989
/// Convert the `Rawlink` into an Option value
90-
fn resolve_immut(&self) -> Option<&T> {
91-
unsafe { self.p.to_option() }
90+
fn resolve_immut<'a>(&self) -> Option<&'a T> {
91+
unsafe {
92+
mem::transmute(self.p.to_option())
93+
}
9294
}
9395

9496
/// Convert the `Rawlink` into an Option value
95-
fn resolve(&mut self) -> Option<&mut T> {
97+
fn resolve<'a>(&mut self) -> Option<&'a mut T> {
9698
if self.p.is_null() {
9799
None
98100
} else {

branches/try2/src/libgraphviz/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,12 +455,12 @@ impl<'a> LabelText<'a> {
455455
}
456456

457457
/// Puts `prefix` on a line above this label, with a blank line separator.
458-
pub fn prefix_line(self, prefix: LabelText) -> LabelText {
458+
pub fn prefix_line(self, prefix: LabelText) -> LabelText<'static> {
459459
prefix.suffix_line(self)
460460
}
461461

462462
/// Puts `suffix` on a line below this label, with a blank line separator.
463-
pub fn suffix_line(self, suffix: LabelText) -> LabelText {
463+
pub fn suffix_line(self, suffix: LabelText) -> LabelText<'static> {
464464
let prefix = self.pre_escaped_content().into_string();
465465
let suffix = suffix.pre_escaped_content();
466466
EscStr(str::Owned(prefix.append(r"\n\n").append(suffix.as_slice())))

branches/try2/src/libgraphviz/maybe_owned_vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ impl<'b,T> slice::Vector<T> for MaybeOwnedVector<'b,T> {
109109
}
110110

111111
impl<'a,T> FromIterator<T> for MaybeOwnedVector<'a,T> {
112-
fn from_iter<I:Iterator<T>>(iterator: I) -> MaybeOwnedVector<T> {
112+
fn from_iter<I:Iterator<T>>(iterator: I) -> MaybeOwnedVector<'a,T> {
113113
// If we are building from scratch, might as well build the
114114
// most flexible variant.
115115
Growable(FromIterator::from_iter(iterator))

branches/try2/src/libgreen/sched.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -959,13 +959,13 @@ impl CleanupJob {
959959
type UnsafeTaskReceiver = raw::Closure;
960960
trait ClosureConverter {
961961
fn from_fn(|&mut Scheduler, Box<GreenTask>|) -> Self;
962-
fn to_fn(self) -> |&mut Scheduler, Box<GreenTask>|;
962+
fn to_fn(self) -> |&mut Scheduler, Box<GreenTask>|:'static ;
963963
}
964964
impl ClosureConverter for UnsafeTaskReceiver {
965965
fn from_fn(f: |&mut Scheduler, Box<GreenTask>|) -> UnsafeTaskReceiver {
966966
unsafe { mem::transmute(f) }
967967
}
968-
fn to_fn(self) -> |&mut Scheduler, Box<GreenTask>| {
968+
fn to_fn(self) -> |&mut Scheduler, Box<GreenTask>|:'static {
969969
unsafe { mem::transmute(self) }
970970
}
971971
}

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 astencode;
72-
pub mod borrowck;
73-
pub mod cfg;
74-
pub mod check_const;
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;
7579
pub mod check_loop;
7680
pub mod check_match;
81+
pub mod check_const;
7782
pub mod check_static;
78-
pub mod const_eval;
83+
pub mod borrowck;
7984
pub mod dataflow;
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;
86-
pub mod freevars;
87-
pub mod graph;
88-
pub mod intrinsicck;
89-
pub mod kind;
90-
pub mod lang_items;
91-
pub mod liveness;
9285
pub mod mem_categorization;
86+
pub mod liveness;
87+
pub mod kind;
88+
pub mod freevars;
9389
pub mod pat_util;
90+
pub mod region;
91+
pub mod const_eval;
92+
pub mod astencode;
93+
pub mod lang_items;
9494
pub mod privacy;
95+
pub mod entry;
96+
pub mod effect;
9597
pub mod reachable;
96-
pub mod region;
97-
pub mod resolve;
98-
pub mod resolve_lifetime;
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;
99104
pub mod save;
105+
pub mod intrinsicck;
100106
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)