1
Fork 0

better errors when a Copy impl is not coherent

This commit is contained in:
Michael Goulet 2022-02-21 21:26:37 -08:00
parent a4a5e79814
commit c8cbd3d03c
5 changed files with 100 additions and 4 deletions

View file

@ -11,7 +11,7 @@ use crate::traits::error_reporting::InferCtxtExt;
#[derive(Clone)]
pub enum CopyImplementationError<'tcx> {
InfrigingFields(Vec<&'tcx ty::FieldDef>),
InfrigingFields(Vec<(&'tcx ty::FieldDef, Ty<'tcx>)>),
NotAnAdt,
HasDestructor,
}
@ -67,7 +67,7 @@ pub fn can_type_implement_copy<'tcx>(
match traits::fully_normalize(&infcx, ctx, cause, param_env, ty) {
Ok(ty) => {
if !infcx.type_is_copy_modulo_regions(param_env, ty, span) {
infringing.push(field);
infringing.push((field, ty));
}
}
Err(errors) => {