Description
Location
https://doc.rust-lang.org/stable/std/hint/fn.black_box.html
Summary
The documentation of black_box
states:
Programs cannot rely on black_box for correctness in any way.
but this is not accurate since programs can rely on it behaving like the identity function.
It would be better to reword this as
Programs cannot rely on black_box for correctness beyond it behaving as the identity function.
or similar, e.g.,
Programs cannot rely on the optimisation-inhibiting effects of black_box for correctness.
Activity
jyn514 commentedon Feb 15, 2023
@gonzalobg are you interested in making a PR to fix this? :)
gonzalobg commentedon Feb 15, 2023
Can't, sorry.
callumio commentedon Feb 15, 2023
@rustbot claim
black_box
#108088Rollup merge of rust-lang#108088 - callumio:issue-107957, r=dtolnay
gonzalobg commentedon Feb 16, 2023
It seems that there are some other parts of the docs that are still incorrect. For example, in the How to use it section, the incorrect claim continues to be repeated:
I think the whole document needs a pass to fix this.
pat-nel87 commentedon Feb 23, 2023
@rustbot claim
8 remaining items