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

don't warn on casting byte strs to slices #34394

Merged
merged 1 commit into from
Jun 22, 2016

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Jun 21, 2016

r? @durka

@@ -1116,6 +1116,7 @@ fn cast_const<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, val: ConstVal, ty: ty::Ty)
ty::TyRawPtr(_) => {
Err(ErrKind::UnimplementedConstVal("casting a bytestr to a raw ptr"))
},
ty::TyRef(..) => Err(ErrKind::UnimplementedConstVal("casting a bytestr to slice")),
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this message replace the uninformative "cannot cast this type" when you do const INVALID: &'static [u8] = b"x" as &[u8];?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

jup

@durka
Copy link
Contributor

durka commented Jun 21, 2016

LGTM but I am not a reviewer

@durka
Copy link
Contributor

durka commented Jun 21, 2016

r? @eddyb

@eddyb
Copy link
Member

eddyb commented Jun 21, 2016

@bors r+

@bors
Copy link
Contributor

bors commented Jun 21, 2016

📌 Commit 0de72bb has been approved by eddyb

Manishearth added a commit to Manishearth/rust that referenced this pull request Jun 22, 2016
…r=eddyb

don't warn on casting byte strs to slices

r? @durka
Manishearth added a commit to Manishearth/rust that referenced this pull request Jun 22, 2016
…r=eddyb

don't warn on casting byte strs to slices

r? @durka
bors added a commit that referenced this pull request Jun 22, 2016
Rollup of 7 pull requests

- Successful merges: #34190, #34363, #34367, #34383, #34387, #34394, #34404
- Failed merges:
@bors bors merged commit 0de72bb into rust-lang:master Jun 22, 2016
@oli-obk oli-obk deleted the const_cast_false_positive branch June 22, 2016 14:55
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.

4 participants