From 7c3256c84842ab5e420b38f08838c234c6f5ba54 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 16 Oct 2020 23:23:08 +0100 Subject: [PATCH] get rid of ! type Signed-off-by: Ian Jackson --- src/cmdlistener.rs | 2 +- src/imports.rs | 2 ++ src/lib.rs | 1 - src/tz.rs | 4 ++-- 4 files changed, 5 insertions(+), 4 deletions(-) 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() } -- 2.30.2