Skip to content

Commit e2cad12

Browse files
ivarflakstadoli-obk
authored andcommitted
Document behaviour of writing Option<NonNull> pointer
Co-authored-by: Oli Scherer <github35764891676564198441@oli-obk.de>
1 parent b5b1647 commit e2cad12

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
@@ -254,6 +254,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
254254

255255
if type_impls_trait {
256256
let vtable_ptr = self.get_vtable_ptr(tp_ty, preds)?;
257+
// Writing a non-null pointer into an `Option<NonNull>` will automatically make it `Some`.
257258
self.write_pointer(vtable_ptr, dest)?;
258259
} else {
259260
// Write `None`

0 commit comments

Comments
 (0)