Skip to content

Commit 88fe4ae

Browse files
committed
librustc: Remove the Copy bound from the language.
1 parent d57e8f8 commit 88fe4ae

File tree

18 files changed

+106
-194
lines changed

18 files changed

+106
-194
lines changed

src/libextra/flate.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ mod tests {
8787
use std::rand::RngUtil;
8888

8989
#[test]
90-
#[allow(non_implicitly_copyable_typarams)]
9190
fn test_flate_round_trip() {
9291
let mut r = rand::rng();
9392
let mut words = ~[];

src/libextra/future.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@ pub fn spawn<A:Send>(blk: ~fn() -> A) -> Future<A> {
145145
return from_port(port);
146146
}
147147

148-
#[allow(non_implicitly_copyable_typarams)]
149148
#[cfg(test)]
150149
mod test {
151150
use future::*;

src/libextra/par.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Cloneright 2012 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
//

src/libextra/test.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,6 @@ fn get_concurrency() -> uint {
671671
else { threads * SCHED_OVERCOMMIT }
672672
}
673673

674-
#[allow(non_implicitly_copyable_typarams)]
675674
pub fn filter_tests(
676675
opts: &TestOpts,
677676
tests: ~[TestDescAndFn]) -> ~[TestDescAndFn]

src/librustc/metadata/tydecode.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -561,9 +561,6 @@ fn parse_bounds(st: &mut PState, conv: conv_did) -> ty::ParamBounds {
561561
'S' => {
562562
param_bounds.builtin_bounds.add(ty::BoundSend);
563563
}
564-
'C' => {
565-
param_bounds.builtin_bounds.add(ty::BoundCopy);
566-
}
567564
'K' => {
568565
param_bounds.builtin_bounds.add(ty::BoundFreeze);
569566
}

src/librustc/metadata/tyencode.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,6 @@ fn enc_bounds(w: @io::Writer, cx: @ctxt, bs: &ty::ParamBounds) {
400400
for bs.builtin_bounds.each |bound| {
401401
match bound {
402402
ty::BoundSend => w.write_char('S'),
403-
ty::BoundCopy => w.write_char('C'),
404403
ty::BoundFreeze => w.write_char('K'),
405404
ty::BoundStatic => w.write_char('O'),
406405
ty::BoundSized => w.write_char('Z'),

src/librustc/middle/borrowck/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ impl BorrowckCtxt {
586586
ty::ty_closure(ref cty) if cty.sigil == ast::BorrowedSigil =>
587587
"a non-copyable stack closure (capture it in a new closure, \
588588
e.g. `|x| f(x)`, to override)",
589-
_ if !ty::type_is_copyable(tcx, ty) =>
589+
_ if ty::type_moves_by_default(tcx, ty) =>
590590
"non-copyable (perhaps you meant to use clone()?)",
591591
_ => default_msg,
592592
}

src/librustc/middle/kind.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,19 @@ use syntax::{visit, ast_util};
2929
// of the following attributes.
3030
//
3131
// send: Things that can be sent on channels or included in spawned closures.
32-
// copy: Things that can be copied.
3332
// freeze: Things thare are deeply immutable. They are guaranteed never to
3433
// change, and can be safely shared without copying between tasks.
3534
// 'static: Things that do not contain borrowed pointers.
3635
//
3736
// Send includes scalar types as well as classes and unique types containing
3837
// only sendable types.
3938
//
40-
// Copy includes boxes, closure and unique types containing copyable types.
41-
//
4239
// Freeze include scalar types, things without non-const fields, and pointers
4340
// to freezable things.
4441
//
4542
// This pass ensures that type parameters are only instantiated with types
4643
// whose kinds are equal or less general than the way the type parameter was
47-
// annotated (with the `Send`, `Copy` or `Freeze` bound).
44+
// annotated (with the `Send` or `Freeze` bound).
4845
//
4946
// It also verifies that noncopyable kinds are not copied. Sendability is not
5047
// applied, since none of our language primitives send. Instead, the sending

src/librustc/middle/lang_items.rs

Lines changed: 93 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// Language items are items that represent concepts intrinsic to the language
1414
// itself. Examples are:
1515
//
16-
// * Traits that specify "kinds"; e.g. "Freeze", "Copy", "Send".
16+
// * Traits that specify "kinds"; e.g. "Freeze", "Send".
1717
//
1818
// * Traits that represent operators; e.g. "Add", "Sub", "Index".
1919
//
@@ -33,63 +33,62 @@ use std::hashmap::HashMap;
3333

3434
pub enum LangItem {
3535
FreezeTraitLangItem, // 0
36-
CopyTraitLangItem, // 1
37-
SendTraitLangItem, // 2
38-
SizedTraitLangItem, // 3
39-
40-
DropTraitLangItem, // 4
41-
42-
AddTraitLangItem, // 5
43-
SubTraitLangItem, // 6
44-
MulTraitLangItem, // 7
45-
DivTraitLangItem, // 8
46-
RemTraitLangItem, // 9
47-
NegTraitLangItem, // 10
48-
NotTraitLangItem, // 11
36+
SendTraitLangItem, // 1
37+
SizedTraitLangItem, // 2
38+
39+
DropTraitLangItem, // 3
40+
41+
AddTraitLangItem, // 4
42+
SubTraitLangItem, // 5
43+
MulTraitLangItem, // 6
44+
DivTraitLangItem, // 7
45+
RemTraitLangItem, // 8
46+
NegTraitLangItem, // 9
47+
NotTraitLangItem, // 10
4948
BitXorTraitLangItem, // 11
50-
BitAndTraitLangItem, // 13
51-
BitOrTraitLangItem, // 14
52-
ShlTraitLangItem, // 15
53-
ShrTraitLangItem, // 16
54-
IndexTraitLangItem, // 17
55-
56-
EqTraitLangItem, // 18
57-
OrdTraitLangItem, // 19
58-
59-
StrEqFnLangItem, // 20
60-
UniqStrEqFnLangItem, // 21
61-
AnnihilateFnLangItem, // 22
62-
LogTypeFnLangItem, // 23
63-
FailFnLangItem, // 24
64-
FailBoundsCheckFnLangItem, // 25
65-
ExchangeMallocFnLangItem, // 26
66-
ClosureExchangeMallocFnLangItem, // 27
67-
ExchangeFreeFnLangItem, // 28
68-
MallocFnLangItem, // 29
69-
FreeFnLangItem, // 30
70-
BorrowAsImmFnLangItem, // 31
71-
BorrowAsMutFnLangItem, // 32
72-
ReturnToMutFnLangItem, // 33
73-
CheckNotBorrowedFnLangItem, // 34
74-
StrDupUniqFnLangItem, // 35
75-
RecordBorrowFnLangItem, // 36
76-
UnrecordBorrowFnLangItem, // 37
77-
78-
StartFnLangItem, // 38
79-
80-
TyDescStructLangItem, // 39
81-
TyVisitorTraitLangItem, // 40
82-
OpaqueStructLangItem, // 41
49+
BitAndTraitLangItem, // 12
50+
BitOrTraitLangItem, // 13
51+
ShlTraitLangItem, // 14
52+
ShrTraitLangItem, // 15
53+
IndexTraitLangItem, // 16
54+
55+
EqTraitLangItem, // 17
56+
OrdTraitLangItem, // 18
57+
58+
StrEqFnLangItem, // 19
59+
UniqStrEqFnLangItem, // 20
60+
AnnihilateFnLangItem, // 21
61+
LogTypeFnLangItem, // 22
62+
FailFnLangItem, // 23
63+
FailBoundsCheckFnLangItem, // 24
64+
ExchangeMallocFnLangItem, // 25
65+
ClosureExchangeMallocFnLangItem, // 26
66+
ExchangeFreeFnLangItem, // 27
67+
MallocFnLangItem, // 28
68+
FreeFnLangItem, // 29
69+
BorrowAsImmFnLangItem, // 30
70+
BorrowAsMutFnLangItem, // 31
71+
ReturnToMutFnLangItem, // 32
72+
CheckNotBorrowedFnLangItem, // 33
73+
StrDupUniqFnLangItem, // 34
74+
RecordBorrowFnLangItem, // 35
75+
UnrecordBorrowFnLangItem, // 36
76+
77+
StartFnLangItem, // 37
78+
79+
TyDescStructLangItem, // 38
80+
TyVisitorTraitLangItem, // 39
81+
OpaqueStructLangItem, // 40
8382
}
8483

8584
pub struct LanguageItems {
86-
items: [Option<def_id>, ..42]
85+
items: [Option<def_id>, ..41]
8786
}
8887

8988
impl LanguageItems {
9089
pub fn new() -> LanguageItems {
9190
LanguageItems {
92-
items: [ None, ..42 ]
91+
items: [ None, ..41 ]
9392
}
9493
}
9594

@@ -100,52 +99,51 @@ impl LanguageItems {
10099
pub fn item_name(index: uint) -> &'static str {
101100
match index {
102101
0 => "freeze",
103-
1 => "copy",
104-
2 => "send",
105-
3 => "sized",
106-
107-
4 => "drop",
108-
109-
5 => "add",
110-
6 => "sub",
111-
7 => "mul",
112-
8 => "div",
113-
9 => "rem",
114-
10 => "neg",
115-
11 => "not",
116-
12 => "bitxor",
117-
13 => "bitand",
118-
14 => "bitor",
119-
15 => "shl",
120-
16 => "shr",
121-
17 => "index",
122-
18 => "eq",
123-
19 => "ord",
124-
125-
20 => "str_eq",
126-
21 => "uniq_str_eq",
127-
22 => "annihilate",
128-
23 => "log_type",
129-
24 => "fail_",
130-
25 => "fail_bounds_check",
131-
26 => "exchange_malloc",
132-
27 => "closure_exchange_malloc",
133-
28 => "exchange_free",
134-
29 => "malloc",
135-
30 => "free",
136-
31 => "borrow_as_imm",
137-
32 => "borrow_as_mut",
138-
33 => "return_to_mut",
139-
34 => "check_not_borrowed",
140-
35 => "strdup_uniq",
141-
36 => "record_borrow",
142-
37 => "unrecord_borrow",
143-
144-
38 => "start",
145-
146-
39 => "ty_desc",
147-
40 => "ty_visitor",
148-
41 => "opaque",
102+
1 => "send",
103+
2 => "sized",
104+
105+
3 => "drop",
106+
107+
4 => "add",
108+
5 => "sub",
109+
6 => "mul",
110+
7 => "div",
111+
8 => "rem",
112+
9 => "neg",
113+
10 => "not",
114+
11 => "bitxor",
115+
12 => "bitand",
116+
13 => "bitor",
117+
14 => "shl",
118+
15 => "shr",
119+
16 => "index",
120+
17 => "eq",
121+
18 => "ord",
122+
123+
19 => "str_eq",
124+
20 => "uniq_str_eq",
125+
21 => "annihilate",
126+
22 => "log_type",
127+
23 => "fail_",
128+
24 => "fail_bounds_check",
129+
25 => "exchange_malloc",
130+
26 => "closure_exchange_malloc",
131+
27 => "exchange_free",
132+
28 => "malloc",
133+
29 => "free",
134+
30 => "borrow_as_imm",
135+
31 => "borrow_as_mut",
136+
32 => "return_to_mut",
137+
33 => "check_not_borrowed",
138+
34 => "strdup_uniq",
139+
35 => "record_borrow",
140+
36 => "unrecord_borrow",
141+
142+
37 => "start",
143+
144+
38 => "ty_desc",
145+
39 => "ty_visitor",
146+
40 => "opaque",
149147

150148
_ => "???"
151149
}
@@ -164,9 +162,6 @@ impl LanguageItems {
164162
pub fn freeze_trait(&self) -> Option<def_id> {
165163
self.items[FreezeTraitLangItem as uint]
166164
}
167-
pub fn copy_trait(&self) -> Option<def_id> {
168-
self.items[CopyTraitLangItem as uint]
169-
}
170165
pub fn send_trait(&self) -> Option<def_id> {
171166
self.items[SendTraitLangItem as uint]
172167
}
@@ -308,7 +303,6 @@ impl<'self> LanguageItemCollector<'self> {
308303
let mut item_refs = HashMap::new();
309304

310305
item_refs.insert(@"freeze", FreezeTraitLangItem as uint);
311-
item_refs.insert(@"copy", CopyTraitLangItem as uint);
312306
item_refs.insert(@"send", SendTraitLangItem as uint);
313307
item_refs.insert(@"sized", SizedTraitLangItem as uint);
314308

src/librustc/middle/lint.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ pub enum lint {
7676
path_statement,
7777
implicit_copies,
7878
unrecognized_lint,
79-
non_implicitly_copyable_typarams,
8079
deprecated_pattern,
8180
non_camel_case_types,
8281
non_uppercase_statics,
@@ -182,13 +181,6 @@ static lint_table: &'static [(&'static str, LintSpec)] = &[
182181
default: warn
183182
}),
184183

185-
("non_implicitly_copyable_typarams",
186-
LintSpec {
187-
lint: non_implicitly_copyable_typarams,
188-
desc: "passing non implicitly copyable types as copy type params",
189-
default: warn
190-
}),
191-
192184
("implicit_copies",
193185
LintSpec {
194186
lint: implicit_copies,

0 commit comments

Comments
 (0)