2016-07-03 16:24:19 +02:00
|
|
|
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
|
2016-06-28 19:40:40 +02:00
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
|
|
|
#![allow(non_snake_case)]
|
|
|
|
|
|
|
|
// 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! {
|
|
|
|
|
2017-01-16 23:33:45 +03:00
|
|
|
E0178: r##"
|
|
|
|
In types, the `+` type operator has low precedence, so it is often necessary
|
|
|
|
to use parentheses.
|
|
|
|
|
|
|
|
For example:
|
|
|
|
|
|
|
|
```compile_fail,E0178
|
|
|
|
trait Foo {}
|
|
|
|
|
|
|
|
struct Bar<'a> {
|
|
|
|
w: &'a Foo + Copy, // error, use &'a (Foo + Copy)
|
|
|
|
x: &'a Foo + 'a, // error, use &'a (Foo + 'a)
|
|
|
|
y: &'a mut Foo + 'a, // error, use &'a mut (Foo + 'a)
|
|
|
|
z: fn() -> Foo + 'a, // error, use fn() -> (Foo + 'a)
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
More details can be found in [RFC 438].
|
|
|
|
|
|
|
|
[RFC 438]: https://github.com/rust-lang/rfcs/pull/438
|
|
|
|
"##,
|
|
|
|
|
2016-07-03 16:34:47 +02:00
|
|
|
E0534: r##"
|
2016-07-04 14:20:45 +02:00
|
|
|
The `inline` attribute was malformed.
|
2016-07-03 16:34:47 +02:00
|
|
|
|
|
|
|
Erroneous code example:
|
|
|
|
|
2017-08-06 21:36:06 -07:00
|
|
|
```ignore (compile_fail not working here; see Issue #43707)
|
2016-07-03 16:34:47 +02:00
|
|
|
#[inline()] // error: expected one argument
|
|
|
|
pub fn something() {}
|
|
|
|
|
|
|
|
fn main() {}
|
|
|
|
```
|
|
|
|
|
2016-07-04 14:20:45 +02:00
|
|
|
The parenthesized `inline` attribute requires the parameter to be specified:
|
2016-07-03 16:34:47 +02:00
|
|
|
|
2017-06-20 15:15:16 +08:00
|
|
|
```
|
2016-07-04 14:20:45 +02:00
|
|
|
#[inline(always)]
|
|
|
|
fn something() {}
|
2017-06-20 15:15:16 +08:00
|
|
|
```
|
2016-07-03 16:34:47 +02:00
|
|
|
|
2017-06-20 15:15:16 +08:00
|
|
|
or:
|
2016-07-04 14:20:45 +02:00
|
|
|
|
2017-06-20 15:15:16 +08:00
|
|
|
```
|
2016-07-04 14:20:45 +02:00
|
|
|
#[inline(never)]
|
|
|
|
fn something() {}
|
2016-07-03 16:34:47 +02:00
|
|
|
```
|
|
|
|
|
2016-07-04 14:20:45 +02:00
|
|
|
Alternatively, a paren-less version of the attribute may be used to hint the
|
|
|
|
compiler about inlining opportunity:
|
2016-07-03 16:34:47 +02:00
|
|
|
|
|
|
|
```
|
2016-07-04 14:20:45 +02:00
|
|
|
#[inline]
|
|
|
|
fn something() {}
|
2016-07-03 16:34:47 +02:00
|
|
|
```
|
|
|
|
|
2016-07-04 14:20:45 +02:00
|
|
|
For more information about the inline attribute, read:
|
2016-07-03 16:53:17 +02:00
|
|
|
https://doc.rust-lang.org/reference.html#inline-attributes
|
2016-07-03 16:34:47 +02:00
|
|
|
"##,
|
|
|
|
|
2016-07-03 16:47:30 +02:00
|
|
|
E0535: r##"
|
2016-07-04 14:20:45 +02:00
|
|
|
An unknown argument was given to the `inline` attribute.
|
2016-07-03 16:47:30 +02:00
|
|
|
|
|
|
|
Erroneous code example:
|
|
|
|
|
2017-08-06 21:36:06 -07:00
|
|
|
```ignore (compile_fail not working here; see Issue #43707)
|
2016-07-03 16:47:30 +02:00
|
|
|
#[inline(unknown)] // error: invalid argument
|
|
|
|
pub fn something() {}
|
|
|
|
|
|
|
|
fn main() {}
|
|
|
|
```
|
|
|
|
|
2016-07-04 14:20:45 +02:00
|
|
|
The `inline` attribute only supports two arguments:
|
2016-07-03 16:47:30 +02:00
|
|
|
|
|
|
|
* always
|
|
|
|
* never
|
|
|
|
|
2016-07-04 14:20:45 +02:00
|
|
|
All other arguments given to the `inline` attribute will return this error.
|
2016-07-03 16:47:30 +02:00
|
|
|
Example:
|
|
|
|
|
|
|
|
```
|
|
|
|
#[inline(never)] // ok!
|
|
|
|
pub fn something() {}
|
|
|
|
|
|
|
|
fn main() {}
|
|
|
|
```
|
|
|
|
|
2016-07-04 14:20:45 +02:00
|
|
|
For more information about the inline attribute, https:
|
|
|
|
read://doc.rust-lang.org/reference.html#inline-attributes
|
2016-07-03 16:53:17 +02:00
|
|
|
"##,
|
|
|
|
|
|
|
|
E0536: r##"
|
2016-07-04 14:20:45 +02:00
|
|
|
The `not` cfg-predicate was malformed.
|
2016-07-03 16:53:17 +02:00
|
|
|
|
|
|
|
Erroneous code example:
|
|
|
|
|
|
|
|
```compile_fail,E0536
|
|
|
|
#[cfg(not())] // error: expected 1 cfg-pattern
|
|
|
|
pub fn something() {}
|
|
|
|
|
|
|
|
pub fn main() {}
|
|
|
|
```
|
|
|
|
|
2016-07-04 14:20:45 +02:00
|
|
|
The `not` predicate expects one cfg-pattern. Example:
|
2016-07-03 16:53:17 +02:00
|
|
|
|
|
|
|
```
|
|
|
|
#[cfg(not(target_os = "linux"))] // ok!
|
|
|
|
pub fn something() {}
|
|
|
|
|
|
|
|
pub fn main() {}
|
|
|
|
```
|
|
|
|
|
2016-07-04 14:20:45 +02:00
|
|
|
For more information about the cfg attribute, read:
|
2016-07-03 16:53:17 +02:00
|
|
|
https://doc.rust-lang.org/reference.html#conditional-compilation
|
2016-07-03 16:47:30 +02:00
|
|
|
"##,
|
|
|
|
|
2016-07-03 16:58:43 +02:00
|
|
|
E0537: r##"
|
2016-07-04 14:20:45 +02:00
|
|
|
An unknown predicate was used inside the `cfg` attribute.
|
2016-07-03 16:58:43 +02:00
|
|
|
|
|
|
|
Erroneous code example:
|
|
|
|
|
|
|
|
```compile_fail,E0537
|
|
|
|
#[cfg(unknown())] // error: invalid predicate `unknown`
|
|
|
|
pub fn something() {}
|
|
|
|
|
|
|
|
pub fn main() {}
|
|
|
|
```
|
|
|
|
|
2016-07-04 14:20:45 +02:00
|
|
|
The `cfg` attribute supports only three kinds of predicates:
|
2016-07-03 16:58:43 +02:00
|
|
|
|
|
|
|
* any
|
|
|
|
* all
|
|
|
|
* not
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
```
|
|
|
|
#[cfg(not(target_os = "linux"))] // ok!
|
|
|
|
pub fn something() {}
|
|
|
|
|
|
|
|
pub fn main() {}
|
|
|
|
```
|
|
|
|
|
2016-07-04 14:20:45 +02:00
|
|
|
For more information about the cfg attribute, read:
|
2016-07-03 16:58:43 +02:00
|
|
|
https://doc.rust-lang.org/reference.html#conditional-compilation
|
|
|
|
"##,
|
|
|
|
|
2017-08-07 10:57:08 -07:00
|
|
|
E0554: r##"
|
|
|
|
Feature attributes are only allowed on the nightly release channel. Stable or
|
|
|
|
beta compilers will not comply.
|
|
|
|
|
|
|
|
Example of erroneous code (on a stable compiler):
|
|
|
|
|
|
|
|
```ignore (depends on release channel)
|
|
|
|
#![feature(non_ascii_idents)] // error: #![feature] may not be used on the
|
|
|
|
// stable release channel
|
|
|
|
```
|
|
|
|
|
|
|
|
If you need the feature, make sure to use a nightly release of the compiler
|
|
|
|
(but be warned that the feature may be removed or altered in the future).
|
|
|
|
"##,
|
|
|
|
|
2016-07-11 23:27:27 +02:00
|
|
|
E0558: r##"
|
|
|
|
The `export_name` attribute was malformed.
|
|
|
|
|
|
|
|
Erroneous code example:
|
|
|
|
|
|
|
|
```compile_fail,E0558
|
|
|
|
#[export_name] // error: export_name attribute has invalid format
|
|
|
|
pub fn something() {}
|
|
|
|
|
|
|
|
fn main() {}
|
|
|
|
```
|
|
|
|
|
|
|
|
The `export_name` attribute expects a string in order to determine the name of
|
|
|
|
the exported symbol. Example:
|
|
|
|
|
|
|
|
```
|
|
|
|
#[export_name = "some_function"] // ok!
|
|
|
|
pub fn something() {}
|
|
|
|
|
|
|
|
fn main() {}
|
|
|
|
```
|
|
|
|
"##,
|
|
|
|
|
2016-08-19 18:58:14 -07:00
|
|
|
E0565: r##"
|
|
|
|
A literal was used in an attribute that doesn't support literals.
|
|
|
|
|
|
|
|
Erroneous code example:
|
|
|
|
|
2017-08-06 21:36:06 -07:00
|
|
|
```ignore (compile_fail not working here; see Issue #43707)
|
|
|
|
#![feature(attr_literals)]
|
|
|
|
|
2016-08-19 18:58:14 -07:00
|
|
|
#[inline("always")] // error: unsupported literal
|
|
|
|
pub fn something() {}
|
|
|
|
```
|
|
|
|
|
|
|
|
Literals in attributes are new and largely unsupported. Work to support literals
|
|
|
|
where appropriate is ongoing. Try using an unquoted name instead:
|
|
|
|
|
|
|
|
```
|
|
|
|
#[inline(always)]
|
|
|
|
pub fn something() {}
|
|
|
|
```
|
|
|
|
"##,
|
2017-02-12 15:18:41 +01:00
|
|
|
|
|
|
|
E0583: r##"
|
|
|
|
A file wasn't found for an out-of-line module.
|
|
|
|
|
|
|
|
Erroneous code example:
|
|
|
|
|
2017-08-06 21:36:06 -07:00
|
|
|
```ignore (compile_fail not working here; see Issue #43707)
|
2017-02-12 15:18:41 +01:00
|
|
|
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
|
2017-08-06 21:36:06 -07:00
|
|
|
#![feature(inclusive_range_syntax)]
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
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
|
|
|
|
}
|
2017-02-12 15:18:41 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
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 `..`):
|
|
|
|
|
|
|
|
```
|
2017-08-06 21:36:06 -07:00
|
|
|
fn main() {
|
|
|
|
let tmp = vec![0, 1, 2, 3, 4, 4, 3, 3, 2, 1];
|
|
|
|
let x = &tmp[1..]; // ok!
|
|
|
|
}
|
2017-02-12 15:18:41 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
Or put an end to your inclusive range:
|
|
|
|
|
|
|
|
```
|
2017-08-06 21:36:06 -07:00
|
|
|
#![feature(inclusive_range_syntax)]
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let tmp = vec![0, 1, 2, 3, 4, 4, 3, 3, 2, 1];
|
|
|
|
let x = &tmp[1...3]; // ok!
|
|
|
|
}
|
2017-02-12 15:18:41 +01:00
|
|
|
```
|
|
|
|
"##,
|
|
|
|
|
2016-06-28 19:40:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
register_diagnostics! {
|
2016-06-29 22:10:20 +02:00
|
|
|
E0538, // multiple [same] items
|
|
|
|
E0539, // incorrect meta item
|
|
|
|
E0540, // multiple rustc_deprecated attributes
|
|
|
|
E0541, // unknown meta item
|
|
|
|
E0542, // missing 'since'
|
|
|
|
E0543, // missing 'reason'
|
|
|
|
E0544, // multiple stability levels
|
|
|
|
E0545, // incorrect 'issue'
|
|
|
|
E0546, // missing 'feature'
|
|
|
|
E0547, // missing 'issue'
|
|
|
|
E0548, // incorrect stability attribute type
|
|
|
|
E0549, // rustc_deprecated attribute must be paired with either stable or unstable attribute
|
|
|
|
E0550, // multiple deprecated attributes
|
|
|
|
E0551, // incorrect meta item
|
|
|
|
E0552, // unrecognized representation hint
|
|
|
|
E0555, // malformed feature attribute, expected #![feature(...)]
|
|
|
|
E0556, // malformed feature, expected just one word
|
|
|
|
E0557, // feature has been removed
|
2017-02-12 14:33:17 +01:00
|
|
|
E0584, // file for module `..` found at both .. and ..
|
2017-03-25 19:00:49 +11:00
|
|
|
E0589, // invalid `repr(align)` attribute
|
2016-06-28 19:40:40 +02:00
|
|
|
}
|