Skip to content

Commit 22408d9

Browse files
committed
auto merge of #7269 : luqmana/rust/drop, r=thestinger
Finally rename finalize to drop. Closes #4332.
2 parents e9ac719 + ca2966c commit 22408d9

File tree

127 files changed

+155
-155
lines changed

Some content is hidden

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

127 files changed

+155
-155
lines changed

doc/tutorial-ffi.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ impl<T: Owned> Unique<T> {
183183
184184
#[unsafe_destructor]
185185
impl<T: Owned> Drop for Unique<T> {
186-
fn finalize(&self) {
186+
fn drop(&self) {
187187
unsafe {
188188
let x = intrinsics::init(); // dummy value to swap in
189189
// moving the object out is needed to call the destructor

doc/tutorial.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2010,7 +2010,7 @@ types by the compiler, and may not be overridden:
20102010
> iterations of the language, and often still are.
20112011
20122012
Additionally, the `Drop` trait is used to define destructors. This
2013-
trait defines one method called `finalize`, which is automatically
2013+
trait defines one method called `drop`, which is automatically
20142014
called when a value of the type that implements this trait is
20152015
destroyed, either because the value went out of scope or because the
20162016
garbage collector reclaimed it.
@@ -2021,15 +2021,15 @@ struct TimeBomb {
20212021
}
20222022
20232023
impl Drop for TimeBomb {
2024-
fn finalize(&self) {
2024+
fn drop(&self) {
20252025
for self.explosivity.times {
20262026
println("blam!");
20272027
}
20282028
}
20292029
}
20302030
~~~
20312031

2032-
It is illegal to call `finalize` directly. Only code inserted by the compiler
2032+
It is illegal to call `drop` directly. Only code inserted by the compiler
20332033
may call it.
20342034

20352035
## Declaring and implementing traits

src/etc/vim/syntax/rust.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ syn keyword rustOperator as
1515

1616
syn match rustAssert "\<assert\(\w\)*!"
1717
syn match rustFail "\<fail\(\w\)*!"
18-
syn keyword rustKeyword break copy do drop extern
18+
syn keyword rustKeyword break copy do extern
1919
syn keyword rustKeyword for if impl let log
2020
syn keyword rustKeyword copy do extern
2121
syn keyword rustKeyword for impl let log

src/libextra/arc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ struct PoisonOnFail {
247247
}
248248

249249
impl Drop for PoisonOnFail {
250-
fn finalize(&self) {
250+
fn drop(&self) {
251251
unsafe {
252252
/* assert!(!*self.failed);
253253
-- might be false in case of cond.wait() */

src/libextra/arena.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ pub struct Arena {
7777

7878
#[unsafe_destructor]
7979
impl Drop for Arena {
80-
fn finalize(&self) {
80+
fn drop(&self) {
8181
unsafe {
8282
destroy_chunk(&self.head);
8383
for self.chunks.each |chunk| {

src/libextra/c_vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ struct DtorRes {
5757

5858
#[unsafe_destructor]
5959
impl Drop for DtorRes {
60-
fn finalize(&self) {
60+
fn drop(&self) {
6161
match self.dtor {
6262
option::None => (),
6363
option::Some(f) => f()

src/libextra/future.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ pub struct Future<A> {
4444
// over ~fn's that have pipes and so forth within!
4545
#[unsafe_destructor]
4646
impl<A> Drop for Future<A> {
47-
fn finalize(&self) {}
47+
fn drop(&self) {}
4848
}
4949

5050
priv enum FutureState<A> {

src/libextra/net_tcp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ pub struct TcpSocket {
5757

5858
#[unsafe_destructor]
5959
impl Drop for TcpSocket {
60-
fn finalize(&self) {
60+
fn drop(&self) {
6161
tear_down_socket_data(self.socket_data)
6262
}
6363
}

src/libextra/rc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ impl<T> Rc<T> {
6868

6969
#[unsafe_destructor]
7070
impl<T> Drop for Rc<T> {
71-
fn finalize(&self) {
71+
fn drop(&self) {
7272
unsafe {
7373
if self.ptr.is_not_null() {
7474
(*self.ptr).count -= 1;
@@ -220,7 +220,7 @@ impl<T> RcMut<T> {
220220

221221
#[unsafe_destructor]
222222
impl<T> Drop for RcMut<T> {
223-
fn finalize(&self) {
223+
fn drop(&self) {
224224
unsafe {
225225
if self.ptr.is_not_null() {
226226
(*self.ptr).count -= 1;

src/libextra/sort.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1207,7 +1207,7 @@ mod big_tests {
12071207

12081208
#[unsafe_destructor]
12091209
impl<'self> Drop for LVal<'self> {
1210-
fn finalize(&self) {
1210+
fn drop(&self) {
12111211
let x = unsafe { local_data::local_data_get(self.key) };
12121212
match x {
12131213
Some(@y) => {

0 commit comments

Comments
 (0)