File tree Expand file tree Collapse file tree 7 files changed +26
-29
lines changed
compiler/rustc_attr_parsing Expand file tree Collapse file tree 7 files changed +26
-29
lines changed Original file line number Diff line number Diff line change @@ -50,11 +50,6 @@ attr_parsing_expects_feature_list =
5050attr_parsing_expects_features =
5151 `{ $name } ` expects feature names
5252
53- attr_parsing_ill_formed_attribute_input = { $num_suggestions ->
54- [ 1 ] attribute must be of the form { $suggestions }
55- *[ other ] valid forms for the attribute are { $suggestions }
56- }
57-
5853attr_parsing_import_name_type_raw =
5954 import name type can only be used with link kind `raw-dylib`
6055
Original file line number Diff line number Diff line change 1- use rustc_errors:: DiagArgValue ;
2-
31use super :: prelude:: * ;
4- use crate :: session_diagnostics:: IllFormedAttributeInputLint ;
52
63pub ( crate ) struct MustUseParser ;
74
@@ -45,14 +42,7 @@ impl<S: Stage> SingleAttributeParser<S> for MustUseParser {
4542 Some ( value_str)
4643 }
4744 ArgParser :: List ( _) => {
48- let suggestions = cx. suggestions ( ) ;
49- cx. emit_err ( IllFormedAttributeInputLint {
50- num_suggestions : suggestions. len ( ) ,
51- suggestions : DiagArgValue :: StrListSepByAnd (
52- suggestions. into_iter ( ) . map ( |s| format ! ( "`{s}`" ) . into ( ) ) . collect ( ) ,
53- ) ,
54- span : cx. attr_span ,
55- } ) ;
45+ cx. expected_name_value ( cx. attr_span , None ) ;
5646 return None ;
5747 }
5848 } ,
Original file line number Diff line number Diff line change @@ -380,15 +380,6 @@ pub(crate) struct UnusedMultiple {
380380 pub name : Symbol ,
381381}
382382
383- #[ derive( Diagnostic ) ]
384- #[ diag( attr_parsing_ill_formed_attribute_input) ]
385- pub ( crate ) struct IllFormedAttributeInputLint {
386- #[ primary_span]
387- pub span : Span ,
388- pub num_suggestions : usize ,
389- pub suggestions : DiagArgValue ,
390- }
391-
392383#[ derive( Diagnostic ) ]
393384#[ diag( attr_parsing_null_on_export, code = E0648 ) ]
394385pub ( crate ) struct NullOnExport {
Original file line number Diff line number Diff line change 5959#[ cold = 1 ]
6060//~^ ERROR malformed
6161#[ must_use( ) ]
62- //~^ ERROR valid forms for the attribute are
62+ //~^ ERROR malformed
6363#[ no_mangle = 1 ]
6464//~^ ERROR malformed
6565#[ unsafe( naked( ) ) ]
Original file line number Diff line number Diff line change @@ -314,11 +314,21 @@ LL | #[cold = 1]
314314 | | didn't expect any arguments here
315315 | help: must be of the form: `#[cold]`
316316
317- error: valid forms for the attribute are `#[ must_use = "reason"]` and `#[must_use]`
317+ error[E0539]: malformed ` must_use` attribute input
318318 --> $DIR/malformed-attrs.rs:61:1
319319 |
320320LL | #[must_use()]
321321 | ^^^^^^^^^^^^^
322+ |
323+ = note: for more information, visit <https://doc.rust-lang.org/reference/attributes/diagnostics.html#the-must_use-attribute>
324+ help: try changing it to one of the following valid forms of the attribute
325+ |
326+ LL - #[must_use()]
327+ LL + #[must_use = "reason"]
328+ |
329+ LL - #[must_use()]
330+ LL + #[must_use]
331+ |
322332
323333error[E0565]: malformed `no_mangle` attribute input
324334 --> $DIR/malformed-attrs.rs:63:1
Original file line number Diff line number Diff line change 1- #[ must_use( ) ] //~ ERROR valid forms for the attribute are `#[must_use = "reason"]` and `#[must_use]`
1+ #[ must_use( ) ] //~ ERROR malformed
22struct Test ;
33
44fn main ( ) { }
Original file line number Diff line number Diff line change 1- error: valid forms for the attribute are `#[ must_use = "reason"]` and `#[must_use]`
1+ error[E0539]: malformed ` must_use` attribute input
22 --> $DIR/malformed-must_use.rs:1:1
33 |
44LL | #[must_use()]
55 | ^^^^^^^^^^^^^
6+ |
7+ = note: for more information, visit <https://doc.rust-lang.org/reference/attributes/diagnostics.html#the-must_use-attribute>
8+ help: try changing it to one of the following valid forms of the attribute
9+ |
10+ LL - #[must_use()]
11+ LL + #[must_use = "reason"]
12+ |
13+ LL - #[must_use()]
14+ LL + #[must_use]
15+ |
616
717error: aborting due to 1 previous error
818
19+ For more information about this error, try `rustc --explain E0539`.
You can’t perform that action at this time.
0 commit comments