Tweak wording of non-const traits used as const bounds
Use verbose suggestions and add additional labels/notes. Add more test cases for stable/nightly and feature enabled/disabled.
This commit is contained in:
parent
f6cb952dc1
commit
4007fc9a0f
49 changed files with 1121 additions and 194 deletions
|
@ -530,10 +530,16 @@ pub(crate) struct GenericArgsOnOverriddenImpl {
|
|||
#[diag(hir_analysis_const_impl_for_non_const_trait)]
|
||||
pub(crate) struct ConstImplForNonConstTrait {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
pub trait_ref_span: Span,
|
||||
pub trait_name: String,
|
||||
#[suggestion(applicability = "machine-applicable", code = "#[const_trait]")]
|
||||
#[suggestion(
|
||||
applicability = "machine-applicable",
|
||||
code = "#[const_trait] ",
|
||||
style = "verbose"
|
||||
)]
|
||||
pub local_trait_span: Option<Span>,
|
||||
pub suggestion_pre: &'static str,
|
||||
#[note]
|
||||
pub marking: (),
|
||||
#[note(hir_analysis_adding)]
|
||||
|
@ -544,8 +550,19 @@ pub(crate) struct ConstImplForNonConstTrait {
|
|||
#[diag(hir_analysis_const_bound_for_non_const_trait)]
|
||||
pub(crate) struct ConstBoundForNonConstTrait {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
pub span: Span,
|
||||
pub modifier: &'static str,
|
||||
#[note]
|
||||
pub def_span: Option<Span>,
|
||||
pub suggestion_pre: &'static str,
|
||||
#[suggestion(
|
||||
applicability = "machine-applicable",
|
||||
code = "#[const_trait] ",
|
||||
style = "verbose"
|
||||
)]
|
||||
pub suggestion: Option<Span>,
|
||||
pub trait_name: String,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue