@@ -13,7 +13,7 @@ use hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
1313use middle:: const_val:: ConstVal ;
1414use middle:: privacy:: AccessLevels ;
1515use mir;
16- use ty:: { self , Ty , TyCtxt } ;
16+ use ty:: { self , CrateInherentImpls , Ty , TyCtxt } ;
1717
1818use rustc_data_structures:: indexed_vec:: IndexVec ;
1919use std:: cell:: { RefCell , RefMut } ;
@@ -177,9 +177,15 @@ impl<'tcx> QueryDescription for queries::coherent_trait<'tcx> {
177177 }
178178}
179179
180- impl < ' tcx > QueryDescription for queries:: coherent_inherent_impls < ' tcx > {
180+ impl < ' tcx > QueryDescription for queries:: crate_inherent_impls < ' tcx > {
181+ fn describe ( _: TyCtxt , k : CrateNum ) -> String {
182+ format ! ( "all inherent impls defined in crate `{:?}`" , k)
183+ }
184+ }
185+
186+ impl < ' tcx > QueryDescription for queries:: crate_inherent_impls_overlap_check < ' tcx > {
181187 fn describe ( _: TyCtxt , _: CrateNum ) -> String {
182- format ! ( "coherence checking all inherent impls" )
188+ format ! ( "check for overlap between inherent impls defined in this crate " )
183189 }
184190}
185191
@@ -375,7 +381,7 @@ define_maps! { <'tcx>
375381 /// Maps a DefId of a type to a list of its inherent impls.
376382 /// Contains implementations of methods that are inherent to a type.
377383 /// Methods in these implementations don't need to be exported.
378- pub inherent_impls: InherentImpls ( DefId ) -> Vec <DefId >,
384+ pub inherent_impls: InherentImpls ( DefId ) -> Rc < Vec <DefId > >,
379385
380386 /// Maps from the def-id of a function/method or const/static
381387 /// to its MIR. Mutation is done at an item granularity to
@@ -400,14 +406,22 @@ define_maps! { <'tcx>
400406 pub closure_type: ItemSignature ( DefId ) -> ty:: PolyFnSig <' tcx>,
401407
402408 /// Caches CoerceUnsized kinds for impls on custom types.
403- pub custom_coerce_unsized_kind : ItemSignature ( DefId )
404- -> ty:: adjustment:: CustomCoerceUnsized ,
409+ pub coerce_unsized_info : ItemSignature ( DefId )
410+ -> ty:: adjustment:: CoerceUnsizedInfo ,
405411
406412 pub typeck_tables: TypeckTables ( DefId ) -> & ' tcx ty:: TypeckTables <' tcx>,
407413
408414 pub coherent_trait: coherent_trait_dep_node( ( CrateNum , DefId ) ) -> ( ) ,
409415
410- pub coherent_inherent_impls: coherent_inherent_impls_dep_node( CrateNum ) -> ( ) ,
416+ /// Gets a complete map from all types to their inherent impls.
417+ /// Not meant to be used directly outside of coherence.
418+ /// (Defined only for LOCAL_CRATE)
419+ pub crate_inherent_impls: crate_inherent_impls_dep_node( CrateNum ) -> CrateInherentImpls ,
420+
421+ /// Checks all types in the krate for overlap in their inherent impls. Reports errors.
422+ /// Not meant to be used directly outside of coherence.
423+ /// (Defined only for LOCAL_CRATE)
424+ pub crate_inherent_impls_overlap_check: crate_inherent_impls_dep_node( CrateNum ) -> ( ) ,
411425
412426 /// Results of evaluating monomorphic constants embedded in
413427 /// other items, such as enum variant explicit discriminants.
@@ -423,7 +437,7 @@ fn coherent_trait_dep_node((_, def_id): (CrateNum, DefId)) -> DepNode<DefId> {
423437 DepNode :: CoherenceCheckTrait ( def_id)
424438}
425439
426- fn coherent_inherent_impls_dep_node ( _: CrateNum ) -> DepNode < DefId > {
440+ fn crate_inherent_impls_dep_node ( _: CrateNum ) -> DepNode < DefId > {
427441 DepNode :: Coherence
428442}
429443
0 commit comments