std: Clean out old unstable + deprecated APIs
These should all have been deprecated for at least one cycle, so this commit cleans them all out.
This commit is contained in:
parent
a967611d8f
commit
b64c9d5670
29 changed files with 52 additions and 1212 deletions
|
|
@ -8,12 +8,15 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::raw::Slice;
|
||||
struct Slice<T> {
|
||||
data: *const T,
|
||||
len: usize,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let Slice { data: data, len: len } = "foo";
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected type `&str`
|
||||
//~| found type `std::raw::Slice<_>`
|
||||
//~| expected &-ptr, found struct `std::raw::Slice`
|
||||
//~| found type `Slice<_>`
|
||||
//~| expected &-ptr, found struct `Slice`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,15 +8,18 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::raw::Slice;
|
||||
struct Slice<T> {
|
||||
data: *const T,
|
||||
len: usize,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
match () {
|
||||
Slice { data: data, len: len } => (),
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected type `()`
|
||||
//~| found type `std::raw::Slice<_>`
|
||||
//~| expected (), found struct `std::raw::Slice`
|
||||
//~| found type `Slice<_>`
|
||||
//~| expected (), found struct `Slice`
|
||||
_ => unreachable!()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,13 +9,12 @@
|
|||
// except according to those terms.
|
||||
|
||||
#![allow(dead_code)]
|
||||
#![feature(recover)]
|
||||
|
||||
use std::panic::RecoverSafe;
|
||||
use std::panic::UnwindSafe;
|
||||
use std::rc::Rc;
|
||||
use std::cell::RefCell;
|
||||
|
||||
fn assert<T: RecoverSafe + ?Sized>() {}
|
||||
fn assert<T: UnwindSafe + ?Sized>() {}
|
||||
|
||||
fn main() {
|
||||
assert::<Rc<RefCell<i32>>>();
|
||||
|
|
|
|||
|
|
@ -9,13 +9,12 @@
|
|||
// except according to those terms.
|
||||
|
||||
#![allow(dead_code)]
|
||||
#![feature(recover)]
|
||||
|
||||
use std::panic::RecoverSafe;
|
||||
use std::panic::UnwindSafe;
|
||||
use std::sync::Arc;
|
||||
use std::cell::RefCell;
|
||||
|
||||
fn assert<T: RecoverSafe + ?Sized>() {}
|
||||
fn assert<T: UnwindSafe + ?Sized>() {}
|
||||
|
||||
fn main() {
|
||||
assert::<Arc<RefCell<i32>>>();
|
||||
|
|
|
|||
|
|
@ -9,12 +9,11 @@
|
|||
// except according to those terms.
|
||||
|
||||
#![allow(dead_code)]
|
||||
#![feature(recover)]
|
||||
|
||||
use std::panic::RecoverSafe;
|
||||
use std::panic::UnwindSafe;
|
||||
use std::cell::RefCell;
|
||||
|
||||
fn assert<T: RecoverSafe + ?Sized>() {}
|
||||
fn assert<T: UnwindSafe + ?Sized>() {}
|
||||
|
||||
fn main() {
|
||||
assert::<&RefCell<i32>>();
|
||||
|
|
|
|||
|
|
@ -9,12 +9,11 @@
|
|||
// except according to those terms.
|
||||
|
||||
#![allow(dead_code)]
|
||||
#![feature(recover)]
|
||||
|
||||
use std::panic::RecoverSafe;
|
||||
use std::panic::UnwindSafe;
|
||||
use std::cell::UnsafeCell;
|
||||
|
||||
fn assert<T: RecoverSafe + ?Sized>() {}
|
||||
fn assert<T: UnwindSafe + ?Sized>() {}
|
||||
|
||||
fn main() {
|
||||
assert::<*const UnsafeCell<i32>>(); //~ ERROR E0277
|
||||
|
|
|
|||
|
|
@ -9,12 +9,11 @@
|
|||
// except according to those terms.
|
||||
|
||||
#![allow(dead_code)]
|
||||
#![feature(recover)]
|
||||
|
||||
use std::panic::RecoverSafe;
|
||||
use std::panic::UnwindSafe;
|
||||
use std::cell::RefCell;
|
||||
|
||||
fn assert<T: RecoverSafe + ?Sized>() {}
|
||||
fn assert<T: UnwindSafe + ?Sized>() {}
|
||||
|
||||
fn main() {
|
||||
assert::<*mut RefCell<i32>>();
|
||||
|
|
|
|||
|
|
@ -10,13 +10,14 @@
|
|||
|
||||
// error-pattern:greetings from the panic handler
|
||||
|
||||
#![feature(std_panic, panic_handler)]
|
||||
#![feature(panic_handler)]
|
||||
|
||||
use std::panic;
|
||||
use std::io::{self, Write};
|
||||
|
||||
fn main() {
|
||||
panic::set_handler(|i| {
|
||||
panic::set_hook(Box::new(|i| {
|
||||
write!(io::stderr(), "greetings from the panic handler");
|
||||
});
|
||||
}));
|
||||
panic!("foobar");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,14 +10,15 @@
|
|||
|
||||
// error-pattern:thread '<main>' panicked at 'foobar'
|
||||
|
||||
#![feature(std_panic, panic_handler)]
|
||||
#![feature(panic_handler)]
|
||||
|
||||
use std::panic;
|
||||
use std::io::{self, Write};
|
||||
|
||||
fn main() {
|
||||
panic::set_handler(|i| {
|
||||
panic::set_hook(Box::new(|i| {
|
||||
write!(io::stderr(), "greetings from the panic handler");
|
||||
});
|
||||
panic::take_handler();
|
||||
}));
|
||||
panic::take_hook();
|
||||
panic!("foobar");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,10 +10,11 @@
|
|||
|
||||
// error-pattern:thread '<main>' panicked at 'foobar'
|
||||
|
||||
#![feature(std_panic, panic_handler)]
|
||||
#![feature(panic_handler)]
|
||||
|
||||
use std::panic;
|
||||
|
||||
fn main() {
|
||||
panic::take_handler();
|
||||
panic::take_hook();
|
||||
panic!("foobar");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,10 +8,10 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(recover, rand, std_panic)]
|
||||
#![feature(rand, std_panic)]
|
||||
|
||||
use std::__rand::{thread_rng, Rng};
|
||||
use std::panic::{self, AssertRecoverSafe};
|
||||
use std::panic::{self, AssertUnwindSafe};
|
||||
|
||||
use std::collections::BinaryHeap;
|
||||
use std::cmp;
|
||||
|
|
@ -70,8 +70,8 @@ fn test_integrity() {
|
|||
{
|
||||
// push the panicking item to the heap and catch the panic
|
||||
let thread_result = {
|
||||
let mut heap_ref = AssertRecoverSafe(&mut heap);
|
||||
panic::recover(move || {
|
||||
let mut heap_ref = AssertUnwindSafe(&mut heap);
|
||||
panic::catch_unwind(move || {
|
||||
heap_ref.push(panic_item);
|
||||
})
|
||||
};
|
||||
|
|
|
|||
|
|
@ -10,25 +10,25 @@
|
|||
|
||||
// ignore-emscripten no threads support
|
||||
|
||||
#![feature(std_panic, recover, panic_propagate, panic_handler, const_fn)]
|
||||
#![feature(panic_handler)]
|
||||
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT};
|
||||
use std::panic;
|
||||
use std::thread;
|
||||
|
||||
static A: AtomicUsize = AtomicUsize::new(0);
|
||||
static A: AtomicUsize = ATOMIC_USIZE_INIT;
|
||||
|
||||
fn main() {
|
||||
panic::set_handler(|_| {
|
||||
panic::set_hook(Box::new(|_| {
|
||||
A.fetch_add(1, Ordering::SeqCst);
|
||||
});
|
||||
}));
|
||||
|
||||
let result = thread::spawn(|| {
|
||||
let result = panic::recover(|| {
|
||||
let result = panic::catch_unwind(|| {
|
||||
panic!("hi there");
|
||||
});
|
||||
|
||||
panic::propagate(result.unwrap_err());
|
||||
panic::resume_unwind(result.unwrap_err());
|
||||
}).join();
|
||||
|
||||
let msg = *result.unwrap_err().downcast::<&'static str>().unwrap();
|
||||
|
|
|
|||
|
|
@ -10,8 +10,6 @@
|
|||
|
||||
// aux-build:reachable-unnameable-items.rs
|
||||
|
||||
#![feature(recover)]
|
||||
|
||||
extern crate reachable_unnameable_items;
|
||||
use reachable_unnameable_items::*;
|
||||
|
||||
|
|
@ -37,5 +35,5 @@ fn main() {
|
|||
|
||||
let none = None;
|
||||
function_accepting_unnameable_type(none);
|
||||
let _guard = std::panic::recover(|| none.unwrap().method_of_unnameable_type3());
|
||||
let _guard = std::panic::catch_unwind(|| none.unwrap().method_of_unnameable_type3());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(std_panic, recover, start)]
|
||||
#![feature(start)]
|
||||
|
||||
use std::ffi::CStr;
|
||||
use std::process::{Command, Output};
|
||||
|
|
@ -22,8 +22,8 @@ fn start(argc: isize, argv: *const *const u8) -> isize {
|
|||
match **argv.offset(1) as char {
|
||||
'1' => {}
|
||||
'2' => println!("foo"),
|
||||
'3' => assert!(panic::recover(|| {}).is_ok()),
|
||||
'4' => assert!(panic::recover(|| panic!()).is_err()),
|
||||
'3' => assert!(panic::catch_unwind(|| {}).is_ok()),
|
||||
'4' => assert!(panic::catch_unwind(|| panic!()).is_err()),
|
||||
'5' => assert!(Command::new("test").spawn().is_err()),
|
||||
_ => panic!()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,8 +23,6 @@ pub fn main() {
|
|||
assert_eq!(s.chars().count(), 4);
|
||||
assert_eq!(schs.len(), 4);
|
||||
assert_eq!(schs.iter().cloned().collect::<String>(), s);
|
||||
assert_eq!(s.char_at(0), 'e');
|
||||
assert_eq!(s.char_at(1), 'é');
|
||||
|
||||
assert!((str::from_utf8(s.as_bytes()).is_ok()));
|
||||
// invalid prefix
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue