Skip to content

Commit

Permalink
Fix HSTRING to conform to Rust's aliasing rules (#2057)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisDenton committed Sep 22, 2022
1 parent 49317c3 commit b13b328
Showing 1 changed file with 2 additions and 2 deletions.
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

0 comments on commit b13b328

Please sign in to comment.