-
Notifications
You must be signed in to change notification settings - Fork 13.3k
IndexMut incorrectly chosen instead of Index #28935
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'm also running into something that appears to be this issue. I'm indexing a Vec, so the implementation of IndexMut is not under my control. I can try to make a reduced example using Vec if it would be helpful. EDIT: oh, it seems that 29869 already contains such an example. |
Just wanted to note that I encountered this bug. |
This came up on Stack Overflow. A simplified example: use std::cell::RefCell;
fn f(v: Vec<RefCell<u8>>) {
let _t = &mut *v[0].borrow_mut();
}
fn main() {}
Workarounds include:
|
This compiles now. Marking as needs-test (unsure if there is one that covers this already) |
…askrgr Rollup of 5 pull requests Successful merges: - rust-lang#96154 (Expand core::hint::unreachable_unchecked() docs) - rust-lang#96615 (Add a regression test for rust-lang#54779) - rust-lang#96982 (fix clippy expect_fun_call) - rust-lang#97003 (Remove some unnecessary `rustc_allow_const_fn_unstable` attributes.) - rust-lang#97011 (Add regression test for rust-lang#28935) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
The whole example compiles it the
IndexMut
implementation is removed.The text was updated successfully, but these errors were encountered: