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

Method calls don't autoderef #2212

Closed
brson opened this issue Apr 15, 2012 · 2 comments
Closed

Method calls don't autoderef #2212

brson opened this issue Apr 15, 2012 · 2 comments
Assignees
Labels
A-type-system Area: Type system

Comments

@brson
Copy link
Contributor

brson commented Apr 15, 2012

Field access does.

impl i for int {
    fn val() -> str { "wut" }
}

fn main() {
    let j = @{
        val: 10
    };
    // This autoderefs
    assert j.val == 10;

    let i = @10;
    // This does not
    assert i.val() == "wut";
}
../src/test/run-pass/method-autoderef.rs:12:11: 12:16 error: attempted access of field val on type @int, but no public field or method with that name was found
../src/test/run-pass/method-autoderef.rs:12     assert i.val() == "wut";
@nikomatsakis
Copy link
Contributor

I've been thinking about this for a while, actually. The reason is clear: it's nice to make impls over types like @T, and if we always auto-deref'd prior to scanning for impl matches, that wouldn't work. I don't know if the right behavior is to scan for matches with the original type, then auto-deref, then scan again, or what. It's an annoying problem.

@msullivan
Copy link
Contributor

Niko fixed this, right?

bors added a commit to rust-lang-ci/rust that referenced this issue Sep 22, 2022
update and move cargo-miri operational description
celinval added a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
I don't think we should discourage people from looking into Kani so I'm changing the words here. I also changed the reference to point to bolero instead of proptest.
Kobzol pushed a commit to Kobzol/rust that referenced this issue Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-type-system Area: Type system
Projects
None yet
Development

No branches or pull requests

3 participants