use rustc::ty::{self, Ty, TyCtxt};
use rustc::ty::maps::Providers;
use rustc::traits::{FulfillmentContext, ObligationCause, ObligationCauseCode, Reveal};
-use session::config;
+use session::{CompileIncomplete, config};
use util::common::time;
use syntax::ast;
match fulfill_cx.select_all_or_error(infcx) {
Ok(()) => true,
Err(errors) => {
- infcx.report_fulfillment_errors(&errors);
+ infcx.report_fulfillment_errors(&errors, None);
false
}
}
}
_ => ()
}
- let substs = tcx.intern_substs(&[]);
- let se_ty = tcx.mk_fn_def(main_def_id, substs,
- ty::Binder(tcx.mk_fn_sig(
+ let se_ty = tcx.mk_fn_ptr(ty::Binder(
+ tcx.mk_fn_sig(
iter::empty(),
tcx.mk_nil(),
false,
hir::Unsafety::Normal,
Abi::Rust
- ))
- );
+ )
+ ));
require_same_types(
tcx,
&ObligationCause::new(main_span, main_id, ObligationCauseCode::MainFunctionType),
se_ty,
- main_t);
+ tcx.mk_fn_ptr(tcx.fn_sig(main_def_id)));
}
_ => {
span_bug!(main_span,
_ => ()
}
- let substs = tcx.intern_substs(&[]);
- let se_ty = tcx.mk_fn_def(start_def_id, substs,
- ty::Binder(tcx.mk_fn_sig(
+ let se_ty = tcx.mk_fn_ptr(ty::Binder(
+ tcx.mk_fn_sig(
[
tcx.types.isize,
tcx.mk_imm_ptr(tcx.mk_imm_ptr(tcx.types.u8))
false,
hir::Unsafety::Normal,
Abi::Rust
- ))
- );
+ )
+ ));
require_same_types(
tcx,
&ObligationCause::new(start_span, start_id, ObligationCauseCode::StartFunctionType),
se_ty,
- start_t);
+ tcx.mk_fn_ptr(tcx.fn_sig(start_def_id)));
}
_ => {
span_bug!(start_span,
}
pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>)
- -> Result<(), usize> {
+ -> Result<(), CompileIncomplete>
+{
let time_passes = tcx.sess.time_passes();
// this ensures that later parts of type checking can assume that items
check_unused::check_crate(tcx);
check_for_entry_fn(tcx);
- let err_count = tcx.sess.err_count();
- if err_count == 0 {
- Ok(())
- } else {
- Err(err_count)
- }
+ tcx.sess.compile_status()
}
/// A quasi-deprecated helper used in rustdoc and save-analysis to get