In https://drafts.csswg.org/css-values/#calc-serialize, section 3 says:
Otherwise, serialize as a calc() containing the summation, with the units ordered ASCII case-insensitive alphabetically, the number (if present) coming before all units, and the percentage (if present) coming after all units.
Servo implements this, and when testing it on Firefox, we've come across web compat bugs, in particular: https://bugzilla.mozilla.org/show_bug.cgi?id=1390496
That's a case where something has calc(100% - 2px).
Blink and Gecko serialize it as written. Servo serializes it as calc(-2px + 100%), following that section of the spec, and the page tries to parse that and messes it up, causing flickering. Not sure about what's Edge's behavior.
Needs like we need another algorithm for serializing calc() values?