Skip to content

Given trait Trait: SubTrait<Output=Self> {}, Self::Output doesn't implement Trait (but it should) #20345

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

Closed
japaric opened this issue Dec 30, 2014 · 0 comments
Assignees

Comments

@japaric
Copy link
Member

japaric commented Dec 30, 2014

STR

Example from libcore:

#![crate_type = "lib"]
#![feature(associated_types, lang_items)]
#![no_std]

#[lang = "sized"] trait Sized {}

#[lang = "not"]
trait Not {
    type Result;

    fn not(self) -> Self::Result;
}

trait Int: Not<Result=Self> {
    fn count_ones(self) -> uint;
    fn count_zeros(self) -> uint {
        // neither works
        (!self).count_ones()
        //~^ error: type `<Self as Not>::Result` does not implement any method in scope named `count_ones`
        //self.not().count_ones()
    }
}

Version

84f5ad8

cc @nikomatsakis

@nikomatsakis nikomatsakis self-assigned this Dec 30, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants