Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Treat field-level borrow attr as duplicate of variant-level borrow attr #2398

Merged
merged 1 commit into from Mar 11, 2023

Conversation

dtolnay
Copy link
Member

@dtolnay dtolnay commented Mar 11, 2023

In the case of an enum like this:

#[derive(Deserialize)]
enum Test<'a> {
    #[serde(borrow)]
    S(#[serde(borrow)] Str<'a>),
}

previously serde_derive's duplicate serde attribute 'borrow' error message would point to the first borrow attribute, the one on the variant. This PR changes it to point to the second attribute, the one on the field. This is consistent with every other situation in which the later attribute in source order is the one that gets blamed for being a duplicate.

@dtolnay dtolnay merged commit 696f6f5 into serde-rs:master Mar 11, 2023
38 checks passed
@dtolnay dtolnay deleted the borrow branch March 11, 2023 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant