Skip to content

Commit 58c5cb5

Browse files
committed
---
yaml --- r: 159750 b: refs/heads/auto c: 058abcc h: refs/heads/master v: v3
1 parent c1d7b60 commit 58c5cb5

30 files changed

+53
-108
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: 09e2ad13d0aa01143bcb20dece3ff6c5a7e34ea3
13+
refs/heads/auto: 058abcc2094f7657063748f038470076b1e73a63
1414
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1515
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1616
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/doc/reference.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2560,10 +2560,6 @@ The currently implemented features of the reference compiler are:
25602560
* `trace_macros` - Allows use of the `trace_macros` macro, which is a nasty
25612561
hack that will certainly be removed.
25622562

2563-
* `unboxed_closure_sugar` - Allows using `|Foo| -> Bar` as a trait bound
2564-
meaning one of the `Fn` traits. Still
2565-
experimental.
2566-
25672563
* `unboxed_closures` - A work in progress feature with many known bugs.
25682564

25692565
* `unsafe_destructor` - Allows use of the `#[unsafe_destructor]` attribute,

branches/auto/src/libcore/iter.rs

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,9 @@ use cmp;
6565
use cmp::Ord;
6666
use mem;
6767
use num::{ToPrimitive, Int};
68-
use ops::{Add, Deref};
68+
use ops::Add;
6969
use option::{Option, Some, None};
7070
use uint;
71-
7271
#[deprecated = "renamed to Extend"] pub use self::Extend as Extendable;
7372

7473
/// Conversion from an `Iterator`
@@ -1022,44 +1021,6 @@ impl<T: Clone> MinMaxResult<T> {
10221021
}
10231022
}
10241023

1025-
/// A trait for iterators that contain cloneable elements
1026-
pub trait CloneIteratorExt<A> {
1027-
/// Creates an iterator that clones the elements it yields. Useful for converting an
1028-
/// Iterator<&T> to an Iterator<T>.
1029-
fn cloned(self) -> Cloned<Self>;
1030-
}
1031-
1032-
1033-
impl<A: Clone, D: Deref<A>, I: Iterator<D>> CloneIteratorExt<A> for I {
1034-
fn cloned(self) -> Cloned<I> {
1035-
Cloned { it: self }
1036-
}
1037-
}
1038-
1039-
/// An iterator that clones the elements of an underlying iterator
1040-
pub struct Cloned<I> {
1041-
it: I,
1042-
}
1043-
1044-
impl<A: Clone, D: Deref<A>, I: Iterator<D>> Iterator<A> for Cloned<I> {
1045-
fn next(&mut self) -> Option<A> {
1046-
self.it.next().cloned()
1047-
}
1048-
1049-
fn size_hint(&self) -> (uint, Option<uint>) {
1050-
self.it.size_hint()
1051-
}
1052-
}
1053-
1054-
impl<A: Clone, D: Deref<A>, I: DoubleEndedIterator<D>>
1055-
DoubleEndedIterator<A> for Cloned<I> {
1056-
fn next_back(&mut self) -> Option<A> {
1057-
self.it.next_back().cloned()
1058-
}
1059-
}
1060-
1061-
impl<A: Clone, D: Deref<A>, I: ExactSize<D>> ExactSize<A> for Cloned<I> {}
1062-
10631024
/// A trait for iterators that are cloneable.
10641025
pub trait CloneableIterator {
10651026
/// Repeats an iterator endlessly

branches/auto/src/libcore/option.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ use result::{Result, Ok, Err};
153153
use slice;
154154
use slice::AsSlice;
155155
use clone::Clone;
156-
use ops::Deref;
157156

158157
// Note that this is not a lang item per se, but it has a hidden dependency on
159158
// `Iterator`, which is one. The compiler assumes that the `next` method of
@@ -695,12 +694,11 @@ impl<T> Option<T> {
695694
}
696695
}
697696

698-
impl<'a, T: Clone, D: Deref<T>> Option<D> {
699-
/// Maps an Option<D> to an Option<T> by dereffing and cloning the contents of the Option.
700-
/// Useful for converting an Option<&T> to an Option<T>.
697+
impl<'a, T: Clone> Option<&'a T> {
698+
/// Maps an Option<&T> to an Option<T> by cloning the contents of the Option<&T>.
701699
#[unstable = "recently added as part of collections reform"]
702700
pub fn cloned(self) -> Option<T> {
703-
self.map(|t| t.deref().clone())
701+
self.map(|t| t.clone())
704702
}
705703
}
706704

branches/auto/src/libcoretest/iter.rs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -440,23 +440,6 @@ fn test_rev() {
440440
vec![16, 14, 12, 10, 8, 6]);
441441
}
442442

443-
#[test]
444-
fn test_cloned() {
445-
let xs = [2u8, 4, 6, 8];
446-
447-
let mut it = xs.iter().cloned();
448-
assert_eq!(it.len(), 4);
449-
assert_eq!(it.next(), Some(2));
450-
assert_eq!(it.len(), 3);
451-
assert_eq!(it.next(), Some(4));
452-
assert_eq!(it.len(), 2);
453-
assert_eq!(it.next_back(), Some(8));
454-
assert_eq!(it.len(), 1);
455-
assert_eq!(it.next_back(), Some(6));
456-
assert_eq!(it.len(), 0);
457-
assert_eq!(it.next_back(), None);
458-
}
459-
460443
#[test]
461444
fn test_double_ended_map() {
462445
let xs = [1i, 2, 3, 4, 5, 6];

branches/auto/src/libcoretest/option.rs

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -241,29 +241,14 @@ fn test_collect() {
241241
assert!(v == None);
242242
}
243243

244-
#[test]
245244
fn test_cloned() {
246-
let val1 = 1u32;
247-
let mut val2 = 2u32;
248-
let val1_ref = &val1;
249-
let opt_none: Option<&'static u32> = None;
250-
let opt_ref = Some(&val1);
251-
let opt_ref_ref = Some(&val1_ref);
252-
let opt_mut_ref = Some(&mut val2);
253-
254-
// None works
255-
assert_eq!(opt_none.clone(), None);
256-
assert_eq!(opt_none.cloned(), None);
257-
258-
// Mutable refs work
259-
assert_eq!(opt_mut_ref.cloned(), Some(2u32));
260-
261-
// Immutable ref works
262-
assert_eq!(opt_ref.clone(), Some(&val1));
263-
assert_eq!(opt_ref.cloned(), Some(1u32));
264-
265-
// Double Immutable ref works
266-
assert_eq!(opt_ref_ref.clone(), Some(&val1_ref));
267-
assert_eq!(opt_ref_ref.clone().cloned(), Some(&val1));
268-
assert_eq!(opt_ref_ref.cloned().cloned(), Some(1u32));
245+
let s = 1u32;
246+
let n: Option<&'static u32> = None;
247+
let o = Some(&s);
248+
249+
assert_eq!(o.clone(), Some(&s));
250+
assert_eq!(o.cloned(), Some(1u32));
251+
252+
assert_eq!(n.clone(), None);
253+
assert_eq!(n.cloned(), None);
269254
}

branches/auto/src/libsyntax/feature_gate.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[
5959
("linkage", Active),
6060
("struct_inherit", Removed),
6161
("overloaded_calls", Active),
62-
("unboxed_closure_sugar", Active),
6362

6463
("quad_precision_float", Removed),
6564

@@ -381,7 +380,7 @@ impl<'a, 'v> Visitor<'v> for Context<'a> {
381380
fn_decl: &'v ast::FnDecl,
382381
block: &'v ast::Block,
383382
span: Span,
384-
_: NodeId) {
383+
_node_id: NodeId) {
385384
match fn_kind {
386385
visit::FkItemFn(_, _, _, abi) if abi == RustIntrinsic => {
387386
self.gate_feature("intrinsics",
@@ -392,6 +391,19 @@ impl<'a, 'v> Visitor<'v> for Context<'a> {
392391
}
393392
visit::walk_fn(self, fn_kind, fn_decl, block, span);
394393
}
394+
395+
fn visit_path_parameters(&mut self, path_span: Span, parameters: &'v ast::PathParameters) {
396+
match *parameters {
397+
ast::ParenthesizedParameters(..) => {
398+
self.gate_feature("unboxed_closures",
399+
path_span,
400+
"parenthetical parameter notation is subject to change");
401+
}
402+
ast::AngleBracketedParameters(..) => { }
403+
}
404+
405+
visit::walk_path_parameters(self, path_span, parameters)
406+
}
395407
}
396408

397409
pub fn check_crate(span_handler: &SpanHandler, krate: &ast::Crate) -> (Features, Vec<Span>) {

branches/auto/src/test/compile-fail/borrowck-unboxed-closures.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(overloaded_calls)]
11+
#![feature(overloaded_calls, unboxed_closures)]
1212

1313
fn a<F:Fn(int, int) -> int>(mut f: F) {
1414
let g = &mut f;

branches/auto/src/test/compile-fail/issue-16939.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(overloaded_calls)]
11+
#![feature(overloaded_calls, unboxed_closures)]
1212

1313
// Make sure we don't ICE when making an overloaded call with the
1414
// wrong arity.

branches/auto/src/test/compile-fail/regionck-unboxed-closure-lifetimes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(unboxed_closure_sugar, unboxed_closures, overloaded_calls)]
11+
#![feature(unboxed_closures, overloaded_calls)]
1212

1313
use std::ops::FnMut;
1414

branches/auto/src/test/compile-fail/unboxed-closure-sugar-default.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// Test interaction between unboxed closure sugar and default type
1212
// parameters (should be exactly as if angle brackets were used).
1313

14-
#![feature(default_type_params)]
14+
#![feature(default_type_params, unboxed_closures)]
1515
#![allow(dead_code)]
1616

1717
struct Foo<T,U,V=T> {

branches/auto/src/test/compile-fail/unboxed-closure-sugar-equiv.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// angle brackets. This test covers only simple types and in
1414
// particular doesn't test bound regions.
1515

16+
#![feature(unboxed_closures)]
1617
#![allow(dead_code)]
1718

1819
struct Foo<T,U> {

branches/auto/src/test/compile-fail/unboxed-closure-sugar-nonexistent-trait.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#![feature(unboxed_closures)]
12+
1113
fn f<F:Nonexist(int) -> int>(x: F) {} //~ ERROR nonexistent trait `Nonexist`
1214

1315
type Typedef = int;

branches/auto/src/test/compile-fail/unboxed-closure-sugar-region.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// parameters (should be exactly as if angle brackets were used
1313
// and regions omitted).
1414

15-
#![feature(default_type_params)]
15+
#![feature(default_type_params, unboxed_closures)]
1616
#![allow(dead_code)]
1717

1818
use std::kinds::marker;

branches/auto/src/test/compile-fail/unboxed-closure-sugar-wrong-number-number-type-parameters-1.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
struct One<A>;
12+
#![feature(unboxed_closures)]
1213

1314
fn foo(_: One()) //~ ERROR wrong number of type arguments
1415
{}

branches/auto/src/test/compile-fail/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
struct Three<A,B,C>;
12+
#![feature(unboxed_closures)]
1213

1314
fn foo(_: Three()) //~ ERROR wrong number of type arguments
1415
{}

branches/auto/src/test/compile-fail/unboxed-closure-sugar-wrong-number-number-type-parameters.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
struct Zero;
12+
#![feature(unboxed_closures)]
1213

1314
fn foo(_: Zero()) //~ ERROR wrong number of type arguments
1415
{}

branches/auto/src/test/compile-fail/unboxed-closure-sugar-wrong-trait.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#![feature(unboxed_closures)]
12+
1113
trait Trait {}
1214

1315
fn f<F:Trait(int) -> int>(x: F) {}

branches/auto/src/test/compile-fail/unboxed-closures-fnmut-as-fn.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// Checks that the Fn trait hierarchy rules do not permit
1212
// Fn to be used where FnMut is implemented.
1313

14-
#![feature(unboxed_closure_sugar)]
14+
#![feature(unboxed_closures)]
1515
#![feature(overloaded_calls)]
1616

1717
use std::ops::{Fn,FnMut,FnOnce};

branches/auto/src/test/run-pass/closure-syntax.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
#![allow(dead_code)]
12-
#![feature(unboxed_closures, unboxed_closure_sugar)]
12+
#![feature(unboxed_closures)]
1313

1414
// compile-flags:-g
1515

branches/auto/src/test/run-pass/hrtb-parse.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
// Test that we can parse all the various places that a `for` keyword
1212
// can appear representing universal quantification.
1313

14+
#![feature(unboxed_closures)]
1415
#![allow(unused_variables)]
1516
#![allow(dead_code)]
1617

branches/auto/src/test/run-pass/issue-18661.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// Test that param substitutions from the correct environment are
1212
// used when translating unboxed closure calls.
1313

14-
#![feature(unboxed_closures)]
14+
#![feature(unboxed_closures, unboxed_closures)]
1515

1616
pub fn inside<F: Fn()>(c: F) {
1717
c.call(());

branches/auto/src/test/run-pass/unboxed-closures-all-traits.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(lang_items, overloaded_calls, unboxed_closures)]
11+
#![feature(lang_items, overloaded_calls, unboxed_closures, unboxed_closures)]
1212

1313
fn a<F:Fn(int, int) -> int>(f: F) -> int {
1414
f(1, 2)

branches/auto/src/test/run-pass/unboxed-closures-extern-fn.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// Checks that extern fn points implement the full range of Fn traits.
1212

13-
#![feature(unboxed_closure_sugar)]
13+
#![feature(unboxed_closures)]
1414
#![feature(overloaded_calls)]
1515

1616
use std::ops::{Fn,FnMut,FnOnce};

branches/auto/src/test/run-pass/unboxed-closures-fn-as-fnmut-and-fnonce.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// Checks that the Fn trait hierarchy rules permit
1212
// any Fn trait to be used where Fn is implemented.
1313

14-
#![feature(unboxed_closure_sugar)]
14+
#![feature(unboxed_closures)]
1515
#![feature(overloaded_calls)]
1616

1717
use std::ops::{Fn,FnMut,FnOnce};

branches/auto/src/test/run-pass/unboxed-closures-fnmut-as-fnonce.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// Checks that the Fn trait hierarchy rules permit
1212
// FnMut or FnOnce to be used where FnMut is implemented.
1313

14-
#![feature(unboxed_closure_sugar)]
14+
#![feature(unboxed_closures)]
1515
#![feature(overloaded_calls)]
1616

1717
use std::ops::{FnMut,FnOnce};

branches/auto/src/test/run-pass/unboxed-closures-manual-impl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// option. This file may not be copied, modified, or distributed
1010
// except according to those terms.
1111

12-
#![feature(unboxed_closure_sugar)]
12+
#![feature(unboxed_closures)]
1313

1414
use std::ops::FnMut;
1515

branches/auto/src/test/run-pass/unboxed-closures-prelude.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// Tests that the reexports of `FnOnce` et al from the prelude work.
1212

13-
#![feature(unboxed_closures, unboxed_closure_sugar)]
13+
#![feature(unboxed_closures)]
1414

1515
fn main() {
1616
let task: Box<FnOnce(int) -> int> = box |: x| x;

branches/auto/src/test/run-pass/unboxed-closures-sugar-object.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
// Test unboxed closure sugar used in object types.
1212

1313
#![allow(dead_code)]
14+
#![feature(unboxed_closures)]
1415

1516
struct Foo<T,U> {
1617
t: T, u: U

0 commit comments

Comments
 (0)