Skip to content

Commit 89e4c40

Browse files
authored
Fix issue when a foreign Err pollutes scope (#758)
1 parent bd99729 commit 89e4c40

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

derive/src/derive_enum.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ impl DeriveEnum {
162162
// if we have fixed value variants
163163
result.ident_str("variant");
164164
result.puncts("=>");
165-
result.ident_str("Err");
165+
result.push_parsed("core::result::Result::Err")?;
166166
result.group(Delimiter::Parenthesis, |err_inner| {
167167
err_inner.push_parsed(format!(
168168
"{}::error::DecodeError::UnexpectedVariant",

tests/derive.rs

+4
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,10 @@ mod derive_with_polluted_scope {
408408
#[allow(non_snake_case)]
409409
fn Ok() {}
410410

411+
#[allow(dead_code)]
412+
#[allow(non_snake_case)]
413+
fn Err() {}
414+
411415
#[derive(bincode::Encode, bincode::Decode)]
412416
struct A {
413417
a: u32,

0 commit comments

Comments
 (0)