Rollup merge of #103575 - Xiretza:suggestions-style-attr, r=davidtwco

Change #[suggestion_*] attributes to use style="..."

As discussed [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/336883-i18n/topic/.23100717.20tool_only_span_suggestion), this changes `#[(multipart_)suggestion_{short,verbose,hidden}(...)]` attributes to plain `#[(multipart_)suggestion(...)]` attributes with a `style = "{short,verbose,hidden}"` parameter.

It also adds a new style, `tool-only`, that corresponds to `tool_only_span_suggestion`/`tool_only_multipart_suggestion` and causes the suggestion to not be shown in human-readable output at all.

Best reviewed commit-by-commit, there's a bit of noise in there.

cc #100717 `@compiler-errors`
r? `@davidtwco`
This commit is contained in:
Manish Goregaokar 2022-11-01 20:00:38 -04:00 committed by GitHub
commit 69e705564d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 405 additions and 135 deletions

View file

@ -109,8 +109,9 @@ pub struct InferenceBadError<'a> {
#[derive(Subdiagnostic)]
pub enum SourceKindSubdiag<'a> {
#[suggestion_verbose(
#[suggestion(
infer_source_kind_subdiag_let,
style = "verbose",
code = ": {type_name}",
applicability = "has-placeholders"
)]
@ -135,8 +136,9 @@ pub enum SourceKindSubdiag<'a> {
parent_prefix: String,
parent_name: String,
},
#[suggestion_verbose(
#[suggestion(
infer_source_kind_subdiag_generic_suggestion,
style = "verbose",
code = "::<{args}>",
applicability = "has-placeholders"
)]
@ -150,8 +152,9 @@ pub enum SourceKindSubdiag<'a> {
#[derive(Subdiagnostic)]
pub enum SourceKindMultiSuggestion<'a> {
#[multipart_suggestion_verbose(
#[multipart_suggestion(
infer_source_kind_fully_qualified,
style = "verbose",
applicability = "has-placeholders"
)]
FullyQualified {
@ -163,8 +166,9 @@ pub enum SourceKindMultiSuggestion<'a> {
adjustment: &'a str,
successor_pos: &'a str,
},
#[multipart_suggestion_verbose(
#[multipart_suggestion(
infer_source_kind_closure_return,
style = "verbose",
applicability = "has-placeholders"
)]
ClosureReturn {
@ -478,8 +482,9 @@ pub enum ImplicitStaticLifetimeSubdiag {
#[primary_span]
span: Span,
},
#[suggestion_verbose(
#[suggestion(
infer_implicit_static_lifetime_suggestion,
style = "verbose",
code = " + '_",
applicability = "maybe-incorrect"
)]