Skip to content

Commit

Permalink
x509-cert: specify concrete types to help the compiler (#1441)
Browse files Browse the repository at this point in the history
rustc fails to infer the appropriate types with Default::default
when building a crate depending on

    femme = "2.2.1"
    getrandom = { version = "0.2.15", features = ["js"] }
    rand = "0.8.5
    x509-cert = { version = "0.2.5", features = ["hazmat", "builder"] }

Co-authored-by: Mathieu Amiot <[email protected]>
  • Loading branch information
istankovic and OtaK authored Jul 8, 2024
1 parent 2c16861 commit 7a2d38a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion x509-cert/src/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub mod pkix;
pub struct Extension {
pub extn_id: ObjectIdentifier,

#[asn1(default = "Default::default")]
#[asn1(default = "bool::default")]
pub critical: bool,

pub extn_value: OctetString,
Expand Down
2 changes: 1 addition & 1 deletion x509-cert/src/ext/pkix/constraints/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use der::Sequence;
#[derive(Clone, Debug, Eq, PartialEq, Sequence)]
#[allow(missing_docs)]
pub struct BasicConstraints {
#[asn1(default = "Default::default")]
#[asn1(default = "bool::default")]
pub ca: bool,
pub path_len_constraint: Option<u8>,
}
Expand Down
2 changes: 1 addition & 1 deletion x509-cert/src/ext/pkix/constraints/name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pub struct GeneralSubtree {
#[asn1(
context_specific = "0",
tag_mode = "IMPLICIT",
default = "Default::default"
default = "u32::default"
)]
pub minimum: u32,

Expand Down
8 changes: 4 additions & 4 deletions x509-cert/src/ext/pkix/crl/dp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ pub struct IssuingDistributionPoint {
#[asn1(
context_specific = "1",
tag_mode = "IMPLICIT",
default = "Default::default"
default = "bool::default"
)]
pub only_contains_user_certs: bool,

#[asn1(
context_specific = "2",
tag_mode = "IMPLICIT",
default = "Default::default"
default = "bool::default"
)]
pub only_contains_ca_certs: bool,

Expand All @@ -48,14 +48,14 @@ pub struct IssuingDistributionPoint {
#[asn1(
context_specific = "4",
tag_mode = "IMPLICIT",
default = "Default::default"
default = "bool::default"
)]
pub indirect_crl: bool,

#[asn1(
context_specific = "5",
tag_mode = "IMPLICIT",
default = "Default::default"
default = "bool::default"
)]
pub only_contains_attribute_certs: bool,
}
Expand Down

0 comments on commit 7a2d38a

Please sign in to comment.