-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement the instruction_set attribute
- Loading branch information
Showing
22 changed files
with
247 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#![feature(isa_attribute)] | ||
|
||
#[instruction_set()] //~ ERROR | ||
fn no_isa_defined() { | ||
} | ||
|
||
fn main() { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
error[E0778]: `#[instruction_set]` requires an argument | ||
--> $DIR/E0778.rs:3:1 | ||
| | ||
LL | #[instruction_set()] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0778`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#![feature(isa_attribute)] | ||
|
||
#[instruction_set(arm::magic)] //~ ERROR | ||
fn main() { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
error[E0779]: Invalid instruction set specified | ||
--> $DIR/E0779.rs:3:1 | ||
| | ||
LL | #[instruction_set(arm::magic)] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0779`. |
Oops, something went wrong.