Skip to content

Commit 82632f1

Browse files
authored
Fix up CI and update MSRV (#543)
1 parent e80f528 commit 82632f1

File tree

8 files changed

+25
-34
lines changed

8 files changed

+25
-34
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
matrix:
4747
RUST:
4848
# MSRV
49-
- VERSION: "1.65.0"
49+
- VERSION: "1.74.0"
5050
FLAGS: ""
5151

5252
- VERSION: stable
@@ -86,18 +86,6 @@ jobs:
8686
target/
8787
key: ${{ runner.os }}-${{ matrix.RUST.VERSION }}-cargo-2-${{ hashFiles('**/Cargo.toml') }}
8888

89-
- run: |
90-
cargo generate-lockfile
91-
cargo update -p anstyle --precise 1.0.8
92-
cargo update -p anstyle-parse --precise 0.2.5
93-
cargo update -p anstyle-query --precise 1.1.1
94-
cargo update -p clap --precise 4.3.24
95-
cargo update -p clap_builder --precise 4.3.24
96-
cargo update -p clap_lex --precise 0.5.0
97-
cargo update -p colorchoice --precise 1.0.2
98-
cargo update -p once_cell --precise 1.20.3
99-
if: matrix.RUST.VERSION == '1.65.0'
100-
10189
- run: cargo check --workspace --tests ${{ matrix.RUST.FLAGS }}
10290
- run: cargo test --workspace ${{ matrix.RUST.FLAGS }}
10391
if: "${{ !matrix.RUST.SKIP_TESTS }}"
@@ -111,19 +99,15 @@ jobs:
11199

112100
- uses: dtolnay/rust-toolchain@888c2e1ea69ab0d4330cbf0af1ecc7b68f368cc1
113101
with:
114-
toolchain: 1.76.0
102+
toolchain: "1.74"
115103
components: llvm-tools-preview
116104

117105
- run: sudo apt update && sudo apt-get install -y lcov
118106

119107
- uses: actions/[email protected]
120108
id: cargo-cache
121109
with:
122-
path: |
123-
~/.cargo/registry/index/
124-
~/.cargo/registry/cache/
125-
~/.cargo/git/db/
126-
target/
110+
path: target/
127111
key: ${{ runner.os }}-cargo-5-${{ hashFiles('**/Cargo.toml') }}
128112

129113
- run: cargo test

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ categories = ["parser-implementations", "encoding", "no-std"]
1010

1111
edition = "2021"
1212
# This specifies the MSRV
13-
rust-version = "1.65.0"
13+
rust-version = "1.74.0"
1414

1515
[features]
1616
default = ["std"]

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Add `asn1` to your `Cargo.toml`:
1313
$ cargo add asn1
1414
```
1515

16-
Builds on Rust 1.65.0 and newer.
16+
Builds on Rust 1.74.0 and newer.
1717

1818
`rust-asn1` is compatible with `#![no_std]` environments:
1919

@@ -23,6 +23,12 @@ $ cargo add asn1 --no-default-features
2323

2424
## Changelog
2525

26+
### Unreleased
27+
28+
#### Changes
29+
30+
- Updated MSRV to 1.74.0.
31+
2632
### [0.21.3]
2733

2834
#### Added
@@ -35,7 +41,6 @@ $ cargo add asn1 --no-default-features
3541

3642
- `BigInt::new`, `BigUint::new`, and `DateTime::new` are now `const fn`.
3743

38-
3944
### [0.21.1]
4045

4146
#### Added

asn1_derive/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ license = "BSD-3-Clause"
77
description = "#[derive] support for asn1"
88
edition = "2021"
99
# This specifies the MSRV
10-
rust-version = "1.65.0"
10+
rust-version = "1.74.0"
1111

1212
[lib]
1313
proc-macro = true

asn1_derive/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ fn generate_struct_read_block(
739739
let name = &f.ident;
740740
let is_defined_by_marker = name
741741
.as_ref()
742-
.map_or(false, |n| defined_by_markers.contains(n));
742+
.is_some_and(|n| defined_by_markers.contains(n));
743743
let name_str = name
744744
.as_ref()
745745
.ok_or_else(|| syn::Error::new_spanned(f, "Field is missing a name"))?;

asn1parse/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ name = "asn1parse"
33
version = "0.1.0"
44
edition = "2021"
55
publish = false
6+
# This specifies the MSRV
7+
rust-version = "1.74.0"
68

79
[dependencies]
810
asn1 = { version = "0.21", path = ".." }

src/base128.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::parser::{ParseError, ParseErrorKind, ParseResult};
22

3-
const INT_MAX_BYTES: u32 = (u128::BITS + 6) / 7;
3+
const INT_MAX_BYTES: u32 = u128::BITS.div_ceil(7);
44

55
pub(crate) fn read_base128_int(mut data: &[u8]) -> ParseResult<(u128, &[u8])> {
66
let mut ret = 0u128;
@@ -30,7 +30,7 @@ pub(crate) fn read_base128_int(mut data: &[u8]) -> ParseResult<(u128, &[u8])> {
3030
pub(crate) fn base128_length(n: u128) -> usize {
3131
// Equivalent to: let bits = if n != 0 { 128 - n.leading_zeros() } else { 1 };
3232
let bits = u128::BITS - (n | 1).leading_zeros();
33-
let bytes = (bits + 6) / 7;
33+
let bytes = bits.div_ceil(7);
3434
bytes as usize
3535
}
3636

src/types.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1277,7 +1277,7 @@ impl<T: Asn1Writable> Asn1Writable for Option<T> {
12771277
}
12781278

12791279
macro_rules! declare_choice {
1280-
($count:ident => $(($number:ident $name:ident)),*) => {
1280+
($count:ident => $(($number:ident $name:ident)),+) => {
12811281
/// Represents an ASN.1 `CHOICE` with the provided number of potential
12821282
/// types.
12831283
///
@@ -1287,7 +1287,7 @@ macro_rules! declare_choice {
12871287
/// `#[derive(asn1::Asn1Write)]` APIs.
12881288
#[derive(Debug, PartialEq, Eq)]
12891289
pub enum $count<
1290-
$($number,)*
1290+
$($number,)+
12911291
> {
12921292
$(
12931293
$name($number),
@@ -1299,14 +1299,14 @@ macro_rules! declare_choice {
12991299
$(
13001300
$number: Asn1Readable<'a>,
13011301
)*
1302-
> Asn1Readable<'a> for $count<$($number,)*> {
1302+
> Asn1Readable<'a> for $count<$($number,)+> {
13031303
fn parse(parser: &mut Parser<'a>) -> ParseResult<Self> {
13041304
let tlv = parser.read_tlv()?;
13051305
$(
13061306
if $number::can_parse(tlv.tag()) {
13071307
return Ok($count::$name(tlv.parse::<$number>()?));
13081308
}
1309-
)*
1309+
)+
13101310
Err(ParseError::new(ParseErrorKind::UnexpectedTag{actual: tlv.tag()}))
13111311
}
13121312

@@ -1315,21 +1315,21 @@ macro_rules! declare_choice {
13151315
if $number::can_parse(tag) {
13161316
return true;
13171317
}
1318-
)*
1318+
)+
13191319
false
13201320
}
13211321
}
13221322

13231323
impl<
13241324
$(
13251325
$number: Asn1Writable,
1326-
)*
1327-
> Asn1Writable for $count<$($number,)*> {
1326+
)+
1327+
> Asn1Writable for $count<$($number,)+> {
13281328
fn write(&self, w: &mut Writer<'_>) -> WriteResult {
13291329
match self {
13301330
$(
13311331
$count::$name(v) => w.write_element(v),
1332-
)*
1332+
)+
13331333
}
13341334
}
13351335
}

0 commit comments

Comments
 (0)