network: Implement From<Infallible> for error type
What changed, and why it matters
This is a routine Rust language addition: it lets the library's network-parsing error type be created from Rust's 'Infallible' type, which can never actually occur. It has no security relevance on its own.
No security action needed. Treat as normal maintenance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit adds impl From<Infallible> for ParseNetworkError in the network crate’s error module. In Rust, Infallible is the error type for operations that cannot fail; providing a From<Infallible> impl is idiomatic boilerplate that enables generic error-conversion code (e.g., ? operator use) to type-check. The implementation is a vacuous match never {} because Infallible has no values. No parsing logic, error handling, or unsafe code is changed.
Changed components
network/src/lib.rs error moduleInspect captured patch +5 / −0
diff --git a/network/src/lib.rs b/network/src/lib.rs
index 48a02d7f..92b1583a 100644
--- a/network/src/lib.rs
+++ b/network/src/lib.rs
@@ -293,6 +293,7 @@ impl<'a> Arbitrary<'a> for NetworkKind {
/// Error types for the network.
pub mod error {
+ use core::convert::Infallible;
use core::fmt;
use internals::error::InputString;
@@ -302,6 +303,10 @@ pub mod error {
#[non_exhaustive]
pub struct ParseNetworkError(pub(super) InputString);
+ impl From<Infallible> for ParseNetworkError {
+ fn from(never: Infallible) -> Self { match never {} }
+ }
+
impl fmt::Display for ParseNetworkError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
// Outputs 'failed to parse <input string> as network'.
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.