-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Borrow checker thinks self is not mutable, when it is. #106325
New issue
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
Comments
I tried reproducing your issue in this playground and this is the error I got:
It doesn't complain about mutability though, but rather about a |
That does fix it, yea. I only have to add ?Sized to the first trait. Should I add it to all of these traits, or I will encounter this again? I am new to rust, and still not entirely sure what this means, or what it means for my trait. Thanks! |
…-diag, r=compiler-errors Suggest `mut self: &mut Self` for `?Sized` impls Closes rust-lang#106325 Closes rust-lang#93078 The suggestion is _probably_ not what the user wants (hence `MaybeIncorrect`) but at least makes the problem in the above issues clearer. It might be better to add a note explaining why this is the case, but I'm not sure how best to word that so this is a start. `@rustbot` label +A-diagnostics
I am trying to extend ByteOrder + Seek, and I have two traits, right now. The first is just extending ByteOrder, and the second extends ByteOrder + Seek
For some reason, I get this error when compiling, and it only occurs on the line with read_bytes.
There are two ways I can work around this, for now. One is by copying the
read_bytes
method into the other trait, which I don't really wanna do, or I found this goofy code will also work...Hopefully this helps clue you in on what is going on.
Is this a bug with the borrow checker?
Meta
rustc --version --verbose
:Backtrace
The text was updated successfully, but these errors were encountered: