Uh oh!
There was an error while loading. Please reload this page.
Suggest direct raw-pointer dereference - #53574
Merged
Merged
Conversation
People often come looking for some kind of `as_ref_unchecked` method on raw pointers that would give them `&T` and not `Option<&T>` when they are sure the pointer is not NULL. There's no such method, but taking a reference of the dereferenced pointer accomplishes the same thing. Therefore, suggest using that, at the `as_ref` site ‒ it's a place people are likely going to look into.
rust-highfive
commented
Aug 21, 2018
Contributor
(rust_highfive has picked a reviewer for you, use r? to override) |
Mark-Simulacrum
commented
Aug 21, 2018
Member
@bors r+ rollup |
bors
commented
Aug 21, 2018
Collaborator
📌 Commit 18f41e5 has been approved by |
GuillaumeGomez added a commit
to GuillaumeGomez/rust
that referenced
this pull request
Aug 22, 2018
…-Simulacrum Suggest direct raw-pointer dereference People often come looking for some kind of `as_ref_unchecked` method on raw pointers that would give them `&T` and not `Option<&T>` when they are sure the pointer is not NULL. There's no such method, but taking a reference of the dereferenced pointer accomplishes the same thing. Therefore, suggest using that, at the `as_ref` site ‒ it's a place people are likely going to look into.
bors added a commit
that referenced
this pull request
Aug 22, 2018
Rollup of 10 pull requests Successful merges: - #53418 (Mark some suggestions as MachineApplicable) - #53431 (Moved some feature gate ui tests to correct location) - #53442 (Update version of rls-data used with save-analysis) - #53504 (Set applicability for more suggestions.) - #53541 (Fix missing impl trait display as ret type) - #53544 (Point at the trait argument when using unboxed closure) - #53558 (Normalize source line and column numbers.) - #53562 (Lament the invincibility of the Turbofish) - #53574 (Suggest direct raw-pointer dereference) - #53585 (Remove super old comment on function that parses items) Failed merges: - #53472 (Use FxHash{Map,Set} instead of the default Hash{Map,Set} everywhere in rustc.) - #53563 (use String::new() instead of String::from(""), "".to_string(), "".to_owned() or "".into()) r? @ghost
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
People often come looking for some kind of
as_ref_uncheckedmethod onraw pointers that would give them
&Tand notOption<&T>when theyare sure the pointer is not NULL.
There's no such method, but taking a reference of the dereferenced
pointer accomplishes the same thing. Therefore, suggest using that, at
the
as_refsite ‒ it's a place people are likely going to look into.