We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code:
struct Ref<T> { inner: T } impl<T> Deref<T> for Ref<T> { fn deref(&self) -> &T { &self.inner } } impl<T> DerefMut<T> for Ref<T> { fn deref_mut(&mut self) -> &mut T { &mut self.inner } } trait ImmutableRefTrait { fn immutable_borrow_method(&self) { () } } trait MutableRefTrait { fn mutable_borrow_method(&mut self) { () } } impl ImmutableRefTrait for uint {} impl MutableRefTrait for uint {} fn main() { let a = Ref { inner: 7u }; a.immutable_borrow_method(); }
Error:
test.rs:28:5: 28:6 error: cannot borrow immutable local variable `a` as mutable test.rs:28 a.immutable_borrow_method();
The text was updated successfully, but these errors were encountered:
Probably related to #15609.
Sorry, something went wrong.
I think this may be a dupe of #12825.
Confirmed as unrelated to #15609, dupe of #12825, can close.
Thanks @eddyb!
No branches or pull requests
Code:
Error:
The text was updated successfully, but these errors were encountered: