diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2025-08-11 04:21:09 +0000 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2025-08-11 16:00:49 +0000 |
| commit | 625143bac3e2917adb59314a408b17e8d2f9bd65 (patch) | |
| tree | 68137828ca43d9ec1fb7a596ad93fe8e72febf5e /compiler/rustc_parse/src | |
| parent | 189f264926ff70b58c8907473de60766477e7dd6 (diff) | |
| download | rust-625143bac3e2917adb59314a408b17e8d2f9bd65.tar.gz rust-625143bac3e2917adb59314a408b17e8d2f9bd65.zip | |
Add link to docs on malformed attributes
Diffstat (limited to 'compiler/rustc_parse/src')
| -rw-r--r-- | compiler/rustc_parse/src/validate_attr.rs | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/compiler/rustc_parse/src/validate_attr.rs b/compiler/rustc_parse/src/validate_attr.rs index 3df9f426ed0..68ef6d6f32c 100644 --- a/compiler/rustc_parse/src/validate_attr.rs +++ b/compiler/rustc_parse/src/validate_attr.rs @@ -313,24 +313,27 @@ fn emit_malformed_attribute( ILL_FORMED_ATTRIBUTE_INPUT, span, ast::CRATE_NODE_ID, - BuiltinLintDiag::IllFormedAttributeInput { suggestions: suggestions.clone() }, + BuiltinLintDiag::IllFormedAttributeInput { + suggestions: suggestions.clone(), + docs: template.docs, + }, ); } else { suggestions.sort(); - psess - .dcx() - .struct_span_err(span, error_msg) - .with_span_suggestions( - span, - if suggestions.len() == 1 { - "must be of the form" - } else { - "the following are the possible correct uses" - }, - suggestions, - Applicability::HasPlaceholders, - ) - .emit(); + let mut err = psess.dcx().struct_span_err(span, error_msg).with_span_suggestions( + span, + if suggestions.len() == 1 { + "must be of the form" + } else { + "the following are the possible correct uses" + }, + suggestions, + Applicability::HasPlaceholders, + ); + if let Some(link) = template.docs { + err.note(format!("for more information, visit <{link}>")); + } + err.emit(); } } |
