Skip to content

Commit f04f801

Browse files
committed
---
yaml --- r: 110167 b: refs/heads/auto c: fbba696 h: refs/heads/master i: 110165: eb4e0ce 110163: 16f8a8c 110159: 9ec613d v: v3
1 parent 9db2238 commit f04f801

File tree

20 files changed

+268
-330
lines changed

20 files changed

+268
-330
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: 60d3c082e8c8d065022988e764e8b44057478ec0
16+
refs/heads/auto: fbba696a4686f0d4415ff728eb9441a2e0782e27
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/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/auto/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/auto/src/doc/tutorial.md

Lines changed: 10 additions & 9 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 = ~10;
1496-
let borrowed = &20;
1495+
let owned = ~20;
1496+
let borrowed = &30;
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,6 +1907,7 @@ to a reference.
19071907
// As with typical function arguments, owned pointers
19081908
// are automatically converted to references
19091909

1910+
(@s).draw_reference();
19101911
(~s).draw_reference();
19111912

19121913
// Unlike typical function arguments, the self value will
@@ -1917,7 +1918,7 @@ s.draw_reference();
19171918
(& &s).draw_reference();
19181919

19191920
// ... and dereferenced and borrowed
1920-
(&~s).draw_reference();
1921+
(&@~s).draw_reference();
19211922
~~~
19221923
19231924
Implementations may also define standalone (sometimes called "static")
@@ -2402,7 +2403,7 @@ that, like strings and vectors, objects have dynamic size and may
24022403
only be referred to via one of the pointer types.
24032404
Other pointer types work as well.
24042405
Casts to traits may only be done with compatible pointers so,
2405-
for example, an `&Circle` may not be cast to an `~Drawable`.
2406+
for example, an `@Circle` may not be cast to an `~Drawable`.
24062407
24072408
~~~
24082409
# type Circle = int; type Rectangle = int;
@@ -2505,8 +2506,8 @@ use std::f64::consts::PI;
25052506
# impl Circle for CircleStruct { fn radius(&self) -> f64 { (self.area() / PI).sqrt() } }
25062507
# impl Shape for CircleStruct { fn area(&self) -> f64 { PI * square(self.radius) } }
25072508
2508-
let concrete = ~CircleStruct{center:Point{x:3.0,y:4.0},radius:5.0};
2509-
let mycircle: ~Circle = concrete as ~Circle;
2509+
let concrete = @CircleStruct{center:Point{x:3.0,y:4.0},radius:5.0};
2510+
let mycircle: @Circle = concrete as @Circle;
25102511
let nonsense = mycircle.radius() * mycircle.area();
25112512
~~~
25122513

branches/auto/src/librustc/driver/driver.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,9 +323,6 @@ 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-
329326
let ty_cx = ty::mk_ctxt(sess, def_map, named_region_map, ast_map,
330327
freevars, region_map, lang_items);
331328

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

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/auto/src/librustc/driver/session.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,9 +232,6 @@ impl Session {
232232
pub fn span_end_note(&self, sp: Span, msg: &str) {
233233
self.diagnostic().span_end_note(sp, msg)
234234
}
235-
pub fn fileline_note(&self, sp: Span, msg: &str) {
236-
self.diagnostic().fileline_note(sp, msg)
237-
}
238235
pub fn note(&self, msg: &str) {
239236
self.diagnostic().handler().note(msg)
240237
}

branches/auto/src/librustc/metadata/creader.rs

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ use metadata::cstore;
2121
use metadata::decoder;
2222
use metadata::loader;
2323
use metadata::loader::Os;
24-
use metadata::loader::CratePaths;
2524

2625
use std::cell::RefCell;
2726
use std::rc::Rc;
@@ -142,7 +141,7 @@ fn visit_view_item(e: &mut Env, i: &ast::ViewItem) {
142141

143142
match extract_crate_info(e, i) {
144143
Some(info) => {
145-
let cnum = resolve_crate(e, &None, info.ident, &info.crate_id, None,
144+
let cnum = resolve_crate(e, None, info.ident, &info.crate_id, None,
146145
i.span);
147146
e.sess.cstore.add_extern_mod_stmt_cnum(info.id, cnum);
148147
}
@@ -279,13 +278,13 @@ fn existing_match(e: &Env, crate_id: &CrateId,
279278
None
280279
}
281280

282-
fn resolve_crate<'a>(e: &mut Env,
283-
root: &Option<CratePaths>,
284-
ident: &str,
285-
crate_id: &CrateId,
286-
hash: Option<&Svh>,
287-
span: Span)
288-
-> ast::CrateNum {
281+
fn resolve_crate(e: &mut Env,
282+
root_ident: Option<&str>,
283+
ident: &str,
284+
crate_id: &CrateId,
285+
hash: Option<&Svh>,
286+
span: Span)
287+
-> ast::CrateNum {
289288
match existing_match(e, crate_id, hash) {
290289
None => {
291290
let id_hash = link::crate_id_hash(crate_id);
@@ -298,11 +297,11 @@ fn resolve_crate<'a>(e: &mut Env,
298297
hash: hash.map(|a| &*a),
299298
os: e.os,
300299
intr: e.intr.clone(),
301-
rejected_via_hash: vec!(),
300+
rejected_via_hash: false,
302301
};
303302
let loader::Library {
304303
dylib, rlib, metadata
305-
} = load_ctxt.load_library_crate(root);
304+
} = load_ctxt.load_library_crate(root_ident);
306305

307306
let crate_id = decoder::get_crate_id(metadata.as_slice());
308307
let hash = decoder::get_crate_hash(metadata.as_slice());
@@ -317,22 +316,15 @@ fn resolve_crate<'a>(e: &mut Env,
317316
});
318317
e.next_crate_num += 1;
319318

320-
// Stash paths for top-most crate locally if necessary.
321-
let crate_paths = if root.is_none() {
322-
Some(CratePaths {
323-
ident: load_ctxt.ident.to_owned(),
324-
dylib: dylib.clone(),
325-
rlib: rlib.clone(),
326-
})
327-
} else {
328-
None
329-
};
330319
// Maintain a reference to the top most crate.
331-
let root = if root.is_some() { root } else { &crate_paths };
320+
let root_crate = match root_ident {
321+
Some(c) => c,
322+
None => load_ctxt.ident.clone()
323+
};
332324

333325
// Now resolve the crates referenced by this crate
334326
let cnum_map = resolve_crate_deps(e,
335-
root,
327+
Some(root_crate),
336328
metadata.as_slice(),
337329
span);
338330

@@ -357,7 +349,7 @@ fn resolve_crate<'a>(e: &mut Env,
357349

358350
// Go through the crate metadata and load any crates that it references
359351
fn resolve_crate_deps(e: &mut Env,
360-
root: &Option<CratePaths>,
352+
root_ident: Option<&str>,
361353
cdata: &[u8], span : Span)
362354
-> cstore::cnum_map {
363355
debug!("resolving deps of external crate");
@@ -368,7 +360,7 @@ fn resolve_crate_deps(e: &mut Env,
368360
for dep in r.iter() {
369361
let extrn_cnum = dep.cnum;
370362
debug!("resolving dep crate {} hash: `{}`", dep.crate_id, dep.hash);
371-
let local_cnum = resolve_crate(e, root,
363+
let local_cnum = resolve_crate(e, root_ident,
372364
dep.crate_id.name.as_slice(),
373365
&dep.crate_id,
374366
Some(&dep.hash),
@@ -401,7 +393,7 @@ impl<'a> Loader<'a> {
401393
impl<'a> CrateLoader for Loader<'a> {
402394
fn load_crate(&mut self, krate: &ast::ViewItem) -> MacroCrate {
403395
let info = extract_crate_info(&self.env, krate).unwrap();
404-
let cnum = resolve_crate(&mut self.env, &None, info.ident,
396+
let cnum = resolve_crate(&mut self.env, None, info.ident,
405397
&info.crate_id, None, krate.span);
406398
let library = self.env.sess.cstore.get_used_crate_source(cnum).unwrap();
407399
MacroCrate {

branches/auto/src/librustc/metadata/loader.rs

Lines changed: 10 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,6 @@ pub enum Os {
4646
OsFreebsd
4747
}
4848

49-
pub struct HashMismatch {
50-
path: Path,
51-
}
52-
5349
pub struct Context<'a> {
5450
pub sess: &'a Session,
5551
pub span: Span,
@@ -59,7 +55,7 @@ pub struct Context<'a> {
5955
pub hash: Option<&'a Svh>,
6056
pub os: Os,
6157
pub intr: Rc<IdentInterner>,
62-
pub rejected_via_hash: Vec<HashMismatch>
58+
pub rejected_via_hash: bool,
6359
}
6460

6561
pub struct Library {
@@ -74,23 +70,6 @@ pub struct ArchiveMetadata {
7470
data: &'static [u8],
7571
}
7672

77-
pub struct CratePaths {
78-
pub ident: ~str,
79-
pub dylib: Option<Path>,
80-
pub rlib: Option<Path>
81-
}
82-
83-
impl CratePaths {
84-
fn paths(&self) -> Vec<Path> {
85-
match (&self.dylib, &self.rlib) {
86-
(&None, &None) => vec!(),
87-
(&Some(ref p), &None) |
88-
(&None, &Some(ref p)) => vec!(p.clone()),
89-
(&Some(ref p1), &Some(ref p2)) => vec!(p1.clone(), p2.clone()),
90-
}
91-
}
92-
}
93-
9473
// FIXME(#11857) this should be a "real" realpath
9574
fn realpath(p: &Path) -> Path {
9675
use std::os;
@@ -104,43 +83,26 @@ fn realpath(p: &Path) -> Path {
10483
}
10584

10685
impl<'a> Context<'a> {
107-
pub fn load_library_crate(&mut self, root: &Option<CratePaths>) -> Library {
86+
pub fn load_library_crate(&mut self, root_ident: Option<&str>) -> Library {
10887
match self.find_library_crate() {
10988
Some(t) => t,
11089
None => {
11190
self.sess.abort_if_errors();
112-
let message = if self.rejected_via_hash.len() > 0 {
91+
let message = if self.rejected_via_hash {
11392
format!("found possibly newer version of crate `{}`",
11493
self.ident)
11594
} else {
11695
format!("can't find crate for `{}`", self.ident)
11796
};
118-
let message = match root {
119-
&None => message,
120-
&Some(ref r) => format!("{} which `{}` depends on",
121-
message, r.ident)
97+
let message = match root_ident {
98+
None => message,
99+
Some(c) => format!("{} which `{}` depends on", message, c),
122100
};
123101
self.sess.span_err(self.span, message);
124102

125-
if self.rejected_via_hash.len() > 0 {
103+
if self.rejected_via_hash {
126104
self.sess.span_note(self.span, "perhaps this crate needs \
127105
to be recompiled?");
128-
let mismatches = self.rejected_via_hash.iter();
129-
for (i, &HashMismatch{ ref path }) in mismatches.enumerate() {
130-
self.sess.fileline_note(self.span,
131-
format!("crate `{}` path \\#{}: {}",
132-
self.ident, i+1, path.display()));
133-
}
134-
match root {
135-
&None => {}
136-
&Some(ref r) => {
137-
for (i, path) in r.paths().iter().enumerate() {
138-
self.sess.fileline_note(self.span,
139-
format!("crate `{}` path \\#{}: {}",
140-
r.ident, i+1, path.display()));
141-
}
142-
}
143-
}
144106
}
145107
self.sess.abort_if_errors();
146108
unreachable!()
@@ -330,7 +292,7 @@ impl<'a> Context<'a> {
330292
info!("{} reading metadata from: {}", flavor, lib.display());
331293
let metadata = match get_metadata_section(self.os, &lib) {
332294
Ok(blob) => {
333-
if self.crate_matches(blob.as_slice(), &lib) {
295+
if self.crate_matches(blob.as_slice()) {
334296
blob
335297
} else {
336298
info!("metadata mismatch");
@@ -365,7 +327,7 @@ impl<'a> Context<'a> {
365327
return if error > 0 {None} else {ret}
366328
}
367329

368-
fn crate_matches(&mut self, crate_data: &[u8], libpath: &Path) -> bool {
330+
fn crate_matches(&mut self, crate_data: &[u8]) -> bool {
369331
match decoder::maybe_get_crate_id(crate_data) {
370332
Some(ref id) if self.crate_id.matches(id) => {}
371333
_ => return false
@@ -377,7 +339,7 @@ impl<'a> Context<'a> {
377339
None => true,
378340
Some(myhash) => {
379341
if *myhash != hash {
380-
self.rejected_via_hash.push(HashMismatch{ path: libpath.clone() });
342+
self.rejected_via_hash = true;
381343
false
382344
} else {
383345
true

0 commit comments

Comments
 (0)