Skip to content

"expected type parameter but found type parameter" #3404

Closed
@catamorphism

Description

@catamorphism
Contributor

This is a terrible error message. See compile-fail/issue-2611-5.rs, which I'm about to check in, for an example program that triggers it.

Activity

metajack

metajack commented on Jul 8, 2013

@metajack
Contributor

Reproduced on 65ed803

thestinger

thestinger commented on Aug 19, 2013

@thestinger
Contributor

Triage bump, still an issue. This is often caused by a mismatch between lifetimes.

dradtke

dradtke commented on Jan 10, 2014

@dradtke

Confirmed that this is still an issue with Rust 0.9. I ran into it playing around with linked list implementations:

pub enum List<T> {
    Cons(T, ~List<T>),
    Nil,
}

impl<T> List<T> {
    fn prepend<T>(mut self, value: T) {
        self = Cons(value, ~self);
    }
}

This causes the compiler to emit two errors, neither of which is very helpful:

error: mismatched types: expected `~List<T>` but found `~List<T>` (expected type parameter but found type parameter)
error: mismatched types: expected `List<T>` but found `List<T>` (expected type parameter but found type parameter)
pnkfelix

pnkfelix commented on Jan 16, 2014

@pnkfelix
Member

accepted for P-low.

added a commit that references this issue on Oct 31, 2014

auto merge of #18264 : jakub-/rust/var-ids-in-error-messages, r=nikom…

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

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @metajack@pnkfelix@catamorphism@dradtke@thestinger

      Issue actions

        "expected type parameter but found type parameter" · Issue #3404 · rust-lang/rust