Skip to content

std: Deprecate finally module #21082

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 14, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/libcore/finally.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@
//! # }
//! ```

#![unstable]
#![deprecated = "It is unclear if this module is more robust than implementing \
Drop on a custom type, and this module is being removed with no \
replacement. Use a custom Drop implementation to regain existing \
functionality."]
#![allow(deprecated)]

use ops::{Drop, FnMut, FnOnce};

Expand Down
17 changes: 11 additions & 6 deletions src/test/run-pass/backtrace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
// ignore-windows FIXME #13259

#![feature(unboxed_closures)]
#![feature(unsafe_destructor)]

use std::os;
use std::io::process::Command;
use std::finally::Finally;
use std::str;
use std::ops::{Drop, FnMut, FnOnce};

#[inline(never)]
fn foo() {
Expand All @@ -28,11 +29,15 @@ fn foo() {

#[inline(never)]
fn double() {
(|&mut:| {
panic!("once");
}).finally(|| {
panic!("twice");
})
struct Double;

impl Drop for Double {
fn drop(&mut self) { panic!("twice") }
}

let _d = Double;

panic!("once");
}

fn runtest(me: &str) {
Expand Down