diff options
| author | Michael Goulet <michael@errs.io> | 2024-05-24 15:17:34 -0400 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2024-05-24 21:53:39 -0400 |
| commit | 045f448e26257c7b19bf6d68c8e5e9d09ab4df79 (patch) | |
| tree | 9daae047b2d3724ae539d76d3a6cd05eb4949c00 /compiler/rustc_monomorphize | |
| parent | 36153f1a4e3162f0a143c7b3e468ecb3beb0008e (diff) | |
| download | rust-045f448e26257c7b19bf6d68c8e5e9d09ab4df79.tar.gz rust-045f448e26257c7b19bf6d68c8e5e9d09ab4df79.zip | |
Don't eagerly monomorphize drop for types that are impossible to instantiate
Diffstat (limited to 'compiler/rustc_monomorphize')
| -rw-r--r-- | compiler/rustc_monomorphize/src/collector.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/compiler/rustc_monomorphize/src/collector.rs b/compiler/rustc_monomorphize/src/collector.rs index 76972ff2263..9487692662b 100644 --- a/compiler/rustc_monomorphize/src/collector.rs +++ b/compiler/rustc_monomorphize/src/collector.rs @@ -1434,6 +1434,15 @@ impl<'v> RootCollector<'_, 'v> { { debug!("RootCollector: ADT drop-glue for `{id:?}`",); + // This type is impossible to instantiate, so we should not try to + // generate a `drop_in_place` instance for it. + if self.tcx.instantiate_and_check_impossible_predicates(( + id.owner_id.to_def_id(), + ty::List::empty(), + )) { + return; + } + let ty = self.tcx.type_of(id.owner_id.to_def_id()).no_bound_vars().unwrap(); visit_drop_use(self.tcx, ty, true, DUMMY_SP, self.output); } |
