summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-09-17 10:25:12 +0800
committerJohn Hodge <tpg@mutabah.net>2016-09-17 10:25:12 +0800
commitb049dd7d36b991bb95f273d862f95f0865c929c2 (patch)
treee481756d43adc2ab15e3d17d3dce05452e8d4193
parentf4c730973e17471b95cc385787647a7cec7d95a8 (diff)
downloadmrust-b049dd7d36b991bb95f273d862f95f0865c929c2.tar.gz
Notes - Expand on the box operator requirements
-rw-r--r--Notes/BoxOperator.md17
1 files changed, 16 insertions, 1 deletions
diff --git a/Notes/BoxOperator.md b/Notes/BoxOperator.md
index 33e30268..5c1cac3e 100644
--- a/Notes/BoxOperator.md
+++ b/Notes/BoxOperator.md
@@ -17,6 +17,7 @@ HIR
```c++
struct ExprNode_Emplace
{
+ /// This influences the ops trait used
enum class Type {
Placer,
Boxer,
@@ -28,9 +29,23 @@ struct ExprNode_Emplace
}
```
-
Type Inferrence
===============
The `_Emplace` node type has a revisit to obtain the expected result type.
+1. If the place has an unknown type, the pre-coercion output type is located by taking the result type and replacing all params with fresh ivars
+1. A bound is added that this new type must implement `ops::Placer<T>` (or `ops::Boxer<T>`) where `T` is the result type of `m_value`
+1. Add a coercion at this node? (Or leave it up to the parent node to have inserted one)
+
+
+Expansion / Lowering
+====================
+
+IDEAS:
+- Convert as any other operator is - in the post-typeck expansion pass
+ - However, since this doesn't expand to a single function call (the current RFC is four calls) that would be interesting
+ - Also, the current RFC introduces bindings, which can't (easily) be done in that pass
+- Keep until MIR, and lower into call sequence
+ - Can use temporaries
+ - Downside: Avoids the extra validation other operators get.