Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Can not borrow a &Trait from a & &mut Trait #9953

Closed
Kimundi opened this issue Oct 19, 2013 · 2 comments
Closed

Can not borrow a &Trait from a & &mut Trait #9953

Kimundi opened this issue Oct 19, 2013 · 2 comments

Comments

@Kimundi
Copy link
Member

Kimundi commented Oct 19, 2013

Maybe I'm missing something, but afaik the only way to do this is with automatic coercion at the moment, which does not work here:

trait Bar{}
impl Bar for uint {};

let x = &mut 7u as &mut Bar;
let y = &x; 
let z: &Bar = *y;
<anon>:9:97: 9:99 error: cannot borrow an `&mut` in a `&` pointer; try an `&mut` instead
<anon>:9         trait Bar{} impl Bar for uint {}; let x = &mut 7u as &mut Bar; let y = &x; let z: &Bar = *y;
                                                                                                          ^~
@Kimundi
Copy link
Member Author

Kimundi commented Oct 19, 2013

See also #9629

@nikomatsakis
Copy link
Contributor

This is pretty much a dup of #9629.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants