@@ -21,7 +21,7 @@ pub fn render(
2121
2222 let name_pc = Ident :: new ( & * p. name . to_sanitized_upper_case ( ) ) ;
2323 let address = util:: hex ( p. base_address ) ;
24- let description = util:: respace ( p. description . as_ref ( ) . unwrap_or ( & p. name ) ) ;
24+ let description = util:: escape_brackets ( util :: respace ( p. description . as_ref ( ) . unwrap_or ( & p. name ) ) . as_ref ( ) ) ;
2525
2626 let name_sc = Ident :: new ( & * p. name . to_sanitized_snake_case ( ) ) ;
2727 let ( base, derived) = if let Some ( base) = p. derived_from . as_ref ( ) {
@@ -95,7 +95,7 @@ pub fn render(
9595 ) ?) ;
9696 }
9797
98- let description = util:: respace ( p. description . as_ref ( ) . unwrap_or ( & p. name ) ) ;
98+ let description = util:: escape_brackets ( util :: respace ( p. description . as_ref ( ) . unwrap_or ( & p. name ) ) . as_ref ( ) ) ;
9999 out. push ( quote ! {
100100 #[ doc = #description]
101101 pub mod #name_sc {
@@ -396,7 +396,7 @@ fn register_or_cluster_block_stable(
396396 let comment = & format ! (
397397 "0x{:02x} - {}" ,
398398 reg_block_field. offset,
399- util:: respace( & reg_block_field. description) ,
399+ util:: escape_brackets ( util :: respace( & reg_block_field. description) . as_ref ( ) ) ,
400400 ) [ ..] ;
401401
402402 fields. append ( quote ! {
@@ -473,14 +473,13 @@ fn register_or_cluster_block_nightly(
473473 let comment = & format ! (
474474 "0x{:02x} - {}" ,
475475 reg_block_field. offset,
476- util:: respace( & reg_block_field. description) ,
476+ util:: escape_brackets ( util :: respace( & reg_block_field. description) . as_ref ( ) ) ,
477477 ) [ ..] ;
478478
479479 region_fields. append ( quote ! {
480480 #[ doc = #comment]
481481 } ) ;
482482
483-
484483 reg_block_field. field . to_tokens ( & mut region_fields) ;
485484 Ident :: new ( "," ) . to_tokens ( & mut region_fields) ;
486485 }
@@ -718,7 +717,7 @@ fn cluster_block(
718717 let mut mod_items: Vec < Tokens > = vec ! [ ] ;
719718
720719 // name_sc needs to take into account array type.
721- let description = util:: respace ( & c. description ) ;
720+ let description = util:: escape_brackets ( util :: respace ( & c. description ) . as_ref ( ) ) ;
722721
723722 // Generate the register block.
724723 let mod_name = match * c {
0 commit comments