Skip to content

Commit 4acf2c1

Browse files
committed
---
yaml --- r: 11411 b: refs/heads/master c: ad03761 h: refs/heads/master i: 11409: 30fb56b 11407: 8af6284 v: v3
1 parent c3ce433 commit 4acf2c1

File tree

17 files changed

+19
-88
lines changed

17 files changed

+19
-88
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: e57b6775c3a2d9dbe7fae69c189b8ae9032315cb
2+
refs/heads/master: ad03761a97eb0f651e3ce4f54cbf87dbf4d6f80f
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf

trunk/src/comp/back/rpath.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ fn get_sysroot_absolute_rt_lib(sess: session::session) -> fs::path {
4040
+ filesearch::relative_target_lib_path(
4141
sess.opts.target_triple)
4242
+ [os::dylib_filename("rustrt")];
43-
check vec::is_not_empty(path);
4443
fs::connect_many(path)
4544
}
4645

@@ -174,7 +173,6 @@ fn get_install_prefix_rpath(cwd: fs::path, target_triple: str) -> str {
174173

175174
let path = [install_prefix]
176175
+ filesearch::relative_target_lib_path(target_triple);
177-
check vec::is_not_empty(path);
178176
get_absolute(cwd, fs::connect_many(path))
179177
}
180178

trunk/src/comp/middle/last_use.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,6 @@ fn visit_block(tp: block_type, cx: ctx, visit: fn()) {
209209
cx.current = start_current;
210210
visit();
211211
let cx_blocks = cx.blocks;
212-
check is_not_empty(cx_blocks);
213212
cx.blocks = tail(cx_blocks);
214213
let branches = if tp == func { local.exits + [cx.current] }
215214
else { local.exits };

trunk/src/comp/middle/resolve.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,6 @@ fn map_crate(e: @env, c: @ast::crate) {
289289
alt follow_import(*e, sc, *path, vp.span) {
290290
some(imp) {
291291
let glob = {def: imp, path: vp};
292-
check list::is_not_empty(sc);
293292
alt list::head(sc) {
294293
scope_item(i) {
295294
e.mod_map.get(i.id).glob_imports += [glob];
@@ -585,7 +584,6 @@ fn visit_block_with_scope(b: ast::blk, sc: scopes, v: vt<scopes>) {
585584
}
586585

587586
fn visit_decl_with_scope(d: @decl, sc: scopes, v: vt<scopes>) {
588-
check list::is_not_empty(sc);
589587
let loc_pos = alt list::head(sc) {
590588
scope_block(_, _, pos) { pos }
591589
_ { @mutable 0u }

trunk/src/comp/middle/trans/alt.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,6 @@ fn extract_variant_args(bcx: block, pat_id: ast::node_id,
278278
let vdefs_tg = vdefs.enm;
279279
let vdefs_var = vdefs.var;
280280
while i < size {
281-
check (valid_variant_index(i, bcx, vdefs_tg, vdefs_var));
282281
let r =
283282
// invariant needed:
284283
// how do we know it even makes sense to pass in ty_param_substs

trunk/src/comp/middle/trans/base.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -355,9 +355,10 @@ fn GEP_tup_like(bcx: block, t: ty::t, base: ValueRef, ixs: [int])
355355
// is meaningless, as it will be cast away.
356356
fn GEP_enum(cx: block, llblobptr: ValueRef, enum_id: ast::def_id,
357357
variant_id: ast::def_id, ty_substs: [ty::t],
358-
ix: uint) : valid_variant_index(ix, cx, enum_id, variant_id) ->
359-
result {
358+
ix: uint) -> result {
360359
let variant = ty::enum_variant_with_id(cx.tcx(), enum_id, variant_id);
360+
assert ix < variant.args.len();
361+
361362
// Synthesize a tuple type so that GEP_tup_like() can work its magic.
362363
// Separately, store the type of the element we're interested in.
363364

@@ -1119,7 +1120,6 @@ fn iter_structural_ty(cx: block, av: ValueRef, t: ty::t,
11191120
let j = 0u;
11201121
let v_id = variant.id;
11211122
for a: ty::arg in args {
1122-
check (valid_variant_index(j, cx, tid, v_id));
11231123
let rslt = GEP_enum(cx, a_tup, tid, v_id, tps, j);
11241124
let llfldp_a = rslt.val;
11251125
cx = rslt.bcx;
@@ -4031,7 +4031,6 @@ fn trans_enum_variant(ccx: crate_ctxt, enum_id: ast::node_id,
40314031
let t_id = local_def(enum_id);
40324032
let v_id = local_def(variant.node.id);
40334033
for va: ast::variant_arg in variant.node.args {
4034-
check (valid_variant_index(i, bcx, t_id, v_id));
40354034
let rslt = GEP_enum(bcx, llblobptr, t_id, v_id, ty_param_substs, i);
40364035
bcx = rslt.bcx;
40374036
let lldestptr = rslt.val;

trunk/src/comp/middle/trans/build.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,6 @@ fn add_span_comment(bcx: block, sp: span, text: str) {
529529
fn add_comment(bcx: block, text: str) {
530530
let ccx = bcx.ccx();
531531
if (!ccx.sess.opts.no_asm_comments) {
532-
check str::is_not_empty("$");
533532
let sanitized = str::replace(text, "$", "");
534533
let comment_text = "; " + sanitized;
535534
let asm = str::as_buf(comment_text, {|c|

trunk/src/comp/middle/trans/common.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -835,20 +835,6 @@ fn C_shape(ccx: crate_ctxt, bytes: [u8]) -> ValueRef {
835835
ret llvm::LLVMConstPointerCast(llglobal, T_ptr(T_i8()));
836836
}
837837

838-
839-
pure fn valid_variant_index(ix: uint, cx: block, enum_id: ast::def_id,
840-
variant_id: ast::def_id) -> bool {
841-
842-
// Handwaving: it's ok to pretend this code is referentially
843-
// transparent, because the relevant parts of the type context don't
844-
// change. (We're not adding new variants during trans.)
845-
unchecked{
846-
let variant =
847-
ty::enum_variant_with_id(cx.tcx(), enum_id, variant_id);
848-
ix < variant.args.len()
849-
}
850-
}
851-
852838
pure fn type_has_static_size(cx: crate_ctxt, t: ty::t) -> bool {
853839
!ty::type_has_dynamic_size(cx.tcx, t)
854840
}

trunk/src/comp/syntax/parse/parser.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,6 @@ fn parse_bottom_expr(p: parser) -> pexpr {
888888
/* Should be a predicate (pure boolean function) applied to
889889
arguments that are all either slot variables or literals.
890890
but the typechecker enforces that. */
891-
892891
let e = parse_expr(p);
893892
hi = e.span.hi;
894893
ex = ast::expr_check(ast::checked_expr, e);

trunk/src/comp/util/filesearch.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ fn relative_target_lib_path(target_triple: str) -> [fs::path] {
8989
fn make_target_lib_path(sysroot: fs::path,
9090
target_triple: str) -> fs::path {
9191
let path = [sysroot] + relative_target_lib_path(target_triple);
92-
check vec::is_not_empty(path);
9392
let path = fs::connect_many(path);
9493
ret path;
9594
}
@@ -112,7 +111,6 @@ fn get_sysroot(maybe_sysroot: option<fs::path>) -> fs::path {
112111

113112
fn get_cargo_sysroot() -> result::t<fs::path, str> {
114113
let path = [get_default_sysroot(), libdir(), "cargo"];
115-
check vec::is_not_empty(path);
116114
result::ok(fs::connect_many(path))
117115
}
118116

trunk/src/libcore/str.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,8 @@ Returns:
659659
660660
The original string with all occurances of `from` replaced with `to`
661661
*/
662-
fn replace(s: str, from: str, to: str) : is_not_empty(from) -> str unsafe {
662+
fn replace(s: str, from: str, to: str) -> str unsafe {
663+
assert is_not_empty(from);
663664
if len_bytes(s) == 0u {
664665
ret "";
665666
} else if starts_with(s, from) {
@@ -1922,12 +1923,10 @@ mod tests {
19221923
#[test]
19231924
fn test_replace() {
19241925
let a = "a";
1925-
check (is_not_empty(a));
19261926
assert (replace("", a, "b") == "");
19271927
assert (replace("a", a, "b") == "b");
19281928
assert (replace("ab", a, "b") == "bb");
19291929
let test = "test";
1930-
check (is_not_empty(test));
19311930
assert (replace(" test test ", test, "toast") == " toast toast ");
19321931
assert (replace(" test test ", test, "") == " ");
19331932
}
@@ -1939,7 +1938,6 @@ mod tests {
19391938

19401939
let a = "ประเ";
19411940
let A = "دولة الكويتทศไทย中华";
1942-
check is_not_empty(a);
19431941
assert (replace(data, a, repl) == A);
19441942
}
19451943

@@ -1950,7 +1948,6 @@ mod tests {
19501948

19511949
let b = "ะเ";
19521950
let B = "ปรدولة الكويتทศไทย中华";
1953-
check is_not_empty(b);
19541951
assert (replace(data, b, repl) == B);
19551952
}
19561953

@@ -1961,7 +1958,6 @@ mod tests {
19611958

19621959
let c = "中华";
19631960
let C = "ประเทศไทยدولة الكويت";
1964-
check is_not_empty(c);
19651961
assert (replace(data, c, repl) == C);
19661962
}
19671963

@@ -1971,7 +1967,6 @@ mod tests {
19711967
let repl = "دولة الكويت";
19721968

19731969
let d = "ไท华";
1974-
check is_not_empty(d);
19751970
assert (replace(data, d, repl) == data);
19761971
}
19771972

trunk/src/libcore/vec.rs

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ Returns the first element of a vector
180180
Predicates:
181181
<is_not_empty> (v)
182182
*/
183-
pure fn head<T: copy>(v: [const T]) : is_not_empty(v) -> T { ret v[0]; }
183+
pure fn head<T: copy>(v: [const T]) -> T { v[0] }
184184

185185
/*
186186
Function: tail
@@ -240,9 +240,7 @@ Returns the last element of a non-empty vector `v`
240240
Predicates:
241241
<is_not_empty> (v)
242242
*/
243-
pure fn last_total<T: copy>(v: [const T]) : is_not_empty(v) -> T {
244-
ret v[len(v) - 1u];
245-
}
243+
pure fn last_total<T: copy>(v: [const T]) -> T { v[len(v) - 1u] }
246244

247245
/*
248246
Function: slice
@@ -886,10 +884,10 @@ Preconditions:
886884
887885
<same_length> (v, u)
888886
*/
889-
fn zip<T: copy, U: copy>(v: [T], u: [U]) : same_length(v, u) -> [(T, U)] {
887+
fn zip<T: copy, U: copy>(v: [T], u: [U]) -> [(T, U)] {
890888
let zipped = [];
891889
let sz = len(v), i = 0u;
892-
assert (sz == len(u));
890+
assert sz == len(u);
893891
while i < sz { zipped += [(v[i], u[i])]; i += 1u; }
894892
ret zipped;
895893
}
@@ -940,7 +938,8 @@ Function: enum_chars
940938
941939
Returns a vector containing a range of chars
942940
*/
943-
fn enum_chars(start: u8, end: u8) : ::u8::le(start, end) -> [char] {
941+
fn enum_chars(start: u8, end: u8) -> [char] {
942+
assert start < end;
944943
let i = start;
945944
let r = [];
946945
while i <= end { r += [i as char]; i += 1u as u8; }
@@ -953,7 +952,8 @@ Function: enum_uints
953952
954953
Returns a vector containing a range of uints
955954
*/
956-
fn enum_uints(start: uint, end: uint) : uint::le(start, end) -> [uint] {
955+
fn enum_uints(start: uint, end: uint) -> [uint] {
956+
assert start < end;
957957
let i = start;
958958
let r = [];
959959
while i <= end { r += [i]; i += 1u; }
@@ -1329,18 +1329,15 @@ mod tests {
13291329
#[test]
13301330
fn test_head() {
13311331
let a = [11, 12];
1332-
check (is_not_empty(a));
13331332
assert (head(a) == 11);
13341333
}
13351334

13361335
#[test]
13371336
fn test_tail() {
13381337
let a = [11];
1339-
check (is_not_empty(a));
13401338
assert (tail(a) == []);
13411339

13421340
a = [11, 12];
1343-
check (is_not_empty(a));
13441341
assert (tail(a) == [12]);
13451342
}
13461343

@@ -1667,7 +1664,6 @@ mod tests {
16671664
let v1 = [1, 2, 3];
16681665
let v2 = [4, 5, 6];
16691666

1670-
check (same_length(v1, v2)); // Silly, but what else can we do?
16711667
let z1 = zip(v1, v2);
16721668

16731669
assert ((1, 4) == z1[0]);

trunk/src/libstd/fs.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,11 @@ Connects a vector of path segments into a single path.
107107
108108
Inserts path separators as needed.
109109
*/
110-
fn connect_many(paths: [path]) : vec::is_not_empty(paths) -> path {
110+
fn connect_many(paths: [path]) -> path {
111111
ret if vec::len(paths) == 1u {
112112
paths[0]
113113
} else {
114114
let rest = vec::slice(paths, 1u, vec::len(paths));
115-
check vec::is_not_empty(rest);
116115
connect(paths[0], connect_many(rest))
117116
}
118117
}

trunk/src/libstd/list.rs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,8 @@ Function: head
140140
141141
Returns the first element of a list
142142
*/
143-
pure fn head<T: copy>(ls: list<T>) : is_not_empty(ls) -> T {
144-
alt ls {
145-
cons(hd, _) { ret hd; }
146-
nil { fail "list empty" }
147-
}
143+
pure fn head<T: copy>(ls: list<T>) -> T {
144+
alt check ls { cons(hd, _) { hd } }
148145
}
149146

150147
/*
@@ -205,15 +202,12 @@ mod tests {
205202
fn test_from_vec() {
206203
let l = from_vec([0, 1, 2]);
207204

208-
check is_not_empty(l);
209205
assert (head(l) == 0);
210206

211207
let tail_l = tail(l);
212-
check is_not_empty(tail_l);
213208
assert (head(tail_l) == 1);
214209

215210
let tail_tail_l = tail(tail_l);
216-
check is_not_empty(tail_tail_l);
217211
assert (head(tail_tail_l) == 2);
218212
}
219213

@@ -227,15 +221,12 @@ mod tests {
227221
fn test_from_vec_mut() {
228222
let l = from_vec([mutable 0, 1, 2]);
229223

230-
check is_not_empty(l);
231224
assert (head(l) == 0);
232225

233226
let tail_l = tail(l);
234-
check is_not_empty(tail_l);
235227
assert (head(tail_l) == 1);
236228

237229
let tail_tail_l = tail(tail_l);
238-
check is_not_empty(tail_tail_l);
239230
assert (head(tail_tail_l) == 2);
240231
}
241232

trunk/src/libstd/sort.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,6 @@ mod test_qsort {
252252

253253
let immut_names = vec::from_mut(names);
254254

255-
// Silly, but what else can we do?
256-
check (vec::same_length(expected, immut_names));
257255
let pairs = vec::zip(expected, immut_names);
258256
for (a, b) in pairs { #debug("%d %d", a, b); assert (a == b); }
259257
}

trunk/src/libstd/test.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ type test_desc = {
4747
// The default console test runner. It accepts the command line
4848
// arguments and a vector of test_descs (generated at compile time).
4949
fn test_main(args: [str], tests: [test_desc]) {
50-
check (vec::is_not_empty(args));
5150
let opts =
5251
alt parse_opts(args) {
5352
either::left(o) { o }
@@ -61,8 +60,7 @@ type test_opts = {filter: option<str>, run_ignored: bool};
6160
type opt_res = either::t<test_opts, str>;
6261

6362
// Parses command line arguments into test options
64-
fn parse_opts(args: [str]) : vec::is_not_empty(args) -> opt_res {
65-
63+
fn parse_opts(args: [str]) -> opt_res {
6664
let args_ = vec::tail(args);
6765
let opts = [getopts::optflag("ignored")];
6866
let match =
@@ -407,7 +405,6 @@ mod tests {
407405
#[test]
408406
fn first_free_arg_should_be_a_filter() {
409407
let args = ["progname", "filter"];
410-
check (vec::is_not_empty(args));
411408
let opts = alt parse_opts(args) { either::left(o) { o }
412409
_ { fail "Malformed arg in first_free_arg_should_be_a_filter"; } };
413410
assert (str::eq("filter", option::get(opts.filter)));
@@ -416,7 +413,6 @@ mod tests {
416413
#[test]
417414
fn parse_ignored_flag() {
418415
let args = ["progname", "filter", "--ignored"];
419-
check (vec::is_not_empty(args));
420416
let opts = alt parse_opts(args) { either::left(o) { o }
421417
_ { fail "Malformed arg in parse_ignored_flag"; } };
422418
assert (opts.run_ignored);
@@ -469,12 +465,10 @@ mod tests {
469465
"test::ignored_tests_result_in_ignored", "test::parse_ignored_flag",
470466
"test::sort_tests"];
471467

472-
check (vec::same_length(expected, filtered));
473468
let pairs = vec::zip(expected, filtered);
474469

475-
476470
for (a, b) in pairs { assert (a == b.name); }
477-
}
471+
}
478472
}
479473

480474

0 commit comments

Comments
 (0)