Skip to content

Commit 883abea

Browse files
committed
---
yaml --- r: 49425 b: refs/heads/master c: 51da7d4 h: refs/heads/master i: 49423: bf66eb4 v: v3
1 parent 7adb00e commit 883abea

File tree

11 files changed

+65
-50
lines changed

11 files changed

+65
-50
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: a29934a61b0ade13ef799a9aa9e95c0be940e0f5
2+
refs/heads/master: 51da7d4bc7a100f5343bc727fb2fb87b05e35c84
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: f7a2371c176663d59062ec5158f39faecba45768
55
refs/heads/try: 2a8fb58d79e685d5ca07b039badcf2ae3ef077ea

trunk/src/libcore/io.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -986,7 +986,7 @@ pub trait WriterUtil {
986986

987987
impl<T:Writer> WriterUtil for T {
988988
fn write_char(&self, ch: char) {
989-
if (ch as uint) < 128u {
989+
if ch as uint < 128u {
990990
self.write(&[ch as u8]);
991991
} else {
992992
self.write_str(str::from_char(ch));

trunk/src/libcore/num/strconv.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ pub pure fn to_str_bytes_common<T:NumCast+Zero+One+Eq+Ord+NumStrConv+Copy+
165165
Div<T,T>+Neg<T>+Modulo<T,T>+Mul<T,T>>(
166166
num: &T, radix: uint, negative_zero: bool,
167167
sign: SignFormat, digits: SignificantDigits) -> (~[u8], bool) {
168-
if (radix as int) < 2 {
168+
if radix as int < 2 {
169169
fail!(fmt!("to_str_bytes_common: radix %? to low, \
170170
must lie in the range [2, 36]", radix));
171171
} else if radix as int > 36 {
@@ -455,10 +455,10 @@ pub pure fn from_str_bytes_common<T:NumCast+Zero+One+Ord+Copy+Div<T,T>+
455455
_ if special && radix >= DIGIT_I_RADIX // first digit of 'inf'
456456
=> fail!(fmt!("from_str_bytes_common: radix %? incompatible with \
457457
special values 'inf' and 'NaN'", radix)),
458-
_ if (radix as int) < 2
458+
_ if radix as int < 2
459459
=> fail!(fmt!("from_str_bytes_common: radix %? to low, \
460460
must lie in the range [2, 36]", radix)),
461-
_ if (radix as int) > 36
461+
_ if radix as int > 36
462462
=> fail!(fmt!("from_str_bytes_common: radix %? to high, \
463463
must lie in the range [2, 36]", radix)),
464464
_ => ()

trunk/src/libcore/repr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ pub impl ReprVisitor {
242242
let (sz, al) = unsafe { ((*inner).size, (*inner).align) };
243243
self.writer.write_char('[');
244244
let mut first = true;
245-
while (p as uint) < (end as uint) {
245+
while p as uint < end as uint {
246246
if first {
247247
first = false;
248248
} else {

trunk/src/libcore/unstable/extfmt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ pub mod rt {
536536
// displayed
537537
let mut unpadded = match cv.precision {
538538
CountImplied => s.to_owned(),
539-
CountIs(max) => if (max as uint) < str::char_len(s) {
539+
CountIs(max) => if max as uint < str::char_len(s) {
540540
str::substr(s, 0, max as uint)
541541
} else {
542542
s.to_owned()

trunk/src/librustc/back/link.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,11 @@ pub fn link_binary(sess: Session,
849849
do cstore::iter_crate_data(cstore) |crate_num, _| {
850850
let link_args = csearch::get_link_args_for_crate(cstore, crate_num);
851851
do vec::consume(link_args) |_, link_arg| {
852-
cc_args.push(link_arg);
852+
// Linker arguments that don't begin with - are likely file names,
853+
// so they should not be necessary.
854+
if link_arg.starts_with("-") {
855+
cc_args.push(link_arg);
856+
}
853857
}
854858
}
855859

trunk/src/librustc/middle/trans/callee.rs

Lines changed: 26 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -492,12 +492,14 @@ pub fn trans_call_inner(
492492
}
493493
};
494494

495-
let args_res = trans_args(bcx, llenv, args, fn_expr_ty,
496-
dest, ret_flag, autoref_arg);
497-
bcx = args_res.bcx;
498-
let mut llargs = /*bad*/copy args_res.args;
495+
let llretslot = trans_ret_slot(bcx, fn_expr_ty, dest);
496+
497+
let mut llargs = ~[];
498+
llargs.push(llretslot);
499+
llargs.push(llenv);
500+
bcx = trans_args(bcx, args, fn_expr_ty,
501+
ret_flag, autoref_arg, &mut llargs);
499502

500-
let llretslot = args_res.retslot;
501503

502504
// Now that the arguments have finished evaluating, we need to revoke
503505
// the cleanup for the self argument, if it exists
@@ -555,30 +557,12 @@ pub enum CallArgs {
555557
ArgVals(&'self [ValueRef])
556558
}
557559

558-
pub struct Args {
559-
bcx: block,
560-
args: ~[ValueRef],
561-
retslot: ValueRef
562-
}
563-
564-
pub fn trans_args(cx: block,
565-
llenv: ValueRef,
566-
+args: CallArgs,
567-
fn_ty: ty::t,
568-
dest: expr::Dest,
569-
ret_flag: Option<ValueRef>,
570-
+autoref_arg: AutorefArg) -> Args {
571-
let _icx = cx.insn_ctxt("trans_args");
572-
let mut temp_cleanups = ~[];
573-
let arg_tys = ty::ty_fn_args(fn_ty);
574-
let mut llargs: ~[ValueRef] = ~[];
575-
576-
let mut bcx = cx;
577-
560+
pub fn trans_ret_slot(+bcx: block,
561+
+fn_ty: ty::t,
562+
+dest: expr::Dest) -> ValueRef
563+
{
578564
let retty = ty::ty_fn_ret(fn_ty);
579-
580-
// Arg 0: Output pointer.
581-
let llretslot = match dest {
565+
match dest {
582566
expr::SaveIn(dst) => dst,
583567
expr::Ignore => {
584568
if ty::type_is_nil(retty) {
@@ -589,13 +573,21 @@ pub fn trans_args(cx: block,
589573
alloc_ty(bcx, retty)
590574
}
591575
}
592-
};
593-
llargs.push(llretslot);
576+
}
577+
}
594578

595-
// Arg 1: Env (closure-bindings / self value)
596-
llargs.push(llenv);
579+
pub fn trans_args(+cx: block,
580+
+args: CallArgs,
581+
+fn_ty: ty::t,
582+
+ret_flag: Option<ValueRef>,
583+
+autoref_arg: AutorefArg,
584+
+llargs: &mut ~[ValueRef]) -> block
585+
{
586+
let _icx = cx.insn_ctxt("trans_args");
587+
let mut temp_cleanups = ~[];
588+
let arg_tys = ty::ty_fn_args(fn_ty);
597589

598-
// ... then explicit args.
590+
let mut bcx = cx;
599591

600592
// First we figure out the caller's view of the types of the arguments.
601593
// This will be needed if this is a generic call, because the callee has
@@ -624,7 +616,7 @@ pub fn trans_args(cx: block,
624616
revoke_clean(bcx, *c)
625617
}
626618

627-
Args { bcx: bcx, args: llargs, retslot: llretslot }
619+
return bcx;
628620
}
629621

630622
pub enum AutorefArg {

trunk/src/libstd/time.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -819,8 +819,8 @@ priv fn do_strftime(format: &str, tm: &Tm) -> ~str {
819819
'M' => fmt!("%02d", tm.tm_min as int),
820820
'm' => fmt!("%02d", tm.tm_mon as int + 1),
821821
'n' => ~"\n",
822-
'P' => if (tm.tm_hour as int) < 12 { ~"am" } else { ~"pm" },
823-
'p' => if (tm.tm_hour as int) < 12 { ~"AM" } else { ~"PM" },
822+
'P' => if tm.tm_hour as int < 12 { ~"am" } else { ~"pm" },
823+
'p' => if tm.tm_hour as int < 12 { ~"AM" } else { ~"PM" },
824824
'R' => {
825825
fmt!("%s:%s",
826826
parse_type('H', tm),

trunk/src/libsyntax/parse/parser.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -581,9 +581,7 @@ pub impl Parser {
581581
}
582582
}
583583

584-
// Useless second parameter for compatibility with quasiquote macros.
585-
// Bleh!
586-
fn parse_ty(&self, _: bool) -> @Ty {
584+
fn parse_ty(&self, colons_before_params: bool) -> @Ty {
587585
maybe_whole!(self, nt_ty);
588586

589587
let lo = self.span.lo;
@@ -663,7 +661,7 @@ pub impl Parser {
663661
result
664662
} else if *self.token == token::MOD_SEP
665663
|| is_ident_or_path(&*self.token) {
666-
let path = self.parse_path_with_tps(false);
664+
let path = self.parse_path_with_tps(colons_before_params);
667665
ty_path(path, self.get_id())
668666
} else {
669667
self.fatal(~"expected type");

trunk/src/libsyntax/print/pprust.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,10 @@ pub fn print_opt_lifetime(s: @ps, lifetime: Option<@ast::Lifetime>) {
370370
}
371371
372372
pub fn print_type(s: @ps, &&ty: @ast::Ty) {
373+
print_type_ex(s, ty, false);
374+
}
375+
376+
pub fn print_type_ex(s: @ps, &&ty: @ast::Ty, print_colons: bool) {
373377
maybe_print_comment(s, ty.span.lo);
374378
ibox(s, 0u);
375379
match ty.node {
@@ -411,7 +415,7 @@ pub fn print_type(s: @ps, &&ty: @ast::Ty) {
411415
f.purity, f.onceness, &f.decl, None,
412416
None, None);
413417
}
414-
ast::ty_path(path, _) => print_path(s, path, false),
418+
ast::ty_path(path, _) => print_path(s, path, print_colons),
415419
ast::ty_fixed_length_vec(ref mt, v) => {
416420
word(s.s, ~"[");
417421
match mt.mutbl {
@@ -1207,7 +1211,7 @@ pub fn print_expr(s: @ps, &&expr: @ast::expr) {
12071211
print_expr(s, expr);
12081212
space(s.s);
12091213
word_space(s, ~"as");
1210-
print_type(s, ty);
1214+
print_type_ex(s, ty, true);
12111215
}
12121216
ast::expr_if(test, ref blk, elseopt) => {
12131217
print_if(s, test, blk, elseopt, false);

trunk/src/test/run-pass/issue-4120.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
fn main()
12+
{
13+
unsafe {
14+
libc::exit(0);
15+
}
16+
error!("ack");
17+
}

0 commit comments

Comments
 (0)