Files
rust/compiler/rustc_session
Jonathan Brouwer 47ce0db55b Rollup merge of #157788 - PiJoules:multiple-sanitizer-flags, r=petrochenkov
Accumulate multiple -Zsanitizer target modifiers

When passing multiple `-Zsanitizer` flags to the compiler (e.g., `-Zsanitizer=address -Zsanitizer=shadow-call-stack`), the options parser was overwriting the previous values in `target_modifiers` instead of accumulating them. This resulted in only the last sanitizer being recorded in the crate metadata's target modifiers, even though the frontend correctly enabled all of them. The only way to provide multiple sanitizers is to combine them into a comma-separated list passed to a single `-Zsanitizer=` flag, but this doesn't fit very well into the GN build system where different targets may pass different combinations of sanitizer flags.

Consequently, this caused spurious "incompatible target modifiers" ABI mismatch errors when linking against dependencies compiled with accumulated flags.

Fix this by entry-modifying the `target_modifiers` map to accumulate the sanitizers as a comma-separated list when the option is `sanitizer`.
2026-06-17 22:36:21 +02:00
..