Skip to content

Commit 812f9b2

Browse files
committed
better error on missing #[start]
1 parent 89c2596 commit 812f9b2

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/tools/miri/src/bin/miri.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ impl rustc_driver::Callbacks for MiriCompilerCalls {
6767
if tcx.sess.compile_status().is_err() {
6868
tcx.sess.fatal("miri cannot be run on programs that fail compilation");
6969
}
70-
;
70+
7171
init_late_loggers(handler, tcx);
7272
if !tcx.sess.crate_types().contains(&CrateType::Executable) {
7373
tcx.sess.fatal("miri only makes sense on bin crates");

src/tools/miri/src/eval.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,11 @@ pub fn create_ecx<'mir, 'tcx: 'mir>(
365365

366366
match entry_type {
367367
EntryFnType::Main { .. } => {
368-
let start_id = tcx.lang_items().start_fn().unwrap();
368+
let start_id = tcx.lang_items().start_fn().unwrap_or_else(|| {
369+
tcx.sess.fatal(
370+
"could not find start function. Make sure the entry point is marked with `#[start]`."
371+
);
372+
});
369373
let main_ret_ty = tcx.fn_sig(entry_id).no_bound_vars().unwrap().output();
370374
let main_ret_ty = main_ret_ty.no_bound_vars().unwrap();
371375
let start_instance = ty::Instance::resolve(

0 commit comments

Comments
 (0)