unsafe keyword: trait examples and unsafe_op_in_unsafe_fn update#102475
unsafe keyword: trait examples and unsafe_op_in_unsafe_fn update#102475bors merged 2 commits intorust-lang:masterfrom
Conversation
|
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
|
(rust-highfive has picked a reviewer for you, use r? to override) |
|
I love the three different examples with the Indexable trait, thanks! |
|
The reference PR rust-lang/reference#1278 that points to these new examples has landed. Would be good to also get this in so that there's no dangling references in the reference. :) |
|
@rust-lang/libs-api @ehuss this is a keyword docs change, not sure whom to hand these to? |
|
T-libs if it's documenting already well-established behavior or practice / not introducing some kind of new commitment. |
Ah okay, yes that would be it. |
|
@bors r+ |
Rollup of 6 pull requests Successful merges: - rust-lang#102300 (Use a macro to not have to copy-paste `ConstFnMutClosure::new(&mut fold, NeverShortCircuit::wrap_mut_2_imp)).0` everywhere) - rust-lang#102475 (unsafe keyword: trait examples and unsafe_op_in_unsafe_fn update) - rust-lang#102760 (Avoid repeated re-initialization of the BufReader buffer) - rust-lang#102764 (Check `WhereClauseReferencesSelf` after all other object safety checks) - rust-lang#102779 (Fix `type_of` ICE) - rust-lang#102780 (run Miri CI when std::sys changes) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Having a safe
fnin anunsafe traitvs anunsafe fnin a safetraitare pretty different situations, but the distinction is subtle and can confuse even seasoned Rust developers. So let's have explicit examples of both. I also removed the existingunsafe traitexample since it was rather strange.Also the
unsafe_op_in_unsafe_fnlint can help disentangle the two sides ofunsafe, so update the docs to account for that.