-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unsafe keyword: trait examples and unsafe_op_in_unsafe_fn update #102475
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
fn
in anunsafe trait
vs anunsafe fn
in a safetrait
are 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 trait
example since it was rather strange.Also the
unsafe_op_in_unsafe_fn
lint can help disentangle the two sides ofunsafe
, so update the docs to account for that.