// N.B., this module needs to be declared first so diagnostics are
// registered before they are used.
-mod diagnostics;
+mod error_codes;
mod astconv;
mod check;
use std::iter;
+use astconv::{AstConv, Bounds};
pub use collect::checked_type_of;
pub struct TypeAndSubsts<'tcx> {
time(tcx.sess, "wf checking", || check::check_wf_new(tcx))?;
time(tcx.sess, "item-types checking", || {
- tcx.sess.track_errors(|| {
- for &module in tcx.hir().krate().modules.keys() {
- tcx.ensure().check_mod_item_types(tcx.hir().local_def_id(module));
- }
- })
- })?;
+ 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));
/// A quasi-deprecated helper used in rustdoc and clippy to get
/// the type from a HIR node.
pub fn hir_ty_to_ty<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, '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
+ // 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.
let env_node_id = tcx.hir().get_parent_item(hir_ty.hir_id);
let env_def_id = tcx.hir().local_def_id_from_hir_id(env_node_id);
}
pub fn hir_trait_to_predicates<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, hir_trait: &hir::TraitRef)
- -> (ty::PolyTraitRef<'tcx>, Vec<(ty::PolyProjectionPredicate<'tcx>, Span)>) {
- // In case there are any projections etc, find the "environment"
- // def-id that will be used to determine the traits/predicates in
+ -> (ty::PolyTraitRef<'tcx>, 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.
let env_hir_id = tcx.hir().get_parent_item(hir_trait.hir_ref_id);
let env_def_id = tcx.hir().local_def_id_from_hir_id(env_hir_id);
let item_cx = self::collect::ItemCtxt::new(tcx, env_def_id);
- let mut projections = Vec::new();
- let (principal, _) = astconv::AstConv::instantiate_poly_trait_ref_inner(
- &item_cx, hir_trait, tcx.types.err, &mut projections, true
+ let mut bounds = Bounds::default();
+ let (principal, _) = AstConv::instantiate_poly_trait_ref_inner(
+ &item_cx, hir_trait, tcx.types.err, &mut bounds, true
);
- (principal, projections)
+ (principal, bounds)
}
__build_diagnostic_array! { librustc_typeck, DIAGNOSTICS }