diff options
| author | bors <bors@rust-lang.org> | 2025-02-01 20:07:58 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-02-01 20:07:58 +0000 |
| commit | 8239a37f9c0951a037cfc51763ea52a20e71e6bd (patch) | |
| tree | 869cab603a15f4c6b1de22ec2ee905a12af7dc5b /compiler/rustc_const_eval/src/interpret | |
| parent | e08cd3cf05e5bfa3323cc21ea8f81f4a15a2f969 (diff) | |
| parent | 2a82ebdcb7512b818da18eb04d1d11f623d6e38c (diff) | |
| download | rust-8239a37f9c0951a037cfc51763ea52a20e71e6bd.tar.gz rust-8239a37f9c0951a037cfc51763ea52a20e71e6bd.zip | |
Auto merge of #136389 - matthiaskrgr:rollup-x453dy9, r=matthiaskrgr
Rollup of 6 pull requests Successful merges: - #130514 (Implement MIR lowering for unsafe binders) - #135684 (docs: Documented Send and Sync requirements for Mutex + MutexGuard) - #136307 (Implement all mix/max functions in a (hopefully) more optimization amendable way) - #136360 (Stabilize `once_wait`) - #136364 (document that ptr cmp is unsigned) - #136374 (Add link attribute for Enzyme's LLVMRust FFI) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_const_eval/src/interpret')
| -rw-r--r-- | compiler/rustc_const_eval/src/interpret/projection.rs | 1 | ||||
| -rw-r--r-- | compiler/rustc_const_eval/src/interpret/step.rs | 7 |
2 files changed, 8 insertions, 0 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/projection.rs b/compiler/rustc_const_eval/src/interpret/projection.rs index 996142d7b03..8ecb3e13d5c 100644 --- a/compiler/rustc_const_eval/src/interpret/projection.rs +++ b/compiler/rustc_const_eval/src/interpret/projection.rs @@ -381,6 +381,7 @@ where OpaqueCast(ty) => { span_bug!(self.cur_span(), "OpaqueCast({ty}) encountered after borrowck") } + UnwrapUnsafeBinder(target) => base.transmute(self.layout_of(target)?, self)?, // We don't want anything happening here, this is here as a dummy. Subtype(_) => base.transmute(base.layout(), self)?, Field(field, _) => self.project_field(base, field.index())?, diff --git a/compiler/rustc_const_eval/src/interpret/step.rs b/compiler/rustc_const_eval/src/interpret/step.rs index d9c0ff5acd1..abe73c43d8a 100644 --- a/compiler/rustc_const_eval/src/interpret/step.rs +++ b/compiler/rustc_const_eval/src/interpret/step.rs @@ -277,6 +277,13 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { let discr = self.discriminant_for_variant(op.layout.ty, variant)?; self.write_immediate(*discr, &dest)?; } + + WrapUnsafeBinder(ref op, _ty) => { + // Constructing an unsafe binder acts like a transmute + // since the operand's layout does not change. + let op = self.eval_operand(op, None)?; + self.copy_op_allow_transmute(&op, &dest)?; + } } trace!("{:?}", self.dump_place(&dest)); |
