Rollup merge of #129969 - GrigorenkoPV:boxed-ty, r=compiler-errors

Make `Ty::boxed_ty` return an `Option`

Looks like a good place to use Rust's type system.

---

Most of 4ac7bcbaad/compiler/rustc_middle/src/ty/sty.rs (L971-L1963) looks like it could be moved to `TyKind` (then I guess  `Ty` should be made to deref to `TyKind`).
This commit is contained in:
Matthias Krüger 2024-09-06 07:33:58 +02:00 committed by GitHub
commit 0180b8fff0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 58 additions and 48 deletions

View file

@ -348,8 +348,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
}
}
if let Some(ty::error::ExpectedFound { found, .. }) = exp_found
&& ty.is_box()
&& ty.boxed_ty() == found
&& ty.boxed_ty() == Some(found)
&& let Ok(snippet) = self.tcx.sess.source_map().span_to_snippet(span)
{
err.span_suggestion(