Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Convert T::Foo resolution to use where clauses, not bounds #20300

Closed

Description

@nikomatsakis

Currently referencing an associated type like T::Foo searches the bounds on T rather than the full set of where clauses. This is no good.

Activity

  1. added this to the 1.0 alpha milestone on Jan 6, 2015
  2. nikomatsakis commented on Jan 6, 2015

    @nikomatsakis
    ContributorAuthor

    Nominating and placing on 1.0 alpha milestone. Ultimately PROBABLY a nice to have, but it's really surprising that this doesn't work.

  3. added
    A-associated-items
    on Jan 7, 2015
  4. changed the title [-]Convert `T::Foo` resolution to use where clauses, not bounds`[/-] [+]Convert `T::Foo` resolution to use where clauses, not bounds[/+] on Jan 8, 2015
  5. jroesch commented on Jan 10, 2015

    @jroesch
    Contributor

    cc me

  6. erickt commented on Jan 10, 2015

    @erickt
    Contributor

    Until this is implemented, you can also use a qualified type path <T as Trait>::Item:

    trait Trait {
        type Item;
    }
    
    struct Foo;
    
    impl Foo {
        fn foo1<T: Trait>(_x: T::Item) {}
    
        fn foo2<T>(_x: <T as Trait>::Item) where T: Trait {}
    }
    
    struct Bar;
    
    impl Trait for Bar {
        type Item = i32;
    }
    
    fn main() {
        Foo::foo1::<Bar>(5i32);
        Foo::foo2::<Bar>(5i32);
    }
  7. carllerche commented on Jan 22, 2015

    @carllerche
    Contributor

    cc me

  8. ahmedcharles commented on Jan 23, 2015

    @ahmedcharles
    Contributor

    Would anyone mind mentoring this?

  9. nikomatsakis commented on Feb 2, 2015

    @nikomatsakis
    ContributorAuthor

    @ahmedcharles a fix is in progress already, actually, but it turns out to be quite a tricky problem. Much trickier than it appeared at first.

  10. added a commit that references this issue on Feb 25, 2015
  11. added a commit that references this issue on Aug 4, 2025
  12. added 2 commits that reference this issue on Nov 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-associated-items

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions