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

Multidispatch inference failure #18019

Closed
nikomatsakis opened this issue Oct 13, 2014 · 1 comment · Fixed by #18022
Closed

Multidispatch inference failure #18019

nikomatsakis opened this issue Oct 13, 2014 · 1 comment · Fixed by #18022
Labels
A-trait-system Area: Trait system A-type-system Area: Type system

Comments

@nikomatsakis
Copy link
Contributor

The following test should successfully compile but does not:

/// A trait for types that can be converted from a given error type `E`.
pub trait FromError<E> {
    /// Perform the conversion.
    fn from_error(err: E) -> Self;
}

// Any type is convertable from itself
impl<E> FromError<E> for E {
    fn from_error(err: E) -> E {
        err
    }
}

fn test() -> Result<(), ()> {
    Err(FromError::from_error(()))
}

fn main() {
    let result = (|| Err(FromError::from_error(())))();
    let foo: () = result.unwrap();
}

Fix forthcoming.

@nikomatsakis nikomatsakis changed the title Multidispatch inference feailure Multidispatch inference failure Oct 13, 2014
@nikomatsakis
Copy link
Contributor Author

cc @aturon

nikomatsakis added a commit to nikomatsakis/rust that referenced this issue Oct 13, 2014
@kmcallister kmcallister added A-type-system Area: Type system A-trait-system Area: Trait system labels Oct 15, 2014
bors added a commit that referenced this issue Oct 17, 2014
Only consider impliciy unboxed closure impl if the obligation is actually for `Fn`, `FnMut`, or `FnOnce`.

Fixes #18019

r? @pcwalton
bors added a commit that referenced this issue Oct 18, 2014
Only consider impliciy unboxed closure impl if the obligation is actually for `Fn`, `FnMut`, or `FnOnce`.

Fixes #18019

r? @pcwalton
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-trait-system Area: Trait system A-type-system Area: Type system
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants