about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/messages.ftl
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2024-12-09 19:34:43 +0000
committerEsteban Küber <esteban@kuber.com.ar>2024-12-10 00:38:05 +0000
commit4007fc9a0f2ca14c26a494cf7d5e02c79485b43b (patch)
tree5d036d155f00e73386da1dd45d8d72f547c9b6a3 /compiler/rustc_hir_analysis/messages.ftl
parentf6cb952dc115fd1311b02b694933e31d8dc8b002 (diff)
downloadrust-4007fc9a0f2ca14c26a494cf7d5e02c79485b43b.tar.gz
rust-4007fc9a0f2ca14c26a494cf7d5e02c79485b43b.zip
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.
Diffstat (limited to 'compiler/rustc_hir_analysis/messages.ftl')
-rw-r--r--compiler/rustc_hir_analysis/messages.ftl14
1 files changed, 8 insertions, 6 deletions
diff --git a/compiler/rustc_hir_analysis/messages.ftl b/compiler/rustc_hir_analysis/messages.ftl
index 070d63b48b7..32498d9c5ab 100644
--- a/compiler/rustc_hir_analysis/messages.ftl
+++ b/compiler/rustc_hir_analysis/messages.ftl
@@ -96,12 +96,14 @@ hir_analysis_coercion_between_struct_same_note = expected coercion between the s
 
 hir_analysis_coercion_between_struct_single_note = expected a single field to be coerced, none found
 
-hir_analysis_const_bound_for_non_const_trait =
-    `{$modifier}` can only be applied to `#[const_trait]` traits
-
-hir_analysis_const_impl_for_non_const_trait =
-    const `impl` for trait `{$trait_name}` which is not marked with `#[const_trait]`
-    .suggestion = mark `{$trait_name}` as const
+hir_analysis_const_bound_for_non_const_trait = `{$modifier}` can only be applied to `#[const_trait]` traits
+    .label = can't be applied to `{$trait_name}`
+    .note = `{$trait_name}` can't be used with `{$modifier}` because it isn't annotated with `#[const_trait]`
+    .suggestion = {$suggestion_pre}mark `{$trait_name}` as `#[const_trait]` to allow it to have `const` implementations
+
+hir_analysis_const_impl_for_non_const_trait = const `impl` for trait `{$trait_name}` which is not marked with `#[const_trait]`
+    .label = this trait is not `const`
+    .suggestion = {$suggestion_pre}mark `{$trait_name}` as `#[const_trait]` to allow it to have `const` implementations
     .note = marking a trait with `#[const_trait]` ensures all default method bodies are `const`
     .adding = adding a non-const method body in the future would be a breaking change