From 28daee4c919dd88772847ec5240eb850bb0dcbf3 Mon Sep 17 00:00:00 2001
From: Oliver Schneider <github35764891676564198441@oli-obk.de>
Date: Tue, 3 Jul 2018 18:23:21 +0200
Subject: [PATCH] Rustup

---
 Cargo.toml                    | 34 +++++++++++++++++++++++++++++++++-
 clippy_lints/src/lifetimes.rs | 21 ++++++++++++++-------
 2 files changed, 47 insertions(+), 8 deletions(-)

diff --git a/Cargo.toml b/Cargo.toml
index dea7f3644c7..2dd71828136 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -48,9 +48,41 @@ semver = "0.9"
 # Not actually needed right now but required to make sure that clippy/ and cargo build
 # with the same set of features in rust-lang/rust
 num-traits = "0.2" # enable the default feature
-winapi = "0.3"
 backtrace = "0.3"
 
+# keep in sync with `cargo`'s `Cargo.toml'
+[target.'cfg(windows)'.dependencies.winapi]
+version = "0.3"
+features = [
+  # keep in sync with `cargo`'s `Cargo.toml'
+  "handleapi",
+  "jobapi",
+  "jobapi2",
+  "minwindef",
+  "ntdef",
+  "ntstatus",
+  "processenv",
+  "processthreadsapi",
+  "psapi",
+  "synchapi",
+  "winerror",
+  "winbase",
+  "wincon",
+  "winnt",
+  # no idea where these come from
+  "lmcons",
+  "minschannel",
+  "minwinbase",
+  "ntsecapi",
+  "profileapi",
+  "schannel",
+  "securitybaseapi",
+  "synchapi",
+  "sysinfoapi",
+  "timezoneapi",
+  "wincrypt",
+]
+
 [dev-dependencies]
 cargo_metadata = "0.5"
 compiletest_rs = "0.3.7"
diff --git a/clippy_lints/src/lifetimes.rs b/clippy_lints/src/lifetimes.rs
index efa50a8f743..605182c007a 100644
--- a/clippy_lints/src/lifetimes.rs
+++ b/clippy_lints/src/lifetimes.rs
@@ -342,16 +342,23 @@ impl<'a, 'tcx> Visitor<'tcx> for RefVisitor<'a, 'tcx> {
                 self.record(&None);
             },
             TyPath(ref path) => {
-                self.collect_anonymous_lifetimes(path, ty);
-            },
-            TyImplTraitExistential(exist_ty_id, _, _) => {
-                if let ItemExistential(ref exist_ty) = self.cx.tcx.hir.expect_item(exist_ty_id.id).node {
-                    for bound in &exist_ty.bounds {
-                        if let GenericBound::Outlives(_) = *bound {
-                            self.record(&None);
+                if let QPath::Resolved(_, ref path) = *path {
+                    if let Def::Existential(def_id) = path.def {
+                        let node_id = self.cx.tcx.hir.as_local_node_id(def_id).unwrap();
+                        if let ItemExistential(ref exist_ty) = self.cx.tcx.hir.expect_item(node_id).node {
+                            for bound in &exist_ty.bounds {
+                                if let GenericBound::Outlives(_) = *bound {
+                                    self.record(&None);
+                                }
+                            }
+                        } else {
+                            unreachable!()
                         }
+                        walk_ty(self, ty);
+                        return;
                     }
                 }
+                self.collect_anonymous_lifetimes(path, ty);
             }
             TyTraitObject(ref bounds, ref lt) => {
                 if !lt.is_elided() {