From 06182c6cd3e5cfdd60914027400f56a163653777 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Kr=C3=BCger?= Date: Tue, 12 May 2026 11:15:24 +0200 Subject: [PATCH 1/2] feat(proto): Mark `PathEvent` as `#[non_exhaustive]` --- noq-proto/src/connection/paths.rs | 1 + noq/src/connection.rs | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/noq-proto/src/connection/paths.rs b/noq-proto/src/connection/paths.rs index bc52d1ac1..d4d9b04e7 100644 --- a/noq-proto/src/connection/paths.rs +++ b/noq-proto/src/connection/paths.rs @@ -1041,6 +1041,7 @@ pub enum PathStatus { /// Application events about paths #[derive(Debug, Clone, PartialEq, Eq)] +#[non_exhaustive] pub enum PathEvent { /// A new path has established connection with the peer. Established { diff --git a/noq/src/connection.rs b/noq/src/connection.rs index ee7f88b60..e773d8d4b 100644 --- a/noq/src/connection.rs +++ b/noq/src/connection.rs @@ -1672,6 +1672,11 @@ impl State { NatTraversal(update) => { self.nat_traversal_updates.send(update).ok(); } + _ => { + // PathEvent is #[non_exhaustive]. + // It's possible that noq is built against a newer noq-proto version. + // In that case, we need to ignore path events we can't handle yet. + } } } } From f82023fb1cda3d4fe1df9f581861420ec9be6a91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Kr=C3=BCger?= Date: Tue, 12 May 2026 16:14:17 +0200 Subject: [PATCH 2/2] Make sure to check PathEvents are handled on test level at least --- noq/src/connection.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/noq/src/connection.rs b/noq/src/connection.rs index e773d8d4b..fd9bdee3b 100644 --- a/noq/src/connection.rs +++ b/noq/src/connection.rs @@ -1676,6 +1676,10 @@ impl State { // PathEvent is #[non_exhaustive]. // It's possible that noq is built against a newer noq-proto version. // In that case, we need to ignore path events we can't handle yet. + // But for tests, we expect noq and noq-proto to be in sync, so we + // should panic in case we don't actually handle new cases. + #[cfg(test)] + panic!("Unhandled PathEvent variant: {event:?}"); } } }