Skip to content

Commit 3c251d6

Browse files
committed
---
yaml --- r: 139195 b: refs/heads/try2 c: b6f9aa1 h: refs/heads/master i: 139193: 9a04047 139191: 2859dff v: v3
1 parent bb2264d commit 3c251d6

File tree

128 files changed

+2066
-1627
lines changed

Some content is hidden

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

128 files changed

+2066
-1627
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: 94327d00c6a5329e510ae364850fa34cd758b83c
8+
refs/heads/try2: b6f9aa1fd75f0e9468b3bb9ee10a95d18c40b567
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: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -579,21 +579,30 @@ 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-
Inherited mutability means that any field of a struct may be mutable, if the
583-
struct is in a mutable slot (or a field of a struct in a mutable slot, and
584-
so forth).
585-
586582
~~~~
587-
struct Stack {
588-
content: ~[int],
589-
head: uint
583+
struct Point {
584+
x: float,
585+
y: float
590586
}
591587
~~~~
592588

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
589+
Inherited mutability means that any field of a struct may be mutable, if the
590+
struct is in a mutable slot (or a field of a struct in a mutable slot, and
591+
so forth).
592+
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
595595
struct without inherited mutability would result in a type error.
596596

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
604+
~~~~
605+
597606
`match` patterns destructure structs. The basic syntax is
598607
`Name { fieldname: pattern, ... }`:
599608

branches/try2/mk/install.mk

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,6 @@ install-host: $(CSREQ$(ISTAGE)_T_$(CFG_BUILD_TRIPLE)_H_$(CFG_BUILD_TRIPLE))
113113
$(Q)$(call INSTALL,$(HB2),$(PHB),rustdoc$(X_$(CFG_BUILD_TRIPLE)))
114114
$(Q)$(call INSTALL,$(HB2),$(PHB),rusti$(X_$(CFG_BUILD_TRIPLE)))
115115
$(Q)$(call INSTALL,$(HB2),$(PHB),rust$(X_$(CFG_BUILD_TRIPLE)))
116-
$(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_LIBRUSTC_$(CFG_BUILD_TRIPLE)))
117-
$(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_LIBRUSTPKG_$(CFG_BUILD_TRIPLE)))
118-
$(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_LIBRUSTDOC_$(CFG_BUILD_TRIPLE)))
119-
$(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_LIBRUSTI_$(CFG_BUILD_TRIPLE)))
120-
$(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_LIBRUST_$(CFG_BUILD_TRIPLE)))
121116
$(Q)$(call INSTALL_LIB,$(HL),$(PHL),$(CORELIB_GLOB_$(CFG_BUILD_TRIPLE)))
122117
$(Q)$(call INSTALL_LIB,$(HL),$(PHL),$(STDLIB_GLOB_$(CFG_BUILD_TRIPLE)))
123118
$(Q)$(call INSTALL_LIB,$(HL),$(PHL),$(LIBRUSTC_GLOB_$(CFG_BUILD_TRIPLE)))
@@ -142,11 +137,6 @@ uninstall:
142137
$(Q)rm -f $(PHB)/rust$(X_$(CFG_BUILD_TRIPLE))
143138
$(Q)rm -f $(PHB)/rustdoc$(X_$(CFG_BUILD_TRIPLE))
144139
$(Q)rm -f $(PHL)/$(CFG_RUSTLLVM_$(CFG_BUILD_TRIPLE))
145-
$(Q)rm -f $(PHL)/$(CFG_LIBRUSTPKG_$(CFG_BUILD_TRIPLE))
146-
$(Q)rm -f $(PHL)/$(CFG_LIBRUSTC_$(CFG_BUILD_TRIPLE))
147-
$(Q)rm -f $(PHL)/$(CFG_LIBRUSTDOC_$(CFG_BUILD_TRIPLE))
148-
$(Q)rm -f $(PHL)/$(CFG_LIBRUSTI_$(CFG_BUILD_TRIPLE))
149-
$(Q)rm -f $(PHL)/$(CFG_LIBRUST_$(CFG_BUILD_TRIPLE))
150140
$(Q)rm -f $(PHL)/$(CFG_RUNTIME_$(CFG_BUILD_TRIPLE))
151141
$(Q)for i in \
152142
$(call HOST_LIB_FROM_HL_GLOB,$(CORELIB_GLOB_$(CFG_BUILD_TRIPLE))) \

branches/try2/src/compiletest/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
use core::prelude::*;
1212

13-
#[deriving_eq]
13+
#[deriving(Eq)]
1414
pub enum mode {
1515
mode_compile_fail,
1616
mode_run_fail,

branches/try2/src/compiletest/runtest.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ fn run_debuginfo_test(config: config, props: TestProps, testfile: &Path) {
267267
// check if each line in props.check_lines appears in the
268268
// output (in order)
269269
let mut i = 0u;
270-
for str::lines(ProcRes.stdout).each |line| {
270+
for str::lines_each(ProcRes.stdout) |line| {
271271
if props.check_lines[i].trim() == line.trim() {
272272
i += 1u;
273273
}
@@ -297,8 +297,8 @@ fn check_error_patterns(props: TestProps,
297297
let mut next_err_idx = 0u;
298298
let mut next_err_pat = props.error_patterns[next_err_idx];
299299
let mut done = false;
300-
for str::split_char(ProcRes.stderr, '\n').each |line| {
301-
if str::contains(*line, next_err_pat) {
300+
for str::lines_each(ProcRes.stderr) |line| {
301+
if str::contains(line, next_err_pat) {
302302
debug!("found error pattern %s", next_err_pat);
303303
next_err_idx += 1u;
304304
if next_err_idx == vec::len(props.error_patterns) {
@@ -347,15 +347,15 @@ fn check_expected_errors(expected_errors: ~[errors::ExpectedError],
347347
// filename:line1:col1: line2:col2: *warning:* msg
348348
// where line1:col1: is the starting point, line2:col2:
349349
// is the ending point, and * represents ANSI color codes.
350-
for str::split_char(ProcRes.stderr, '\n').each |line| {
350+
for str::lines_each(ProcRes.stderr) |line| {
351351
let mut was_expected = false;
352352
for vec::eachi(expected_errors) |i, ee| {
353353
if !found_flags[i] {
354354
debug!("prefix=%s ee.kind=%s ee.msg=%s line=%s",
355-
prefixes[i], ee.kind, ee.msg, *line);
356-
if (str::starts_with(*line, prefixes[i]) &&
357-
str::contains(*line, ee.kind) &&
358-
str::contains(*line, ee.msg)) {
355+
prefixes[i], ee.kind, ee.msg, line);
356+
if (str::starts_with(line, prefixes[i]) &&
357+
str::contains(line, ee.kind) &&
358+
str::contains(line, ee.msg)) {
359359
found_flags[i] = true;
360360
was_expected = true;
361361
break;
@@ -364,13 +364,13 @@ fn check_expected_errors(expected_errors: ~[errors::ExpectedError],
364364
}
365365

366366
// ignore this msg which gets printed at the end
367-
if str::contains(*line, ~"aborting due to") {
367+
if str::contains(line, ~"aborting due to") {
368368
was_expected = true;
369369
}
370370

371-
if !was_expected && is_compiler_error_or_warning(*line) {
371+
if !was_expected && is_compiler_error_or_warning(str::from_slice(line)) {
372372
fatal_ProcRes(fmt!("unexpected compiler error or warning: '%s'",
373-
*line),
373+
line),
374374
ProcRes);
375375
}
376376
}

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-
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));
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));
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-
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");
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");
337337
}
338338
339339
340340
#[test]
341341
fn test_escape_unicode() {
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");
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");
348348
}

branches/try2/src/libcore/cmp.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pub trait Eq {
3737
pure fn ne(&self, other: &Self) -> bool;
3838
}
3939

40-
#[deriving_eq]
40+
#[deriving(Eq)]
4141
pub enum Ordering { Less, Equal, Greater }
4242

4343
/// Trait for types that form a total order
@@ -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-
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);
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);
180180
}
181181
}

branches/try2/src/libcore/comm.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,6 @@ pub fn stream<T:Owned>() -> (Port<T>, Chan<T>) {
108108
109109
// Add an inherent method so that imports of GenericChan are not
110110
// required.
111-
#[cfg(stage1)]
112-
#[cfg(stage2)]
113-
#[cfg(stage3)]
114111
pub impl<T: Owned> Chan<T> {
115112
fn send(&self, x: T) { chan_send(self, x) }
116113
fn try_send(&self, x: T) -> bool { chan_try_send(self, x) }
@@ -148,9 +145,6 @@ fn chan_try_send<T:Owned>(self: &Chan<T>, x: T) -> bool {
148145
}
149146
150147
// Use an inherent impl so that imports are not required:
151-
#[cfg(stage1)]
152-
#[cfg(stage2)]
153-
#[cfg(stage3)]
154148
pub impl<T: Owned> Port<T> {
155149
fn recv(&self) -> T { port_recv(self) }
156150
fn try_recv(&self) -> Option<T> { port_try_recv(self) }
@@ -226,9 +220,6 @@ pub fn PortSet<T: Owned>() -> PortSet<T>{
226220
}
227221
228222
// Use an inherent impl so that imports are not required:
229-
#[cfg(stage1)]
230-
#[cfg(stage2)]
231-
#[cfg(stage3)]
232223
pub impl<T:Owned> PortSet<T> {
233224
fn recv(&self) -> T { port_set_recv(self) }
234225
fn try_recv(&self) -> Option<T> { port_set_try_recv(self) }
@@ -302,9 +293,6 @@ pure fn port_set_peek<T:Owned>(self: &PortSet<T>) -> bool {
302293
/// A channel that can be shared between many senders.
303294
pub type SharedChan<T> = unstable::Exclusive<Chan<T>>;
304295
305-
#[cfg(stage1)]
306-
#[cfg(stage2)]
307-
#[cfg(stage3)]
308296
pub impl<T: Owned> SharedChan<T> {
309297
fn send(&self, x: T) { shared_chan_send(self, x) }
310298
fn try_send(&self, x: T) -> bool { shared_chan_try_send(self, x) }

branches/try2/src/libcore/core.rc

Lines changed: 1 addition & 34 deletions
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};
@@ -212,34 +212,10 @@ pub use to_str::ToStr;
212212
pub use clone::Clone;
213213

214214

215-
/*
216-
* Export the log levels as global constants. Higher levels mean
217-
* more-verbosity. Error is the bottom level, default logging level is
218-
* warn-and-below.
219-
*/
220-
/// The error log level
221-
#[cfg(stage0)]
222-
pub const error : u32 = 1_u32;
223-
/// The warning log level
224-
#[cfg(stage0)]
225-
pub const warn : u32 = 2_u32;
226-
/// The info log level
227-
#[cfg(stage0)]
228-
pub const info : u32 = 3_u32;
229-
/// The debug log level
230-
#[cfg(stage0)]
231-
pub const debug : u32 = 4_u32;
232-
233-
234215
/* Unsupported interfaces */
235216

236217
// Private APIs
237218
pub mod unstable;
238-
// NOTE: Remove after snapshot
239-
#[cfg(stage0)]
240-
pub mod private {
241-
pub use super::unstable::extfmt;
242-
}
243219

244220
/* For internal use, not exported */
245221

@@ -255,15 +231,6 @@ pub mod rt;
255231
// can be resolved within libcore.
256232
#[doc(hidden)]
257233
pub mod core {
258-
#[cfg(stage0)]
259-
pub const error : u32 = 1_u32;
260-
#[cfg(stage0)]
261-
pub const warn : u32 = 2_u32;
262-
#[cfg(stage0)]
263-
pub const info : u32 = 3_u32;
264-
#[cfg(stage0)]
265-
pub const debug : u32 = 4_u32;
266-
267234
pub use cmp;
268235
pub use condition;
269236
pub use option;

0 commit comments

Comments
 (0)