From 178f8a8078ad0a30cb968e6767fb605119aeedee Mon Sep 17 00:00:00 2001 From: Jackson O'Donnell Date: Thu, 21 Jul 2016 03:16:07 -0500 Subject: [PATCH 01/12] Added messages for E0467, E0468, E0469, and E0470 --- src/librustc_metadata/diagnostics.rs | 103 +++++++++++++++++++++++++-- 1 file changed, 99 insertions(+), 4 deletions(-) diff --git a/src/librustc_metadata/diagnostics.rs b/src/librustc_metadata/diagnostics.rs index ae9f500c5de59..129b1157364dc 100644 --- a/src/librustc_metadata/diagnostics.rs +++ b/src/librustc_metadata/diagnostics.rs @@ -91,6 +91,105 @@ You need to link your code to the relevant crate in order to be able to use it well, and you link to them the same way. "##, +E0467: r##" +Invalid or no macros listed for reexport. + +Causes of this error: +```ignore +#[macro_reexport] // error: no macros listed for export +extern crate macros_for_good; +``` + +```ignore +#[macro_reexport(fun_macro = "foo")] // error: not a macro identifier +extern crate macros_for_good; +``` + +Currently, `macro_reexport` requires at least one macro name to be listed. +Unlike `macro_use`, listing no names does not reexport all macros from the +given crate. + +Decide which macros you would like to export and list them properly. + +"##, + +E0468: r##" +A non-root module attempts to import macros from another crate. + +```ignore +mod foo { + #[macro_use(helpful_macro)] // error: must be at crate root to import + extern crate some_crate; // macros from another crate + helpful_macro!(...) +} + +fn main() { + // ... +} +``` + +Only `extern crate` imports at the crate root level (i.e., in lib.rs) are +allowed to import macros. + +Either move the macro import to crate root or do without the foreign macros. + +This will work: + +```ignore +#[macro_use(helpful_macro)] +extern crate some_crate; +mod foo { + helpful_macro!(...) +} + +fn main() { + //... +} +``` + +"##, + +E0469: r##" +A macro listed for import was not found. + +```ignore +/// // crate some_crate contains: +/// macro_rules! eat { +/// ... +/// } +/// macro_rules! drink { +/// ... +/// } +#[macro_use(be_merry)] // error: be_merry is not +extern crate some_crate; // a macro in some_crate! +``` + +This is likely caused by a typo. Did you misspell the macro's name? + +Double-check the names of the macros listed for import, and that the crate +in question exports them. +"##, + +E0470: r##" +A macro listed for reexport was not found. + +```ignore +/// // crate some_crate contains: +/// macro_rules! eat { +/// ... +/// } +/// macro_rules! drink { +/// ... +/// } +#[macro_reexport(be_merry)] // error: be_merry is not +extern crate some_crate; // a macro in some_crate! +``` + +This is likely caused by a typo. Did you misspell the macro's name? + +Double-check the names of the macros listed for reexport, and that the crate +in question exports them. +"## } register_diagnostics! { @@ -103,10 +202,6 @@ register_diagnostics! { E0464, // multiple matching crates for `..` E0465, // multiple .. candidates for `..` found E0466, // bad macro import - E0467, // bad macro reexport - E0468, // an `extern crate` loading macros must be at the crate root - E0469, // imported macro not found - E0470, // reexported macro not found E0519, // local crate and dependency have same (crate-name, disambiguator) E0523, // two dependencies have same (crate-name, disambiguator) but different SVH } From 4cbbe51cfef1c8cfcffe428144b7c18847e0f1c4 Mon Sep 17 00:00:00 2001 From: Jackson O'Donnell Date: Thu, 21 Jul 2016 23:10:03 -0500 Subject: [PATCH 02/12] registered diagnostics for rustc_metadata --- src/librustc_driver/lib.rs | 1 + src/librustc_metadata/lib.rs | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index 0a8df923b846b..2777a6d4ea241 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -1112,6 +1112,7 @@ pub fn diagnostics_registry() -> errors::registry::Registry { all_errors.extend_from_slice(&rustc_privacy::DIAGNOSTICS); all_errors.extend_from_slice(&rustc_trans::DIAGNOSTICS); all_errors.extend_from_slice(&rustc_const_eval::DIAGNOSTICS); + all_errors.extend_from_slice(&rustc_metadata::DIAGNOSTICS); Registry::new(&all_errors) } diff --git a/src/librustc_metadata/lib.rs b/src/librustc_metadata/lib.rs index cd92493e3db70..43569e8e49d50 100644 --- a/src/librustc_metadata/lib.rs +++ b/src/librustc_metadata/lib.rs @@ -62,3 +62,5 @@ pub mod index; pub mod loader; pub mod macro_import; pub mod tls_context; + +__build_diagnostic_array! { librustc_metadata, DIAGNOSTICS } From eead207f4a1a49ef4f46ff020ac2c6f91a2282a4 Mon Sep 17 00:00:00 2001 From: Jackson O'Donnell Date: Thu, 21 Jul 2016 23:49:48 -0500 Subject: [PATCH 03/12] added diagnostic message for E0466 --- src/librustc_metadata/diagnostics.rs | 111 ++++++++++++++++++++++++--- 1 file changed, 101 insertions(+), 10 deletions(-) diff --git a/src/librustc_metadata/diagnostics.rs b/src/librustc_metadata/diagnostics.rs index 129b1157364dc..a22b61d9586fc 100644 --- a/src/librustc_metadata/diagnostics.rs +++ b/src/librustc_metadata/diagnostics.rs @@ -91,15 +91,59 @@ You need to link your code to the relevant crate in order to be able to use it well, and you link to them the same way. "##, +E0466: r##" +Invalid macro import declarations. + +This is a syntax error at the level of attribute declarations. + +Causes of this error: + +```ignore +#[macro_use(a_macro(another_macro))] // error: invalid import declaration +extern crate some_crate; + +#[macro_use(i_want = "some_macros")] // error: invalid import declaration +extern crate another_crate; +``` + +Macro imports are properly declared as: + +```ignore +#[macro_use(get_tacos, bring_beer)] // imports macros get_tacos and +extern crate some_crate; // bring_beer from some_crate +``` + +Declaring `macro_use` with no arguments will import all available macros from +the given crate. + +Exported macros must be declared as such with `macro_export`. In the above +example, some_crate would contain: + +```ignore +#[macro_export] +macro_rules! get_tacos { + ... +} + +#[macro_export] +macro_rules! bring_beer { + ... +} +``` + +"##, + E0467: r##" Invalid or no macros listed for reexport. +This is a syntax error at the level of attribute declarations. + Causes of this error: + ```ignore #[macro_reexport] // error: no macros listed for export extern crate macros_for_good; ``` - ```ignore #[macro_reexport(fun_macro = "foo")] // error: not a macro identifier extern crate macros_for_good; @@ -110,7 +154,6 @@ Unlike `macro_use`, listing no names does not reexport all macros from the given crate. Decide which macros you would like to export and list them properly. - "##, E0468: r##" @@ -152,44 +195,93 @@ fn main() { E0469: r##" A macro listed for import was not found. +Either the listed macro is not contained in the imported crate, or it is not +exported from the given crate. + ```ignore /// // crate some_crate contains: +/// #[macro_export] /// macro_rules! eat { /// ... /// } /// macro_rules! drink { /// ... /// } -#[macro_use(be_merry)] // error: be_merry is not -extern crate some_crate; // a macro in some_crate! + +// error: drink is a private macro of some_crate +// error: be_merry does not exist in some_crate +#[macro_use(drink, be_merry)] +extern crate some_crate; ``` -This is likely caused by a typo. Did you misspell the macro's name? +This could be caused by a typo. Did you misspell the macro's name? Double-check the names of the macros listed for import, and that the crate in question exports them. + +A working version of the above: + +```ignore +/// // crate some_crate contains: +/// #[macro_export] +/// macro_rules! eat { +/// ... +/// } +/// #[macro_export] +/// macro_rules! drink { +/// ... +/// } + +#[macro_use(eat, drink)] +extern crate some_crate; +``` "##, E0470: r##" A macro listed for reexport was not found. +Either the listed macro is not contained in the imported crate, or it is not +exported from the given crate. + ```ignore /// // crate some_crate contains: +/// #[macro_export] /// macro_rules! eat { /// ... /// } /// macro_rules! drink { /// ... /// } -#[macro_reexport(be_merry)] // error: be_merry is not -extern crate some_crate; // a macro in some_crate! + +// error: drink is a private macro of some_crate +// error: be_merry does not exist in some_crate +#[macro_reexport(drink, be_merry)] +extern crate some_crate; ``` -This is likely caused by a typo. Did you misspell the macro's name? +This could be caused by a typo. Did you misspell the macro's name? Double-check the names of the macros listed for reexport, and that the crate in question exports them. -"## + +A working version of the above: + +```ignore +/// // crate some_crate contains: +/// #[macro_export] +/// macro_rules! eat { +/// ... +/// } +/// #[macro_export] +/// macro_rules! drink { +/// ... +/// } + +#[macro_reexport(eat, drink)] +extern crate some_crate; +``` +"##, + } register_diagnostics! { @@ -201,7 +293,6 @@ register_diagnostics! { E0462, // found staticlib `..` instead of rlib or dylib E0464, // multiple matching crates for `..` E0465, // multiple .. candidates for `..` found - E0466, // bad macro import E0519, // local crate and dependency have same (crate-name, disambiguator) E0523, // two dependencies have same (crate-name, disambiguator) but different SVH } From 3476aad31fa55d6c429c890449c6f0c14facc4a2 Mon Sep 17 00:00:00 2001 From: Jackson O'Donnell Date: Fri, 22 Jul 2016 09:20:18 -0500 Subject: [PATCH 04/12] fixed make tidy errors --- src/librustc_metadata/diagnostics.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/librustc_metadata/diagnostics.rs b/src/librustc_metadata/diagnostics.rs index a22b61d9586fc..afe2914f1a02e 100644 --- a/src/librustc_metadata/diagnostics.rs +++ b/src/librustc_metadata/diagnostics.rs @@ -109,14 +109,14 @@ extern crate another_crate; Macro imports are properly declared as: ```ignore -#[macro_use(get_tacos, bring_beer)] // imports macros get_tacos and +#[macro_use(get_tacos, bring_beer)] // imports macros get_tacos and extern crate some_crate; // bring_beer from some_crate ``` -Declaring `macro_use` with no arguments will import all available macros from +Declaring `macro_use` with no arguments will import all available macros from the given crate. -Exported macros must be declared as such with `macro_export`. In the above +Exported macros must be declared as such with `macro_export`. In the above example, some_crate would contain: ```ignore @@ -149,8 +149,8 @@ extern crate macros_for_good; extern crate macros_for_good; ``` -Currently, `macro_reexport` requires at least one macro name to be listed. -Unlike `macro_use`, listing no names does not reexport all macros from the +Currently, `macro_reexport` requires at least one macro name to be listed. +Unlike `macro_use`, listing no names does not reexport all macros from the given crate. Decide which macros you would like to export and list them properly. @@ -171,12 +171,12 @@ fn main() { } ``` -Only `extern crate` imports at the crate root level (i.e., in lib.rs) are +Only `extern crate` imports at the crate root level (i.e., in lib.rs) are allowed to import macros. Either move the macro import to crate root or do without the foreign macros. -This will work: +This will work: ```ignore #[macro_use(helpful_macro)] @@ -216,7 +216,7 @@ extern crate some_crate; This could be caused by a typo. Did you misspell the macro's name? -Double-check the names of the macros listed for import, and that the crate +Double-check the names of the macros listed for import, and that the crate in question exports them. A working version of the above: @@ -261,7 +261,7 @@ extern crate some_crate; This could be caused by a typo. Did you misspell the macro's name? -Double-check the names of the macros listed for reexport, and that the crate +Double-check the names of the macros listed for reexport, and that the crate in question exports them. A working version of the above: From 2a0136c6a6c0464a7df30450466fdd6d953257ac Mon Sep 17 00:00:00 2001 From: Jackson O'Donnell Date: Fri, 22 Jul 2016 09:31:19 -0500 Subject: [PATCH 05/12] compliant error messages --- src/librustc_metadata/diagnostics.rs | 63 +++++++++++++++------------- 1 file changed, 35 insertions(+), 28 deletions(-) diff --git a/src/librustc_metadata/diagnostics.rs b/src/librustc_metadata/diagnostics.rs index afe2914f1a02e..59eae48be872d 100644 --- a/src/librustc_metadata/diagnostics.rs +++ b/src/librustc_metadata/diagnostics.rs @@ -94,8 +94,6 @@ well, and you link to them the same way. E0466: r##" Invalid macro import declarations. -This is a syntax error at the level of attribute declarations. - Causes of this error: ```ignore @@ -106,42 +104,36 @@ extern crate some_crate; extern crate another_crate; ``` -Macro imports are properly declared as: +This is a syntax error at the level of attribute declarations. + +The proper syntax for macro imports is the following: ```ignore +// // some_crate contains: +// #[macro_export] +// macro_rules! get_tacos { +// ... +// } +// +// #[macro_export] +// macro_rules! bring_beer { +// ... +// } #[macro_use(get_tacos, bring_beer)] // imports macros get_tacos and extern crate some_crate; // bring_beer from some_crate ``` -Declaring `macro_use` with no arguments will import all available macros from -the given crate. - -Exported macros must be declared as such with `macro_export`. In the above -example, some_crate would contain: - -```ignore -#[macro_export] -macro_rules! get_tacos { - ... -} - -#[macro_export] -macro_rules! bring_beer { - ... -} -``` - +If you would like to import all exported macros, write `macro_use` with no +arguments. "##, E0467: r##" Invalid or no macros listed for reexport. -This is a syntax error at the level of attribute declarations. - Causes of this error: ```ignore -#[macro_reexport] // error: no macros listed for export +#[macro_reexport] // error: no macros listed for export extern crate macros_for_good; ``` ```ignore @@ -149,16 +141,27 @@ extern crate macros_for_good; extern crate macros_for_good; ``` +This is a syntax error at the level of attribute declarations. + Currently, `macro_reexport` requires at least one macro name to be listed. Unlike `macro_use`, listing no names does not reexport all macros from the given crate. Decide which macros you would like to export and list them properly. + +These are proper reexport declarations: + +```ignore +#[macro_reexport(some_macro, another_macro)] +extern crate macros_for_good; +``` "##, E0468: r##" A non-root module attempts to import macros from another crate. +Example of erroneous code: + ```ignore mod foo { #[macro_use(helpful_macro)] // error: must be at crate root to import @@ -195,8 +198,7 @@ fn main() { E0469: r##" A macro listed for import was not found. -Either the listed macro is not contained in the imported crate, or it is not -exported from the given crate. +Example of erroneous code: ```ignore /// // crate some_crate contains: @@ -214,6 +216,9 @@ exported from the given crate. extern crate some_crate; ``` +Either the listed macro is not contained in the imported crate, or it is not +exported from the given crate. + This could be caused by a typo. Did you misspell the macro's name? Double-check the names of the macros listed for import, and that the crate @@ -240,8 +245,7 @@ extern crate some_crate; E0470: r##" A macro listed for reexport was not found. -Either the listed macro is not contained in the imported crate, or it is not -exported from the given crate. +Example of erroneous code: ```ignore /// // crate some_crate contains: @@ -259,6 +263,9 @@ exported from the given crate. extern crate some_crate; ``` +Either the listed macro is not contained in the imported crate, or it is not +exported from the given crate. + This could be caused by a typo. Did you misspell the macro's name? Double-check the names of the macros listed for reexport, and that the crate From 5f9aa816f904c5adf9b06d89ece030986937a42d Mon Sep 17 00:00:00 2001 From: Jackson O'Donnell Date: Fri, 22 Jul 2016 15:34:25 -0500 Subject: [PATCH 06/12] re-fix trailing whitespace for make tidy --- src/librustc_metadata/diagnostics.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustc_metadata/diagnostics.rs b/src/librustc_metadata/diagnostics.rs index 59eae48be872d..9a2eba7193652 100644 --- a/src/librustc_metadata/diagnostics.rs +++ b/src/librustc_metadata/diagnostics.rs @@ -114,7 +114,7 @@ The proper syntax for macro imports is the following: // macro_rules! get_tacos { // ... // } -// +// // #[macro_export] // macro_rules! bring_beer { // ... From 9a4a81f68ed7944d594aab40df059207e1c247c7 Mon Sep 17 00:00:00 2001 From: Jackson O'Donnell Date: Fri, 22 Jul 2016 17:51:18 -0500 Subject: [PATCH 07/12] fixed failing doctests --- src/librustc_metadata/diagnostics.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/librustc_metadata/diagnostics.rs b/src/librustc_metadata/diagnostics.rs index 9a2eba7193652..91ae8a74311e8 100644 --- a/src/librustc_metadata/diagnostics.rs +++ b/src/librustc_metadata/diagnostics.rs @@ -14,14 +14,14 @@ register_long_diagnostics! { E0454: r##" A link name was given with an empty name. Erroneous code example: -``` +```ignore #[link(name = "")] extern {} // error: #[link(name = "")] given with empty name ``` The rust compiler cannot link to an external library if you don't give it its name. Example: -``` +```ignore #[link(name = "some_lib")] extern {} // ok! ``` "##, @@ -50,7 +50,7 @@ See more: https://doc.rust-lang.org/book/conditional-compilation.html E0458: r##" An unknown "kind" was specified for a link attribute. Erroneous code example: -``` +```ignore #[link(kind = "wonderful_unicorn")] extern {} // error: unknown kind: `wonderful_unicorn` ``` @@ -64,7 +64,7 @@ Please specify a valid "kind" value, from one of the following: E0459: r##" A link was used without a name parameter. Erroneous code example: -``` +```ignore #[link(kind = "dylib")] extern {} // error: #[link(...)] specified without `name = "foo"` ``` @@ -72,7 +72,7 @@ A link was used without a name parameter. Erroneous code example: Please add the name parameter to allow the rust compiler to find the library you want. Example: -``` +```ignore #[link(kind = "dylib", name = "some_lib")] extern {} // ok! ``` "##, @@ -80,7 +80,7 @@ you want. Example: E0463: r##" A plugin/crate was declared but cannot be found. Erroneous code example: -``` +```ignore #![feature(plugin)] #![plugin(cookie_monster)] // error: can't find crate for `cookie_monster` extern crate cake_is_a_lie; // error: can't find crate for `cake_is_a_lie` From 055a228356c1f77a5e6a5a8d4dcf4d1d57f708e5 Mon Sep 17 00:00:00 2001 From: Jackson O'Donnell Date: Sat, 23 Jul 2016 09:44:03 -0500 Subject: [PATCH 08/12] Added @GuillaumeGomez recommendations --- src/librustc_metadata/diagnostics.rs | 119 ++++++++++++++------------- 1 file changed, 63 insertions(+), 56 deletions(-) diff --git a/src/librustc_metadata/diagnostics.rs b/src/librustc_metadata/diagnostics.rs index 91ae8a74311e8..50332b02ce0ee 100644 --- a/src/librustc_metadata/diagnostics.rs +++ b/src/librustc_metadata/diagnostics.rs @@ -14,7 +14,7 @@ register_long_diagnostics! { E0454: r##" A link name was given with an empty name. Erroneous code example: -```ignore +```compile_fail,E0454 #[link(name = "")] extern {} // error: #[link(name = "")] given with empty name ``` @@ -50,7 +50,7 @@ See more: https://doc.rust-lang.org/book/conditional-compilation.html E0458: r##" An unknown "kind" was specified for a link attribute. Erroneous code example: -```ignore +```compile_fail,E0458 #[link(kind = "wonderful_unicorn")] extern {} // error: unknown kind: `wonderful_unicorn` ``` @@ -64,7 +64,7 @@ Please specify a valid "kind" value, from one of the following: E0459: r##" A link was used without a name parameter. Erroneous code example: -```ignore +```compile_fail,E0458 #[link(kind = "dylib")] extern {} // error: #[link(...)] specified without `name = "foo"` ``` @@ -92,15 +92,15 @@ well, and you link to them the same way. "##, E0466: r##" -Invalid macro import declarations. +Macro import declarations were malformed. Causes of this error: -```ignore -#[macro_use(a_macro(another_macro))] // error: invalid import declaration +```compile_fail +#[macro_use(a_macro(another_macro))] // error: invalid import declaration extern crate some_crate; -#[macro_use(i_want = "some_macros")] // error: invalid import declaration +#[macro_use(i_want = "some_macros")] // error: invalid import declaration extern crate another_crate; ``` @@ -109,16 +109,18 @@ This is a syntax error at the level of attribute declarations. The proper syntax for macro imports is the following: ```ignore -// // some_crate contains: -// #[macro_export] -// macro_rules! get_tacos { -// ... -// } -// -// #[macro_export] -// macro_rules! bring_beer { -// ... -// } +// in some_crate: +#[macro_export] +macro_rules! get_tacos { + ... +} + +#[macro_export] +macro_rules! bring_beer { + ... +} + +// in your crate: #[macro_use(get_tacos, bring_beer)] // imports macros get_tacos and extern crate some_crate; // bring_beer from some_crate ``` @@ -128,15 +130,15 @@ arguments. "##, E0467: r##" -Invalid or no macros listed for reexport. +Macro reexport declarations were empty or malformed. Causes of this error: -```ignore -#[macro_reexport] // error: no macros listed for export +```compile_fail,E0467 +#[macro_reexport] // error: no macros listed for export extern crate macros_for_good; ``` -```ignore +```compile_fail,E0467 #[macro_reexport(fun_macro = "foo")] // error: not a macro identifier extern crate macros_for_good; ``` @@ -162,7 +164,7 @@ A non-root module attempts to import macros from another crate. Example of erroneous code: -```ignore +```compile_fail,E0468 mod foo { #[macro_use(helpful_macro)] // error: must be at crate root to import extern crate some_crate; // macros from another crate @@ -184,6 +186,7 @@ This will work: ```ignore #[macro_use(helpful_macro)] extern crate some_crate; + mod foo { helpful_macro!(...) } @@ -201,15 +204,16 @@ A macro listed for import was not found. Example of erroneous code: ```ignore -/// // crate some_crate contains: -/// #[macro_export] -/// macro_rules! eat { -/// ... -/// } -/// macro_rules! drink { -/// ... -/// } +// in some_crate: +#[macro_export] +macro_rules! eat { + ... +} +macro_rules! drink { + ... +} +// In your crate: // error: drink is a private macro of some_crate // error: be_merry does not exist in some_crate #[macro_use(drink, be_merry)] @@ -227,16 +231,17 @@ in question exports them. A working version of the above: ```ignore -/// // crate some_crate contains: -/// #[macro_export] -/// macro_rules! eat { -/// ... -/// } -/// #[macro_export] -/// macro_rules! drink { -/// ... -/// } +// In some_crate: +#[macro_export] +macro_rules! eat { + ... +} +#[macro_export] +macro_rules! drink { + ... +} +// In your crate: #[macro_use(eat, drink)] extern crate some_crate; ``` @@ -248,15 +253,16 @@ A macro listed for reexport was not found. Example of erroneous code: ```ignore -/// // crate some_crate contains: -/// #[macro_export] -/// macro_rules! eat { -/// ... -/// } -/// macro_rules! drink { -/// ... -/// } +// In some_crate +#[macro_export] +macro_rules! eat { + ... +} +macro_rules! drink { + ... +} +// In your crate: // error: drink is a private macro of some_crate // error: be_merry does not exist in some_crate #[macro_reexport(drink, be_merry)] @@ -274,16 +280,17 @@ in question exports them. A working version of the above: ```ignore -/// // crate some_crate contains: -/// #[macro_export] -/// macro_rules! eat { -/// ... -/// } -/// #[macro_export] -/// macro_rules! drink { -/// ... -/// } +// In some_crate: +#[macro_export] +macro_rules! eat { + ... +} +#[macro_export] +macro_rules! drink { + ... +} +// In your_crate: #[macro_reexport(eat, drink)] extern crate some_crate; ``` From 3f6b5e6fcd1152ef76142e94fa50e3d82e53144b Mon Sep 17 00:00:00 2001 From: Jackson O'Donnell Date: Sat, 23 Jul 2016 10:53:10 -0500 Subject: [PATCH 09/12] change to "Erroneous code example" --- src/librustc_metadata/diagnostics.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/librustc_metadata/diagnostics.rs b/src/librustc_metadata/diagnostics.rs index 50332b02ce0ee..4c5c181d8baf5 100644 --- a/src/librustc_metadata/diagnostics.rs +++ b/src/librustc_metadata/diagnostics.rs @@ -94,7 +94,7 @@ well, and you link to them the same way. E0466: r##" Macro import declarations were malformed. -Causes of this error: +Erroneous code xamples: ```compile_fail #[macro_use(a_macro(another_macro))] // error: invalid import declaration @@ -132,7 +132,7 @@ arguments. E0467: r##" Macro reexport declarations were empty or malformed. -Causes of this error: +Erroneous code examples: ```compile_fail,E0467 #[macro_reexport] // error: no macros listed for export @@ -201,7 +201,7 @@ fn main() { E0469: r##" A macro listed for import was not found. -Example of erroneous code: +Erroneous code example: ```ignore // in some_crate: @@ -250,7 +250,7 @@ extern crate some_crate; E0470: r##" A macro listed for reexport was not found. -Example of erroneous code: +Erroneous code example: ```ignore // In some_crate From cdda2c358468cce231c868f01e009634b8813085 Mon Sep 17 00:00:00 2001 From: Jackson O'Donnell Date: Sun, 24 Jul 2016 17:03:10 -0500 Subject: [PATCH 10/12] Fixed failing Rust_Compiler_Error_Index_487 --- src/librustc_metadata/diagnostics.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/librustc_metadata/diagnostics.rs b/src/librustc_metadata/diagnostics.rs index 4c5c181d8baf5..833d726dcf0c5 100644 --- a/src/librustc_metadata/diagnostics.rs +++ b/src/librustc_metadata/diagnostics.rs @@ -64,7 +64,7 @@ Please specify a valid "kind" value, from one of the following: E0459: r##" A link was used without a name parameter. Erroneous code example: -```compile_fail,E0458 +```compile_fail,E0459 #[link(kind = "dylib")] extern {} // error: #[link(...)] specified without `name = "foo"` ``` @@ -153,7 +153,7 @@ Decide which macros you would like to export and list them properly. These are proper reexport declarations: -```ignore +```compile_fail,E0463 #[macro_reexport(some_macro, another_macro)] extern crate macros_for_good; ``` From 083b536a6bad5d62f0e32f0e0cab89388eaecf0f Mon Sep 17 00:00:00 2001 From: Jackson O'Donnell Date: Sun, 24 Jul 2016 17:08:51 -0500 Subject: [PATCH 11/12] Delete empty line --- src/librustc_metadata/diagnostics.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/librustc_metadata/diagnostics.rs b/src/librustc_metadata/diagnostics.rs index 833d726dcf0c5..788692c0a44a3 100644 --- a/src/librustc_metadata/diagnostics.rs +++ b/src/librustc_metadata/diagnostics.rs @@ -180,7 +180,6 @@ Only `extern crate` imports at the crate root level (i.e., in lib.rs) are allowed to import macros. Either move the macro import to crate root or do without the foreign macros. - This will work: ```ignore From fd9ebcf57bf24ea4cdc767b23794fe6f6839efaf Mon Sep 17 00:00:00 2001 From: Jackson O'Donnell Date: Sat, 30 Jul 2016 12:46:42 -0500 Subject: [PATCH 12/12] Fixed failing doctest for E0463 --- src/librustc_metadata/diagnostics.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustc_metadata/diagnostics.rs b/src/librustc_metadata/diagnostics.rs index 788692c0a44a3..fe50654ca38ad 100644 --- a/src/librustc_metadata/diagnostics.rs +++ b/src/librustc_metadata/diagnostics.rs @@ -153,7 +153,7 @@ Decide which macros you would like to export and list them properly. These are proper reexport declarations: -```compile_fail,E0463 +```compile_fail #[macro_reexport(some_macro, another_macro)] extern crate macros_for_good; ```