mirror of
https://github.com/Noratrieb/blog.git
synced 2026-01-14 20:35:02 +01:00
deploy: 7bc3d1cfbb
This commit is contained in:
parent
bd20f8a3bc
commit
e6effff870
5 changed files with 11 additions and 11 deletions
|
|
@ -111,8 +111,8 @@ that is implemented in Miri. For an excellent introduction, see this part of the
|
|||
and only the pointers that have their tag in the stack are allowed to access it. Tags can be pushed and popped from the stack through various operations, for example borrowing.</p>
|
||||
<p>In the code example above, we get a nice little hint where the tag was created. When we created a reference (that was then
|
||||
coerced into a raw pointer) from our box, it got a new tag called <code>&lt;3314&gt;</code>. Then, when we moved the box into the function,
|
||||
something happened: The tag was invalidated and popped off the borrow stack. That&rsquo;s because box invalidates all tags when it&rsquo;s
|
||||
moved. The tag was popped off the borrow stack and we tried to read from it anyways - undefined behaviour happened!</p>
|
||||
something happened: The tag was popped off the borrow stack and therefore invalidated. That&rsquo;s because box invalidates all tags
|
||||
when it&rsquo;s moved. The tag was popped off the borrow stack and we tried to read with it anyways - undefined behaviour happened!</p>
|
||||
<p>And that&rsquo;s how our code wasn&rsquo;t a miscompilation, but undefined behaviour. Quite surprising, isn&rsquo;t it?</p>
|
||||
<h1 id="noalias-nothanks">noalias, nothanks</h1>
|
||||
<p>Many people, myself included, don&rsquo;t think that this is a good thing.</p>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue