summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dhall/src/phase/mod.rs6
-rw-r--r--dhall_syntax/src/core/expr.rs14
-rw-r--r--dhall_syntax/src/core/visitor.rs2
-rw-r--r--dhall_syntax/src/lib.rs1
-rw-r--r--dhall_syntax/src/parser.rs4
5 files changed, 9 insertions, 18 deletions
diff --git a/dhall/src/phase/mod.rs b/dhall/src/phase/mod.rs
index b73597c..2700e99 100644
--- a/dhall/src/phase/mod.rs
+++ b/dhall/src/phase/mod.rs
@@ -2,7 +2,7 @@ use std::borrow::Cow;
use std::fmt::Display;
use std::path::Path;
-use dhall_syntax::{Const, SubExpr, Void};
+use dhall_syntax::{Const, SubExpr};
use crate::core::thunk::{Thunk, TypedThunk};
use crate::core::value::Value;
@@ -17,8 +17,8 @@ pub(crate) mod parse;
pub(crate) mod resolve;
pub(crate) mod typecheck;
-pub type ParsedSubExpr = SubExpr<Void>;
-pub type DecodedSubExpr = SubExpr<Void>;
+pub type ParsedSubExpr = SubExpr<!>;
+pub type DecodedSubExpr = SubExpr<!>;
pub type ResolvedSubExpr = SubExpr<Normalized>;
pub type NormalizedSubExpr = SubExpr<Normalized>;
diff --git a/dhall_syntax/src/core/expr.rs b/dhall_syntax/src/core/expr.rs
index 30ac4eb..efbcee2 100644
--- a/dhall_syntax/src/core/expr.rs
+++ b/dhall_syntax/src/core/expr.rs
@@ -8,20 +8,10 @@ pub type Integer = isize;
pub type Natural = usize;
pub type Double = NaiveDouble;
-/// An empty type
-#[derive(Debug, Copy, Clone, PartialEq, Eq)]
-pub enum Void {}
-
-impl std::fmt::Display for Void {
- fn fmt(&self, _f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
- match *self {}
- }
-}
-
-pub fn trivial_result<T>(x: Result<T, Void>) -> T {
+pub fn trivial_result<T>(x: Result<T, !>) -> T {
match x {
Ok(x) => x,
- Err(e) => match e {},
+ Err(e) => e,
}
}
diff --git a/dhall_syntax/src/core/visitor.rs b/dhall_syntax/src/core/visitor.rs
index 7b4ed4b..5a5fcc9 100644
--- a/dhall_syntax/src/core/visitor.rs
+++ b/dhall_syntax/src/core/visitor.rs
@@ -176,7 +176,7 @@ impl<'a, T, SE1, SE2, E1, E2> ExprFFallibleVisitor<'a, SE1, SE2, E1, E2>
where
T: ExprFInFallibleVisitor<'a, SE1, SE2, E1, E2>,
{
- type Error = Void;
+ type Error = !;
fn visit_subexpr(&mut self, subexpr: &'a SE1) -> Result<SE2, Self::Error> {
Ok(self.0.visit_subexpr(subexpr))
diff --git a/dhall_syntax/src/lib.rs b/dhall_syntax/src/lib.rs
index 8406595..4566e64 100644
--- a/dhall_syntax/src/lib.rs
+++ b/dhall_syntax/src/lib.rs
@@ -1,6 +1,7 @@
#![feature(trace_macros)]
#![feature(slice_patterns)]
#![feature(try_blocks)]
+#![feature(never_type)]
#![allow(
clippy::many_single_char_names,
clippy::should_implement_trait,
diff --git a/dhall_syntax/src/parser.rs b/dhall_syntax/src/parser.rs
index d467970..bcaa00e 100644
--- a/dhall_syntax/src/parser.rs
+++ b/dhall_syntax/src/parser.rs
@@ -18,8 +18,8 @@ use crate::*;
// their own crate because they are quite general and useful. For now they
// are here and hopefully you can figure out how they work.
-pub(crate) type ParsedExpr = Expr<Void>;
-pub(crate) type ParsedSubExpr = SubExpr<Void>;
+pub(crate) type ParsedExpr = Expr<!>;
+pub(crate) type ParsedSubExpr = SubExpr<!>;
type ParsedText = InterpolatedText<ParsedSubExpr>;
type ParsedTextContents = InterpolatedTextContents<ParsedSubExpr>;