Skip to content

Commit afbfc28

Browse files
committed
---
yaml --- r: 150610 b: refs/heads/try2 c: 5dacd11 h: refs/heads/master v: v3
1 parent 941e28d commit afbfc28

File tree

12 files changed

+143
-235
lines changed

12 files changed

+143
-235
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: d9a1af27419d866500db00a204854d708553a320
8+
refs/heads/try2: 5dacd1174d95732e2b2368896815781bbf891616
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/doc/rust.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,13 +206,12 @@ The keywords are the following strings:
206206
as
207207
break
208208
crate
209-
do
210209
else enum extern
211210
false fn for
212211
if impl in
213212
let loop
214213
match mod mut
215-
priv pub
214+
priv proc pub
216215
ref return
217216
self static struct super
218217
true trait type
@@ -2558,12 +2557,12 @@ task in a _failing state_.
25582557

25592558
~~~~ {.ignore}
25602559
# use std::task;
2561-
# do task::spawn {
2560+
# task::spawn(proc() {
25622561
25632562
([1, 2, 3, 4])[0];
25642563
(["a", "b"])[10]; // fails
25652564
2566-
# }
2565+
# })
25672566
~~~~
25682567

25692568
### Unary operator expressions

branches/try2/src/doc/rustdoc.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,12 +165,12 @@ that one can still write things like `#[deriving(Eq)]`).
165165
# // what's actually being documented.
166166
# fn fib(n: int) { n + 2 }
167167

168-
do spawn { fib(200); }
168+
spawn(proc() { fib(200); })
169169
```
170170
*/
171171
# fn foo() {}
172172

173-
The documentation online would look like `do spawn { fib(200); }`, but when
173+
The documentation online would look like `spawn(proc() { fib(200); })`, but when
174174
testing this code, the `fib` function will be included (so it can compile).
175175

176176
## Running tests (advanced)

branches/try2/src/doc/tutorial.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1492,8 +1492,8 @@ Rust uses the unary star operator (`*`) to access the contents of a
14921492
box or pointer, similarly to C.
14931493
14941494
~~~
1495-
let owned = ~20;
1496-
let borrowed = &30;
1495+
let owned = ~10;
1496+
let borrowed = &20;
14971497

14981498
let sum = *owned + *borrowed;
14991499
~~~
@@ -1520,7 +1520,7 @@ can sometimes make code awkward and parenthesis-filled.
15201520
# struct Point { x: f64, y: f64 }
15211521
# enum Shape { Rectangle(Point, Point) }
15221522
# impl Shape { fn area(&self) -> int { 0 } }
1523-
let start = @Point { x: 10.0, y: 20.0 };
1523+
let start = ~Point { x: 10.0, y: 20.0 };
15241524
let end = ~Point { x: (*start).x + 100.0, y: (*start).y + 100.0 };
15251525
let rect = &Rectangle(*start, *end);
15261526
let area = (*rect).area();
@@ -1534,7 +1534,7 @@ dot), so in most cases, explicitly dereferencing the receiver is not necessary.
15341534
# struct Point { x: f64, y: f64 }
15351535
# enum Shape { Rectangle(Point, Point) }
15361536
# impl Shape { fn area(&self) -> int { 0 } }
1537-
let start = @Point { x: 10.0, y: 20.0 };
1537+
let start = ~Point { x: 10.0, y: 20.0 };
15381538
let end = ~Point { x: start.x + 100.0, y: start.y + 100.0 };
15391539
let rect = &Rectangle(*start, *end);
15401540
let area = rect.area();
@@ -1546,7 +1546,7 @@ something silly like
15461546
15471547
~~~
15481548
# struct Point { x: f64, y: f64 }
1549-
let point = &@~Point { x: 10.0, y: 20.0 };
1549+
let point = &~Point { x: 10.0, y: 20.0 };
15501550
println!("{:f}", point.x);
15511551
~~~
15521552
@@ -1907,7 +1907,6 @@ to a reference.
19071907
// As with typical function arguments, owned pointers
19081908
// are automatically converted to references
19091909

1910-
(@s).draw_reference();
19111910
(~s).draw_reference();
19121911

19131912
// Unlike typical function arguments, the self value will
@@ -1918,7 +1917,7 @@ s.draw_reference();
19181917
(& &s).draw_reference();
19191918

19201919
// ... and dereferenced and borrowed
1921-
(&@~s).draw_reference();
1920+
(&~s).draw_reference();
19221921
~~~
19231922
19241923
Implementations may also define standalone (sometimes called "static")
@@ -2403,7 +2402,7 @@ that, like strings and vectors, objects have dynamic size and may
24032402
only be referred to via one of the pointer types.
24042403
Other pointer types work as well.
24052404
Casts to traits may only be done with compatible pointers so,
2406-
for example, an `@Circle` may not be cast to an `~Drawable`.
2405+
for example, an `&Circle` may not be cast to an `~Drawable`.
24072406
24082407
~~~
24092408
# type Circle = int; type Rectangle = int;
@@ -2506,8 +2505,8 @@ use std::f64::consts::PI;
25062505
# impl Circle for CircleStruct { fn radius(&self) -> f64 { (self.area() / PI).sqrt() } }
25072506
# impl Shape for CircleStruct { fn area(&self) -> f64 { PI * square(self.radius) } }
25082507
2509-
let concrete = @CircleStruct{center:Point{x:3.0,y:4.0},radius:5.0};
2510-
let mycircle: @Circle = concrete as @Circle;
2508+
let concrete = ~CircleStruct{center:Point{x:3.0,y:4.0},radius:5.0};
2509+
let mycircle: ~Circle = concrete as ~Circle;
25112510
let nonsense = mycircle.radius() * mycircle.area();
25122511
~~~
25132512

branches/try2/src/librustc/driver/driver.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,9 @@ pub fn phase_3_run_analysis_passes(sess: Session,
323323
let region_map = time(time_passes, "region resolution", (), |_|
324324
middle::region::resolve_crate(&sess, krate));
325325

326+
time(time_passes, "loop checking", (), |_|
327+
middle::check_loop::check_crate(&sess, krate));
328+
326329
let ty_cx = ty::mk_ctxt(sess, def_map, named_region_map, ast_map,
327330
freevars, region_map, lang_items);
328331

@@ -348,9 +351,6 @@ pub fn phase_3_run_analysis_passes(sess: Session,
348351
time(time_passes, "effect checking", (), |_|
349352
middle::effect::check_crate(&ty_cx, method_map, krate));
350353

351-
time(time_passes, "loop checking", (), |_|
352-
middle::check_loop::check_crate(&ty_cx, krate));
353-
354354
let middle::moves::MoveMaps {moves_map, moved_variables_set,
355355
capture_map} =
356356
time(time_passes, "compute moves", (), |_|

branches/try2/src/librustc/middle/check_loop.rs

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

11-
use middle::ty;
11+
use driver::session::Session;
1212

1313
use syntax::ast;
1414
use syntax::codemap::Span;
@@ -21,11 +21,11 @@ enum Context {
2121
}
2222

2323
struct CheckLoopVisitor<'a> {
24-
tcx: &'a ty::ctxt,
24+
sess: &'a Session,
2525
}
2626

27-
pub fn check_crate(tcx: &ty::ctxt, krate: &ast::Crate) {
28-
visit::walk_crate(&mut CheckLoopVisitor { tcx: tcx }, krate, Normal)
27+
pub fn check_crate(sess: &Session, krate: &ast::Crate) {
28+
visit::walk_crate(&mut CheckLoopVisitor { sess: sess }, krate, Normal)
2929
}
3030

3131
impl<'a> Visitor<Context> for CheckLoopVisitor<'a> {
@@ -57,12 +57,10 @@ impl<'a> CheckLoopVisitor<'a> {
5757
match cx {
5858
Loop => {}
5959
Closure => {
60-
self.tcx.sess.span_err(span, format!("`{}` inside of a closure",
61-
name));
60+
self.sess.span_err(span, format!("`{}` inside of a closure", name));
6261
}
6362
Normal => {
64-
self.tcx.sess.span_err(span, format!("`{}` outside of loop",
65-
name));
63+
self.sess.span_err(span, format!("`{}` outside of loop", name));
6664
}
6765
}
6866
}

branches/try2/src/librustc/middle/typeck/check/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -923,7 +923,7 @@ fn compare_impl_method(tcx: &ty::ctxt,
923923
result::Err(ref terr) => {
924924
tcx.sess.span_err(
925925
impl_m_span,
926-
format!("method `{}` has an incompatible type: {}",
926+
format!("method `{}` has an incompatible type for trait: {}",
927927
token::get_ident(trait_m.ident),
928928
ty::type_err_to_str(tcx, terr)));
929929
ty::note_and_explain_type_err(tcx, terr);

0 commit comments

Comments
 (0)