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

Cannot locate the impl of the trait from nested type parameter. #24972

Closed
ghost opened this issue Apr 30, 2015 · 1 comment
Closed

Cannot locate the impl of the trait from nested type parameter. #24972

ghost opened this issue Apr 30, 2015 · 1 comment
Labels
A-traits Area: Trait system A-typesystem Area: The type system E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@ghost
Copy link

ghost commented Apr 30, 2015

When I used bound::typeparam as type, thread rustc panicked.

use rustc_serialize::{Encodable, Decodable};
use std::fmt::Display;


pub trait Entity : Decodable + Encodable + Sized {
    type Key: Clone + Decodable + Encodable + ToString + Display + Eq + Ord + Sized;

    fn id(&self) -> Self::Key;

    fn find_by_id(id: Self::Key) -> Option<Self>;
}

pub struct DbRef<E: Entity> {
    pub id: E::Key,
}

impl<E> DbRef<E>
 where E: Entity {
    fn get(self) -> Option<E> {
        E::find_by_id(self.id)
    }
} 

Source code: https://github.com/ceram1/appcore/blob/master/src/db/mod.rs
Build log: https://travis-ci.org/ceram1/appcore/builds/60641835

@steveklabnik steveklabnik added A-typesystem Area: The type system A-traits Area: Trait system I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ labels Apr 30, 2015
@arielb1
Copy link
Contributor

arielb1 commented Oct 23, 2015

No ICE in 1.5.

@arielb1 arielb1 added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Oct 23, 2015
bors added a commit that referenced this issue Oct 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-traits Area: Trait system A-typesystem Area: The type system E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

2 participants