Skip to content

Commit 6233736

Browse files
authored
chore(tests): Allow compiling examples and tests with stable toolchain (#63)
1 parent b9660e6 commit 6233736

File tree

11 files changed

+30
-45
lines changed

11 files changed

+30
-45
lines changed

arithmetic-coding-core/src/model.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@ pub mod one_shot;
1515
/// # Example
1616
///
1717
/// ```
18-
/// #![feature(exclusive_range_pattern)]
19-
/// #![feature(never_type)]
20-
/// # use std::ops::Range;
18+
/// # use std::convert::Infallible;
19+
/// use std::ops::Range;
2120
/// #
2221
/// # use arithmetic_coding_core::Model;
2322
///
@@ -32,9 +31,9 @@ pub mod one_shot;
3231
/// impl Model for MyModel {
3332
/// type B = u32;
3433
/// type Symbol = Symbol;
35-
/// type ValueError = !;
34+
/// type ValueError = Infallible;
3635
///
37-
/// fn probability(&self, symbol: Option<&Self::Symbol>) -> Result<Range<u32>, !> {
36+
/// fn probability(&self, symbol: Option<&Self::Symbol>) -> Result<Range<u32>, Infallible> {
3837
/// Ok(match symbol {
3938
/// None => 0..1,
4039
/// Some(&Symbol::A) => 1..2,

arithmetic-coding-core/src/model/fixed_length.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use crate::BitStore;
2020
/// # Example
2121
///
2222
/// ```
23-
/// #![feature(never_type)]
23+
/// # use std::convert::Infallible;
2424
/// # use std::ops::Range;
2525
/// #
2626
/// # use arithmetic_coding_core::fixed_length;
@@ -36,9 +36,9 @@ use crate::BitStore;
3636
/// impl fixed_length::Model for MyModel {
3737
/// type B = u32;
3838
/// type Symbol = Symbol;
39-
/// type ValueError = !;
39+
/// type ValueError = Infallible;
4040
///
41-
/// fn probability(&self, symbol: &Self::Symbol) -> Result<Range<u32>, !> {
41+
/// fn probability(&self, symbol: &Self::Symbol) -> Result<Range<u32>, Infallible> {
4242
/// Ok(match symbol {
4343
/// Symbol::A => 0..1,
4444
/// Symbol::B => 1..2,

arithmetic-coding-core/src/model/max_length.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use crate::BitStore;
2222
/// # Example
2323
///
2424
/// ```
25-
/// #![feature(never_type)]
25+
/// # use std::convert::Infallible;
2626
/// # use std::ops::Range;
2727
/// #
2828
/// # use arithmetic_coding_core::max_length;
@@ -38,9 +38,9 @@ use crate::BitStore;
3838
/// impl max_length::Model for MyModel {
3939
/// type B = u32;
4040
/// type Symbol = Symbol;
41-
/// type ValueError = !;
41+
/// type ValueError = Infallible;
4242
///
43-
/// fn probability(&self, symbol: Option<&Self::Symbol>) -> Result<Range<u32>, !> {
43+
/// fn probability(&self, symbol: Option<&Self::Symbol>) -> Result<Range<u32>, Infallible> {
4444
/// Ok(match symbol {
4545
/// Some(Symbol::A) => 0..1,
4646
/// Some(Symbol::B) => 1..2,

arithmetic-coding-core/src/model/one_shot.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use crate::{fixed_length, BitStore};
2323
/// # Example
2424
///
2525
/// ```
26-
/// #![feature(never_type)]
26+
/// # use std::convert::Infallible;
2727
/// # use std::ops::Range;
2828
/// #
2929
/// # use arithmetic_coding_core::one_shot;
@@ -39,9 +39,9 @@ use crate::{fixed_length, BitStore};
3939
/// impl one_shot::Model for MyModel {
4040
/// type B = u32;
4141
/// type Symbol = Symbol;
42-
/// type ValueError = !;
42+
/// type ValueError = Infallible;
4343
///
44-
/// fn probability(&self, symbol: &Self::Symbol) -> Result<Range<u32>, !> {
44+
/// fn probability(&self, symbol: &Self::Symbol) -> Result<Range<u32>, Infallible> {
4545
/// Ok(match symbol {
4646
/// Symbol::A => 0..1,
4747
/// Symbol::B => 1..2,

examples/concatenated.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![feature(never_type)]
2-
31
use arithmetic_coding::{Decoder, Encoder, Model};
42
use bitstream_io::{BigEndian, BitRead, BitReader, BitWrite, BitWriter};
53

@@ -47,7 +45,7 @@ mod integer {
4745
}
4846

4947
mod symbolic {
50-
use std::ops::Range;
48+
use std::{convert::Infallible, ops::Range};
5149

5250
#[derive(Debug)]
5351
pub enum Symbol {
@@ -61,9 +59,9 @@ mod symbolic {
6159
impl arithmetic_coding::Model for Model {
6260
type B = u32;
6361
type Symbol = Symbol;
64-
type ValueError = !;
62+
type ValueError = Infallible;
6563

66-
fn probability(&self, symbol: Option<&Self::Symbol>) -> Result<Range<u32>, !> {
64+
fn probability(&self, symbol: Option<&Self::Symbol>) -> Result<Range<u32>, Infallible> {
6765
Ok(match symbol {
6866
None => 0..1,
6967
Some(&Symbol::A) => 1..2,

examples/fixed_length.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
#![feature(never_type)]
2-
3-
use std::ops::Range;
1+
use std::{convert::Infallible, ops::Range};
42

53
use arithmetic_coding::fixed_length;
64

@@ -19,7 +17,7 @@ pub struct MyModel;
1917
impl fixed_length::Model for MyModel {
2018
type B = u32;
2119
type Symbol = Symbol;
22-
type ValueError = !;
20+
type ValueError = Infallible;
2321

2422
fn probability(&self, symbol: &Self::Symbol) -> Result<Range<u32>, Self::ValueError> {
2523
match symbol {

examples/max_length.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
#![feature(never_type)]
2-
3-
use std::ops::Range;
1+
use std::{convert::Infallible, ops::Range};
42

53
use arithmetic_coding::max_length;
64

@@ -19,7 +17,7 @@ pub struct MyModel;
1917
impl max_length::Model for MyModel {
2018
type B = u32;
2119
type Symbol = Symbol;
22-
type ValueError = !;
20+
type ValueError = Infallible;
2321

2422
fn probability(&self, symbol: Option<&Self::Symbol>) -> Result<Range<u32>, Self::ValueError> {
2523
match symbol {

examples/symbolic.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
#![feature(never_type)]
2-
3-
use std::ops::Range;
1+
use std::{convert::Infallible, ops::Range};
42

53
use arithmetic_coding::Model;
64

@@ -19,9 +17,9 @@ pub struct MyModel;
1917
impl Model for MyModel {
2018
type B = u32;
2119
type Symbol = Symbol;
22-
type ValueError = !;
20+
type ValueError = Infallible;
2321

24-
fn probability(&self, symbol: Option<&Self::Symbol>) -> Result<Range<u32>, !> {
22+
fn probability(&self, symbol: Option<&Self::Symbol>) -> Result<Range<u32>, Infallible> {
2523
Ok(match symbol {
2624
None => 0..1,
2725
Some(&Symbol::A) => 1..2,

tests/concatenated.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![feature(never_type)]
2-
31
use arithmetic_coding::{Decoder, Encoder, Model};
42
use bitstream_io::{BigEndian, BitRead, BitReader, BitWrite, BitWriter};
53
use symbolic::Symbol;
@@ -48,7 +46,7 @@ mod integer {
4846
}
4947

5048
mod symbolic {
51-
use std::ops::Range;
49+
use std::{convert::Infallible, ops::Range};
5250

5351
#[derive(Debug, PartialEq, Eq)]
5452
pub enum Symbol {
@@ -62,9 +60,9 @@ mod symbolic {
6260
impl arithmetic_coding::Model for Model {
6361
type B = u32;
6462
type Symbol = Symbol;
65-
type ValueError = !;
63+
type ValueError = Infallible;
6664

67-
fn probability(&self, symbol: Option<&Self::Symbol>) -> Result<Range<u32>, !> {
65+
fn probability(&self, symbol: Option<&Self::Symbol>) -> Result<Range<u32>, Infallible> {
6866
Ok(match symbol {
6967
None => 0..1,
7068
Some(&Symbol::A) => 1..2,

tests/fixed_length.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
#![feature(never_type)]
2-
3-
use std::ops::Range;
1+
use std::{convert::Infallible, ops::Range};
42

53
use arithmetic_coding::fixed_length;
64

@@ -19,7 +17,7 @@ pub struct MyModel;
1917
impl fixed_length::Model for MyModel {
2018
type B = u32;
2119
type Symbol = Symbol;
22-
type ValueError = !;
20+
type ValueError = Infallible;
2321

2422
fn probability(&self, symbol: &Self::Symbol) -> Result<Range<u32>, Self::ValueError> {
2523
match symbol {

tests/max_length.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
#![feature(never_type)]
2-
3-
use std::ops::Range;
1+
use std::{convert::Infallible, ops::Range};
42

53
use arithmetic_coding::max_length;
64
use test_case::test_case;
@@ -20,7 +18,7 @@ pub struct MyModel;
2018
impl max_length::Model for MyModel {
2119
type B = u32;
2220
type Symbol = Symbol;
23-
type ValueError = !;
21+
type ValueError = Infallible;
2422

2523
fn probability(&self, symbol: Option<&Self::Symbol>) -> Result<Range<u32>, Self::ValueError> {
2624
match symbol {

0 commit comments

Comments
 (0)