Skip to content
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

Suggest using `as_ref` on `*const T` #61444

Merged
merged 1 commit into from Jun 4, 2019

Conversation

Projects
None yet
6 participants
@estebank
Copy link
Contributor

commented Jun 1, 2019

Fix #21596.

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

commented Jun 1, 2019

r? @matthewjasper

(rust_highfive has picked a reviewer for you, use r? to override)

@estebank estebank force-pushed the estebank:const-pt-as-ref branch from 640c993 to eb73b73 Jun 2, 2019

@matthewjasper

This comment has been minimized.

Copy link
Contributor

commented Jun 3, 2019

@bors r+

@bors

This comment has been minimized.

Copy link
Contributor

commented Jun 3, 2019

📌 Commit eb73b73 has been approved by matthewjasper

Centril added a commit to Centril/rust that referenced this pull request Jun 4, 2019

Rollup merge of rust-lang#61444 - estebank:const-pt-as-ref, r=matthew…
…jasper

Suggest using `as_ref` on `*const T`

Fix rust-lang#21596.

bors added a commit that referenced this pull request Jun 4, 2019

Auto merge of #61507 - Centril:rollup-hdm781j, r=Centril
Rollup of 13 pull requests

Successful merges:

 - #61373 (Emit StorageDead along unwind paths for generators)
 - #61404 (miri unsizing: fix projecting into a field of an operand)
 - #61409 (Fix an ICE with a const argument in a trait)
 - #61413 (Re-implement async fn drop order lowering )
 - #61419 (Add an unusual-conversion example to to_uppercase)
 - #61420 (Succinctify splice docs)
 - #61444 (Suggest using `as_ref` on `*const T`)
 - #61446 (On TerminatorKind::DropAndReplace still handle unused_mut correctly)
 - #61485 (azure: retry s3 upload if it fails)
 - #61489 (ci: Reenable step timings on AppVeyor)
 - #61496 (Do not panic in tidy on unbalanced parentheses in cfg's)
 - #61497 (Treat 0 as special value for codegen-units-std)
 - #61499 (Add regression test for existential type ICE #53457)

Failed merges:

r? @ghost

Centril added a commit to Centril/rust that referenced this pull request Jun 4, 2019

Rollup merge of rust-lang#61444 - estebank:const-pt-as-ref, r=matthew…
…jasper

Suggest using `as_ref` on `*const T`

Fix rust-lang#21596.

bors added a commit that referenced this pull request Jun 4, 2019

Auto merge of #61509 - Centril:rollup-s26bbh0, r=Centril
Rollup of 14 pull requests

Successful merges:

 - #61135 (Fix documentation of `Rc::make_mut` regarding `rc::Weak`.)
 - #61404 (miri unsizing: fix projecting into a field of an operand)
 - #61409 (Fix an ICE with a const argument in a trait)
 - #61413 (Re-implement async fn drop order lowering )
 - #61419 (Add an unusual-conversion example to to_uppercase)
 - #61420 (Succinctify splice docs)
 - #61444 (Suggest using `as_ref` on `*const T`)
 - #61446 (On TerminatorKind::DropAndReplace still handle unused_mut correctly)
 - #61485 (azure: retry s3 upload if it fails)
 - #61489 (ci: Reenable step timings on AppVeyor)
 - #61494 (Utilize cfg(bootstrap) over cfg(stage0))
 - #61496 (Do not panic in tidy on unbalanced parentheses in cfg's)
 - #61497 (Treat 0 as special value for codegen-units-std)
 - #61499 (Add regression test for existential type ICE #53457)

Failed merges:

r? @ghost

Centril added a commit to Centril/rust that referenced this pull request Jun 4, 2019

Rollup merge of rust-lang#61444 - estebank:const-pt-as-ref, r=matthew…
…jasper

Suggest using `as_ref` on `*const T`

Fix rust-lang#21596.

bors added a commit that referenced this pull request Jun 4, 2019

Auto merge of #61510 - Centril:rollup-bvi95y2, r=Centril
Rollup of 13 pull requests

Successful merges:

 - #61135 (Fix documentation of `Rc::make_mut` regarding `rc::Weak`.)
 - #61404 (miri unsizing: fix projecting into a field of an operand)
 - #61409 (Fix an ICE with a const argument in a trait)
 - #61413 (Re-implement async fn drop order lowering )
 - #61419 (Add an unusual-conversion example to to_uppercase)
 - #61420 (Succinctify splice docs)
 - #61444 (Suggest using `as_ref` on `*const T`)
 - #61446 (On TerminatorKind::DropAndReplace still handle unused_mut correctly)
 - #61485 (azure: retry s3 upload if it fails)
 - #61489 (ci: Reenable step timings on AppVeyor)
 - #61496 (Do not panic in tidy on unbalanced parentheses in cfg's)
 - #61497 (Treat 0 as special value for codegen-units-std)
 - #61499 (Add regression test for existential type ICE #53457)

Failed merges:

r? @ghost

@bors bors merged commit eb73b73 into rust-lang:master Jun 4, 2019

1 check passed

Travis CI - Pull Request Build Passed
Details
@RalfJung

This comment has been minimized.

Copy link
Member

commented Jun 12, 2019

Might be a good place to mention that this is UB if the pointer is dangling, unaligned or does not point to initialized memory -- even if the result reference is never used?

@estebank

This comment has been minimized.

Copy link
Contributor Author

commented Jun 12, 2019

@RalfJung sounds reasonable. Can you file a follow up ticket?

@RalfJung

This comment has been minimized.

Copy link
Member

commented Jun 12, 2019

I was thinking maybe adding that to the as_ref docs makes more sense? Or both?

I have adding it to the docs on my list.

@estebank

This comment has been minimized.

Copy link
Contributor Author

commented Jun 12, 2019

I think minimizing the requirement of having the docs open is a good thing. Basically anything I would tell someone when pair programming should be in the diagnostic itself, and this would count. I feel the diagnostics are part of the documentation, and the clarification should certainly be in the proper docs as well.

@RalfJung

This comment has been minimized.

Copy link
Member

commented Jun 12, 2019

Issue opened at #61786.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.