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

Add logic to determine whether unnamed fmt arguments are present #343

Merged
merged 1 commit into from
Nov 4, 2024

Conversation

dtolnay
Copy link
Owner

@dtolnay dtolnay commented Nov 4, 2024

This is needed for an upcoming change that disallows extra positional fmt arguments in the format string of a tuple struct or tuple variant due to ambiguity. For example in #[error("{} {0}", $N)] Variant(i32) it is ambiguous whether the {0} refers to $N vs &self.0. One would need to write a named #[error("{n} {n}", n = $N)] for the former or a numbered #[error("{n} {0}", n = $N)] for the latter, both of which have an obviously unambiguous meaning.

@dtolnay dtolnay merged commit d2a823d into master Nov 4, 2024
18 checks passed
@dtolnay dtolnay deleted the unnamed branch November 4, 2024 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant