diff options
| author | bors <bors@rust-lang.org> | 2019-04-18 14:52:45 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-04-18 14:52:45 +0000 |
| commit | d6f513ec7d1e83c8689f94fb48686dd11f1d1c80 (patch) | |
| tree | ffac5f0c321b75165397cf045d60ed31c171a0fa /src/libsyntax_ext/error_codes.rs | |
| parent | bf843eb9c2d48a80a5992a5d60858e27269f9575 (diff) | |
| parent | a1d2f7222cf1f5c4344a918251c7f37d252c2434 (diff) | |
| download | rust-d6f513ec7d1e83c8689f94fb48686dd11f1d1c80.tar.gz rust-d6f513ec7d1e83c8689f94fb48686dd11f1d1c80.zip | |
Auto merge of #60025 - JohnTitor:rename-files, r=petrochenkov
Rename files about error codes
fixes #60017
This PR will be failed in tidy.
<details>
<summary>The log is here:</summary>
```
tidy check
tidy error: duplicate error code: 411
tidy error: Documents\GitHub\rust\src\librustc_resolve\diagnostics.rs:83: __diagnostic_used!(E0411);
tidy error: Documents\GitHub\rust\src\librustc_resolve\diagnostics.rs:84: err.code(DiagnosticId::Error("E0411".to_owned()));
tidy error: duplicate error code: 424
tidy error: Documents\GitHub\rust\src\librustc_resolve\diagnostics.rs:90: debug!("smart_resolve_path_fragment: E0424, source={:?}", source);
tidy error: Documents\GitHub\rust\src\librustc_resolve\diagnostics.rs:92: __diagnostic_used!(E0424);
tidy error: Documents\GitHub\rust\src\librustc_resolve\diagnostics.rs:93: err.code(DiagnosticId::Error("E0424".to_owned()));
some tidy checks failed
```
</details>
I'd like to fix this but I don't know what to do.
I will work on later. Please let me know if you have any solutions.
r? @petrochenkov
Diffstat (limited to 'src/libsyntax_ext/error_codes.rs')
| -rw-r--r-- | src/libsyntax_ext/error_codes.rs | 123 |
1 files changed, 123 insertions, 0 deletions
diff --git a/src/libsyntax_ext/error_codes.rs b/src/libsyntax_ext/error_codes.rs new file mode 100644 index 00000000000..9bbd9fdec17 --- /dev/null +++ b/src/libsyntax_ext/error_codes.rs @@ -0,0 +1,123 @@ +#![allow(non_snake_case)] + +use syntax::{register_diagnostic, register_long_diagnostics}; + +// Error messages for EXXXX errors. +// Each message should start and end with a new line, and be wrapped to 80 characters. +// In vim you can `:set tw=80` and use `gq` to wrap paragraphs. Use `:set tw=0` to disable. +register_long_diagnostics! { +E0660: r##" +The argument to the `asm` macro is not well-formed. + +Erroneous code example: + +```compile_fail,E0660 +asm!("nop" "nop"); +``` + +Considering that this would be a long explanation, we instead recommend you to +take a look at the unstable book: +https://doc.rust-lang.org/unstable-book/language-features/asm.html +"##, + +E0661: r##" +An invalid syntax was passed to the second argument of an `asm` macro line. + +Erroneous code example: + +```compile_fail,E0661 +let a; +asm!("nop" : "r"(a)); +``` + +Considering that this would be a long explanation, we instead recommend you to +take a look at the unstable book: +https://doc.rust-lang.org/unstable-book/language-features/asm.html +"##, + +E0662: r##" +An invalid input operand constraint was passed to the `asm` macro (third line). + +Erroneous code example: + +```compile_fail,E0662 +asm!("xor %eax, %eax" + : + : "=test"("a") + ); +``` + +Considering that this would be a long explanation, we instead recommend you to +take a look at the unstable book: +https://doc.rust-lang.org/unstable-book/language-features/asm.html +"##, + +E0663: r##" +An invalid input operand constraint was passed to the `asm` macro (third line). + +Erroneous code example: + +```compile_fail,E0663 +asm!("xor %eax, %eax" + : + : "+test"("a") + ); +``` + +Considering that this would be a long explanation, we instead recommend you to +take a look at the unstable book: +https://doc.rust-lang.org/unstable-book/language-features/asm.html +"##, + +E0664: r##" +A clobber was surrounded by braces in the `asm` macro. + +Erroneous code example: + +```compile_fail,E0664 +asm!("mov $$0x200, %eax" + : + : + : "{eax}" + ); +``` + +Considering that this would be a long explanation, we instead recommend you to +take a look at the unstable book: +https://doc.rust-lang.org/unstable-book/language-features/asm.html +"##, + +E0665: r##" +The `Default` trait was derived on an enum. + +Erroneous code example: + +```compile_fail,E0665 +#[derive(Default)] +enum Food { + Sweet, + Salty, +} +``` + +The `Default` cannot be derived on an enum for the simple reason that the +compiler doesn't know which value to pick by default whereas it can for a +struct as long as all its fields implement the `Default` trait as well. + +If you still want to implement `Default` on your enum, you'll have to do it "by +hand": + +``` +enum Food { + Sweet, + Salty, +} + +impl Default for Food { + fn default() -> Food { + Food::Sweet + } +} +``` +"##, +} |
