xso-proc: update inline comment with resolution from upstream bug

Jonas Schäfer created

Reminder: when something feels too good to be true, it likely is.

skip-changelog, because this is no user-facing change.

Change summary

xso-proc/src/compound.rs | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)

Detailed changes

xso-proc/src/compound.rs 🔗

@@ -278,7 +278,13 @@ impl Compound {
                     format!("{}", name_b)
                 };
 
-                // See TODO below for why we do the extra replace calls.
+                // We need to escape `{` and `}` because we feed it into
+                // a generated `panic!()` as message template below. We cannot
+                // do something like `panic!("member {} […]", #field_a, […])`,
+                // because rustc does not allow that in a const context.
+                // (It *did* briefly (and unintentionally, see
+                // https://github.com/rust-lang/rust/issues/140585 ) allow
+                // that in version 1.86, but that was rolled back.
                 let attr_a = attr_a.replace('{', "{{").replace('}', "}}");
                 let attr_b = attr_b.replace('{', "{{").replace('}', "}}");
                 let field_a = FieldName(&member_a)
@@ -295,11 +301,6 @@ impl Compound {
                 // is never used.
                 checks.extend(quote_spanned! {span=>
                     const _: () = { if #check {
-                        // TODO: Rust nightly from 2025-05-02 (or around that date) didn't like our fancy panic, so we use something simpler.
-                        // Filed bug upstream: https://github.com/rust-lang/rust/issues/140585
-                        // For now, we work around this because it breaks our docs builds...
-                        //panic!("member {} and member {} match the same XML attribute: {} == {}", #field_a, #field_b, #attr_a, #attr_b);
-                        // Note that we cannot replace it with concat!(..), because we may have `{` and `}` in the strings...
                         panic!(concat!("member ", #field_a, " and member ", #field_b, " match the same XML attribute: ", #attr_a, " == ", #attr_b));
                     } };
                 })