Skip to content

Commit 470118f

Browse files
committed
auto merge of #20504 : japaric/rust/derive-self, r=alexcrichton
I put the sed scripts in the commits, in case this needs a "rebase".
2 parents c6c7866 + 351409a commit 470118f

File tree

327 files changed

+1416
-1416
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

327 files changed

+1416
-1416
lines changed

src/compiletest/common.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use std::fmt;
1313
use std::str::FromStr;
1414
use regex::Regex;
1515

16-
#[deriving(Clone, PartialEq)]
16+
#[derive(Clone, PartialEq)]
1717
pub enum Mode {
1818
CompileFail,
1919
RunFail,
@@ -59,7 +59,7 @@ impl fmt::Show for Mode {
5959
}
6060
}
6161

62-
#[deriving(Clone)]
62+
#[derive(Clone)]
6363
pub struct Config {
6464
// The library paths required for running the compiler
6565
pub compile_lib_path: String,

src/compiletest/errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub struct ExpectedError {
3030
pub static EXPECTED_PATTERN : &'static str =
3131
r"//~(?P<follow>\|)?(?P<adjusts>\^*)\s*(?P<kind>\S*)\s*(?P<msg>.*)";
3232

33-
#[deriving(PartialEq, Show)]
33+
#[derive(PartialEq, Show)]
3434
enum WhichLine { ThisLine, FollowPrevious(uint), AdjustBackward(uint) }
3535

3636
// Load any test directives embedded in the file

src/grammar/verify.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use std::io::File;
2626

2727
use syntax::parse;
2828
use syntax::parse::lexer;
29-
use rustc::session::{mod, config};
29+
use rustc::session::{self, config};
3030

3131
use syntax::ast;
3232
use syntax::ast::Name;

src/liballoc/arc.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ use core::atomic;
7171
use core::atomic::Ordering::{Relaxed, Release, Acquire, SeqCst};
7272
use core::borrow::BorrowFrom;
7373
use core::clone::Clone;
74-
use core::fmt::{mod, Show};
74+
use core::fmt::{self, Show};
7575
use core::cmp::{Eq, Ord, PartialEq, PartialOrd, Ordering};
7676
use core::default::Default;
7777
use core::kinds::{Sync, Send};
@@ -81,7 +81,7 @@ use core::nonzero::NonZero;
8181
use core::ops::{Drop, Deref};
8282
use core::option::Option;
8383
use core::option::Option::{Some, None};
84-
use core::ptr::{mod, PtrExt};
84+
use core::ptr::{self, PtrExt};
8585
use heap::deallocate;
8686

8787
/// An atomically reference counted wrapper for shared state.
@@ -800,6 +800,6 @@ mod tests {
800800
}
801801

802802
// Make sure deriving works with Arc<T>
803-
#[deriving(Eq, Ord, PartialEq, PartialOrd, Clone, Show, Default)]
803+
#[derive(Eq, Ord, PartialEq, PartialOrd, Clone, Show, Default)]
804804
struct Foo { inner: Arc<int> }
805805
}

src/liballoc/boxed.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use core::clone::Clone;
1717
use core::cmp::{PartialEq, PartialOrd, Eq, Ord, Ordering};
1818
use core::default::Default;
1919
use core::fmt;
20-
use core::hash::{mod, Hash};
20+
use core::hash::{self, Hash};
2121
use core::kinds::Sized;
2222
use core::mem;
2323
use core::option::Option;

src/liballoc/rc.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -147,14 +147,14 @@ use core::clone::Clone;
147147
use core::cmp::{PartialEq, PartialOrd, Eq, Ord, Ordering};
148148
use core::default::Default;
149149
use core::fmt;
150-
use core::hash::{mod, Hash};
150+
use core::hash::{self, Hash};
151151
use core::kinds::marker;
152152
use core::mem::{transmute, min_align_of, size_of, forget};
153153
use core::nonzero::NonZero;
154154
use core::ops::{Deref, Drop};
155155
use core::option::Option;
156156
use core::option::Option::{Some, None};
157-
use core::ptr::{mod, PtrExt};
157+
use core::ptr::{self, PtrExt};
158158
use core::result::Result;
159159
use core::result::Result::{Ok, Err};
160160

@@ -264,7 +264,7 @@ pub fn is_unique<T>(rc: &Rc<T>) -> bool {
264264
/// # Example
265265
///
266266
/// ```
267-
/// use std::rc::{mod, Rc};
267+
/// use std::rc::{self, Rc};
268268
///
269269
/// let x = Rc::new(3u);
270270
/// assert_eq!(rc::try_unwrap(x), Ok(3u));
@@ -298,7 +298,7 @@ pub fn try_unwrap<T>(rc: Rc<T>) -> Result<T, Rc<T>> {
298298
/// # Example
299299
///
300300
/// ```
301-
/// use std::rc::{mod, Rc};
301+
/// use std::rc::{self, Rc};
302302
///
303303
/// let mut x = Rc::new(3u);
304304
/// *rc::get_mut(&mut x).unwrap() = 4u;

src/libarena/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ use std::rt::heap::{allocate, deallocate};
4646
// The way arena uses arrays is really deeply awful. The arrays are
4747
// allocated, and have capacities reserved, but the fill for the array
4848
// will always stay at 0.
49-
#[deriving(Clone, PartialEq)]
49+
#[derive(Clone, PartialEq)]
5050
struct Chunk {
5151
data: Rc<RefCell<Vec<u8>>>,
5252
fill: Cell<uint>,

src/libcollections/binary_heap.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
//! use std::collections::BinaryHeap;
3131
//! use std::uint;
3232
//!
33-
//! #[deriving(Copy, Eq, PartialEq)]
33+
//! #[derive(Copy, Eq, PartialEq)]
3434
//! struct State {
3535
//! cost: uint,
3636
//! position: uint,
@@ -157,12 +157,12 @@ use core::mem::{zeroed, replace, swap};
157157
use core::ptr;
158158

159159
use slice;
160-
use vec::{mod, Vec};
160+
use vec::{self, Vec};
161161

162162
/// A priority queue implemented with a binary heap.
163163
///
164164
/// This will be a max-heap.
165-
#[deriving(Clone)]
165+
#[derive(Clone)]
166166
#[stable]
167167
pub struct BinaryHeap<T> {
168168
data: Vec<T>,
@@ -565,7 +565,7 @@ pub struct Iter <'a, T: 'a> {
565565
iter: slice::Iter<'a, T>,
566566
}
567567

568-
// FIXME(#19839) Remove in favor of `#[deriving(Clone)]`
568+
// FIXME(#19839) Remove in favor of `#[derive(Clone)]`
569569
impl<'a, T> Clone for Iter<'a, T> {
570570
fn clone(&self) -> Iter<'a, T> {
571571
Iter { iter: self.iter.clone() }

src/libcollections/bit.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ use core::fmt;
8989
use core::hash;
9090
use core::iter::RandomAccessIterator;
9191
use core::iter::{Chain, Enumerate, Repeat, Skip, Take, repeat, Cloned};
92-
use core::iter::{mod, FromIterator};
92+
use core::iter::{self, FromIterator};
9393
use core::num::Int;
9494
use core::ops::Index;
9595
use core::slice;
@@ -1040,7 +1040,7 @@ impl cmp::Eq for Bitv {}
10401040

10411041
/// An iterator for `Bitv`.
10421042
#[stable]
1043-
#[deriving(Clone)]
1043+
#[derive(Clone)]
10441044
pub struct Iter<'a> {
10451045
bitv: &'a Bitv,
10461046
next_idx: uint,
@@ -1139,7 +1139,7 @@ impl<'a> RandomAccessIterator for Iter<'a> {
11391139
/// let bv: Bitv = s.into_bitv();
11401140
/// assert!(bv[3]);
11411141
/// ```
1142-
#[deriving(Clone)]
1142+
#[derive(Clone)]
11431143
#[stable]
11441144
pub struct BitvSet {
11451145
bitv: Bitv,
@@ -1784,15 +1784,15 @@ impl<S: hash::Writer> hash::Hash<S> for BitvSet {
17841784
}
17851785

17861786
/// An iterator for `BitvSet`.
1787-
#[deriving(Clone)]
1787+
#[derive(Clone)]
17881788
#[stable]
17891789
pub struct SetIter<'a> {
17901790
set: &'a BitvSet,
17911791
next_idx: uint
17921792
}
17931793

17941794
/// An iterator combining two `BitvSet` iterators.
1795-
#[deriving(Clone)]
1795+
#[derive(Clone)]
17961796
struct TwoBitPositions<'a> {
17971797
set: &'a BitvSet,
17981798
other: &'a BitvSet,

src/libcollections/btree/map.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ use ring_buf::RingBuf;
3333
use self::Continuation::{Continue, Finished};
3434
use self::StackOp::*;
3535
use super::node::ForceResult::{Leaf, Internal};
36-
use super::node::TraversalItem::{mod, Elem, Edge};
36+
use super::node::TraversalItem::{self, Elem, Edge};
3737
use super::node::{Traversal, MutTraversal, MoveTraversal};
38-
use super::node::{mod, Node, Found, GoDown};
38+
use super::node::{self, Node, Found, GoDown};
3939

4040
// FIXME(conventions): implement bounded iterators
4141

@@ -81,7 +81,7 @@ use super::node::{mod, Node, Found, GoDown};
8181
/// force this degenerate behaviour to occur on every operation. While the total amount of work
8282
/// done on each operation isn't *catastrophic*, and *is* still bounded by O(B log<sub>B</sub>n),
8383
/// it is certainly much slower when it does.
84-
#[deriving(Clone)]
84+
#[derive(Clone)]
8585
#[stable]
8686
pub struct BTreeMap<K, V> {
8787
root: Node<K, V>,
@@ -505,7 +505,7 @@ mod stack {
505505
use core::mem;
506506
use core::ops::{Deref, DerefMut};
507507
use super::BTreeMap;
508-
use super::super::node::{mod, Node, Fit, Split, Internal, Leaf};
508+
use super::super::node::{self, Node, Fit, Split, Internal, Leaf};
509509
use super::super::node::handle;
510510
use vec::Vec;
511511

src/libcollections/btree/node.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ impl<K: Clone, V: Clone> Clone for Node<K, V> {
496496
/// println!("Uninitialized memory: {}", handle.into_kv());
497497
/// }
498498
/// ```
499-
#[deriving(Copy)]
499+
#[derive(Copy)]
500500
pub struct Handle<NodeRef, Type, NodeType> {
501501
node: NodeRef,
502502
index: uint

src/libcollections/btree/set.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
use core::prelude::*;
1515

1616
use core::borrow::BorrowFrom;
17-
use core::cmp::Ordering::{mod, Less, Greater, Equal};
17+
use core::cmp::Ordering::{self, Less, Greater, Equal};
1818
use core::default::Default;
1919
use core::fmt::Show;
2020
use core::fmt;
@@ -30,7 +30,7 @@ use btree_map::{BTreeMap, Keys};
3030
///
3131
/// See BTreeMap's documentation for a detailed discussion of this collection's performance
3232
/// benefits and drawbacks.
33-
#[deriving(Clone, Hash, PartialEq, Eq, Ord, PartialOrd)]
33+
#[derive(Clone, Hash, PartialEq, Eq, Ord, PartialOrd)]
3434
#[stable]
3535
pub struct BTreeSet<T>{
3636
map: BTreeMap<T, ()>,

src/libcollections/dlist.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use core::cmp::Ordering;
2626
use core::default::Default;
2727
use core::fmt;
2828
use core::hash::{Writer, Hash};
29-
use core::iter::{mod, FromIterator};
29+
use core::iter::{self, FromIterator};
3030
use core::mem;
3131
use core::ptr;
3232

@@ -84,7 +84,7 @@ pub struct IterMut<'a, T:'a> {
8484
}
8585

8686
/// An iterator over mutable references to the items of a `DList`.
87-
#[deriving(Clone)]
87+
#[derive(Clone)]
8888
#[stable]
8989
pub struct IntoIter<T> {
9090
list: DList<T>

src/libcollections/enum_set.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use core::ops::{Sub, BitOr, BitAnd, BitXor};
2121

2222
// FIXME(contentions): implement union family of methods? (general design may be wrong here)
2323

24-
#[deriving(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
24+
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
2525
/// A specialized set implementation to use enum types.
2626
pub struct EnumSet<E> {
2727
// We must maintain the invariant that no bits are set
@@ -223,7 +223,7 @@ pub struct Iter<E> {
223223
bits: uint,
224224
}
225225

226-
// FIXME(#19839) Remove in favor of `#[deriving(Clone)]`
226+
// FIXME(#19839) Remove in favor of `#[derive(Clone)]`
227227
impl<E> Clone for Iter<E> {
228228
fn clone(&self) -> Iter<E> {
229229
Iter {
@@ -287,7 +287,7 @@ mod test {
287287

288288
use super::{EnumSet, CLike};
289289

290-
#[deriving(Copy, PartialEq, Show)]
290+
#[derive(Copy, PartialEq, Show)]
291291
#[repr(uint)]
292292
enum Foo {
293293
A, B, C
@@ -491,7 +491,7 @@ mod test {
491491
#[should_fail]
492492
fn test_overflow() {
493493
#[allow(dead_code)]
494-
#[deriving(Copy)]
494+
#[derive(Copy)]
495495
#[repr(uint)]
496496
enum Bar {
497497
V00, V01, V02, V03, V04, V05, V06, V07, V08, V09,

src/libcollections/ring_buf.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use core::prelude::*;
1717
use core::cmp::Ordering;
1818
use core::default::Default;
1919
use core::fmt;
20-
use core::iter::{mod, FromIterator, RandomAccessIterator};
20+
use core::iter::{self, FromIterator, RandomAccessIterator};
2121
use core::kinds::marker;
2222
use core::mem;
2323
use core::num::{Int, UnsignedInt};
@@ -1139,7 +1139,7 @@ pub struct Iter<'a, T:'a> {
11391139
head: uint
11401140
}
11411141

1142-
// FIXME(#19839) Remove in favor of `#[deriving(Clone)]`
1142+
// FIXME(#19839) Remove in favor of `#[derive(Clone)]`
11431143
impl<'a, T> Clone for Iter<'a, T> {
11441144
fn clone(&self) -> Iter<'a, T> {
11451145
Iter {
@@ -1674,21 +1674,21 @@ mod tests {
16741674
})
16751675
}
16761676

1677-
#[deriving(Clone, PartialEq, Show)]
1677+
#[derive(Clone, PartialEq, Show)]
16781678
enum Taggy {
16791679
One(int),
16801680
Two(int, int),
16811681
Three(int, int, int),
16821682
}
16831683

1684-
#[deriving(Clone, PartialEq, Show)]
1684+
#[derive(Clone, PartialEq, Show)]
16851685
enum Taggypar<T> {
16861686
Onepar(int),
16871687
Twopar(int, int),
16881688
Threepar(int, int, int),
16891689
}
16901690

1691-
#[deriving(Clone, PartialEq, Show)]
1691+
#[derive(Clone, PartialEq, Show)]
16921692
struct RecCy {
16931693
x: int,
16941694
y: int,

src/libcollections/slice.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,15 @@
9090
use alloc::boxed::Box;
9191
use core::borrow::{BorrowFrom, BorrowFromMut, ToOwned};
9292
use core::clone::Clone;
93-
use core::cmp::Ordering::{mod, Greater, Less};
94-
use core::cmp::{mod, Ord, PartialEq};
93+
use core::cmp::Ordering::{self, Greater, Less};
94+
use core::cmp::{self, Ord, PartialEq};
9595
use core::iter::{Iterator, IteratorExt, IteratorCloneExt};
9696
use core::iter::{range, range_step, MultiplicativeIterator};
9797
use core::kinds::Sized;
9898
use core::mem::size_of;
9999
use core::mem;
100100
use core::ops::{FnMut, SliceMut};
101-
use core::option::Option::{mod, Some, None};
101+
use core::option::Option::{self, Some, None};
102102
use core::ptr::PtrExt;
103103
use core::ptr;
104104
use core::result::Result;
@@ -1083,7 +1083,7 @@ impl<T: Clone, V: AsSlice<T>> SliceConcatExt<T, Vec<T>> for [V] {
10831083
/// The last generated swap is always (0, 1), and it returns the
10841084
/// sequence to its initial order.
10851085
#[experimental]
1086-
#[deriving(Clone)]
1086+
#[derive(Clone)]
10871087
pub struct ElementSwaps {
10881088
sdir: Vec<SizeDirection>,
10891089
/// If `true`, emit the last swap that returns the sequence to initial
@@ -1130,11 +1130,11 @@ impl<T: Clone> ToOwned<Vec<T>> for [T] {
11301130
// Iterators
11311131
////////////////////////////////////////////////////////////////////////////////
11321132

1133-
#[deriving(Copy, Clone)]
1133+
#[derive(Copy, Clone)]
11341134
enum Direction { Pos, Neg }
11351135

11361136
/// An `Index` and `Direction` together.
1137-
#[deriving(Copy, Clone)]
1137+
#[derive(Copy, Clone)]
11381138
struct SizeDirection {
11391139
size: uint,
11401140
dir: Direction,
@@ -2709,7 +2709,7 @@ mod tests {
27092709
assert!(values == [2, 3, 5, 6, 7]);
27102710
}
27112711

2712-
#[deriving(Clone, PartialEq)]
2712+
#[derive(Clone, PartialEq)]
27132713
struct Foo;
27142714

27152715
#[test]

0 commit comments

Comments
 (0)