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 lookup fails for operator #21922

Closed
sellibitze opened this Issue Feb 4, 2015 · 3 comments

Comments

Projects
None yet
6 participants
@sellibitze
Copy link
Contributor

sellibitze commented Feb 4, 2015

libcore/ops.rs provides all kinds of operator implementations for “value” and “reference type” combinations. But one thing does not seem to work like it should:

use std::ops::Add;
fn show(z: i32) {
    println!("{}", z)
}
fn main() {
    let x = 23;
    let y = 42;
    show(Add::add( x,  y));
    show(Add::add( x, &y));
    show(Add::add(&x,  y));
    show(Add::add(&x, &y));
    show( x +  y);
    show( x + &y);  // <-- everything but this works
    show(&x +  y);
    show(&x + &y);
}

I think there is a problem with how these methods are looked up because the UFCS apparently works. This issue currently kind of blocks the libcoretest/ops.rs tests I was planning to add.

cc @aturon

@aturon

This comment has been minimized.

Copy link
Member

aturon commented Mar 10, 2015

@aturon

This comment has been minimized.

Copy link
Member

aturon commented Mar 10, 2015

triage: I-nominated

@rust-highfive rust-highfive added this to the 1.0 beta milestone Mar 10, 2015

@nrc nrc removed this from the 1.0 beta milestone Mar 11, 2015

@pnkfelix

This comment has been minimized.

Copy link
Member

pnkfelix commented Mar 12, 2015

@nikomatsakis points out that Dissecting how we type-check plus is important.

But, for this particular bug, we are going to categorize it as P-high, not a 1.0 blocker.

@pnkfelix pnkfelix added P-medium and removed I-nominated labels Mar 12, 2015

bors added a commit that referenced this issue Sep 30, 2015

@bors bors closed this in #28730 Sep 30, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.