Skip to content

Explanation for E0207 is about unused type, but is shown when type is used incorrectly #33650

Closed
@kornelski

Description

@kornelski

I'm trying to use a reference in an associated type. Rust wants me to add lifetime annotations, but it doesn't tell me where exactly they are needed.

If I try such (invalid) code:

trait Tr {
    type Ty;
}

struct St;

impl<'a> Tr for St {
    type Ty = &'a u8;
}

I'm getting error:

error: the lifetime parameter 'a is not constrained by the impl trait, self type, or predicates E0207

The problem is E0207 only tells me to remove the lifetime, but I'm trying to add it, so the error explanation doesn't help me solve my problem.

Pinging #32777


rustc 1.10.0-nightly (2b79e05 2016-05-13)

Metadata

Metadata

Assignees

No one assigned

    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