Skip to content

Commit 9ee1d93

Browse files
author
Jorge Aparicio
committed
---
yaml --- r: 163667 b: refs/heads/snap-stage3 c: e64a007 h: refs/heads/master i: 163665: e9e9fed 163663: 8ebc0df v: v3
1 parent e715522 commit 9ee1d93

37 files changed

+160
-427
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 9146a919b616e39e528e4d7100d16eef52f1f852
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: f2ef2cda526ba601cf5091f65cb12962a0ae0956
4+
refs/heads/snap-stage3: e64a0072d66f0071f47325711a226f34d7b76f05
55
refs/heads/try: 20cbbffeefc1f35e2ea63afce7b42fbd79611d42
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d

branches/snap-stage3/src/librustc/lint/builtin.rs

Lines changed: 21 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,9 @@ declare_lint! {
5656
"suggest using `loop { }` instead of `while true { }`"
5757
}
5858

59+
#[deriving(Copy)]
5960
pub struct WhileTrue;
6061

61-
impl Copy for WhileTrue {}
62-
6362
impl LintPass for WhileTrue {
6463
fn get_lints(&self) -> LintArray {
6564
lint_array!(WHILE_TRUE)
@@ -83,10 +82,9 @@ declare_lint! {
8382
"detects unnecessary type casts that can be removed"
8483
}
8584

85+
#[deriving(Copy)]
8686
pub struct UnusedCasts;
8787

88-
impl Copy for UnusedCasts {}
89-
9088
impl LintPass for UnusedCasts {
9189
fn get_lints(&self) -> LintArray {
9290
lint_array!(UNUSED_TYPECASTS)
@@ -126,13 +124,12 @@ declare_lint! {
126124
"shift exceeds the type's number of bits"
127125
}
128126

127+
#[deriving(Copy)]
129128
pub struct TypeLimits {
130129
/// Id of the last visited negated expression
131130
negated_expr_id: ast::NodeId,
132131
}
133132

134-
impl Copy for TypeLimits {}
135-
136133
impl TypeLimits {
137134
pub fn new() -> TypeLimits {
138135
TypeLimits {
@@ -442,10 +439,9 @@ impl<'a, 'tcx, 'v> Visitor<'v> for ImproperCTypesVisitor<'a, 'tcx> {
442439
}
443440
}
444441

442+
#[deriving(Copy)]
445443
pub struct ImproperCTypes;
446444

447-
impl Copy for ImproperCTypes {}
448-
449445
impl LintPass for ImproperCTypes {
450446
fn get_lints(&self) -> LintArray {
451447
lint_array!(IMPROPER_CTYPES)
@@ -486,10 +482,9 @@ declare_lint! {
486482
"use of owned (Box type) heap memory"
487483
}
488484

485+
#[deriving(Copy)]
489486
pub struct BoxPointers;
490487

491-
impl Copy for BoxPointers {}
492-
493488
impl BoxPointers {
494489
fn check_heap_type<'a, 'tcx>(&self, cx: &Context<'a, 'tcx>,
495490
span: Span, ty: Ty<'tcx>) {
@@ -627,10 +622,9 @@ declare_lint! {
627622
"detects attributes that were not used by the compiler"
628623
}
629624

625+
#[deriving(Copy)]
630626
pub struct UnusedAttributes;
631627

632-
impl Copy for UnusedAttributes {}
633-
634628
impl LintPass for UnusedAttributes {
635629
fn get_lints(&self) -> LintArray {
636630
lint_array!(UNUSED_ATTRIBUTES)
@@ -711,10 +705,9 @@ declare_lint! {
711705
"path statements with no effect"
712706
}
713707

708+
#[deriving(Copy)]
714709
pub struct PathStatements;
715710

716-
impl Copy for PathStatements {}
717-
718711
impl LintPass for PathStatements {
719712
fn get_lints(&self) -> LintArray {
720713
lint_array!(PATH_STATEMENTS)
@@ -746,10 +739,9 @@ declare_lint! {
746739
"unused result of an expression in a statement"
747740
}
748741

742+
#[deriving(Copy)]
749743
pub struct UnusedResults;
750744

751-
impl Copy for UnusedResults {}
752-
753745
impl LintPass for UnusedResults {
754746
fn get_lints(&self) -> LintArray {
755747
lint_array!(UNUSED_MUST_USE, UNUSED_RESULTS)
@@ -815,10 +807,9 @@ declare_lint! {
815807
"types, variants, traits and type parameters should have camel case names"
816808
}
817809

810+
#[deriving(Copy)]
818811
pub struct NonCamelCaseTypes;
819812

820-
impl Copy for NonCamelCaseTypes {}
821-
822813
impl NonCamelCaseTypes {
823814
fn check_case(&self, cx: &Context, sort: &str, ident: ast::Ident, span: Span) {
824815
fn is_camel_case(ident: ast::Ident) -> bool {
@@ -939,10 +930,9 @@ declare_lint! {
939930
"methods, functions, lifetime parameters and modules should have snake case names"
940931
}
941932

933+
#[deriving(Copy)]
942934
pub struct NonSnakeCase;
943935

944-
impl Copy for NonSnakeCase {}
945-
946936
impl NonSnakeCase {
947937
fn check_snake_case(&self, cx: &Context, sort: &str, ident: ast::Ident, span: Span) {
948938
fn is_snake_case(ident: ast::Ident) -> bool {
@@ -1053,10 +1043,9 @@ declare_lint! {
10531043
"static constants should have uppercase identifiers"
10541044
}
10551045

1046+
#[deriving(Copy)]
10561047
pub struct NonUpperCaseGlobals;
10571048

1058-
impl Copy for NonUpperCaseGlobals {}
1059-
10601049
impl LintPass for NonUpperCaseGlobals {
10611050
fn get_lints(&self) -> LintArray {
10621051
lint_array!(NON_UPPER_CASE_GLOBALS)
@@ -1107,10 +1096,9 @@ declare_lint! {
11071096
"`if`, `match`, `while` and `return` do not need parentheses"
11081097
}
11091098

1099+
#[deriving(Copy)]
11101100
pub struct UnusedParens;
11111101

1112-
impl Copy for UnusedParens {}
1113-
11141102
impl UnusedParens {
11151103
fn check_unused_parens_core(&self, cx: &Context, value: &ast::Expr, msg: &str,
11161104
struct_lit_needs_parens: bool) {
@@ -1202,10 +1190,9 @@ declare_lint! {
12021190
"unnecessary braces around an imported item"
12031191
}
12041192

1193+
#[deriving(Copy)]
12051194
pub struct UnusedImportBraces;
12061195

1207-
impl Copy for UnusedImportBraces {}
1208-
12091196
impl LintPass for UnusedImportBraces {
12101197
fn get_lints(&self) -> LintArray {
12111198
lint_array!(UNUSED_IMPORT_BRACES)
@@ -1242,10 +1229,9 @@ declare_lint! {
12421229
"using `Struct { x: x }` instead of `Struct { x }`"
12431230
}
12441231

1232+
#[deriving(Copy)]
12451233
pub struct NonShorthandFieldPatterns;
12461234

1247-
impl Copy for NonShorthandFieldPatterns {}
1248-
12491235
impl LintPass for NonShorthandFieldPatterns {
12501236
fn get_lints(&self) -> LintArray {
12511237
lint_array!(NON_SHORTHAND_FIELD_PATTERNS)
@@ -1276,10 +1262,9 @@ declare_lint! {
12761262
"unnecessary use of an `unsafe` block"
12771263
}
12781264

1265+
#[deriving(Copy)]
12791266
pub struct UnusedUnsafe;
12801267

1281-
impl Copy for UnusedUnsafe {}
1282-
12831268
impl LintPass for UnusedUnsafe {
12841269
fn get_lints(&self) -> LintArray {
12851270
lint_array!(UNUSED_UNSAFE)
@@ -1302,10 +1287,9 @@ declare_lint! {
13021287
"usage of an `unsafe` block"
13031288
}
13041289

1290+
#[deriving(Copy)]
13051291
pub struct UnsafeBlocks;
13061292

1307-
impl Copy for UnsafeBlocks {}
1308-
13091293
impl LintPass for UnsafeBlocks {
13101294
fn get_lints(&self) -> LintArray {
13111295
lint_array!(UNSAFE_BLOCKS)
@@ -1327,10 +1311,9 @@ declare_lint! {
13271311
"detect mut variables which don't need to be mutable"
13281312
}
13291313

1314+
#[deriving(Copy)]
13301315
pub struct UnusedMut;
13311316

1332-
impl Copy for UnusedMut {}
1333-
13341317
impl UnusedMut {
13351318
fn check_unused_mut_pat(&self, cx: &Context, pats: &[P<ast::Pat>]) {
13361319
// collect all mutable pattern and group their NodeIDs by their Identifier to
@@ -1397,10 +1380,9 @@ declare_lint! {
13971380
"detects unnecessary allocations that can be eliminated"
13981381
}
13991382

1383+
#[deriving(Copy)]
14001384
pub struct UnusedAllocation;
14011385

1402-
impl Copy for UnusedAllocation {}
1403-
14041386
impl LintPass for UnusedAllocation {
14051387
fn get_lints(&self) -> LintArray {
14061388
lint_array!(UNUSED_ALLOCATION)
@@ -1589,10 +1571,9 @@ impl LintPass for MissingDoc {
15891571
}
15901572
}
15911573

1574+
#[deriving(Copy)]
15921575
pub struct MissingCopyImplementations;
15931576

1594-
impl Copy for MissingCopyImplementations {}
1595-
15961577
impl LintPass for MissingCopyImplementations {
15971578
fn get_lints(&self) -> LintArray {
15981579
lint_array!(MISSING_COPY_IMPLEMENTATIONS)
@@ -1665,10 +1646,9 @@ declare_lint! {
16651646

16661647
/// Checks for use of items with `#[deprecated]`, `#[experimental]` and
16671648
/// `#[unstable]` attributes, or no stability attribute.
1649+
#[deriving(Copy)]
16681650
pub struct Stability;
16691651

1670-
impl Copy for Stability {}
1671-
16721652
impl Stability {
16731653
fn lint(&self, cx: &Context, id: ast::DefId, span: Span) {
16741654
let stability = stability::lookup(cx.tcx, id);
@@ -1903,10 +1883,9 @@ declare_lint!{
19031883

19041884
/// Does nothing as a lint pass, but registers some `Lint`s
19051885
/// which are used by other parts of the compiler.
1886+
#[deriving(Copy)]
19061887
pub struct HardwiredLints;
19071888

1908-
impl Copy for HardwiredLints {}
1909-
19101889
impl LintPass for HardwiredLints {
19111890
fn get_lints(&self) -> LintArray {
19121891
lint_array!(

branches/snap-stage3/src/librustc/lint/mod.rs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ use syntax::ast;
4242
pub use lint::context::{Context, LintStore, raw_emit_lint, check_crate, gather_attrs};
4343

4444
/// Specification of a single lint.
45+
#[deriving(Copy)]
4546
pub struct Lint {
4647
/// A string identifier for the lint.
4748
///
@@ -64,8 +65,6 @@ pub struct Lint {
6465
pub desc: &'static str,
6566
}
6667

67-
impl Copy for Lint {}
68-
6968
impl Lint {
7069
/// Get the lint's name, with ASCII letters converted to lowercase.
7170
pub fn name_lower(&self) -> String {
@@ -175,14 +174,12 @@ pub trait LintPass {
175174
pub type LintPassObject = Box<LintPass + 'static>;
176175

177176
/// Identifies a lint known to the compiler.
178-
#[deriving(Clone)]
177+
#[deriving(Clone, Copy)]
179178
pub struct LintId {
180179
// Identity is based on pointer equality of this field.
181180
lint: &'static Lint,
182181
}
183182

184-
impl Copy for LintId {}
185-
186183
impl PartialEq for LintId {
187184
fn eq(&self, other: &LintId) -> bool {
188185
(self.lint as *const Lint) == (other.lint as *const Lint)
@@ -213,13 +210,11 @@ impl LintId {
213210
}
214211

215212
/// Setting for how to handle a lint.
216-
#[deriving(Clone, PartialEq, PartialOrd, Eq, Ord)]
213+
#[deriving(Clone, Copy, PartialEq, PartialOrd, Eq, Ord)]
217214
pub enum Level {
218215
Allow, Warn, Deny, Forbid
219216
}
220217

221-
impl Copy for Level {}
222-
223218
impl Level {
224219
/// Convert a level to a lower-case string.
225220
pub fn as_str(self) -> &'static str {
@@ -244,7 +239,7 @@ impl Level {
244239
}
245240

246241
/// How a lint level was set.
247-
#[deriving(Clone, PartialEq, Eq)]
242+
#[deriving(Clone, Copy, PartialEq, Eq)]
248243
pub enum LintSource {
249244
/// Lint is at the default level as declared
250245
/// in rustc or a plugin.
@@ -257,8 +252,6 @@ pub enum LintSource {
257252
CommandLine,
258253
}
259254

260-
impl Copy for LintSource {}
261-
262255
pub type LevelSource = (Level, LintSource);
263256

264257
pub mod builtin;

branches/snap-stage3/src/librustc/metadata/common.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ pub const tag_items_data_item_reexport_def_id: uint = 0x39;
113113
pub const tag_items_data_item_reexport_name: uint = 0x3a;
114114

115115
// used to encode crate_ctxt side tables
116-
#[deriving(PartialEq)]
116+
#[deriving(Copy, PartialEq)]
117117
#[repr(uint)]
118118
pub enum astencode_tag { // Reserves 0x40 -- 0x5f
119119
tag_ast = 0x40,
@@ -145,7 +145,6 @@ pub enum astencode_tag { // Reserves 0x40 -- 0x5f
145145
tag_table_object_cast_map = 0x57,
146146
}
147147

148-
impl Copy for astencode_tag {}
149148
static first_astencode_tag: uint = tag_ast as uint;
150149
static last_astencode_tag: uint = tag_table_object_cast_map as uint;
151150
impl astencode_tag {

branches/snap-stage3/src/librustc/metadata/csearch.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,13 @@ use syntax::parse::token;
3333

3434
use std::collections::hash_map::HashMap;
3535

36+
#[deriving(Copy)]
3637
pub struct MethodInfo {
3738
pub name: ast::Name,
3839
pub def_id: ast::DefId,
3940
pub vis: ast::Visibility,
4041
}
4142

42-
impl Copy for MethodInfo {}
43-
4443
pub fn get_symbol(cstore: &cstore::CStore, def: ast::DefId) -> String {
4544
let cdata = cstore.get_crate_data(def.krate);
4645
decoder::get_symbol(cdata.data(), def.node)

branches/snap-stage3/src/librustc/metadata/cstore.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,23 +48,19 @@ pub struct crate_metadata {
4848
pub span: Span,
4949
}
5050

51-
#[deriving(Show, PartialEq, Clone)]
51+
#[deriving(Copy, Show, PartialEq, Clone)]
5252
pub enum LinkagePreference {
5353
RequireDynamic,
5454
RequireStatic,
5555
}
5656

57-
impl Copy for LinkagePreference {}
58-
59-
#[deriving(Clone, PartialEq, FromPrimitive)]
57+
#[deriving(Copy, Clone, PartialEq, FromPrimitive)]
6058
pub enum NativeLibraryKind {
6159
NativeStatic, // native static library (.a archive)
6260
NativeFramework, // OSX-specific
6361
NativeUnknown, // default way to specify a dynamic library
6462
}
6563

66-
impl Copy for NativeLibraryKind {}
67-
6864
// Where a crate came from on the local filesystem. One of these two options
6965
// must be non-None.
7066
#[deriving(PartialEq, Clone)]

0 commit comments

Comments
 (0)