Skip to content

Commit cc5f205

Browse files
committed
build!: declare extern blocks as unsafe to comply with Rust 2024
Signed-off-by: Esteve Fernandez <esteve@apache.org>
1 parent ea7df53 commit cc5f205

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

rosidl_runtime_rs/src/sequence.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ impl std::error::Error for SequenceExceedsBoundsError {}
503503
macro_rules! impl_sequence_alloc_for_primitive_type {
504504
($rust_type:ty, $init_func:ident, $fini_func:ident, $copy_func:ident) => {
505505
#[link(name = "rosidl_runtime_c")]
506-
extern "C" {
506+
unsafe extern "C" {
507507
fn $init_func(seq: *mut Sequence<$rust_type>, size: usize) -> bool;
508508
fn $fini_func(seq: *mut Sequence<$rust_type>);
509509
fn $copy_func(

rosidl_runtime_rs/src/string.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ pub struct StringExceedsBoundsError {
116116
macro_rules! string_impl {
117117
($string:ty, $char_type:ty, $unsigned_char_type:ty, $string_conversion_func:ident, $init:ident, $fini:ident, $assignn:ident, $sequence_init:ident, $sequence_fini:ident, $sequence_copy:ident) => {
118118
#[link(name = "rosidl_runtime_c")]
119-
extern "C" {
119+
unsafe extern "C" {
120120
fn $init(s: *mut $string) -> bool;
121121
fn $fini(s: *mut $string);
122122
fn $assignn(s: *mut $string, value: *const $char_type, n: usize) -> bool;

0 commit comments

Comments
 (0)