Skip to content

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

Closed
@japaric

Description

@japaric

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions