1
Fork 0

Fix accuracy of T: Clone check in suggestion

This commit is contained in:
Esteban Küber 2024-03-13 15:37:27 +00:00
parent 259348cf7e
commit 5a7caa3174
17 changed files with 51 additions and 72 deletions

View file

@ -988,6 +988,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
}
pub(crate) fn suggest_cloning(&self, err: &mut Diag<'_>, ty: Ty<'tcx>, expr: &hir::Expr<'_>) {
let ty = ty.peel_refs();
if let Some(clone_trait_def) = self.infcx.tcx.lang_items().clone_trait()
&& self
.infcx