Skip to content

Conversation

@fw-immunant
Copy link
Collaborator

println! adds references (&) to its arguments, to avoid moving them.

This is undesirable here, because it is extremely error-prone to take references to static muts. We could println!("{}", {counter}), but this is somewhat exotic syntax and just sticking with dbg! also avoids this problem as it does not add references.

`println!` adds references (&) to its arguments, to avoid moving them.

This is undesirable here, because it is extremely error-prone to take
references to `static mut`s. We could `println!("{}", {counter})`, but
this is somewhat exotic syntax and just sticking with `dbg!` also
avoids this problem as it does not add references.
@fw-immunant fw-immunant merged commit 03df73e into main May 6, 2025
70 of 71 checks passed
@fw-immunant fw-immunant deleted the fw/mut-static-reference branch May 6, 2025 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants