Remove remaining unstable-spec features

Everything that was gated behind it was stabilized with Matrix v1.2.
This commit is contained in:
Jonas Platte 2022-02-02 23:25:19 +01:00
parent a55df1ef9d
commit 9c4bf00f79
No known key found for this signature in database
GPG Key ID: 7D261D771D915378
7 changed files with 5 additions and 33 deletions

View File

@ -39,14 +39,10 @@ them. Check out the documentation [on docs.rs][docs] (or on
## Status ## Status
As of 2022-01-31, we support all events and REST endpoints of the v1 version of As of 2022-01-31, we support all events and REST endpoints of the v1 version of
the Matrix specification, with v1.1 coverage in progress. the Matrix specification, with v1.1 and v1.2 coverage in progress.
Various changes from the unreleased version of the specification are also Various changes from in-progress MSCs, finished MSCs, and a few less formalized
implemented, gated behind the `unstable-spec` Cargo feature. things are also implemented, gated behind the `unstable-pre-spec` Cargo feature.
Various changes from in-progress MSCs, finished MSCs,
and (often) unreleased versions of the specification are also implemented,
gated behind the `unstable-pre-spec` Cargo feature.
## Contributing ## Contributing

View File

@ -24,7 +24,6 @@ compat = []
unstable-exhaustive-types = [] unstable-exhaustive-types = []
# feature dependency required for r0::room::create_room::CreationContent::into_event_content # feature dependency required for r0::room::create_room::CreationContent::into_event_content
unstable-pre-spec = ["ruma-events/unstable-pre-spec"] unstable-pre-spec = ["ruma-events/unstable-pre-spec"]
unstable-spec = []
client = [] client = []
server = [] server = []

View File

@ -3,7 +3,6 @@
pub mod add_3pid; pub mod add_3pid;
pub mod bind_3pid; pub mod bind_3pid;
pub mod change_password; pub mod change_password;
#[cfg(feature = "unstable-spec")] // todo: v1.2
pub mod check_registration_token_validity; pub mod check_registration_token_validity;
pub mod deactivate; pub mod deactivate;
pub mod delete_3pid; pub mod delete_3pid;

View File

@ -59,7 +59,6 @@ pub enum AuthData<'a> {
Dummy(Dummy<'a>), Dummy(Dummy<'a>),
/// Registration token-based authentication (`m.login.registration_token`). /// Registration token-based authentication (`m.login.registration_token`).
#[cfg(feature = "unstable-spec")] // todo: v1.2
RegistrationToken(RegistrationToken<'a>), RegistrationToken(RegistrationToken<'a>),
/// Fallback acknowledgement. /// Fallback acknowledgement.
@ -85,7 +84,6 @@ impl<'a> AuthData<'a> {
Self::EmailIdentity(_) => Some(AuthType::EmailIdentity), Self::EmailIdentity(_) => Some(AuthType::EmailIdentity),
Self::Msisdn(_) => Some(AuthType::Msisdn), Self::Msisdn(_) => Some(AuthType::Msisdn),
Self::Dummy(_) => Some(AuthType::Dummy), Self::Dummy(_) => Some(AuthType::Dummy),
#[cfg(feature = "unstable-spec")] // todo: v1.2
Self::RegistrationToken(_) => Some(AuthType::RegistrationToken), Self::RegistrationToken(_) => Some(AuthType::RegistrationToken),
Self::FallbackAcknowledgement(_) => None, Self::FallbackAcknowledgement(_) => None,
Self::_Custom(c) => Some(AuthType::_Custom(PrivOwnedStr(c.auth_type.into()))), Self::_Custom(c) => Some(AuthType::_Custom(PrivOwnedStr(c.auth_type.into()))),
@ -102,7 +100,6 @@ impl<'a> AuthData<'a> {
Self::EmailIdentity(x) => x.session, Self::EmailIdentity(x) => x.session,
Self::Msisdn(x) => x.session, Self::Msisdn(x) => x.session,
Self::Dummy(x) => x.session, Self::Dummy(x) => x.session,
#[cfg(feature = "unstable-spec")] // todo: v1.2
Self::RegistrationToken(x) => x.session, Self::RegistrationToken(x) => x.session,
Self::FallbackAcknowledgement(x) => Some(x.session), Self::FallbackAcknowledgement(x) => Some(x.session),
Self::_Custom(x) => x.session, Self::_Custom(x) => x.session,
@ -145,7 +142,6 @@ impl<'a> AuthData<'a> {
thirdparty_id_creds: x.thirdparty_id_creds, thirdparty_id_creds: x.thirdparty_id_creds,
session: None, session: None,
})), })),
#[cfg(feature = "unstable-spec")] // todo: v1.2
Self::RegistrationToken(x) => { Self::RegistrationToken(x) => {
Cow::Owned(serialize(RegistrationToken { token: x.token, session: None })) Cow::Owned(serialize(RegistrationToken { token: x.token, session: None }))
} }
@ -190,7 +186,6 @@ impl IncomingAuthData {
"m.login.email.identity" => Self::EmailIdentity(deserialize_variant(session, data)?), "m.login.email.identity" => Self::EmailIdentity(deserialize_variant(session, data)?),
"m.login.msisdn" => Self::Msisdn(deserialize_variant(session, data)?), "m.login.msisdn" => Self::Msisdn(deserialize_variant(session, data)?),
"m.login.dummy" => Self::Dummy(deserialize_variant(session, data)?), "m.login.dummy" => Self::Dummy(deserialize_variant(session, data)?),
#[cfg(feature = "unstable-spec")] // todo: v1.2
"m.registration_token" => Self::RegistrationToken(deserialize_variant(session, data)?), "m.registration_token" => Self::RegistrationToken(deserialize_variant(session, data)?),
_ => Self::_Custom(IncomingCustomAuthData { _ => Self::_Custom(IncomingCustomAuthData {
auth_type: auth_type.into(), auth_type: auth_type.into(),
@ -210,7 +205,6 @@ impl IncomingAuthData {
Self::EmailIdentity(_) => Some(AuthType::EmailIdentity), Self::EmailIdentity(_) => Some(AuthType::EmailIdentity),
Self::Msisdn(_) => Some(AuthType::Msisdn), Self::Msisdn(_) => Some(AuthType::Msisdn),
Self::Dummy(_) => Some(AuthType::Dummy), Self::Dummy(_) => Some(AuthType::Dummy),
#[cfg(feature = "unstable-spec")] // todo: v1.2
Self::RegistrationToken(_) => Some(AuthType::RegistrationToken), Self::RegistrationToken(_) => Some(AuthType::RegistrationToken),
Self::FallbackAcknowledgement(_) => None, Self::FallbackAcknowledgement(_) => None,
Self::_Custom(c) => Some(AuthType::_Custom(PrivOwnedStr(c.auth_type.as_str().into()))), Self::_Custom(c) => Some(AuthType::_Custom(PrivOwnedStr(c.auth_type.as_str().into()))),
@ -227,7 +221,6 @@ impl IncomingAuthData {
Self::EmailIdentity(x) => x.session.as_deref(), Self::EmailIdentity(x) => x.session.as_deref(),
Self::Msisdn(x) => x.session.as_deref(), Self::Msisdn(x) => x.session.as_deref(),
Self::Dummy(x) => x.session.as_deref(), Self::Dummy(x) => x.session.as_deref(),
#[cfg(feature = "unstable-spec")] // todo: v1.2
Self::RegistrationToken(x) => x.session.as_deref(), Self::RegistrationToken(x) => x.session.as_deref(),
Self::FallbackAcknowledgement(x) => Some(&x.session), Self::FallbackAcknowledgement(x) => Some(&x.session),
Self::_Custom(x) => x.session.as_deref(), Self::_Custom(x) => x.session.as_deref(),
@ -270,7 +263,6 @@ impl IncomingAuthData {
thirdparty_id_creds: &x.thirdparty_id_creds, thirdparty_id_creds: &x.thirdparty_id_creds,
session: None, session: None,
})), })),
#[cfg(feature = "unstable-spec")] // todo: v1.2
Self::RegistrationToken(x) => { Self::RegistrationToken(x) => {
Cow::Owned(serialize(RegistrationToken { token: &x.token, session: None })) Cow::Owned(serialize(RegistrationToken { token: &x.token, session: None }))
} }
@ -290,7 +282,6 @@ impl IncomingAuthData {
Self::EmailIdentity(a) => AuthData::EmailIdentity(a.to_outgoing()), Self::EmailIdentity(a) => AuthData::EmailIdentity(a.to_outgoing()),
Self::Msisdn(a) => AuthData::Msisdn(a.to_outgoing()), Self::Msisdn(a) => AuthData::Msisdn(a.to_outgoing()),
Self::Dummy(a) => AuthData::Dummy(a.to_outgoing()), Self::Dummy(a) => AuthData::Dummy(a.to_outgoing()),
#[cfg(feature = "unstable-spec")] // todo: v1.2
Self::RegistrationToken(a) => AuthData::RegistrationToken(a.to_outgoing()), Self::RegistrationToken(a) => AuthData::RegistrationToken(a.to_outgoing()),
Self::FallbackAcknowledgement(a) => AuthData::FallbackAcknowledgement(a.to_outgoing()), Self::FallbackAcknowledgement(a) => AuthData::FallbackAcknowledgement(a.to_outgoing()),
Self::_Custom(a) => AuthData::_Custom(CustomAuthData { Self::_Custom(a) => AuthData::_Custom(CustomAuthData {
@ -327,7 +318,6 @@ impl<'de> Deserialize<'de> for IncomingAuthData {
Some("m.login.email.identity") => from_raw_json_value(&json).map(Self::EmailIdentity), Some("m.login.email.identity") => from_raw_json_value(&json).map(Self::EmailIdentity),
Some("m.login.msisdn") => from_raw_json_value(&json).map(Self::Msisdn), Some("m.login.msisdn") => from_raw_json_value(&json).map(Self::Msisdn),
Some("m.login.dummy") => from_raw_json_value(&json).map(Self::Dummy), Some("m.login.dummy") => from_raw_json_value(&json).map(Self::Dummy),
#[cfg(feature = "unstable-spec")] // todo: v1.2
Some("m.login.registration_token") => { Some("m.login.registration_token") => {
from_raw_json_value(&json).map(Self::RegistrationToken) from_raw_json_value(&json).map(Self::RegistrationToken)
} }
@ -375,7 +365,6 @@ pub enum AuthType {
/// Registration token-based authentication (`m.login.registration_token`). /// Registration token-based authentication (`m.login.registration_token`).
#[ruma_enum(rename = "m.login.registration_token")] #[ruma_enum(rename = "m.login.registration_token")]
#[cfg(feature = "unstable-spec")] // todo: v1.2
RegistrationToken, RegistrationToken,
#[doc(hidden)] #[doc(hidden)]
@ -606,7 +595,6 @@ impl IncomingDummy {
#[derive(Clone, Debug, Outgoing, Serialize)] #[derive(Clone, Debug, Outgoing, Serialize)]
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
#[serde(tag = "type", rename = "m.login.registration_token")] #[serde(tag = "type", rename = "m.login.registration_token")]
#[cfg(feature = "unstable-spec")] // todo: v1.2
pub struct RegistrationToken<'a> { pub struct RegistrationToken<'a> {
/// The registration token. /// The registration token.
pub token: &'a str, pub token: &'a str,
@ -615,7 +603,6 @@ pub struct RegistrationToken<'a> {
pub session: Option<&'a str>, pub session: Option<&'a str>,
} }
#[cfg(feature = "unstable-spec")] // todo: v1.2
impl<'a> RegistrationToken<'a> { impl<'a> RegistrationToken<'a> {
/// Creates a new `RegistrationToken` with the given token. /// Creates a new `RegistrationToken` with the given token.
pub fn new(token: &'a str) -> Self { pub fn new(token: &'a str) -> Self {
@ -623,7 +610,6 @@ impl<'a> RegistrationToken<'a> {
} }
} }
#[cfg(feature = "unstable-spec")] // todo: v1.2
impl IncomingRegistrationToken { impl IncomingRegistrationToken {
/// Convert from `IncomingRegistrationToken` to `RegistrationToken`. /// Convert from `IncomingRegistrationToken` to `RegistrationToken`.
fn to_outgoing(&self) -> RegistrationToken<'_> { fn to_outgoing(&self) -> RegistrationToken<'_> {

View File

@ -65,7 +65,6 @@ fn deserialize_auth_data_direct_request() {
} }
#[test] #[test]
#[cfg(feature = "unstable-spec")] // todo: v1.2
fn serialize_auth_data_registration_token() { fn serialize_auth_data_registration_token() {
let auth_data = AuthData::RegistrationToken( let auth_data = AuthData::RegistrationToken(
assign!(uiaa::RegistrationToken::new("mytoken"), { session: Some("session") }), assign!(uiaa::RegistrationToken::new("mytoken"), { session: Some("session") }),
@ -82,7 +81,6 @@ fn serialize_auth_data_registration_token() {
} }
#[test] #[test]
#[cfg(feature = "unstable-spec")] // todo: v1.2
fn deserialize_auth_data_registration_token() { fn deserialize_auth_data_registration_token() {
let json = json!({ let json = json!({
"type": "m.login.registration_token", "type": "m.login.registration_token",

View File

@ -115,12 +115,6 @@ unstable-pre-spec = [
"ruma-federation-api/unstable-pre-spec", "ruma-federation-api/unstable-pre-spec",
"ruma-signatures/unstable-pre-spec", "ruma-signatures/unstable-pre-spec",
"ruma-state-res/__unstable-pre-spec", # for tests "ruma-state-res/__unstable-pre-spec", # for tests
# If you enable bleeding-edge pre-spec features, you
# probably want things from the unstable spec too
"unstable-spec",
]
unstable-spec = [
"ruma-client-api/unstable-spec",
] ]
[dependencies] [dependencies]

View File

@ -72,7 +72,7 @@ impl CiTask {
// 2. Run tests // 2. Run tests
let workspace_res = let workspace_res =
cmd!("rustup run stable cargo test --workspace --features full,unstable-pre-spec,unstable-spec") cmd!("rustup run stable cargo test --workspace --features full,unstable-pre-spec")
.run(); .run();
let events_compat_res = let events_compat_res =
cmd!("rustup run stable cargo test -p ruma-events --features compat compat").run(); cmd!("rustup run stable cargo test -p ruma-events --features compat compat").run();
@ -98,7 +98,7 @@ impl CiTask {
let clippy_all_res = cmd!( let clippy_all_res = cmd!(
" "
rustup run nightly cargo clippy rustup run nightly cargo clippy
--workspace --all-targets --features=full,compat,unstable-pre-spec,unstable-spec -- -D warnings --workspace --all-targets --features=full,compat,unstable-pre-spec -- -D warnings
" "
) )
.run(); .run();