]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_middle/src/ty/binding.rs
Rollup merge of #101545 - TaKO8Ki:remove-unnecessary-partialord-ord, r=oli-obk
[rust.git] / compiler / rustc_middle / src / ty / binding.rs
1 use rustc_hir::{BindingAnnotation, ByRef, Mutability};
2
3 #[derive(Clone, PartialEq, TyEncodable, TyDecodable, Debug, Copy, HashStable)]
4 pub enum BindingMode {
5     BindByReference(Mutability),
6     BindByValue(Mutability),
7 }
8
9 TrivialTypeTraversalAndLiftImpls! { BindingMode, }
10
11 impl BindingMode {
12     pub fn convert(BindingAnnotation(by_ref, mutbl): BindingAnnotation) -> BindingMode {
13         match by_ref {
14             ByRef::No => BindingMode::BindByValue(mutbl),
15             ByRef::Yes => BindingMode::BindByReference(mutbl),
16         }
17     }
18 }