1 // Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 use hir
::def_id
::DefId
;
13 use super::thread
::{DepGraphThreadData, DepMessage}
;
15 pub struct DepTask
<'graph
> {
16 data
: &'graph DepGraphThreadData
,
20 impl<'graph
> DepTask
<'graph
> {
21 pub fn new(data
: &'graph DepGraphThreadData
, key
: DepNode
<DefId
>)
23 data
.enqueue(DepMessage
::PushTask(key
));
24 DepTask { data: data, key: key }
28 impl<'graph
> Drop
for DepTask
<'graph
> {
30 self.data
.enqueue(DepMessage
::PopTask(self.key
));
34 pub struct IgnoreTask
<'graph
> {
35 data
: &'graph DepGraphThreadData
38 impl<'graph
> IgnoreTask
<'graph
> {
39 pub fn new(data
: &'graph DepGraphThreadData
) -> IgnoreTask
<'graph
> {
40 data
.enqueue(DepMessage
::PushIgnore
);
41 IgnoreTask { data: data }
45 impl<'graph
> Drop
for IgnoreTask
<'graph
> {
47 self.data
.enqueue(DepMessage
::PopIgnore
);