summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2022-03-28 13:49:00 +0200
committerJustus Winter <justus@sequoia-pgp.org>2022-03-28 13:49:00 +0200
commitf66d98e0fac7320af3e918bbb69f09b130df3d63 (patch)
tree9390d1ff70f13bafcdfeec7e2646085c138ebe85
parent407141a8e798d5799b16b2d5310a06c0aae38244 (diff)
openpgp: Clarify that message::Token is not covered by SemVer.
- Do this using a deprecation so that anyone using it will get a compiler warning. - Revert this change once message::Token is private. - See #836.
-rw-r--r--openpgp/NEWS2
-rw-r--r--openpgp/src/message/lexer.rs2
-rw-r--r--openpgp/src/message/mod.rs5
-rw-r--r--openpgp/src/parse.rs1
4 files changed, 9 insertions, 1 deletions
diff --git a/openpgp/NEWS b/openpgp/NEWS
index 12877bdb..a1e6fe9f 100644
--- a/openpgp/NEWS
+++ b/openpgp/NEWS
@@ -7,6 +7,8 @@
- Packet::version
- SignatureBuilder::set_reference_time
- SignatureBuilder::effective_signature_creation_time
+** Deprecated functionality
+ - message::Token is not covered by SemVer guarantees, DO NOT match on it
* Changes in 1.8.0
** New functionality
- crypto::Signer::acceptable_hashes
diff --git a/openpgp/src/message/lexer.rs b/openpgp/src/message/lexer.rs
index 8e6f8910..e32f58ed 100644
--- a/openpgp/src/message/lexer.rs
+++ b/openpgp/src/message/lexer.rs
@@ -13,6 +13,8 @@ pub(crate) type LexerItem<Tok, Loc, Error>
/// extensions.
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq)]
+#[deprecated(since = "1.9.0",
+ note = "Not covered by SemVer guarantees, DO NOT match on it.")]
pub enum Token {
/// A Literal data packet.
Literal,
diff --git a/openpgp/src/message/mod.rs b/openpgp/src/message/mod.rs
index 0967607e..9e734aa4 100644
--- a/openpgp/src/message/mod.rs
+++ b/openpgp/src/message/mod.rs
@@ -21,6 +21,9 @@
//!
//! [Section 11.3 of RFC 4880]: https://tools.ietf.org/html/rfc4880#section-11.3
+// XXX: For Token. Drop this once Token is private.
+#![allow(deprecated)]
+
use std::convert::TryFrom;
use std::fmt;
use std::io;
@@ -35,7 +38,7 @@ use crate::packet::Tag;
use crate::parse::Parse;
mod lexer;
-lalrpop_util::lalrpop_mod!(#[allow(clippy::all)] grammar, "/message/grammar.rs");
+lalrpop_util::lalrpop_mod!(#[allow(clippy::all, deprecated)] grammar, "/message/grammar.rs");
use self::lexer::{Lexer, LexicalError};
pub use self::lexer::Token;
diff --git a/openpgp/src/parse.rs b/openpgp/src/parse.rs
index 72241d73..81549c50 100644
--- a/openpgp/src/parse.rs
+++ b/openpgp/src/parse.rs
@@ -4878,6 +4878,7 @@ impl <'a> PacketParser<'a> {
// this as opaque content to the message validator.
let mut path = self.path().to_vec();
path.push(0);
+ #[allow(deprecated)]
self.state.message_validator.push_token(
message::Token::OpaqueContent, &path);
}