chiark / gitweb /
get rid of ! type
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 16 Oct 2020 22:23:08 +0000 (23:23 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 16 Oct 2020 22:23:08 +0000 (23:23 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/cmdlistener.rs
src/imports.rs
src/lib.rs
src/tz.rs

index 9a7f7d32ed14edc7121d7a59b460085d2e7bc7dc..76b8abf2a548420da5ca52bab6632956d41133a4 100644 (file)
@@ -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![],
index 53b6f9939876e0c254b2506ede9b74d36eaeeab4..dcd5754f745a7bbf7e70908ff3b391f91888615c 100644 (file)
@@ -126,7 +126,9 @@ pub use nix::unistd::Uid;
 
 pub fn default<T: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;
index d095695af788ed78dc94ba33ee588f08810edce0..96163a0a76be090b9eb90abed37eb2e3626122c7 100644 (file)
@@ -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)]
 
index 04c7e20d7403a9b8b2a79fa0b85a678a057a67d9..39f958cf646f246e9c43ed951d9538c83d34990c 100644 (file)
--- a/src/tz.rs
+++ b/src/tz.rs
@@ -43,8 +43,8 @@ type MemoTable = Option<HashMap<String, Timezone>>;
 static MEMO: RwLock<MemoTable> = 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() }