Attention is currently required from: Adrian Taylor.
Patch set 2:Auto-Submit +1Commit-Queue +1
To view, visit change 3560901. To unsubscribe, or for help writing mail filters, visit settings.
Attention is currently required from: Adrian Taylor.
1 comment:
Patchset:
adetaylor: bump?
To view, visit change 3560901. To unsubscribe, or for help writing mail filters, visit settings.
Attention is currently required from: danakj.
Patch set 2:Code-Review +1Commit-Queue +2
Chromium LUCI CQ submitted this change.
Fix test generated crate roots when modules have `..` path components
A `..` symbol can't be part of a Rust module name, so convert it into
a string that is valid in a Rust identifier.
This popped up when //content/test:content_unittests has modules at
"../browser/..." and "../renderer/..." etc.
R=adet...@chromium.org
Bug: 1305396
Change-Id: I6a7e4db46c158b39c4e6df3f61ce8d9414b81f9e
Cq-Include-Trybots: luci.chromium.try:android-rust-arm-dbg,android-rust-arm-rel,linux-rust-x64-rel,linux-rust-x64-dbg
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3560901
Auto-Submit: danakj <dan...@chromium.org>
Reviewed-by: Adrian Taylor <adet...@chromium.org>
Commit-Queue: Adrian Taylor <adet...@chromium.org>
Cr-Commit-Position: refs/heads/main@{#987580}
---
M build/rust/rust_target.gni
1 file changed, 34 insertions(+), 1 deletion(-)
diff --git a/build/rust/rust_target.gni b/build/rust/rust_target.gni
index 63bae4c9..1117e07 100644
--- a/build/rust/rust_target.gni
+++ b/build/rust/rust_target.gni
@@ -63,7 +63,16 @@
foreach(rs, invoker.sources) {
rs_path_from_root = rebase_path(rs, target_gen_dir)
contents += [ "#[path = \"${rs_path_from_root}\"]" ]
- rs_modname = string_replace(string_replace(rs, "/", "_"), ".rs", "")
+
+ # Drop the file extension from the module name.
+ rs_modname = string_replace(rs, ".rs", "")
+
+ # Replace invalid "/" chars in the source file path.
+ rs_modname = string_replace(rs_modname, "/", "_")
+
+ # Since source files are specified relative to the BUILD.gn they may
+ # also have ".." path components.
+ rs_modname = string_replace(rs_modname, "..", "dotdot")
contents += [
"mod ${rs_modname};",
"",
To view, visit change 3560901. To unsubscribe, or for help writing mail filters, visit settings.