1
Fork 0

Auto merge of #94925 - lcnr:relax-sus-auto-impls, r=estebank

relax `suspicious_auto_trait_impls` lint wrt lifetimes

fixes the warning for https://github.com/rust-lang/rust/issues/93367#issuecomment-1063993489.
This commit is contained in:
bors 2022-03-15 22:54:35 +00:00
commit f21488a12c
3 changed files with 27 additions and 12 deletions

View file

@ -297,17 +297,11 @@ impl<'tcx> TypeVisitor<'tcx> for AreUniqueParamsVisitor {
_ => ControlFlow::Break(NotUniqueParam::NotParam(t.into())),
}
}
fn visit_region(&mut self, r: ty::Region<'tcx>) -> ControlFlow<Self::BreakTy> {
match *r {
ty::ReEarlyBound(p) => {
if self.seen.insert(p.index) {
ControlFlow::CONTINUE
} else {
ControlFlow::Break(NotUniqueParam::DuplicateParam(r.into()))
}
}
_ => ControlFlow::Break(NotUniqueParam::NotParam(r.into())),
}
fn visit_region(&mut self, _: ty::Region<'tcx>) -> ControlFlow<Self::BreakTy> {
// We don't drop candidates during candidate assembly because of region
// constraints, so the behavior for impls only constrained by regions
// will not change.
ControlFlow::CONTINUE
}
fn visit_const(&mut self, c: ty::Const<'tcx>) -> ControlFlow<Self::BreakTy> {
match c.val() {