Skip to content

Commit 1a48c04

Browse files
committed
---
yaml --- r: 112615 b: refs/heads/snap-stage3 c: a1ad41b h: refs/heads/master i: 112613: ea72bad 112611: 26dcea7 112607: b04b8a0 v: v3
1 parent 4b53017 commit 1a48c04

File tree

51 files changed

+667
-265
lines changed

Some content is hidden

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

51 files changed

+667
-265
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 30e373390f1a2f74e78bf9ca9c8ca68451f3511a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: c8a29c4c595e76b71372a2e40d359ac1ddd8aec8
4+
refs/heads/snap-stage3: a1ad41b93d133aa4f3bda71475f8e41d9dfe704d
55
refs/heads/try: fa3000fae833e0869b11da51cabb2a2598ba86d1
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/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/libstd/hashmap.rs
26-
[json]: https://github.com/mozilla/rust/blob/master/src/libextra/json.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
2727

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

branches/snap-stage3/src/doc/tutorial.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1793,11 +1793,6 @@ 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-
18011796
## Closure compatibility
18021797
18031798
Rust closures have a convenient subtyping property: you can pass any kind of

branches/snap-stage3/src/etc/maketest.py

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,53 @@
1212
import os
1313
import sys
1414

15-
# FIXME #12303 these tests are broken on windows
16-
if os.name == 'nt':
17-
print 'ignoring make tests on windows'
18-
sys.exit(0)
15+
# msys1/msys2 automatically converts `/abs/path1:/abs/path2` into
16+
# `c:\real\abs\path1;c:\real\abs\path2` (semicolons) if shell thinks
17+
# the value is list of paths.
18+
# this causes great confusion and error: shell and Makefile doesn't like
19+
# windows paths so it is really error-prone. revert it for peace.
20+
def normalize_path(v):
21+
# c:\path -> /c/path
22+
if ':\\' in v:
23+
v = '/' + v.replace(':\\', '/')
24+
v = v.replace('\\', '/')
25+
return v
26+
27+
28+
def putenv(name, value):
29+
if os.name == 'nt':
30+
value = normalize_path(value)
31+
os.putenv(name, value)
32+
1933

2034
make = sys.argv[2]
21-
os.putenv('RUSTC', os.path.abspath(sys.argv[3]))
22-
os.putenv('TMPDIR', os.path.abspath(sys.argv[4]))
23-
os.putenv('CC', sys.argv[5])
24-
os.putenv('RUSTDOC', os.path.abspath(sys.argv[6]))
35+
putenv('RUSTC', os.path.abspath(sys.argv[3]))
36+
putenv('TMPDIR', os.path.abspath(sys.argv[4]))
37+
putenv('CC', sys.argv[5])
38+
putenv('RUSTDOC', os.path.abspath(sys.argv[6]))
2539
filt = sys.argv[7]
2640
ldpath = sys.argv[8]
2741
if ldpath != '':
28-
os.putenv(ldpath.split('=')[0], ldpath.split('=')[1])
42+
name = ldpath.split('=')[0]
43+
value = ldpath.split('=')[1]
44+
if os.name == 'nt' and name != 'PATH':
45+
value = ":".join(normalize_path(v) for v in value.split(";"))
46+
os.putenv(name, value)
2947

3048
if not filt in sys.argv[1]:
3149
sys.exit(0)
3250
print('maketest: ' + os.path.basename(os.path.dirname(sys.argv[1])))
3351

34-
proc = subprocess.Popen([make, '-C', sys.argv[1]],
52+
path = sys.argv[1]
53+
if path[-1] == '/':
54+
# msys1 has a bug that `make` fails to include `../tools.mk` (parent dir)
55+
# if `-C path` option is given and `path` is absolute directory with
56+
# trailing slash (`c:/path/to/test/`).
57+
# the easist workaround is to remove the slash (`c:/path/to/test`).
58+
# msys2 seems to fix this problem.
59+
path = path[:-1]
60+
61+
proc = subprocess.Popen([make, '-C', path],
3562
stdout = subprocess.PIPE,
3663
stderr = subprocess.PIPE)
3764
out, err = proc.communicate()

branches/snap-stage3/src/libnum/bigint.rs

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

233-
assert_eq!(borrow, 0); // <=> assert!((self >= other));
233+
assert!(borrow == 0,
234+
"Cannot subtract other from self because other is larger than self.");
234235
return BigUint::new(diff);
235236
}
236237
}
@@ -1755,6 +1756,13 @@ mod biguint_tests {
17551756
}
17561757
}
17571758

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+
17581766
static mul_triples: &'static [(&'static [BigDigit],
17591767
&'static [BigDigit],
17601768
&'static [BigDigit])] = &[

branches/snap-stage3/src/librustc/front/feature_gate.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -130,16 +130,14 @@ 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 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-
_ => {}
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");
142139
}
140+
_ => {}
143141
}
144142
}
145143
ast::ViewItemExternCrate(..) => {

branches/snap-stage3/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(vec!(vp)),
169+
node: ast::ViewItemUse(vp),
170170
attrs: Vec::new(),
171171
vis: ast::Inherited,
172172
span: DUMMY_SP,

branches/snap-stage3/src/librustc/front/test.rs

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

branches/snap-stage3/src/librustc/middle/privacy.rs

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -872,26 +872,24 @@ 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 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-
}
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);
895893
}
896894
}
897895
}

branches/snap-stage3/src/librustc/middle/resolve.rs

Lines changed: 71 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1417,72 +1417,70 @@ 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_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-
}
1438-
}
1439-
}
1440-
1441-
ViewPathGlob(ref module_ident_path, _) |
1442-
ViewPathList(ref module_ident_path, _, _) => {
1443-
for segment in module_ident_path.segments.iter() {
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 {
14441435
module_path.push(segment.identifier)
14451436
}
14461437
}
14471438
}
14481439

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);
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)
14641444
}
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);
1445+
}
1446+
}
1447+
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);
14841474
}
14851475
}
1476+
ViewPathGlob(_, id) => {
1477+
self.build_import_directive(&*module_,
1478+
module_path,
1479+
GlobImport,
1480+
view_path.span,
1481+
id,
1482+
is_public);
1483+
}
14861484
}
14871485
}
14881486

@@ -5226,23 +5224,21 @@ impl<'a> Resolver<'a> {
52265224

52275225
match vi.node {
52285226
ViewItemExternCrate(..) => {} // ignore
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-
}
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+
},
52465242
}
52475243
}
52485244
}

branches/snap-stage3/src/librustc/middle/typeck/check/mod.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3199,12 +3199,13 @@ fn check_expr_with_unifier(fcx: &FnCtxt,
31993199
}
32003200
ast::ExprStruct(ref path, ref fields, base_expr) => {
32013201
// Resolve the path.
3202-
match tcx.def_map.borrow().find(&id) {
3203-
Some(&ast::DefStruct(type_def_id)) => {
3202+
let def = tcx.def_map.borrow().find(&id).map(|i| *i);
3203+
match def {
3204+
Some(ast::DefStruct(type_def_id)) => {
32043205
check_struct_constructor(fcx, id, expr.span, type_def_id,
32053206
fields.as_slice(), base_expr);
32063207
}
3207-
Some(&ast::DefVariant(enum_id, variant_id, _)) => {
3208+
Some(ast::DefVariant(enum_id, variant_id, _)) => {
32083209
check_struct_enum_variant(fcx, id, expr.span, enum_id,
32093210
variant_id, fields.as_slice());
32103211
}

0 commit comments

Comments
 (0)