blob: 998c5d25088e6e3ebd4507b764963dfaf05402b4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
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 ?some 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`
UFCS "inherent" paths can resolve to trait items
================================================
_Unconfirmed_
`<Foo>::SOMECONST` can either refer to `impl Foo { const SOMECONST... } or `impl Trait for Foo { const SOMECONST ... }`
Blocks that don't yield a value can mark as diverged if ?any statement diverges
=============
- This includes any function call (or method call)
- TODO: Is this just the last statement? or all statements
The "base" value of a struct literal isn't always moved
======================================================
- Only the values used are moved, which can lead to the source not being moved (if all used values are Copy)
|