diff options
author | John Hodge <tpg@mutabah.net> | 2016-09-18 17:12:07 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-09-18 17:12:07 +0800 |
commit | 551baa8444eb73d9323609ae547bdf7d717417a0 (patch) | |
tree | b38e9a52c95afffaaf6b52ed67bfadfba937bb38 | |
parent | a3fb9f77f7397cb906f526c2bf401c2dd8a7b0ce (diff) | |
download | mrust-551baa8444eb73d9323609ae547bdf7d717417a0.tar.gz |
Notes - Extra box notes and updated todo
-rw-r--r-- | Notes/BoxOperator.md | 26 | ||||
-rw-r--r-- | 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) |