-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Detect when negative literal indices are used and suggest appropriate code #89251
Conversation
r? @davidtwco (rust-highfive has picked a reviewer for you, use r? to override) |
Suggested test case (no error should trigger): use core::ops::Index;
struct X;
impl Index<i32> for X {
type Output = ();
fn index(&self, _: i32) -> &() {
&()
}
}
fn main() {
X[-1];
} |
b50f3bb
to
c531106
Compare
@NieDzejkob added your case to the test. |
This comment has been minimized.
This comment has been minimized.
c531106
to
8455a3b
Compare
8455a3b
to
5c70f25
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking really good, some minor changes. r=me after fixing.
@bors r=davidtwco |
📌 Commit e19d82f has been approved by |
…arth Rollup of 7 pull requests Successful merges: - rust-lang#88838 (Do not suggest importing inaccessible items) - rust-lang#89251 (Detect when negative literal indices are used and suggest appropriate code) - rust-lang#89321 (Rebase resume argument projections during state transform) - rust-lang#89327 (Pick one possible lifetime in case there are multiple choices) - rust-lang#89344 (Cleanup lower_generics_mut and make span be the bound itself) - rust-lang#89397 (Update `llvm` submodule to fix function name mangling on x86 Windows) - rust-lang#89412 (Add regression test for issues rust-lang#88969 and rust-lang#89119 ) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
No description provided.