Constant syntax::DIAGNOSTICS [] [src]

pub const DIAGNOSTICS: [(&'static str, &'static str); 12] = [("E0178",
  "\nIn types, the `+` type operator has low precedence, so it is often necessary\nto use parentheses.\n\nFor example:\n\n```compile_fail,E0178\ntrait Foo {}\n\nstruct Bar<\'a> {\n    w: &\'a Foo + Copy,   // error, use &\'a (Foo + Copy)\n    x: &\'a Foo + \'a,     // error, use &\'a (Foo + \'a)\n    y: &\'a mut Foo + \'a, // error, use &\'a mut (Foo + \'a)\n    z: fn() -> Foo + \'a, // error, use fn() -> (Foo + \'a)\n}\n```\n\nMore details can be found in [RFC 438].\n\n[RFC 438]: https://github.com/rust-lang/rfcs/pull/438\n"),
 ("E0534",
  "\nThe `inline` attribute was malformed.\n\nErroneous code example:\n\n```ignore (compile_fail not working here; see Issue #43707)\n#[inline()] // error: expected one argument\npub fn something() {}\n\nfn main() {}\n```\n\nThe parenthesized `inline` attribute requires the parameter to be specified:\n\n```\n#[inline(always)]\nfn something() {}\n```\n\nor:\n\n```\n#[inline(never)]\nfn something() {}\n```\n\nAlternatively, a paren-less version of the attribute may be used to hint the\ncompiler about inlining opportunity:\n\n```\n#[inline]\nfn something() {}\n```\n\nFor more information about the inline attribute, read:\nhttps://doc.rust-lang.org/reference.html#inline-attributes\n"),
 ("E0535",
  "\nAn unknown argument was given to the `inline` attribute.\n\nErroneous code example:\n\n```ignore (compile_fail not working here; see Issue #43707)\n#[inline(unknown)] // error: invalid argument\npub fn something() {}\n\nfn main() {}\n```\n\nThe `inline` attribute only supports two arguments:\n\n * always\n * never\n\nAll other arguments given to the `inline` attribute will return this error.\nExample:\n\n```\n#[inline(never)] // ok!\npub fn something() {}\n\nfn main() {}\n```\n\nFor more information about the inline attribute, https:\nread://doc.rust-lang.org/reference.html#inline-attributes\n"),
 ("E0536",
  "\nThe `not` cfg-predicate was malformed.\n\nErroneous code example:\n\n```compile_fail,E0536\n#[cfg(not())] // error: expected 1 cfg-pattern\npub fn something() {}\n\npub fn main() {}\n```\n\nThe `not` predicate expects one cfg-pattern. Example:\n\n```\n#[cfg(not(target_os = \"linux\"))] // ok!\npub fn something() {}\n\npub fn main() {}\n```\n\nFor more information about the cfg attribute, read:\nhttps://doc.rust-lang.org/reference.html#conditional-compilation\n"),
 ("E0537",
  "\nAn unknown predicate was used inside the `cfg` attribute.\n\nErroneous code example:\n\n```compile_fail,E0537\n#[cfg(unknown())] // error: invalid predicate `unknown`\npub fn something() {}\n\npub fn main() {}\n```\n\nThe `cfg` attribute supports only three kinds of predicates:\n\n * any\n * all\n * not\n\nExample:\n\n```\n#[cfg(not(target_os = \"linux\"))] // ok!\npub fn something() {}\n\npub fn main() {}\n```\n\nFor more information about the cfg attribute, read:\nhttps://doc.rust-lang.org/reference.html#conditional-compilation\n"),
 ("E0552",
  "\nA unrecognized representation attribute was used.\n\nErroneous code example:\n\n```compile_fail,E0552\n#[repr(D)] // error: unrecognized representation hint\nstruct MyStruct {\n    my_field: usize\n}\n```\n\nYou can use a `repr` attribute to tell the compiler how you want a struct or\nenum to be laid out in memory.\n\nMake sure you\'re using one of the supported options:\n\n```\n#[repr(C)] // ok!\nstruct MyStruct {\n    my_field: usize\n}\n```\n\nFor more information about specifying representations, see the [\"Alternative\nRepresentations\" section] of the Rustonomicon.\n\n[\"Alternative Representations\" section]: https://doc.rust-lang.org/nomicon/other-reprs.html\n"),
 ("E0554",
  "\nFeature attributes are only allowed on the nightly release channel. Stable or\nbeta compilers will not comply.\n\nExample of erroneous code (on a stable compiler):\n\n```ignore (depends on release channel)\n#![feature(non_ascii_idents)] // error: #![feature] may not be used on the\n                              //        stable release channel\n```\n\nIf you need the feature, make sure to use a nightly release of the compiler\n(but be warned that the feature may be removed or altered in the future).\n"),
 ("E0557",
  "\nA feature attribute named a feature that has been removed.\n\nErroneous code example:\n\n```compile_fail,E0557\n#![feature(managed_boxes)] // error: feature has been removed\n```\n\nDelete the offending feature attribute.\n"),
 ("E0565",
  "\nA literal was used in an attribute that doesn\'t support literals.\n\nErroneous code example:\n\n```ignore (compile_fail not working here; see Issue #43707)\n#![feature(attr_literals)]\n\n#[inline(\"always\")] // error: unsupported literal\npub fn something() {}\n```\n\nLiterals in attributes are new and largely unsupported. Work to support literals\nwhere appropriate is ongoing. Try using an unquoted name instead:\n\n```\n#[inline(always)]\npub fn something() {}\n```\n"),
 ("E0583",
  "\nA file wasn\'t found for an out-of-line module.\n\nErroneous code example:\n\n```ignore (compile_fail not working here; see Issue #43707)\nmod file_that_doesnt_exist; // error: file not found for module\n\nfn main() {}\n```\n\nPlease be sure that a file corresponding to the module exists. If you\nwant to use a module named `file_that_doesnt_exist`, you need to have a file\nnamed `file_that_doesnt_exist.rs` or `file_that_doesnt_exist/mod.rs` in the\nsame directory.\n"),
 ("E0585",
  "\nA documentation comment that doesn\'t document anything was found.\n\nErroneous code example:\n\n```compile_fail,E0585\nfn main() {\n    // The following doc comment will fail:\n    /// This is a useless doc comment!\n}\n```\n\nDocumentation comments need to be followed by items, including functions,\ntypes, modules, etc. Examples:\n\n```\n/// I\'m documenting the following struct:\nstruct Foo;\n\n/// I\'m documenting the following function:\nfn foo() {}\n```\n"),
 ("E0586",
  "\nAn inclusive range was used with no end.\n\nErroneous code example:\n\n```compile_fail,E0586\n#![feature(inclusive_range_syntax)]\n\nfn main() {\n    let tmp = vec![0, 1, 2, 3, 4, 4, 3, 3, 2, 1];\n    let x = &tmp[1..=]; // error: inclusive range was used with no end\n}\n```\n\nAn inclusive range needs an end in order to *include* it. If you just need a\nstart and no end, use a non-inclusive range (with `..`):\n\n```\nfn main() {\n    let tmp = vec![0, 1, 2, 3, 4, 4, 3, 3, 2, 1];\n    let x = &tmp[1..]; // ok!\n}\n```\n\nOr put an end to your inclusive range:\n\n```\n#![feature(inclusive_range_syntax)]\n\nfn main() {\n    let tmp = vec![0, 1, 2, 3, 4, 4, 3, 3, 2, 1];\n    let x = &tmp[1..=3]; // ok!\n}\n```\n")]
🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?