I don't understand the stacked borrowing rules enough to understand why the
existing code is a violation. It is creating a mutable unsafe pointer; then
taking some immutable borrows to the same data while doing nothing with that
pointer; then later using the pointer.
Simply moving the creation of the unsafe pointer to immediately before it
is used removes the error.
Found with miri, which reports:
```
error: Undefined Behavior: trying to reborrow for SharedReadOnly, but parent tag <1121039> does not have an appropriate item in the borrow sta
ck
--> components/tidb_query_vec_executors/src/slow_hash_aggr_executor.rs:281:32
|
281 | let offset_begin = self.group_key_buffer.len();
| ^^^^^^^^^^^^^^^^^^^^^ trying to reborrow for SharedReadOnly, but parent tag <1121039> does not have an ap
propriate item in the borrow stack
|
= help: this indicates a potential bug in the program: it performed an invalid operation, but the rules it violated are still experimental
= help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md for further information
```
Signed-off-by: Brian Anderson <andersrb@gmail.com>