Skip to content

Commit

Permalink
ci: Rust 1.79 fixes (#1202)
Browse files Browse the repository at this point in the history
  • Loading branch information
dj8yfo authored Jun 19, 2024
1 parent 0974448 commit 5970226
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 29 deletions.
21 changes: 15 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,35 @@ env:
RUSTFLAGS: -D warnings
jobs:
test:
runs-on: ${{ matrix.platform }}
name: "${{ matrix.platform }} ${{ matrix.toolchain }}"
runs-on: ${{ matrix.platform.os }}
name: "${{ matrix.platform.os }} ${{ matrix.platform.rs }}"
strategy:
matrix:
platform: [ubuntu-latest, macos-latest]
toolchain: [stable, 1.76.0]
platform:
- os: ubuntu-latest
rs: 1.76.0
- os: ubuntu-latest
rs: stable
- os: macos-latest
rs: 1.76.0
- os: macos-latest
rs: 1.78.0
steps:
- uses: actions/checkout@v3
- name: "${{ matrix.toolchain }} with rustfmt, and wasm32"
- name: "${{ matrix.platform.rs }} with rustfmt, and wasm32"
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.toolchain }}
toolchain: ${{ matrix.platform.rs }}
default: true
target: wasm32-unknown-unknown
- uses: Swatinem/rust-cache@v1
# - name: Downgrade dependencies
# run: |
# cargo update -p clap@4.5.4 --precise 4.4.18
# cd examples/adder && cargo update -p clap@4.5.4 --precise 4.4.18
- name: print rustc && rustdoc version
run: rustc --version && rustdoc --version
- name: test
run: cargo test --all --features unstable,legacy
lint:
Expand Down
3 changes: 3 additions & 0 deletions near-sdk-macros/src/core_impl/info_extractor/arg_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,15 @@ pub enum BindgenArgType {
/// A single argument of a function after it was processed by the bindgen.
pub struct ArgInfo {
/// Attributes not related to bindgen.
#[allow(unused)]
pub non_bindgen_attrs: Vec<Attribute>,
/// The `binding` part of `ref mut binding @ SUBPATTERN: TYPE` argument.
pub ident: Ident,
/// Whether pattern has a preceded `ref`.
#[allow(unused)]
pub pat_reference: Option<Token![ref]>,
/// Whether pattern has a preceded `mut`.
#[allow(unused)]
pub pat_mutability: Option<Token![mut]>,
/// Whether the `TYPE` starts with `&`.
pub reference: Option<Token![&]>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ pub struct TraitItemMethodInfo {
/// Attributes and signature information.
pub attr_sig_info: AttrSigInfo,
/// The original AST of the trait item method.
#[allow(unused)]
pub original: TraitItemFn,
/// String representation of method name, e.g. `"my_method"`.
#[allow(unused)]
pub ident_byte_str: LitStr,
}

Expand Down
16 changes: 8 additions & 8 deletions near-sdk/compilation_tests/schema_derive_invalids.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@ error[E0277]: the trait bound `Inner: JsonSchema` is not satisfied
| ^^^^^ the trait `JsonSchema` is not implemented for `Inner`
|
= help: the following other types implement trait `JsonSchema`:
bool
char
isize
i8
i16
i32
i64
i128
&'a T
&'a mut T
()
(T0, T1)
(T0, T1, T2)
(T0, T1, T2, T3)
(T0, T1, T2, T3, T4)
(T0, T1, T2, T3, T4, T5)
and $N others
note: required by a bound in `SchemaGenerator::subschema_for`
--> $CARGO/schemars-0.8.21/src/gen.rs
Expand Down
6 changes: 3 additions & 3 deletions near-sdk/src/environment/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ const REGISTER_EXPECTED_ERR: &str =
/// Register used internally for atomic operations. This register is safe to use by the user,
/// since it only needs to be untouched while methods of `Environment` execute, which is guaranteed
/// guest code is not parallel.
const ATOMIC_OP_REGISTER: u64 = std::u64::MAX - 2;
const ATOMIC_OP_REGISTER: u64 = u64::MAX - 2;
/// Register used to record evicted values from the storage.
const EVICTED_REGISTER: u64 = std::u64::MAX - 1;
const EVICTED_REGISTER: u64 = u64::MAX - 1;

/// Key used to store the state of the contract.
const STATE_KEY: &[u8] = b"STATE";
Expand Down Expand Up @@ -139,7 +139,7 @@ pub fn read_register(register_id: u64) -> Option<Vec<u8>> {
/// Returns the size of the register. If register is not used returns `None`.
pub fn register_len(register_id: u64) -> Option<u64> {
let len = unsafe { sys::register_len(register_id) };
if len == std::u64::MAX {
if len == u64::MAX {
None
} else {
Some(len)
Expand Down
20 changes: 10 additions & 10 deletions near-sdk/src/json_types/integers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ mod tests {
test_serde!(U128, u128, 123);
test_serde!(U128, u128, 10u128.pow(18));
test_serde!(U128, u128, 2u128.pow(100));
test_serde!(U128, u128, u128::max_value());
assert!(U128::from(u128::min_value()) < U128::from(u128::max_value()));
test_serde!(U128, u128, u128::MAX);
assert!(U128::from(u128::MIN) < U128::from(u128::MAX));
}

#[test]
Expand All @@ -108,9 +108,9 @@ mod tests {
test_serde!(I128, i128, 10i128.pow(18));
test_serde!(I128, i128, 2i128.pow(100));
test_serde!(I128, i128, -(2i128.pow(100)));
test_serde!(I128, i128, i128::max_value());
test_serde!(I128, i128, i128::min_value());
assert!(I128::from(i128::min_value()) < I128::from(i128::max_value()));
test_serde!(I128, i128, i128::MAX);
test_serde!(I128, i128, i128::MIN);
assert!(I128::from(i128::MIN) < I128::from(i128::MAX));
}

#[test]
Expand All @@ -120,8 +120,8 @@ mod tests {
test_serde!(U64, u64, 123);
test_serde!(U64, u64, 10u64.pow(18));
test_serde!(U64, u64, 2u64.pow(60));
test_serde!(U64, u64, u64::max_value());
assert!(U64::from(u64::min_value()) < U64::from(u64::max_value()));
test_serde!(U64, u64, u64::MAX);
assert!(U64::from(u64::MIN) < U64::from(u64::MAX));
}

#[test]
Expand All @@ -133,8 +133,8 @@ mod tests {
test_serde!(I64, i64, 10i64.pow(18));
test_serde!(I64, i64, 2i64.pow(60));
test_serde!(I64, i64, -(2i64.pow(60)));
test_serde!(I64, i64, i64::max_value());
test_serde!(I64, i64, i64::min_value());
assert!(I64::from(i64::min_value()) < I64::from(i64::max_value()));
test_serde!(I64, i64, i64::MAX);
test_serde!(I64, i64, i64::MIN);
assert!(I64::from(i64::MIN) < I64::from(i64::MAX));
}
}
1 change: 0 additions & 1 deletion near-sdk/src/store/iterable_map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,6 @@ mod test_map {
use borsh::{BorshDeserialize, BorshSerialize};
use rand::{rngs::SmallRng, Rng, SeedableRng};
use std::cell::RefCell;
use std::usize;
use std::vec::Vec;

#[test]
Expand Down
1 change: 0 additions & 1 deletion near-sdk/src/store/lookup_map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,6 @@ mod test_map {
use crate::store::LookupMap;
use borsh::{BorshDeserialize, BorshSerialize};
use std::cell::RefCell;
use std::usize;
use std::vec::Vec;

#[test]
Expand Down

0 comments on commit 5970226

Please sign in to comment.