Don't lint explicit_auto_deref
when the target type is a projection containing a generic argument
This commit is contained in:
parent
213003b887
commit
5b1e445b9a
@ -1362,6 +1362,7 @@ fn ty_auto_deref_stability<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>, precedenc
|
||||
continue;
|
||||
},
|
||||
ty::Param(_) => TyPosition::new_deref_stable_for_result(precedence, ty),
|
||||
ty::Projection(_) if ty.has_non_region_param() => TyPosition::new_deref_stable_for_result(precedence, ty),
|
||||
ty::Infer(_) | ty::Error(_) | ty::Bound(..) | ty::Opaque(..) | ty::Placeholder(_) | ty::Dynamic(..) => {
|
||||
Position::ReborrowStable(precedence).into()
|
||||
},
|
||||
|
@ -266,4 +266,15 @@ fn main() {
|
||||
}
|
||||
x
|
||||
};
|
||||
|
||||
trait WithAssoc {
|
||||
type Assoc: ?Sized;
|
||||
}
|
||||
impl WithAssoc for String {
|
||||
type Assoc = str;
|
||||
}
|
||||
fn takes_assoc<T: WithAssoc>(_: &T::Assoc) -> T {
|
||||
unimplemented!()
|
||||
}
|
||||
let _: String = takes_assoc(&*String::new());
|
||||
}
|
||||
|
@ -266,4 +266,15 @@ fn deref(&self) -> &Self::Target {
|
||||
}
|
||||
*x
|
||||
};
|
||||
|
||||
trait WithAssoc {
|
||||
type Assoc: ?Sized;
|
||||
}
|
||||
impl WithAssoc for String {
|
||||
type Assoc = str;
|
||||
}
|
||||
fn takes_assoc<T: WithAssoc>(_: &T::Assoc) -> T {
|
||||
unimplemented!()
|
||||
}
|
||||
let _: String = takes_assoc(&*String::new());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user