Skip to content

Commit c0d8626

Browse files
committed
---
yaml --- r: 39796 b: refs/heads/incoming c: 0de7aa5 h: refs/heads/master v: v3
1 parent 2c5cc63 commit c0d8626

File tree

6 files changed

+60
-46
lines changed

6 files changed

+60
-46
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: 3d5418789064fdb463e872a4e651af1c628a3650
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: a810c03263670238bccd64cabb12a23a46e3a278
9-
refs/heads/incoming: a82c8b3da2ce3d1ea288f58d20c07984ebaf930c
9+
refs/heads/incoming: 0de7aa55062485835bc45b962f306dddf42f372d
1010
refs/heads/dist-snap: 22efa39382d41b084fde1719df7ae8ce5697d8c9
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/src/libcore/core.rc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ pub mod util;
172172

173173
pub use kinds::{Const, Copy, Owned, Durable};
174174
pub use ops::{Drop};
175-
pub use ops::{Add, Sub, Mul, Div, Modulo, Neg};
175+
pub use ops::{Add, Sub, Mul, Div, Modulo, Neg, Not};
176176
pub use ops::{BitAnd, BitOr, BitXor};
177177
pub use ops::{Shl, Shr, Index};
178178

branches/incoming/src/libcore/ops.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ pub trait Neg<Result> {
4848
pure fn neg(&self) -> Result;
4949
}
5050

51+
#[lang="not"]
52+
pub trait Not<Result> {
53+
pure fn not(&self) -> Result;
54+
}
55+
5156
#[lang="bitand"]
5257
pub trait BitAnd<RHS,Result> {
5358
pure fn bitand(&self, rhs: &RHS) -> Result;
@@ -77,4 +82,3 @@ pub trait Shr<RHS,Result> {
7782
pub trait Index<Index,Result> {
7883
pure fn index(&self, index: Index) -> Result;
7984
}
80-

branches/incoming/src/libcore/prelude.rs

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

55
pub use kinds::{Const, Copy, Owned, Durable};
66
pub use ops::{Drop};
7-
pub use ops::{Add, Sub, Mul, Div, Modulo, Neg};
7+
pub use ops::{Add, Sub, Mul, Div, Modulo, Neg, Not};
88
pub use ops::{BitAnd, BitOr, BitXor};
99
pub use ops::{Shl, Shr, Index};
1010
pub use option::{Option, Some, None};

branches/incoming/src/librustc/middle/lang_items.rs

Lines changed: 47 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -50,36 +50,37 @@ pub enum LangItem {
5050
DivTraitLangItem, // 8
5151
ModuloTraitLangItem, // 9
5252
NegTraitLangItem, // 10
53-
BitXorTraitLangItem, // 11
54-
BitAndTraitLangItem, // 12
55-
BitOrTraitLangItem, // 13
56-
ShlTraitLangItem, // 14
57-
ShrTraitLangItem, // 15
58-
IndexTraitLangItem, // 16
59-
60-
EqTraitLangItem, // 17
61-
OrdTraitLangItem, // 18
62-
63-
StrEqFnLangItem, // 19
64-
UniqStrEqFnLangItem, // 20
65-
AnnihilateFnLangItem, // 21
66-
LogTypeFnLangItem, // 22
67-
FailFnLangItem, // 23
68-
FailBoundsCheckFnLangItem, // 24
69-
ExchangeMallocFnLangItem, // 25
70-
ExchangeFreeFnLangItem, // 26
71-
MallocFnLangItem, // 27
72-
FreeFnLangItem, // 28
53+
NotTraitLangItem, // 11
54+
BitXorTraitLangItem, // 12
55+
BitAndTraitLangItem, // 13
56+
BitOrTraitLangItem, // 14
57+
ShlTraitLangItem, // 15
58+
ShrTraitLangItem, // 16
59+
IndexTraitLangItem, // 17
60+
61+
EqTraitLangItem, // 18
62+
OrdTraitLangItem, // 19
63+
64+
StrEqFnLangItem, // 20
65+
UniqStrEqFnLangItem, // 21
66+
AnnihilateFnLangItem, // 22
67+
LogTypeFnLangItem, // 23
68+
FailFnLangItem, // 24
69+
FailBoundsCheckFnLangItem, // 25
70+
ExchangeMallocFnLangItem, // 26
71+
ExchangeFreeFnLangItem, // 27
72+
MallocFnLangItem, // 28
73+
FreeFnLangItem, // 29
7374
}
7475

7576
struct LanguageItems {
76-
items: [ Option<def_id> * 29 ]
77+
items: [ Option<def_id> * 30 ]
7778
}
7879

7980
impl LanguageItems {
8081
static pub fn new() -> LanguageItems {
8182
LanguageItems {
82-
items: [ None, ..29 ]
83+
items: [ None, ..30 ]
8384
}
8485
}
8586

@@ -106,25 +107,26 @@ impl LanguageItems {
106107
8 => "div",
107108
9 => "modulo",
108109
10 => "neg",
109-
11 => "bitxor",
110-
12 => "bitand",
111-
13 => "bitor",
112-
14 => "shl",
113-
15 => "shr",
114-
16 => "index",
115-
17 => "eq",
116-
18 => "ord",
117-
118-
19 => "str_eq",
119-
20 => "uniq_str_eq",
120-
21 => "annihilate",
121-
22 => "log_type",
122-
23 => "fail_",
123-
24 => "fail_bounds_check",
124-
25 => "exchange_malloc",
125-
26 => "exchange_free",
126-
27 => "malloc",
127-
28 => "free",
110+
11 => "not",
111+
12 => "bitxor",
112+
13 => "bitand",
113+
14 => "bitor",
114+
15 => "shl",
115+
16 => "shr",
116+
17 => "index",
117+
18 => "eq",
118+
19 => "ord",
119+
120+
20 => "str_eq",
121+
21 => "uniq_str_eq",
122+
22 => "annihilate",
123+
23 => "log_type",
124+
24 => "fail_",
125+
25 => "fail_bounds_check",
126+
26 => "exchange_malloc",
127+
27 => "exchange_free",
128+
28 => "malloc",
129+
29 => "free",
128130

129131
_ => "???"
130132
}
@@ -167,6 +169,9 @@ impl LanguageItems {
167169
pub fn neg_trait(&const self) -> def_id {
168170
self.items[NegTraitLangItem as uint].get()
169171
}
172+
pub fn not_trait(&const self) -> def_id {
173+
self.items[NotTraitLangItem as uint].get()
174+
}
170175
pub fn bitxor_trait(&const self) -> def_id {
171176
self.items[BitXorTraitLangItem as uint].get()
172177
}
@@ -244,6 +249,7 @@ fn LanguageItemCollector(crate: @crate,
244249
item_refs.insert(~"div", DivTraitLangItem as uint);
245250
item_refs.insert(~"modulo", ModuloTraitLangItem as uint);
246251
item_refs.insert(~"neg", NegTraitLangItem as uint);
252+
item_refs.insert(~"not", NotTraitLangItem as uint);
247253
item_refs.insert(~"bitxor", BitXorTraitLangItem as uint);
248254
item_refs.insert(~"bitand", BitAndTraitLangItem as uint);
249255
item_refs.insert(~"bitor", BitOrTraitLangItem as uint);

branches/incoming/src/librustc/middle/resolve.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ use syntax::ast::{ty_str, ty_u, ty_u16, ty_u32, ty_u64, ty_u8, ty_uint};
5454
use syntax::ast::{type_value_ns, ty_param_bound, unnamed_field};
5555
use syntax::ast::{variant, view_item, view_item_export, view_item_import};
5656
use syntax::ast::{view_item_use, view_path_glob, view_path_list};
57-
use syntax::ast::{view_path_simple, visibility, anonymous, named};
57+
use syntax::ast::{view_path_simple, visibility, anonymous, named, not};
5858
use syntax::ast_util::{def_id_of_def, dummy_sp, local_def};
5959
use syntax::ast_util::{path_to_ident, walk_pat, trait_method_to_ty_method};
6060
use syntax::ast_util::{Privacy, Public, Private, visibility_to_privacy};
@@ -5217,6 +5217,10 @@ impl Resolver {
52175217
self.add_fixed_trait_for_expr(expr.id,
52185218
self.lang_items.neg_trait());
52195219
}
5220+
expr_unary(not, _) => {
5221+
self.add_fixed_trait_for_expr(expr.id,
5222+
self.lang_items.not_trait());
5223+
}
52205224
expr_index(*) => {
52215225
self.add_fixed_trait_for_expr(expr.id,
52225226
self.lang_items.index_trait());

0 commit comments

Comments
 (0)