Skip to content

Commit ee8743a

Browse files
committed
---
yaml --- r: 94961 b: refs/heads/dist-snap c: daee1b4 h: refs/heads/master i: 94959: cc3b7d4 v: v3
1 parent e4d86ac commit ee8743a

File tree

5 files changed

+47
-22
lines changed

5 files changed

+47
-22
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: c274a6888410ce3e357e014568b43310ed787d36
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: f210a1671883d5fe97a2b06ebbe9270fa9a6943a
9+
refs/heads/dist-snap: daee1b4d5c6e1db8563c57ff5529b62d0a29fbde
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/libextra/ringbuf.rs

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -143,19 +143,6 @@ impl<T> RingBuf<T> {
143143
}
144144
}
145145

146-
/// Swap elements at indices `i` and `j`
147-
///
148-
/// `i` and `j` may be equal.
149-
///
150-
/// Fails if there is no element with the given index
151-
pub fn swap(&mut self, i: uint, j: uint) {
152-
assert!(i < self.len());
153-
assert!(j < self.len());
154-
let ri = self.raw_index(i);
155-
let rj = self.raw_index(j);
156-
self.elts.swap(ri, rj);
157-
}
158-
159146
/// Return index in underlying vec for a given logical element index
160147
fn raw_index(&self, idx: uint) -> uint {
161148
raw_index(self.lo, self.elts.len(), idx)
@@ -617,14 +604,6 @@ mod tests {
617604
assert_eq!(d.elts.capacity(), 64);
618605
}
619606

620-
#[test]
621-
fn test_swap() {
622-
let mut d: RingBuf<int> = range(0, 5).collect();
623-
d.pop_front();
624-
d.swap(0, 3);
625-
assert_eq!(d.iter().map(|&x|x).collect::<~[int]>(), ~[4, 2, 3, 1]);
626-
}
627-
628607
#[test]
629608
fn test_iter() {
630609
let mut d = RingBuf::new();

branches/dist-snap/src/librustc/middle/trans/controlflow.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ use syntax::ast;
2525
use syntax::ast::Name;
2626
use syntax::ast_util;
2727
use syntax::codemap::Span;
28+
use syntax::visit::Visitor;
2829

2930
pub fn trans_block(bcx: @mut Block, b: &ast::Block, dest: expr::Dest) -> @mut Block {
3031
let _icx = push_ctxt("trans_block");
@@ -64,12 +65,22 @@ pub fn trans_if(bcx: @mut Block,
6465
// Drop branches that are known to be impossible
6566
if is_const(cond_val) && !is_undef(cond_val) {
6667
if const_to_uint(cond_val) == 1 {
68+
match els {
69+
Some(elexpr) => {
70+
let mut trans = TransItemVisitor { ccx: bcx.fcx.ccx };
71+
trans.visit_expr(elexpr, ());
72+
}
73+
None => {}
74+
}
6775
// if true { .. } [else { .. }]
6876
return do with_scope(bcx, thn.info(), "if_true_then") |bcx| {
6977
let bcx_out = trans_block(bcx, thn, dest);
7078
trans_block_cleanups(bcx_out, block_cleanups(bcx))
7179
}
7280
} else {
81+
let mut trans = TransItemVisitor { ccx: bcx.fcx.ccx } ;
82+
trans.visit_block(thn, ());
83+
7384
match els {
7485
// if false { .. } else { .. }
7586
Some(elexpr) => {
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+
// this used to just ICE on compiling
12+
pub fn foo() {
13+
if cfg!(foo) {
14+
static a: int = 3;
15+
a
16+
} else { 3 };
17+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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+
// aux-build:cfg_inner_static.rs
12+
// xfail-fast
13+
14+
extern mod cfg_inner_static;
15+
16+
fn main() {
17+
cfg_inner_static::foo();
18+
}

0 commit comments

Comments
 (0)