Add Ptr::to_option method - #6604
Conversation
There was a problem hiding this comment.
I'm concerned about this line. Will this be problematic?
There was a problem hiding this comment.
Yes, to_option isn't a safe function. Raw pointers can point to invalid locations so the unsafe block is incorrectly assuming the operation is safe.
There was a problem hiding this comment.
Dang, yeah that makes sense. I dunno if this is a lost cause then. :(
|
Converting unsafe pointers to Option-something seems useful but this implementation has a couple things that concern me. It looks like it is returning a copy of It should be unsafe because it dereferences an arbitrary pointer. |
|
@brson Fixed to use an |
`match_wildcard` improvements fixes: rust-lang#6604 fixes: rust-lang#5733 fixes: rust-lang#6862 rust-lang#5733 is only fixed in the normal case, if different paths are used for the variants then the same problem will occur. It's cause by `def_path_str` returning an utterly useless result. I haven't dug into why yet. For rust-lang#6604 there should be some discussion before accepting this. It's easy enough to change the message rather than disable the lint for `Option` and `Result`. changelog: Attempt to find a common path prefix for `match_wildcard_for_single_variants` and `wildcard_enum_match_arm` changelog: Don't lint op `Option` and `Result` for `match_wildcard_for_single_variants` and `wildcard_enum_match_arm` changelog: Consider `or` patterns and `Self` prefix for `match_wildcard_for_single_variants` and `wildcard_enum_match_arm`
8774: feat: Honor `.cargo/config.toml` r=matklad a=Veykril  Implements `cargo/.config` build target and cfg access by using unstable cargo options: - `cargo config get` to read the target triple out of the config to pass to `cargo metadata` --filter-platform - `cargo rustc --print` to read out the `rustc_cfgs`, this causes us to honor `rustflags` and the like. If those commands fail, due to not having a nightly toolchain present for example, they will fall back to invoking rustc directly as we currently do. I personally think it should be fine to use these unstable options as they are unlikely to change(even if they did it shouldn't be a problem due to the fallback) and don't burden the user if they do not have a nightly toolchain at hand since we fall back to the previous behaviour. cc rust-lang#8741 Closes rust-lang#6604, Closes rust-lang#5904, Closes rust-lang#8430, Closes rust-lang#8480 Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
No description provided.