Skip to content

Commit 46670b4

Browse files
committed
---
yaml --- r: 107707 b: refs/heads/dist-snap c: 28b987b h: refs/heads/master i: 107705: 4116a96 107703: f0a5338 v: v3
1 parent 99166a2 commit 46670b4

28 files changed

+108
-65
lines changed

[refs]

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

branches/dist-snap/mk/tests.mk

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,7 @@ ifeq ($(NO_REBUILD),)
344344
STDTESTDEP_$(1)_$(2)_$(3)_$(4) = $$(SREQ$(1)_T_$(2)_H_$(3)) \
345345
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.extra \
346346
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.rustuv \
347-
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.green \
348-
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.native
347+
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.green
349348
else
350349
STDTESTDEP_$(1)_$(2)_$(3)_$(4) =
351350
endif

branches/dist-snap/src/etc/generate-deriving-span-tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def write_file(name, string):
118118
for (trait, supers, errs) in [('Rand', [], 1),
119119
('Clone', [], 1), ('DeepClone', ['Clone'], 1),
120120
('Eq', [], 2), ('Ord', [], 8),
121-
('TotalEq', [], 1), ('TotalOrd', ['TotalEq'], 1)]:
121+
('TotalEq', [], 2), ('TotalOrd', ['TotalEq'], 2)]:
122122
traits[trait] = (ALL, supers, errs)
123123

124124
for (trait, (types, super_traits, error_count)) in traits.items():

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,13 @@ struct Node<T> {
4747
}
4848

4949
/// Double-ended DList iterator
50+
#[deriving(Clone)]
5051
pub struct Items<'a, T> {
5152
priv head: &'a Link<T>,
5253
priv tail: Rawlink<Node<T>>,
5354
priv nelem: uint,
5455
}
5556

56-
// FIXME #11820: the &'a Option<> of the Link stops clone working.
57-
impl<'a, T> Clone for Items<'a, T> {
58-
fn clone(&self) -> Items<'a, T> { *self }
59-
}
60-
6157
/// Double-ended mutable DList iterator
6258
pub struct MutItems<'a, T> {
6359
priv list: &'a mut DList<T>,

branches/dist-snap/src/librustc/front/feature_gate.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[
4747
("macro_registrar", Active),
4848
("log_syntax", Active),
4949
("trace_macros", Active),
50+
("simd", Active),
5051

5152
// These are used to test this portion of the compiler, they don't actually
5253
// mean anything
@@ -171,6 +172,13 @@ impl Visitor<()> for Context {
171172
}
172173
}
173174

175+
ast::ItemStruct(..) => {
176+
if attr::contains_name(i.attrs, "simd") {
177+
self.gate_feature("simd", i.span,
178+
"SIMD types are experimental and possibly buggy");
179+
}
180+
}
181+
174182
_ => {}
175183
}
176184

branches/dist-snap/src/librustc/middle/kind.rs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -184,6 +184,9 @@ fn with_appropriate_checker(cx: &Context,
184184
let id = ast_util::def_id_of_def(fv.def).node;
185185
let var_t = ty::node_id_to_type(cx.tcx, id);
186186

187+
// check that only immutable variables are implicitly copied in
188+
check_imm_free_var(cx, fv.def, fv.span);
189+
187190
check_freevar_bounds(cx, fv.span, var_t, bounds, None);
188191
}
189192

@@ -444,6 +447,23 @@ pub fn check_trait_cast_bounds(cx: &Context, sp: Span, ty: ty::t,
444447
});
445448
}
446449

450+
fn check_imm_free_var(cx: &Context, def: Def, sp: Span) {
451+
match def {
452+
DefLocal(_, BindByValue(MutMutable)) => {
453+
cx.tcx.sess.span_err(
454+
sp,
455+
"mutable variables cannot be implicitly captured");
456+
}
457+
DefLocal(..) | DefArg(..) | DefBinding(..) => { /* ok */ }
458+
DefUpvar(_, def1, _, _) => { check_imm_free_var(cx, *def1, sp); }
459+
_ => {
460+
cx.tcx.sess.span_bug(
461+
sp,
462+
format!("unknown def for free variable: {:?}", def));
463+
}
464+
}
465+
}
466+
447467
fn check_copy(cx: &Context, ty: ty::t, sp: Span, reason: &str) {
448468
debug!("type_contents({})={}",
449469
ty_to_str(cx.tcx, ty),

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -399,17 +399,13 @@ struct BindingInfo {
399399

400400
type BindingsMap = HashMap<Ident, BindingInfo>;
401401

402+
#[deriving(Clone)]
402403
struct ArmData<'a,'b> {
403404
bodycx: &'b Block<'b>,
404405
arm: &'a ast::Arm,
405406
bindings_map: @BindingsMap
406407
}
407408

408-
// FIXME #11820: method resolution is unreliable with &
409-
impl<'a,'b> Clone for ArmData<'a, 'b> {
410-
fn clone(&self) -> ArmData<'a, 'b> { *self }
411-
}
412-
413409
/**
414410
* Info about Match.
415411
* If all `pats` are matched then arm `data` will be executed.
@@ -2231,3 +2227,5 @@ fn bind_irrefutable_pat<'a>(
22312227
}
22322228
return bcx;
22332229
}
2230+
2231+

branches/dist-snap/src/libstd/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,14 @@
5252
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
5353
html_root_url = "http://static.rust-lang.org/doc/master")];
5454

55-
#[feature(macro_rules, globs, asm, managed_boxes, thread_local, link_args)];
55+
#[feature(macro_rules, globs, asm, managed_boxes, thread_local, link_args, simd)];
5656

5757
// Don't link to std. We are std.
5858
#[no_std];
5959

6060
#[deny(non_camel_case_types)];
6161
#[deny(missing_doc)];
62+
#[allow(unknown_features)];
6263

6364
// When testing libstd, bring in libuv as the I/O backend so tests can print
6465
// things and all of the std::io tests have an I/O interface to run on top

branches/dist-snap/src/libstd/unstable/simd.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,32 +12,42 @@
1212
1313
#[allow(non_camel_case_types)];
1414

15+
#[experimental]
1516
#[simd]
1617
pub struct i8x16(i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8);
1718

19+
#[experimental]
1820
#[simd]
1921
pub struct i16x8(i16, i16, i16, i16, i16, i16, i16, i16);
2022

23+
#[experimental]
2124
#[simd]
2225
pub struct i32x4(i32, i32, i32, i32);
2326

27+
#[experimental]
2428
#[simd]
2529
pub struct i64x2(i64, i64);
2630

31+
#[experimental]
2732
#[simd]
2833
pub struct u8x16(u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8);
2934

35+
#[experimental]
3036
#[simd]
3137
pub struct u16x8(u16, u16, u16, u16, u16, u16, u16, u16);
3238

39+
#[experimental]
3340
#[simd]
3441
pub struct u32x4(u32, u32, u32, u32);
3542

43+
#[experimental]
3644
#[simd]
3745
pub struct u64x2(u64, u64);
3846

47+
#[experimental]
3948
#[simd]
4049
pub struct f32x4(f32, f32, f32, f32);
4150

51+
#[experimental]
4252
#[simd]
4353
pub struct f64x2(f64, f64);

branches/dist-snap/src/libsyntax/ext/deriving/cmp/ord.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,14 @@ fn cs_op(less: bool, equal: bool, cx: &ExtCtxt, span: Span, substr: &Substructur
7878
_ => cx.span_bug(span, "Not exactly 2 arguments in `deriving(Ord)`")
7979
};
8080

81-
let cmp = cx.expr_binary(span, op, self_f, other_f);
81+
let cmp = cx.expr_binary(span, op,
82+
cx.expr_deref(span, self_f),
83+
cx.expr_deref(span, other_f));
8284

8385
let not_cmp = cx.expr_unary(span, ast::UnNot,
84-
cx.expr_binary(span, op, other_f, self_f));
86+
cx.expr_binary(span, op,
87+
cx.expr_deref(span, other_f),
88+
cx.expr_deref(span, self_f)));
8589

8690
let and = cx.expr_binary(span, ast::BiAnd, not_cmp, subexpr);
8791
cx.expr_binary(span, ast::BiOr, cmp, and)

branches/dist-snap/src/libsyntax/ext/deriving/generic.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,8 +1013,7 @@ impl<'a> TraitDef<'a> {
10131013
};
10141014
let path = cx.path_ident(sp, cx.ident_of(format!("{}_{}", prefix, i)));
10151015
paths.push(path.clone());
1016-
let val = cx.expr(sp, ast::ExprParen(cx.expr_deref(sp, cx.expr_path(path))));
1017-
ident_expr.push((sp, opt_id, val));
1016+
ident_expr.push((sp, opt_id, cx.expr_path(path)));
10181017
}
10191018

10201019
let subpats = self.create_subpatterns(paths, mutbl);
@@ -1058,8 +1057,7 @@ impl<'a> TraitDef<'a> {
10581057
let path = cx.path_ident(sp, cx.ident_of(format!("{}_{}", prefix, i)));
10591058

10601059
paths.push(path.clone());
1061-
let val = cx.expr(sp, ast::ExprParen(cx.expr_deref(sp, cx.expr_path(path))));
1062-
ident_expr.push((sp, None, val));
1060+
ident_expr.push((sp, None, cx.expr_path(path)));
10631061
}
10641062

10651063
let subpats = self.create_subpatterns(paths, mutbl);
@@ -1134,7 +1132,7 @@ pub fn cs_same_method(f: |&ExtCtxt, Span, ~[@Expr]| -> @Expr,
11341132
cx.expr_method_call(field.span,
11351133
field.self_,
11361134
substructure.method_ident,
1137-
field.other.map(|e| cx.expr_addr_of(field.span, *e)))
1135+
field.other.clone())
11381136
});
11391137

11401138
f(cx, trait_span, called)

branches/dist-snap/src/test/compile-fail/deriving-span-TotalEq-enum-struct-variant.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ struct Error;
2020
enum Enum {
2121
A {
2222
x: Error //~ ERROR
23+
//~^ ERROR
2324
}
2425
}
2526

branches/dist-snap/src/test/compile-fail/deriving-span-TotalEq-enum.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ struct Error;
2020
enum Enum {
2121
A(
2222
Error //~ ERROR
23+
//~^ ERROR
2324
)
2425
}
2526

branches/dist-snap/src/test/compile-fail/deriving-span-TotalEq-struct.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ struct Error;
1919
#[deriving(TotalEq)]
2020
struct Struct {
2121
x: Error //~ ERROR
22+
//~^ ERROR
2223
}
2324

2425
fn main() {}

branches/dist-snap/src/test/compile-fail/deriving-span-TotalEq-tuple-struct.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ struct Error;
1919
#[deriving(TotalEq)]
2020
struct Struct(
2121
Error //~ ERROR
22+
//~^ ERROR
2223
);
2324

2425
fn main() {}

branches/dist-snap/src/test/compile-fail/deriving-span-TotalOrd-enum-struct-variant.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ struct Error;
2020
enum Enum {
2121
A {
2222
x: Error //~ ERROR
23+
//~^ ERROR
2324
}
2425
}
2526

branches/dist-snap/src/test/compile-fail/deriving-span-TotalOrd-enum.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ struct Error;
2020
enum Enum {
2121
A(
2222
Error //~ ERROR
23+
//~^ ERROR
2324
)
2425
}
2526

branches/dist-snap/src/test/compile-fail/deriving-span-TotalOrd-struct.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ struct Error;
1919
#[deriving(TotalOrd,TotalEq)]
2020
struct Struct {
2121
x: Error //~ ERROR
22+
//~^ ERROR
2223
}
2324

2425
fn main() {}

branches/dist-snap/src/test/compile-fail/deriving-span-TotalOrd-tuple-struct.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ struct Error;
1919
#[deriving(TotalOrd,TotalEq)]
2020
struct Struct(
2121
Error //~ ERROR
22+
//~^ ERROR
2223
);
2324

2425
fn main() {}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright 2014 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+
#[simd]
12+
pub struct i64x2(i64, i64); //~ ERROR: SIMD types are experimental
13+
14+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -13,41 +13,38 @@ use std::task;
1313
fn user(_i: int) {}
1414

1515
fn foo() {
16-
// Here, i is *copied* into the proc (heap closure).
17-
// Requires allocation. The proc's copy is not mutable.
16+
// Here, i is *moved* into the closure: Not actually OK
1817
let mut i = 0;
1918
do task::spawn {
20-
user(i);
21-
println!("spawned {}", i)
19+
user(i); //~ ERROR mutable variables cannot be implicitly captured
2220
}
23-
i += 1;
24-
println!("original {}", i)
2521
}
2622

2723
fn bar() {
28-
// Here, the original i has not been moved, only copied, so is still
29-
// mutable outside of the proc.
24+
// Here, i would be implicitly *copied* but it
25+
// is mutable: bad
3026
let mut i = 0;
3127
while i < 10 {
3228
do task::spawn {
33-
user(i);
29+
user(i); //~ ERROR mutable variables cannot be implicitly captured
3430
}
3531
i += 1;
3632
}
3733
}
3834

3935
fn car() {
40-
// Here, i must be shadowed in the proc to be mutable.
36+
// Here, i is mutable, but *explicitly* shadowed copied:
4137
let mut i = 0;
4238
while i < 10 {
43-
do task::spawn {
44-
let mut i = i;
45-
i += 1;
46-
user(i);
39+
{
40+
let i = i;
41+
do task::spawn {
42+
user(i);
43+
}
4744
}
4845
i += 1;
4946
}
5047
}
5148

52-
pub fn main() {}
53-
49+
fn main() {
50+
}

0 commit comments

Comments
 (0)