diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2017-02-12 15:18:41 +0100 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2017-02-21 15:52:14 +0100 |
| commit | b6818be41dea90e53344f84770f5e0faaacee4a8 (patch) | |
| tree | b14ffb3c7e637eeefd43490868600432cd82dbf7 /src/libsyntax/diagnostic_list.rs | |
| parent | 0a45dd7e711abdd3bcfb6292bba836485ee82fae (diff) | |
| download | rust-b6818be41dea90e53344f84770f5e0faaacee4a8.tar.gz rust-b6818be41dea90e53344f84770f5e0faaacee4a8.zip | |
Add long error explanations
Diffstat (limited to 'src/libsyntax/diagnostic_list.rs')
| -rw-r--r-- | src/libsyntax/diagnostic_list.rs | 71 |
1 files changed, 68 insertions, 3 deletions
diff --git a/src/libsyntax/diagnostic_list.rs b/src/libsyntax/diagnostic_list.rs index f482b818f77..2d59051ec4a 100644 --- a/src/libsyntax/diagnostic_list.rs +++ b/src/libsyntax/diagnostic_list.rs @@ -201,6 +201,74 @@ where appropriate is ongoing. Try using an unquoted name instead: pub fn something() {} ``` "##, + +E0583: r##" +A file wasn't found for an out-of-line module. + +Erroneous code example: + +```compile_fail,E0583 +mod file_that_doesnt_exist; // error: file not found for module + +fn main() {} +``` + +Please be sure that a file corresponding to the module exists. If you +want to use a module named `file_that_doesnt_exist`, you need to have a file +named `file_that_doesnt_exist.rs` or `file_that_doesnt_exist/mod.rs` in the +same directory. +"##, + +E0585: r##" +A documentation comment that doesn't document anything was found. + +Erroneous code example: + +```compile_fail,E0585 +fn main() { + // The following doc comment will fail: + /// This is a useless doc comment! +} +``` + +Documentation comments need to be followed by items, including functions, +types, modules, etc. Examples: + +``` +/// I'm documenting the following struct: +struct Foo; + +/// I'm documenting the following function: +fn foo() {} +``` +"##, + +E0586: r##" +An inclusive range was used with no end. + +Erroneous code example: + +```compile_fail,E0586 +let tmp = vec![0, 1, 2, 3, 4, 4, 3, 3, 2, 1]; +let x = &tmp[1...]; // error: inclusive range was used with no end +``` + +An inclusive range needs an end in order to *include* it. If you just need a +start and no end, use a non-inclusive range (with `..`): + +``` +let tmp = vec![0, 1, 2, 3, 4, 4, 3, 3, 2, 1]; +let x = &tmp[1..]; // ok! +``` + +Or put an end to your inclusive range: + +``` +let tmp = vec![0, 1, 2, 3, 4, 4, 3, 3, 2, 1]; +let x = &tmp[1...3]; // ok! +``` +"##, + } register_diagnostics! { @@ -224,8 +292,5 @@ register_diagnostics! { E0555, // malformed feature attribute, expected #![feature(...)] E0556, // malformed feature, expected just one word E0557, // feature has been removed - E0583, // file not found for module E0584, // file for module `..` found at both .. and .. - E0585, // documentation comment that doesn't document anything - E0586, // inclusive range with no end } |
