From 50fb018f3f91d7995a966bf9930ace3c290f2a64 Mon Sep 17 00:00:00 2001 From: Ariel Ben-Yehuda Date: Mon, 3 Oct 2016 20:25:46 +0300 Subject: [PATCH] split slices and arrays in fast_reject this does not have a measurable performance effect and mostly makes the logs clearer --- src/librustc/ty/fast_reject.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/librustc/ty/fast_reject.rs b/src/librustc/ty/fast_reject.rs index befc9533c387b..4b007c69d3941 100644 --- a/src/librustc/ty/fast_reject.rs +++ b/src/librustc/ty/fast_reject.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use hir; use hir::def_id::DefId; use ty::{self, Ty, TyCtxt}; use syntax::ast; @@ -24,8 +25,9 @@ pub enum SimplifiedType { FloatSimplifiedType(ast::FloatTy), AdtSimplifiedType(DefId), StrSimplifiedType, - ArraySimplifiedType, - PtrSimplifiedType, + ArraySimplifiedType(usize), + SliceSimplifiedType, + PtrSimplifiedType(hir::Mutability), NeverSimplifiedType, TupleSimplifiedType(usize), TraitSimplifiedType(DefId), @@ -57,8 +59,9 @@ pub fn simplify_type<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, ty::TyFloat(float_type) => Some(FloatSimplifiedType(float_type)), ty::TyAdt(def, _) => Some(AdtSimplifiedType(def.did)), ty::TyStr => Some(StrSimplifiedType), - ty::TyArray(..) | ty::TySlice(_) => Some(ArraySimplifiedType), - ty::TyRawPtr(_) => Some(PtrSimplifiedType), + ty::TyArray(_, n) => Some(ArraySimplifiedType(n)), + ty::TySlice(_) => Some(SliceSimplifiedType), + ty::TyRawPtr(mt) => Some(PtrSimplifiedType(mt.mutbl)), ty::TyTrait(ref trait_info) => { Some(TraitSimplifiedType(trait_info.principal.def_id())) }