-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Check array indices in constant propagation #51308
Conversation
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
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.
My initial hope was that just propagating the Rvalue::Len
would automatically cause the index out of bounds terminator to report its error.
Did you try to go down that route?
Not sure what you mean with
So I'll just look into what exactly has to be propagated here and adjust the PR. I think I understand what kind of approach you're thinking of. |
oh... that makes a lot of sense. So we're just failing badly at propagating those constants? |
Yes, exactly, this code in
Removing this makes array index checks work. I'll do slices in a separate PR. Will update the commit in a minute. |
f34283a
to
42bd288
Compare
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
You should |
c4fb5d7
to
4db265b
Compare
Thanks, Travis is passing now |
@bors r+ Awesome! Thanks |
📌 Commit 4db265b has been approved by |
🔒 Merge conflict |
4db265b
to
9600489
Compare
Rebased but didn't find any conflicts (?) |
yea bors is a little confused lately @bors r+ |
📌 Commit 9600489 has been approved by |
…ck, r=oli-obk Check array indices in constant propagation Previously, uses of constant weren't correctly propagated. This fixes rust-lang#48920. r? @oli-obk because you suggested it
Rollup of 7 pull requests Successful merges: - #50852 (Add doc comment to hiding portions of code example) - #51183 (Update rustdoc book to suggest using Termination trait instead of hidden ‘foo’ function) - #51255 (Fix confusing error message for sub_instant) - #51256 (Fix crate-name option in rustdoc) - #51308 (Check array indices in constant propagation) - #51343 (test: Ignore some problematic tests on sparc and sparc64) - #51358 (Tests that #39963 is fixed on MIR borrowck) Failed merges:
Is code like this supposed to give an error in the last Nightly?
|
It's just a lint and not an error, but yes indeed it should |
If I compile with "rustc test.rs" I see:
If I compile with "rustc --emit=metadata test.rs", I see no errors. Is this good? |
Ugh.... that is weird. Open an issue? |
Opened as #51491 |
Previously, uses of constant weren't correctly propagated.
This fixes #48920.
r? @oli-obk because you suggested it