Skip to content

Commit

Permalink
Fix issue when a foreign Err pollutes scope (#758)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZoeyR authored Mar 10, 2025
1 parent bd99729 commit 89e4c40
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion derive/src/derive_enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ impl DeriveEnum {
// if we have fixed value variants
result.ident_str("variant");
result.puncts("=>");
result.ident_str("Err");
result.push_parsed("core::result::Result::Err")?;
result.group(Delimiter::Parenthesis, |err_inner| {
err_inner.push_parsed(format!(
"{}::error::DecodeError::UnexpectedVariant",
Expand Down
4 changes: 4 additions & 0 deletions tests/derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,10 @@ mod derive_with_polluted_scope {
#[allow(non_snake_case)]
fn Ok() {}

#[allow(dead_code)]
#[allow(non_snake_case)]
fn Err() {}

#[derive(bincode::Encode, bincode::Decode)]
struct A {
a: u32,
Expand Down

0 comments on commit 89e4c40

Please sign in to comment.