Skip to content

Commit 08afee0

Browse files
Fully qualify std Result type
The prior macro expansion could produce errors if the macros were called in a context where `Result` is redefined, for example in a crate with its own `Result` type which pre-fills the error type. This replaces existing `Result` uses with `std::result::Result` to avoid the compilation error in that case.
1 parent a885bb4 commit 08afee0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

components/salsa-macro-rules/src/setup_input_struct.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ macro_rules! setup_input_struct {
123123
fn serialize<S: $zalsa::serde::Serializer>(
124124
fields: &Self::Fields,
125125
serializer: S,
126-
) -> Result<S::Ok, S::Error> {
126+
) -> std::result::Result<S::Ok, S::Error> {
127127
$zalsa::macro_if! {
128128
if $persist {
129129
$($serialize_fn(fields, serializer))?
@@ -135,7 +135,7 @@ macro_rules! setup_input_struct {
135135

136136
fn deserialize<'de, D: $zalsa::serde::Deserializer<'de>>(
137137
deserializer: D,
138-
) -> Result<Self::Fields, D::Error> {
138+
) -> std::result::Result<Self::Fields, D::Error> {
139139
$zalsa::macro_if! {
140140
if $persist {
141141
$($deserialize_fn(deserializer))?
@@ -241,7 +241,7 @@ macro_rules! setup_input_struct {
241241

242242
$zalsa::macro_if! { $persist =>
243243
impl $zalsa::serde::Serialize for $Struct {
244-
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
244+
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
245245
where
246246
S: $zalsa::serde::Serializer,
247247
{
@@ -250,7 +250,7 @@ macro_rules! setup_input_struct {
250250
}
251251

252252
impl<'de> $zalsa::serde::Deserialize<'de> for $Struct {
253-
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
253+
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
254254
where
255255
D: $zalsa::serde::Deserializer<'de>,
256256
{

0 commit comments

Comments
 (0)