Skip to content

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented May 6, 2016

fixes #33452

r? @eddyb

cc @Ms2ger

Copy link
Member

@eddyb eddyb May 6, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this help? Wouldn't it still error?
EDIT: I think... I see? Can't be done in const_eval but is still constant.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, and the const_err lint ignores some kinds of errors, since there's no point in informing the user that const_eval can't evaluate it unless they try to use it in an array length or pattern.

@eddyb
Copy link
Member

eddyb commented May 6, 2016

@bors r+

@bors
Copy link
Collaborator

bors commented May 6, 2016

📌 Commit d818a08 has been approved by eddyb

@bluss
Copy link
Contributor

bluss commented May 6, 2016

b"" is actually a &[u8; 0] (and so on with the correct length), not a slice (&[u8]).

@Ms2ger
Copy link
Contributor

Ms2ger commented May 7, 2016

And travis complains:

/home/travis/build/rust-lang/rust/src/librustc_const_eval/eval.rs:1121: line longer than 100 chars

@eddyb
Copy link
Member

eddyb commented May 7, 2016

@bors r- Until the tidy failure is fixed.

@oli-obk oli-obk force-pushed the const_err/cast_u8_ptr branch from d818a08 to 7461e45 Compare May 8, 2016 08:52
@oli-obk
Copy link
Contributor Author

oli-obk commented May 9, 2016

done

@eddyb
Copy link
Member

eddyb commented May 9, 2016

@bors r+

@bors
Copy link
Collaborator

bors commented May 9, 2016

📌 Commit 7461e45 has been approved by eddyb

@bors
Copy link
Collaborator

bors commented May 9, 2016

⌛ Testing commit 7461e45 with merge faca79f...

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

fixes #33452

r? @eddyb

cc @Ms2ger
@bors bors merged commit 7461e45 into rust-lang:master May 9, 2016
@oli-obk oli-obk deleted the const_err/cast_u8_ptr branch May 10, 2016 12:47
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 this pull request may close these issues.

const_err warns about casting bytestring to raw pointer
5 participants