Skip to content

Commit db579d3

Browse files
Document behaviour of writing Option<NonNull> pointer
Co-authored-by: Oli Scherer <[email protected]>
1 parent b08d57f commit db579d3

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

compiler/rustc_const_eval/src/interpret/intrinsics.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
183183

184184
if type_impls_trait {
185185
let vtable_ptr = self.get_vtable_ptr(tp_ty, preds)?;
186+
// Writing a non-null pointer into an `Option<NonNull>` will automatically make it `Some`.
186187
self.write_pointer(vtable_ptr, dest)?;
187188
} else {
188189
// Write `None`

0 commit comments

Comments
 (0)