@@ -5,8 +5,6 @@ use rustc::hir::itemlikevisit::ItemLikeVisitor;
5
5
use rustc:: traits:: { self , IntercrateMode } ;
6
6
use rustc:: ty:: TyCtxt ;
7
7
8
- use crate :: lint;
9
-
10
8
pub fn crate_inherent_impls_overlap_check < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
11
9
crate_num : CrateNum ) {
12
10
assert_eq ! ( crate_num, LOCAL_CRATE ) ;
@@ -20,8 +18,7 @@ struct InherentOverlapChecker<'a, 'tcx: 'a> {
20
18
21
19
impl < ' a , ' tcx > InherentOverlapChecker < ' a , ' tcx > {
22
20
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 < ' _ > ) {
25
22
26
23
let name_and_namespace = |def_id| {
27
24
let item = self . tcx . associated_item ( def_id) ;
@@ -36,22 +33,12 @@ impl<'a, 'tcx> InherentOverlapChecker<'a, 'tcx> {
36
33
37
34
for & item2 in & impl_items2[ ..] {
38
35
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 =
48
37
struct_span_err ! ( self . tcx. sess,
49
38
self . tcx. span_of_impl( item1) . unwrap( ) ,
50
39
E0592 ,
51
40
"duplicate definitions with name `{}`" ,
52
- name)
53
- } ;
54
-
41
+ name) ;
55
42
err. span_label ( self . tcx . span_of_impl ( item1) . unwrap ( ) ,
56
43
format ! ( "duplicate definitions for `{}`" , name) ) ;
57
44
err. span_label ( self . tcx . span_of_impl ( item2) . unwrap ( ) ,
@@ -76,7 +63,7 @@ impl<'a, 'tcx> InherentOverlapChecker<'a, 'tcx> {
76
63
77
64
for ( i, & impl1_def_id) in impls. iter ( ) . enumerate ( ) {
78
65
for & impl2_def_id in & impls[ ( i + 1 ) ..] {
79
- let used_to_be_allowed = traits:: overlapping_impls (
66
+ traits:: overlapping_impls (
80
67
self . tcx ,
81
68
impl1_def_id,
82
69
impl2_def_id,
@@ -86,28 +73,11 @@ impl<'a, 'tcx> InherentOverlapChecker<'a, 'tcx> {
86
73
impl1_def_id,
87
74
impl2_def_id,
88
75
overlap,
89
- false ,
90
76
) ;
91
77
false
92
78
} ,
93
79
|| true ,
94
80
) ;
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
- }
111
81
}
112
82
}
113
83
}
0 commit comments