Skip to content

Commit c18b758

Browse files
committed
---
yaml --- r: 51454 b: refs/heads/incoming c: f581b2f h: refs/heads/master v: v3
1 parent 573b812 commit c18b758

File tree

14 files changed

+35
-116
lines changed

14 files changed

+35
-116
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: 8eb2bab100b42f0ba751552d8eff00eb2134c55a
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/incoming: d7d17dc14e653332848f7f6f994b34eb7fc923ec
9+
refs/heads/incoming: f581b2f9ddb9f5a973ad7719d57ee6ebc157063c
1010
refs/heads/dist-snap: 8b98e5a296d95c5e832db0756828e5bec31c6f50
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

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

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -498,12 +498,7 @@ fn check_item(i: @ast::item, cx: ty::ctxt) {
498498
// not traverse into subitems, since that is handled by the outer
499499
// lint visitor.
500500
fn item_stopping_visitor<E>(v: visit::vt<E>) -> visit::vt<E> {
501-
visit::mk_vt(@visit::Visitor {visit_item: |_i, _e, _v| { },
502-
.. **(ty_stopping_visitor(v))})
503-
}
504-
505-
fn ty_stopping_visitor<E>(v: visit::vt<E>) -> visit::vt<E> {
506-
visit::mk_vt(@visit::Visitor {visit_ty: |_t, _e, _v| { },.. **v})
501+
visit::mk_vt(@visit::Visitor {visit_item: |_i, _e, _v| { },.. **v})
507502
}
508503

509504
fn check_item_while_true(cx: ty::ctxt, it: @ast::item) {

branches/incoming/src/librustc/middle/typeck/astconv.rs

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454

5555
use core::prelude::*;
5656

57-
use middle::const_eval;
5857
use middle::ty::{arg, field, substs};
5958
use middle::ty::{ty_param_substs_and_ty};
6059
use middle::ty;
@@ -413,29 +412,9 @@ pub fn ast_ty_to_ty<AC:AstConv, RS:region_scope + Copy + Durable>(
413412
}
414413
}
415414
}
416-
ast::ty_fixed_length_vec(a_mt, e) => {
417-
match const_eval::eval_const_expr_partial(tcx, e) {
418-
Ok(ref r) => {
419-
match *r {
420-
const_eval::const_int(i) =>
421-
ty::mk_evec(tcx, ast_mt_to_mt(self, rscope, a_mt),
422-
ty::vstore_fixed(i as uint)),
423-
const_eval::const_uint(i) =>
424-
ty::mk_evec(tcx, ast_mt_to_mt(self, rscope, a_mt),
425-
ty::vstore_fixed(i as uint)),
426-
_ => {
427-
tcx.sess.span_fatal(
428-
ast_ty.span, ~"expected constant expr for vector length");
429-
}
430-
}
431-
}
432-
Err(ref r) => {
433-
tcx.sess.span_fatal(
434-
ast_ty.span,
435-
fmt!("expected constant expr for vector length: %s",
436-
*r));
437-
}
438-
}
415+
ast::ty_fixed_length_vec(a_mt, u) => {
416+
ty::mk_evec(tcx, ast_mt_to_mt(self, rscope, a_mt),
417+
ty::vstore_fixed(u))
439418
}
440419
ast::ty_infer => {
441420
// ty_infer should only appear as the type of arguments or return

branches/incoming/src/librustc/middle/typeck/check/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2169,7 +2169,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
21692169
}
21702170
ast::expr_repeat(element, count_expr, mutbl) => {
21712171
let count = ty::eval_repeat_count(tcx, count_expr);
2172-
check_expr_with_hint(fcx, count_expr, ty::mk_uint(tcx));
2172+
fcx.write_ty(count_expr.id, ty::mk_uint(tcx));
21732173
let tt = ast_expr_vstore_to_vstore(fcx, ev, count, vst);
21742174
let t: ty::t = fcx.infcx().next_ty_var();
21752175
bot |= check_expr_has_type(fcx, element, t);
@@ -2537,7 +2537,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
25372537
}
25382538
ast::expr_repeat(element, count_expr, mutbl) => {
25392539
let count = ty::eval_repeat_count(tcx, count_expr);
2540-
check_expr_with_hint(fcx, count_expr, ty::mk_uint(tcx));
2540+
fcx.write_ty(count_expr.id, ty::mk_uint(tcx));
25412541
let t: ty::t = fcx.infcx().next_ty_var();
25422542
bot |= check_expr_has_type(fcx, element, t);
25432543
let t = ty::mk_evec(tcx, ty::mt {ty: t, mutbl: mutbl},

branches/incoming/src/libsyntax/ast.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,7 @@ pub enum vstore {
386386
#[auto_decode]
387387
#[deriving_eq]
388388
pub enum expr_vstore {
389+
// FIXME (#3469): Change uint to @expr (actually only constant exprs)
389390
expr_vstore_fixed(Option<uint>), // [1,2,3,4]
390391
expr_vstore_uniq, // ~[1,2,3,4]
391392
expr_vstore_box, // @[1,2,3,4]
@@ -915,7 +916,7 @@ pub enum ty_ {
915916
ty_box(mt),
916917
ty_uniq(mt),
917918
ty_vec(mt),
918-
ty_fixed_length_vec(mt, @expr),
919+
ty_fixed_length_vec(mt, uint),
919920
ty_ptr(mt),
920921
ty_rptr(Option<@Lifetime>, mt),
921922
ty_closure(@TyClosure),

branches/incoming/src/libsyntax/fold.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -622,10 +622,10 @@ pub fn noop_fold_ty(t: &ty_, fld: @ast_fold) -> ty_ {
622622
}
623623
ty_tup(ref tys) => ty_tup(tys.map(|ty| fld.fold_ty(*ty))),
624624
ty_path(path, id) => ty_path(fld.fold_path(path), fld.new_id(id)),
625-
ty_fixed_length_vec(ref mt, e) => {
625+
ty_fixed_length_vec(ref mt, vs) => {
626626
ty_fixed_length_vec(
627627
fold_mt(mt, fld),
628-
fld.fold_expr(e)
628+
vs
629629
)
630630
}
631631
ty_mac(ref mac) => ty_mac(fold_mac(*mac))

branches/incoming/src/libsyntax/parse/parser.rs

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -642,8 +642,7 @@ pub impl Parser {
642642
self.obsolete(*self.last_span, ObsoleteMutVector);
643643
}
644644

645-
// Parse the `* e` in `[ int * e ]`
646-
// where `e` is a const expression
645+
// Parse the `* 3` in `[ int * 3 ]`
647646
let t = match self.maybe_parse_fixed_vstore_with_star() {
648647
None => ty_vec(mt),
649648
Some(suffix) => ty_fixed_length_vec(mt, suffix)
@@ -815,9 +814,23 @@ pub impl Parser {
815814
})
816815
}
817816

818-
fn maybe_parse_fixed_vstore_with_star(&self) -> Option<@ast::expr> {
817+
fn maybe_parse_fixed_vstore_with_star(&self) -> Option<uint> {
819818
if self.eat(&token::BINOP(token::STAR)) {
820-
Some(self.parse_expr())
819+
match *self.token {
820+
token::LIT_INT_UNSUFFIXED(i) if i >= 0i64 => {
821+
self.bump();
822+
Some(i as uint)
823+
}
824+
_ => {
825+
self.fatal(
826+
fmt!(
827+
"expected integral vector length \
828+
but found `%s`",
829+
token_to_str(self.reader, &copy *self.token)
830+
)
831+
);
832+
}
833+
}
821834
} else {
822835
None
823836
}

branches/incoming/src/libsyntax/print/pprust.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ pub fn print_type_ex(s: @ps, &&ty: @ast::Ty, print_colons: bool) {
425425
}
426426
print_type(s, mt.ty);
427427
word(s.s, ~" * ");
428-
print_expr(s, v);
428+
word(s.s, fmt!("%u", v));
429429
word(s.s, ~"]");
430430
}
431431
ast::ty_mac(_) => {

branches/incoming/src/libsyntax/visit.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,10 +246,7 @@ pub fn visit_ty<E>(t: @Ty, e: E, v: vt<E>) {
246246
(v.visit_ty)(f.decl.output, e, v);
247247
},
248248
ty_path(p, _) => visit_path(p, e, v),
249-
ty_fixed_length_vec(ref mt, ex) => {
250-
(v.visit_ty)(mt.ty, e, v);
251-
(v.visit_expr)(ex, e, v);
252-
},
249+
ty_fixed_length_vec(ref mt, _) => (v.visit_ty)(mt.ty, e, v),
253250
ty_nil | ty_bot | ty_mac(_) | ty_infer => ()
254251
}
255252
}

branches/incoming/src/rustllvm/RustWrapper.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "llvm/ADT/DenseSet.h"
2828
#include "llvm/Assembly/Parser.h"
2929
#include "llvm/Assembly/PrintModulePass.h"
30+
#include "llvm/Support/CommandLine.h"
3031
#include "llvm/Support/FormattedStream.h"
3132
#include "llvm/Support/Timer.h"
3233
#include "llvm/Support/raw_ostream.h"
@@ -428,6 +429,10 @@ LLVMRustWriteOutputFile(LLVMPassManagerRef PMR,
428429

429430
LLVMRustInitializeTargets();
430431

432+
int argc = 2;
433+
const char* argv[] = {"rustc", "-arm-enable-ehabi"};
434+
cl::ParseCommandLineOptions(argc, argv);
435+
431436
TargetOptions Options;
432437
Options.NoFramePointerElim = true;
433438
Options.EnableSegmentedStacks = EnableSegmentedStacks;

branches/incoming/src/test/compile-fail/non-constant-expr-for-fixed-len-vec.rs

Lines changed: 0 additions & 17 deletions
This file was deleted.

branches/incoming/src/test/compile-fail/non-constant-expr-for-vec-repeat.rs

Lines changed: 0 additions & 17 deletions
This file was deleted.

branches/incoming/src/test/run-pass/const-expr-in-fixed-length-vec.rs

Lines changed: 0 additions & 19 deletions
This file was deleted.

branches/incoming/src/test/run-pass/const-expr-in-vec-repeat.rs

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)