diff options
| author | Luca Versari <veluca93@gmail.com> | 2024-09-16 11:56:22 +0200 |
|---|---|---|
| committer | Luca Versari <veluca93@gmail.com> | 2024-11-16 01:07:51 +0100 |
| commit | b462c68aee956602408373975d3ca898e464030b (patch) | |
| tree | fcb0b903238a67ca25d22c8bf7212b99629dc5a2 /compiler/rustc_ast_lowering/src/errors.rs | |
| parent | ce40196577ecc0b72f6de7e2c8e43fdc728fb69a (diff) | |
| download | rust-b462c68aee956602408373975d3ca898e464030b.tar.gz rust-b462c68aee956602408373975d3ca898e464030b.zip | |
Fix ICE when passing DefId-creating args to legacy_const_generics.
Diffstat (limited to 'compiler/rustc_ast_lowering/src/errors.rs')
| -rw-r--r-- | compiler/rustc_ast_lowering/src/errors.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/compiler/rustc_ast_lowering/src/errors.rs b/compiler/rustc_ast_lowering/src/errors.rs index 6b39c2d3955..e6a3f939f2d 100644 --- a/compiler/rustc_ast_lowering/src/errors.rs +++ b/compiler/rustc_ast_lowering/src/errors.rs @@ -451,3 +451,26 @@ pub(crate) struct YieldInClosure { #[suggestion(code = "#[coroutine] ", applicability = "maybe-incorrect", style = "verbose")] pub suggestion: Option<Span>, } + +#[derive(Diagnostic)] +#[diag(ast_lowering_invalid_legacy_const_generic_arg)] +pub(crate) struct InvalidLegacyConstGenericArg { + #[primary_span] + pub span: Span, + #[subdiagnostic] + pub suggestion: UseConstGenericArg, +} + +#[derive(Subdiagnostic)] +#[multipart_suggestion( + ast_lowering_invalid_legacy_const_generic_arg_suggestion, + applicability = "maybe-incorrect" +)] +pub(crate) struct UseConstGenericArg { + #[suggestion_part(code = "::<{const_args}>")] + pub end_of_fn: Span, + pub const_args: String, + pub other_args: String, + #[suggestion_part(code = "{other_args}")] + pub call_args: Span, +} |
