Allow mutating signature through ExternFn

This commit is contained in:
David Tolnay 2020-04-22 18:12:43 -07:00
parent 0b956da64a
commit 9bfbea37c7
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82

View File

@ -1,7 +1,7 @@
use crate::syntax::{ExternFn, Receiver, Ref, Signature, Slice, Ty1, Type};
use std::hash::{Hash, Hasher};
use std::mem;
use std::ops::Deref;
use std::ops::{Deref, DerefMut};
impl Deref for ExternFn {
type Target = Signature;
@ -11,6 +11,12 @@ impl Deref for ExternFn {
}
}
impl DerefMut for ExternFn {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.sig
}
}
impl Hash for Type {
fn hash<H: Hasher>(&self, state: &mut H) {
mem::discriminant(self).hash(state);