@@ -54,12 +54,6 @@ pub enum SimplifyParams {
5454 No ,
5555}
5656
57- #[ derive( PartialEq , Eq , Debug , Clone , Copy ) ]
58- pub enum StripReferences {
59- Yes ,
60- No ,
61- }
62-
6357/// Tries to simplify a type by only returning the outermost injective¹ layer, if one exists.
6458///
6559/// 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 {
7367/// When using `SimplifyParams::Yes`, we still return a simplified type for params and projections²,
7468/// the reasoning for this can be seen at the places doing this.
7569///
76- /// For diagnostics we strip references with `StripReferences::Yes`. This is currently the best
77- /// way to skip some unhelpful suggestions.
7870///
7971/// ¹ meaning that if two outermost layers are different, then the whole types are also different.
8072/// ² 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(
8779 tcx : TyCtxt < ' _ > ,
8880 ty : Ty < ' _ > ,
8981 can_simplify_params : SimplifyParams ,
90- strip_references : StripReferences ,
9182) -> Option < SimplifiedType > {
9283 match * ty. kind ( ) {
9384 ty:: Bool => Some ( BoolSimplifiedType ) ,
@@ -106,16 +97,7 @@ pub fn simplify_type(
10697 }
10798 _ => Some ( MarkerTraitObjectSimplifiedType ) ,
10899 } ,
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) ) ,
119101 ty:: FnDef ( def_id, _) | ty:: Closure ( def_id, _) => Some ( ClosureSimplifiedType ( def_id) ) ,
120102 ty:: Generator ( def_id, _, _) => Some ( GeneratorSimplifiedType ( def_id) ) ,
121103 ty:: GeneratorWitness ( ref tys) => {
0 commit comments