diff options
| author | Ding Xiang Fei <dingxiangfei2009@protonmail.ch> | 2025-01-29 06:48:28 +0800 |
|---|---|---|
| committer | Ding Xiang Fei <dingxiangfei2009@protonmail.ch> | 2025-02-09 20:40:43 +0800 |
| commit | b9435056a7e152e1d455b404061240b964a39584 (patch) | |
| tree | 30ec9211977f60915dca62454c6132fa8c3ee177 /compiler/rustc_hir_analysis/src/coherence/builtin.rs | |
| parent | c0673246371b1a5ecac940f1ea6418857f932d7c (diff) | |
| download | rust-b9435056a7e152e1d455b404061240b964a39584.tar.gz rust-b9435056a7e152e1d455b404061240b964a39584.zip | |
move repr(transparent) checks to coherence
Diffstat (limited to 'compiler/rustc_hir_analysis/src/coherence/builtin.rs')
| -rw-r--r-- | compiler/rustc_hir_analysis/src/coherence/builtin.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/rustc_hir_analysis/src/coherence/builtin.rs b/compiler/rustc_hir_analysis/src/coherence/builtin.rs index c21576a5e7c..c5aee60117b 100644 --- a/compiler/rustc_hir_analysis/src/coherence/builtin.rs +++ b/compiler/rustc_hir_analysis/src/coherence/builtin.rs @@ -810,5 +810,8 @@ fn visit_implementation_of_coerce_pointee_validity( if !def.repr().transparent() { return Err(tcx.dcx().emit_err(errors::CoercePointeeNotTransparent { span })); } + if def.all_fields().next().is_none() { + return Err(tcx.dcx().emit_err(errors::CoercePointeeNoField { span })); + } Ok(()) } |
