Skip to content

Commit

Permalink
Add comment on macro hygenics bug
Browse files Browse the repository at this point in the history
Co-authored-by: Jubilee <46493976+workingjubilee@users.noreply.github.com>
  • Loading branch information
ChrisDenton and workingjubilee authored Apr 9, 2024
1 parent ae03f89 commit 614e793
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion library/std/src/sys/pal/windows/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ macro_rules! wide_str {

/// Creates a UTF-16 string from a str without null termination.
macro_rules! utf16 {
// Note: this macro uses triple underscores to avoid const cycles
// Note: this macro uses triple underscores to avoid const cycles which,
// despite macro hygienics, occur if we use a const with the same name
// as an argument to the macro, see issue rust-lang/rust#123691
($str:expr) => {{
const ___UTF8: &str = $str;
const ___UTF16_LEN: usize = crate::sys::pal::windows::api::utf16_len(___UTF8);
Expand Down

0 comments on commit 614e793

Please sign in to comment.