Skip to content

chore(tests): Allow compiling examples and tests with stable toolchain #63

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions arithmetic-coding-core/src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ pub mod one_shot;
/// # Example
///
/// ```
/// #![feature(exclusive_range_pattern)]
/// #![feature(never_type)]
/// # use std::ops::Range;
/// # use std::convert::Infallible;
/// use std::ops::Range;
/// #
/// # use arithmetic_coding_core::Model;
///
Expand All @@ -32,9 +31,9 @@ pub mod one_shot;
/// impl Model for MyModel {
/// type B = u32;
/// type Symbol = Symbol;
/// type ValueError = !;
/// type ValueError = Infallible;
///
/// fn probability(&self, symbol: Option<&Self::Symbol>) -> Result<Range<u32>, !> {
/// fn probability(&self, symbol: Option<&Self::Symbol>) -> Result<Range<u32>, Infallible> {
/// Ok(match symbol {
/// None => 0..1,
/// Some(&Symbol::A) => 1..2,
Expand Down
6 changes: 3 additions & 3 deletions arithmetic-coding-core/src/model/fixed_length.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use crate::BitStore;
/// # Example
///
/// ```
/// #![feature(never_type)]
/// # use std::convert::Infallible;
/// # use std::ops::Range;
/// #
/// # use arithmetic_coding_core::fixed_length;
Expand All @@ -36,9 +36,9 @@ use crate::BitStore;
/// impl fixed_length::Model for MyModel {
/// type B = u32;
/// type Symbol = Symbol;
/// type ValueError = !;
/// type ValueError = Infallible;
///
/// fn probability(&self, symbol: &Self::Symbol) -> Result<Range<u32>, !> {
/// fn probability(&self, symbol: &Self::Symbol) -> Result<Range<u32>, Infallible> {
/// Ok(match symbol {
/// Symbol::A => 0..1,
/// Symbol::B => 1..2,
Expand Down
6 changes: 3 additions & 3 deletions arithmetic-coding-core/src/model/max_length.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use crate::BitStore;
/// # Example
///
/// ```
/// #![feature(never_type)]
/// # use std::convert::Infallible;
/// # use std::ops::Range;
/// #
/// # use arithmetic_coding_core::max_length;
Expand All @@ -38,9 +38,9 @@ use crate::BitStore;
/// impl max_length::Model for MyModel {
/// type B = u32;
/// type Symbol = Symbol;
/// type ValueError = !;
/// type ValueError = Infallible;
///
/// fn probability(&self, symbol: Option<&Self::Symbol>) -> Result<Range<u32>, !> {
/// fn probability(&self, symbol: Option<&Self::Symbol>) -> Result<Range<u32>, Infallible> {
/// Ok(match symbol {
/// Some(Symbol::A) => 0..1,
/// Some(Symbol::B) => 1..2,
Expand Down
6 changes: 3 additions & 3 deletions arithmetic-coding-core/src/model/one_shot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use crate::{fixed_length, BitStore};
/// # Example
///
/// ```
/// #![feature(never_type)]
/// # use std::convert::Infallible;
/// # use std::ops::Range;
/// #
/// # use arithmetic_coding_core::one_shot;
Expand All @@ -39,9 +39,9 @@ use crate::{fixed_length, BitStore};
/// impl one_shot::Model for MyModel {
/// type B = u32;
/// type Symbol = Symbol;
/// type ValueError = !;
/// type ValueError = Infallible;
///
/// fn probability(&self, symbol: &Self::Symbol) -> Result<Range<u32>, !> {
/// fn probability(&self, symbol: &Self::Symbol) -> Result<Range<u32>, Infallible> {
/// Ok(match symbol {
/// Symbol::A => 0..1,
/// Symbol::B => 1..2,
Expand Down
8 changes: 3 additions & 5 deletions examples/concatenated.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![feature(never_type)]

use arithmetic_coding::{Decoder, Encoder, Model};
use bitstream_io::{BigEndian, BitRead, BitReader, BitWrite, BitWriter};

Expand Down Expand Up @@ -47,7 +45,7 @@ mod integer {
}

mod symbolic {
use std::ops::Range;
use std::{convert::Infallible, ops::Range};

#[derive(Debug)]
pub enum Symbol {
Expand All @@ -61,9 +59,9 @@ mod symbolic {
impl arithmetic_coding::Model for Model {
type B = u32;
type Symbol = Symbol;
type ValueError = !;
type ValueError = Infallible;

fn probability(&self, symbol: Option<&Self::Symbol>) -> Result<Range<u32>, !> {
fn probability(&self, symbol: Option<&Self::Symbol>) -> Result<Range<u32>, Infallible> {
Ok(match symbol {
None => 0..1,
Some(&Symbol::A) => 1..2,
Expand Down
6 changes: 2 additions & 4 deletions examples/fixed_length.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#![feature(never_type)]

use std::ops::Range;
use std::{convert::Infallible, ops::Range};

use arithmetic_coding::fixed_length;

Expand All @@ -19,7 +17,7 @@ pub struct MyModel;
impl fixed_length::Model for MyModel {
type B = u32;
type Symbol = Symbol;
type ValueError = !;
type ValueError = Infallible;

fn probability(&self, symbol: &Self::Symbol) -> Result<Range<u32>, Self::ValueError> {
match symbol {
Expand Down
6 changes: 2 additions & 4 deletions examples/max_length.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#![feature(never_type)]

use std::ops::Range;
use std::{convert::Infallible, ops::Range};

use arithmetic_coding::max_length;

Expand All @@ -19,7 +17,7 @@ pub struct MyModel;
impl max_length::Model for MyModel {
type B = u32;
type Symbol = Symbol;
type ValueError = !;
type ValueError = Infallible;

fn probability(&self, symbol: Option<&Self::Symbol>) -> Result<Range<u32>, Self::ValueError> {
match symbol {
Expand Down
8 changes: 3 additions & 5 deletions examples/symbolic.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#![feature(never_type)]

use std::ops::Range;
use std::{convert::Infallible, ops::Range};

use arithmetic_coding::Model;

Expand All @@ -19,9 +17,9 @@ pub struct MyModel;
impl Model for MyModel {
type B = u32;
type Symbol = Symbol;
type ValueError = !;
type ValueError = Infallible;

fn probability(&self, symbol: Option<&Self::Symbol>) -> Result<Range<u32>, !> {
fn probability(&self, symbol: Option<&Self::Symbol>) -> Result<Range<u32>, Infallible> {
Ok(match symbol {
None => 0..1,
Some(&Symbol::A) => 1..2,
Expand Down
8 changes: 3 additions & 5 deletions tests/concatenated.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![feature(never_type)]

use arithmetic_coding::{Decoder, Encoder, Model};
use bitstream_io::{BigEndian, BitRead, BitReader, BitWrite, BitWriter};
use symbolic::Symbol;
Expand Down Expand Up @@ -48,7 +46,7 @@ mod integer {
}

mod symbolic {
use std::ops::Range;
use std::{convert::Infallible, ops::Range};

#[derive(Debug, PartialEq, Eq)]
pub enum Symbol {
Expand All @@ -62,9 +60,9 @@ mod symbolic {
impl arithmetic_coding::Model for Model {
type B = u32;
type Symbol = Symbol;
type ValueError = !;
type ValueError = Infallible;

fn probability(&self, symbol: Option<&Self::Symbol>) -> Result<Range<u32>, !> {
fn probability(&self, symbol: Option<&Self::Symbol>) -> Result<Range<u32>, Infallible> {
Ok(match symbol {
None => 0..1,
Some(&Symbol::A) => 1..2,
Expand Down
6 changes: 2 additions & 4 deletions tests/fixed_length.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#![feature(never_type)]

use std::ops::Range;
use std::{convert::Infallible, ops::Range};

use arithmetic_coding::fixed_length;

Expand All @@ -19,7 +17,7 @@ pub struct MyModel;
impl fixed_length::Model for MyModel {
type B = u32;
type Symbol = Symbol;
type ValueError = !;
type ValueError = Infallible;

fn probability(&self, symbol: &Self::Symbol) -> Result<Range<u32>, Self::ValueError> {
match symbol {
Expand Down
6 changes: 2 additions & 4 deletions tests/max_length.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#![feature(never_type)]

use std::ops::Range;
use std::{convert::Infallible, ops::Range};

use arithmetic_coding::max_length;
use test_case::test_case;
Expand All @@ -20,7 +18,7 @@ pub struct MyModel;
impl max_length::Model for MyModel {
type B = u32;
type Symbol = Symbol;
type ValueError = !;
type ValueError = Infallible;

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