Fix starlark linker errors for clean builds

build/gen.py would set CXXFLAGS when building cargo tests, which would
allow cxx to use C++20 features. Incremental builds would then reuse
that, thus ensuring string_view support was added, even though it was
never specified in Cargo.toml.

Bug: 528225104
Change-Id: Ia55e2b7aaa8729cd268193451ed126576a6a6964
Reviewed-on: https://gn-review.googlesource.com/c/gn/+/24600
Reviewed-by: Takuto Ikuta <tikuta@google.com>
Commit-Queue: Matt Stark <msta@google.com>
diff --git a/src/gn/starlark/Cargo.toml b/src/gn/starlark/Cargo.toml
index abcc8e2..2072cdd 100644
--- a/src/gn/starlark/Cargo.toml
+++ b/src/gn/starlark/Cargo.toml
@@ -27,7 +27,9 @@
 [workspace.dependencies]
 allocative = "0.3"
 anyhow = "1.0"
-cxx = "1.0"
+# cxx's C++ version must be <= GN's C++ version. This does not need to be kept
+# in sync unless you're trying to use new C++ features in the bridge.
+cxx = { version = "1.0", features = ["c++20"] }
 either = "1.16"
 starlark = "0.14"
 starlark_derive = "0.14"