-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
dangling_pointers_from_temporaries lint is imprecise (false positives and false negatives) #78691
Copy link
Copy link
Open
Labels
A-FFIArea: Foreign function interface (FFI)Area: Foreign function interface (FFI)A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.Category: This is a bug.L-dangling_pointers_from_temporariesLint: dangling_pointers_from_temporariesLint: dangling_pointers_from_temporariesL-false-positiveLint: False positive (should not have fired).Lint: False positive (should not have fired).T-langRelevant to the language teamRelevant to the language team
Metadata
Metadata
Assignees
Labels
A-FFIArea: Foreign function interface (FFI)Area: Foreign function interface (FFI)A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.Category: This is a bug.L-dangling_pointers_from_temporariesLint: dangling_pointers_from_temporariesLint: dangling_pointers_from_temporariesL-false-positiveLint: False positive (should not have fired).Lint: False positive (should not have fired).T-langRelevant to the language teamRelevant to the language team
Type
Fields
Give feedbackNo fields configured for issues without a type.
I tried this code:
I get:
However since the CString is not deallocated until after the function call the code is fine and the warning should not trigger.
See https://rust.godbolt.org/z/vjrvGn for the assembly.