rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
93.58k stars 12.05k forks source link

Fix insufficient logic when searching for the underlying allocation #124761

Closed Urgau closed 1 week ago

Urgau commented 1 week ago

This PR fixes the logic inside the invalid_reference_casting lint, when trying to lint on bigger memory layout casts.

More specifically when looking for the "underlying allocation" we were wrongly assuming that when we got &mut slice[index] that slice[index] was the allocation, but it's not.

Fixes https://github.com/rust-lang/rust/issues/124685

rustbot commented 1 week ago

r? @jieyouxu

rustbot has assigned @jieyouxu. They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

jieyouxu commented 1 week ago

Thanks!

@bors r+ rollup

bors commented 1 week ago

:pushpin: Commit cd6a0c8c77575056f95d79ae1f5c460794e1388f has been approved by jieyouxu

It is now in the queue for this repository.