Skip to content

Commit 19828b7

Browse files
committed
---
yaml --- r: 104956 b: refs/heads/snap-stage3 c: d8590e2 h: refs/heads/master v: v3
1 parent 9dad564 commit 19828b7

File tree

22 files changed

+945
-80
lines changed

22 files changed

+945
-80
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 62f1d68439dcfd509eaca29887afa97f22938373
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: ddc796096be787613a291c38c076cb499dfb5857
4+
refs/heads/snap-stage3: d8590e2c9ce7fd48df03d347f591d6892c6e1599
55
refs/heads/try: db814977d07bd798feb24f6b74c00800ef458a13
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/libnum/bigint.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ impl TotalOrd for BigUint {
117117
if s_len < o_len { return Less; }
118118
if s_len > o_len { return Greater; }
119119

120-
for (&self_i, &other_i) in self.data.rev_iter().zip(other.data.rev_iter()) {
120+
for (&self_i, &other_i) in self.data.iter().rev().zip(other.data.iter().rev()) {
121121
if self_i < other_i { return Less; }
122122
if self_i > other_i { return Greater; }
123123
}
@@ -788,7 +788,7 @@ impl BigUint {
788788

789789
let mut borrow = 0;
790790
let mut shifted_rev = Vec::with_capacity(self.data.len());
791-
for elem in self.data.rev_iter() {
791+
for elem in self.data.iter().rev() {
792792
shifted_rev.push((*elem >> n_bits) | borrow);
793793
borrow = *elem << (BigDigit::bits - n_bits);
794794
}

branches/snap-stage3/src/librustc/driver/driver.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,9 @@ pub fn phase_3_run_analysis_passes(sess: Session,
305305
time(time_passes, "resolution", (), |_|
306306
middle::resolve::resolve_crate(&sess, lang_items, krate));
307307

308+
// Discard MTWT tables that aren't required past resolution.
309+
syntax::ext::mtwt::clear_tables();
310+
308311
let named_region_map = time(time_passes, "lifetime resolution", (),
309312
|_| middle::resolve_lifetime::krate(&sess, krate));
310313

@@ -585,6 +588,10 @@ pub fn compile_input(sess: Session, cfg: ast::CrateConfig, input: &Input,
585588
if stop_after_phase_3(&analysis.ty_cx.sess) { return; }
586589
let (tcx, trans) = phase_4_translate_to_llvm(expanded_crate,
587590
analysis, &outputs);
591+
592+
// Discard interned strings as they are no longer required.
593+
token::get_ident_interner().clear();
594+
588595
(outputs, trans, tcx.sess)
589596
};
590597
phase_5_run_llvm_passes(&sess, &trans, &outputs);

branches/snap-stage3/src/librustc/middle/check_match.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ fn is_useful(cx: &MatchCheckCtxt, m: &matrix, v: &[@Pat]) -> useful {
288288
is_useful_specialized(cx, m, v, vec(n), n, left_ty)
289289
}
290290
ty::ty_unboxed_vec(..) | ty::ty_vec(..) => {
291-
let max_len = m.rev_iter().fold(0, |max_len, r| {
291+
let max_len = m.iter().rev().fold(0, |max_len, r| {
292292
match r.get(0).node {
293293
PatVec(ref before, _, ref after) => {
294294
cmp::max(before.len() + after.len(), max_len)

branches/snap-stage3/src/librustc/middle/liveness.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,7 @@ impl<'a> Liveness<'a> {
879879
fn propagate_through_block(&mut self, blk: &Block, succ: LiveNode)
880880
-> LiveNode {
881881
let succ = self.propagate_through_opt_expr(blk.expr, succ);
882-
blk.stmts.rev_iter().fold(succ, |succ, stmt| {
882+
blk.stmts.iter().rev().fold(succ, |succ, stmt| {
883883
self.propagate_through_stmt(*stmt, succ)
884884
})
885885
}
@@ -980,7 +980,7 @@ impl<'a> Liveness<'a> {
980980
this.ir.tcx.sess.span_bug(expr.span, "no registered caps");
981981
}
982982
};
983-
caps.deref().rev_iter().fold(succ, |succ, cap| {
983+
caps.deref().iter().rev().fold(succ, |succ, cap| {
984984
this.init_from_succ(cap.ln, succ);
985985
let var = this.variable(cap.var_nid, expr.span);
986986
this.acc(cap.ln, var, ACC_READ | ACC_USE);
@@ -1121,7 +1121,7 @@ impl<'a> Liveness<'a> {
11211121

11221122
ExprStruct(_, ref fields, with_expr) => {
11231123
let succ = self.propagate_through_opt_expr(with_expr, succ);
1124-
fields.rev_iter().fold(succ, |succ, field| {
1124+
fields.iter().rev().fold(succ, |succ, field| {
11251125
self.propagate_through_expr(field.expr, succ)
11261126
})
11271127
}
@@ -1173,14 +1173,14 @@ impl<'a> Liveness<'a> {
11731173
}
11741174

11751175
ExprInlineAsm(ref ia) => {
1176-
let succ = ia.outputs.rev_iter().fold(succ, |succ, &(_, expr)| {
1176+
let succ = ia.outputs.iter().rev().fold(succ, |succ, &(_, expr)| {
11771177
// see comment on lvalues in
11781178
// propagate_through_lvalue_components()
11791179
let succ = self.write_lvalue(expr, succ, ACC_WRITE);
11801180
self.propagate_through_lvalue_components(expr, succ)
11811181
});
11821182
// Inputs are executed first. Propagate last because of rev order
1183-
ia.inputs.rev_iter().fold(succ, |succ, &(_, expr)| {
1183+
ia.inputs.iter().rev().fold(succ, |succ, &(_, expr)| {
11841184
self.propagate_through_expr(expr, succ)
11851185
})
11861186
}

branches/snap-stage3/src/librustc/middle/resolve.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5520,7 +5520,8 @@ impl<'a> Resolver<'a> {
55205520
if idents.len() == 0 {
55215521
return ~"???";
55225522
}
5523-
return self.idents_to_str(idents.move_rev_iter()
5523+
return self.idents_to_str(idents.move_iter()
5524+
.rev()
55245525
.collect::<Vec<ast::Ident>>()
55255526
.as_slice());
55265527
}

branches/snap-stage3/src/librustc/middle/trans/cabi.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ pub enum ArgKind {
2525
/// LLVM type or by coercing to another specified type
2626
Direct,
2727
/// Pass the argument indirectly via a hidden pointer
28-
Indirect
28+
Indirect,
29+
/// Ignore the argument (useful for empty struct)
30+
Ignore,
2931
}
3032

3133
/// Information about how a specific C type
@@ -68,13 +70,27 @@ impl ArgType {
6870
}
6971
}
7072

73+
pub fn ignore(ty: Type) -> ArgType {
74+
ArgType {
75+
kind: Ignore,
76+
ty: ty,
77+
cast: None,
78+
pad: None,
79+
attr: None,
80+
}
81+
}
82+
7183
pub fn is_direct(&self) -> bool {
7284
return self.kind == Direct;
7385
}
7486

7587
pub fn is_indirect(&self) -> bool {
7688
return self.kind == Indirect;
7789
}
90+
91+
pub fn is_ignore(&self) -> bool {
92+
return self.kind == Ignore;
93+
}
7894
}
7995

8096
/// Metadata describing how the arguments to a native function

branches/snap-stage3/src/librustc/middle/trans/cabi_x86.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,19 @@ pub fn compute_abi_info(ccx: &CrateContext,
6363
ret_ty = ArgType::direct(rty, None, None, None);
6464
}
6565

66-
for &a in atys.iter() {
67-
arg_tys.push(ArgType::direct(a, None, None, None));
66+
for &t in atys.iter() {
67+
let ty = match t.kind() {
68+
Struct => {
69+
let size = llsize_of_alloc(ccx, t);
70+
if size == 0 {
71+
ArgType::ignore(t)
72+
} else {
73+
ArgType::indirect(t, Some(ByValAttribute))
74+
}
75+
}
76+
_ => ArgType::direct(t, None, None, None),
77+
};
78+
arg_tys.push(ty);
6879
}
6980

7081
return FnType {

branches/snap-stage3/src/librustc/middle/trans/foreign.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,10 @@ pub fn trans_native_call<'a>(
325325
for (i, &llarg_rust) in llargs_rust.iter().enumerate() {
326326
let mut llarg_rust = llarg_rust;
327327

328+
if arg_tys[i].is_ignore() {
329+
continue;
330+
}
331+
328332
// Does Rust pass this argument by pointer?
329333
let rust_indirect = type_of::arg_is_indirect(ccx,
330334
*passed_arg_tys.get(i));
@@ -901,6 +905,9 @@ fn lltype_for_fn_from_foreign_types(ccx: &CrateContext, tys: &ForeignTypes) -> T
901905
};
902906

903907
for &arg_ty in tys.fn_ty.arg_tys.iter() {
908+
if arg_ty.is_ignore() {
909+
continue;
910+
}
904911
// add padding
905912
match arg_ty.pad {
906913
Some(ty) => llargument_tys.push(ty),
@@ -949,6 +956,9 @@ fn add_argument_attributes(tys: &ForeignTypes,
949956
}
950957

951958
for &arg_ty in tys.fn_ty.arg_tys.iter() {
959+
if arg_ty.is_ignore() {
960+
continue;
961+
}
952962
// skip padding
953963
if arg_ty.pad.is_some() { i += 1; }
954964

branches/snap-stage3/src/librustc/middle/typeck/check/vtable.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ fn lookup_vtables(vcx: &VtableContext,
9494
// We do this backwards for reasons discussed above.
9595
assert_eq!(substs.tps.len(), type_param_defs.len());
9696
let mut result: Vec<vtable_param_res> =
97-
substs.tps.rev_iter()
97+
substs.tps.iter()
98+
.rev()
9899
.zip(type_param_defs.rev_iter())
99100
.map(|(ty, def)|
100101
lookup_vtables_for_param(vcx, span, Some(substs),

branches/snap-stage3/src/librustdoc/passes.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ impl<'a> fold::DocFolder for Stripper<'a> {
128128
}
129129
}
130130

131-
clean::ViewItemItem(..) => {
131+
clean::ViewItemItem(..) |
132+
clean::ModuleItem(..) => {
132133
if i.visibility != Some(ast::Public) {
133134
return None
134135
}
@@ -140,9 +141,6 @@ impl<'a> fold::DocFolder for Stripper<'a> {
140141
}
141142
}
142143

143-
// handled below
144-
clean::ModuleItem(..) => {}
145-
146144
// trait impls for private items should be stripped
147145
clean::ImplItem(clean::Impl{ for_: clean::ResolvedPath{ id: ref for_id, .. }, .. }) => {
148146
if !self.exported_items.contains(for_id) {

0 commit comments

Comments
 (0)