Skip to content

Commit 1026e90

Browse files
committed
fix: pass ros_distro cfg so docs.rs shim builds can run
docs.rs has no ROS_DISTRO; build.rs must read --cfg ros_distro from rustc-args the same way rclrs does. Also document that String sequences share the primitive LayoutTail. Assisted-by: Cursor:auto [Cursor Agent]
1 parent a3cacda commit 1026e90

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

rosidl_runtime_rs/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,5 @@ rustflags = "0.1"
4444

4545
[package.metadata.docs.rs]
4646
features = ["use_ros_shim"]
47+
# build.rs reads this via rustflags under use_ros_shim (same pattern as rclrs)
48+
rustc-args = ["--cfg", "ros_distro=\"humble\""]

rosidl_runtime_rs/src/traits.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,13 @@
1818
use std::{borrow::Cow, fmt::Debug};
1919

2020
/// Gives a `Sequence<T>` the trailing ABI fields that match
21-
/// `rosidl_runtime_c__<T>__Sequence` for its element type: [`crate::BufferFlags`]
22-
/// for primitive elements on distros that carry them, `()` otherwise.
21+
/// `rosidl_runtime_c__<T>__Sequence` for its element type.
22+
///
23+
/// Starting with Lyrical, every C type declared through
24+
/// `ROSIDL_RUNTIME_C__PRIMITIVE_SEQUENCE` has two trailing flags. That macro
25+
/// covers numeric primitives **and** `String`/`U16String`, so those element
26+
/// types use [`crate::BufferFlags`] on Lyrical+ and `()` on Humble/Jazzy/Kilted.
27+
/// Message element types always use `()`, their C sequences were not extended.
2328
///
2429
/// Kept separate from [`SequenceAlloc`] so that trait stays about the C alloc
2530
/// functions. User code never needs to implement this.

0 commit comments

Comments
 (0)