@@ -54,12 +54,6 @@ pub enum SimplifyParams {
54
54
No ,
55
55
}
56
56
57
- #[ derive( PartialEq , Eq , Debug , Clone , Copy ) ]
58
- pub enum StripReferences {
59
- Yes ,
60
- No ,
61
- }
62
-
63
57
/// Tries to simplify a type by only returning the outermost injective¹ layer, if one exists.
64
58
///
65
59
/// The idea is to get something simple that we can use to quickly decide if two types could unify,
@@ -73,8 +67,6 @@ pub enum StripReferences {
73
67
/// When using `SimplifyParams::Yes`, we still return a simplified type for params and projections²,
74
68
/// the reasoning for this can be seen at the places doing this.
75
69
///
76
- /// For diagnostics we strip references with `StripReferences::Yes`. This is currently the best
77
- /// way to skip some unhelpful suggestions.
78
70
///
79
71
/// ¹ meaning that if two outermost layers are different, then the whole types are also different.
80
72
/// ² FIXME(@lcnr): this seems like it can actually end up being unsound with the way it's used during
@@ -87,7 +79,6 @@ pub fn simplify_type(
87
79
tcx : TyCtxt < ' _ > ,
88
80
ty : Ty < ' _ > ,
89
81
can_simplify_params : SimplifyParams ,
90
- strip_references : StripReferences ,
91
82
) -> Option < SimplifiedType > {
92
83
match * ty. kind ( ) {
93
84
ty:: Bool => Some ( BoolSimplifiedType ) ,
@@ -106,16 +97,7 @@ pub fn simplify_type(
106
97
}
107
98
_ => Some ( MarkerTraitObjectSimplifiedType ) ,
108
99
} ,
109
- ty:: Ref ( _, ty, mutbl) => {
110
- if strip_references == StripReferences :: Yes {
111
- // For diagnostics, when recommending similar impls we want to
112
- // recommend impls even when there is a reference mismatch,
113
- // so we treat &T and T equivalently in that case.
114
- simplify_type ( tcx, ty, can_simplify_params, strip_references)
115
- } else {
116
- Some ( RefSimplifiedType ( mutbl) )
117
- }
118
- }
100
+ ty:: Ref ( _, _, mutbl) => Some ( RefSimplifiedType ( mutbl) ) ,
119
101
ty:: FnDef ( def_id, _) | ty:: Closure ( def_id, _) => Some ( ClosureSimplifiedType ( def_id) ) ,
120
102
ty:: Generator ( def_id, _, _) => Some ( GeneratorSimplifiedType ( def_id) ) ,
121
103
ty:: GeneratorWitness ( ref tys) => {
0 commit comments