]> git.lizzy.rs Git - rust.git/blob - src/librustc/middle/borrowck.rs
Rollup merge of #58064 - llogiq:vec-deque-try-rfold, r=scottmcm
[rust.git] / src / librustc / middle / borrowck.rs
1 use crate::ich::StableHashingContext;
2 use crate::hir::HirId;
3 use crate::util::nodemap::FxHashSet;
4
5 use rustc_data_structures::stable_hasher::{HashStable, StableHasher,
6                                            StableHasherResult};
7
8 #[derive(Copy, Clone, Debug, RustcEncodable, RustcDecodable)]
9 pub enum SignalledError { SawSomeError, NoErrorsSeen }
10
11 impl Default for SignalledError {
12     fn default() -> SignalledError {
13         SignalledError::NoErrorsSeen
14     }
15 }
16
17 impl_stable_hash_for!(enum self::SignalledError { SawSomeError, NoErrorsSeen });
18
19 #[derive(Debug, Default, RustcEncodable, RustcDecodable)]
20 pub struct BorrowCheckResult {
21     pub used_mut_nodes: FxHashSet<HirId>,
22     pub signalled_any_error: SignalledError,
23 }
24
25 impl<'a> HashStable<StableHashingContext<'a>> for BorrowCheckResult {
26     fn hash_stable<W: StableHasherResult>(&self,
27                                           hcx: &mut StableHashingContext<'a>,
28                                           hasher: &mut StableHasher<W>) {
29         let BorrowCheckResult {
30             ref used_mut_nodes,
31             ref signalled_any_error,
32         } = *self;
33         used_mut_nodes.hash_stable(hcx, hasher);
34         signalled_any_error.hash_stable(hcx, hasher);
35     }
36 }