Skip to content

Commit db24095

Browse files
committed
---
yaml --- r: 50111 b: refs/heads/auto c: 557b8cc h: refs/heads/master i: 50109: bf95ed8 50107: 1c2c49b 50103: 68f7cd3 50095: b73c257 50079: f532cfe 50047: 2213e19 v: v3
1 parent 26c90df commit db24095

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+298
-280
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1414
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1515
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1616
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
17-
refs/heads/auto: d52408d46a0d7f7ba0004a829207fef6870fa88c
17+
refs/heads/auto: 557b8cce8e5dc12b868ae32f8969464cd38105ae
1818
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167

branches/auto/src/libcore/condition.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ struct Guard<T, U> {
8484
cond: &'self Condition/&self<T, U>
8585
}
8686

87-
#[unsafe_destructor]
8887
impl<T, U> Drop for Guard/&self<T, U> {
8988
fn finalize(&self) {
9089
unsafe {

branches/auto/src/libcore/io.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,17 +1230,15 @@ pub mod fsync {
12301230
arg: Arg<t>,
12311231
}
12321232

1233-
#[unsafe_destructor]
12341233
impl<T:Copy> Drop for Res<T> {
12351234
fn finalize(&self) {
1236-
match self.arg.opt_level {
1237-
None => (),
1238-
Some(level) => {
1239-
// fail hard if not succesful
1240-
fail_unless!(((self.arg.fsync_fn)(self.arg.val, level)
1241-
!= -1));
1242-
}
1235+
match self.arg.opt_level {
1236+
None => (),
1237+
Some(level) => {
1238+
// fail hard if not succesful
1239+
fail_unless!(((self.arg.fsync_fn)(self.arg.val, level) != -1));
12431240
}
1241+
}
12441242
}
12451243
}
12461244

branches/auto/src/libcore/managed.rs

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -49,43 +49,23 @@ pub pure fn mut_ptr_eq<T>(a: @mut T, b: @mut T) -> bool {
4949
}
5050

5151
#[cfg(notest)]
52-
impl<T:Eq> Eq for @T {
52+
impl<T:Eq> Eq for @const T {
5353
#[inline(always)]
54-
pure fn eq(&self, other: &@T) -> bool { *(*self) == *(*other) }
54+
pure fn eq(&self, other: &@const T) -> bool { *(*self) == *(*other) }
5555
#[inline(always)]
56-
pure fn ne(&self, other: &@T) -> bool { *(*self) != *(*other) }
56+
pure fn ne(&self, other: &@const T) -> bool { *(*self) != *(*other) }
5757
}
5858

5959
#[cfg(notest)]
60-
impl<T:Eq> Eq for @mut T {
60+
impl<T:Ord> Ord for @const T {
6161
#[inline(always)]
62-
pure fn eq(&self, other: &@mut T) -> bool { *(*self) == *(*other) }
62+
pure fn lt(&self, other: &@const T) -> bool { *(*self) < *(*other) }
6363
#[inline(always)]
64-
pure fn ne(&self, other: &@mut T) -> bool { *(*self) != *(*other) }
65-
}
66-
67-
#[cfg(notest)]
68-
impl<T:Ord> Ord for @T {
69-
#[inline(always)]
70-
pure fn lt(&self, other: &@T) -> bool { *(*self) < *(*other) }
71-
#[inline(always)]
72-
pure fn le(&self, other: &@T) -> bool { *(*self) <= *(*other) }
73-
#[inline(always)]
74-
pure fn ge(&self, other: &@T) -> bool { *(*self) >= *(*other) }
75-
#[inline(always)]
76-
pure fn gt(&self, other: &@T) -> bool { *(*self) > *(*other) }
77-
}
78-
79-
#[cfg(notest)]
80-
impl<T:Ord> Ord for @mut T {
81-
#[inline(always)]
82-
pure fn lt(&self, other: &@mut T) -> bool { *(*self) < *(*other) }
83-
#[inline(always)]
84-
pure fn le(&self, other: &@mut T) -> bool { *(*self) <= *(*other) }
64+
pure fn le(&self, other: &@const T) -> bool { *(*self) <= *(*other) }
8565
#[inline(always)]
86-
pure fn ge(&self, other: &@mut T) -> bool { *(*self) >= *(*other) }
66+
pure fn ge(&self, other: &@const T) -> bool { *(*self) >= *(*other) }
8767
#[inline(always)]
88-
pure fn gt(&self, other: &@mut T) -> bool { *(*self) > *(*other) }
68+
pure fn gt(&self, other: &@const T) -> bool { *(*self) > *(*other) }
8969
}
9070

9171
#[test]

branches/auto/src/libcore/option.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,6 @@ fn test_unwrap_resource() {
514514
i: @mut int,
515515
}
516516

517-
#[unsafe_destructor]
518517
impl ::ops::Drop for R {
519518
fn finalize(&self) { *(self.i) += 1; }
520519
}

branches/auto/src/libcore/pipes.rs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,6 @@ struct BufferResource<T> {
350350
351351
}
352352
353-
#[unsafe_destructor]
354353
impl<T> ::ops::Drop for BufferResource<T> {
355354
fn finalize(&self) {
356355
unsafe {
@@ -446,17 +445,16 @@ pub fn try_recv<T:Owned,Tbuffer:Owned>(p: RecvPacketBuffered<T, Tbuffer>)
446445
let p_ = p.unwrap();
447446
let p = unsafe { &*p_ };
448447
449-
#[unsafe_destructor]
450448
struct DropState {
451449
p: &'self PacketHeader,
452450
453451
drop {
454-
unsafe {
455-
if task::failing() {
456-
self.p.state = Terminated;
457-
let old_task = swap_task(&mut self.p.blocked_task,
458-
ptr::null());
459-
if !old_task.is_null() {
452+
if task::failing() {
453+
self.p.state = Terminated;
454+
let old_task = swap_task(&mut self.p.blocked_task,
455+
ptr::null());
456+
if !old_task.is_null() {
457+
unsafe {
460458
rustrt::rust_task_deref(old_task);
461459
}
462460
}
@@ -775,7 +773,6 @@ pub struct SendPacketBuffered<T, Tbuffer> {
775773
mut buffer: Option<BufferResource<Tbuffer>>,
776774
}
777775
778-
#[unsafe_destructor]
779776
impl<T:Owned,Tbuffer:Owned> ::ops::Drop for SendPacketBuffered<T,Tbuffer> {
780777
fn finalize(&self) {
781778
//if self.p != none {
@@ -845,7 +842,6 @@ pub struct RecvPacketBuffered<T, Tbuffer> {
845842
mut buffer: Option<BufferResource<Tbuffer>>,
846843
}
847844
848-
#[unsafe_destructor]
849845
impl<T:Owned,Tbuffer:Owned> ::ops::Drop for RecvPacketBuffered<T,Tbuffer> {
850846
fn finalize(&self) {
851847
//if self.p != none {

branches/auto/src/libcore/str.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ pub pure fn split_str_nonempty(s: &'a str, sep: &'b str) -> ~[~str] {
599599
pub fn levdistance(s: &str, t: &str) -> uint {
600600

601601
let slen = s.len();
602-
let tlen = s.len();
602+
let tlen = t.len();
603603

604604
if slen == 0 { return tlen; }
605605
if tlen == 0 { return slen; }
@@ -611,7 +611,7 @@ pub fn levdistance(s: &str, t: &str) -> uint {
611611
let mut current = i;
612612
dcol[0] = current + 1;
613613

614-
for s.each_chari |j, tc| {
614+
for t.each_chari |j, tc| {
615615

616616
let mut next = dcol[j + 1];
617617

branches/auto/src/libcore/unstable.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ struct ArcDestruct<T> {
118118
mut data: *libc::c_void,
119119
}
120120

121-
#[unsafe_destructor]
122121
impl<T> Drop for ArcDestruct<T>{
123122
fn finalize(&self) {
124123
unsafe {

branches/auto/src/libcore/unstable/finally.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ struct Finallyalizer {
4545
dtor: &'self fn()
4646
}
4747

48-
#[unsafe_destructor]
4948
impl Drop for Finallyalizer/&self {
5049
fn finalize(&self) {
5150
(self.dtor)();

branches/auto/src/librustc/middle/kind.rs

Lines changed: 5 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ use core::str;
2222
use core::vec;
2323
use std::oldmap::HashMap;
2424
use syntax::ast::*;
25-
use syntax::attr::attrs_contains_name;
2625
use syntax::codemap::{span, spanned};
2726
use syntax::print::pprust::expr_to_str;
2827
use syntax::{visit, ast_util};
@@ -56,8 +55,6 @@ use syntax::{visit, ast_util};
5655
// primitives in the stdlib are explicitly annotated to only take sendable
5756
// types.
5857

59-
use core::hashmap::linear::LinearSet;
60-
6158
pub const try_adding: &'static str = "Try adding a move";
6259

6360
pub type rval_map = HashMap<node_id, ()>;
@@ -66,7 +63,7 @@ pub struct Context {
6663
tcx: ty::ctxt,
6764
method_map: typeck::method_map,
6865
last_use_map: liveness::last_use_map,
69-
current_item: node_id,
66+
current_item: node_id
7067
}
7168

7269
pub fn check_crate(tcx: ty::ctxt,
@@ -77,15 +74,16 @@ pub fn check_crate(tcx: ty::ctxt,
7774
tcx: tcx,
7875
method_map: method_map,
7976
last_use_map: last_use_map,
80-
current_item: -1,
77+
current_item: -1
8178
};
8279
let visit = visit::mk_vt(@visit::Visitor {
8380
visit_arm: check_arm,
8481
visit_expr: check_expr,
8582
visit_fn: check_fn,
8683
visit_ty: check_ty,
87-
visit_item: check_item,
88-
visit_block: check_block,
84+
visit_item: |i, cx, v| {
85+
visit::visit_item(i, Context { current_item: i.id,.. cx }, v);
86+
},
8987
.. *visit::default_visitor()
9088
});
9189
visit::visit_crate(*crate, ctx, visit);
@@ -94,93 +92,6 @@ pub fn check_crate(tcx: ty::ctxt,
9492

9593
type check_fn = @fn(Context, @freevar_entry);
9694

97-
fn check_struct_safe_for_destructor(cx: Context,
98-
span: span,
99-
struct_did: def_id) {
100-
let struct_tpt = ty::lookup_item_type(cx.tcx, struct_did);
101-
if struct_tpt.bounds.len() == 0 {
102-
let struct_ty = ty::mk_struct(cx.tcx, struct_did, ty::substs {
103-
self_r: None,
104-
self_ty: None,
105-
tps: ~[]
106-
});
107-
if !ty::type_is_owned(cx.tcx, struct_ty) {
108-
cx.tcx.sess.span_err(span,
109-
~"cannot implement a destructor on a struct \
110-
that is not Owned");
111-
cx.tcx.sess.span_note(span,
112-
~"use \"#[unsafe_destructor]\" on the \
113-
implementation to force the compiler to \
114-
allow this");
115-
}
116-
} else {
117-
cx.tcx.sess.span_err(span,
118-
~"cannot implement a destructor on a struct \
119-
with type parameters");
120-
cx.tcx.sess.span_note(span,
121-
~"use \"#[unsafe_destructor]\" on the \
122-
implementation to force the compiler to \
123-
allow this");
124-
}
125-
}
126-
127-
fn check_block(block: &blk, cx: Context, visitor: visit::vt<Context>) {
128-
visit::visit_block(block, cx, visitor);
129-
}
130-
131-
fn check_item(item: @item, cx: Context, visitor: visit::vt<Context>) {
132-
// If this is a destructor, check kinds.
133-
if !attrs_contains_name(item.attrs, "unsafe_destructor") {
134-
match item.node {
135-
item_impl(_, Some(trait_ref), self_type, _) => {
136-
match cx.tcx.def_map.find(&trait_ref.ref_id) {
137-
None => cx.tcx.sess.bug(~"trait ref not in def map!"),
138-
Some(trait_def) => {
139-
let trait_def_id = ast_util::def_id_of_def(trait_def);
140-
if cx.tcx.lang_items.drop_trait() == trait_def_id {
141-
// Yes, it's a destructor.
142-
match self_type.node {
143-
ty_path(_, path_node_id) => {
144-
let struct_def = cx.tcx.def_map.get(
145-
&path_node_id);
146-
let struct_did =
147-
ast_util::def_id_of_def(struct_def);
148-
check_struct_safe_for_destructor(
149-
cx,
150-
self_type.span,
151-
struct_did);
152-
}
153-
_ => {
154-
cx.tcx.sess.span_bug(self_type.span,
155-
~"the self type for \
156-
the Drop trait \
157-
impl is not a \
158-
path");
159-
}
160-
}
161-
}
162-
}
163-
}
164-
}
165-
item_struct(struct_def, _) => {
166-
match struct_def.dtor {
167-
None => {}
168-
Some(ref dtor) => {
169-
let struct_did = def_id { crate: 0, node: item.id };
170-
check_struct_safe_for_destructor(cx,
171-
dtor.span,
172-
struct_did);
173-
}
174-
}
175-
}
176-
_ => {}
177-
}
178-
}
179-
180-
let cx = Context { current_item: item.id, ..cx };
181-
visit::visit_item(item, cx, visitor);
182-
}
183-
18495
// Yields the appropriate function to check the kind of closed over
18596
// variables. `id` is the node_id for some expression that creates the
18697
// closure.

branches/auto/src/librustc/middle/trans/base.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,11 @@ pub struct icx_popper {
8888
ccx: @CrateContext,
8989
}
9090

91-
#[unsafe_destructor]
9291
impl Drop for icx_popper {
9392
fn finalize(&self) {
94-
unsafe {
95-
if self.ccx.sess.count_llvm_insns() {
96-
self.ccx.stats.llvm_insn_ctxt.pop();
97-
}
98-
}
93+
if self.ccx.sess.count_llvm_insns() {
94+
self.ccx.stats.llvm_insn_ctxt.pop();
95+
}
9996
}
10097
}
10198

branches/auto/src/libstd/arena.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ pub struct Arena {
8888
priv mut chunks: @List<Chunk>,
8989
}
9090

91-
#[unsafe_destructor]
9291
impl Drop for Arena {
9392
fn finalize(&self) {
9493
unsafe {

branches/auto/src/libstd/c_vec.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,11 @@ struct DtorRes {
5454
dtor: Option<@fn()>,
5555
}
5656

57-
#[unsafe_destructor]
5857
impl Drop for DtorRes {
5958
fn finalize(&self) {
60-
unsafe {
61-
match self.dtor {
62-
option::None => (),
63-
option::Some(f) => f()
64-
}
59+
match self.dtor {
60+
option::None => (),
61+
option::Some(f) => f()
6562
}
6663
}
6764
}

branches/auto/src/libstd/future.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ pub struct Future<A> {
3535

3636
// FIXME(#2829) -- futures should not be copyable, because they close
3737
// over ~fn's that have pipes and so forth within!
38-
#[unsafe_destructor]
3938
impl<A> Drop for Future<A> {
4039
fn finalize(&self) {}
4140
}

branches/auto/src/libstd/net_tcp.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ pub struct TcpSocket {
5555
socket_data: @TcpSocketData,
5656
}
5757

58-
#[unsafe_destructor]
5958
impl Drop for TcpSocket {
6059
fn finalize(&self) {
6160
unsafe {

branches/auto/src/libstd/sort.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1190,7 +1190,6 @@ mod big_tests {
11901190
key: &'self fn(@uint),
11911191
}
11921192
1193-
#[unsafe_destructor]
11941193
impl Drop for LVal/&self {
11951194
fn finalize(&self) {
11961195
let x = unsafe { task::local_data::local_data_get(self.key) };

0 commit comments

Comments
 (0)