From 551baa8444eb73d9323609ae547bdf7d717417a0 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sun, 18 Sep 2016 17:12:07 +0800 Subject: Notes - Extra box notes and updated todo --- Notes/BoxOperator.md | 26 ++++++++++++++++++++++++++ Notes/todo.txt | 5 +---- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/Notes/BoxOperator.md b/Notes/BoxOperator.md index 5c1cac3e..f18537da 100644 --- a/Notes/BoxOperator.md +++ b/Notes/BoxOperator.md @@ -48,4 +48,30 @@ IDEAS: - Keep until MIR, and lower into call sequence - Can use temporaries - Downside: Avoids the extra validation other operators get. + - Still the best solution. + + + + +```rust +let p = PLACE; +let mut place = Placer::make_place(p); +let raw_place = Place::pointer(&mut place); +let value = EXPR; +unsafe { + std::ptr::write(raw_place, value); + InPlace::finalize(place) +} +``` + +```rust +let mut place = BoxPlace::make_place(); +let raw_place = Place::pointer(&mut place); +let value = EXPR; +unsafe { + ::std::ptr::write(raw_place, value); + Boxed::finalize(place) +} +``` + diff --git a/Notes/todo.txt b/Notes/todo.txt index 161c34eb..301f71a5 100644 --- a/Notes/todo.txt +++ b/Notes/todo.txt @@ -1,9 +1,6 @@ TODO: -- Replace `box` desugaring with passthrough to HIR which will replace with operator call after typeck - - See https://github.com/rust-lang/rfcs/pull/1426#r48383364 - - May require a design/notes doc covering the inferrence behavior. +- Fix method selection to be aware of multiple possible methods with the same name - Audit TODOs in codebase -- Method and type monomorphisation - Test compile against a no_std program - MIR Optimisations - HIR Optimisation (remove dead code in `if true/if false` branches) -- cgit v1.2.3