@@ -15,8 +15,6 @@ use rustc::hir::itemlikevisit::ItemLikeVisitor;
1515use rustc:: traits:: { self , IntercrateMode } ;
1616use rustc:: ty:: TyCtxt ;
1717
18- use lint;
19-
2018pub fn crate_inherent_impls_overlap_check < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
2119 crate_num : CrateNum ) {
2220 assert_eq ! ( crate_num, LOCAL_CRATE ) ;
@@ -30,8 +28,7 @@ struct InherentOverlapChecker<'a, 'tcx: 'a> {
3028
3129impl < ' a , ' tcx > InherentOverlapChecker < ' a , ' tcx > {
3230 fn check_for_common_items_in_impls ( & self , impl1 : DefId , impl2 : DefId ,
33- overlap : traits:: OverlapResult ,
34- used_to_be_allowed : bool ) {
31+ overlap : traits:: OverlapResult ) {
3532
3633 let name_and_namespace = |def_id| {
3734 let item = self . tcx . associated_item ( def_id) ;
@@ -46,21 +43,13 @@ impl<'a, 'tcx> InherentOverlapChecker<'a, 'tcx> {
4643
4744 for & item2 in & impl_items2[ ..] {
4845 if ( name, namespace) == name_and_namespace ( item2) {
49- let node_id = self . tcx . hir . as_local_node_id ( impl1) ;
50- let mut err = if used_to_be_allowed && node_id. is_some ( ) {
51- self . tcx . struct_span_lint_node (
52- lint:: builtin:: INCOHERENT_FUNDAMENTAL_IMPLS ,
53- node_id. unwrap ( ) ,
54- self . tcx . span_of_impl ( item1) . unwrap ( ) ,
55- & format ! ( "duplicate definitions with name `{}` (E0592)" , name)
56- )
57- } else {
58- struct_span_err ! ( self . tcx. sess,
59- self . tcx. span_of_impl( item1) . unwrap( ) ,
60- E0592 ,
61- "duplicate definitions with name `{}`" ,
62- name)
63- } ;
46+ let mut err = struct_span_err ! (
47+ self . tcx. sess,
48+ self . tcx. span_of_impl( item1) . unwrap( ) ,
49+ E0592 ,
50+ "duplicate definitions with name `{}`" ,
51+ name
52+ ) ;
6453
6554 err. span_label ( self . tcx . span_of_impl ( item1) . unwrap ( ) ,
6655 format ! ( "duplicate definitions for `{}`" , name) ) ;
@@ -82,38 +71,16 @@ impl<'a, 'tcx> InherentOverlapChecker<'a, 'tcx> {
8271
8372 for ( i, & impl1_def_id) in impls. iter ( ) . enumerate ( ) {
8473 for & impl2_def_id in & impls[ ( i + 1 ) ..] {
85- let used_to_be_allowed = traits:: overlapping_impls (
74+ traits:: overlapping_impls (
8675 self . tcx ,
8776 impl1_def_id,
8877 impl2_def_id,
8978 IntercrateMode :: Issue43355 ,
9079 |overlap| {
91- self . check_for_common_items_in_impls (
92- impl1_def_id,
93- impl2_def_id,
94- overlap,
95- false ,
96- ) ;
97- false
80+ self . check_for_common_items_in_impls ( impl1_def_id, impl2_def_id, overlap)
9881 } ,
99- || true ,
100- ) ;
101-
102- if used_to_be_allowed {
103- traits:: overlapping_impls (
104- self . tcx ,
105- impl1_def_id,
106- impl2_def_id,
107- IntercrateMode :: Fixed ,
108- |overlap| self . check_for_common_items_in_impls (
109- impl1_def_id,
110- impl2_def_id,
111- overlap,
112- true ,
113- ) ,
114- || ( ) ,
115- ) ;
116- }
82+ || ( ) ,
83+ )
11784 }
11885 }
11986 }
0 commit comments