diff options
| author | Zalathar <Zalathar@users.noreply.github.com> | 2024-12-25 14:57:21 +1100 |
|---|---|---|
| committer | Zalathar <Zalathar@users.noreply.github.com> | 2024-12-25 16:17:09 +1100 |
| commit | 399620939844d7b2e4a93e450f8c578960d0b6f2 (patch) | |
| tree | b83ad750522f061f1dae7093fdb8c0860f0bded8 /compiler/rustc_passes/src/errors.rs | |
| parent | 9124662da3e0d573703c9bb07d5e3cf8d06f1b20 (diff) | |
| download | rust-399620939844d7b2e4a93e450f8c578960d0b6f2.tar.gz rust-399620939844d7b2e4a93e450f8c578960d0b6f2.zip | |
Overhaul error messages for disallowed coverage attributes
Diffstat (limited to 'compiler/rustc_passes/src/errors.rs')
| -rw-r--r-- | compiler/rustc_passes/src/errors.rs | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/compiler/rustc_passes/src/errors.rs b/compiler/rustc_passes/src/errors.rs index 163325f2a3c..d95fa5db0ce 100644 --- a/compiler/rustc_passes/src/errors.rs +++ b/compiler/rustc_passes/src/errors.rs @@ -71,13 +71,21 @@ pub(crate) struct InlineNotFnOrClosure { pub defn_span: Span, } +/// "coverage attribute not allowed here" #[derive(Diagnostic)] -#[diag(passes_coverage_not_fn_or_closure, code = E0788)] -pub(crate) struct CoverageNotFnOrClosure { +#[diag(passes_coverage_attribute_not_allowed, code = E0788)] +pub(crate) struct CoverageAttributeNotAllowed { #[primary_span] pub attr_span: Span, - #[label] - pub defn_span: Span, + /// "not a function, impl block, or module" + #[label(passes_not_fn_impl_mod)] + pub not_fn_impl_mod: Option<Span>, + /// "function has no body" + #[label(passes_no_body)] + pub no_body: Option<Span>, + /// "coverage attribute can be applied to a function (with body), impl block, or module" + #[help] + pub help: (), } #[derive(Diagnostic)] |
