summaryrefslogtreecommitdiffstats
path: root/openpgp
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@pep.foundation>2020-08-13 14:58:56 +0200
committerNeal H. Walfield <neal@pep.foundation>2020-08-13 17:06:33 +0200
commit7a82d7005d1ad9249b1b47c665999401a51e8bb4 (patch)
treeac73bbbce3cf2f3b279bb1a1d3e1536bf38a4943 /openpgp
parentedebb1b96bb4f0008e1ef17845b988cc18899d16 (diff)
opengpgp: Mark SubpacketTag as non-exhaustive.
Diffstat (limited to 'openpgp')
-rw-r--r--openpgp/src/packet/signature/subpacket.rs7
-rw-r--r--openpgp/src/parse.rs1
2 files changed, 8 insertions, 0 deletions
diff --git a/openpgp/src/packet/signature/subpacket.rs b/openpgp/src/packet/signature/subpacket.rs
index 4dd895bf..4993cc9d 100644
--- a/openpgp/src/packet/signature/subpacket.rs
+++ b/openpgp/src/packet/signature/subpacket.rs
@@ -132,6 +132,8 @@ lazy_static!{
/// The subpacket types specified by [Section 5.2.3.1 of RFC 4880].
///
/// [Section 5.2.3.1 of RFC 4880]: https://tools.ietf.org/html/rfc4880#section-5.2.3.1
+/// Note: This enum cannot be exhaustively matched to allow future
+/// extensions.
#[derive(Debug)]
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash)]
#[derive(Clone, Copy)]
@@ -213,6 +215,10 @@ pub enum SubpacketTag {
Private(u8),
/// Unknown subpacket tag.
Unknown(u8),
+
+ /// This marks this enum as non-exhaustive. Do not use this
+ /// variant.
+ #[doc(hidden)] __Nonexhaustive,
}
impl fmt::Display for SubpacketTag {
@@ -291,6 +297,7 @@ impl From<SubpacketTag> for u8 {
SubpacketTag::Reserved(u) => u,
SubpacketTag::Private(u) => u,
SubpacketTag::Unknown(u) => u,
+ SubpacketTag::__Nonexhaustive => unreachable!(),
}
}
}
diff --git a/openpgp/src/parse.rs b/openpgp/src/parse.rs
index 9375ffaf..8524dbc5 100644
--- a/openpgp/src/parse.rs
+++ b/openpgp/src/parse.rs
@@ -1719,6 +1719,7 @@ impl Subpacket {
tag,
body: php.parse_bytes("unknown subpacket", len)?,
},
+ SubpacketTag::__Nonexhaustive => unreachable!(),
};
let total_out = php.reader.total_out();