Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Rust toolchain to 1.71.0 and remove pydocstyle workaround #321

Merged
merged 3 commits into from
Jul 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,8 @@ jobs:
required-ros-distributions: ${{ matrix.ros_distribution }}
use-ros2-testing: ${{ matrix.ros_distribution == 'rolling' }}

- name: Downgrade pydocstyle as a workaround for https://github.com/ament/ament_lint/issues/434
run: |
sudo pip install pydocstyle==6.1.1

- name: Setup Rust
uses: dtolnay/rust-toolchain@1.63.0
uses: dtolnay/rust-toolchain@1.71.0
with:
components: clippy, rustfmt

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ RUN apt-get update && apt-get install -y \
&& rm -rf /var/lib/apt/lists/*

# Install Rust and the cargo-ament-build plugin
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain 1.63.0 -y
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain 1.71.0 -y
ENV PATH=/root/.cargo/bin:$PATH
RUN cargo install cargo-ament-build

Expand Down
2 changes: 1 addition & 1 deletion rclrs/src/dynamic_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ fn get_type_support_library(
let ament = ament_rs::Ament::new().map_err(|_| RequiredPrefixNotSourced {
package: package_name.to_owned(),
})?;
let prefix = PathBuf::from(ament.find_package(&package_name).ok_or(
let prefix = PathBuf::from(ament.find_package(package_name).ok_or(
RequiredPrefixNotSourced {
package: package_name.to_owned(),
},
Expand Down
2 changes: 1 addition & 1 deletion rclrs/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,6 @@ pub(crate) trait ToResult {

impl ToResult for rcl_ret_t {
fn ok(&self) -> Result<(), RclrsError> {
to_rclrs_result(*self as i32)
to_rclrs_result(*self)
}
}
2 changes: 1 addition & 1 deletion rclrs/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ impl Node {
&self,
getter: unsafe extern "C" fn(*const rcl_node_t) -> *const c_char,
) -> String {
unsafe { call_string_getter_with_handle(&*self.rcl_node_mtx.lock().unwrap(), getter) }
unsafe { call_string_getter_with_handle(&self.rcl_node_mtx.lock().unwrap(), getter) }
}

/// Creates a [`Client`][1].
Expand Down
4 changes: 2 additions & 2 deletions rclrs/src/parameter/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ mod tests {
assert!(!rcl_params.is_null());
assert_eq!(unsafe { (*rcl_params).num_nodes }, 1);
let rcl_node_params = unsafe { &(*(*rcl_params).params) };
assert_eq!((*rcl_node_params).num_params, 1);
let rcl_variant = unsafe { &(*(*rcl_node_params).parameter_values) };
assert_eq!(rcl_node_params.num_params, 1);
let rcl_variant = unsafe { &(*rcl_node_params.parameter_values) };
let param_value = unsafe { ParameterValue::from_rcl_variant(rcl_variant) };
assert_eq!(param_value, pair.1);
unsafe { rcl_yaml_node_struct_fini(rcl_params) };
Expand Down
2 changes: 1 addition & 1 deletion rclrs/src/subscription.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ where
///
/// This can be more efficient for messages containing large arrays.
pub fn take_boxed(&self) -> Result<(Box<T>, MessageInfo), RclrsError> {
let mut rmw_message = Box::new(<T as Message>::RmwMsg::default());
let mut rmw_message = Box::<<T as Message>::RmwMsg>::default();
let message_info = self.take_inner(&mut *rmw_message)?;
// TODO: This will still use the stack in general. Change signature of
// from_rmw_message to allow placing the result in a Box directly.
Expand Down
5 changes: 5 additions & 0 deletions rclrs/src/vendor/rcl_interfaces/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ pub mod rmw {
pub description: rosidl_runtime_rs::String,
pub additional_constraints: rosidl_runtime_rs::String,
pub read_only: bool,
pub dynamic_typing: bool,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this break backwards compatibility with humble?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Humble does have a dynamic_typing field as well (https://github.com/ros2/rcl_interfaces/blob/humble/rcl_interfaces/msg/ParameterDescriptor.msg#L25), so this should be ok.

pub floating_point_range: rosidl_runtime_rs::BoundedSequence<
crate::vendor::rcl_interfaces::msg::rmw::FloatingPointRange,
1,
Expand Down Expand Up @@ -1269,6 +1270,7 @@ pub struct ParameterDescriptor {
pub description: std::string::String,
pub additional_constraints: std::string::String,
pub read_only: bool,
pub dynamic_typing: bool,
pub floating_point_range: rosidl_runtime_rs::BoundedSequence<
crate::vendor::rcl_interfaces::msg::rmw::FloatingPointRange,
1,
Expand Down Expand Up @@ -1298,6 +1300,7 @@ impl rosidl_runtime_rs::Message for ParameterDescriptor {
description: msg.description.as_str().into(),
additional_constraints: msg.additional_constraints.as_str().into(),
read_only: msg.read_only,
dynamic_typing: msg.dynamic_typing,
floating_point_range: msg.floating_point_range,
integer_range: msg.integer_range,
}),
Expand All @@ -1307,6 +1310,7 @@ impl rosidl_runtime_rs::Message for ParameterDescriptor {
description: msg.description.as_str().into(),
additional_constraints: msg.additional_constraints.as_str().into(),
read_only: msg.read_only,
dynamic_typing: msg.dynamic_typing,
floating_point_range: msg.floating_point_range.clone(),
integer_range: msg.integer_range.clone(),
}),
Expand All @@ -1320,6 +1324,7 @@ impl rosidl_runtime_rs::Message for ParameterDescriptor {
description: msg.description.to_string(),
additional_constraints: msg.additional_constraints.to_string(),
read_only: msg.read_only,
dynamic_typing: msg.dynamic_typing,
floating_point_range: msg.floating_point_range,
integer_range: msg.integer_range,
}
Expand Down
2 changes: 1 addition & 1 deletion rclrs/vendor_interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ def main():


if __name__ == '__main__':
main()
main()