Skip to content

Commit bb2264d

Browse files
committed
---
yaml --- r: 139194 b: refs/heads/try2 c: 94327d0 h: refs/heads/master v: v3
1 parent 9a04047 commit bb2264d

File tree

139 files changed

+1687
-2123
lines changed

Some content is hidden

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

139 files changed

+1687
-2123
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: f011f928dd69a5b770b348aea2c547431c34e11a
8+
refs/heads/try2: 94327d00c6a5329e510ae364850fa34cd758b83c
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: 9 additions & 18 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, ... }`:

branches/try2/mk/install.mk

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ 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)))
116121
$(Q)$(call INSTALL_LIB,$(HL),$(PHL),$(CORELIB_GLOB_$(CFG_BUILD_TRIPLE)))
117122
$(Q)$(call INSTALL_LIB,$(HL),$(PHL),$(STDLIB_GLOB_$(CFG_BUILD_TRIPLE)))
118123
$(Q)$(call INSTALL_LIB,$(HL),$(PHL),$(LIBRUSTC_GLOB_$(CFG_BUILD_TRIPLE)))
@@ -137,6 +142,11 @@ uninstall:
137142
$(Q)rm -f $(PHB)/rust$(X_$(CFG_BUILD_TRIPLE))
138143
$(Q)rm -f $(PHB)/rustdoc$(X_$(CFG_BUILD_TRIPLE))
139144
$(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))
140150
$(Q)rm -f $(PHL)/$(CFG_RUNTIME_$(CFG_BUILD_TRIPLE))
141151
$(Q)for i in \
142152
$(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_each(ProcRes.stdout) |line| {
270+
for str::lines(ProcRes.stdout).each |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::lines_each(ProcRes.stderr) |line| {
301-
if str::contains(line, next_err_pat) {
300+
for str::split_char(ProcRes.stderr, '\n').each |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::lines_each(ProcRes.stderr) |line| {
350+
for str::split_char(ProcRes.stderr, '\n').each |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(str::from_slice(line)) {
371+
if !was_expected && is_compiler_error_or_warning(*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-
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: 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-
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/comm.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ 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)]
111114
pub impl<T: Owned> Chan<T> {
112115
fn send(&self, x: T) { chan_send(self, x) }
113116
fn try_send(&self, x: T) -> bool { chan_try_send(self, x) }
@@ -145,6 +148,9 @@ fn chan_try_send<T:Owned>(self: &Chan<T>, x: T) -> bool {
145148
}
146149
147150
// Use an inherent impl so that imports are not required:
151+
#[cfg(stage1)]
152+
#[cfg(stage2)]
153+
#[cfg(stage3)]
148154
pub impl<T: Owned> Port<T> {
149155
fn recv(&self) -> T { port_recv(self) }
150156
fn try_recv(&self) -> Option<T> { port_try_recv(self) }
@@ -220,6 +226,9 @@ pub fn PortSet<T: Owned>() -> PortSet<T>{
220226
}
221227
222228
// Use an inherent impl so that imports are not required:
229+
#[cfg(stage1)]
230+
#[cfg(stage2)]
231+
#[cfg(stage3)]
223232
pub impl<T:Owned> PortSet<T> {
224233
fn recv(&self) -> T { port_set_recv(self) }
225234
fn try_recv(&self) -> Option<T> { port_set_try_recv(self) }
@@ -293,6 +302,9 @@ pure fn port_set_peek<T:Owned>(self: &PortSet<T>) -> bool {
293302
/// A channel that can be shared between many senders.
294303
pub type SharedChan<T> = unstable::Exclusive<Chan<T>>;
295304
305+
#[cfg(stage1)]
306+
#[cfg(stage2)]
307+
#[cfg(stage3)]
296308
pub impl<T: Owned> SharedChan<T> {
297309
fn send(&self, x: T) { shared_chan_send(self, x) }
298310
fn try_send(&self, x: T) -> bool { shared_chan_try_send(self, x) }

branches/try2/src/libcore/core.rc

Lines changed: 34 additions & 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};
201+
pub use str::{StrSlice, Trimmable};
202202
pub use container::{Container, Mutable};
203203
pub use vec::{CopyableVector, ImmutableVector};
204204
pub use vec::{ImmutableEqVector, ImmutableCopyableVector};
@@ -212,10 +212,34 @@ 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+
215234
/* Unsupported interfaces */
216235

217236
// Private APIs
218237
pub mod unstable;
238+
// NOTE: Remove after snapshot
239+
#[cfg(stage0)]
240+
pub mod private {
241+
pub use super::unstable::extfmt;
242+
}
219243

220244
/* For internal use, not exported */
221245

@@ -231,6 +255,15 @@ pub mod rt;
231255
// can be resolved within libcore.
232256
#[doc(hidden)]
233257
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+
234267
pub use cmp;
235268
pub use condition;
236269
pub use option;

0 commit comments

Comments
 (0)