Properly compare types for Option::as_deref
suggestion
This commit is contained in:
parent
e4106065bf
commit
896ccb9606
6 changed files with 54 additions and 38 deletions
|
@ -3593,7 +3593,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
|||
&& let Some(deref_target_did) = tcx.lang_items().deref_target()
|
||||
&& let projection = tcx.mk_projection(deref_target_did, tcx.mk_substs(&[ty::GenericArg::from(found_ty)]))
|
||||
&& let Ok(deref_target) = tcx.try_normalize_erasing_regions(param_env, projection)
|
||||
&& deref_target == target_ty
|
||||
&& infcx.can_eq(param_env, deref_target, target_ty)
|
||||
{
|
||||
let help = if let hir::Mutability::Mut = needs_mut
|
||||
&& let Some(deref_mut_did) = tcx.lang_items().deref_mut_trait()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue