Skip to content
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

reborrow or copy-then-borrow #13967

Open
bingmatv opened this issue Jan 9, 2025 · 0 comments · May be fixed by #13984
Open

reborrow or copy-then-borrow #13967

bingmatv opened this issue Jan 9, 2025 · 0 comments · May be fixed by #13984
Assignees
Labels
A-lint Area: New lints

Comments

@bingmatv
Copy link

bingmatv commented Jan 9, 2025

What it does

Warn when the code tries to copy the value behind a reference, then borrow the copy.

Advantage

No response

Drawbacks

No response

Example

fn main() {
    let a = &[0u8; 2];
    let r = &mut { *a };
}

Similar to https://users.rust-lang.org/t/runtime-speed-when-converting-as-bytes-or-as-ref-to-be-mut/123712/10 that tries to convert a reference to mutably borrow.

@bingmatv bingmatv added the A-lint Area: New lints label Jan 9, 2025
@samueltardieu samueltardieu self-assigned this Jan 11, 2025
@samueltardieu samueltardieu linked a pull request Jan 11, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: New lints
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants