Uh oh!
There was an error while loading. Please reload this page.
Forbid casting to/from a pointer of unknown kind - #45735
Conversation
rust-highfive
commented
Nov 3, 2017
r? @pnkfelix (rust_highfive has picked a reviewer for you, use r? to override) |
There was a problem hiding this comment.
Does this case occur only by lack of type information? I'm not pretty sure.
arielb1
commented
Nov 5, 2017
It's not a good idea to assume things when encountering a use std::fmt;fnmain(){let x:*const_ = 0as*const_;// we don't want to allow this if...let y:Option<*const fmt::Debug> = Some(x)as_;// ^ later, we have x = *const fmt::Debug}fnnot_ok(){let x = 0as*consti32as*const_as*mut_;//~ ERROR ?}Instead, you should make |
tirr-c
commented
Nov 6, 2017
Added a new error code for casting with unknown pointer kind. r? @arielb1 |
There was a problem hiding this comment.
This forbids casting an *const _ to an *const u32, please move the check after the following if to avoid breaking user code.
tirr-c
commented
Nov 6, 2017
Updated, but I couldn't trigger the |
Can't you have |
arielb1
commented
Nov 6, 2017
@bors r+ |
bors
commented
Nov 6, 2017
📌 Commit 99ada04 has been approved by |
tirr-c
commented
Nov 6, 2017
It just compiles. I'm not sure when inference occurs, but maybe |
bors
commented
Nov 8, 2017
Forbid casting to/from a pointer of unknown kind Fixes#45730. Before, it ICE'd when `pointer_kind` encountered `TyInfer`.
bors
commented
Nov 8, 2017
☀️ Test successful - status-appveyor, status-travis |
Fixes#45730.
Before, it ICE'd when
pointer_kindencounteredTyInfer.