summaryrefslogtreecommitdiff
path: root/Notes
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-10-15 11:17:16 +0800
committerJohn Hodge <tpg@mutabah.net>2016-10-15 11:17:16 +0800
commitbe952e5ea5f60edf6d39ebb6f6ec692799c60850 (patch)
treeff547ef32d7e7e6ba2a41b379eb7f26c933092dc /Notes
parent7c74d6a7c03af83de0c41260c81460cfe447f8cf (diff)
downloadmrust-be952e5ea5f60edf6d39ebb6f6ec692799c60850.tar.gz
Notes - Various quirks
Diffstat (limited to 'Notes')
-rw-r--r--Notes/Quirks.md37
1 files changed, 37 insertions, 0 deletions
diff --git a/Notes/Quirks.md b/Notes/Quirks.md
new file mode 100644
index 00000000..258d095e
--- /dev/null
+++ b/Notes/Quirks.md
@@ -0,0 +1,37 @@
+
+Methods can be called on some "statement-like" expressions
+====
+
+https://github.com/rust-lang/rust/blob/master/src/libstd/sys/common/poison.rs#L172
+```
+fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ match *self {
+ TryLockError::Poisoned(..) => "poisoned lock: another task failed inside",
+ TryLockError::WouldBlock => "try_lock failed because the operation would block"
+ }.fmt(f)
+}
+```
+
+Method call on a statement-like match
+
+
+The `ident` fragment matches reserved words
+===
+
+Typically used for replacing `self` in macros.
+
+
+
+Any integer can cast to a pointer
+===================
+This includes `u8`
+
+
+Modules with the same name as primtiive types have interesting lookup quirks
+===================
+- If a path like `u32::some_name` is seen, if the module `u32` exists in the current scope and `some_name` is an item in that module
+ - Treat the path as `self::u32::some_name`
+ - Otherwise, treat it as `<u32 as ?>::some_name`
+
+
+