Skip to content

Chaining Arc<RefCell<..>> confuses borrowck. #26706

Closed
@dpc

Description

@dpc

http://is.gd/rNjThX

use std::sync::Arc;
use std::cell::RefCell;

struct A {
    a : Arc<RefCell<i32>>
}

struct B {
    b : Arc<RefCell<A>>
}

impl B {
    fn is_foo(&self) -> bool {
        *self.b.borrow().a.borrow() == 2
    }
}

This should compile, but it does not. Breaking the chain is a workaround.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lifetimesArea: Lifetimes / regions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions