Constant syntax::DIAGNOSTICS [] [src]

pub const DIAGNOSTICS: [(&'static str, &'static str); 13] = [("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]:\n"),
  "\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:\n\n"),
  "\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://\n"),
  "\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:\n\n"),
  "\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:\n\n"),
  "\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]:\n"),
  "\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"),
  "\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"),
  "\nThe `export_name` attribute was malformed.\n\nErroneous code example:\n\n```compile_fail,E0558\n#[export_name] // error: export_name attribute has invalid format\npub fn something() {}\n\nfn main() {}\n```\n\nThe `export_name` attribute expects a string in order to determine the name of\nthe exported symbol. Example:\n\n```\n#[export_name = \"some_function\"] // ok!\npub fn something() {}\n\nfn main() {}\n```\n"),
  "\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"),
  "\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 `` or `file_that_doesnt_exist/` in the\nsame directory.\n"),
  "\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"),
  "\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, and unstable location; did you mean to load this crate from via Cargo.toml instead?