We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3e52a0a commit 1d3abf1Copy full SHA for 1d3abf1
doc/tutorial.md
@@ -1859,6 +1859,13 @@ match my_rec {
1859
}
1860
~~~~
1861
1862
+It's unsafe to dereference `b` in the second `log` expression, because `b` is
1863
+a _pointer_ to the inside of `my_rec`, and the assignment statement has
1864
+allocated a new record and assigned `my_rec` to point to it. Thus, the old
1865
+contents of `my_rec` are no longer live, and `b` is dangling at this point.
1866
+The borrow-checking analysis inside the compiler recognizes this situation
1867
+and rejects the program.
1868
+
1869
## Argument passing styles
1870
1871
The fact that arguments are conceptually passed by safe reference does
0 commit comments