Code view:

A painting is a person's account of this edit as text, recorded independently of the node mapping - a rendering often has several equally defensible answers where the mapping has one. Deletions and insertions carry no position on the opposite side in a painting, so that panel draws no caret for them.

Before

…lines 1–10 unchanged (10 lines)
11 for &my_bool in &[true, false] {
12 let mask = -(my_bool as TwoPtrs); // false -> 0, true -> -1 aka !0
13 // This is branchless code to select one or the other pointer.
14 // However, it drops provenance when transmuting to TwoPtrs, so this is UB.
15 let val = unsafe {
16 transmute::<_, &str>(
17 //~^ ERROR: constructing invalid value: encountered a dangling reference
18 !mask & transmute::<_, TwoPtrs>("false !")
19 | mask & transmute::<_, TwoPtrs>("true !"),
20 )
21 };
22 println!("{}", val);
23 }
24}
25

After

…lines 1–10 unchanged (10 lines)
11 for &my_bool in &[true, false] {
12 let mask = -(my_bool as TwoPtrs); // false -> 0, true -> -1 aka !0
13 // This is branchless code to select one or the other pointer.
14 // However, it drops provenance when transmuting to TwoPtrs, so this is UB.
15 let val = unsafe {
16 transmute::<_, &str>(
17 //~^ ERROR: encountered a dangling reference
18 !mask & transmute::<_, TwoPtrs>("false !")
19 | mask & transmute::<_, TwoPtrs>("true !"),
20 )
21 };
22 println!("{}", val);
23 }
24}
25

Before

source_file
inner_attribute_item
# "#"
! "!"
[ "["
attribute
identifier "allow"
token_tree
( "("
identifier "integer_to_ptr_transmutes"
) ")"
] "]"
use_declaration
use "use"
scoped_identifier
scoped_identifier
identifier "std"
:: "::"
identifier "mem"
:: "::"
identifier "transmute"
; ";"
attribute_item
# "#"
[ "["
attribute
identifier "cfg"
token_tree
( "("
identifier "target_pointer_width"
= "="
string_literal
" "\""
string_content "32"
" "\""
) ")"
] "]"
type_item
type "type"
type_identifier "TwoPtrs"
= "="
primitive_type "i64"
; ";"
attribute_item
# "#"
[ "["
attribute
identifier "cfg"
token_tree
( "("
identifier "target_pointer_width"
= "="
string_literal
" "\""
string_content "64"
" "\""
) ")"
] "]"
type_item
type "type"
type_identifier "TwoPtrs"
= "="
primitive_type "i128"
; ";"
function_item
fn "fn"
identifier "main"
parameters
( "("
) ")"
block
{ "{"
expression_statement
for_expression
for "for"
reference_pattern
& "&"
identifier "my_bool"
in "in"
reference_expression
& "&"
array_expression
[ "["
boolean_literal
true "true"
, ","
boolean_literal
false "false"
] "]"
block
{ "{"
let_declaration
let "let"
identifier "mask"
= "="
unary_expression
- "-"
parenthesized_expression
( "("
type_cast_expression
identifier "my_bool"
as "as"
type_identifier "TwoPtrs"
) ")"
; ";"
line_comment
// "//"
line_comment
// "//"
line_comment
// "//"
let_declaration
let "let"
identifier "val"
= "="
unsafe_block
unsafe "unsafe"
block
{ "{"
call_expression
generic_function
identifier "transmute"
:: "::"
type_arguments
< "<"
type_identifier "_"
, ","
reference_type
& "&"
primitive_type "str"
> ">"
arguments
( "("
line_comment
// "//"
binary_expression (+44 nodes collapsed)
, ","
) ")"
} "}"
; ";"
expression_statement
macro_invocation
identifier "println"
! "!"
token_tree
( "("
string_literal
" "\""
string_content "{}"
" "\""
, ","
identifier "val"
) ")"
; ";"
} "}"
} "}"

After

source_file
inner_attribute_item
# "#"
! "!"
[ "["
attribute
identifier "allow"
token_tree
( "("
identifier "integer_to_ptr_transmutes"
) ")"
] "]"
use_declaration
use "use"
scoped_identifier
scoped_identifier
identifier "std"
:: "::"
identifier "mem"
:: "::"
identifier "transmute"
; ";"
attribute_item
# "#"
[ "["
attribute
identifier "cfg"
token_tree
( "("
identifier "target_pointer_width"
= "="
string_literal
" "\""
string_content "32"
" "\""
) ")"
] "]"
type_item
type "type"
type_identifier "TwoPtrs"
= "="
primitive_type "i64"
; ";"
attribute_item
# "#"
[ "["
attribute
identifier "cfg"
token_tree
( "("
identifier "target_pointer_width"
= "="
string_literal
" "\""
string_content "64"
" "\""
) ")"
] "]"
type_item
type "type"
type_identifier "TwoPtrs"
= "="
primitive_type "i128"
; ";"
function_item
fn "fn"
identifier "main"
parameters
( "("
) ")"
block
{ "{"
expression_statement
for_expression
for "for"
reference_pattern
& "&"
identifier "my_bool"
in "in"
reference_expression
& "&"
array_expression
[ "["
boolean_literal
true "true"
, ","
boolean_literal
false "false"
] "]"
block
{ "{"
let_declaration
let "let"
identifier "mask"
= "="
unary_expression
- "-"
parenthesized_expression
( "("
type_cast_expression
identifier "my_bool"
as "as"
type_identifier "TwoPtrs"
) ")"
; ";"
line_comment
// "//"
line_comment
// "//"
line_comment
// "//"
let_declaration
let "let"
identifier "val"
= "="
unsafe_block
unsafe "unsafe"
block
{ "{"
call_expression
generic_function
identifier "transmute"
:: "::"
type_arguments
< "<"
type_identifier "_"
, ","
reference_type
& "&"
primitive_type "str"
> ">"
arguments
( "("
line_comment
// "//"
binary_expression (+44 nodes collapsed)
, ","
) ")"
} "}"
; ";"
expression_statement
macro_invocation
identifier "println"
! "!"
token_tree
( "("
string_literal
" "\""
string_content "{}"
" "\""
, ","
identifier "val"
) ")"
; ";"
} "}"
} "}"