Commit Graph

3 Commits

Author SHA1 Message Date
Alex Crichton
4bde92c176 rustc: Fix ICE with #[target_feature] on module
This commit fixes an ICE in rustc when `#[target_feature]` was applied to items
other than functions due to the way the feature was validated.
2018-03-07 17:09:09 -08:00
Alex Crichton
0ecaa67e90 rustc: Refactor attribute checking to operate on HIR
This'll enable running queries that could be cached and overall be more amenable
to the query infastructure.
2018-01-13 16:07:13 -08:00
Alex Crichton
5f006cebfc rustc: Tweak #[target_feature] syntax
This is an implementation of the `#[target_feature]` syntax-related changes of
[RFC 2045][rfc]. Notably two changes have been implemented:

* The new syntax is `#[target_feature(enable = "..")]` instead of
  `#[target_feature = "+.."]`. The `enable` key is necessary instead of the `+`
  to indicate that a feature is being enabled, and a sub-list is used for
  possible expansion in the future. Additionally within this syntax the feature
  names being enabled are now whitelisted against a known set of target feature
  names that we know about.

* The `#[target_feature]` attribute can only be applied to unsafe functions. It
  was decided in the RFC that invoking an instruction possibly not defined for
  the current processor is undefined behavior, so to enable this feature for now
  it requires an `unsafe` intervention.

[rfc]: https://github.com/rust-lang/rfcs/blob/master/text/2045-target-feature.md
2018-01-13 10:07:18 -08:00