Skip to content

fix typo in autorefs lint doc example #140719

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

Merged
merged 1 commit into from
May 7, 2025
Merged

fix typo in autorefs lint doc example #140719

merged 1 commit into from
May 7, 2025

Conversation

wyfo
Copy link
Contributor

@wyfo wyfo commented May 6, 2025

The documentation is talking about other way using only raw pointers, but the example was use std::slice::from_raw_parts_mut which also create a reference. std::ptr::slice_from_raw_parts_mut should be used instead, and it also highlights the benefit of raw pointer manipulation compared to dereference, as the function doesn't need to be unsafe anymore.

Moreover, unsafe_op_in_unsafe_fn warning has been enabled since Edition 2024, so I've updated the examples to use unsafe blocks.

The documentation is talking about other way using only raw pointers, but the example was use `std::slice::from_raw_parts_mut` which also create a reference. `std::ptr::slice_from_raw_parts_mut` should be used instead, and it also highlights the benefit of raw pointer manipulation compared to dereference, as the function doesn't need to be unsafe anymore.

Moreover, [`unsafe_op_in_unsafe_fn`](https://doc.rust-lang.org/edition-guide/rust-2024/unsafe-op-in-unsafe-fn.html) warning has been enabled since Edition 2024, so I've updated the examples to use unsafe blocks.
@rustbot
Copy link
Collaborator

rustbot commented May 6, 2025

r? @lcnr

rustbot has assigned @lcnr.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 6, 2025
@lcnr
Copy link
Contributor

lcnr commented May 7, 2025

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented May 7, 2025

📌 Commit 49ac393 has been approved by lcnr

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 7, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request May 7, 2025
…llaumeGomez

Rollup of 4 pull requests

Successful merges:

 - rust-lang#139518 (Stabilize precise capture syntax in style guide)
 - rust-lang#140398 (Fix backtrace for cygwin)
 - rust-lang#140719 (fix typo in autorefs lint doc example)
 - rust-lang#140724 (Update `compiler-builtins` to 0.1.158)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 763209e into rust-lang:master May 7, 2025
6 checks passed
@rustbot rustbot added this to the 1.88.0 milestone May 7, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request May 7, 2025
Rollup merge of rust-lang#140719 - wyfo:patch-1, r=lcnr

fix typo in autorefs lint doc example

The documentation is talking about other way using only raw pointers, but the example was use `std::slice::from_raw_parts_mut` which also create a reference. `std::ptr::slice_from_raw_parts_mut` should be used instead, and it also highlights the benefit of raw pointer manipulation compared to dereference, as the function doesn't need to be unsafe anymore.

Moreover, [`unsafe_op_in_unsafe_fn`](https://doc.rust-lang.org/edition-guide/rust-2024/unsafe-op-in-unsafe-fn.html) warning has been enabled since Edition 2024, so I've updated the examples to use unsafe blocks.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
4 participants