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

fix const index feature-gate regression #30202

Merged
merged 1 commit into from
Dec 7, 2015

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Dec 4, 2015

see #29947 (comment)

I also added some missing tests

@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 @Aatch (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. Due to 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 the contribution instructions for more information.

@@ -11,7 +11,7 @@
#![deny(exceeding_bitshifts)]
#![allow(unused_variables)]
#![allow(dead_code)]
#![feature(num_bits_bytes)]
#![feature(num_bits_bytes, const_indexing)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, interesting ... am I right in inferring that this program will compile successfully (and the error occurs at runtime, assuming the checks are turned on), if the feature gate is not included here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(because I thought we had decided that such errors in such contexts should not cause compilation errors, at least not ones that cannot be controlled via lint-style allow/warn/deny switches, but instead should just generate code to panic at runtime?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bitshift checks have been errors since before 1.0. I'll investigate if anything assumes they errored in check_const.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a problem. The "error" is actually the exceeding_bitshifts lint which is set to deny here. So it's already behind a lint.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. Sorry, I was not clear about what I was saying.

I was worried about the fact that you added the feature gate opt-in, since this very bug (that this PR is addressing) is about the fact that people shouldn't have to add this feature gate to get this code to work.

But it seems like you are saying that you need the feature gate there in order to see the compile-time error on just the line that you added, and without the feature gate, there would be no compile-time error -- i.e. the lint wouldn't detect the excessive bitshift at compile-time.

I would have preferred such a subtle issue be broken out into a separate test. But its not worth blocking the PR at this point.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so a run-fail test that does the same as this file just without the feature gate? I think there's a bitshift overflow run-fail test. I'll add it there.

@bluss
Copy link
Member

bluss commented Dec 6, 2015

If this is in Rust 1.6-beta, the fix should be backported

@bluss bluss added the regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. label Dec 6, 2015
@bluss bluss removed the regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. label Dec 6, 2015
@bluss
Copy link
Member

bluss commented Dec 6, 2015

(No tag, found a bug report for this PR)

@oli-obk
Copy link
Contributor Author

oli-obk commented Dec 6, 2015

not in the beta according to playground: http://is.gd/xCYioD

@oli-obk oli-obk force-pushed the fix/const_index_feature_gate branch from 81358f1 to baa8ce7 Compare December 6, 2015 12:00
@Aatch
Copy link
Contributor

Aatch commented Dec 7, 2015

Looks good to me

@Aatch
Copy link
Contributor

Aatch commented Dec 7, 2015

@bors r+ baa8ce7

bors added a commit that referenced this pull request Dec 7, 2015
@bors
Copy link
Contributor

bors commented Dec 7, 2015

⌛ Testing commit baa8ce7 with merge 4dbdfb4...

@bors bors merged commit baa8ce7 into rust-lang:master Dec 7, 2015
@oli-obk oli-obk deleted the fix/const_index_feature_gate branch January 14, 2016 14:06
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