diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs index e01bd2a93aa..67f73d4dd4f 100644 --- a/src/libsyntax/attr.rs +++ b/src/libsyntax/attr.rs @@ -324,7 +324,7 @@ pub fn find_export_name_attr(diag: &Handler, attrs: &[Attribute]) -> Option, attrs: &[Attribute]) -> In InlineAttr::None } } - _ => ia + _ => ia, } }) } diff --git a/src/libsyntax/diagnostic_list.rs b/src/libsyntax/diagnostic_list.rs index eb30657bd56..010b1d638e6 100644 --- a/src/libsyntax/diagnostic_list.rs +++ b/src/libsyntax/diagnostic_list.rs @@ -1,4 +1,4 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // @@ -15,9 +15,146 @@ // In vim you can `:set tw=80` and use `gq` to wrap paragraphs. Use `:set tw=0` to disable. register_long_diagnostics! { -E0533: r##" -```compile_fail,E0533 -#[export_name] +E0534: r##" +The `inline` attribute was malformed. + +Erroneous code example: + +```compile_fail,E0534 +#[inline()] // error: expected one argument +pub fn something() {} + +fn main() {} +``` + +The parenthesized `inline` attribute requires the parameter to be specified: + +```ignore +#[inline(always)] +fn something() {} + +// or: + +#[inline(never)] +fn something() {} +``` + +Alternatively, a paren-less version of the attribute may be used to hint the +compiler about inlining opportunity: + +``` +#[inline] +fn something() {} +``` + +For more information about the inline attribute, read: +https://doc.rust-lang.org/reference.html#inline-attributes +"##, + +E0535: r##" +An unknown argument was given to the `inline` attribute. + +Erroneous code example: + +```compile_fail,E0535 +#[inline(unknown)] // error: invalid argument +pub fn something() {} + +fn main() {} +``` + +The `inline` attribute only supports two arguments: + + * always + * never + +All other arguments given to the `inline` attribute will return this error. +Example: + +``` +#[inline(never)] // ok! +pub fn something() {} + +fn main() {} +``` + +For more information about the inline attribute, https: +read://doc.rust-lang.org/reference.html#inline-attributes +"##, + +E0536: r##" +The `not` cfg-predicate was malformed. + +Erroneous code example: + +```compile_fail,E0536 +#[cfg(not())] // error: expected 1 cfg-pattern +pub fn something() {} + +pub fn main() {} +``` + +The `not` predicate expects one cfg-pattern. Example: + +``` +#[cfg(not(target_os = "linux"))] // ok! +pub fn something() {} + +pub fn main() {} +``` + +For more information about the cfg attribute, read: +https://doc.rust-lang.org/reference.html#conditional-compilation +"##, + +E0537: r##" +An unknown predicate was used inside the `cfg` attribute. + +Erroneous code example: + +```compile_fail,E0537 +#[cfg(unknown())] // error: invalid predicate `unknown` +pub fn something() {} + +pub fn main() {} +``` + +The `cfg` attribute supports only three kinds of predicates: + + * any + * all + * not + +Example: + +``` +#[cfg(not(target_os = "linux"))] // ok! +pub fn something() {} + +pub fn main() {} +``` + +For more information about the cfg attribute, read: +https://doc.rust-lang.org/reference.html#conditional-compilation +"##, + +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() {} @@ -27,10 +164,6 @@ fn main() {} } register_diagnostics! { - E0534, // expected one argument - E0535, // invalid argument - E0536, // expected 1 cfg-pattern - E0537, // invalid predicate E0538, // multiple [same] items E0539, // incorrect meta item E0540, // multiple rustc_deprecated attributes diff --git a/src/tools/tidy/src/errors.rs b/src/tools/tidy/src/errors.rs index 41869288cc9..3a70e54ff97 100644 --- a/src/tools/tidy/src/errors.rs +++ b/src/tools/tidy/src/errors.rs @@ -25,7 +25,7 @@ pub fn check(path: &Path, bad: &mut bool) { &mut |path| super::filter_dirs(path) || path.ends_with("src/test"), &mut |file| { let filename = file.file_name().unwrap().to_string_lossy(); - if filename != "diagnostics.rs" { + if filename != "diagnostics.rs" && filename != "diagnostic_list.rs" { return } diff --git a/src/tools/tidy/src/features.rs b/src/tools/tidy/src/features.rs index 0b989d92b3d..199e8a77df7 100644 --- a/src/tools/tidy/src/features.rs +++ b/src/tools/tidy/src/features.rs @@ -46,7 +46,8 @@ pub fn check(path: &Path, bad: &mut bool) { &mut |path| super::filter_dirs(path) || path.ends_with("src/test"), &mut |file| { let filename = file.file_name().unwrap().to_string_lossy(); - if !filename.ends_with(".rs") || filename == "features.rs" { + if !filename.ends_with(".rs") || filename == "features.rs" || + filename == "diagnostic_list.rs" { return }