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

Fix HSTRING to conform to Rust's aliasing rules #2057

Merged
merged 1 commit into from Sep 22, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/libs/windows/src/core/strings/hstring.rs
Expand Up @@ -408,11 +408,11 @@ impl Header {
header
}

fn duplicate(&mut self) -> *mut Header {
fn duplicate(&self) -> *mut Header {
if self.flags & REFERENCE_FLAG == 0 {
// If this is not a "fast pass" string then simply increment the reference count.
self.count.add_ref();
self
self as *const Header as *mut Header
} else {
// Otherwise, allocate a new string and copy the value into the new string.
let copy = Header::alloc(self.len);
Expand Down