Skip to content

Commit 7bc310c

Browse files
committed
---
yaml --- r: 151155 b: refs/heads/try2 c: 1efb668 h: refs/heads/master i: 151153: a9be9d0 151151: 60b8d14 v: v3
1 parent 9fade92 commit 7bc310c

File tree

26 files changed

+240
-298
lines changed

26 files changed

+240
-298
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: ff25d62165cbd74e98c569aa74feedbb3ca181e3
8+
refs/heads/try2: 1efb668aaab923434b5b406b78afe5f6c0852ac7
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/doc/complement-lang-faq.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ Some examples that demonstrate different aspects of the language:
2222

2323
[sprocketnes]: https://github.com/pcwalton/sprocketnes
2424
[hash]: https://github.com/mozilla/rust/blob/master/src/libstd/hash.rs
25-
[HashMap]: https://github.com/mozilla/rust/blob/master/src/libcollections/hashmap.rs
26-
[json]: https://github.com/mozilla/rust/blob/master/src/libserialize/json.rs
25+
[HashMap]: https://github.com/mozilla/rust/blob/master/src/libstd/hashmap.rs
26+
[json]: https://github.com/mozilla/rust/blob/master/src/libextra/json.rs
2727

2828
You may also be interested in browsing [GitHub's Rust][github-rust] page.
2929

branches/try2/src/doc/tutorial.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1793,6 +1793,11 @@ spawn(proc() {
17931793
});
17941794
~~~~
17951795
1796+
> *Note:* If you want to see the output of `debug!` statements, you will need to turn on
1797+
> `debug!` logging. To enable `debug!` logging, set the RUST_LOG environment
1798+
> variable to the name of your crate, which, for a file named `foo.rs`, will be
1799+
> `foo` (e.g., with bash, `export RUST_LOG=foo`).
1800+
17961801
## Closure compatibility
17971802
17981803
Rust closures have a convenient subtyping property: you can pass any kind of

branches/try2/src/libnum/bigint.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,7 @@ impl Sub<BigUint, BigUint> for BigUint {
230230
lo
231231
}).collect();
232232

233-
assert!(borrow == 0,
234-
"Cannot subtract other from self because other is larger than self.");
233+
assert_eq!(borrow, 0); // <=> assert!((self >= other));
235234
return BigUint::new(diff);
236235
}
237236
}
@@ -1756,13 +1755,6 @@ mod biguint_tests {
17561755
}
17571756
}
17581757

1759-
#[test]
1760-
#[should_fail]
1761-
fn test_sub_fail_on_underflow() {
1762-
let (a, b) : (BigUint, BigUint) = (Zero::zero(), One::one());
1763-
a - b;
1764-
}
1765-
17661758
static mul_triples: &'static [(&'static [BigDigit],
17671759
&'static [BigDigit],
17681760
&'static [BigDigit])] = &[

branches/try2/src/librustc/front/feature_gate.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,16 @@ impl<'a> Visitor<()> for Context<'a> {
130130

131131
fn visit_view_item(&mut self, i: &ast::ViewItem, _: ()) {
132132
match i.node {
133-
ast::ViewItemUse(ref path) => {
134-
match path.node {
135-
ast::ViewPathGlob(..) => {
136-
self.gate_feature("globs", path.span,
137-
"glob import statements are \
138-
experimental and possibly buggy");
133+
ast::ViewItemUse(ref paths) => {
134+
for path in paths.iter() {
135+
match path.node {
136+
ast::ViewPathGlob(..) => {
137+
self.gate_feature("globs", path.span,
138+
"glob import statements are \
139+
experimental and possibly buggy");
140+
}
141+
_ => {}
139142
}
140-
_ => {}
141143
}
142144
}
143145
ast::ViewItemExternCrate(..) => {

branches/try2/src/librustc/front/std_inject.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ impl<'a> fold::Folder for PreludeInjector<'a> {
166166

167167
let vp = @codemap::dummy_spanned(ast::ViewPathGlob(prelude_path, ast::DUMMY_NODE_ID));
168168
let vi2 = ast::ViewItem {
169-
node: ast::ViewItemUse(vp),
169+
node: ast::ViewItemUse(vec!(vp)),
170170
attrs: Vec::new(),
171171
vis: ast::Inherited,
172172
span: DUMMY_SP,

branches/try2/src/librustc/front/test.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,9 +299,9 @@ fn mk_std(cx: &TestCtxt) -> ast::ViewItem {
299299
let id_test = token::str_to_ident("test");
300300
let (vi, vis) = if cx.is_test_crate {
301301
(ast::ViewItemUse(
302-
@nospan(ast::ViewPathSimple(id_test,
303-
path_node(vec!(id_test)),
304-
ast::DUMMY_NODE_ID))),
302+
vec!(@nospan(ast::ViewPathSimple(id_test,
303+
path_node(vec!(id_test)),
304+
ast::DUMMY_NODE_ID)))),
305305
ast::Public)
306306
} else {
307307
(ast::ViewItemExternCrate(id_test,

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

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -872,24 +872,26 @@ impl<'a> Visitor<()> for PrivacyVisitor<'a> {
872872
fn visit_view_item(&mut self, a: &ast::ViewItem, _: ()) {
873873
match a.node {
874874
ast::ViewItemExternCrate(..) => {}
875-
ast::ViewItemUse(ref vpath) => {
876-
match vpath.node {
877-
ast::ViewPathSimple(..) | ast::ViewPathGlob(..) => {}
878-
ast::ViewPathList(_, ref list, _) => {
879-
for pid in list.iter() {
880-
debug!("privacy - list {}", pid.node.id);
881-
let seg = ast::PathSegment {
882-
identifier: pid.node.name,
883-
lifetimes: Vec::new(),
884-
types: OwnedSlice::empty(),
885-
};
886-
let segs = vec!(seg);
887-
let path = ast::Path {
888-
global: false,
889-
span: pid.span,
890-
segments: segs,
891-
};
892-
self.check_path(pid.span, pid.node.id, &path);
875+
ast::ViewItemUse(ref uses) => {
876+
for vpath in uses.iter() {
877+
match vpath.node {
878+
ast::ViewPathSimple(..) | ast::ViewPathGlob(..) => {}
879+
ast::ViewPathList(_, ref list, _) => {
880+
for pid in list.iter() {
881+
debug!("privacy - list {}", pid.node.id);
882+
let seg = ast::PathSegment {
883+
identifier: pid.node.name,
884+
lifetimes: Vec::new(),
885+
types: OwnedSlice::empty(),
886+
};
887+
let segs = vec!(seg);
888+
let path = ast::Path {
889+
global: false,
890+
span: pid.span,
891+
segments: segs,
892+
};
893+
self.check_path(pid.span, pid.node.id, &path);
894+
}
893895
}
894896
}
895897
}

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

Lines changed: 75 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1417,69 +1417,71 @@ impl<'a> Resolver<'a> {
14171417
fn build_reduced_graph_for_view_item(&mut self, view_item: &ViewItem,
14181418
parent: ReducedGraphParent) {
14191419
match view_item.node {
1420-
ViewItemUse(ref view_path) => {
1421-
// Extract and intern the module part of the path. For
1422-
// globs and lists, the path is found directly in the AST;
1423-
// for simple paths we have to munge the path a little.
1424-
1425-
let mut module_path = Vec::new();
1426-
match view_path.node {
1427-
ViewPathSimple(_, ref full_path, _) => {
1428-
let path_len = full_path.segments.len();
1429-
assert!(path_len != 0);
1430-
1431-
for (i, segment) in full_path.segments
1432-
.iter()
1433-
.enumerate() {
1434-
if i != path_len - 1 {
1435-
module_path.push(segment.identifier)
1420+
ViewItemUse(ref view_paths) => {
1421+
for view_path in view_paths.iter() {
1422+
// Extract and intern the module part of the path. For
1423+
// globs and lists, the path is found directly in the AST;
1424+
// for simple paths we have to munge the path a little.
1425+
1426+
let mut module_path = Vec::new();
1427+
match view_path.node {
1428+
ViewPathSimple(_, ref full_path, _) => {
1429+
let path_len = full_path.segments.len();
1430+
assert!(path_len != 0);
1431+
1432+
for (i, segment) in full_path.segments
1433+
.iter()
1434+
.enumerate() {
1435+
if i != path_len - 1 {
1436+
module_path.push(segment.identifier)
1437+
}
14361438
}
14371439
}
1438-
}
14391440

1440-
ViewPathGlob(ref module_ident_path, _) |
1441-
ViewPathList(ref module_ident_path, _, _) => {
1442-
for segment in module_ident_path.segments.iter() {
1443-
module_path.push(segment.identifier)
1441+
ViewPathGlob(ref module_ident_path, _) |
1442+
ViewPathList(ref module_ident_path, _, _) => {
1443+
for segment in module_ident_path.segments.iter() {
1444+
module_path.push(segment.identifier)
1445+
}
14441446
}
14451447
}
1446-
}
14471448

1448-
// Build up the import directives.
1449-
let module_ = parent.module();
1450-
let is_public = view_item.vis == ast::Public;
1451-
match view_path.node {
1452-
ViewPathSimple(binding, ref full_path, id) => {
1453-
let source_ident =
1454-
full_path.segments.last().unwrap().identifier;
1455-
let subclass = SingleImport(binding,
1456-
source_ident);
1457-
self.build_import_directive(&*module_,
1458-
module_path,
1459-
subclass,
1460-
view_path.span,
1461-
id,
1462-
is_public);
1463-
}
1464-
ViewPathList(_, ref source_idents, _) => {
1465-
for source_ident in source_idents.iter() {
1466-
let name = source_ident.node.name;
1467-
self.build_import_directive(
1468-
&*module_,
1469-
module_path.clone(),
1470-
SingleImport(name, name),
1471-
source_ident.span,
1472-
source_ident.node.id,
1473-
is_public);
1449+
// Build up the import directives.
1450+
let module_ = parent.module();
1451+
let is_public = view_item.vis == ast::Public;
1452+
match view_path.node {
1453+
ViewPathSimple(binding, ref full_path, id) => {
1454+
let source_ident =
1455+
full_path.segments.last().unwrap().identifier;
1456+
let subclass = SingleImport(binding,
1457+
source_ident);
1458+
self.build_import_directive(&*module_,
1459+
module_path,
1460+
subclass,
1461+
view_path.span,
1462+
id,
1463+
is_public);
1464+
}
1465+
ViewPathList(_, ref source_idents, _) => {
1466+
for source_ident in source_idents.iter() {
1467+
let name = source_ident.node.name;
1468+
self.build_import_directive(
1469+
&*module_,
1470+
module_path.clone(),
1471+
SingleImport(name, name),
1472+
source_ident.span,
1473+
source_ident.node.id,
1474+
is_public);
1475+
}
1476+
}
1477+
ViewPathGlob(_, id) => {
1478+
self.build_import_directive(&*module_,
1479+
module_path,
1480+
GlobImport,
1481+
view_path.span,
1482+
id,
1483+
is_public);
14741484
}
1475-
}
1476-
ViewPathGlob(_, id) => {
1477-
self.build_import_directive(&*module_,
1478-
module_path,
1479-
GlobImport,
1480-
view_path.span,
1481-
id,
1482-
is_public);
14831485
}
14841486
}
14851487
}
@@ -5224,21 +5226,23 @@ impl<'a> Resolver<'a> {
52245226

52255227
match vi.node {
52265228
ViewItemExternCrate(..) => {} // ignore
5227-
ViewItemUse(ref p) => {
5228-
match p.node {
5229-
ViewPathSimple(_, _, id) => self.finalize_import(id, p.span),
5230-
ViewPathList(_, ref list, _) => {
5231-
for i in list.iter() {
5232-
self.finalize_import(i.node.id, i.span);
5233-
}
5234-
},
5235-
ViewPathGlob(_, id) => {
5236-
if !self.used_imports.contains(&(id, TypeNS)) &&
5237-
!self.used_imports.contains(&(id, ValueNS)) {
5238-
self.session.add_lint(UnusedImports, id, p.span,
5239-
"unused import".to_owned());
5240-
}
5241-
},
5229+
ViewItemUse(ref path) => {
5230+
for p in path.iter() {
5231+
match p.node {
5232+
ViewPathSimple(_, _, id) => self.finalize_import(id, p.span),
5233+
ViewPathList(_, ref list, _) => {
5234+
for i in list.iter() {
5235+
self.finalize_import(i.node.id, i.span);
5236+
}
5237+
},
5238+
ViewPathGlob(_, id) => {
5239+
if !self.used_imports.contains(&(id, TypeNS)) &&
5240+
!self.used_imports.contains(&(id, ValueNS)) {
5241+
self.session.add_lint(UnusedImports, id, p.span,
5242+
"unused import".to_owned());
5243+
}
5244+
},
5245+
}
52425246
}
52435247
}
52445248
}

branches/try2/src/librustdoc/clean.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@ use core;
3232
use doctree;
3333
use visit_ast;
3434

35-
/// A stable identifier to the particular version of JSON output.
36-
/// Increment this when the `Crate` and related structures change.
37-
pub static SCHEMA_VERSION: &'static str = "0.8.2";
38-
3935
pub trait Clean<T> {
4036
fn clean(&self) -> T;
4137
}
@@ -1089,7 +1085,7 @@ impl Clean<Item> for ast::ViewItem {
10891085
#[deriving(Clone, Encodable, Decodable)]
10901086
pub enum ViewItemInner {
10911087
ExternCrate(~str, Option<~str>, ast::NodeId),
1092-
Import(ViewPath)
1088+
Import(Vec<ViewPath>)
10931089
}
10941090

10951091
impl Clean<ViewItemInner> for ast::ViewItem_ {
@@ -1103,7 +1099,7 @@ impl Clean<ViewItemInner> for ast::ViewItem_ {
11031099
ExternCrate(i.clean(), string, *id)
11041100
}
11051101
&ast::ViewItemUse(ref vp) => {
1106-
Import(vp.clean())
1102+
Import(vp.clean().move_iter().collect())
11071103
}
11081104
}
11091105
}

branches/try2/src/librustdoc/html/render.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,10 +1167,12 @@ fn item_module(w: &mut Writer, cx: &Context,
11671167
try!(write!(w, ";</code></td></tr>"));
11681168
}
11691169

1170-
clean::Import(ref import) => {
1171-
try!(write!(w, "<tr><td><code>{}{}</code></td></tr>",
1172-
VisSpace(myitem.visibility),
1173-
*import));
1170+
clean::Import(ref imports) => {
1171+
for import in imports.iter() {
1172+
try!(write!(w, "<tr><td><code>{}{}</code></td></tr>",
1173+
VisSpace(myitem.visibility),
1174+
*import));
1175+
}
11741176
}
11751177
}
11761178

branches/try2/src/librustdoc/lib.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ use std::io::{File, MemWriter};
3434
use std::str;
3535
use serialize::{json, Decodable, Encodable};
3636

37-
// reexported from `clean` so it can be easily updated with the mod itself
38-
pub use clean::SCHEMA_VERSION;
39-
4037
pub mod clean;
4138
pub mod core;
4239
pub mod doctree;
@@ -58,6 +55,8 @@ pub mod visit_ast;
5855
pub mod test;
5956
mod flock;
6057

58+
pub static SCHEMA_VERSION: &'static str = "0.8.1";
59+
6160
type Pass = (&'static str, // name
6261
fn(clean::Crate) -> plugins::PluginResult, // fn
6362
&'static str); // description

branches/try2/src/librustdoc/visit_ast.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,14 @@ impl<'a> RustdocVisitor<'a> {
133133
return om.view_items.push(item.clone());
134134
}
135135
let item = match item.node {
136-
ast::ViewItemUse(ref vpath) => {
137-
match self.visit_view_path(*vpath, om) {
136+
ast::ViewItemUse(ref paths) => {
137+
// rustc no longer supports "use foo, bar;"
138+
assert_eq!(paths.len(), 1);
139+
match self.visit_view_path(*paths.get(0), om) {
138140
None => return,
139141
Some(path) => {
140142
ast::ViewItem {
141-
node: ast::ViewItemUse(path),
143+
node: ast::ViewItemUse(vec!(path)),
142144
.. item.clone()
143145
}
144146
}

0 commit comments

Comments
 (0)