diff options
| author | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2018-12-07 00:56:19 +0100 |
|---|---|---|
| committer | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2018-12-21 11:01:24 +0100 |
| commit | edd08e020cb1269a0f171e0502d8bc166c78e58b (patch) | |
| tree | 9a9e0d156d3842712bb4830796f6ae40996b4f48 | |
| parent | 6d34ec18c7d7e574553f6347ecf08e1e1c45c13d (diff) | |
| download | rust-edd08e020cb1269a0f171e0502d8bc166c78e58b.tar.gz rust-edd08e020cb1269a0f171e0502d8bc166c78e58b.zip | |
Optimize away a move
| -rw-r--r-- | src/librustc/ty/query/plumbing.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/librustc/ty/query/plumbing.rs b/src/librustc/ty/query/plumbing.rs index a73b92ed713..3f90f072ddb 100644 --- a/src/librustc/ty/query/plumbing.rs +++ b/src/librustc/ty/query/plumbing.rs @@ -136,11 +136,14 @@ impl<'a, 'tcx, Q: QueryDescription<'tcx>> JobOwner<'a, 'tcx, Q> { Entry::Vacant(entry) => { // No job entry for this query. Return a new one to be started later return tls::with_related_context(tcx, |icx| { + // Create the `parent` variable before `info`. This allows LLVM + // to elide the move of `info` + let parent = icx.query.clone(); let info = QueryInfo { span, query: Q::query(key.clone()), }; - let job = Lrc::new(QueryJob::new(info, icx.query.clone())); + let job = Lrc::new(QueryJob::new(info, parent)); let owner = JobOwner { cache, job: job.clone(), |
