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

Docs: Compile-time bounds check in index expression #25286

Merged
merged 1 commit into from
May 11, 2015

Conversation

johannhof
Copy link
Contributor

The reference was claiming all vectors all bounds-checked at run-time, when constant vectors are usually checked at compile-time.

For the changed example see http://is.gd/28ak9E

Also fixed a minor grammar issue.

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way Github handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see CONTRIBUTING.md for more information.

@bluss
Copy link
Member

bluss commented May 10, 2015

Consider the case of a runtime value for the index and a fixed size array, then it's checked at run time. Not sure how to explain that in a concise manner.

@johannhof
Copy link
Contributor Author

Right, good catch. I'll try to rephrase.

@steveklabnik
Copy link
Member

yes, http://is.gd/SUUj9T shows this off.

@johannhof johannhof force-pushed the patch-1 branch 2 times, most recently from d8bd5b3 to 022774b Compare May 10, 2015 23:22
The reference was claiming all vectors all bounds-checked at run-time, when constant vectors are usually checked at compile-time.

For the changed example see http://is.gd/28ak9E
@johannhof
Copy link
Contributor Author

Updated. Should explain most cases now.

@bluss
Copy link
Member

bluss commented May 10, 2015

great. This is all about rust semantics right. I mean, the optimizing part of the compilation may find that it always is out of bounds, and compile that call to panic in statically, but we don't emit any warning or otherwise even notice that :-)

@johannhof
Copy link
Contributor Author

r? @steveklabnik

reassigning ❤️

@steveklabnik
Copy link
Member

@bors: r+ rollup

@bors
Copy link
Contributor

bors commented May 11, 2015

📌 Commit 295b62d has been approved by steveklabnik

@steveklabnik
Copy link
Member

Excellent, thanks so much!

@steveklabnik
Copy link
Member

Oh, and you should check in over at #25196, as this means you get to be in AUTHORS. :)

@johannhof
Copy link
Contributor Author

yay :D

Manishearth added a commit to Manishearth/rust that referenced this pull request May 11, 2015
The reference was claiming all vectors all bounds-checked at run-time, when constant vectors are usually checked at compile-time.

For the changed example see http://is.gd/28ak9E

Also fixed a minor grammar issue.
Manishearth added a commit to Manishearth/rust that referenced this pull request May 11, 2015
The reference was claiming all vectors all bounds-checked at run-time, when constant vectors are usually checked at compile-time.

For the changed example see http://is.gd/28ak9E

Also fixed a minor grammar issue.
Manishearth added a commit to Manishearth/rust that referenced this pull request May 11, 2015
The reference was claiming all vectors all bounds-checked at run-time, when constant vectors are usually checked at compile-time.

For the changed example see http://is.gd/28ak9E

Also fixed a minor grammar issue.
bors added a commit that referenced this pull request May 11, 2015
@bors bors merged commit 295b62d into rust-lang:master May 11, 2015
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.

6 participants