Skip to content

Commit

Permalink
Mark more errors as unsupported.
Browse files Browse the repository at this point in the history
  • Loading branch information
solson committed Feb 10, 2017
1 parent 459f898 commit d971a63
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/error.rs
Expand Up @@ -116,7 +116,7 @@ impl<'tcx> Error for EvalError<'tcx> {
EvalError::AssumptionNotHeld =>
"`assume` argument was false",
EvalError::InlineAsm =>
"cannot evaluate inline assembly",
"miri does not support inline assembly",
EvalError::TypeNotPrimitive(_) =>
"expected primitive type, got nonprimitive",
EvalError::ReallocatedStaticMemory =>
Expand Down
6 changes: 6 additions & 0 deletions src/eval_context.rs
Expand Up @@ -1437,6 +1437,12 @@ pub fn eval_main<'a, 'tcx: 'a>(
let mut ecx = EvalContext::new(tcx, limits);
let mir = ecx.load_mir(def_id).expect("main function's MIR not found");

if !mir.return_ty.is_nil() || mir.arg_count != 0 {
let msg = "miri does not support main functions without `fn()` type signatures";
tcx.sess.err(&EvalError::Unimplemented(String::from(msg)).to_string());
return;
}

ecx.push_stack_frame(
def_id,
DUMMY_SP,
Expand Down

0 comments on commit d971a63

Please sign in to comment.