diff --git a/rust-version b/rust-version index 70ece06e4f02..1270131b7267 100644 --- a/rust-version +++ b/rust-version @@ -1 +1 @@ -8ff785011be6625e32afceee3a08e5cff7470feb +1edd389cc4c7b5be7a3dd4fe4b986f6017018e54 diff --git a/src/stacked_borrows.rs b/src/stacked_borrows.rs index 05b9c478cfea..37f2acf4c3bc 100644 --- a/src/stacked_borrows.rs +++ b/src/stacked_borrows.rs @@ -194,11 +194,10 @@ impl GlobalState { /// Error reporting fn err_sb_ub(msg: String) -> InterpError<'static> { - // FIXME: use `err_machine_stop!` macro, once that exists. - InterpError::MachineStop(Box::new(TerminationInfo::ExperimentalUb { + err_machine_stop!(TerminationInfo::ExperimentalUb { msg, url: format!("https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md"), - })) + }) } // # Stacked Borrows Core Begin diff --git a/tests/run-pass/async-fn.rs b/tests/run-pass/async-fn.rs index 90448aca1779..b0a979123343 100644 --- a/tests/run-pass/async-fn.rs +++ b/tests/run-pass/async-fn.rs @@ -1,7 +1,9 @@ #![feature(never_type)] +#![feature(wake_trait)] -use std::{future::Future, pin::Pin, task::Poll, ptr}; -use std::task::{Waker, RawWaker, RawWakerVTable, Context}; +use std::{future::Future, pin::Pin, task::Poll}; +use std::task::{Wake, Waker, Context}; +use std::sync::Arc; // See if we can run a basic `async fn` pub async fn foo(x: &u32, y: u32) -> u32 { @@ -47,25 +49,14 @@ async fn partial_init(x: u32) -> u32 { } fn run_fut(mut fut: impl Future, output: u32) { - fn raw_waker_clone(_this: *const ()) -> RawWaker { - panic!("unimplemented"); + struct MyWaker; + impl Wake for MyWaker { + fn wake(self: Arc) { + unimplemented!() + } } - fn raw_waker_wake(_this: *const ()) { - panic!("unimplemented"); - } - fn raw_waker_wake_by_ref(_this: *const ()) { - panic!("unimplemented"); - } - fn raw_waker_drop(_this: *const ()) {} - static RAW_WAKER: RawWakerVTable = RawWakerVTable::new( - raw_waker_clone, - raw_waker_wake, - raw_waker_wake_by_ref, - raw_waker_drop, - ); - - let waker = unsafe { Waker::from_raw(RawWaker::new(ptr::null(), &RAW_WAKER)) }; + let waker = Waker::from(Arc::new(MyWaker)); let mut context = Context::from_waker(&waker); assert_eq!(unsafe { Pin::new_unchecked(&mut fut) }.poll(&mut context), Poll::Ready(output)); }