Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
2 changes: 1 addition & 1 deletion g2gen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ A macro to create types that implement fast finite field arithmetic.
"""
categories = [ "no-std", "algorithms" ]
keywords = [ "finite-field", "galois", "macro", "newtype"]
rust-version = "1.61"
rust-version = "1.70"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cargo +1.61.0 check

Runs just fine. Issue seems to be running cargo +1.61.0 test, which I'd say can be ignored. I guess that means the CI setup should be updated so it only runs check in the MSRV case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, I think we need to pin dependencies to an older version, cause I get

error: package textwrap v0.16.2 cannot be built because it requires rustc 1.70 or newer, while the currently active rustc version is 1.61.0

when trying to run the tests with cargo +1.61.0 test

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. the dev-dependecies are no longer compatible with 1.61.0. So you cannot run cargo +1.61.0 test. But you can still run cargo +1.61.0 check. So g2p will run just fine with the older rust version, it's just that we can't test it with the current tests :/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a Cargo.lock file, with dependencies set to versions that are compatible with 1.61. With this the tests should work fine when run with cargo +1.61.0 test


[lib]
proc-macro = true
Expand Down
13 changes: 1 addition & 12 deletions g2gen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pub fn g2p(input: P1TokenStream) -> P1TokenStream {
let mod_name = Ident::new(&format!("{}_mod", ident_name), Span::call_site());

let struct_def = quote![
#[derive(Clone, Copy, Hash)]
#[derive(Clone, Copy, Eq, PartialEq, Hash)]
pub struct #ident(pub #ty);
];

Expand All @@ -95,16 +95,6 @@ pub fn g2p(input: P1TokenStream) -> P1TokenStream {
}
];

let eq = quote![
impl ::core::cmp::PartialEq<Self> for #ident {
fn eq(&self, other: &Self) -> bool {
self.0 == other.0
}
}

impl ::core::cmp::Eq for #ident {}
];

let tmpl = format!("{{}}_{}", ident_name);
let debug = quote![
impl ::core::fmt::Debug for #ident {
Expand Down Expand Up @@ -196,7 +186,6 @@ pub fn g2p(input: P1TokenStream) -> P1TokenStream {
#tables
#from
#into
#eq
#debug
#display
#add
Expand Down
2 changes: 1 addition & 1 deletion g2p/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ A crate to create types that implement fast finite field arithmetic.
"""
categories = [ "no-std", "cryptography", "algorithms" ]
keywords = [ "finite-field", "galois", "macro", "newtype"]
rust-version = "1.61"
rust-version = "1.70"

[dev-dependencies]
static_assertions = "1.1"
Expand Down
8 changes: 4 additions & 4 deletions g2poly/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ impl G2PolyProd {
/// assert_eq!((G2Poly(0x40_00_00_00_00_00_00_00) * G2Poly(4)).try_to_poly(), None);
/// ```
pub fn try_to_poly(self) -> Option<G2Poly> {
if self.0 <= u64::max_value() as u128 {
if self.0 <= u64::MAX as u128 {
Some(G2Poly(self.0 as u64))
} else {
None
Expand All @@ -110,19 +110,19 @@ impl G2PolyProd {
}

impl fmt::Debug for G2Poly {
fn fmt<'a>(&self, f: &mut fmt::Formatter<'a>) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "G2Poly {{ {:b} }}", self.0)
}
}

impl fmt::Debug for G2PolyProd {
fn fmt<'a>(&self, f: &mut fmt::Formatter<'a>) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "G2PolyProd {{ {:b} }}", self.0)
}
}

impl fmt::Display for G2Poly {
fn fmt<'a>(&self, f: &mut fmt::Formatter<'a>) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
if self.0 == 0 {
return write!(f, "G2Poly {{ 0 }}");
}
Expand Down
Loading