Skip to content

Commit

Permalink
Merge pull request #360 from DaniPopes/fix-ruint-item
Browse files Browse the repository at this point in the history
fix: allow `uint!` in item position
  • Loading branch information
prestwich authored Mar 12, 2024
2 parents f0782ee + a395018 commit c99178c
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 5 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [1.12.1] - 2024-03-12

### Fixed

- docs.rs build ([#356])
- `uint!` in item position ([#360])

[#356]: https://github.com/recmo/uint/pull/356
[#360]: https://github.com/recmo/uint/pull/360

## [1.12.0] - 2024-02-27

Expand Down Expand Up @@ -312,7 +316,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

<!-- links to version -->

[unreleased]: https://github.com/recmo/uint/compare/v1.12.0...HEAD
[unreleased]: https://github.com/recmo/uint/compare/v1.12.1...HEAD
[1.12.1]: https://github.com/recmo/uint/releases/tag/v1.12.1
[1.12.0]: https://github.com/recmo/uint/releases/tag/v1.12.0
[1.11.1]: https://github.com/recmo/uint/releases/tag/v1.11.1
[1.11.0]: https://github.com/recmo/uint/releases/tag/v1.11.0
Expand Down
2 changes: 1 addition & 1 deletion src/algorithms/div/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ pub fn div(numerator: &mut [u64], divisor: &mut [u64]) {
#[cfg(test)]
mod tests {
use super::*;
use crate::{aliases::U512, uint};
use crate::aliases::U512;

// Test vectors from <https://github.com/chfast/intx/blob/8b5f4748a7386a9530769893dae26b3273e0ffe2/test/unittests/test_div.cpp#L58>
// [[numerator, divisor, quotient, remainder]; _]
Expand Down
3 changes: 1 addition & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,9 @@ pub use self::{
#[doc(inline)]
pub use ruint_macro::uint;

/// Extra features that are nightly only.
#[cfg(feature = "generic_const_exprs")]
pub mod nightly {
//! Extra features that are nightly only.
/// Alias for `Uint` specified only by bit size.
///
/// Compared to [`crate::Uint`] it compile-time computes the required number
Expand Down
18 changes: 17 additions & 1 deletion src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#[doc(hidden)]
macro_rules! uint {
($($t:tt)*) => {
$crate::__private::ruint_macro::uint_with_path!([$crate] $($t)*)
$crate::__private::ruint_macro::uint_with_path! { [$crate] $($t)* }
}
}

Expand Down Expand Up @@ -77,6 +77,22 @@ macro_rules! impl_bin_op {

#[cfg(test)]
mod tests {
// https://github.com/recmo/uint/issues/359
ruint_macro::uint_with_path! {
[crate]
const _A: [crate::aliases::U256; 2] = [
0x00006f85d6f68a85ec10345351a23a3aaf07f38af8c952a7bceca70bd2af7ad5_U256,
0x00004b4110c9ae997782e1509b1d0fdb20a7c02bbd8bea7305462b9f8125b1e8_U256,
];
}

crate::uint! {
const _B: [crate::aliases::U256; 2] = [
0x00006f85d6f68a85ec10345351a23a3aaf07f38af8c952a7bceca70bd2af7ad5_U256,
0x00004b4110c9ae997782e1509b1d0fdb20a7c02bbd8bea7305462b9f8125b1e8_U256,
];
}

#[test]
fn test_uint_macro_with_paths() {
extern crate self as aaa;
Expand Down

0 comments on commit c99178c

Please sign in to comment.