about summary refs log tree commit diff
path: root/compiler/rustc_middle
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2024-11-28 22:20:44 +0000
committerEsteban Küber <esteban@kuber.com.ar>2024-12-07 21:37:15 +0000
commitcb4db0a6c6ef642c13f7f08d449acde0336a2c8c (patch)
tree8af15f172471bfb64b3fa1a1a4d6a7d6e1b20e93 /compiler/rustc_middle
parentd860e5b088a0030c55b8850d10ab231d86fc2969 (diff)
Account for `impl Trait` in "add bound" suggestion message
Diffstat (limited to 'compiler/rustc_middle')
-rw-r--r--compiler/rustc_middle/src/ty/diagnostics.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/ty/diagnostics.rs b/compiler/rustc_middle/src/ty/diagnostics.rs
index a7548184760..49ed69d4e48 100644
--- a/compiler/rustc_middle/src/ty/diagnostics.rs
+++ b/compiler/rustc_middle/src/ty/diagnostics.rs
@@ -531,6 +531,12 @@ pub fn suggest_constraining_type_params<'a>(
             SuggestChangingConstraintsMessage::RestrictBoundFurther => {
                 format!("consider further restricting this bound with {post}")
             }
+            SuggestChangingConstraintsMessage::RestrictTypeFurther { ty }
+            | SuggestChangingConstraintsMessage::RestrictType { ty }
+                if ty.starts_with("impl ") =>
+            {
+                format!("consider restricting opaque type `{ty}` with {post}")
+            }
             SuggestChangingConstraintsMessage::RestrictType { ty } => {
                 format!("consider restricting type parameter `{ty}` with {post}")
             }