]>
Commit | Line | Data |
---|---|---|
dfeec247 XL |
1 | use rustc_hir::BindingAnnotation; |
2 | use rustc_hir::BindingAnnotation::*; | |
3 | use rustc_hir::Mutability; | |
3b2f2976 | 4 | |
3dfed10e | 5 | #[derive(Clone, PartialEq, TyEncodable, TyDecodable, Debug, Copy, HashStable)] |
3b2f2976 XL |
6 | pub enum BindingMode { |
7 | BindByReference(Mutability), | |
8 | BindByValue(Mutability), | |
9 | } | |
10 | ||
94b46f34 XL |
11 | CloneTypeFoldableAndLiftImpls! { BindingMode, } |
12 | ||
3b2f2976 XL |
13 | impl BindingMode { |
14 | pub fn convert(ba: BindingAnnotation) -> BindingMode { | |
15 | match ba { | |
dfeec247 XL |
16 | Unannotated => BindingMode::BindByValue(Mutability::Not), |
17 | Mutable => BindingMode::BindByValue(Mutability::Mut), | |
18 | Ref => BindingMode::BindByReference(Mutability::Not), | |
19 | RefMut => BindingMode::BindByReference(Mutability::Mut), | |
3b2f2976 XL |
20 | } |
21 | } | |
22 | } |