diff options
| author | ljedrz <ljedrz@gmail.com> | 2018-10-01 15:44:23 +0200 |
|---|---|---|
| committer | ljedrz <ljedrz@gmail.com> | 2018-10-05 09:00:54 +0200 |
| commit | 0ee6b54c2471a68b838bde42bfe48f1e91df1633 (patch) | |
| tree | e186225032be4f0c5bac75cc2ce53dc0bb714d7f | |
| parent | e153103c380c8ac88aea1ab0a200facf1e94aa1a (diff) | |
| download | rust-0ee6b54c2471a68b838bde42bfe48f1e91df1633.tar.gz rust-0ee6b54c2471a68b838bde42bfe48f1e91df1633.zip | |
rustc/ty: move a faster early return up
| -rw-r--r-- | src/librustc/ty/query/job.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/librustc/ty/query/job.rs b/src/librustc/ty/query/job.rs index a1dc4f16ce9..321f2a66799 100644 --- a/src/librustc/ty/query/job.rs +++ b/src/librustc/ty/query/job.rs @@ -324,16 +324,16 @@ fn connected_to_root<'tcx>( query: Lrc<QueryJob<'tcx>>, visited: &mut FxHashSet<*const QueryJob<'tcx>> ) -> bool { - // We already visited this or we're deliberately ignoring it - if visited.contains(&query.as_ptr()) { - return false; - } - // This query is connected to the root (it has no query parent), return true if query.parent.is_none() { return true; } + // We already visited this or we're deliberately ignoring it + if visited.contains(&query.as_ptr()) { + return false; + } + visited.insert(query.as_ptr()); let mut connected = false; |
