-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Emit a warning around thin &CStr interior mutability breaks #118513
Copy link
Copy link
Open
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
From @chorman0773 https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/CStr.20as.20thin.20pointer/near/405432566
Passing an
&UnsafeCell<CStr>tosize_of_valis currently sound because it just returns the length parameter of the fat pointer. After makingCStrthin however,size_of_valwill need to callstrlenon the data. This is not ok in a&UnsafeCellbecause another context could be writing the data, e.g. temporarily overwriting the\0.This seems like something we may be able to emit a warning for?
Thin cstr: #59905
@rustbot label +T-libs +T-compiler +A-diagnostics