diff options
| author | xd009642 <danielmckenna93@gmail.com> | 2020-10-08 23:23:27 +0100 |
|---|---|---|
| committer | xd009642 <danielmckenna93@gmail.com> | 2020-10-08 23:32:20 +0100 |
| commit | a6e2b636e658ca7346ffb32bf11301d92b72a1de (patch) | |
| tree | 6542609d14fcfd59a5500e0fb3fa6b3a699c4760 /compiler/rustc_error_codes/src | |
| parent | 4437b4b1509c3c15b41a05489c4bddd2fe30e33f (diff) | |
| download | rust-a6e2b636e658ca7346ffb32bf11301d92b72a1de.tar.gz rust-a6e2b636e658ca7346ffb32bf11301d92b72a1de.zip | |
Implement the instruction_set attribute
Diffstat (limited to 'compiler/rustc_error_codes/src')
| -rw-r--r-- | compiler/rustc_error_codes/src/error_codes.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_error_codes/src/error_codes/E0778.md | 35 | ||||
| -rw-r--r-- | compiler/rustc_error_codes/src/error_codes/E0779.md | 32 |
3 files changed, 69 insertions, 0 deletions
diff --git a/compiler/rustc_error_codes/src/error_codes.rs b/compiler/rustc_error_codes/src/error_codes.rs index 981b5bb8ba7..0a88759f84c 100644 --- a/compiler/rustc_error_codes/src/error_codes.rs +++ b/compiler/rustc_error_codes/src/error_codes.rs @@ -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 diff --git a/compiler/rustc_error_codes/src/error_codes/E0778.md b/compiler/rustc_error_codes/src/error_codes/E0778.md new file mode 100644 index 00000000000..467362dca58 --- /dev/null +++ b/compiler/rustc_error_codes/src/error_codes/E0778.md @@ -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 diff --git a/compiler/rustc_error_codes/src/error_codes/E0779.md b/compiler/rustc_error_codes/src/error_codes/E0779.md new file mode 100644 index 00000000000..146e20c2626 --- /dev/null +++ b/compiler/rustc_error_codes/src/error_codes/E0779.md @@ -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 |
