From f7df1f38dd2a52709cd83aeb6d6714215fe046bc Mon Sep 17 00:00:00 2001 From: Havvy Date: Mon, 11 Jun 2018 01:52:12 -0700 Subject: [PATCH 1/4] Long diagnostic for E0541 --- src/libsyntax/diagnostic_list.rs | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/src/libsyntax/diagnostic_list.rs b/src/libsyntax/diagnostic_list.rs index 5f940437ab3fb..35e2b7017918b 100644 --- a/src/libsyntax/diagnostic_list.rs +++ b/src/libsyntax/diagnostic_list.rs @@ -93,6 +93,35 @@ For more information about the cfg attribute, read: https://doc.rust-lang.org/reference.html#conditional-compilation "##, +E0541: r##" +An unknown meta item was used. + +Erroneous code example: + +```compile_fail,E0541 +#[deprecated( + since="1.0.0", + reason="Example invalid meta item. Should be 'note'") // error: unknown meta item +] +fn deprecated_function() {} + +Meta items are the key/value pairs inside of an attribute. The keys provided must be one of the +valid keys for the specified attribute. + +To fix the problem, either remove the unknown meta item, or rename it it you provided the wrong +name. + +In the erroneous code example above, the wrong name was provided, so changing it to the right name +fixes the error. + +``` +#[deprecated( + since="1.0.0", + note="This is a valid meta item for the deprecated attribute." +)] +fn deprecated_function() {} +"##, + E0552: r##" A unrecognized representation attribute was used. @@ -318,7 +347,6 @@ register_diagnostics! { E0538, // multiple [same] items E0539, // incorrect meta item E0540, // multiple rustc_deprecated attributes - E0541, // unknown meta item E0542, // missing 'since' E0543, // missing 'reason' E0544, // multiple stability levels From 2d7b046d710ef92d69f25aeae0d6a508b97122ef Mon Sep 17 00:00:00 2001 From: Havvy Date: Mon, 11 Jun 2018 02:44:55 -0700 Subject: [PATCH 2/4] Fix typos in previous commit --- src/libsyntax/diagnostic_list.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libsyntax/diagnostic_list.rs b/src/libsyntax/diagnostic_list.rs index 35e2b7017918b..34a6e470ccdf7 100644 --- a/src/libsyntax/diagnostic_list.rs +++ b/src/libsyntax/diagnostic_list.rs @@ -104,11 +104,12 @@ Erroneous code example: reason="Example invalid meta item. Should be 'note'") // error: unknown meta item ] fn deprecated_function() {} +``` Meta items are the key/value pairs inside of an attribute. The keys provided must be one of the valid keys for the specified attribute. -To fix the problem, either remove the unknown meta item, or rename it it you provided the wrong +To fix the problem, either remove the unknown meta item, or rename it if you provided the wrong name. In the erroneous code example above, the wrong name was provided, so changing it to the right name @@ -120,6 +121,7 @@ fixes the error. note="This is a valid meta item for the deprecated attribute." )] fn deprecated_function() {} +``` "##, E0552: r##" From 0c91bd200e2ef544263023ce7d3b4ad211338808 Mon Sep 17 00:00:00 2001 From: Havvy Date: Mon, 11 Jun 2018 03:04:08 -0700 Subject: [PATCH 3/4] Make tidy happy --- src/libsyntax/diagnostic_list.rs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/libsyntax/diagnostic_list.rs b/src/libsyntax/diagnostic_list.rs index 34a6e470ccdf7..31b2f4fc427db 100644 --- a/src/libsyntax/diagnostic_list.rs +++ b/src/libsyntax/diagnostic_list.rs @@ -101,19 +101,20 @@ Erroneous code example: ```compile_fail,E0541 #[deprecated( since="1.0.0", - reason="Example invalid meta item. Should be 'note'") // error: unknown meta item + // error: unknown meta item + reason="Example invalid meta item. Should be 'note'") ] fn deprecated_function() {} ``` -Meta items are the key/value pairs inside of an attribute. The keys provided must be one of the -valid keys for the specified attribute. +Meta items are the key/value pairs inside of an attribute. The keys provided +must be one of the valid keys for the specified attribute. -To fix the problem, either remove the unknown meta item, or rename it if you provided the wrong -name. +To fix the problem, either remove the unknown meta item, or rename it if you +provided the wrong name. -In the erroneous code example above, the wrong name was provided, so changing it to the right name -fixes the error. +In the erroneous code example above, the wrong name was provided, so changing it +to the right name fixes the error. ``` #[deprecated( From cf3fcab9732f080222b21bce8399c97e97f2e3e9 Mon Sep 17 00:00:00 2001 From: Havvy Date: Mon, 11 Jun 2018 03:51:04 -0700 Subject: [PATCH 4/4] More E0541 long diagnostic wording tweaks --- src/libsyntax/diagnostic_list.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libsyntax/diagnostic_list.rs b/src/libsyntax/diagnostic_list.rs index 31b2f4fc427db..9775a6475ccd6 100644 --- a/src/libsyntax/diagnostic_list.rs +++ b/src/libsyntax/diagnostic_list.rs @@ -107,14 +107,14 @@ Erroneous code example: fn deprecated_function() {} ``` -Meta items are the key/value pairs inside of an attribute. The keys provided +Meta items are the key-value pairs inside of an attribute. The keys provided must be one of the valid keys for the specified attribute. To fix the problem, either remove the unknown meta item, or rename it if you provided the wrong name. -In the erroneous code example above, the wrong name was provided, so changing it -to the right name fixes the error. +In the erroneous code example above, the wrong name was provided, so changing +to a correct one it will fix the error. Example: ``` #[deprecated(