Skip to content

Commit 82bce19

Browse files
committed
---
yaml --- r: 151191 b: refs/heads/try2 c: cbf1131 h: refs/heads/master i: 151189: b621863 151187: 43254e8 151183: 13d5b80 v: v3
1 parent fae4e0d commit 82bce19

File tree

107 files changed

+1282
-907
lines changed

Some content is hidden

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

107 files changed

+1282
-907
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: 2bf25a7fff031736cbefc849f826b4c0c5c695c1
8+
refs/heads/try2: cbf113182ce58ee8b5a253679c7b518abbb1f5e2
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/mk/tests.mk

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,16 @@ TESTDEP_$(1)_$(2)_$(3)_$(4) = $$(SREQ$(1)_T_$(2)_H_$(3)) \
349349
$$(foreach crate,$$(TARGET_CRATES),\
350350
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(crate)) \
351351
$$(CRATE_FULLDEPS_$(1)_T_$(2)_H_$(3)_$(4))
352+
353+
# The regex crate depends on the regex_macros crate during testing, but it
354+
# notably depend on the *host* regex_macros crate, not the target version.
355+
# Additionally, this is not a dependency in stage1, only in stage2.
356+
ifeq ($(4),regex)
357+
ifneq ($(1),1)
358+
TESTDEP_$(1)_$(2)_$(3)_$(4) += $$(TLIB$(1)_T_$(3)_H_$(3))/stamp.regex_macros
359+
endif
360+
endif
361+
352362
else
353363
TESTDEP_$(1)_$(2)_$(3)_$(4) = $$(RSINPUTS_$(4))
354364
endif

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

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

branches/try2/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/try2/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/try2/src/librustc/back/link.rs

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,12 @@ pub mod write {
152152
(sess.targ_cfg.os == abi::OsMacos &&
153153
sess.targ_cfg.arch == abi::X86_64);
154154

155+
// OSX has -dead_strip, which doesn't rely on ffunction_sections
156+
// FIXME(#13846) this should be enabled for windows
157+
let ffunction_sections = sess.targ_cfg.os != abi::OsMacos &&
158+
sess.targ_cfg.os != abi::OsWin32;
159+
let fdata_sections = ffunction_sections;
160+
155161
let reloc_model = match sess.opts.cg.relocation_model.as_slice() {
156162
"pic" => lib::llvm::RelocPIC,
157163
"static" => lib::llvm::RelocStatic,
@@ -173,9 +179,11 @@ pub mod write {
173179
lib::llvm::CodeModelDefault,
174180
reloc_model,
175181
opt_level,
176-
true,
182+
true /* EnableSegstk */,
177183
use_softfp,
178-
no_fp_elim
184+
no_fp_elim,
185+
ffunction_sections,
186+
fdata_sections,
179187
)
180188
})
181189
})
@@ -1136,20 +1144,38 @@ fn link_args(sess: &Session,
11361144
args.push("-nodefaultlibs".to_owned());
11371145
}
11381146

1147+
// If we're building a dylib, we don't use --gc-sections because LLVM has
1148+
// already done the best it can do, and we also don't want to eliminate the
1149+
// metadata. If we're building an executable, however, --gc-sections drops
1150+
// the size of hello world from 1.8MB to 597K, a 67% reduction.
1151+
if !dylib && sess.targ_cfg.os != abi::OsMacos {
1152+
args.push("-Wl,--gc-sections".to_owned());
1153+
}
1154+
11391155
if sess.targ_cfg.os == abi::OsLinux {
11401156
// GNU-style linkers will use this to omit linking to libraries which
11411157
// don't actually fulfill any relocations, but only for libraries which
11421158
// follow this flag. Thus, use it before specifying libraries to link to.
11431159
args.push("-Wl,--as-needed".to_owned());
11441160

1145-
// GNU-style linkers support optimization with -O. --gc-sections
1146-
// removes metadata and potentially other useful things, so don't
1147-
// include it. GNU ld doesn't need a numeric argument, but other linkers
1148-
// do.
1161+
// GNU-style linkers support optimization with -O. GNU ld doesn't need a
1162+
// numeric argument, but other linkers do.
11491163
if sess.opts.optimize == session::Default ||
11501164
sess.opts.optimize == session::Aggressive {
11511165
args.push("-Wl,-O1".to_owned());
11521166
}
1167+
} else if sess.targ_cfg.os == abi::OsMacos {
1168+
// The dead_strip option to the linker specifies that functions and data
1169+
// unreachable by the entry point will be removed. This is quite useful
1170+
// with Rust's compilation model of compiling libraries at a time into
1171+
// one object file. For example, this brings hello world from 1.7MB to
1172+
// 458K.
1173+
//
1174+
// Note that this is done for both executables and dynamic libraries. We
1175+
// won't get much benefit from dylibs because LLVM will have already
1176+
// stripped away as much as it could. This has not been seen to impact
1177+
// link times negatively.
1178+
args.push("-Wl,-dead_strip".to_owned());
11531179
}
11541180

11551181
if sess.targ_cfg.os == abi::OsWin32 {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ fn fold_mod(cx: &mut Context, m: &ast::Mod) -> ast::Mod {
7070
filter_view_item(cx, a).map(|x| cx.fold_view_item(x))
7171
}).collect();
7272
ast::Mod {
73+
inner: m.inner,
7374
view_items: filtered_view_items,
7475
items: flattened_items
7576
}

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

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ impl<'a> fold::Folder for TestHarnessGenerator<'a> {
143143
}
144144

145145
let mod_nomain = ast::Mod {
146+
inner: m.inner,
146147
view_items: m.view_items.clone(),
147148
items: m.items.iter().map(|i| nomain(&self.cx, *i)).collect(),
148149
};
@@ -299,9 +300,9 @@ fn mk_std(cx: &TestCtxt) -> ast::ViewItem {
299300
let id_test = token::str_to_ident("test");
300301
let (vi, vis) = if cx.is_test_crate {
301302
(ast::ViewItemUse(
302-
vec!(@nospan(ast::ViewPathSimple(id_test,
303-
path_node(vec!(id_test)),
304-
ast::DUMMY_NODE_ID)))),
303+
@nospan(ast::ViewPathSimple(id_test,
304+
path_node(vec!(id_test)),
305+
ast::DUMMY_NODE_ID))),
305306
ast::Public)
306307
} else {
307308
(ast::ViewItemExternCrate(id_test,
@@ -335,6 +336,7 @@ fn mk_test_module(cx: &TestCtxt) -> @ast::Item {
335336
)).unwrap();
336337

337338
let testmod = ast::Mod {
339+
inner: DUMMY_SP,
338340
view_items: view_items,
339341
items: vec!(mainfn, tests),
340342
};

branches/try2/src/librustc/lib/llvm.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1748,7 +1748,9 @@ pub mod llvm {
17481748
Level: CodeGenOptLevel,
17491749
EnableSegstk: bool,
17501750
UseSoftFP: bool,
1751-
NoFramePointerElim: bool) -> TargetMachineRef;
1751+
NoFramePointerElim: bool,
1752+
FunctionSections: bool,
1753+
DataSections: bool) -> TargetMachineRef;
17521754
pub fn LLVMRustDisposeTargetMachine(T: TargetMachineRef);
17531755
pub fn LLVMRustAddAnalysisPasses(T: TargetMachineRef,
17541756
PM: PassManagerRef,

branches/try2/src/librustc/metadata/tydecode.rs

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -138,23 +138,6 @@ pub fn parse_substs_data(data: &[u8], crate_num: ast::CrateNum, pos: uint, tcx:
138138
parse_substs(&mut st, conv)
139139
}
140140

141-
fn parse_vstore(st: &mut PState, conv: conv_did) -> ty::Vstore {
142-
assert_eq!(next(st), '/');
143-
144-
let c = peek(st);
145-
if '0' <= c && c <= '9' {
146-
let n = parse_uint(st);
147-
assert_eq!(next(st), '|');
148-
return ty::VstoreFixed(n);
149-
}
150-
151-
match next(st) {
152-
'~' => ty::VstoreUniq,
153-
'&' => ty::VstoreSlice(parse_region(st, conv)),
154-
c => st.tcx.sess.bug(format!("parse_vstore(): bad input '{}'", c))
155-
}
156-
}
157-
158141
fn parse_size(st: &mut PState) -> Option<uint> {
159142
assert_eq!(next(st), '/');
160143

@@ -361,8 +344,7 @@ fn parse_ty(st: &mut PState, conv: conv_did) -> ty::t {
361344
return ty::mk_vec(st.tcx, mt, sz);
362345
}
363346
'v' => {
364-
let v = parse_vstore(st, |x,y| conv(x,y));
365-
return ty::mk_str(st.tcx, v);
347+
return ty::mk_str(st.tcx);
366348
}
367349
'T' => {
368350
assert_eq!(next(st), '[');

branches/try2/src/librustc/metadata/tyencode.rs

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -177,21 +177,6 @@ fn enc_bound_region(w: &mut MemWriter, cx: &ctxt, br: ty::BoundRegion) {
177177
}
178178
}
179179

180-
pub fn enc_vstore(w: &mut MemWriter, cx: &ctxt,
181-
v: ty::Vstore,
182-
enc_mut: |&mut MemWriter|) {
183-
mywrite!(w, "/");
184-
match v {
185-
ty::VstoreFixed(u) => mywrite!(w, "{}|", u),
186-
ty::VstoreUniq => mywrite!(w, "~"),
187-
ty::VstoreSlice(r) => {
188-
mywrite!(w, "&");
189-
enc_region(w, cx, r);
190-
enc_mut(w);
191-
}
192-
}
193-
}
194-
195180
pub fn enc_trait_ref(w: &mut MemWriter, cx: &ctxt, s: &ty::TraitRef) {
196181
mywrite!(w, "{}|", (cx.ds)(s.def_id));
197182
enc_substs(w, cx, &s.substs);
@@ -275,9 +260,8 @@ fn enc_sty(w: &mut MemWriter, cx: &ctxt, st: &ty::sty) {
275260
None => mywrite!(w, "|"),
276261
}
277262
}
278-
ty::ty_str(v) => {
263+
ty::ty_str => {
279264
mywrite!(w, "v");
280-
enc_vstore(w, cx, v, |_| {});
281265
}
282266
ty::ty_closure(ref f) => {
283267
mywrite!(w, "f");

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,7 @@ fn missing_ctor(cx: &MatchCheckCtxt,
405405
ty::ty_struct(..) => check_matrix_for_wild(cx, m),
406406
ty::ty_uniq(ty) | ty::ty_rptr(_, ty::mt{ty: ty, ..}) => match ty::get(ty).sty {
407407
ty::ty_vec(_, None) => ctor_for_slice(m),
408+
ty::ty_str => Some(single),
408409
_ => check_matrix_for_wild(cx, m),
409410
},
410411
ty::ty_enum(eid, _) => {

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,14 @@ impl<'a> EffectCheckVisitor<'a> {
6868
debug!("effect: checking index with base type {}",
6969
ppaux::ty_to_str(self.tcx, base_type));
7070
match ty::get(base_type).sty {
71-
ty::ty_str(..) => {
71+
ty::ty_uniq(ty) | ty::ty_rptr(_, ty::mt{ty, ..}) => match ty::get(ty).sty {
72+
ty::ty_str => {
73+
self.tcx.sess.span_err(e.span,
74+
"modification of string types is not allowed");
75+
}
76+
_ => {}
77+
},
78+
ty::ty_str => {
7279
self.tcx.sess.span_err(e.span,
7380
"modification of string types is not allowed");
7481
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,7 @@ fn check_heap_type(cx: &Context, span: Span, ty: ty::t) {
911911
ty::ty_box(_) => {
912912
n_box += 1;
913913
}
914-
ty::ty_uniq(_) | ty::ty_str(ty::VstoreUniq) |
914+
ty::ty_uniq(_) |
915915
ty::ty_trait(~ty::TyTrait { store: ty::UniqTraitStore, .. }) |
916916
ty::ty_closure(~ty::ClosureTy { store: ty::UniqTraitStore, .. }) => {
917917
n_uniq += 1;

0 commit comments

Comments
 (0)