adnanademovic/rosrust

Generate const token bug

Closed this issue · 0 comments

The rosrust_codegen/src/msg.rs:529

quote! { #name; bool = #bool_value }

should be

quote! { #name: bool = #bool_value }

The ";" but should be ":".

This bug will cause a compile error when generating the constant values in Overall message.

error: expected one of `!` or `::`, found `=`

in rosrust::rosmsg_include!(..., IGNORE_BAD) line.

With this bug, we will get:

    impl Overall {
        #[allow(dead_code, non_upper_case_globals)]
        pub const c_bool_t: _;
    }

but this const field part should be:

    impl Overall {
        #[allow(dead_code, non_upper_case_globals)]
        pub const c_bool_t: bool = true;
        #[allow(dead_code, non_upper_case_globals)]
        pub const c_bool_f: bool = false;
        #[allow(dead_code, non_upper_case_globals)]
        pub const c_int8: i8 = -55i8 as i8;
        #[allow(dead_code, non_upper_case_globals)]
        pub const c_int16: i16 = -55i16 as i16;
        #[allow(dead_code, non_upper_case_globals)]
        pub const c_int32: i32 = -55i32 as i32;
        #[allow(dead_code, non_upper_case_globals)]
        pub const c_int64: i64 = -55i64 as i64;
        #[allow(dead_code, non_upper_case_globals)]
        pub const c_uint8: u8 = 55u8 as u8;
        #[allow(dead_code, non_upper_case_globals)]
        pub const c_uint16: u16 = 55u16 as u16;
        #[allow(dead_code, non_upper_case_globals)]
        pub const c_uint32: u32 = 55u32 as u32;
        #[allow(dead_code, non_upper_case_globals)]
        pub const c_uint64: u64 = 55u64 as u64;
        #[allow(dead_code, non_upper_case_globals)]
        pub const c_float32: f32 = -55f32 as f32;
        #[allow(dead_code, non_upper_case_globals)]
        pub const c_float64: f64 = -55f64 as f64;
        #[allow(dead_code, non_upper_case_globals)]
        pub const c_string: &'static str =
            "Things \'in\' here should \"be able\" # to go crazy with \\ escapes";
    }