diff options
| author | Michael Goulet <michael@errs.io> | 2023-03-07 23:37:52 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2023-03-08 00:12:33 +0000 |
| commit | 8a99ffc3442329d2fb2f07ce87852c3e12cc4d6a (patch) | |
| tree | 852617af92a29f7c413e708136b98c87714f20db /compiler/rustc_trait_selection/src | |
| parent | 1a521db67e2935e5a46c7b95b511ab9a43be5770 (diff) | |
Suppress copy impl error when post-normalized type references errors
Diffstat (limited to 'compiler/rustc_trait_selection/src')
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/misc.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/misc.rs b/compiler/rustc_trait_selection/src/traits/misc.rs index b94346b0956..336db4fee6c 100644 --- a/compiler/rustc_trait_selection/src/traits/misc.rs +++ b/compiler/rustc_trait_selection/src/traits/misc.rs @@ -87,7 +87,12 @@ pub fn type_allowed_to_implement_copy<'tcx>( }; let ty = ocx.normalize(&normalization_cause, param_env, unnormalized_ty); let normalization_errors = ocx.select_where_possible(); - if !normalization_errors.is_empty() { + + // NOTE: The post-normalization type may also reference errors, + // such as when we project to a missing type or we have a mismatch + // between expected and found const-generic types. Don't report an + // additional copy error here, since it's not typically useful. + if !normalization_errors.is_empty() || ty.references_error() { tcx.sess.delay_span_bug(field_span, format!("couldn't normalize struct field `{unnormalized_ty}` when checking Copy implementation")); continue; } |
