-
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
ICE when using target_feature with a const #64768
Comments
Backtrace:
|
triage: P-high. Assigning to @davidtwco . Removing nomination label. |
Of note: The reason I was attempting to use target function on a const was because the const needed a different value on different targets. EDIT: Of note, I am now aware I did it wrong, and was misunderstanding how it's ment to be used. |
…e-const, r=varkor hir: Disallow `target_feature` on constants Fixes rust-lang#64768. This PR fixes an ICE when `#[target_feature]` is applied to constants by disallowing this with the same error as when `#[target_feature]` is applied to other places it shouldn't be. I couldn't see anything in the [RFC](https://github.com/rust-lang/rfcs/blob/master/text/2045-target-feature.md) that suggested that `#[target_feature]` should be applicable to constants or any tests that suggested it should, though I might have missed something - if this is desirable in future, it remains possible to remove this error (but for the time being, I think this error is better than an ICE). I also added some extra cases to the test for other places where `#[target_feature]` should not be permitted. cc @gnzlbg
The following code snippet triggers a ICE:
rustc 1.37.0 (eae3437df 2019-08-13) running on x86_64-unknown-linux-gnu
Bug was found on playground
The text was updated successfully, but these errors were encountered: