Immutable borrow occur here

I have a problem when
immutable borrow occurs here,

pub struct ODXParser
    pub variants:HashMap<String, Arc<RefCell<Variant>>>,
    pub current_variant_name:String,
    pub variant_service_instances:HashMap<String,Vec<DiagServiceInstance>>

impl  ODXParser
    pub fn new()->ODXParser
        return ODXParser{variants:HashMap::new(),odxfile:String::new(),current_variant_name:String::default(),..Default::default()}
 pub fn set_pending(&mut self,param:&str,pending_value:&BitVec)

let parser = &mut ODXParser::new();

let variants = &parser.variants ;

parser.set_pending("RQ_FaultMemory_Read_identified_errors.DtcStatusbyte_STRUCTURE",&pending_value );

when i call set_pending, it complier said that there is immutable borrow at line
let variants = &parser.variants and it cannot be mutable borrow again, i am confused why immutable borrow happens for parser at let variants = &parser.variants ;

Would you mind filling in the gaps? This post sounds like a part of an error message. Some relevant source code, and a complete error message (as available in the terminal from cargo check) would be useful :slight_smile:

1 Like

Where exactly?