Skip to content

Commit 3f84010

Browse files
committed
Examine lifetimes in OpaqueDef bounds as well
Fix rust-lang#7893.
1 parent 08b7e87 commit 3f84010

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

clippy_lints/src/lifetimes.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,11 +378,15 @@ impl<'a, 'tcx> Visitor<'tcx> for RefVisitor<'a, 'tcx> {
378378

379379
fn visit_ty(&mut self, ty: &'tcx Ty<'_>) {
380380
match ty.kind {
381-
TyKind::OpaqueDef(item, _) => {
381+
TyKind::OpaqueDef(item, bounds) => {
382382
let map = self.cx.tcx.hir();
383383
let item = map.item(item);
384384
walk_item(self, item);
385385
walk_ty(self, ty);
386+
self.lts.extend(bounds.iter().filter_map(|bound| match bound {
387+
GenericArg::Lifetime(l) => Some(RefLt::Named(l.name.ident().name)),
388+
_ => None,
389+
}));
386390
},
387391
TyKind::BareFn(&BareFnTy { decl, .. }) => {
388392
let mut sub_visitor = RefVisitor::new(self.cx);

0 commit comments

Comments
 (0)