Constant rustc_passes::DIAGNOSTICS [−][src]
pub const DIAGNOSTICS: [(&'static str, &'static str); 11]=
[("E0130", "\nYou declared a pattern as an argument in a foreign function declaration.\nErroneous code example:\n\n```compile_fail\nextern {\n fn foo((a, b): (u32, u32)); // error: patterns aren\'t allowed in foreign\n // function declarations\n}\n```\n\nPlease replace the pattern argument with a regular one. Example:\n\n```\nstruct SomeStruct {\n a: u32,\n b: u32,\n}\n\nextern {\n fn foo(s: SomeStruct); // ok!\n}\n```\n\nOr:\n\n```\nextern {\n fn foo(a: (u32, u32)); // ok!\n}\n```\n"), ("E0197", "\nInherent implementations (one that do not implement a trait but provide\nmethods associated with a type) are always safe because they are not\nimplementing an unsafe trait. Removing the `unsafe` keyword from the inherent\nimplementation will resolve this error.\n\n```compile_fail,E0197\nstruct Foo;\n\n// this will cause this error\nunsafe impl Foo { }\n// converting it to this will fix it\nimpl Foo { }\n```\n"), ("E0198", "\nA negative implementation is one that excludes a type from implementing a\nparticular trait. Not being able to use a trait is always a safe operation,\nso negative implementations are always safe and never need to be marked as\nunsafe.\n\n```compile_fail\n#![feature(optin_builtin_traits)]\n\nstruct Foo;\n\n// unsafe is unnecessary\nunsafe impl !Clone for Foo { }\n```\n\nThis will compile:\n\n```ignore (ignore auto_trait future compatibility warning)\n#![feature(optin_builtin_traits)]\n\nstruct Foo;\n\nauto trait Enterprise {}\n\nimpl !Enterprise for Foo { }\n```\n\nPlease note that negative impls are only allowed for auto traits.\n"), ("E0267", "\nThis error indicates the use of a loop keyword (`break` or `continue`) inside a\nclosure but outside of any loop. Erroneous code example:\n\n```compile_fail,E0267\nlet w = || { break; }; // error: `break` inside of a closure\n```\n\n`break` and `continue` keywords can be used as normal inside closures as long as\nthey are also contained within a loop. To halt the execution of a closure you\nshould instead use a return statement. Example:\n\n```\nlet w = || {\n for _ in 0..10 {\n break;\n }\n};\n\nw();\n```\n"), ("E0268", "\nThis error indicates the use of a loop keyword (`break` or `continue`) outside\nof a loop. Without a loop to break out of or continue in, no sensible action can\nbe taken. Erroneous code example:\n\n```compile_fail,E0268\nfn some_func() {\n break; // error: `break` outside of loop\n}\n```\n\nPlease verify that you are using `break` and `continue` only in loops. Example:\n\n```\nfn some_func() {\n for _ in 0..10 {\n break; // ok!\n }\n}\n```\n"), ("E0379", "\nTrait methods cannot be declared `const` by design. For more information, see\n[RFC 911].\n\n[RFC 911]: https://github.com/rust-lang/rfcs/pull/911\n"), ("E0380", "\nAuto traits cannot have methods or associated items.\nFor more information see the [opt-in builtin traits RFC][RFC 19].\n\n[RFC 19]: https://github.com/rust-lang/rfcs/blob/master/text/0019-opt-in-builtin-traits.md\n"), ("E0449", "\nA visibility qualifier was used when it was unnecessary. Erroneous code\nexamples:\n\n```compile_fail,E0449\nstruct Bar;\n\ntrait Foo {\n fn foo();\n}\n\npub impl Bar {} // error: unnecessary visibility qualifier\n\npub impl Foo for Bar { // error: unnecessary visibility qualifier\n pub fn foo() {} // error: unnecessary visibility qualifier\n}\n```\n\nTo fix this error, please remove the visibility qualifier when it is not\nrequired. Example:\n\n```\nstruct Bar;\n\ntrait Foo {\n fn foo();\n}\n\n// Directly implemented methods share the visibility of the type itself,\n// so `pub` is unnecessary here\nimpl Bar {}\n\n// Trait methods share the visibility of the trait, so `pub` is\n// unnecessary in either case\nimpl Foo for Bar {\n fn foo() {}\n}\n```\n"), ("E0590", "\n`break` or `continue` must include a label when used in the condition of a\n`while` loop.\n\nExample of erroneous code:\n\n```compile_fail\nwhile break {}\n```\n\nTo fix this, add a label specifying which loop is being broken out of:\n```\n\'foo: while break \'foo {}\n```\n"), ("E0571", "\nA `break` statement with an argument appeared in a non-`loop` loop.\n\nExample of erroneous code:\n\n```compile_fail,E0571\n# let mut i = 1;\n# fn satisfied(n: usize) -> bool { n % 23 == 0 }\nlet result = while true {\n if satisfied(i) {\n break 2*i; // error: `break` with value from a `while` loop\n }\n i += 1;\n};\n```\n\nThe `break` statement can take an argument (which will be the value of the loop\nexpression if the `break` statement is executed) in `loop` loops, but not\n`for`, `while`, or `while let` loops.\n\nMake sure `break value;` statements only occur in `loop` loops:\n\n```\n# let mut i = 1;\n# fn satisfied(n: usize) -> bool { n % 23 == 0 }\nlet result = loop { // ok!\n if satisfied(i) {\n break 2*i;\n }\n i += 1;\n};\n```\n"), ("E0695", "\nA `break` statement without a label appeared inside a labeled block.\n\nExample of erroneous code:\n\n```compile_fail,E0695\n# #![feature(label_break_value)]\nloop {\n \'a: {\n break;\n }\n}\n```\n\nMake sure to always label the `break`:\n\n```\n# #![feature(label_break_value)]\n\'l: loop {\n \'a: {\n break \'l;\n }\n}\n```\n\nOr if you want to `break` the labeled block:\n\n```\n# #![feature(label_break_value)]\nloop {\n \'a: {\n break \'a;\n }\n break;\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?