-
Notifications
You must be signed in to change notification settings - Fork 13.3k
dangerous_implicit_autorefs
suggestion is wrong
#140721
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
The two warnings are not duplicated. They warn on two different part of the expression. Applying both suggestions make the warnings disappear. unsafe fn slice_ptr_len_because_of_msrv<T>(slice: *const [T]) -> usize {
unsafe { (&(&(*slice))[..]).len() }
} |
I may be wrong, but the way I understand the first warning is that it indicates that the autoref happens between |
The autoref actually happens on the slice operation |
For the compiler, And because the It's unclear to me if it's a bug. cc @traviscross |
Improve `dangerous_implicit_aurorefs` diagnostic output This PR *greatly* improves the `dangerous_implicit_aurorefs` lint diagnostic output. Kind of related to rust-lang#140721. r? `@jieyouxu` (maybe)
Improve `dangerous_implicit_aurorefs` diagnostic output This PR *greatly* improves the `dangerous_implicit_aurorefs` lint diagnostic output. Kind of related to rust-lang#140721. r? ``@jieyouxu`` (maybe)
Improve `dangerous_implicit_aurorefs` diagnostic output This PR *greatly* improves the `dangerous_implicit_aurorefs` lint diagnostic output. Kind of related to rust-lang#140721. r? ```@jieyouxu``` (maybe)
Rollup merge of rust-lang#140768 - Urgau:improv_autorefs-lint, r=fmease Improve `dangerous_implicit_aurorefs` diagnostic output This PR *greatly* improves the `dangerous_implicit_aurorefs` lint diagnostic output. Kind of related to rust-lang#140721. r? ```@jieyouxu``` (maybe)
The following code:
gives the two following warnings
I the first warning is quite a duplicate of the second one, and its suggestion is also wrong, as
(&(*slice)[..]).len()
would still trigger the warning.The text was updated successfully, but these errors were encountered: