Skip to content

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

Closed

Description

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

Activity

  1. added
    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
    on Apr 30, 2015
  2. arielb1 commented on Oct 23, 2015

    @arielb1
    Contributor

    No ICE in 1.5.

  3. added
    E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.
    on Oct 23, 2015
  4. added a commit that references this issue on Oct 26, 2015
    bf7eec0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-trait-systemArea: Trait systemA-type-systemArea: Type systemE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions