@@ -5,8 +5,6 @@ use rustc::hir::itemlikevisit::ItemLikeVisitor;
55use rustc:: traits:: { self , IntercrateMode } ;
66use rustc:: ty:: TyCtxt ;
77
8- use crate :: lint;
9-
108pub fn crate_inherent_impls_overlap_check < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
119 crate_num : CrateNum ) {
1210 assert_eq ! ( crate_num, LOCAL_CRATE ) ;
@@ -20,8 +18,7 @@ struct InherentOverlapChecker<'a, 'tcx: 'a> {
2018
2119impl < ' a , ' tcx > InherentOverlapChecker < ' a , ' tcx > {
2220 fn check_for_common_items_in_impls ( & self , impl1 : DefId , impl2 : DefId ,
23- overlap : traits:: OverlapResult < ' _ > ,
24- used_to_be_allowed : bool ) {
21+ overlap : traits:: OverlapResult < ' _ > ) {
2522
2623 let name_and_namespace = |def_id| {
2724 let item = self . tcx . associated_item ( def_id) ;
@@ -36,22 +33,12 @@ impl<'a, 'tcx> InherentOverlapChecker<'a, 'tcx> {
3633
3734 for & item2 in & impl_items2[ ..] {
3835 if ( name, namespace) == name_and_namespace ( item2) {
39- let hir_id = self . tcx . hir ( ) . as_local_hir_id ( impl1) ;
40- let mut err = if used_to_be_allowed && hir_id. is_some ( ) {
41- self . tcx . struct_span_lint_hir (
42- lint:: builtin:: INCOHERENT_FUNDAMENTAL_IMPLS ,
43- hir_id. unwrap ( ) ,
44- self . tcx . span_of_impl ( item1) . unwrap ( ) ,
45- & format ! ( "duplicate definitions with name `{}` (E0592)" , name)
46- )
47- } else {
36+ let mut err =
4837 struct_span_err ! ( self . tcx. sess,
4938 self . tcx. span_of_impl( item1) . unwrap( ) ,
5039 E0592 ,
5140 "duplicate definitions with name `{}`" ,
52- name)
53- } ;
54-
41+ name) ;
5542 err. span_label ( self . tcx . span_of_impl ( item1) . unwrap ( ) ,
5643 format ! ( "duplicate definitions for `{}`" , name) ) ;
5744 err. span_label ( self . tcx . span_of_impl ( item2) . unwrap ( ) ,
@@ -76,7 +63,7 @@ impl<'a, 'tcx> InherentOverlapChecker<'a, 'tcx> {
7663
7764 for ( i, & impl1_def_id) in impls. iter ( ) . enumerate ( ) {
7865 for & impl2_def_id in & impls[ ( i + 1 ) ..] {
79- let used_to_be_allowed = traits:: overlapping_impls (
66+ traits:: overlapping_impls (
8067 self . tcx ,
8168 impl1_def_id,
8269 impl2_def_id,
@@ -86,28 +73,11 @@ impl<'a, 'tcx> InherentOverlapChecker<'a, 'tcx> {
8673 impl1_def_id,
8774 impl2_def_id,
8875 overlap,
89- false ,
9076 ) ;
9177 false
9278 } ,
9379 || true ,
9480 ) ;
95-
96- if used_to_be_allowed {
97- traits:: overlapping_impls (
98- self . tcx ,
99- impl1_def_id,
100- impl2_def_id,
101- IntercrateMode :: Fixed ,
102- |overlap| self . check_for_common_items_in_impls (
103- impl1_def_id,
104- impl2_def_id,
105- overlap,
106- true ,
107- ) ,
108- || ( ) ,
109- ) ;
110- }
11181 }
11282 }
11383 }
0 commit comments