-
Notifications
You must be signed in to change notification settings - Fork 353
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
replace all unreachable!
and panic!
calls with bug!
#47
Conversation
@@ -44,22 +44,25 @@ impl<'a> CompilerCalls<'a> for MiriCompilerCalls { | |||
fn extract_str(lit: &syntax::ast::Lit) -> syntax::parse::token::InternedString { | |||
match lit.node { | |||
syntax::ast::LitKind::Str(ref s, _) => s.clone(), | |||
_ => panic!("attribute values need to be strings"), | |||
_ => bug!("attribute values need to be strings"), |
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.
This should actually be a span_err, because it is a miri user fault, not miri progrmmer fault.
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.
I don't think the parser ever yields something other than a LitKind::Str
. Rustc will error and abort long before we reach this.
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.
#[memory_size=true]
should give LitKind::Bool for the value.
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.
@oli-obk It turns out this changed in a recent nightly. Beta still bails on non-string literals in attributes, but nightly accepts them if you use #![feature(attr_literals)]
.
@@ -49,8 +49,7 @@ pub fn binary_op<'tcx>(bin_op: mir::BinOp, left: PrimVal, right: PrimVal) -> Eva | |||
BitOr => $v($l | $r), | |||
|
|||
// these have already been handled | |||
Shl => bug!("`<<` operation should already have been handled"), | |||
Shr => bug!("`>>` operation should already have been handled"), | |||
Shl | Shr => bug!("`bin_op` operation should already have been handled", bin_op.to_hir_binop().as_str()), |
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.
s/bin_op/{}/
fixes #32
I didn't touch the
unimplemented!
, since these probably need to go away by being implememented before moving miri into rustc.