Skip to content

Commit 216eea7

Browse files
committed
---
yaml --- r: 162043 b: refs/heads/auto c: 8c07db5 h: refs/heads/master i: 162041: ce0538c 162039: 31fb714 v: v3
1 parent 4055adf commit 216eea7

File tree

8 files changed

+67
-101
lines changed

8 files changed

+67
-101
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1010
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1111
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1212
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
13-
refs/heads/auto: fb52e69a503fbe1c5f7641655bc45def875584b3
13+
refs/heads/auto: 8c07db5aac1bf87bce734d34b2c63a0890e02bd4
1414
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1515
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1616
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/librustc_trans/trans/closure.rs

Lines changed: 9 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -272,24 +272,21 @@ fn load_environment<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
272272
let mut i = 0u;
273273
for freevar in freevars.iter() {
274274
let mut upvarptr = GEPi(bcx, llcdata, &[0u, i]);
275-
let captured_by_ref = match store {
276-
ty::RegionTraitStore(..) => {
277-
upvarptr = Load(bcx, upvarptr);
278-
true
279-
}
280-
ty::UniqTraitStore => false
281-
};
275+
match store {
276+
ty::RegionTraitStore(..) => { upvarptr = Load(bcx, upvarptr); }
277+
ty::UniqTraitStore => {}
278+
}
282279
let def_id = freevar.def.def_id();
283280

284281
bcx.fcx.llupvars.borrow_mut().insert(def_id.node, upvarptr);
285-
if let Some(env_pointer_alloca) = env_pointer_alloca {
282+
for &env_pointer_alloca in env_pointer_alloca.iter() {
286283
debuginfo::create_captured_var_metadata(
287284
bcx,
288285
def_id.node,
289286
cdata_ty,
290287
env_pointer_alloca,
291288
i,
292-
captured_by_ref,
289+
store,
293290
freevar.span);
294291
}
295292

@@ -323,25 +320,11 @@ fn load_unboxed_closure_environment<'blk, 'tcx>(
323320
bcx.fcx.llenv.unwrap()
324321
};
325322

326-
// Store the pointer to closure data in an alloca for debug info because that's what the
327-
// llvm.dbg.declare intrinsic expects
328-
let env_pointer_alloca = if bcx.sess().opts.debuginfo == FullDebugInfo {
329-
let alloc = alloc_ty(bcx, ty::mk_mut_ptr(bcx.tcx(), self_type), "__debuginfo_env_ptr");
330-
Store(bcx, llenv, alloc);
331-
Some(alloc)
332-
} else {
333-
None
334-
};
335-
336323
for (i, freevar) in freevars.iter().enumerate() {
337324
let mut upvar_ptr = GEPi(bcx, llenv, &[0, i]);
338-
let captured_by_ref = match freevar_mode {
339-
ast::CaptureByRef => {
340-
upvar_ptr = Load(bcx, upvar_ptr);
341-
true
342-
}
343-
ast::CaptureByValue => false
344-
};
325+
if freevar_mode == ast::CaptureByRef {
326+
upvar_ptr = Load(bcx, upvar_ptr);
327+
}
345328
let def_id = freevar.def.def_id();
346329
bcx.fcx.llupvars.borrow_mut().insert(def_id.node, upvar_ptr);
347330

@@ -350,17 +333,6 @@ fn load_unboxed_closure_environment<'blk, 'tcx>(
350333
upvar_ptr,
351334
node_id_type(bcx, def_id.node))
352335
}
353-
354-
if let Some(env_pointer_alloca) = env_pointer_alloca {
355-
debuginfo::create_captured_var_metadata(
356-
bcx,
357-
def_id.node,
358-
self_type,
359-
env_pointer_alloca,
360-
i,
361-
captured_by_ref,
362-
freevar.span);
363-
}
364336
}
365337

366338
bcx

branches/auto/src/librustc_trans/trans/debuginfo.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -885,7 +885,7 @@ pub fn create_captured_var_metadata<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
885885
env_data_type: Ty<'tcx>,
886886
env_pointer: ValueRef,
887887
env_index: uint,
888-
captured_by_ref: bool,
888+
closure_store: ty::TraitStore,
889889
span: Span) {
890890
if fn_should_be_ignored(bcx.fcx) {
891891
return;
@@ -940,10 +940,13 @@ pub fn create_captured_var_metadata<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
940940
llvm::LLVMDIBuilderCreateOpDeref(Type::i64(cx).to_ref())]
941941
};
942942

943-
let address_op_count = if captured_by_ref {
944-
address_operations.len()
945-
} else {
946-
address_operations.len() - 1
943+
let address_op_count = match closure_store {
944+
ty::RegionTraitStore(..) => {
945+
address_operations.len()
946+
}
947+
ty::UniqTraitStore => {
948+
address_operations.len() - 1
949+
}
947950
};
948951

949952
let variable_access = IndirectVariable {

branches/auto/src/librustrt/stack_overflow.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ mod imp {
277277
all(target_os = "linux", target_arch = "x86_64"),
278278
all(target_os = "linux", target_arch = "arm"), // may not match
279279
all(target_os = "linux", target_arch = "mips"), // may not match
280+
all(target_os = "linux", target_arch = "mipsel"), // may not match
280281
target_os = "android"))] // may not match
281282
mod signal {
282283
use libc;

branches/auto/src/libstd/macros.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,11 +217,12 @@ macro_rules! debug_assert_eq(
217217
/// Iterators:
218218
///
219219
/// ```rust
220-
/// fn divide_by_three(x: u32) -> u32 { // one of the poorest implementations of x/3
221-
/// for i in std::iter::count(0_u32, 1) {
222-
/// if 3*i < i { panic!("u32 overflow"); }
223-
/// if x < 3*i { return i-1; }
220+
/// fn divide_by_three(x: i32) -> i32 { // one of the poorest implementations of x/3
221+
/// for i in std::iter::count(0_i32, 1) {
222+
/// if i < 0 { panic!("i32 overflow"); }
223+
/// if x < 3*i { return i; }
224224
/// }
225+
///
225226
/// unreachable!();
226227
/// }
227228
/// ```

branches/auto/src/libstd/num/strconv.rs

Lines changed: 41 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,13 @@ pub enum SignFormat {
8383
/// - `f` - a callback which will be invoked for each ascii character
8484
/// which composes the string representation of this integer
8585
///
86+
/// # Return value
87+
///
88+
/// A tuple containing the byte vector, and a boolean flag indicating
89+
/// whether it represents a special value like `inf`, `-inf`, `NaN` or not.
90+
/// It returns a tuple because there can be ambiguity between a special value
91+
/// and a number representation at higher bases.
92+
///
8693
/// # Panics
8794
///
8895
/// - Panics if `radix` < 2 or `radix` > 36.
@@ -140,41 +147,40 @@ fn int_to_str_bytes_common<T: Int>(num: T, radix: uint, sign: SignFormat, f: |u8
140147
}
141148
}
142149

143-
/// Converts a number to its string representation as a byte vector.
144-
/// This is meant to be a common base implementation for all numeric string
145-
/// conversion functions like `to_string()` or `to_str_radix()`.
146-
///
147-
/// # Arguments
148-
///
149-
/// - `num` - The number to convert. Accepts any number that
150-
/// implements the numeric traits.
151-
/// - `radix` - Base to use. Accepts only the values 2-36. If the exponential notation
152-
/// is used, then this base is only used for the significand. The exponent
153-
/// itself always printed using a base of 10.
154-
/// - `negative_zero` - Whether to treat the special value `-0` as
155-
/// `-0` or as `+0`.
156-
/// - `sign` - How to emit the sign. See `SignFormat`.
157-
/// - `digits` - The amount of digits to use for emitting the fractional
158-
/// part, if any. See `SignificantDigits`.
159-
/// - `exp_format` - Whether or not to use the exponential (scientific) notation.
160-
/// See `ExponentFormat`.
161-
/// - `exp_capital` - Whether or not to use a capital letter for the exponent sign, if
162-
/// exponential notation is desired.
163-
///
164-
/// # Return value
165-
///
166-
/// A tuple containing the byte vector, and a boolean flag indicating
167-
/// whether it represents a special value like `inf`, `-inf`, `NaN` or not.
168-
/// It returns a tuple because there can be ambiguity between a special value
169-
/// and a number representation at higher bases.
170-
///
171-
/// # Panics
172-
///
173-
/// - Panics if `radix` < 2 or `radix` > 36.
174-
/// - Panics if `radix` > 14 and `exp_format` is `ExpDec` due to conflict
175-
/// between digit and exponent sign `'e'`.
176-
/// - Panics if `radix` > 25 and `exp_format` is `ExpBin` due to conflict
177-
/// between digit and exponent sign `'p'`.
150+
/**
151+
* Converts a number to its string representation as a byte vector.
152+
* This is meant to be a common base implementation for all numeric string
153+
* conversion functions like `to_string()` or `to_str_radix()`.
154+
*
155+
* # Arguments
156+
* - `num` - The number to convert. Accepts any number that
157+
* implements the numeric traits.
158+
* - `radix` - Base to use. Accepts only the values 2-36. If the exponential notation
159+
* is used, then this base is only used for the significand. The exponent
160+
* itself always printed using a base of 10.
161+
* - `negative_zero` - Whether to treat the special value `-0` as
162+
* `-0` or as `+0`.
163+
* - `sign` - How to emit the sign. See `SignFormat`.
164+
* - `digits` - The amount of digits to use for emitting the fractional
165+
* part, if any. See `SignificantDigits`.
166+
* - `exp_format` - Whether or not to use the exponential (scientific) notation.
167+
* See `ExponentFormat`.
168+
* - `exp_capital` - Whether or not to use a capital letter for the exponent sign, if
169+
* exponential notation is desired.
170+
*
171+
* # Return value
172+
* A tuple containing the byte vector, and a boolean flag indicating
173+
* whether it represents a special value like `inf`, `-inf`, `NaN` or not.
174+
* It returns a tuple because there can be ambiguity between a special value
175+
* and a number representation at higher bases.
176+
*
177+
* # Panics
178+
* - Panics if `radix` < 2 or `radix` > 36.
179+
* - Panics if `radix` > 14 and `exp_format` is `ExpDec` due to conflict
180+
* between digit and exponent sign `'e'`.
181+
* - Panics if `radix` > 25 and `exp_format` is `ExpBin` due to conflict
182+
* between digit and exponent sign `'p'`.
183+
*/
178184
pub fn float_to_str_bytes_common<T: Float>(
179185
num: T, radix: uint, negative_zero: bool,
180186
sign: SignFormat, digits: SignificantDigits, exp_format: ExponentFormat, exp_upper: bool

branches/auto/src/libstd/rt/backtrace.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ mod imp {
252252
#[cfg(all(target_os = "ios", target_arch = "arm"))]
253253
#[inline(never)]
254254
pub fn write(w: &mut Writer) -> IoResult<()> {
255-
use iter::{IteratorExt, range};
255+
use iter::{Iterator, range};
256256
use result;
257257
use slice::{SlicePrelude};
258258

branches/auto/src/test/debuginfo/var-captured-in-sendable-closure.rs

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,7 @@
2323
// gdb-check:$2 = {a = -2, b = 3.5, c = 4}
2424
// gdb-command:print *owned
2525
// gdb-check:$3 = 5
26-
// gdb-command:continue
2726

28-
// gdb-command:print constant2
29-
// gdb-check:$4 = 6
30-
// gdb-command:continue
3127

3228
// === LLDB TESTS ==================================================================================
3329

@@ -41,7 +37,6 @@
4137
// lldb-check:[...]$2 = 5
4238

4339
#![allow(unused_variables)]
44-
#![feature(unboxed_closures)]
4540

4641
struct Struct {
4742
a: int,
@@ -60,24 +55,12 @@ fn main() {
6055

6156
let owned = box 5;
6257

63-
let closure = move |:| {
58+
let closure: proc() = proc() {
6459
zzz(); // #break
6560
do_something(&constant, &a_struct.a, &*owned);
6661
};
6762

6863
closure();
69-
70-
let constant2 = 6u;
71-
72-
// The `self` argument of the following closure should be passed by value
73-
// to FnOnce::call_once(self, args), which gets translated a bit differently
74-
// than the regular case. Let's make sure this is supported too.
75-
let immedate_env = move |:| {
76-
zzz(); // #break
77-
return constant2;
78-
};
79-
80-
immedate_env();
8164
}
8265

8366
fn do_something(_: &int, _:&int, _:&int) {

0 commit comments

Comments
 (0)