Skip to content

Commit 414b005

Browse files
committed
---
yaml --- r: 83279 b: refs/heads/try c: 76a5391 h: refs/heads/master i: 83277: 8eb0eef 83275: c51147a 83271: 6b6e90e 83263: e98a444 v: v3
1 parent 62c57f6 commit 414b005

34 files changed

+240
-290
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 0e4d1fc8cae42e15e00f71d9f439b01bb25a86ae
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 6c08cc2db4f98e9f07ae7d50338396c4123c2f0a
5-
refs/heads/try: 176051c6f85d5cd3843d7aa4446998ac620627b4
5+
refs/heads/try: 76a53911b45aad4bb036bd7af596b6c43dd600a8
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/doc/tutorial-container.md

Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44

55
The container traits are defined in the `std::container` module.
66

7-
## Unique vectors
7+
## Unique and managed vectors
88

9-
Vectors have `O(1)` indexing, push (to the end) and pop (from the end). Vectors
10-
are the most common container in Rust, and are flexible enough to fit many use
11-
cases.
9+
Vectors have `O(1)` indexing and removal from the end, along with `O(1)`
10+
amortized insertion. Vectors are the most common container in Rust, and are
11+
flexible enough to fit many use cases.
1212

1313
Vectors can also be sorted and used as efficient lookup tables with the
14-
`bsearch()` method, if all the elements are inserted at one time and
14+
`std::vec::bsearch` function, if all the elements are inserted at one time and
1515
deletions are unnecessary.
1616

1717
## Maps and sets
@@ -42,15 +42,10 @@ implementing the `IterBytes` trait.
4242

4343
## Double-ended queues
4444

45-
The `extra::ringbuf` module implements a double-ended queue with `O(1)`
46-
amortized inserts and removals from both ends of the container. It also has
47-
`O(1)` indexing like a vector. The contained elements are not required to be
48-
copyable, and the queue will be sendable if the contained type is sendable.
49-
Its interface `Deque` is defined in `extra::collections`.
50-
51-
The `extra::dlist` module implements a double-ended linked list, also
52-
implementing the `Deque` trait, with `O(1)` removals and inserts at either end,
53-
and `O(1)` concatenation.
45+
The `extra::deque` module implements a double-ended queue with `O(1)` amortized
46+
inserts and removals from both ends of the container. It also has `O(1)`
47+
indexing like a vector. The contained elements are not required to be copyable,
48+
and the queue will be sendable if the contained type is sendable.
5449

5550
## Priority queues
5651

@@ -202,11 +197,11 @@ The function `range` (or `range_inclusive`) allows to simply iterate through a g
202197
203198
~~~
204199
for i in range(0, 5) {
205-
print!("{} ", i) // prints "0 1 2 3 4"
200+
printf!("%d ", i) // prints "0 1 2 3 4"
206201
}
207202

208203
for i in std::iter::range_inclusive(0, 5) { // needs explicit import
209-
print!("{} ", i) // prints "0 1 2 3 4 5"
204+
printf!("%d ", i) // prints "0 1 2 3 4 5"
210205
}
211206
~~~
212207
@@ -238,15 +233,15 @@ let mut it = xs.iter().zip(ys.iter());
238233

239234
// print out the pairs of elements up to (&3, &"baz")
240235
for (x, y) in it {
241-
println!("{} {}", *x, *y);
236+
printfln!("%d %s", *x, *y);
242237

243238
if *x == 3 {
244239
break;
245240
}
246241
}
247242

248243
// yield and print the last pair from the iterator
249-
println!("last: {:?}", it.next());
244+
printfln!("last: %?", it.next());
250245

251246
// the iterator is now fully consumed
252247
assert!(it.next().is_none());
@@ -340,13 +335,13 @@ another `DoubleEndedIterator` with `next` and `next_back` exchanged.
340335
~~~
341336
let xs = [1, 2, 3, 4, 5, 6];
342337
let mut it = xs.iter();
343-
println!("{:?}", it.next()); // prints `Some(&1)`
344-
println!("{:?}", it.next()); // prints `Some(&2)`
345-
println!("{:?}", it.next_back()); // prints `Some(&6)`
338+
printfln!("%?", it.next()); // prints `Some(&1)`
339+
printfln!("%?", it.next()); // prints `Some(&2)`
340+
printfln!("%?", it.next_back()); // prints `Some(&6)`
346341
347342
// prints `5`, `4` and `3`
348343
for &x in it.invert() {
349-
println!("{}", x)
344+
printfln!("%?", x)
350345
}
351346
~~~
352347

@@ -361,11 +356,11 @@ let xs = [1, 2, 3, 4];
361356
let ys = [5, 6, 7, 8];
362357
let mut it = xs.iter().chain(ys.iter()).map(|&x| x * 2);
363358
364-
println!("{:?}", it.next()); // prints `Some(2)`
359+
printfln!("%?", it.next()); // prints `Some(2)`
365360
366361
// prints `16`, `14`, `12`, `10`, `8`, `6`, `4`
367362
for x in it.invert() {
368-
println!("{}", x);
363+
printfln!("%?", x);
369364
}
370365
~~~
371366

@@ -392,17 +387,17 @@ underlying iterators are.
392387
let xs = [1, 2, 3, 4, 5];
393388
let ys = ~[7, 9, 11];
394389
let mut it = xs.iter().chain(ys.iter());
395-
println!("{:?}", it.idx(0)); // prints `Some(&1)`
396-
println!("{:?}", it.idx(5)); // prints `Some(&7)`
397-
println!("{:?}", it.idx(7)); // prints `Some(&11)`
398-
println!("{:?}", it.idx(8)); // prints `None`
390+
printfln!("%?", it.idx(0)); // prints `Some(&1)`
391+
printfln!("%?", it.idx(5)); // prints `Some(&7)`
392+
printfln!("%?", it.idx(7)); // prints `Some(&11)`
393+
printfln!("%?", it.idx(8)); // prints `None`
399394
400395
// yield two elements from the beginning, and one from the end
401396
it.next();
402397
it.next();
403398
it.next_back();
404399
405-
println!("{:?}", it.idx(0)); // prints `Some(&3)`
406-
println!("{:?}", it.idx(4)); // prints `Some(&9)`
407-
println!("{:?}", it.idx(6)); // prints `None`
400+
printfln!("%?", it.idx(0)); // prints `Some(&3)`
401+
printfln!("%?", it.idx(4)); // prints `Some(&9)`
402+
printfln!("%?", it.idx(6)); // prints `None`
408403
~~~

branches/try/doc/tutorial.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2979,15 +2979,15 @@ tutorials on individual topics.
29792979
* [The foreign function interface][ffi]
29802980
* [Containers and iterators](tutorial-container.html)
29812981
* [Error-handling and Conditions](tutorial-conditions.html)
2982-
* [Packaging up Rust code][rustpkg]
2982+
* [Packaging up Rust code](rustpkg)
29832983

29842984
There is further documentation on the [wiki], however those tend to be even more out of date as this document.
29852985

29862986
[borrow]: tutorial-borrowed-ptr.html
29872987
[tasks]: tutorial-tasks.html
29882988
[macros]: tutorial-macros.html
29892989
[ffi]: tutorial-ffi.html
2990-
[rustpkg]: rustpkg.html
2990+
[rustpkg]: tutorial-rustpkg.html
29912991

29922992
[wiki]: https://github.com/mozilla/rust/wiki/Docs
29932993

branches/try/src/libextra/glob.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
* `glob`/`fnmatch` functions.
2424
*/
2525

26-
use std::{os, path};
26+
use std::{os, path, util};
2727

2828
use sort;
2929

@@ -356,7 +356,7 @@ impl Pattern {
356356
chars_eq(c, c2, options.case_sensitive)
357357
}
358358
AnySequence => {
359-
unreachable!()
359+
util::unreachable()
360360
}
361361
};
362362
if !matches {

branches/try/src/libextra/terminfo/parm.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables)
261261
flags.width = (cur as uint - '0' as uint);
262262
fstate = FormatStateWidth;
263263
}
264-
_ => unreachable!()
264+
_ => util::unreachable()
265265
}
266266
state = FormatPattern(flags, fstate);
267267
}
@@ -487,7 +487,7 @@ fn format(val: Param, op: FormatOp, flags: Flags) -> Result<~[u8],~str> {
487487
FormatDigit => 10,
488488
FormatOctal => 8,
489489
FormatHex|FormatHEX => 16,
490-
FormatString => unreachable!()
490+
FormatString => util::unreachable()
491491
};
492492
let mut s = ~[];
493493
match op {
@@ -535,7 +535,7 @@ fn format(val: Param, op: FormatOp, flags: Flags) -> Result<~[u8],~str> {
535535
s.push_all_move(s_);
536536
}
537537
}
538-
FormatString => unreachable!()
538+
FormatString => util::unreachable()
539539
}
540540
s
541541
}

branches/try/src/libextra/url.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,16 +1061,12 @@ mod tests {
10611061
10621062
#[test]
10631063
fn test_decode_form_urlencoded() {
1064-
// FIXME #4449: Commented out because this causes an ICE, but only
1065-
// on FreeBSD
1066-
/*
10671064
assert_eq!(decode_form_urlencoded([]).len(), 0);
10681065
10691066
let s = "a=1&foo+bar=abc&foo+bar=12+%3D+34".as_bytes();
10701067
let form = decode_form_urlencoded(s);
10711068
assert_eq!(form.len(), 2);
1072-
assert_eq!(form.get_ref(&~"a"), &~[~"1"]);
1073-
assert_eq!(form.get_ref(&~"foo bar"), &~[~"abc", ~"12 = 34"]);
1074-
*/
1069+
assert_eq!(form.get(&~"a"), &~[~"1"]);
1070+
assert_eq!(form.get(&~"foo bar"), &~[~"abc", ~"12 = 34"]);
10751071
}
10761072
}

branches/try/src/librustc/back/rpath.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use metadata::cstore;
1414
use metadata::filesearch;
1515

1616
use std::hashmap::HashSet;
17-
use std::{os, vec};
17+
use std::{os, util, vec};
1818

1919
fn not_win32(os: session::Os) -> bool {
2020
os != session::OsWin32
@@ -116,7 +116,7 @@ pub fn get_rpath_relative_to_output(os: session::Os,
116116
session::OsAndroid | session::OsLinux | session::OsFreebsd
117117
=> "$ORIGIN",
118118
session::OsMacos => "@executable_path",
119-
session::OsWin32 => unreachable!()
119+
session::OsWin32 => util::unreachable()
120120
};
121121

122122
Path(prefix).push_rel(&os::make_absolute(output).get_relative_to(&os::make_absolute(lib)))

branches/try/src/librustc/middle/check_match.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ pub fn check_arms(cx: &MatchCheckCtxt, arms: &[Arm]) {
126126
Some(&DefStatic(did, false)) => {
127127
let const_expr = lookup_const_by_id(cx.tcx, did).unwrap();
128128
match eval_const_expr(cx.tcx, const_expr) {
129-
const_float(f) if f.is_nan() => true,
129+
const_float(f) if f.is_NaN() => true,
130130
_ => false
131131
}
132132
}
@@ -136,7 +136,7 @@ pub fn check_arms(cx: &MatchCheckCtxt, arms: &[Arm]) {
136136
do walk_pat(*pat) |p| {
137137
if pat_matches_nan(p) {
138138
cx.tcx.sess.span_warn(p.span, "unmatchable NaN in pattern, \
139-
use the is_nan method in a guard instead");
139+
use the is_NaN method in a guard instead");
140140
}
141141
true
142142
};

branches/try/src/librustc/middle/entry.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ use syntax::codemap::Span;
1818
use syntax::parse::token::special_idents;
1919
use syntax::visit;
2020
use syntax::visit::Visitor;
21+
use std::util;
2122

2223
struct EntryContext {
2324
session: Session,
@@ -93,7 +94,7 @@ fn find_item(item: @item, ctxt: &mut EntryContext) {
9394
ctxt.non_main_fns.push((item.id, item.span));
9495
}
9596
}
96-
_ => unreachable!()
97+
_ => util::unreachable()
9798
}
9899
}
99100

branches/try/src/librustc/middle/trans/_match.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ fn variant_opt(bcx: @mut Block, pat_id: ast::NodeId)
356356
adt::represent_node(bcx, pat_id))
357357
}
358358
}
359-
unreachable!();
359+
::std::util::unreachable();
360360
}
361361
ast::DefFn(*) |
362362
ast::DefStruct(_) => {

branches/try/src/librustdoc/prune_private_pass.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ use fold::Fold;
2020
use fold;
2121
use pass::Pass;
2222

23+
use std::util;
24+
2325
pub fn mk_pass() -> Pass {
2426
Pass {
2527
name: ~"prune_private",
@@ -146,7 +148,7 @@ fn is_visible(srv: astsrv::Srv, doc: doc::ItemDoc) -> bool {
146148
}
147149
}
148150
}
149-
_ => unreachable!()
151+
_ => util::unreachable()
150152
}
151153
}
152154
}

branches/try/src/librustpkg/api.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ use target::*;
1616
use version::Version;
1717
use workcache_support::*;
1818

19-
use std::os;
2019
use extra::arc::{Arc,RWArc};
2120
use extra::workcache;
2221
use extra::workcache::{Database, Logger, FreshnessMap};
@@ -41,13 +40,11 @@ pub fn new_default_context(c: workcache::Context, p: Path) -> BuildContext {
4140
}
4241

4342
fn file_is_fresh(path: &str, in_hash: &str) -> bool {
44-
let path = Path(path);
45-
os::path_exists(&path) && in_hash == digest_file_with_date(&path)
43+
in_hash == digest_file_with_date(&Path(path))
4644
}
4745

4846
fn binary_is_fresh(path: &str, in_hash: &str) -> bool {
49-
let path = Path(path);
50-
os::path_exists(&path) && in_hash == digest_only_date(&path)
47+
in_hash == digest_only_date(&Path(path))
5148
}
5249

5350
pub fn new_workcache_context(p: &Path) -> workcache::Context {

branches/try/src/librustpkg/exit_codes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
pub static COPY_FAILED_CODE: int = 65;
11+
pub static copy_failed_code: int = 65;

branches/try/src/librustpkg/path_util.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ fn target_bin_dir(workspace: &Path) -> Path {
118118
/// directory is, and if the file exists, return it.
119119
pub fn built_executable_in_workspace(pkgid: &PkgId, workspace: &Path) -> Option<Path> {
120120
let mut result = target_build_dir(workspace);
121+
// should use a target-specific subdirectory
121122
result = mk_output_path(Main, Build, pkgid, result);
122123
debug!("built_executable_in_workspace: checking whether %s exists",
123124
result.to_str());

branches/try/src/librustpkg/rustpkg.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ use package_source::PkgSrc;
4747
use target::{WhatToBuild, Everything, is_lib, is_main, is_test, is_bench};
4848
// use workcache_support::{discover_outputs, digest_only_date};
4949
use workcache_support::digest_only_date;
50-
use exit_codes::COPY_FAILED_CODE;
50+
use exit_codes::copy_failed_code;
5151

5252
pub mod api;
5353
mod conditions;
@@ -789,10 +789,10 @@ pub fn main_args(args: &[~str]) {
789789
}.run(sub_cmd, rm_args.clone())
790790
};
791791
// FIXME #9262: This is using the same error code for all errors,
792-
// and at least one test case succeeds if rustpkg returns COPY_FAILED_CODE,
792+
// and at least one test case succeeds if rustpkg returns copy_failed_code,
793793
// when actually, it might set the exit code for that even if a different
794794
// unhandled condition got raised.
795-
if result.is_err() { os::set_exit_status(COPY_FAILED_CODE); }
795+
if result.is_err() { os::set_exit_status(copy_failed_code); }
796796

797797
}
798798

0 commit comments

Comments
 (0)