Store ByRef
instead of BindingAnnotation
in PatInfo
This commit is contained in:
parent
6c6b3027ef
commit
d19e48d79a
2 changed files with 30 additions and 30 deletions
|
@ -707,6 +707,15 @@ pub enum ByRef {
|
|||
No,
|
||||
}
|
||||
|
||||
impl ByRef {
|
||||
pub fn cap_ref_mutability(mut self, mutbl: Mutability) -> Self {
|
||||
if let ByRef::Yes(old_mutbl) = &mut self {
|
||||
*old_mutbl = cmp::min(*old_mutbl, mutbl);
|
||||
}
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
/// Explicit binding annotations given in the HIR for a binding. Note
|
||||
/// that this is not the final binding *mode* that we infer after type
|
||||
/// inference.
|
||||
|
@ -732,13 +741,6 @@ impl BindingAnnotation {
|
|||
Self::MUT_REF_MUT => "mut ref mut ",
|
||||
}
|
||||
}
|
||||
|
||||
pub fn cap_ref_mutability(mut self, mutbl: Mutability) -> Self {
|
||||
if let ByRef::Yes(old_mutbl) = &mut self.0 {
|
||||
*old_mutbl = cmp::min(*old_mutbl, mutbl);
|
||||
}
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Encodable, Decodable, Debug)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue