-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Conversation
@@ -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")), |
There was a problem hiding this comment.
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];
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jup
LGTM but I am not a reviewer |
r? @eddyb |
@bors r+ |
📌 Commit 0de72bb has been approved by |
…r=eddyb don't warn on casting byte strs to slices r? @durka
…r=eddyb don't warn on casting byte strs to slices r? @durka
r? @durka