Skip to content

Commit be642a3

Browse files
committed
---
yaml --- r: 35064 b: refs/heads/master c: 2ec09c4 h: refs/heads/master v: v3
1 parent 4d7763b commit be642a3

Some content is hidden

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

49 files changed

+384
-701
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: a0fda80a528122183938e4f0297102adffd62639
2+
refs/heads/master: 2ec09c4eb91b94bd68c95eaa8966d4801c3347bf
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: eb8fd119c65c67f3b1b8268cc7341c22d39b7b61
55
refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024

trunk/doc/tutorial.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ If you've fulfilled those prerequisites, something along these lines
100100
should work.
101101

102102
~~~~ {.notrust}
103-
$ curl -O http://dl.rust-lang.org/dist/rust-0.4.tar.gz
103+
$ wget http://dl.rust-lang.org/dist/rust-0.4.tar.gz
104104
$ tar -xzf rust-0.4.tar.gz
105105
$ cd rust-0.4
106106
$ ./configure
@@ -490,7 +490,7 @@ const MY_STRUCTY_PASSWORD: Password = Password { value: MY_PASSWORD };
490490
## Operators
491491

492492
Rust's set of operators contains very few surprises. Arithmetic is done with
493-
`*`, `/`, `%`, `+`, and `-` (multiply, divide, take remainder, add, subtract). `-` is
493+
`*`, `/`, `%`, `+`, and `-` (multiply, divide, remainder, plus, minus). `-` is
494494
also a unary prefix operator that negates numbers. As in C, the bit operators
495495
`>>`, `<<`, `&`, `|`, and `^` are also supported.
496496

@@ -608,7 +608,7 @@ a wildcard pattern that matches any single value. The asterisk (`*`)
608608
is a different wildcard that can match one or more fields in an `enum`
609609
variant.
610610

611-
The patterns in a match arm are followed by a fat arrow, `=>`, then an
611+
The patterns in an match arm are followed by a fat arrow, `=>`, then an
612612
expression to evaluate. Each case is separated by commas. It's often
613613
convenient to use a block expression for each case, in which case the
614614
commas are optional.
@@ -865,7 +865,7 @@ fn area(sh: Shape) -> float {
865865
}
866866
~~~~
867867

868-
You can write a lone `_` to ignore an individual field, and can
868+
You can write a lone `_` to ignore an individual fields, and can
869869
ignore all fields of a variant like: `Circle(*)`. As in their
870870
introduction form, nullary enum patterns are written without
871871
parentheses.
@@ -1096,7 +1096,7 @@ All pointer types can be dereferenced with the `*` unary operator.
10961096
Managed boxes are pointers to heap-allocated, garbage collected
10971097
memory. Applying the unary `@` operator to an expression creates a
10981098
managed box. The resulting box contains the result of the
1099-
expression. Copying a managed box, as happens during assignment, only
1099+
expression. Copying a shared box, as happens during assignment, only
11001100
copies a pointer, never the contents of the box.
11011101

11021102
~~~~
@@ -1145,7 +1145,7 @@ Managed boxes never cross task boundaries.
11451145
In contrast with managed boxes, owned boxes have a single owning
11461146
memory slot and thus two owned boxes may not refer to the same
11471147
memory. All owned boxes across all tasks are allocated on a single
1148-
_exchange heap_, where their uniquely-owned nature allows tasks to
1148+
_exchange heap_, where their uniquely owned nature allows tasks to
11491149
exchange them efficiently.
11501150

11511151
Because owned boxes are uniquely owned, copying them requires allocating
@@ -1158,7 +1158,7 @@ let x = ~10;
11581158
let y = x; // error: copying a non-implicitly copyable type
11591159
~~~~
11601160

1161-
If you really want to copy an owned box you must say so explicitly.
1161+
If you really want to copy a unique box you must say so explicitly.
11621162

11631163
~~~~
11641164
let x = ~10;
@@ -1190,7 +1190,7 @@ become the sole owner of the box.
11901190

11911191
Rust borrowed pointers are a general purpose reference/pointer type,
11921192
similar to the C++ reference type, but guaranteed to point to valid
1193-
memory. In contrast with owned pointers, where the holder of an owned
1193+
memory. In contrast with owned pointers, where the holder of a unique
11941194
pointer is the owner of the pointed-to memory, borrowed pointers never
11951195
imply ownership. Pointers may be borrowed from any type, in which case
11961196
the pointer is guaranteed not to outlive the value it points to.
@@ -1210,14 +1210,14 @@ contains a point, but allocated in a different location:
12101210
~~~
12111211
# struct Point { x: float, y: float }
12121212
let on_the_stack : Point = Point {x: 3.0, y: 4.0};
1213-
let managed_box : @Point = @Point {x: 5.0, y: 1.0};
1214-
let owned_box : ~Point = ~Point {x: 7.0, y: 9.0};
1213+
let shared_box : @Point = @Point {x: 5.0, y: 1.0};
1214+
let unique_box : ~Point = ~Point {x: 7.0, y: 9.0};
12151215
~~~
12161216
12171217
Suppose we wanted to write a procedure that computed the distance
12181218
between any two points, no matter where they were stored. For example,
12191219
we might like to compute the distance between `on_the_stack` and
1220-
`managed_box`, or between `managed_box` and `owned_box`. One option is
1220+
`shared_box`, or between `shared_box` and `unique_box`. One option is
12211221
to define a function that takes two arguments of type point—that is,
12221222
it takes the points by value. But this will cause the points to be
12231223
copied when we call the function. For points, this is probably not so
@@ -1241,11 +1241,11 @@ Now we can call `compute_distance()` in various ways:
12411241
~~~
12421242
# struct Point{ x: float, y: float };
12431243
# let on_the_stack : Point = Point {x: 3.0, y: 4.0};
1244-
# let managed_box : @Point = @Point {x: 5.0, y: 1.0};
1245-
# let owned_box : ~Point = ~Point {x: 7.0, y: 9.0};
1244+
# let shared_box : @Point = @Point {x: 5.0, y: 1.0};
1245+
# let unique_box : ~Point = ~Point {x: 7.0, y: 9.0};
12461246
# fn compute_distance(p1: &Point, p2: &Point) -> float { 0f }
1247-
compute_distance(&on_the_stack, managed_box);
1248-
compute_distance(managed_box, owned_box);
1247+
compute_distance(&on_the_stack, shared_box);
1248+
compute_distance(shared_box, unique_box);
12491249
~~~
12501250
12511251
Here the `&` operator is used to take the address of the variable
@@ -1255,11 +1255,11 @@ value. We also call this _borrowing_ the local variable
12551255
`on_the_stack`, because we are created an alias: that is, another
12561256
route to the same data.
12571257
1258-
In the case of the boxes `managed_box` and `owned_box`, however, no
1258+
In the case of the boxes `shared_box` and `unique_box`, however, no
12591259
explicit action is necessary. The compiler will automatically convert
12601260
a box like `@point` or `~point` to a borrowed pointer like
12611261
`&point`. This is another form of borrowing; in this case, the
1262-
contents of the managed/owned box is being lent out.
1262+
contents of the shared/unique box is being lent out.
12631263
12641264
Whenever a value is borrowed, there are some limitations on what you
12651265
can do with the original. For example, if the contents of a variable

trunk/src/libcore/result.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,11 @@ pub pure fn to_either<T: Copy, U: Copy>(res: &Result<U, T>)
103103
* ok(parse_bytes(buf))
104104
* }
105105
*/
106-
pub fn chain<T, U, V>(res: Result<T, V>, op: fn(t: T)
106+
pub fn chain<T, U: Copy, V: Copy>(res: Result<T, V>, op: fn(t: T)
107107
-> Result<U, V>) -> Result<U, V> {
108108
match move res {
109109
Ok(move t) => op(move t),
110-
Err(move e) => Err(move e)
110+
Err(move e) => Err(e)
111111
}
112112
}
113113

@@ -119,13 +119,13 @@ pub fn chain<T, U, V>(res: Result<T, V>, op: fn(t: T)
119119
* immediately returned. This function can be used to pass through a
120120
* successful result while handling an error.
121121
*/
122-
pub fn chain_err<T, U, V>(
122+
pub fn chain_err<T: Copy, U: Copy, V: Copy>(
123123
res: Result<T, V>,
124124
op: fn(t: V) -> Result<T, U>)
125125
-> Result<T, U> {
126126
match move res {
127-
Ok(move t) => Ok(move t),
128-
Err(move v) => op(move v)
127+
Ok(move t) => Ok(t),
128+
Err(move v) => op(v)
129129
}
130130
}
131131

trunk/src/libfuzzer/fuzzer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ fn as_str(f: fn@(+x: io::Writer)) -> ~str {
225225
io::with_str_writer(f)
226226
}
227227

228-
fn check_variants_of_ast(crate: ast::crate, codemap: codemap::CodeMap,
228+
fn check_variants_of_ast(crate: ast::crate, codemap: @codemap::CodeMap,
229229
filename: &Path, cx: context) {
230230
let stolen = steal(crate, cx.mode);
231231
let extra_exprs = vec::filter(common_exprs(),
@@ -239,7 +239,7 @@ fn check_variants_of_ast(crate: ast::crate, codemap: codemap::CodeMap,
239239

240240
fn check_variants_T<T: Copy>(
241241
crate: ast::crate,
242-
codemap: codemap::CodeMap,
242+
codemap: @codemap::CodeMap,
243243
filename: &Path,
244244
thing_label: ~str,
245245
things: ~[T],

trunk/src/librustc/driver/driver.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ fn pretty_print_input(sess: Session, cfg: ast::crate_cfg, input: input,
354354
ppm_expanded | ppm_normal => pprust::no_ann()
355355
};
356356
let is_expanded = upto != cu_parse;
357-
let src = codemap::get_filemap(sess.codemap, source_name(input)).src;
357+
let src = sess.codemap.get_filemap(source_name(input)).src;
358358
do io::with_str_reader(*src) |rdr| {
359359
pprust::print_crate(sess.codemap, sess.parse_sess.interner,
360360
sess.span_diagnostic, crate,
@@ -574,7 +574,7 @@ fn build_session_options(binary: ~str,
574574

575575
fn build_session(sopts: @session::options,
576576
demitter: diagnostic::emitter) -> Session {
577-
let codemap = codemap::new_codemap();
577+
let codemap = @codemap::CodeMap::new();
578578
let diagnostic_handler =
579579
diagnostic::mk_handler(Some(demitter));
580580
let span_diagnostic_handler =
@@ -583,7 +583,7 @@ fn build_session(sopts: @session::options,
583583
}
584584

585585
fn build_session_(sopts: @session::options,
586-
cm: codemap::CodeMap,
586+
cm: @codemap::CodeMap,
587587
demitter: diagnostic::emitter,
588588
span_diagnostic_handler: diagnostic::span_handler)
589589
-> Session {

trunk/src/librustc/driver/session.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ type Session_ = {targ_cfg: @config,
131131
opts: @options,
132132
cstore: metadata::cstore::CStore,
133133
parse_sess: parse_sess,
134-
codemap: codemap::CodeMap,
134+
codemap: @codemap::CodeMap,
135135
// For a library crate, this is always none
136136
mut main_fn: Option<(node_id, codemap::span)>,
137137
span_diagnostic: diagnostic::span_handler,

trunk/src/librustc/metadata/encoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::Serializer,
557557
let add_to_index = |copy ebml_w| add_to_index_(item, ebml_w, index);
558558

559559
debug!("encoding info for item at %s",
560-
syntax::codemap::span_to_str(item.span, ecx.tcx.sess.codemap));
560+
ecx.tcx.sess.codemap.span_to_str(item.span));
561561

562562
match item.node {
563563
item_const(_, _) => {

trunk/src/librustc/metadata/tyencode.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -286,11 +286,6 @@ fn enc_sty(w: io::Writer, cx: @ctxt, st: ty::sty) {
286286
w.write_char('I');
287287
w.write_uint(id.to_uint());
288288
}
289-
ty::ty_infer(ty::FloatVar(id)) => {
290-
w.write_char('X');
291-
w.write_char('F');
292-
w.write_uint(id.to_uint());
293-
}
294289
ty::ty_param({idx: id, def_id: did}) => {
295290
w.write_char('p');
296291
w.write_str(cx.ds(did));

trunk/src/librustc/middle/const_eval.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,8 +389,6 @@ fn lit_to_const(lit: @lit) -> const_val {
389389
lit_uint(n, _) => const_uint(n),
390390
lit_int_unsuffixed(n) => const_int(n),
391391
lit_float(n, _) => const_float(float::from_str(*n).get() as f64),
392-
lit_float_unsuffixed(n) =>
393-
const_float(float::from_str(*n).get() as f64),
394392
lit_nil => const_int(0i64),
395393
lit_bool(b) => const_bool(b)
396394
}

trunk/src/librustc/middle/liveness.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ use std::map::HashMap;
9797
use syntax::{visit, ast_util};
9898
use syntax::print::pprust::{expr_to_str, block_to_str};
9999
use visit::vt;
100-
use syntax::codemap::{span, span_to_str};
100+
use syntax::codemap::span;
101101
use syntax::ast::*;
102102
use io::WriterUtil;
103103
use capture::{cap_move, cap_drop, cap_copy, cap_ref};
@@ -170,9 +170,9 @@ impl LiveNodeKind : cmp::Eq {
170170
fn live_node_kind_to_str(lnk: LiveNodeKind, cx: ty::ctxt) -> ~str {
171171
let cm = cx.sess.codemap;
172172
match lnk {
173-
FreeVarNode(s) => fmt!("Free var node [%s]", span_to_str(s, cm)),
174-
ExprNode(s) => fmt!("Expr node [%s]", span_to_str(s, cm)),
175-
VarDefNode(s) => fmt!("Var def node [%s]", span_to_str(s, cm)),
173+
FreeVarNode(s) => fmt!("Free var node [%s]", cm.span_to_str(s)),
174+
ExprNode(s) => fmt!("Expr node [%s]", cm.span_to_str(s)),
175+
VarDefNode(s) => fmt!("Var def node [%s]", cm.span_to_str(s)),
176176
ExitNode => ~"Exit node"
177177
}
178178
}

trunk/src/librustc/middle/trans/base.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,7 @@ fn trans_trace(bcx: block, sp_opt: Option<span>, trace_str: ~str) {
919919
let {V_filename, V_line} = match sp_opt {
920920
Some(sp) => {
921921
let sess = bcx.sess();
922-
let loc = codemap::lookup_char_pos(sess.parse_sess.cm, sp.lo);
922+
let loc = sess.parse_sess.cm.lookup_char_pos(sp.lo);
923923
{V_filename: C_cstr(bcx.ccx(), loc.file.name),
924924
V_line: loc.line as int}
925925
}

trunk/src/librustc/middle/trans/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ fn _UndefReturn(cx: block, Fn: ValueRef) -> ValueRef {
645645
fn add_span_comment(bcx: block, sp: span, text: ~str) {
646646
let ccx = bcx.ccx();
647647
if !ccx.sess.no_asm_comments() {
648-
let s = text + ~" (" + codemap::span_to_str(sp, ccx.sess.codemap)
648+
let s = text + ~" (" + ccx.sess.codemap.span_to_str(sp)
649649
+ ~")";
650650
log(debug, s);
651651
add_comment(bcx, s);

trunk/src/librustc/middle/trans/consts.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,6 @@ fn const_lit(cx: @crate_ctxt, e: @ast::expr, lit: ast::lit)
2222
}
2323
}
2424
ast::lit_float(fs, t) => C_floating(*fs, T_float_ty(cx, t)),
25-
ast::lit_float_unsuffixed(fs) => {
26-
let lit_float_ty = ty::node_id_to_type(cx.tcx, e.id);
27-
match ty::get(lit_float_ty).sty {
28-
ty::ty_float(t) => {
29-
C_floating(*fs, T_float_ty(cx, t))
30-
}
31-
_ => {
32-
cx.sess.span_bug(lit.span,
33-
~"floating point literal doesn't have the right \
34-
type");
35-
}
36-
}
37-
}
3825
ast::lit_bool(b) => C_bool(b),
3926
ast::lit_nil => C_nil(),
4027
ast::lit_str(s) => C_estr_slice(cx, *s)

trunk/src/librustc/middle/trans/controlflow.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ fn trans_fail_value(bcx: block, sp_opt: Option<span>, V_fail_str: ValueRef)
339339
let {V_filename, V_line} = match sp_opt {
340340
Some(sp) => {
341341
let sess = bcx.sess();
342-
let loc = codemap::lookup_char_pos(sess.parse_sess.cm, sp.lo);
342+
let loc = sess.parse_sess.cm.lookup_char_pos(sp.lo);
343343
{V_filename: C_cstr(bcx.ccx(), loc.file.name),
344344
V_line: loc.line as int}
345345
}
@@ -361,7 +361,7 @@ fn trans_fail_bounds_check(bcx: block, sp: span,
361361
let _icx = bcx.insn_ctxt("trans_fail_bounds_check");
362362
let ccx = bcx.ccx();
363363
364-
let loc = codemap::lookup_char_pos(bcx.sess().parse_sess.cm, sp.lo);
364+
let loc = bcx.sess().parse_sess.cm.lookup_char_pos(sp.lo);
365365
let line = C_int(ccx, loc.line as int);
366366
let filename_cstr = C_cstr(bcx.ccx(), loc.file.name);
367367
let filename = PointerCast(bcx, filename_cstr, T_ptr(T_i8()));

trunk/src/librustc/middle/trans/debuginfo.rs

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,8 @@ fn create_file(cx: @crate_ctxt, full_path: ~str) -> @metadata<file_md> {
229229
return mdval;
230230
}
231231

232-
fn line_from_span(cm: codemap::CodeMap, sp: span) -> uint {
233-
codemap::lookup_char_pos(cm, sp.lo).line
232+
fn line_from_span(cm: @codemap::CodeMap, sp: span) -> uint {
233+
cm.lookup_char_pos(sp.lo).line
234234
}
235235

236236
fn create_block(cx: block) -> @metadata<block_md> {
@@ -244,9 +244,9 @@ fn create_block(cx: block) -> @metadata<block_md> {
244244
}
245245
let sp = cx.node_info.get().span;
246246

247-
let start = codemap::lookup_char_pos(cx.sess().codemap, sp.lo);
247+
let start = cx.sess().codemap.lookup_char_pos(sp.lo);
248248
let fname = start.file.name;
249-
let end = codemap::lookup_char_pos(cx.sess().codemap, sp.hi);
249+
let end = cx.sess().codemap.lookup_char_pos(sp.hi);
250250
let tg = LexicalBlockTag;
251251
/*alt cached_metadata::<@metadata<block_md>>(
252252
cache, tg,
@@ -597,7 +597,7 @@ fn create_ty(_cx: @crate_ctxt, _t: ty::t, _ty: @ast::Ty)
597597
}
598598

599599
fn filename_from_span(cx: @crate_ctxt, sp: codemap::span) -> ~str {
600-
codemap::lookup_char_pos(cx.sess.codemap, sp.lo).file.name
600+
cx.sess.codemap.lookup_char_pos(sp.lo).file.name
601601
}
602602

603603
fn create_var(type_tag: int, context: ValueRef, name: ~str, file: ValueRef,
@@ -629,8 +629,7 @@ fn create_local_var(bcx: block, local: @ast::local)
629629
// FIXME this should be handled (#2533)
630630
_ => fail ~"no single variable name for local"
631631
};
632-
let loc = codemap::lookup_char_pos(cx.sess.codemap,
633-
local.span.lo);
632+
let loc = cx.sess.codemap.lookup_char_pos(local.span.lo);
634633
let ty = node_id_type(bcx, local.node.id);
635634
let tymd = create_ty(cx, ty, local.node.ty);
636635
let filemd = create_file(cx, loc.file.name);
@@ -674,8 +673,7 @@ fn create_arg(bcx: block, arg: ast::arg, sp: span)
674673
option::None => ()
675674
}
676675

677-
let loc = codemap::lookup_char_pos(cx.sess.codemap,
678-
sp.lo);
676+
let loc = cx.sess.codemap.lookup_char_pos(sp.lo);
679677
let ty = node_id_type(bcx, arg.id);
680678
let tymd = create_ty(cx, ty, arg.ty);
681679
let filemd = create_file(cx, loc.file.name);
@@ -714,7 +712,7 @@ fn update_source_pos(cx: block, s: span) {
714712
}
715713
let cm = cx.sess().codemap;
716714
let blockmd = create_block(cx);
717-
let loc = codemap::lookup_char_pos(cm, s.lo);
715+
let loc = cm.lookup_char_pos(s.lo);
718716
let scopedata = ~[lli32(loc.line as int),
719717
lli32(loc.col as int),
720718
blockmd.node,
@@ -731,7 +729,7 @@ fn create_function(fcx: fn_ctxt) -> @metadata<subprogram_md> {
731729
log(debug, fcx.id);
732730

733731
let sp = fcx.span.get();
734-
log(debug, codemap::span_to_str(sp, cx.sess.codemap));
732+
log(debug, cx.sess.codemap.span_to_str(sp));
735733

736734
let (ident, ret_ty, id) = match cx.tcx.items.get(fcx.id) {
737735
ast_map::node_item(item, _) => {
@@ -773,8 +771,7 @@ fn create_function(fcx: fn_ctxt) -> @metadata<subprogram_md> {
773771
option::None => ()
774772
}
775773

776-
let loc = codemap::lookup_char_pos(cx.sess.codemap,
777-
sp.lo);
774+
let loc = cx.sess.codemap.lookup_char_pos(sp.lo);
778775
let file_node = create_file(cx, loc.file.name).node;
779776
let ty_node = if cx.sess.opts.extra_debuginfo {
780777
match ret_ty.node {

0 commit comments

Comments
 (0)