about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid Wood <david.wood2@arm.com>2025-02-27 21:20:20 +0000
committerDavid Wood <david.wood2@arm.com>2025-06-16 23:04:34 +0000
commit7ab1321f976f0b0452f6d8339ecb954d666d9f8a (patch)
treef3db10f31ef71940d6209bd37503509d74aa0487
parentc162328d3070f4d7a018cf901e80ed8052f2e4a8 (diff)
downloadrust-7ab1321f976f0b0452f6d8339ecb954d666d9f8a.tar.gz
rust-7ab1321f976f0b0452f6d8339ecb954d666d9f8a.zip
trait_sel: stash `{Meta,Pointee}Sized` errors
`Sized` errors are currently stashed to improve diagnostics and this
must happen with `{Meta,Pointee}Sized` too to maintain diagnostic
output.
-rw-r--r--compiler/rustc_trait_selection/src/error_reporting/traits/ambiguity.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/rustc_trait_selection/src/error_reporting/traits/ambiguity.rs b/compiler/rustc_trait_selection/src/error_reporting/traits/ambiguity.rs
index 275b580d794..39f115ce0cd 100644
--- a/compiler/rustc_trait_selection/src/error_reporting/traits/ambiguity.rs
+++ b/compiler/rustc_trait_selection/src/error_reporting/traits/ambiguity.rs
@@ -199,7 +199,10 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
                 // avoid inundating the user with unnecessary errors, but we now
                 // check upstream for type errors and don't add the obligations to
                 // begin with in those cases.
-                if self.tcx.is_lang_item(trait_pred.def_id(), LangItem::Sized) {
+                if matches!(
+                    self.tcx.as_lang_item(trait_pred.def_id()),
+                    Some(LangItem::Sized | LangItem::MetaSized)
+                ) {
                     match self.tainted_by_errors() {
                         None => {
                             let err = self.emit_inference_failure_err(