-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
format! allows named arguments to be referenced by position #69110
Comments
This should be reintroduced as a warn by default lint, regardless of crater results. We know this is relatively easy to stumble and rely on and rust is no longer close to 100% open source. Furthermore this is relatively benign mistake, a warning seems to me more than enough. |
This is pretty much a duplicate of #45256. |
(yeah but clearly no one acted on it back then, since even then the official response was "oh, we should lint against this.") |
This has also leaked into the captured formatting parameter arguments in some situations (I could not come up with a situation where capturing a value parameter would do something similar): fn main() {
let a = 5;
println!("{:-<a$}");
} prints
|
Triage: #45256 has been closed as fixed, and the above code gives this warning now:
So we can close this issue too now. |
The following example compiles, but shouldn't.
This seems to be an unintentional regression that was introduced somewhere between 1.11.0 and 1.12.0, most likely by #33642.
However, this code has been accepted on stable for multiple years now (1.12 was in 2016), so fixing this might break existing code. We could still change this back to an error if crater reports no regressions since it is reasonable to say that the code in question is clearly incorrect and was not caught by the compiler by mistake.
The text was updated successfully, but these errors were encountered: