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

rustc --explain E0495 missing documentation #51243

Closed
smklein opened this issue May 31, 2018 · 4 comments
Closed

rustc --explain E0495 missing documentation #51243

smklein opened this issue May 31, 2018 · 4 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@smklein
Copy link
Contributor

smklein commented May 31, 2018

This error message was reported while compiling a project of mine locally:
error[E0495]: cannot infer an appropriate lifetime for autoref due to conflicting requirements`

The compiler advised the following:
For more information about this error, try rustc --explain E0495.

However, that results in the following:

$ rustc --explain E0495
error: no extended information for E0495

For reference:

$ rustc --version
rustc 1.28.0-nightly (990d8aa 2018-05-25)

@csmoe csmoe added the A-diagnostics Area: Messages for errors, warnings, and lints label May 31, 2018
@MisieEugene
Copy link

Hi,
I have the same issue with my stable installation.

For reference:

$ rustc --version
rustc 1.27.1 (5f2b325 2018-07-07)

@luojia65
Copy link
Contributor

luojia65 commented Mar 22, 2019

Same problem. I've installed Version 1.33.0 (2aa4c46cf 2019-02-28).
Code:

pub struct A;

pub struct B<'a> {
    pub a: &'a A,
}

pub struct C<'a> {
    pub a: &'a A,
}

impl<'a> B<'a> {
    pub fn get_c<'b: 'a>(&self) -> C<'b> { 
        C { a: self.a } 
    }
}

Error:

error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
  --> src/lib.rs:13:9
   |
13 |         C { a: self.a } 
   |         ^
   |
note: first, the lifetime cannot outlive the lifetime 'a as defined on the impl at 11:6...
  --> src/lib.rs:11:6
   |
11 | impl<'a> B<'a> {
   |      ^^
note: ...so that reference does not outlive borrowed content
  --> src/lib.rs:13:16
   |
13 |         C { a: self.a } 
   |                ^^^^^^
note: but, the lifetime must be valid for the lifetime 'b as defined on the method body at 12:18...
  --> src/lib.rs:12:18
   |
12 |     pub fn get_c<'b: 'a>(&self) -> C<'b> { 
   |                  ^^
   = note: ...so that the expression is assignable:
           expected C<'b>
              found C<'_>

@JohnTitor
Copy link
Member

Seems fixed in the latest beta(rustc 1.40.0-beta.1 (76b4053 2019-11-05)) and nightly
@smklein @MisieEugene @luojia65 could you check it?

@JohnTitor JohnTitor added C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 10, 2019
@JohnTitor
Copy link
Member

Closing as fixed.
If you still have the problem, feel free to re-open this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants