Commit Graph

15 Commits

Author SHA1 Message Date
Esteban Küber
609ffa1a89 Reword malformed attribute input diagnostics
- Handle empty `cfg_attr` attribute
- Reword empty `derive` attribute error
- Use consistend error message: "malformed `attrname` attribute input"
- Provide suggestions when possible
- Move note/help to label/suggestion
- Use consistent wording "ill-formed" -> "malformed"
- Move diagnostic logic out of parser
2019-05-25 11:55:50 -07:00
Vadim Petrochenkov
fa72a81bea Update tests 2019-03-11 23:10:26 +03:00
Vadim Petrochenkov
41c65992c5 Implement basic input validation for built-in attributes 2019-01-13 14:17:19 +03:00
Mark Rousskov
2a663555dd Remove licenses 2018-12-25 21:08:33 -07:00
dragan.mladjenovic
f985e6cfd4 tests/ui: Add missing mips{64} ignores 2018-07-31 15:22:14 +02:00
John Paul Adrian Glaubitz
d63aabcb36 test: Ignore some problematic tests on powerpc and powerpc64* 2018-06-17 12:00:47 +02:00
John Paul Adrian Glaubitz
690240994f test: Ignore some problematic tests on sparc and sparc64 2018-06-04 23:59:40 +02:00
Alex Crichton
1217d70465 Separately gate each target_feature feature
Use an explicit whitelist for what features are actually stable and can be
enabled.
2018-04-16 13:58:42 -07:00
dragan.mladjenovic
0a94344fa7 Add ignores for powerpc and s390x to target-feature-wrong.rs and update references. 2018-04-10 11:26:47 +02:00
dragan.mladjenovic
1e5145db9f Update ui test references. 2018-04-10 09:11:21 +02:00
Alex Crichton
38d48ef537 rustc: Forbid #[inline(always)] with #[target_feature]
Once a target feature is enabled for a function that means that it in general
can't be inlined into other functions which don't have that target feature
enabled. This can cause both safety and LLVM issues if we were to actually
inline it, so `#[inline(always)]` both can't be respected and would be an error
if we did so!

Today LLVM doesn't inline functions with different `#[target_feature]`
annotations, but it turns out that if one is tagged with `#[inline(always)]`
it'll override this and cause scary LLVM error to arise!

This commit fixes this issue by forbidding these two attributes to be used in
conjunction with one another.

cc rust-lang-nursery/stdsimd#404
2018-03-27 14:38:20 -07:00
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
Vadim Petrochenkov
fa2d9fc4b9 Update UI tests 2018-02-26 20:24:02 +03: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