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

auto-borrow and consistent behavior of pointers #13988

Closed
oblitum opened this issue May 6, 2014 · 1 comment
Closed

auto-borrow and consistent behavior of pointers #13988

oblitum opened this issue May 6, 2014 · 1 comment

Comments

@oblitum
Copy link

oblitum commented May 6, 2014

auto-deref has been added but I'm still interested in a more uniform behavior of custom pointers (meaning the ones that exist by trait implementation) and native ones (like the dying ~T).

An example situation:

use std::rc::Rc;

struct Bar { x: int }

fn foo(p: &int) {
    println!("{}", p);
}

fn baz(p: &Bar) {
    println!("{}", p.x);
}

fn main() {
    let pi = box 10;
    let pb = Rc::new(Bar {x: 3});
    foo(pi);
    // this still doesn't auto borrow:
    //baz(pb);
    // although this works:
    println!("{}", pb.x);
}

I've looked in #7141, #12491, #13542, #5527, #12825, #12610 and RFC 59 but could not grasp whether any would be addressing this or whether it's desirable, sorry if it's a duplicate.

@steveklabnik
Copy link
Member

Closing in favor of the linked RFC issue.

bors added a commit to rust-lang-ci/rust that referenced this issue Feb 13, 2023
Fix markdown removal in hover handling whitespace weirdly

Fixes rust-lang/rust-analyzer#10028
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