-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
False positive with trivially_copy_pass_by_ref #2961
Comments
See #2951. It's partially fixed and the bug you're describing is (will be) in the known problems section of the lint. Still a bug though, that needs to be fixed somtimes. I don't see a problem with the second link you posted? |
@flip1995 There's no problem with the second line of code, I just wanted to provide the context of what the signature of |
False positive in Rust code: fn show_usize(x: &usize, f: &mut Formatter<'_>) -> Result {
Display::fmt(x, f)
} The error:
fn fmt(&self, f: &mut Formatter<'_>) -> Result; Quoting @eddyb from Discord:
|
@mati865 In that case, the What's happening is that we need that signature elsewhere (because we turn that function into a pointer). It should |
Possibly related false positive when a function is async (playground): pub async fn foo(x: &u8) -> &u8 { x } This code fails |
The following code falsely assumes that
value
can be converted from reference to value when the value is returned as a reference by the function.https://github.com/CraneStation/cranelift/blob/01de6842b1a3230db645a00f4ecf0176b5fdc65f/lib/codegen/src/regalloc/virtregs.rs#L100-L106
ref_slice
https://github.com/CraneStation/cranelift/blob/fb4acf8b5aaf63a96b9364d9b6f8d373fd8913c8/lib/codegen/src/ref_slice.rs#L12-L14
The text was updated successfully, but these errors were encountered: