From: Ian Jackson Date: Fri, 16 Oct 2020 22:23:08 +0000 (+0100) Subject: get rid of ! type X-Git-Tag: otter-0.2.0~634 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=7c3256c84842ab5e420b38f08838c234c6f5ba54;p=otter.git get rid of ! type Signed-off-by: Ian Jackson --- diff --git a/src/cmdlistener.rs b/src/cmdlistener.rs index 9a7f7d32..76b8abf2 100644 --- a/src/cmdlistener.rs +++ b/src/cmdlistener.rs @@ -170,7 +170,7 @@ fn execute_game_insn(cs: &CommandStream, .unwrap_or(""); let tz = match Timezone::from_str(timezone) { Ok(tz) => tz, - Err(x) => x, // x is of type ! + Err(x) => match x { }, }; let (player, logentry) = ig.player_new(pl.st, tz, logentry)?; (U{ pcs: vec![], diff --git a/src/imports.rs b/src/imports.rs index 53b6f993..dcd5754f 100644 --- a/src/imports.rs +++ b/src/imports.rs @@ -126,7 +126,9 @@ pub use nix::unistd::Uid; pub fn default() -> T { Default::default() } +#[derive(Debug,Copy,Clone)] pub enum Impossible { } +display_as_debug!(Impossible); pub type E = anyhow::Error; pub type AE = anyhow::Error; diff --git a/src/lib.rs b/src/lib.rs index d095695a..96163a0a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,7 +2,6 @@ // SPDX-License-Identifier: AGPL-3.0-or-later // There is NO WARRANTY. -#![feature(never_type)] #![feature(proc_macro_hygiene, decl_macro)] #![feature(slice_strip)] diff --git a/src/tz.rs b/src/tz.rs index 04c7e20d..39f958cf 100644 --- a/src/tz.rs +++ b/src/tz.rs @@ -43,8 +43,8 @@ type MemoTable = Option>; static MEMO: RwLock = const_rwlock(None); impl FromStr for Timezone { - type Err = !; - #[throws(!)] + type Err = Impossible; + #[throws(Impossible)] fn from_str(name: &str) -> Self { if name.is_empty() { return default() }