Skip to content

Commit d5ad126

Browse files
committed
---
yaml --- r: 63879 b: refs/heads/snap-stage3 c: ba922a4 h: refs/heads/master i: 63877: 39ba4c0 63875: 96b8431 63871: 2ae6147 v: v3
1 parent cd47e1f commit d5ad126

40 files changed

+198
-341
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: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 3bad7129ebb13d7a4c0a7965aeb5bd536cc0f5f0
4+
refs/heads/snap-stage3: ba922a4027f407dd28ab0e699837109ca99ff1ae
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/libextra/arc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,8 +436,8 @@ impl<T:Freeze + Send> RWARC<T> {
436436
// lock it. This wraps the unsafety, with the justification that the 'lock'
437437
// field is never overwritten; only 'failed' and 'data'.
438438
#[doc(hidden)]
439-
fn borrow_rwlock<T:Freeze + Send>(state: *mut RWARCInner<T>) -> *RWlock {
440-
unsafe { cast::transmute(&(*state).lock) }
439+
fn borrow_rwlock<T:Freeze + Send>(state: *const RWARCInner<T>) -> *RWlock {
440+
unsafe { cast::transmute(&const (*state).lock) }
441441
}
442442

443443
/// The "write permission" token used for RWARC.write_downgrade().

branches/snap-stage3/src/libextra/bitv.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -705,8 +705,8 @@ impl cmp::Eq for BitvSet {
705705
}
706706

707707
impl Container for BitvSet {
708-
fn len(&self) -> uint { self.size }
709-
fn is_empty(&self) -> bool { self.size == 0 }
708+
fn len(&const self) -> uint { self.size }
709+
fn is_empty(&const self) -> bool { self.size == 0 }
710710
}
711711

712712
impl Mutable for BitvSet {

branches/snap-stage3/src/libextra/deque.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ pub struct Deque<T> {
2828

2929
impl<T> Container for Deque<T> {
3030
/// Return the number of elements in the deque
31-
fn len(&self) -> uint { self.nelts }
31+
fn len(&const self) -> uint { self.nelts }
3232

3333
/// Return true if the deque contains no elements
34-
fn is_empty(&self) -> bool { self.len() == 0 }
34+
fn is_empty(&const self) -> bool { self.len() == 0 }
3535
}
3636

3737
impl<T> Mutable for Deque<T> {

branches/snap-stage3/src/libextra/flate.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ static lz_fast : c_int = 0x1; // LZ with only one probe
4444
static lz_norm : c_int = 0x80; // LZ with 128 probes, "normal"
4545
static lz_best : c_int = 0xfff; // LZ with 4095 probes, "best"
4646

47-
pub fn deflate_bytes(bytes: &[u8]) -> ~[u8] {
48-
do vec::as_imm_buf(bytes) |b, len| {
47+
pub fn deflate_bytes(bytes: &const [u8]) -> ~[u8] {
48+
do vec::as_const_buf(bytes) |b, len| {
4949
unsafe {
5050
let mut outsz : size_t = 0;
5151
let res =
@@ -62,8 +62,8 @@ pub fn deflate_bytes(bytes: &[u8]) -> ~[u8] {
6262
}
6363
}
6464

65-
pub fn inflate_bytes(bytes: &[u8]) -> ~[u8] {
66-
do vec::as_imm_buf(bytes) |b, len| {
65+
pub fn inflate_bytes(bytes: &const [u8]) -> ~[u8] {
66+
do vec::as_const_buf(bytes) |b, len| {
6767
unsafe {
6868
let mut outsz : size_t = 0;
6969
let res =

branches/snap-stage3/src/libextra/treemap.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,10 @@ impl<K: Ord + TotalOrd, V> Ord for TreeMap<K, V> {
8787

8888
impl<K: TotalOrd, V> Container for TreeMap<K, V> {
8989
/// Return the number of elements in the map
90-
fn len(&self) -> uint { self.length }
90+
fn len(&const self) -> uint { self.length }
9191

9292
/// Return true if the map contains no elements
93-
fn is_empty(&self) -> bool { self.root.is_none() }
93+
fn is_empty(&const self) -> bool { self.root.is_none() }
9494
}
9595

9696
impl<K: TotalOrd, V> Mutable for TreeMap<K, V> {
@@ -265,11 +265,11 @@ impl<T: Ord + TotalOrd> Ord for TreeSet<T> {
265265
impl<T: TotalOrd> Container for TreeSet<T> {
266266
/// Return the number of elements in the set
267267
#[inline]
268-
fn len(&self) -> uint { self.map.len() }
268+
fn len(&const self) -> uint { self.map.len() }
269269

270270
/// Return true if the set contains no elements
271271
#[inline]
272-
fn is_empty(&self) -> bool { self.map.is_empty() }
272+
fn is_empty(&const self) -> bool { self.map.is_empty() }
273273
}
274274

275275
impl<T: TotalOrd> Mutable for TreeSet<T> {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,7 @@ fn get_explicit_self(item: ebml::Doc) -> ast::explicit_self_ {
786786
's' => { return ast::sty_static; }
787787
'v' => { return ast::sty_value; }
788788
'@' => { return ast::sty_box(get_mutability(string[1])); }
789-
'~' => { return ast::sty_uniq; }
789+
'~' => { return ast::sty_uniq(get_mutability(string[1])); }
790790
'&' => {
791791
// FIXME(#4846) expl. region
792792
return ast::sty_region(None, get_mutability(string[1]));

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,8 +630,9 @@ fn encode_explicit_self(ebml_w: &mut writer::Encoder, explicit_self: ast::explic
630630
ebml_w.writer.write(&[ '@' as u8 ]);
631631
encode_mutability(ebml_w, m);
632632
}
633-
sty_uniq => {
633+
sty_uniq(m) => {
634634
ebml_w.writer.write(&[ '~' as u8 ]);
635+
encode_mutability(ebml_w, m);
635636
}
636637
}
637638

branches/snap-stage3/src/librustc/middle/check_const.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ pub fn check_expr(sess: Session,
9292
if is_const {
9393
match e.node {
9494
expr_unary(_, deref, _) => { }
95-
expr_unary(_, box(_), _) | expr_unary(_, uniq, _) => {
95+
expr_unary(_, box(_), _) | expr_unary(_, uniq(_), _) => {
9696
sess.span_err(e.span,
9797
"disallowed operator in constant expression");
9898
return;

branches/snap-stage3/src/librustc/middle/lang_items.rs

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -152,122 +152,122 @@ impl LanguageItems {
152152

153153
// FIXME #4621: Method macros sure would be nice here.
154154

155-
pub fn freeze_trait(&self) -> def_id {
155+
pub fn freeze_trait(&const self) -> def_id {
156156
self.items[FreezeTraitLangItem as uint].get()
157157
}
158-
pub fn copy_trait(&self) -> def_id {
158+
pub fn copy_trait(&const self) -> def_id {
159159
self.items[CopyTraitLangItem as uint].get()
160160
}
161-
pub fn send_trait(&self) -> def_id {
161+
pub fn send_trait(&const self) -> def_id {
162162
self.items[SendTraitLangItem as uint].get()
163163
}
164-
pub fn sized_trait(&self) -> def_id {
164+
pub fn sized_trait(&const self) -> def_id {
165165
self.items[SizedTraitLangItem as uint].get()
166166
}
167167

168-
pub fn drop_trait(&self) -> def_id {
168+
pub fn drop_trait(&const self) -> def_id {
169169
self.items[DropTraitLangItem as uint].get()
170170
}
171171

172-
pub fn add_trait(&self) -> def_id {
172+
pub fn add_trait(&const self) -> def_id {
173173
self.items[AddTraitLangItem as uint].get()
174174
}
175-
pub fn sub_trait(&self) -> def_id {
175+
pub fn sub_trait(&const self) -> def_id {
176176
self.items[SubTraitLangItem as uint].get()
177177
}
178-
pub fn mul_trait(&self) -> def_id {
178+
pub fn mul_trait(&const self) -> def_id {
179179
self.items[MulTraitLangItem as uint].get()
180180
}
181-
pub fn div_trait(&self) -> def_id {
181+
pub fn div_trait(&const self) -> def_id {
182182
self.items[DivTraitLangItem as uint].get()
183183
}
184-
pub fn rem_trait(&self) -> def_id {
184+
pub fn rem_trait(&const self) -> def_id {
185185
self.items[RemTraitLangItem as uint].get()
186186
}
187-
pub fn neg_trait(&self) -> def_id {
187+
pub fn neg_trait(&const self) -> def_id {
188188
self.items[NegTraitLangItem as uint].get()
189189
}
190-
pub fn not_trait(&self) -> def_id {
190+
pub fn not_trait(&const self) -> def_id {
191191
self.items[NotTraitLangItem as uint].get()
192192
}
193-
pub fn bitxor_trait(&self) -> def_id {
193+
pub fn bitxor_trait(&const self) -> def_id {
194194
self.items[BitXorTraitLangItem as uint].get()
195195
}
196-
pub fn bitand_trait(&self) -> def_id {
196+
pub fn bitand_trait(&const self) -> def_id {
197197
self.items[BitAndTraitLangItem as uint].get()
198198
}
199-
pub fn bitor_trait(&self) -> def_id {
199+
pub fn bitor_trait(&const self) -> def_id {
200200
self.items[BitOrTraitLangItem as uint].get()
201201
}
202-
pub fn shl_trait(&self) -> def_id {
202+
pub fn shl_trait(&const self) -> def_id {
203203
self.items[ShlTraitLangItem as uint].get()
204204
}
205-
pub fn shr_trait(&self) -> def_id {
205+
pub fn shr_trait(&const self) -> def_id {
206206
self.items[ShrTraitLangItem as uint].get()
207207
}
208-
pub fn index_trait(&self) -> def_id {
208+
pub fn index_trait(&const self) -> def_id {
209209
self.items[IndexTraitLangItem as uint].get()
210210
}
211211

212-
pub fn eq_trait(&self) -> def_id {
212+
pub fn eq_trait(&const self) -> def_id {
213213
self.items[EqTraitLangItem as uint].get()
214214
}
215-
pub fn ord_trait(&self) -> def_id {
215+
pub fn ord_trait(&const self) -> def_id {
216216
self.items[OrdTraitLangItem as uint].get()
217217
}
218218

219-
pub fn str_eq_fn(&self) -> def_id {
219+
pub fn str_eq_fn(&const self) -> def_id {
220220
self.items[StrEqFnLangItem as uint].get()
221221
}
222-
pub fn uniq_str_eq_fn(&self) -> def_id {
222+
pub fn uniq_str_eq_fn(&const self) -> def_id {
223223
self.items[UniqStrEqFnLangItem as uint].get()
224224
}
225-
pub fn annihilate_fn(&self) -> def_id {
225+
pub fn annihilate_fn(&const self) -> def_id {
226226
self.items[AnnihilateFnLangItem as uint].get()
227227
}
228-
pub fn log_type_fn(&self) -> def_id {
228+
pub fn log_type_fn(&const self) -> def_id {
229229
self.items[LogTypeFnLangItem as uint].get()
230230
}
231-
pub fn fail_fn(&self) -> def_id {
231+
pub fn fail_fn(&const self) -> def_id {
232232
self.items[FailFnLangItem as uint].get()
233233
}
234-
pub fn fail_bounds_check_fn(&self) -> def_id {
234+
pub fn fail_bounds_check_fn(&const self) -> def_id {
235235
self.items[FailBoundsCheckFnLangItem as uint].get()
236236
}
237-
pub fn exchange_malloc_fn(&self) -> def_id {
237+
pub fn exchange_malloc_fn(&const self) -> def_id {
238238
self.items[ExchangeMallocFnLangItem as uint].get()
239239
}
240-
pub fn exchange_free_fn(&self) -> def_id {
240+
pub fn exchange_free_fn(&const self) -> def_id {
241241
self.items[ExchangeFreeFnLangItem as uint].get()
242242
}
243-
pub fn malloc_fn(&self) -> def_id {
243+
pub fn malloc_fn(&const self) -> def_id {
244244
self.items[MallocFnLangItem as uint].get()
245245
}
246-
pub fn free_fn(&self) -> def_id {
246+
pub fn free_fn(&const self) -> def_id {
247247
self.items[FreeFnLangItem as uint].get()
248248
}
249-
pub fn borrow_as_imm_fn(&self) -> def_id {
249+
pub fn borrow_as_imm_fn(&const self) -> def_id {
250250
self.items[BorrowAsImmFnLangItem as uint].get()
251251
}
252-
pub fn borrow_as_mut_fn(&self) -> def_id {
252+
pub fn borrow_as_mut_fn(&const self) -> def_id {
253253
self.items[BorrowAsMutFnLangItem as uint].get()
254254
}
255-
pub fn return_to_mut_fn(&self) -> def_id {
255+
pub fn return_to_mut_fn(&const self) -> def_id {
256256
self.items[ReturnToMutFnLangItem as uint].get()
257257
}
258-
pub fn check_not_borrowed_fn(&self) -> def_id {
258+
pub fn check_not_borrowed_fn(&const self) -> def_id {
259259
self.items[CheckNotBorrowedFnLangItem as uint].get()
260260
}
261-
pub fn strdup_uniq_fn(&self) -> def_id {
261+
pub fn strdup_uniq_fn(&const self) -> def_id {
262262
self.items[StrDupUniqFnLangItem as uint].get()
263263
}
264-
pub fn record_borrow_fn(&self) -> def_id {
264+
pub fn record_borrow_fn(&const self) -> def_id {
265265
self.items[RecordBorrowFnLangItem as uint].get()
266266
}
267-
pub fn unrecord_borrow_fn(&self) -> def_id {
267+
pub fn unrecord_borrow_fn(&const self) -> def_id {
268268
self.items[UnrecordBorrowFnLangItem as uint].get()
269269
}
270-
pub fn start_fn(&self) -> def_id {
270+
pub fn start_fn(&const self) -> def_id {
271271
self.items[StartFnLangItem as uint].get()
272272
}
273273
pub fn ty_desc(&const self) -> def_id {

branches/snap-stage3/src/librustc/middle/liveness.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ fn visit_fn(fk: &visit::fn_kind,
368368
match *fk {
369369
fk_method(_, _, method) => {
370370
match method.explicit_self.node {
371-
sty_value | sty_region(*) | sty_box(_) | sty_uniq => {
371+
sty_value | sty_region(*) | sty_box(_) | sty_uniq(_) => {
372372
fn_maps.add_variable(Arg(method.self_id,
373373
special_idents::self_));
374374
}

branches/snap-stage3/src/librustc/middle/trans/callee.rs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ pub struct FnData {
6262
pub struct MethodData {
6363
llfn: ValueRef,
6464
llself: ValueRef,
65+
temp_cleanup: Option<ValueRef>,
6566
self_ty: ty::t,
6667
self_mode: ty::SelfMode,
6768
explicit_self: ast::explicit_self_
@@ -615,10 +616,7 @@ pub fn trans_call_inner(in_cx: block,
615616
}
616617
Method(d) => {
617618
// Weird but true: we pass self in the *environment* slot!
618-
let llself = PointerCast(bcx,
619-
d.llself,
620-
Type::opaque_box(ccx).ptr_to());
621-
(d.llfn, llself)
619+
(d.llfn, d.llself)
622620
}
623621
Closure(d) => {
624622
// Closures are represented as (llfn, llclosure) pair:
@@ -649,9 +647,10 @@ pub fn trans_call_inner(in_cx: block,
649647
// Now that the arguments have finished evaluating, we need to revoke
650648
// the cleanup for the self argument, if it exists
651649
match callee.data {
652-
Method(d) if d.self_mode == ty::ByCopy ||
653-
d.explicit_self == ast::sty_value => {
654-
revoke_clean(bcx, d.llself);
650+
Method(d) => {
651+
for d.temp_cleanup.iter().advance |&v| {
652+
revoke_clean(bcx, v);
653+
}
655654
}
656655
_ => {}
657656
}
@@ -930,7 +929,7 @@ pub fn trans_arg_expr(bcx: block,
930929
ByRef(_) => val = scratch.val,
931930
}
932931
} else {
933-
debug!("by copy arg with type %s");
932+
debug!("by copy arg with type %s", bcx.ty_to_str(arg_datum.ty));
934933
match arg_datum.mode {
935934
ByRef(_) => val = Load(bcx, arg_datum.val),
936935
ByValue => val = arg_datum.val,
@@ -944,10 +943,6 @@ pub fn trans_arg_expr(bcx: block,
944943
if formal_arg_ty != arg_datum.ty {
945944
// this could happen due to e.g. subtyping
946945
let llformal_arg_ty = type_of::type_of_explicit_arg(ccx, &formal_arg_ty);
947-
let llformal_arg_ty = match self_mode {
948-
ty::ByRef => llformal_arg_ty.ptr_to(),
949-
ty::ByCopy => llformal_arg_ty,
950-
};
951946
debug!("casting actual type (%s) to match formal (%s)",
952947
bcx.val_to_str(val), bcx.llty_str(llformal_arg_ty));
953948
val = PointerCast(bcx, val, llformal_arg_ty);

branches/snap-stage3/src/librustc/middle/trans/consts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ fn const_expr_unadjusted(cx: @mut CrateContext, e: &ast::expr) -> ValueRef {
340340
let is_float = ty::type_is_fp(ty);
341341
return match u {
342342
ast::box(_) |
343-
ast::uniq |
343+
ast::uniq(_) |
344344
ast::deref => {
345345
let (dv, _dt) = const_deref(cx, te, ty, true);
346346
dv

branches/snap-stage3/src/librustc/middle/trans/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1314,7 +1314,7 @@ fn trans_unary_datum(bcx: block,
13141314
trans_boxed_expr(bcx, un_ty, sub_expr, sub_ty,
13151315
heap_managed)
13161316
}
1317-
ast::uniq => {
1317+
ast::uniq(_) => {
13181318
let heap = heap_for_unique(bcx, un_ty);
13191319
trans_boxed_expr(bcx, un_ty, sub_expr, sub_ty, heap)
13201320
}

0 commit comments

Comments
 (0)