summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNadrieril2019-09-03 11:23:26 +0200
committerNadrieril2019-09-03 11:23:26 +0200
commit468977575c68ac4cc3a57395ace4095db50e8947 (patch)
tree4bee3eb9ae523c313ffa683688a1bd9ee2ec78cb
parenta92d09259fc1db995a036eb2f22491c7024ca878 (diff)
Upgrade rust toolchain
Diffstat (limited to '')
-rw-r--r--.rustfmt.toml2
-rw-r--r--dhall/src/phase/binary.rs28
-rw-r--r--dhall/src/phase/normalize.rs7
-rw-r--r--dhall/src/phase/typecheck.rs8
-rw-r--r--dhall_proc_macros/src/parse_children.rs2
-rw-r--r--dhall_syntax/src/lib.rs1
-rw-r--r--improved_slice_patterns/src/lib.rs25
-rw-r--r--rust-toolchain2
8 files changed, 34 insertions, 41 deletions
diff --git a/.rustfmt.toml b/.rustfmt.toml
index 0713c39..ee91dbd 100644
--- a/.rustfmt.toml
+++ b/.rustfmt.toml
@@ -1,3 +1,3 @@
edition = "2018"
max_width = 80
-error_on_line_overflow = true
+# error_on_line_overflow = true
diff --git a/dhall/src/phase/binary.rs b/dhall/src/phase/binary.rs
index 40219d9..76d7ec9 100644
--- a/dhall/src/phase/binary.rs
+++ b/dhall/src/phase/binary.rs
@@ -52,7 +52,7 @@ fn cbor_value_to_dhall(data: &cbor::Value) -> Result<DecodedExpr, DecodeError> {
let l = Label::from(l.as_str());
Var(V(l, *n as usize))
}
- [U64(0), f, args..] => {
+ [U64(0), f, args @ ..] => {
if args.is_empty() {
Err(DecodeError::WrongFormatError(
"Function application must have at least one argument"
@@ -126,7 +126,7 @@ fn cbor_value_to_dhall(data: &cbor::Value) -> Result<DecodedExpr, DecodeError> {
let t = cbor_value_to_dhall(&t)?;
EmptyListLit(rc(App(rc(ExprF::Builtin(Builtin::List)), t)))
}
- [U64(4), Null, rest..] => {
+ [U64(4), Null, rest @ ..] => {
let rest = rest
.iter()
.map(cbor_value_to_dhall)
@@ -174,7 +174,7 @@ fn cbor_value_to_dhall(data: &cbor::Value) -> Result<DecodedExpr, DecodeError> {
let l = Label::from(l.as_str());
Field(x, l)
}
- [U64(10), x, rest..] => {
+ [U64(10), x, rest @ ..] => {
let x = cbor_value_to_dhall(&x)?;
let labels = rest
.iter()
@@ -203,7 +203,7 @@ fn cbor_value_to_dhall(data: &cbor::Value) -> Result<DecodedExpr, DecodeError> {
[U64(15), U64(x)] => NaturalLit(*x as Natural),
[U64(16), U64(x)] => IntegerLit(*x as Integer),
[U64(16), I64(x)] => IntegerLit(*x as Integer),
- [U64(18), String(first), rest..] => {
+ [U64(18), String(first), rest @ ..] => {
TextLit(InterpolatedText::from((
first.clone(),
rest.iter()
@@ -225,7 +225,7 @@ fn cbor_value_to_dhall(data: &cbor::Value) -> Result<DecodedExpr, DecodeError> {
let t = cbor_value_to_dhall(&t)?;
Assert(t)
}
- [U64(24), hash, U64(mode), U64(scheme), rest..] => {
+ [U64(24), hash, U64(mode), U64(scheme), rest @ ..] => {
let mode = match mode {
0 => ImportMode::Code,
1 => ImportMode::RawText,
@@ -238,7 +238,9 @@ fn cbor_value_to_dhall(data: &cbor::Value) -> Result<DecodedExpr, DecodeError> {
let hash = match hash {
Null => None,
Bytes(bytes) => match bytes.as_slice() {
- [18, 32, rest..] => Some(Hash::SHA256(rest.to_vec())),
+ [18, 32, rest @ ..] => {
+ Some(Hash::SHA256(rest.to_vec()))
+ }
_ => Err(DecodeError::WrongFormatError(format!(
"import/hash/unknown_multihash: {:?}",
bytes
@@ -334,7 +336,7 @@ fn cbor_value_to_dhall(data: &cbor::Value) -> Result<DecodedExpr, DecodeError> {
location,
})
}
- [U64(25), bindings..] => {
+ [U64(25), bindings @ ..] => {
let mut tuples = bindings.iter().tuples();
let bindings = (&mut tuples)
.map(|(x, t, v)| {
@@ -478,13 +480,9 @@ where
BoolIf(x, y, z) => ser_seq!(ser; tag(14), expr(x), expr(y), expr(z)),
Var(V(l, n)) if l == &"_".into() => ser.serialize_u64(*n as u64),
Var(V(l, n)) => ser_seq!(ser; label(l), U64(*n as u64)),
- Lam(l, x, y) if l == &"_".into() => {
- ser_seq!(ser; tag(1), expr(x), expr(y))
- }
+ Lam(l, x, y) if l == &"_".into() => ser_seq!(ser; tag(1), expr(x), expr(y)),
Lam(l, x, y) => ser_seq!(ser; tag(1), label(l), expr(x), expr(y)),
- Pi(l, x, y) if l == &"_".into() => {
- ser_seq!(ser; tag(2), expr(x), expr(y))
- }
+ Pi(l, x, y) if l == &"_".into() => ser_seq!(ser; tag(2), expr(x), expr(y)),
Pi(l, x, y) => ser_seq!(ser; tag(2), label(l), expr(x), expr(y)),
Let(_, _, _, _) => {
let (bound_e, bindings) = collect_nested_lets(e);
@@ -556,9 +554,7 @@ where
ser_seq!(ser; tag(3), U64(op), expr(x), expr(y))
}
Merge(x, y, None) => ser_seq!(ser; tag(6), expr(x), expr(y)),
- Merge(x, y, Some(z)) => {
- ser_seq!(ser; tag(6), expr(x), expr(y), expr(z))
- }
+ Merge(x, y, Some(z)) => ser_seq!(ser; tag(6), expr(x), expr(y), expr(z)),
ToMap(x, None) => ser_seq!(ser; tag(27), expr(x)),
ToMap(x, Some(y)) => ser_seq!(ser; tag(27), expr(x), expr(y)),
Projection(x, ls) => ser.collect_seq(
diff --git a/dhall/src/phase/normalize.rs b/dhall/src/phase/normalize.rs
index 3f6e99c..0992f74 100644
--- a/dhall/src/phase/normalize.rs
+++ b/dhall/src/phase/normalize.rs
@@ -290,7 +290,7 @@ pub(crate) fn apply_builtin(
)
}
},
- (ListFold, [_, l, _, cons, nil, r..]) => match &*l.as_whnf() {
+ (ListFold, [_, l, _, cons, nil, r @ ..]) => match &*l.as_whnf() {
EmptyListLit(_) => Ret::ValueWithRemainingArgs(r, nil.clone()),
NEListLit(xs) => {
let mut v = nil.clone();
@@ -326,7 +326,8 @@ pub(crate) fn apply_builtin(
)
}
},
- (OptionalFold, [_, v, _, just, nothing, r..]) => match &*v.as_whnf() {
+ (OptionalFold, [_, v, _, just, nothing, r @ ..]) => match &*v.as_whnf()
+ {
EmptyOptionalLit(_) => {
Ret::ValueWithRemainingArgs(r, nothing.clone())
}
@@ -356,7 +357,7 @@ pub(crate) fn apply_builtin(
),
),
},
- (NaturalFold, [n, t, succ, zero, r..]) => match &*n.as_whnf() {
+ (NaturalFold, [n, t, succ, zero, r @ ..]) => match &*n.as_whnf() {
NaturalLit(0) => Ret::ValueWithRemainingArgs(r, zero.clone()),
NaturalLit(n) => {
let fold = Value::from_builtin(NaturalFold)
diff --git a/dhall/src/phase/typecheck.rs b/dhall/src/phase/typecheck.rs
index 9013c1f..2e61fbc 100644
--- a/dhall/src/phase/typecheck.rs
+++ b/dhall/src/phase/typecheck.rs
@@ -249,9 +249,7 @@ fn type_of_builtin<E>(b: Builtin) -> Expr<E> {
list
),
ListLength => make_type!(forall (a: Type) -> (List a) -> Natural),
- ListHead | ListLast => {
- make_type!(forall (a: Type) -> (List a) -> Optional a)
- }
+ ListHead | ListLast => make_type!(forall (a: Type) -> (List a) -> Optional a),
ListIndexed => make_type!(
forall (a: Type) ->
(List a) ->
@@ -375,9 +373,7 @@ fn type_last_layer(
Import(_) => unreachable!(
"There should remain no imports in a resolved expression"
),
- Lam(_, _, _) | Pi(_, _, _) | Let(_, _, _, _) | Embed(_) | Var(_) => {
- unreachable!()
- }
+ Lam(_, _, _) | Pi(_, _, _) | Let(_, _, _, _) | Embed(_) | Var(_) => unreachable!(),
App(f, a) => {
let tf = f.get_type()?;
let tf_borrow = tf.as_whnf();
diff --git a/dhall_proc_macros/src/parse_children.rs b/dhall_proc_macros/src/parse_children.rs
index c78adbc..b1d43fc 100644
--- a/dhall_proc_macros/src/parse_children.rs
+++ b/dhall_proc_macros/src/parse_children.rs
@@ -91,7 +91,7 @@ fn make_parser_branch(
Single { rule_name, .. } => {
quote!(<<Self as PestConsumer>::RuleEnum>::#rule_name)
}
- Multiple { .. } => quote!(#i_variable_pattern..),
+ Multiple { .. } => quote!(#i_variable_pattern @ ..),
});
let match_filter = branch.pattern.iter().map(|item| match item {
Single { .. } => quote!(),
diff --git a/dhall_syntax/src/lib.rs b/dhall_syntax/src/lib.rs
index 7b43c6b..95f40c2 100644
--- a/dhall_syntax/src/lib.rs
+++ b/dhall_syntax/src/lib.rs
@@ -2,7 +2,6 @@
#![feature(slice_patterns)]
#![feature(never_type)]
#![feature(proc_macro_hygiene)]
-#![feature(type_alias_enum_variants)]
#![allow(
clippy::many_single_char_names,
clippy::should_implement_trait,
diff --git a/improved_slice_patterns/src/lib.rs b/improved_slice_patterns/src/lib.rs
index 5478c1b..1669207 100644
--- a/improved_slice_patterns/src/lib.rs
+++ b/improved_slice_patterns/src/lib.rs
@@ -15,7 +15,7 @@
/// Contrary to slice_patterns, this allows moving out
/// of the iterator.
///
-/// A variable length pattern (`x..`) is only allowed as the last
+/// A variable length pattern (`x @ ..`) is only allowed as the last
/// pattern, unless the iterator is double-ended.
///
/// Example:
@@ -25,7 +25,7 @@
/// let vec = vec![Some(1), Some(2), Some(3), None];
///
/// let res = destructure_iter!(vec.into_iter();
-/// [Some(x), y.., z] => {
+/// [Some(x), y @ .., z] => {
/// // x: usize
/// // y: impl Iterator<Option<usize>>
/// // z: Option<usize>
@@ -42,7 +42,8 @@
#[macro_export]
macro_rules! destructure_iter {
// Variable length pattern
- (@match_forwards, $iter:expr, ($body:expr), $x:ident.., $($rest:tt)*) => {
+ (@match_forwards, $iter:expr, ($body:expr),
+ $x:ident @ .., $($rest:tt)*) => {
$crate::destructure_iter!(@match_backwards,
$iter,
({
@@ -133,7 +134,7 @@ macro_rules! destructure_iter {
/// Contrary to slice_patterns, this allows moving out
/// of the `Vec`.
///
-/// A variable length pattern (`x..`) returns an iterator.
+/// A variable length pattern (`x @ ..`) returns an iterator.
///
/// Example:
/// ```edition2018
@@ -143,7 +144,7 @@ macro_rules! destructure_iter {
/// let vec = vec![Some(1), Some(2), Some(3), None];
///
/// let res = match_vec!(vec;
-/// [Some(_), y.., None] => {
+/// [Some(_), y @ .., None] => {
/// y.collect::<Vec<_>>()
/// },
/// [None, None] => {
@@ -158,7 +159,7 @@ macro_rules! destructure_iter {
/// let vec = vec![Some(1), Some(2), Some(3), None];
///
/// let res = match_vec!(vec;
-/// [Some(_), y.., Some(_)] => {
+/// [Some(_), y @ .., Some(_)] => {
/// y.collect::<Vec<_>>()
/// },
/// [None, None] => {
@@ -175,16 +176,16 @@ macro_rules! destructure_iter {
#[macro_export]
macro_rules! match_vec {
// Variable length pattern
- (@make_pat; ($($acc:tt)*), $x:ident.., $($rest:tt)*) => {
+ (@make_pat; ($($acc:tt)*), $x:ident @ .., $($rest:tt)*) => {
$crate::match_vec!(@make_pat;
- ($($acc)*, $x..),
+ ($($acc)*, $x @ ..),
$($rest)*
)
};
// Special variable length pattern with a common unary variant
(@make_pat; ($($acc:tt)*), $variant:ident ($x:ident).., $($rest:tt)*) => {
$crate::match_vec!(@make_pat;
- ($($acc)*, $x..),
+ ($($acc)*, $x @ ..),
$($rest)*
)
};
@@ -209,7 +210,7 @@ macro_rules! match_vec {
[$($acc)*]
};
- (@make_filter; $x:ident.., $($rest:tt)*) => {
+ (@make_filter; $x:ident @ .., $($rest:tt)*) => {
$crate::match_vec!(@make_filter;
$($rest)*
)
@@ -282,8 +283,8 @@ fn test() {
[Some(_x), None, None] => 4,
[Some(_x), None] => 2,
[None, Some(y)] => 1,
- [None, _y..] => 3,
- [_x.., Some(y), Some(z), None] => y - z,
+ [None, _y @ ..] => 3,
+ [_x @ .., Some(y), Some(z), None] => y - z,
[Some(ys)..] => ys.sum(),
[] => 0,
[..] => -1,
diff --git a/rust-toolchain b/rust-toolchain
index 50ef20a..1d00bee 100644
--- a/rust-toolchain
+++ b/rust-toolchain
@@ -1 +1 @@
-nightly-2019-03-22
+nightly-2019-09-03