Skip to content

RefCell and &mut ~Trait strange syntax is required. #13307

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
dpc opened this issue Apr 4, 2014 · 1 comment
Closed

RefCell and &mut ~Trait strange syntax is required. #13307

dpc opened this issue Apr 4, 2014 · 1 comment

Comments

@dpc
Copy link
Contributor

dpc commented Apr 4, 2014

use std::cell::RefCell;

trait Foo {}

impl Foo for () {}

fn main() {
    let foo: RefCell<~Foo> = RefCell::new(~() as ~Foo);
    let fooref: &mut Foo = *&mut *foo.borrow_mut();
    println!("{:?}", fooref);
}

Is this really required? Thanks Eridius for helping me get this to work.

@lilyball
Copy link
Contributor

lilyball commented Apr 4, 2014

I just filed this already as #13305

@lilyball lilyball closed this as completed Apr 4, 2014
arcnmx pushed a commit to arcnmx/rust that referenced this issue Dec 17, 2022
…bold

fix: normalize projection after discarding free `BoundVar`s in RPIT

Fixes rust-lang#13307

When we lower the return type of a function, it may contain free `BoundVar`s in `OpaqueType`'s substitution, which would cause panic during canonicalization as part of projection normalization. Those `BoundVar`s are irrelevant in this context and will be discarded, and we should defer projection normalization until then.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants