#![feature(in_band_lifetimes)]
#![feature(nll)]
#![feature(slice_patterns)]
+#![feature(try_blocks)]
#![feature(never_type)]
#![recursion_limit = "256"]
mod structured_errors;
mod variance;
-use rustc::hir::def_id::{DefId, LOCAL_CRATE};
-use rustc::hir::{self, Node};
use rustc::infer::InferOk;
use rustc::lint;
use rustc::middle;
use rustc::ty::{self, Ty, TyCtxt};
use rustc::util;
use rustc::util::common::ErrorReported;
+use rustc_hir as hir;
+use rustc_hir::def_id::{DefId, LOCAL_CRATE};
+use rustc_hir::Node;
+use rustc_span::{Span, DUMMY_SP};
use rustc_target::spec::abi::Abi;
-use syntax_pos::{Span, DUMMY_SP};
-use util::common::time;
use rustc_error_codes::*;
ty: Ty<'tcx>,
}
-fn require_c_abi_if_c_variadic(tcx: TyCtxt<'_>, decl: &hir::FnDecl, abi: Abi, span: Span) {
+fn require_c_abi_if_c_variadic(tcx: TyCtxt<'_>, decl: &hir::FnDecl<'_>, abi: Abi, span: Span) {
if decl.c_variadic && !(abi == Abi::C || abi == Abi::Cdecl) {
let mut err = struct_span_err!(
tcx.sess,
}
pub fn check_crate(tcx: TyCtxt<'_>) -> Result<(), ErrorReported> {
- let _prof_timer = tcx.prof.generic_activity("type_check_crate");
+ let _prof_timer = tcx.sess.timer("type_check_crate");
// this ensures that later parts of type checking can assume that items
// have valid types and not error
// FIXME(matthewjasper) We shouldn't need to do this.
tcx.sess.track_errors(|| {
- time(tcx.sess, "type collecting", || {
+ tcx.sess.time("type collecting", || {
for &module in tcx.hir().krate().modules.keys() {
tcx.ensure().collect_mod_item_types(tcx.hir().local_def_id(module));
}
if tcx.features().rustc_attrs {
tcx.sess.track_errors(|| {
- time(tcx.sess, "outlives testing", || outlives::test::test_inferred_outlives(tcx));
+ tcx.sess.time("outlives testing", || outlives::test::test_inferred_outlives(tcx));
})?;
}
tcx.sess.track_errors(|| {
- time(tcx.sess, "impl wf inference", || impl_wf_check::impl_wf_check(tcx));
+ tcx.sess.time("impl wf inference", || impl_wf_check::impl_wf_check(tcx));
})?;
tcx.sess.track_errors(|| {
- time(tcx.sess, "coherence checking", || coherence::check_coherence(tcx));
+ tcx.sess.time("coherence checking", || coherence::check_coherence(tcx));
})?;
if tcx.features().rustc_attrs {
tcx.sess.track_errors(|| {
- time(tcx.sess, "variance testing", || variance::test::test_variance(tcx));
+ tcx.sess.time("variance testing", || variance::test::test_variance(tcx));
})?;
}
tcx.sess.track_errors(|| {
- time(tcx.sess, "wf checking", || check::check_wf_new(tcx));
+ tcx.sess.time("wf checking", || check::check_wf_new(tcx));
})?;
- time(tcx.sess, "item-types checking", || {
+ tcx.sess.time("item-types checking", || {
for &module in tcx.hir().krate().modules.keys() {
tcx.ensure().check_mod_item_types(tcx.hir().local_def_id(module));
}
});
- time(tcx.sess, "item-bodies checking", || tcx.typeck_item_bodies(LOCAL_CRATE));
+ tcx.sess.time("item-bodies checking", || tcx.typeck_item_bodies(LOCAL_CRATE));
check_unused::check_crate(tcx);
check_for_entry_fn(tcx);
/// A quasi-deprecated helper used in rustdoc and clippy to get
/// the type from a HIR node.
-pub fn hir_ty_to_ty<'tcx>(tcx: TyCtxt<'tcx>, hir_ty: &hir::Ty) -> Ty<'tcx> {
+pub fn hir_ty_to_ty<'tcx>(tcx: TyCtxt<'tcx>, hir_ty: &hir::Ty<'_>) -> Ty<'tcx> {
// In case there are any projections, etc., find the "environment"
// def-ID that will be used to determine the traits/predicates in
// scope. This is derived from the enclosing item-like thing.
astconv::AstConv::ast_ty_to_ty(&item_cx, hir_ty)
}
-pub fn hir_trait_to_predicates<'tcx>(tcx: TyCtxt<'tcx>, hir_trait: &hir::TraitRef) -> Bounds<'tcx> {
+pub fn hir_trait_to_predicates<'tcx>(
+ tcx: TyCtxt<'tcx>,
+ hir_trait: &hir::TraitRef<'_>,
+) -> Bounds<'tcx> {
// In case there are any projections, etc., find the "environment"
// def-ID that will be used to determine the traits/predicates in
// scope. This is derived from the enclosing item-like thing.