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

const_err warns about casting bytestring to raw pointer #33452

Closed
Ms2ger opened this issue May 6, 2016 · 3 comments · Fixed by #33457
Closed

const_err warns about casting bytestring to raw pointer #33452

Ms2ger opened this issue May 6, 2016 · 3 comments · Fixed by #33457

Comments

@Ms2ger
Copy link
Contributor

Ms2ger commented May 6, 2016

In particular, b"TouchList\0" as *const u8. We can't use as_ptr() because it's in a const context.

@oli-obk
Copy link
Contributor

oli-obk commented May 6, 2016

whoops, on it

bors added a commit that referenced this issue May 9, 2016
casting `&[u8]` to `* const u8` doesn't work in const_eval

fixes #33452

r? @eddyb

cc @Ms2ger
@nox
Copy link
Contributor

nox commented May 10, 2016

error: internal compiler error: ../src/librustc_mir/transform/promote_consts.rs:204: tmp4 not promotable: Unpromotable
   --> /Users/nox/src/servo/components/script/dom/bindings/interface.rs:122:23
122 |>                 name: b"Function\0" as *const _ as *const libc::c_char,
    |>                       ^^^^^^^^^^^^^
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

Please reopen.

@oli-obk
Copy link
Contributor

oli-obk commented May 10, 2016

hmm... that's a different issue. @eddyb this looks like your new constant code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants