diff options
| author | Ralf Jung <post@ralfj.de> | 2024-05-04 20:04:01 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2024-05-04 20:04:01 +0200 |
| commit | f0dee6bbe5f093ce4fc40c33ad13b0b1350df7f5 (patch) | |
| tree | 8bce188a960c8f4b957065dc99e0b15631ee652e /compiler/rustc_const_eval/src/interpret/terminator.rs | |
| parent | 86a933a5743afe4117fdde5bdf04ba1baa634715 (diff) | |
| download | rust-f0dee6bbe5f093ce4fc40c33ad13b0b1350df7f5.tar.gz rust-f0dee6bbe5f093ce4fc40c33ad13b0b1350df7f5.zip | |
some comments or dynamic drop handling
Diffstat (limited to 'compiler/rustc_const_eval/src/interpret/terminator.rs')
| -rw-r--r-- | compiler/rustc_const_eval/src/interpret/terminator.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/terminator.rs b/compiler/rustc_const_eval/src/interpret/terminator.rs index cc9c7cbc0b0..b474003087b 100644 --- a/compiler/rustc_const_eval/src/interpret/terminator.rs +++ b/compiler/rustc_const_eval/src/interpret/terminator.rs @@ -949,6 +949,12 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { // implementation fail -- a problem shared by rustc. let place = self.force_allocation(place)?; + // We behave a bit different from codegen here. + // Codegen creates an `InstanceDef::Virtual` with index 0 (the slot of the drop method) and + // then dispatches that to the normal call machinery. However, our call machinery currently + // only supports calling `VtblEntry::Method`; it would choke on a `MetadataDropInPlace`. So + // instead we do the virtual call stuff ourselves. It's easier here than in `eval_fn_call` + // since we can just get a place of the underlying type and use `mplace_to_ref`. let place = match place.layout.ty.kind() { ty::Dynamic(data, _, ty::Dyn) => { // Dropping a trait object. Need to find actual drop fn. |
