Skip to content

Commit e59d43e

Browse files
committed
---
yaml --- r: 139163 b: refs/heads/try2 c: ee2f3d9 h: refs/heads/master i: 139161: 70e15ec 139159: 8787ceb v: v3
1 parent 20148d2 commit e59d43e

38 files changed

+686
-509
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: d8c0da39402818db2d41369826956538ba9672e1
8+
refs/heads/try2: ee2f3d9673407db3ca5a0eb24e01ef52c7fc676c
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/doc/tutorial.md

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -579,29 +579,20 @@ Structs are quite similar to C structs and are even laid out the same way in
579579
memory (so you can read from a Rust struct in C, and vice-versa). Use the dot
580580
operator to access struct fields, as in `mypoint.x`.
581581

582-
~~~~
583-
struct Point {
584-
x: float,
585-
y: float
586-
}
587-
~~~~
588-
589582
Inherited mutability means that any field of a struct may be mutable, if the
590583
struct is in a mutable slot (or a field of a struct in a mutable slot, and
591584
so forth).
592585

593-
With a value (say, `mypoint`) of such a type in a mutable location, you can do
594-
`mypoint.y += 1.0`. But in an immutable location, such an assignment to a
595-
struct without inherited mutability would result in a type error.
596-
597-
~~~~ {.xfail-test}
598-
# struct Point { x: float, y: float }
599-
let mut mypoint = Point { x: 1.0, y: 1.0 };
600-
let origin = Point { x: 0.0, y: 0.0 };
601-
602-
mypoint.y += 1.0; // mypoint is mutable, and its fields as well
603-
origin.y += 1.0; // ERROR: assigning to immutable field
604586
~~~~
587+
struct Stack {
588+
content: ~[int],
589+
head: uint
590+
}
591+
~~~~
592+
593+
With a value (say, `mystack`) of such a type in a mutable location, you can do
594+
`mystack.head += 1`. But in an immutable location, such an assignment to a
595+
struct without inherited mutability would result in a type error.
605596

606597
`match` patterns destructure structs. The basic syntax is
607598
`Name { fieldname: pattern, ... }`:
@@ -1372,11 +1363,11 @@ let crayon_names = crayons.map(|v| crayon_to_str(*v));
13721363
let favorite_crayon_name = crayon_names[0];
13731364
13741365
// Remove whitespace from before and after the string
1375-
let new_favorite_crayon_name = favorite_crayon_name.trim();
1366+
let new_favorite_crayon_name = favorite_crayon_name.trim_DBGBRWD();
13761367
13771368
if favorite_crayon_name.len() > 5 {
13781369
// Create a substring
1379-
println(favorite_crayon_name.substr(0, 5));
1370+
println(favorite_crayon_name.substr_DBGBRWD(0, 5));
13801371
}
13811372
~~~
13821373

branches/try2/src/compiletest/runtest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ fn run_debuginfo_test(config: config, props: TestProps, testfile: &Path) {
268268
// output (in order)
269269
let mut i = 0u;
270270
for str::lines(ProcRes.stdout).each |line| {
271-
if props.check_lines[i].trim() == line.trim() {
271+
if props.check_lines[i].trim_DBGBRWD() == line.trim_DBGBRWD() {
272272
i += 1u;
273273
}
274274
if i == num_check_lines {

branches/try2/src/libcore/char.rs

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -288,16 +288,16 @@ fn test_is_whitespace() {
288288

289289
#[test]
290290
fn test_to_digit() {
291-
assert_eq!(to_digit('0', 10u), Some(0u));
292-
assert_eq!(to_digit('1', 2u), Some(1u));
293-
assert_eq!(to_digit('2', 3u), Some(2u));
294-
assert_eq!(to_digit('9', 10u), Some(9u));
295-
assert_eq!(to_digit('a', 16u), Some(10u));
296-
assert_eq!(to_digit('A', 16u), Some(10u));
297-
assert_eq!(to_digit('b', 16u), Some(11u));
298-
assert_eq!(to_digit('B', 16u), Some(11u));
299-
assert_eq!(to_digit('z', 36u), Some(35u));
300-
assert_eq!(to_digit('Z', 36u), Some(35u));
291+
fail_unless!(to_digit('0', 10u) == Some(0u));
292+
fail_unless!(to_digit('1', 2u) == Some(1u));
293+
fail_unless!(to_digit('2', 3u) == Some(2u));
294+
fail_unless!(to_digit('9', 10u) == Some(9u));
295+
fail_unless!(to_digit('a', 16u) == Some(10u));
296+
fail_unless!(to_digit('A', 16u) == Some(10u));
297+
fail_unless!(to_digit('b', 16u) == Some(11u));
298+
fail_unless!(to_digit('B', 16u) == Some(11u));
299+
fail_unless!(to_digit('z', 36u) == Some(35u));
300+
fail_unless!(to_digit('Z', 36u) == Some(35u));
301301

302302
fail_unless!(to_digit(' ', 10u).is_none());
303303
fail_unless!(to_digit('$', 36u).is_none());
@@ -321,28 +321,28 @@ fn test_is_digit() {
321321
322322
#[test]
323323
fn test_escape_default() {
324-
assert_eq!(escape_default('\n'), ~"\\n");
325-
assert_eq!(escape_default('\r'), ~"\\r");
326-
assert_eq!(escape_default('\''), ~"\\'");
327-
assert_eq!(escape_default('"'), ~"\\\"");
328-
assert_eq!(escape_default(' '), ~" ");
329-
assert_eq!(escape_default('a'), ~"a");
330-
assert_eq!(escape_default('~'), ~"~");
331-
assert_eq!(escape_default('\x00'), ~"\\x00");
332-
assert_eq!(escape_default('\x1f'), ~"\\x1f");
333-
assert_eq!(escape_default('\x7f'), ~"\\x7f");
334-
assert_eq!(escape_default('\xff'), ~"\\xff");
335-
assert_eq!(escape_default('\u011b'), ~"\\u011b");
336-
assert_eq!(escape_default('\U0001d4b6'), ~"\\U0001d4b6");
324+
fail_unless!(escape_default('\n') == ~"\\n");
325+
fail_unless!(escape_default('\r') == ~"\\r");
326+
fail_unless!(escape_default('\'') == ~"\\'");
327+
fail_unless!(escape_default('"') == ~"\\\"");
328+
fail_unless!(escape_default(' ') == ~" ");
329+
fail_unless!(escape_default('a') == ~"a");
330+
fail_unless!(escape_default('~') == ~"~");
331+
fail_unless!(escape_default('\x00') == ~"\\x00");
332+
fail_unless!(escape_default('\x1f') == ~"\\x1f");
333+
fail_unless!(escape_default('\x7f') == ~"\\x7f");
334+
fail_unless!(escape_default('\xff') == ~"\\xff");
335+
fail_unless!(escape_default('\u011b') == ~"\\u011b");
336+
fail_unless!(escape_default('\U0001d4b6') == ~"\\U0001d4b6");
337337
}
338338
339339
340340
#[test]
341341
fn test_escape_unicode() {
342-
assert_eq!(escape_unicode('\x00'), ~"\\x00");
343-
assert_eq!(escape_unicode('\n'), ~"\\x0a");
344-
assert_eq!(escape_unicode(' '), ~"\\x20");
345-
assert_eq!(escape_unicode('a'), ~"\\x61");
346-
assert_eq!(escape_unicode('\u011b'), ~"\\u011b");
347-
assert_eq!(escape_unicode('\U0001d4b6'), ~"\\U0001d4b6");
342+
fail_unless!(escape_unicode('\x00') == ~"\\x00");
343+
fail_unless!(escape_unicode('\n') == ~"\\x0a");
344+
fail_unless!(escape_unicode(' ') == ~"\\x20");
345+
fail_unless!(escape_unicode('a') == ~"\\x61");
346+
fail_unless!(escape_unicode('\u011b') == ~"\\u011b");
347+
fail_unless!(escape_unicode('\U0001d4b6') == ~"\\U0001d4b6");
348348
}

branches/try2/src/libcore/cmp.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,10 @@ pub pure fn max<T:Ord>(v1: T, v2: T) -> T {
172172
mod test {
173173
#[test]
174174
fn test_int() {
175-
assert_eq!(5.cmp(&10), Less);
176-
assert_eq!(10.cmp(&5), Greater);
177-
assert_eq!(5.cmp(&5), Equal);
178-
assert_eq!((-5).cmp(&12), Less);
179-
assert_eq!(12.cmp(-5), Greater);
175+
fail_unless!(5.cmp(&10) == Less);
176+
fail_unless!(10.cmp(&5) == Greater);
177+
fail_unless!(5.cmp(&5) == Equal);
178+
fail_unless!((-5).cmp(&12) == Less);
179+
fail_unless!(12.cmp(-5) == Greater);
180180
}
181181
}

branches/try2/src/libcore/core.rc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ pub use path::WindowsPath;
198198
pub use path::PosixPath;
199199

200200
pub use tuple::{CopyableTuple, ImmutableTuple, ExtendedTupleOps};
201-
pub use str::{StrSlice, Trimmable};
201+
pub use str::{StrSlice};
202202
pub use container::{Container, Mutable};
203203
pub use vec::{CopyableVector, ImmutableVector};
204204
pub use vec::{ImmutableEqVector, ImmutableCopyableVector};

0 commit comments

Comments
 (0)