Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
kornelski opened this issue May 15, 2016 · 1 comment

Comments

@kornelski
Copy link
Contributor

kornelski commented May 15, 2016

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)

@sanmai-NL
Copy link

What's the version of Rust you're using? Some notes about how to report bugs/issues here.

nham pushed a commit to nham/rust that referenced this issue May 23, 2016
The previous explanation does not seem to explain what it means for an
implementation parameter to be used or unused. The new explanation lists
the three ways specific ways by which an impl parameter becomes constrained
(taken from RFC 447).

This also adds a link to RFC 447.

The explanation has two different examples. The first is adapted from RFC 447,
and shows an instance of E0207 on a impl for a type. The second one is a trait
impl example adapted from issue rust-lang#22834.

Closes rust-lang#33650
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue May 24, 2016
Improve the long explanation of E0207.

The previous explanation does not seem to explain what it means for an
implementation parameter to be used or unused. The new explanation lists
the three ways specific ways by which an impl parameter becomes constrained
(taken from RFC 447).

This also adds a link to RFC 447.

The explanation has two different examples. The first is adapted from RFC 447,
and shows an instance of E0207 on a impl for a type. The second one is a trait
impl example adapted from issue rust-lang#22834.

Closes rust-lang#33650

cc rust-lang#32777

r? @GuillaumeGomez
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants