summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-09-16 22:30:33 +0800
committerJohn Hodge <tpg@mutabah.net>2016-09-16 22:30:33 +0800
commite503135eb7aa91bd28256b7f91b62ee265b47fdf (patch)
tree201596a64d3bfbab85052a996146eb0af9332422
parent3bf66ae06912107e60b697358f9a17672a2db263 (diff)
downloadmrust-e503135eb7aa91bd28256b7f91b62ee265b47fdf.tar.gz
Notes - `box` operator quirks
-rw-r--r--Notes/BoxOperator.md36
-rw-r--r--Notes/todo.txt7
2 files changed, 39 insertions, 4 deletions
diff --git a/Notes/BoxOperator.md b/Notes/BoxOperator.md
new file mode 100644
index 00000000..33e30268
--- /dev/null
+++ b/Notes/BoxOperator.md
@@ -0,0 +1,36 @@
+% `box` and `in` operators
+
+See: https://github.com/rust-lang/rfcs/pull/1426#r48383364
+
+Structures
+=========
+
+AST
+---
+
+UniOp for `box` and BinOp for `in` and `<-`
+
+
+HIR
+---
+
+```c++
+struct ExprNode_Emplace
+{
+ enum class Type {
+ Placer,
+ Boxer,
+ };
+
+ Type m_type;
+ ExprNodeP m_place;
+ ExprNodeP m_value;
+}
+```
+
+
+Type Inferrence
+===============
+
+The `_Emplace` node type has a revisit to obtain the expected result type.
+
diff --git a/Notes/todo.txt b/Notes/todo.txt
index b1518ef4..161c34eb 100644
--- a/Notes/todo.txt
+++ b/Notes/todo.txt
@@ -1,8 +1,7 @@
TODO:
-- Fix method selection such that calling `let _: Foo = bar.into();` works
- - A `From<Bar>` impl for `Foo` isn't found, becuase the code that searches for the `Into` impl doesn't know that the param is `Foo`
- - Could have an edge case where a trait is selected if it's the only possibility (there's no other source of that method name)
- - Correct solution would be to hand parameters to the `find_method` function.
+- 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.
- Audit TODOs in codebase
- Method and type monomorphisation
- Test compile against a no_std program