[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240516190345.957477-9-amiculas@cisco.com>
Date: Thu, 16 May 2024 22:03:31 +0300
From: Ariel Miculas <amiculas@...co.com>
To: rust-for-linux@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
tycho@...ho.pizza, brauner@...nel.org, viro@...iv.linux.org.uk,
ojeda@...nel.org, alex.gaynor@...il.com, wedsonaf@...il.com,
shallyn@...co.com, Ariel Miculas <amiculas@...co.com>
Subject: [RFC PATCH v3 08/22] rust: capnp: return an error when trying to display floating point values
The kernel doesn't support floating point values, so return an error
when the kernel feature is enabled.
Signed-off-by: Ariel Miculas <amiculas@...co.com>
---
rust/capnp/stringify.rs | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/rust/capnp/stringify.rs b/rust/capnp/stringify.rs
index 426025fea0e8..f93e3521ce0b 100644
--- a/rust/capnp/stringify.rs
+++ b/rust/capnp/stringify.rs
@@ -71,8 +71,12 @@ pub(crate) fn print(
dynamic_value::Reader::UInt16(x) => formatter.write_fmt(format_args!("{x}")),
dynamic_value::Reader::UInt32(x) => formatter.write_fmt(format_args!("{x}")),
dynamic_value::Reader::UInt64(x) => formatter.write_fmt(format_args!("{x}")),
+ #[cfg(not(feature = "kernel"))]
dynamic_value::Reader::Float32(x) => formatter.write_fmt(format_args!("{x}")),
+ #[cfg(not(feature = "kernel"))]
dynamic_value::Reader::Float64(x) => formatter.write_fmt(format_args!("{x}")),
+ #[cfg(feature = "kernel")]
+ dynamic_value::Reader::Float32(_) | dynamic_value::Reader::Float64(_) => Err(fmt::Error),
dynamic_value::Reader::Enum(e) => match cvt(e.get_enumerant())? {
Some(enumerant) => {
formatter.write_str(cvt(cvt(enumerant.get_proto().get_name())?.to_str())?)
--
2.34.1
Powered by blists - more mailing lists