about summary refs log tree commit diff
path: root/src/libstd/sys/unix/stack_overflow.rs
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2020-05-19 13:53:43 +0200
committerGitHub <noreply@github.com>2020-05-19 13:53:43 +0200
commit79ac73a3fc7364409ae261db024f535c10ebc9a7 (patch)
tree9a19da7fafac2b1aea31e9f8954ed232a3cebe9c /src/libstd/sys/unix/stack_overflow.rs
parent12040cf665b55f10a68818d116265eeea3b082e6 (diff)
parent0dcde02cc7bdd47f48af12e911829390c2864c47 (diff)
downloadrust-79ac73a3fc7364409ae261db024f535c10ebc9a7.tar.gz
rust-79ac73a3fc7364409ae261db024f535c10ebc9a7.zip
Rollup merge of #72068 - estebank:mut-deref-hack, r=oli-obk
Ignore arguments when looking for `IndexMut` for subsequent `mut` obligation

Given code like `v[&field].boo();` where `field: String` and
`.boo(&mut self)`, typeck will have decided that `v` is accessed using
`Index`, but when `boo` adds a new `mut` obligation,
`convert_place_op_to_mutable` is called. When this happens, for *some
reason* the arguments' dereference adjustments are completely ignored
causing an error saying that `IndexMut` is not satisfied:

```
error[E0596]: cannot borrow data in an index of `Indexable` as mutable
  --> src/main.rs:30:5
   |
30 |     v[&field].boo();
   |     ^^^^^^^^^ cannot borrow as mutable
   |
   = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `Indexable`
```

This is not true, but by changing `try_overloaded_place_op` to retry
when given `Needs::MutPlace` without passing the argument types, the
example successfully compiles.

I believe there might be more appropriate ways to deal with this.

Fix #72002.
Diffstat (limited to 'src/libstd/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions