Skip to content

Commit 2837fbd

Browse files
committed
---
yaml --- r: 138750 b: refs/heads/try2 c: f1a8b58 h: refs/heads/master v: v3
1 parent e82f0fb commit 2837fbd

File tree

17 files changed

+83
-120
lines changed

17 files changed

+83
-120
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: 876b6ba792f83f1b50d1356e7305f334b5ba2f05
8+
refs/heads/try2: f1a8b58811da99da00a41c1f6a68f1c83e64c4c2
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,14 +178,12 @@ fn is_test_fn(i: @ast::item) -> bool {
178178

179179
fn has_test_signature(i: @ast::item) -> bool {
180180
match &i.node {
181-
&ast::item_fn(ref decl, _, ref generics, _) => {
181+
&ast::item_fn(ref decl, _, ref tps, _) => {
182182
let no_output = match decl.output.node {
183183
ast::ty_nil => true,
184184
_ => false
185185
};
186-
decl.inputs.is_empty()
187-
&& no_output
188-
&& !generics.is_parameterized()
186+
decl.inputs.is_empty() && no_output && tps.is_empty()
189187
}
190188
_ => false
191189
}

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

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -228,16 +228,14 @@ fn encode_type(ecx: @EncodeContext, ebml_w: writer::Encoder, typ: ty::t) {
228228

229229
fn encode_symbol(ecx: @EncodeContext, ebml_w: writer::Encoder, id: node_id) {
230230
ebml_w.start_tag(tag_items_data_item_symbol);
231-
match ecx.item_symbols.find(&id) {
232-
Some(ref x) => {
233-
debug!("encode_symbol(id=%?, str=%s)", id, *x);
234-
ebml_w.writer.write(str::to_bytes(*x));
235-
}
236-
None => {
237-
ecx.diag.handler().bug(
238-
fmt!("encode_symbol: id not found %d", id));
239-
}
240-
}
231+
let sym = match ecx.item_symbols.find(&id) {
232+
Some(ref x) => (/*bad*/copy *x),
233+
None => {
234+
ecx.diag.handler().bug(
235+
fmt!("encode_symbol: id not found %d", id));
236+
}
237+
};
238+
ebml_w.writer.write(str::to_bytes(sym));
241239
ebml_w.end_tag();
242240
}
243241

@@ -266,8 +264,6 @@ fn encode_enum_variant_info(ecx: @EncodeContext, ebml_w: writer::Encoder,
266264
path: &[ast_map::path_elt],
267265
index: @mut ~[entry<int>],
268266
generics: &ast::Generics) {
269-
debug!("encode_enum_variant_info(id=%?)", id);
270-
271267
let mut disr_val = 0;
272268
let mut i = 0;
273269
let vi = ty::enum_variants(ecx.tcx,

branches/try2/src/librustc/middle/trans/base.rs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ pub fn get_extern_const(externs: ExternMap, llmod: ModuleRef,
197197
}
198198

199199
pub fn trans_foreign_call(cx: block, externs: ExternMap,
200-
llmod: ModuleRef, name: @str, args: ~[ValueRef]) ->
200+
llmod: ModuleRef, name: @str, args: &[ValueRef]) ->
201201
ValueRef {
202202
let _icx = cx.insn_ctxt("trans_foreign_call");
203203
let n = args.len() as int;
@@ -242,7 +242,7 @@ pub fn bump_ptr(bcx: block, t: ty::t, base: ValueRef, sz: ValueRef) ->
242242
// @llblobptr is the data part of a enum value; its actual type
243243
// is meaningless, as it will be cast away.
244244
pub fn GEP_enum(bcx: block, llblobptr: ValueRef, enum_id: ast::def_id,
245-
variant_id: ast::def_id, ty_substs: ~[ty::t],
245+
variant_id: ast::def_id, ty_substs: &[ty::t],
246246
ix: uint) -> ValueRef {
247247
let _icx = bcx.insn_ctxt("GEP_enum");
248248
let ccx = bcx.ccx();
@@ -449,7 +449,7 @@ pub fn set_inline_hint(f: ValueRef) {
449449
}
450450
}
451451

452-
pub fn set_inline_hint_if_appr(attrs: ~[ast::attribute],
452+
pub fn set_inline_hint_if_appr(attrs: &[ast::attribute],
453453
llfn: ValueRef) {
454454
match attr::find_inline_attr(attrs) {
455455
attr::ia_hint => set_inline_hint(llfn),
@@ -489,7 +489,7 @@ pub fn note_unique_llvm_symbol(ccx: @CrateContext, +sym: ~str) {
489489
490490
491491
pub fn get_res_dtor(ccx: @CrateContext, did: ast::def_id,
492-
parent_id: ast::def_id, substs: ~[ty::t])
492+
parent_id: ast::def_id, substs: &[ty::t])
493493
-> ValueRef {
494494
let _icx = ccx.insn_ctxt("trans_res_dtor");
495495
if !substs.is_empty() {
@@ -516,7 +516,7 @@ pub fn get_res_dtor(ccx: @CrateContext, did: ast::def_id,
516516
}
517517

518518
// Structural comparison: a rather involved form of glue.
519-
pub fn maybe_name_value(cx: @CrateContext, v: ValueRef, s: ~str) {
519+
pub fn maybe_name_value(cx: @CrateContext, v: ValueRef, s: &str) {
520520
if cx.sess.opts.save_temps {
521521
let _: () = str::as_c_str(s, |buf| {
522522
unsafe {
@@ -641,7 +641,7 @@ pub fn iter_structural_ty(cx: block, av: ValueRef, t: ty::t,
641641

642642
fn iter_variant(cx: block, a_tup: ValueRef,
643643
variant: ty::VariantInfo,
644-
tps: ~[ty::t], tid: ast::def_id,
644+
tps: &[ty::t], tid: ast::def_id,
645645
f: val_and_ty_fn) -> block {
646646
let _icx = cx.insn_ctxt("iter_variant");
647647
if variant.args.len() == 0u { return cx; }
@@ -916,7 +916,7 @@ pub fn have_cached_lpad(bcx: block) -> bool {
916916
return res;
917917
}
918918

919-
pub fn in_lpad_scope_cx(bcx: block, f: fn(&mut scope_info)) {
919+
pub fn in_lpad_scope_cx(bcx: block, f: fn(+si: &mut scope_info)) {
920920
let mut bcx = bcx;
921921
loop {
922922
{
@@ -1652,7 +1652,7 @@ pub fn new_fn_ctxt(ccx: @CrateContext,
16521652
// field of the fn_ctxt with
16531653
pub fn create_llargs_for_fn_args(cx: fn_ctxt,
16541654
ty_self: self_arg,
1655-
args: ~[ast::arg]) -> ~[ValueRef] {
1655+
args: &[ast::arg]) -> ~[ValueRef] {
16561656
let _icx = cx.insn_ctxt("create_llargs_for_fn_args");
16571657

16581658
match ty_self {
@@ -1865,7 +1865,7 @@ pub fn trans_fn(ccx: @CrateContext,
18651865
debug!("trans_fn(ty_self=%?)", ty_self);
18661866
let _icx = ccx.insn_ctxt("trans_fn");
18671867
ccx.stats.n_fns += 1;
1868-
let the_path_str = path_str(ccx.sess, path);
1868+
let the_path_str = path_str(ccx.sess, &path);
18691869
trans_closure(ccx, path, decl, body, llfndecl, ty_self,
18701870
param_substs, id, impl_id,
18711871
|fcx| {
@@ -1883,7 +1883,7 @@ pub fn trans_fn(ccx: @CrateContext,
18831883
pub fn trans_enum_variant(ccx: @CrateContext,
18841884
enum_id: ast::node_id,
18851885
variant: ast::variant,
1886-
args: ~[ast::variant_arg],
1886+
args: &[ast::variant_arg],
18871887
disr: int,
18881888
is_degen: bool,
18891889
param_substs: Option<@param_substs>,
@@ -1946,7 +1946,7 @@ pub fn trans_enum_variant(ccx: @CrateContext,
19461946
// NB: In theory this should be merged with the function above. But the AST
19471947
// structures are completely different, so very little code would be shared.
19481948
pub fn trans_tuple_struct(ccx: @CrateContext,
1949-
fields: ~[@ast::struct_field],
1949+
fields: &[@ast::struct_field],
19501950
ctor_id: ast::node_id,
19511951
param_substs: Option<@param_substs>,
19521952
llfndecl: ValueRef) {
@@ -2079,15 +2079,15 @@ pub fn trans_item(ccx: @CrateContext, item: ast::item) {
20792079
_ => fail!(~"trans_item"),
20802080
};
20812081
match /*bad*/copy item.node {
2082-
ast::item_fn(ref decl, purity, ref generics, ref body) => {
2082+
ast::item_fn(ref decl, purity, ref tps, ref body) => {
20832083
if purity == ast::extern_fn {
20842084
let llfndecl = get_item_val(ccx, item.id);
20852085
foreign::trans_foreign_fn(ccx,
20862086
vec::append(
20872087
/*bad*/copy *path,
20882088
~[path_name(item.ident)]),
20892089
decl, body, llfndecl, item.id);
2090-
} else if !generics.is_type_parameterized() {
2090+
} else if tps.is_empty() {
20912091
let llfndecl = get_item_val(ccx, item.id);
20922092
trans_fn(ccx,
20932093
vec::append(/*bad*/copy *path, ~[path_name(item.ident)]),
@@ -2111,8 +2111,8 @@ pub fn trans_item(ccx: @CrateContext, item: ast::item) {
21112111
ast::item_mod(ref m) => {
21122112
trans_mod(ccx, m);
21132113
}
2114-
ast::item_enum(ref enum_definition, ref generics) => {
2115-
if !generics.is_type_parameterized() {
2114+
ast::item_enum(ref enum_definition, ref tps) => {
2115+
if tps.is_empty() {
21162116
let degen = (*enum_definition).variants.len() == 1u;
21172117
let vi = ty::enum_variants(ccx.tcx, local_def(item.id));
21182118
let mut i = 0;
@@ -2128,8 +2128,8 @@ pub fn trans_item(ccx: @CrateContext, item: ast::item) {
21282128
};
21292129
foreign::trans_foreign_mod(ccx, foreign_mod, abi);
21302130
}
2131-
ast::item_struct(struct_def, generics) => {
2132-
if !generics.is_type_parameterized() {
2131+
ast::item_struct(struct_def, tps) => {
2132+
if tps.is_empty() {
21332133
trans_struct_def(ccx, struct_def, path, item.id);
21342134
}
21352135
}
@@ -2847,7 +2847,7 @@ pub fn trap(bcx: block) {
28472847
}
28482848
}
28492849
2850-
pub fn decl_gc_metadata(ccx: @CrateContext, llmod_id: ~str) {
2850+
pub fn decl_gc_metadata(ccx: @CrateContext, llmod_id: &str) {
28512851
if !ccx.sess.opts.gc || !*ccx.uses_gc {
28522852
return;
28532853
}
@@ -3014,7 +3014,7 @@ pub fn trans_crate(sess: session::Session,
30143014
tcx: ty::ctxt,
30153015
output: &Path,
30163016
emap2: resolve::ExportMap2,
3017-
maps: astencode::Maps) -> (ModuleRef, LinkMeta) {
3017+
+maps: astencode::Maps) -> (ModuleRef, LinkMeta) {
30183018
30193019
let symbol_hasher = @hash::default_state();
30203020
let link_meta =

branches/try2/src/librustc/middle/trans/build.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ pub fn Ret(cx: block, V: ValueRef) {
117117
}
118118
}
119119
120-
pub fn AggregateRet(cx: block, RetVals: ~[ValueRef]) {
120+
pub fn AggregateRet(cx: block, RetVals: &[ValueRef]) {
121121
if cx.unreachable { return; }
122122
check_not_terminated(cx);
123123
terminate(cx, "AggregateRet");
@@ -184,7 +184,7 @@ pub fn noname() -> *libc::c_char {
184184
}
185185
}
186186
187-
pub fn Invoke(cx: block, Fn: ValueRef, Args: ~[ValueRef],
187+
pub fn Invoke(cx: block, Fn: ValueRef, Args: &[ValueRef],
188188
Then: BasicBlockRef, Catch: BasicBlockRef) {
189189
if cx.unreachable { return; }
190190
check_not_terminated(cx);
@@ -202,7 +202,7 @@ pub fn Invoke(cx: block, Fn: ValueRef, Args: ~[ValueRef],
202202
}
203203
}
204204
205-
pub fn FastInvoke(cx: block, Fn: ValueRef, Args: ~[ValueRef],
205+
pub fn FastInvoke(cx: block, Fn: ValueRef, Args: &[ValueRef],
206206
Then: BasicBlockRef, Catch: BasicBlockRef) {
207207
if cx.unreachable { return; }
208208
check_not_terminated(cx);
@@ -567,7 +567,7 @@ pub fn Store(cx: block, Val: ValueRef, Ptr: ValueRef) {
567567
}
568568
}
569569
570-
pub fn GEP(cx: block, Pointer: ValueRef, Indices: ~[ValueRef]) -> ValueRef {
570+
pub fn GEP(cx: block, Pointer: ValueRef, Indices: &[ValueRef]) -> ValueRef {
571571
unsafe {
572572
if cx.unreachable { return llvm::LLVMGetUndef(T_ptr(T_nil())); }
573573
count_insn(cx, "gep");
@@ -810,7 +810,7 @@ pub fn EmptyPhi(cx: block, Ty: TypeRef) -> ValueRef {
810810
}
811811
}
812812
813-
pub fn Phi(cx: block, Ty: TypeRef, vals: ~[ValueRef], bbs: ~[BasicBlockRef])
813+
pub fn Phi(cx: block, Ty: TypeRef, vals: &[ValueRef], bbs: &[BasicBlockRef])
814814
-> ValueRef {
815815
unsafe {
816816
if cx.unreachable { return llvm::LLVMGetUndef(Ty); }
@@ -844,11 +844,10 @@ pub fn _UndefReturn(cx: block, Fn: ValueRef) -> ValueRef {
844844
}
845845
}
846846
847-
pub fn add_span_comment(bcx: block, sp: span, text: ~str) {
847+
pub fn add_span_comment(bcx: block, sp: span, text: &str) {
848848
let ccx = bcx.ccx();
849849
if !ccx.sess.no_asm_comments() {
850-
let s = text + ~" (" + ccx.sess.codemap.span_to_str(sp)
851-
+ ~")";
850+
let s = fmt!("%s (%s)", text, ccx.sess.codemap.span_to_str(sp));
852851
log(debug, copy s);
853852
add_comment(bcx, s);
854853
}
@@ -888,7 +887,7 @@ pub fn Call(cx: block, Fn: ValueRef, Args: &[ValueRef]) -> ValueRef {
888887
}
889888
}
890889
891-
pub fn FastCall(cx: block, Fn: ValueRef, Args: ~[ValueRef]) -> ValueRef {
890+
pub fn FastCall(cx: block, Fn: ValueRef, Args: &[ValueRef]) -> ValueRef {
892891
if cx.unreachable { return _UndefReturn(cx, Fn); }
893892
unsafe {
894893
count_insn(cx, "fastcall");
@@ -899,7 +898,7 @@ pub fn FastCall(cx: block, Fn: ValueRef, Args: ~[ValueRef]) -> ValueRef {
899898
}
900899
}
901900
902-
pub fn CallWithConv(cx: block, Fn: ValueRef, Args: ~[ValueRef],
901+
pub fn CallWithConv(cx: block, Fn: ValueRef, Args: &[ValueRef],
903902
Conv: CallConv) -> ValueRef {
904903
if cx.unreachable { return _UndefReturn(cx, Fn); }
905904
unsafe {

branches/try2/src/librustc/middle/trans/callee.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ pub fn trans_fn_ref_with_vtables_to_callee(
187187
bcx: block,
188188
def_id: ast::def_id,
189189
ref_id: ast::node_id,
190-
+type_params: ~[ty::t],
190+
type_params: &[ty::t],
191191
vtables: Option<typeck::vtable_res>)
192192
-> Callee {
193193
Callee {bcx: bcx,
@@ -199,7 +199,7 @@ pub fn trans_fn_ref_with_vtables(
199199
bcx: block, //
200200
def_id: ast::def_id, // def id of fn
201201
ref_id: ast::node_id, // node id of use of fn; may be zero if N/A
202-
+type_params: ~[ty::t], // values for fn's ty params
202+
type_params: &[ty::t], // values for fn's ty params
203203
vtables: Option<typeck::vtable_res>)
204204
-> FnData {
205205
//!
@@ -378,7 +378,7 @@ pub fn trans_lang_call(bcx: block,
378378
pub fn trans_lang_call_with_type_params(bcx: block,
379379
did: ast::def_id,
380380
args: &[ValueRef],
381-
type_params: ~[ty::t],
381+
type_params: &[ty::t],
382382
dest: expr::Dest)
383383
-> block {
384384
let fty;
@@ -394,7 +394,7 @@ pub fn trans_lang_call_with_type_params(bcx: block,
394394
|bcx| {
395395
let callee =
396396
trans_fn_ref_with_vtables_to_callee(bcx, did, 0,
397-
copy type_params,
397+
type_params,
398398
None);
399399

400400
let new_llval;
@@ -636,8 +636,8 @@ pub enum AutorefArg {
636636
pub fn trans_arg_expr(bcx: block,
637637
formal_ty: ty::arg,
638638
arg_expr: @ast::expr,
639-
temp_cleanups: &mut ~[ValueRef],
640-
ret_flag: Option<ValueRef>,
639+
+temp_cleanups: &mut ~[ValueRef],
640+
+ret_flag: Option<ValueRef>,
641641
+autoref_arg: AutorefArg) -> Result {
642642
let _icx = bcx.insn_ctxt("trans_arg_expr");
643643
let ccx = bcx.ccx();

0 commit comments

Comments
 (0)