Implement the instruction_set attribute
This commit is contained in:
parent
4437b4b150
commit
a6e2b636e6
22 changed files with 247 additions and 4 deletions
|
@ -460,6 +460,8 @@ E0774: include_str!("./error_codes/E0774.md"),
|
|||
E0775: include_str!("./error_codes/E0775.md"),
|
||||
E0776: include_str!("./error_codes/E0776.md"),
|
||||
E0777: include_str!("./error_codes/E0777.md"),
|
||||
E0778: include_str!("./error_codes/E0778.md"),
|
||||
E0779: include_str!("./error_codes/E0779.md"),
|
||||
;
|
||||
// E0006, // merged with E0005
|
||||
// E0008, // cannot bind by-move into a pattern guard
|
||||
|
|
35
compiler/rustc_error_codes/src/error_codes/E0778.md
Normal file
35
compiler/rustc_error_codes/src/error_codes/E0778.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
The `instruction_set` attribute was malformed.
|
||||
|
||||
Erroneous code example:
|
||||
|
||||
```compile_fail,E0778
|
||||
#![feature(isa_attribute)]
|
||||
|
||||
#[instruction_set()] // error: expected one argument
|
||||
pub fn something() {}
|
||||
fn main() {}
|
||||
```
|
||||
|
||||
The parenthesized `instruction_set` attribute requires the parameter to be
|
||||
specified:
|
||||
|
||||
```
|
||||
#![feature(isa_attribute)]
|
||||
|
||||
#[cfg_attr(target_arch="arm", instruction_set(arm::a32))]
|
||||
fn something() {}
|
||||
```
|
||||
|
||||
or:
|
||||
|
||||
```
|
||||
#![feature(isa_attribute)]
|
||||
|
||||
#[cfg_attr(target_arch="arm", instruction_set(arm::t32))]
|
||||
fn something() {}
|
||||
```
|
||||
|
||||
For more information see the [`instruction_set` attribute][isa-attribute]
|
||||
section of the Reference.
|
||||
|
||||
[isa-attribute]: https://doc.rust-lang.org/reference/attributes/codegen.html
|
32
compiler/rustc_error_codes/src/error_codes/E0779.md
Normal file
32
compiler/rustc_error_codes/src/error_codes/E0779.md
Normal file
|
@ -0,0 +1,32 @@
|
|||
An unknown argument was given to the `instruction_set` attribute.
|
||||
|
||||
Erroneous code example:
|
||||
|
||||
```compile_fail,E0779
|
||||
#![feature(isa_attribute)]
|
||||
|
||||
#[instruction_set(intel::x64)] // error: invalid argument
|
||||
pub fn something() {}
|
||||
fn main() {}
|
||||
```
|
||||
|
||||
The `instruction_set` attribute only supports two arguments currently:
|
||||
|
||||
* arm::a32
|
||||
* arm::t32
|
||||
|
||||
All other arguments given to the `instruction_set` attribute will return this
|
||||
error. Example:
|
||||
|
||||
```
|
||||
#![feature(isa_attribute)]
|
||||
|
||||
#[cfg_attr(target_arch="arm", instruction_set(arm::a32))] // ok!
|
||||
pub fn something() {}
|
||||
fn main() {}
|
||||
```
|
||||
|
||||
For more information see the [`instruction_set` attribute][isa-attribute]
|
||||
section of the Reference.
|
||||
|
||||
[isa-attribute]: https://doc.rust-lang.org/reference/attributes/codegen.html
|
Loading…
Add table
Add a link
Reference in a new issue