Skip to content

Commit f161cf0

Browse files
committed
---
yaml --- r: 52118 b: refs/heads/dist-snap c: fa96740 h: refs/heads/master v: v3
1 parent 25925f4 commit f161cf0

File tree

6 files changed

+98
-86
lines changed

6 files changed

+98
-86
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
99
refs/heads/incoming: 44d4d6de762f3f9aae1fedcf454c66b79b3ad58d
10-
refs/heads/dist-snap: 1070cc0109661d9f47a6e2c39ad853041ddf30e2
10+
refs/heads/dist-snap: fa967409232c06c35fb100aac65ff274d4d6c30d
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1313
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/librustc/middle/lint.rs

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,12 @@ impl lint : cmp::Eq {
105105
pure fn ne(&self, other: &lint) -> bool { !(*self).eq(other) }
106106
}
107107

108-
fn level_to_str(lv: level) -> ~str {
108+
fn level_to_str(lv: level) -> &static/str {
109109
match lv {
110-
allow => ~"allow",
111-
warn => ~"warn",
112-
deny => ~"deny",
113-
forbid => ~"forbid"
110+
allow => "allow",
111+
warn => "warn",
112+
deny => "deny",
113+
forbid => "forbid"
114114
}
115115
}
116116

@@ -126,7 +126,7 @@ impl level : cmp::Eq {
126126
}
127127

128128
type lint_spec = @{lint: lint,
129-
desc: ~str,
129+
desc: &static/str,
130130
default: level};
131131

132132
type lint_dict = HashMap<~str,lint_spec>;
@@ -139,109 +139,109 @@ fn get_lint_dict() -> lint_dict {
139139
let v = ~[
140140
(~"ctypes",
141141
@{lint: ctypes,
142-
desc: ~"proper use of core::libc types in foreign modules",
142+
desc: "proper use of core::libc types in foreign modules",
143143
default: warn}),
144144

145145
(~"unused_imports",
146146
@{lint: unused_imports,
147-
desc: ~"imports that are never used",
147+
desc: "imports that are never used",
148148
default: allow}),
149149

150150
(~"while_true",
151151
@{lint: while_true,
152-
desc: ~"suggest using loop { } instead of while(true) { }",
152+
desc: "suggest using loop { } instead of while(true) { }",
153153
default: warn}),
154154

155155
(~"path_statement",
156156
@{lint: path_statement,
157-
desc: ~"path statements with no effect",
157+
desc: "path statements with no effect",
158158
default: warn}),
159159

160160
(~"unrecognized_lint",
161161
@{lint: unrecognized_lint,
162-
desc: ~"unrecognized lint attribute",
162+
desc: "unrecognized lint attribute",
163163
default: warn}),
164164

165165
(~"non_implicitly_copyable_typarams",
166166
@{lint: non_implicitly_copyable_typarams,
167-
desc: ~"passing non implicitly copyable types as copy type params",
167+
desc: "passing non implicitly copyable types as copy type params",
168168
default: warn}),
169169

170170
(~"vecs_implicitly_copyable",
171171
@{lint: vecs_implicitly_copyable,
172-
desc: ~"make vecs and strs not implicitly copyable \
172+
desc: "make vecs and strs not implicitly copyable \
173173
(only checked at top level)",
174174
default: warn}),
175175

176176
(~"implicit_copies",
177177
@{lint: implicit_copies,
178-
desc: ~"implicit copies of non implicitly copyable data",
178+
desc: "implicit copies of non implicitly copyable data",
179179
default: warn}),
180180

181181
(~"deprecated_mode",
182182
@{lint: deprecated_mode,
183-
desc: ~"warn about deprecated uses of modes",
183+
desc: "warn about deprecated uses of modes",
184184
default: warn}),
185185

186186
(~"deprecated_pattern",
187187
@{lint: deprecated_pattern,
188-
desc: ~"warn about deprecated uses of pattern bindings",
188+
desc: "warn about deprecated uses of pattern bindings",
189189
default: allow}),
190190

191191
(~"non_camel_case_types",
192192
@{lint: non_camel_case_types,
193-
desc: ~"types, variants and traits should have camel case names",
193+
desc: "types, variants and traits should have camel case names",
194194
default: allow}),
195195

196196
(~"managed_heap_memory",
197197
@{lint: managed_heap_memory,
198-
desc: ~"use of managed (@ type) heap memory",
198+
desc: "use of managed (@ type) heap memory",
199199
default: allow}),
200200

201201
(~"owned_heap_memory",
202202
@{lint: owned_heap_memory,
203-
desc: ~"use of owned (~ type) heap memory",
203+
desc: "use of owned (~ type) heap memory",
204204
default: allow}),
205205

206206
(~"heap_memory",
207207
@{lint: heap_memory,
208-
desc: ~"use of any (~ type or @ type) heap memory",
208+
desc: "use of any (~ type or @ type) heap memory",
209209
default: allow}),
210210

211211
(~"structural_records",
212212
@{lint: structural_records,
213-
desc: ~"use of any structural records",
213+
desc: "use of any structural records",
214214
default: allow}),
215215

216216
(~"legacy modes",
217217
@{lint: legacy_modes,
218-
desc: ~"allow legacy modes",
218+
desc: "allow legacy modes",
219219
default: forbid}),
220220

221221
(~"type_limits",
222222
@{lint: type_limits,
223-
desc: ~"comparisons made useless by limits of the types involved",
223+
desc: "comparisons made useless by limits of the types involved",
224224
default: warn}),
225225

226226
(~"default_methods",
227227
@{lint: default_methods,
228-
desc: ~"allow default methods",
228+
desc: "allow default methods",
229229
default: deny}),
230230

231231
(~"deprecated_self",
232232
@{lint: deprecated_self,
233-
desc: ~"warn about deprecated uses of `self`",
233+
desc: "warn about deprecated uses of `self`",
234234
default: allow}),
235235

236236
/* FIXME(#3266)--make liveness warnings lintable
237237
(~"unused_variable",
238238
@{lint: unused_variable,
239-
desc: ~"detect variables which are not used in any way",
239+
desc: "detect variables which are not used in any way",
240240
default: warn}),
241241
242242
(~"dead_assignment",
243243
@{lint: dead_assignment,
244-
desc: ~"detect assignments that will never be read",
244+
desc: "detect assignments that will never be read",
245245
default: warn}),
246246
*/
247247
];

branches/dist-snap/src/librustc/middle/ty.rs

Lines changed: 33 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ use core::dvec::DVec;
3333
use core::dvec;
3434
use core::ops;
3535
use core::option;
36+
use core::ptr::to_unsafe_ptr;
3637
use core::result::Result;
3738
use core::result;
3839
use core::to_bytes;
@@ -304,18 +305,22 @@ impl creader_cache_key : to_bytes::IterBytes {
304305
}
305306
}
306307

307-
type intern_key = {sty: sty, o_def_id: Option<ast::def_id>};
308+
type intern_key = {sty: *sty, o_def_id: Option<ast::def_id>};
308309

309310
impl intern_key : cmp::Eq {
310311
pure fn eq(&self, other: &intern_key) -> bool {
311-
(*self).sty == (*other).sty && (*self).o_def_id == (*other).o_def_id
312+
unsafe {
313+
*self.sty == *other.sty && self.o_def_id == other.o_def_id
314+
}
312315
}
313316
pure fn ne(&self, other: &intern_key) -> bool { !(*self).eq(other) }
314317
}
315318

316319
impl intern_key : to_bytes::IterBytes {
317320
pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
318-
to_bytes::iter_bytes_2(&self.sty, &self.o_def_id, lsb0, f);
321+
unsafe {
322+
to_bytes::iter_bytes_2(&*self.sty, &self.o_def_id, lsb0, f);
323+
}
319324
}
320325
}
321326

@@ -1008,11 +1013,12 @@ fn mk_t(cx: ctxt, +st: sty) -> t { mk_t_with_id(cx, st, None) }
10081013
// Interns a type/name combination, stores the resulting box in cx.interner,
10091014
// and returns the box as cast to an unsafe ptr (see comments for t above).
10101015
fn mk_t_with_id(cx: ctxt, +st: sty, o_def_id: Option<ast::def_id>) -> t {
1011-
let key = {sty: st, o_def_id: o_def_id};
1016+
let key = {sty: to_unsafe_ptr(&st), o_def_id: o_def_id};
10121017
match cx.interner.find(key) {
10131018
Some(t) => unsafe { return cast::reinterpret_cast(&t); },
10141019
_ => ()
10151020
}
1021+
10161022
let mut flags = 0u;
10171023
fn rflags(r: Region) -> uint {
10181024
(has_regions as uint) | {
@@ -1028,42 +1034,46 @@ fn mk_t_with_id(cx: ctxt, +st: sty, o_def_id: Option<ast::def_id>) -> t {
10281034
substs.self_r.iter(|r| f |= rflags(*r));
10291035
return f;
10301036
}
1031-
match st {
1032-
ty_estr(vstore_slice(r)) => {
1037+
match &st {
1038+
&ty_estr(vstore_slice(r)) => {
10331039
flags |= rflags(r);
10341040
}
1035-
ty_evec(mt, vstore_slice(r)) => {
1041+
&ty_evec(ref mt, vstore_slice(r)) => {
10361042
flags |= rflags(r);
10371043
flags |= get(mt.ty).flags;
10381044
}
1039-
ty_nil | ty_bot | ty_bool | ty_int(_) | ty_float(_) | ty_uint(_) |
1040-
ty_estr(_) | ty_type | ty_opaque_closure_ptr(_) |
1041-
ty_opaque_box | ty_err => (),
1042-
ty_param(_) => flags |= has_params as uint,
1043-
ty_infer(_) => flags |= needs_infer as uint,
1044-
ty_self => flags |= has_self as uint,
1045-
ty_enum(_, ref substs) | ty_struct(_, ref substs)
1046-
| ty_trait(_, ref substs, _) => {
1045+
&ty_nil | &ty_bot | &ty_bool | &ty_int(_) | &ty_float(_) | &ty_uint(_) |
1046+
&ty_estr(_) | &ty_type | &ty_opaque_closure_ptr(_) |
1047+
&ty_opaque_box | &ty_err => (),
1048+
&ty_param(_) => flags |= has_params as uint,
1049+
&ty_infer(_) => flags |= needs_infer as uint,
1050+
&ty_self => flags |= has_self as uint,
1051+
&ty_enum(_, ref substs) | &ty_struct(_, ref substs) |
1052+
&ty_trait(_, ref substs, _) => {
10471053
flags |= sflags(substs);
10481054
}
1049-
ty_box(m) | ty_uniq(m) | ty_evec(m, _) |
1050-
ty_ptr(m) | ty_unboxed_vec(m) => {
1055+
&ty_box(ref m) | &ty_uniq(ref m) | &ty_evec(ref m, _) |
1056+
&ty_ptr(ref m) | &ty_unboxed_vec(ref m) => {
10511057
flags |= get(m.ty).flags;
10521058
}
1053-
ty_rptr(r, m) => {
1059+
&ty_rptr(r, ref m) => {
10541060
flags |= rflags(r);
10551061
flags |= get(m.ty).flags;
10561062
}
1057-
ty_rec(flds) => for flds.each |f| { flags |= get(f.mt.ty).flags; },
1058-
ty_tup(ts) => for ts.each |tt| { flags |= get(*tt).flags; },
1059-
ty_fn(ref f) => {
1063+
&ty_rec(ref flds) => for flds.each |f| { flags |= get(f.mt.ty).flags; },
1064+
&ty_tup(ref ts) => for ts.each |tt| { flags |= get(*tt).flags; },
1065+
&ty_fn(ref f) => {
10601066
flags |= rflags(f.meta.region);
10611067
for f.sig.inputs.each |a| { flags |= get(a.ty).flags; }
10621068
flags |= get(f.sig.output).flags;
10631069
}
10641070
}
1065-
let t = @{sty: st, id: cx.next_id, flags: flags, o_def_id: o_def_id};
1066-
cx.interner.insert(key, t);
1071+
1072+
let t = @{sty: move st, id: cx.next_id, flags: flags, o_def_id: o_def_id};
1073+
1074+
let key = {sty: to_unsafe_ptr(&t.sty), o_def_id: o_def_id};
1075+
cx.interner.insert(move key, t);
1076+
10671077
cx.next_id += 1u;
10681078
unsafe { cast::reinterpret_cast(&t) }
10691079
}

branches/dist-snap/src/librustc/middle/typeck/infer/combine.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@
5454
// terms of error reporting, although we do not do that properly right
5555
// now.
5656

57+
#[warn(vecs_implicitly_copyable)];
58+
5759
use middle::ty;
5860
use middle::ty::{FnTyBase, FnMeta, FnSig};
5961
use middle::typeck::infer::sub::Sub;

0 commit comments

Comments
 (0)