Skip to content

Commit cc43081

Browse files
committed
---
yaml --- r: 44628 b: refs/heads/master c: 8ee2d58 h: refs/heads/master v: v3
1 parent 38909c3 commit cc43081

File tree

12 files changed

+44
-96
lines changed

12 files changed

+44
-96
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: a782efc4f16fed52f1f82af5869bfb5285bbc3f4
2+
refs/heads/master: 8ee2d58683cd2dfe981b4c84b7538f44c7ec9cd2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a6d9689399d091c3265f00434a69c551a61c28dc
55
refs/heads/try: ef355f6332f83371e4acf04fc4eb940ab41d78d3

trunk/doc/tutorial.md

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,9 @@ for more information on them.
114114

115115
When complete, `make install` will place several programs into
116116
`/usr/local/bin`: `rustc`, the Rust compiler; `rustdoc`, the
117-
API-documentation tool; `cargo`, the Rust package manager;
118-
and `rusti`, the Rust REPL.
117+
API-documentation tool; `rustpkg`, the Rust package manager;
118+
`rusti`, the Rust REPL; and `rust`, a tool which acts both as a unified
119+
interface for them, and for a few common command line scenarios.
119120

120121
[wiki-start]: https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust
121122
[tarball]: http://static.rust-lang.org/dist/rust-0.5.tar.gz
@@ -154,6 +155,25 @@ declaration to appear at the top level of the file: all statements must
154155
live inside a function. Rust programs can also be compiled as
155156
libraries, and included in other programs.
156157

158+
## Using the rust tool
159+
160+
While using `rustc` directly to generate your executables, and then
161+
running them manually is a perfectly valid way to test your code,
162+
for smaller projects, prototypes, or if you're a beginner, it might be
163+
more convenient to use the `rust` tool.
164+
165+
You use it by calling it with one of the supported commands, followed by
166+
arguments for that command. For example `rust build foo.rs` calls the
167+
`build` command with the argument `foo.rs`.
168+
169+
The commands are:
170+
- `build`, `doc`, `pkg` and `sketch`, which simply forward all arguments
171+
to the included programs `rustc`, `rustdoc`, `rustpkg` and `rusti`.
172+
- `run` and `test`, which both accept one source file and, using `rustc`,
173+
produce either a normal or a test executable in the current working
174+
directory and run it.
175+
- `help`, which prints out the usage text of one of the commands.
176+
157177
## Editing Rust code
158178

159179
There are vim highlighting and indentation scripts in the Rust source
@@ -2184,7 +2204,7 @@ impl Circle for CircleStruct {
21842204
}
21852205
impl Shape for CircleStruct {
21862206
fn area(&self) -> float { pi * square(self.radius) }
2187-
}
2207+
}
21882208
~~~~
21892209

21902210
Notice that methods of `Circle` can call methods on `Shape`, as our

trunk/src/libcore/to_str.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ impl ToStr for @str {
4343
pure fn to_str(&self) -> ~str { ::str::from_slice(*self) }
4444
}
4545

46-
// FIXME #4898: impl for one-tuples
47-
4846
impl<A: ToStr, B: ToStr> ToStr for (A, B) {
4947
#[inline(always)]
5048
pure fn to_str(&self) -> ~str {

trunk/src/libcore/tuple.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,6 @@ impl<A: Copy, B: Copy> ExtendedTupleOps<A,B> for (~[A], ~[B]) {
111111
}
112112
}
113113

114-
// FIXME #4898: impl for one-tuples
115-
116114
#[cfg(notest)]
117115
impl<A: Eq, B: Eq> Eq for (A, B) {
118116
#[inline(always)]

trunk/src/librustc/middle/typeck/check/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1198,7 +1198,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
11981198

11991199
tcx.sess.span_err(sp, msg);
12001200

1201-
vec::from_fn(supplied_arg_count, |_| ty::mk_err(tcx))
1201+
vec::from_fn(expected_arg_count, |_| ty::mk_err(tcx))
12021202
};
12031203

12041204
sig.output

trunk/src/libsyntax/parse/parser.rs

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -576,21 +576,12 @@ pub impl Parser {
576576
self.bump();
577577
ty_nil
578578
} else {
579-
// (t) is a parenthesized ty
580-
// (t,) is the type of a tuple with only one field,
581-
// of type t
582579
let mut ts = ~[self.parse_ty(false)];
583-
let mut one_tuple = false;
584580
while self.token == token::COMMA {
585581
self.bump();
586-
if self.token != token::RPAREN {
587-
ts.push(self.parse_ty(false));
588-
}
589-
else {
590-
one_tuple = true;
591-
}
582+
ts.push(self.parse_ty(false));
592583
}
593-
let t = if ts.len() == 1 && !one_tuple { ts[0].node }
584+
let t = if vec::len(ts) == 1u { ts[0].node }
594585
else { ty_tup(ts) };
595586
self.expect(token::RPAREN);
596587
t
@@ -1070,9 +1061,6 @@ pub impl Parser {
10701061

10711062
if self.token == token::LPAREN {
10721063
self.bump();
1073-
// (e) is parenthesized e
1074-
// (e,) is a tuple with only one field, e
1075-
let mut one_tuple = false;
10761064
if self.token == token::RPAREN {
10771065
hi = self.span.hi;
10781066
self.bump();
@@ -1081,18 +1069,12 @@ pub impl Parser {
10811069
}
10821070
let mut es = ~[self.parse_expr()];
10831071
while self.token == token::COMMA {
1084-
self.bump();
1085-
if self.token != token::RPAREN {
1086-
es.push(self.parse_expr());
1087-
}
1088-
else {
1089-
one_tuple = true;
1090-
}
1072+
self.bump(); es.push(self.parse_expr());
10911073
}
10921074
hi = self.span.hi;
10931075
self.expect(token::RPAREN);
10941076

1095-
return if es.len() == 1 && !one_tuple {
1077+
return if es.len() == 1 {
10961078
self.mk_expr(lo, self.span.hi, expr_paren(es[0]))
10971079
}
10981080
else {
@@ -2176,13 +2158,11 @@ pub impl Parser {
21762158
pat = pat_lit(expr);
21772159
} else {
21782160
let mut fields = ~[self.parse_pat(refutable)];
2179-
if self.look_ahead(1) != token::RPAREN {
2180-
while self.token == token::COMMA {
2181-
self.bump();
2182-
fields.push(self.parse_pat(refutable));
2183-
}
2161+
while self.token == token::COMMA {
2162+
self.bump();
2163+
fields.push(self.parse_pat(refutable));
21842164
}
2185-
if fields.len() == 1 { self.expect(token::COMMA); }
2165+
if vec::len(fields) == 1u { self.expect(token::COMMA); }
21862166
hi = self.span.hi;
21872167
self.expect(token::RPAREN);
21882168
pat = pat_tup(fields);

trunk/src/libsyntax/print/pprust.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -414,9 +414,6 @@ pub fn print_type_ex(s: @ps, &&ty: @ast::Ty, print_colons: bool) {
414414
ast::ty_tup(elts) => {
415415
popen(s);
416416
commasep(s, inconsistent, elts, print_type);
417-
if elts.len() == 1 {
418-
word(s.s, ~",");
419-
}
420417
pclose(s);
421418
}
422419
ast::ty_bare_fn(f) => {
@@ -1202,9 +1199,6 @@ pub fn print_expr(s: @ps, &&expr: @ast::expr) {
12021199
ast::expr_tup(exprs) => {
12031200
popen(s);
12041201
commasep_exprs(s, inconsistent, exprs);
1205-
if exprs.len() == 1 {
1206-
word(s.s, ~",");
1207-
}
12081202
pclose(s);
12091203
}
12101204
ast::expr_call(func, args, sugar) => {
@@ -1640,9 +1634,6 @@ pub fn print_pat(s: @ps, &&pat: @ast::pat, refutable: bool) {
16401634
ast::pat_tup(elts) => {
16411635
popen(s);
16421636
commasep(s, inconsistent, elts, |s, p| print_pat(s, p, refutable));
1643-
if elts.len() == 1 {
1644-
word(s.s, ~",");
1645-
}
16461637
pclose(s);
16471638
}
16481639
ast::pat_box(inner) => {

trunk/src/test/bench/core-map.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -302,26 +302,26 @@ fn main() {
302302
}
303303
};
304304

305-
let seed = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
305+
let seed = ~[1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
306306

307307
{
308-
let rng = rand::seeded_rng(seed);
308+
let rng = rand::seeded_rng(&seed);
309309
let mut results = empty_results();
310310
old_int_benchmarks(rng, num_keys, &mut results);
311311
old_str_benchmarks(rng, num_keys, &mut results);
312312
write_results("std::oldmap::HashMap", &results);
313313
}
314314

315315
{
316-
let rng = rand::seeded_rng(seed);
316+
let rng = rand::seeded_rng(&seed);
317317
let mut results = empty_results();
318318
linear_int_benchmarks(rng, num_keys, &mut results);
319319
linear_str_benchmarks(rng, num_keys, &mut results);
320320
write_results("core::hashmap::linear::LinearMap", &results);
321321
}
322322

323323
{
324-
let rng = rand::seeded_rng(seed);
324+
let rng = rand::seeded_rng(&seed);
325325
let mut results = empty_results();
326326
tree_int_benchmarks(rng, num_keys, &mut results);
327327
tree_str_benchmarks(rng, num_keys, &mut results);

trunk/src/test/bench/core-set.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,27 +152,27 @@ fn main() {
152152
}
153153
};
154154

155-
let seed = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
155+
let seed = ~[1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
156156
let max = 200000;
157157

158158
{
159-
let rng = rand::seeded_rng(seed);
159+
let rng = rand::seeded_rng(&seed);
160160
let mut results = empty_results();
161161
results.bench_int(rng, num_keys, max, || LinearSet::new::<uint>());
162162
results.bench_str(rng, num_keys, || LinearSet::new::<~str>());
163163
write_results("core::hashmap::LinearSet", &results);
164164
}
165165

166166
{
167-
let rng = rand::seeded_rng(seed);
167+
let rng = rand::seeded_rng(&seed);
168168
let mut results = empty_results();
169169
results.bench_int(rng, num_keys, max, || TreeSet::new::<uint>());
170170
results.bench_str(rng, num_keys, || TreeSet::new::<~str>());
171171
write_results("std::treemap::TreeSet", &results);
172172
}
173173

174174
{
175-
let rng = rand::seeded_rng(seed);
175+
let rng = rand::seeded_rng(&seed);
176176
let mut results = empty_results();
177177
results.bench_int(rng, num_keys, max, || BitvSet::new());
178178
write_results("std::bitv::BitvSet", &results);

trunk/src/test/compile-fail/issue-4935.rs

Lines changed: 0 additions & 14 deletions
This file was deleted.

trunk/src/test/run-pass/one-tuple.rs

Lines changed: 0 additions & 24 deletions
This file was deleted.

trunk/src/test/run-pass/reflect-visit-data.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -636,12 +636,11 @@ struct Triple { x: int, y: int, z: int }
636636

637637
pub fn main() {
638638
unsafe {
639-
let r = (1,2,3,true,false, Triple {x:5,y:4,z:3}, (12,));
639+
let r = (1,2,3,true,false, Triple {x:5,y:4,z:3});
640640
let p = ptr::addr_of(&r) as *c_void;
641641
let u = my_visitor(@Stuff {mut ptr1: p,
642642
mut ptr2: p,
643-
mut vals: ~[]
644-
});
643+
mut vals: ~[]});
645644
let v = ptr_visit_adaptor(Inner {inner: u});
646645
let td = get_tydesc_for(r);
647646
unsafe { error!("tydesc sz: %u, align: %u",
@@ -654,7 +653,7 @@ pub fn main() {
654653
}
655654
error!("%?", copy u.vals);
656655
assert u.vals == ~[
657-
~"1", ~"2", ~"3", ~"true", ~"false", ~"5", ~"4", ~"3", ~"12"
656+
~"1", ~"2", ~"3", ~"true", ~"false", ~"5", ~"4", ~"3"
658657
];
659658
}
660659
}

0 commit comments

Comments
 (0)