Skip to content

bounds in ty params can't seem to refer to other ty params #2611

Closed

Description

@catamorphism

This is more-or-less taken from commented-out code in core::iter-trait:

import iter;
import iter::base_iter;

impl Q<A> for base_iter<A> {
   fn flat_map_to_vec<B:copy, IB:base_iter<B>>(op: fn(B) -> IB) -> [B] {
      iter::flat_map_to_vec(self, op)
   }
}

This fails to compile with unresolved typename: B. That's not right, since the method should get resolved in a scope that includes its own ty params. Strangely enough, the same function does compile if it's not inside an impl and takes its self arg explicitly.

Activity

  1. catamorphism commented on Jun 15, 2012

    @catamorphism
    ContributorAuthor

    Adding (xfailed) test case as run-pass/issue-2611.rs

  2. bstrie commented on Jul 17, 2012

    @bstrie
    Contributor

    Post-0.3, the test case gives this error instead:

    mismatched types: expected `core::iter::base_iter<'b>` but found `core::iter::base_iter<'a>` (type parameter vs type parameter)
    2611.rs:6       iter::flat_map_to_vec(self, op)
                    ^~~~~~~~~~~~~~~~~~~~~
    

    Not sure whether or not the message is accurate, but it's certainly unhelpful.

  3. catamorphism commented on Jul 17, 2012

    @catamorphism
    ContributorAuthor

    I'll try fixing the error message.

  4. msullivan commented on Aug 23, 2012

    @msullivan
    Contributor

    Now it fails with a message saying they have incompatible type parameters. I think I'm going to look into this some.

  5. catamorphism commented on Sep 1, 2012

    @catamorphism
    ContributorAuthor

    I'm going to take this one, since @msullivan already has plenty of stuff ;-) I'm still getting the "incompatible type parameters" message too, which seems wrong. I'll keep looking.

  6. removed their assignment
    on Jun 16, 2014
  7. added 2 commits that reference this issue on Oct 24, 2022
  8. added a commit that references this issue on Jan 6, 2023
  9. added a commit that references this issue on Oct 20, 2025
  10. added a commit that references this issue on Aug 21, 2026
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-resolveArea: Name/path resolution done by `rustc_resolve` specifically

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions