Skip to content

Commit b13b328

Browse files
authored
Fix HSTRING to conform to Rust's aliasing rules (#2057)
1 parent 49317c3 commit b13b328

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

crates/libs/windows/src/core/strings/hstring.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,11 +408,11 @@ impl Header {
408408
header
409409
}
410410

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

0 commit comments

Comments
 (0)