-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
Hi,
I am using this ASN.1 spec:
Test DEFINITIONS AUTOMATIC TAGS ::=
BEGIN
maxofRICrequestID INTEGER ::= 4294967295
ENDThis is an ASN.1 definition pulled from E2AP.
rasn generates the following code for this:
#[allow(
non_camel_case_types,
non_snake_case,
non_upper_case_globals,
unused,
clippy::too_many_arguments
)]
pub mod test {
extern crate alloc;
use core::borrow::Borrow;
use rasn::prelude::*;
use std::sync::LazyLock;
pub static MAXOF_RICREQUEST_ID: LazyLock<Integer> = LazyLock::new(|| Integer::from(4294967295));
}If you try to compile this, you'll get this error:
error: literal out of range for `i32`
--> test-example/src/test.rs:13:88
|
13 | pub static MAXOF_RICREQUEST_ID: LazyLock<Integer> = LazyLock::new(|| Integer::from(4294967295));
| ^^^^^^^^^^
|
= note: the literal `4294967295` does not fit into the type `i32` whose range is `-2147483648..=2147483647`
= help: consider using the type `u32` instead
= note: `#[deny(overflowing_literals)]` on by defaultThe solution I have been using is to change:
pub static MAXOF_RICREQUEST_ID: LazyLock<Integer> = LazyLock::new(|| Integer::from(4294967295));to:
pub static MAXOF_RICREQUEST_ID: LazyLock<Integer> = LazyLock::new(|| Integer::from(4294967295u128));Can the compiler be changed to account for values equal to or greater than unsigned 32 bit max?
Metadata
Metadata
Assignees
Labels
No labels