Remove usage of 'never_type' nightly feature

Summary: It doesn't look like the never type is going to be stabilized anytime soon, so lets just use the `never-say-never` crate instead.

Reviewed By: dtolnay

Differential Revision: D41459064

fbshipit-source-id: 6bc82377242b31171251b2393a534f76c7f3d97a
This commit is contained in:
Jason White 2022-11-29 12:40:44 -08:00 committed by Facebook GitHub Bot
parent 8058dd4803
commit 0037ec860d
6 changed files with 11 additions and 13 deletions

View file

@ -66,12 +66,6 @@ impl WriteResponse for ResponseOk {
} }
} }
impl WriteResponse for ! {
fn write_response(&self, f: &mut ResponseWriter) {
ResponseNone.write_response(f)
}
}
impl<T> WriteResponse for ResponseAsPlain<T> impl<T> WriteResponse for ResponseAsPlain<T>
where where
T: AsRef<[u8]>, T: AsRef<[u8]>,

View file

@ -29,7 +29,6 @@
#![deny(missing_docs)] #![deny(missing_docs)]
#![deny(rustdoc::broken_intra_doc_links)] #![deny(rustdoc::broken_intra_doc_links)]
#![feature(internal_output_capture)] #![feature(internal_output_capture)]
#![feature(never_type)]
mod children; mod children;
mod cp; mod cp;

View file

@ -43,6 +43,7 @@ use reverie::Frame;
use reverie::GlobalRPC; use reverie::GlobalRPC;
use reverie::GlobalTool; use reverie::GlobalTool;
use reverie::Guest; use reverie::Guest;
use reverie::Never;
use reverie::Pid; use reverie::Pid;
#[cfg(target_arch = "x86_64")] #[cfg(target_arch = "x86_64")]
use reverie::Rdtsc; use reverie::Rdtsc;
@ -1275,7 +1276,7 @@ impl<L: Tool + 'static> TracedTask<L> {
// Wait on a future that will never complete. This pending future will // Wait on a future that will never complete. This pending future will
// be dropped when the channel receives the event just sent. // be dropped when the channel receives the event just sent.
future::pending::<!>().await future::pending().await
} }
/// Marks the current task as exited via a channel. The receiver end of the /// Marks the current task as exited via a channel. The receiver end of the
@ -1698,7 +1699,7 @@ impl<L: Tool + 'static> TracedTask<L> {
Ok(_) => { Ok(_) => {
// Drop the handle_syscall_event future. // Drop the handle_syscall_event future.
self.notifier.notify_one(); self.notifier.notify_one();
future::pending::<!>().await future::pending().await
} }
Err(err) => self.abort(Err(err)).await, Err(err) => self.abort(Err(err)).await,
} }
@ -2161,7 +2162,7 @@ impl<L: Tool + 'static> Guest<L> for TracedTask<L> {
} }
#[allow(unreachable_code)] #[allow(unreachable_code)]
async fn tail_inject<S: SyscallInfo>(&mut self, syscall: S) -> ! { async fn tail_inject<S: SyscallInfo>(&mut self, syscall: S) -> Never {
// Call a non-templatized function to reduce code bloat. // Call a non-templatized function to reduce code bloat.
let (nr, args) = syscall.into_parts(); let (nr, args) = syscall.into_parts();
self.do_tail_inject(nr, args).await self.do_tail_inject(nr, args).await

View file

@ -18,6 +18,7 @@ lazy_static = "1.4"
libc = "0.2.137" libc = "0.2.137"
linked-hash-map = { version = "0.5", features = ["serde_impl"] } linked-hash-map = { version = "0.5", features = ["serde_impl"] }
memmap = "0.7" memmap = "0.7"
never-say-never = "6"
nix = "0.25" nix = "0.25"
object = { version = "0.29", features = ["write"] } object = { version = "0.29", features = ["write"] }
procfs = "0.9" procfs = "0.9"

View file

@ -21,6 +21,7 @@ use crate::timer::TimerSchedule;
use crate::tool::GlobalRPC; use crate::tool::GlobalRPC;
use crate::tool::GlobalTool; use crate::tool::GlobalTool;
use crate::tool::Tool; use crate::tool::Tool;
use crate::Never;
use crate::Pid; use crate::Pid;
/// A representation of a guest task (thread). /// A representation of a guest task (thread).
@ -152,7 +153,7 @@ pub trait Guest<T: Tool>: Send + GlobalRPC<T::GlobalState> {
/// } /// }
/// } /// }
/// ``` /// ```
async fn tail_inject<S: SyscallInfo>(&mut self, syscall: S) -> !; async fn tail_inject<S: SyscallInfo>(&mut self, syscall: S) -> Never;
/// Like [`Guest::inject`], but will retry the syscall if `EINTR` or /// Like [`Guest::inject`], but will retry the syscall if `EINTR` or
/// `ERESTARTSYS` are returned. /// `ERESTARTSYS` are returned.
@ -350,7 +351,7 @@ where
self.inner.inject(syscall).await self.inner.inject(syscall).await
} }
async fn tail_inject<S: SyscallInfo>(&mut self, syscall: S) -> ! { async fn tail_inject<S: SyscallInfo>(&mut self, syscall: S) -> Never {
#![allow(unreachable_code)] #![allow(unreachable_code)]
self.inner.tail_inject(syscall).await self.inner.tail_inject(syscall).await
} }

View file

@ -9,7 +9,6 @@
#![doc = include_str!("../../README.md")] #![doc = include_str!("../../README.md")]
#![deny(missing_docs)] #![deny(missing_docs)]
#![deny(rustdoc::broken_intra_doc_links)] #![deny(rustdoc::broken_intra_doc_links)]
#![feature(never_type)]
mod auxv; mod auxv;
mod backtrace; mod backtrace;
@ -65,3 +64,6 @@ pub use nix::sys::signal::Signal;
pub use raw_cpuid::CpuIdResult; pub use raw_cpuid::CpuIdResult;
/// typed syscalls. /// typed syscalls.
pub use reverie_syscalls as syscalls; pub use reverie_syscalls as syscalls;
/// `Never` type is a stopgap for the unstable `!` type (i.e., the never type).
pub type Never = never_say_never::Never;