Skip to content

Commit

Permalink
Rollup merge of rust-lang#66186 - GuillaumeGomez:long-err-explanation…
Browse files Browse the repository at this point in the history
…-E0623, r=Dylan-DPC

Add long error explanation for E0623

Part of rust-lang#61137.

r? @Dylan-DPC
  • Loading branch information
JohnTitor authored Nov 13, 2019
2 parents 1d89492 + fd868d4 commit 0395fc7
Show file tree
Hide file tree
Showing 71 changed files with 123 additions and 9 deletions.
46 changes: 45 additions & 1 deletion src/librustc/error_codes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1896,6 +1896,51 @@ fn foo<'a>(x: &'a i32, y: &i32) -> &'a i32 {
```
"##,

E0623: r##"
A lifetime didn't match what was expected.
Erroneous code example:
```compile_fail,E0623
struct Foo<'a> {
x: &'a isize,
}
fn bar<'short, 'long>(c: Foo<'short>, l: &'long isize) {
let _: Foo<'long> = c; // error!
}
```
In this example, we tried to set a value with an incompatible lifetime to
another one (`'long` is unrelated to `'short`). We can solve this issue in
two different ways:
Either we make `'short` live at least as long as `'long`:
```
struct Foo<'a> {
x: &'a isize,
}
// we set 'short to live at least as long as 'long
fn bar<'short: 'long, 'long>(c: Foo<'short>, l: &'long isize) {
let _: Foo<'long> = c; // ok!
}
```
Or we use only one lifetime:
```
struct Foo<'a> {
x: &'a isize,
}
fn bar<'short>(c: Foo<'short>, l: &'short isize) {
let _: Foo<'short> = c; // ok!
}
```
"##,

E0635: r##"
The `#![feature]` attribute specified an unknown feature.
Expand Down Expand Up @@ -2329,7 +2374,6 @@ the future, [RFC 2091] prohibits their implementation without a follow-up RFC.
E0488, // lifetime of variable does not enclose its declaration
E0489, // type/lifetime parameter not in scope here
E0490, // a value of type `..` is borrowed for too long
E0623, // lifetime mismatch where both parameters are anonymous regions
E0628, // generators cannot have explicit parameters
E0631, // type mismatch in closure arguments
E0637, // "'_" is not a valid lifetime bound
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ LL | let _failure_proves_not_implied_outlives_region_b: &'b T = &x;

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0623`.
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ LL | let z: I::A = if cond { x } else { y };

error: aborting due to previous error

For more information about this error, try `rustc --explain E0623`.
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ LL | let _c: <T as Trait<'a>>::Type = b;

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0623`.
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ LL | (a, b)

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0623`.
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ LL | let b = bar(foo, x);

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0623`.
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ LL | let b = bar(f, y);

error: aborting due to previous error

For more information about this error, try `rustc --explain E0623`.
1 change: 1 addition & 0 deletions src/test/ui/async-await/issues/issue-63388-1.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ LL | foo

error: aborting due to previous error

For more information about this error, try `rustc --explain E0623`.
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ LL | async fn async_ret_impl_trait1<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<

error: aborting due to previous error

For more information about this error, try `rustc --explain E0623`.
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ LL | S { pointer: &mut *p.pointer }

error: aborting due to previous error

For more information about this error, try `rustc --explain E0623`.
3 changes: 2 additions & 1 deletion src/test/ui/continue-after-missing-main.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ LL | let _: AdaptedMatrixProvider<'original_data, MP> = tableau.provider().c

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0601`.
Some errors have detailed explanations: E0601, E0623.
For more information about an error, try `rustc --explain E0601`.
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,5 @@ LL | fn ty_param_wont_outlive_static<T:Debug>(x: T) -> impl Debug + 'static {

error: aborting due to 5 previous errors

For more information about this error, try `rustc --explain E0310`.
Some errors have detailed explanations: E0310, E0623.
For more information about an error, try `rustc --explain E0310`.
3 changes: 2 additions & 1 deletion src/test/ui/in-band-lifetimes/mismatched.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ LL | fn foo2(x: &'a u32, y: &'b u32) -> &'a u32 { y }

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0621`.
Some errors have detailed explanations: E0621, E0623.
For more information about an error, try `rustc --explain E0621`.
1 change: 1 addition & 0 deletions src/test/ui/in-band-lifetimes/mismatched_trait_impl.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ LL | x

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0623`.
3 changes: 2 additions & 1 deletion src/test/ui/issues/issue-17728.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ LL | | }

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0308`.
Some errors have detailed explanations: E0308, E0623.
For more information about an error, try `rustc --explain E0308`.
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ LL | if x > y { x } else { y }

error: aborting due to previous error

For more information about this error, try `rustc --explain E0623`.
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ LL | x

error: aborting due to previous error

For more information about this error, try `rustc --explain E0623`.
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ LL | if true { x } else { self }

error: aborting due to previous error

For more information about this error, try `rustc --explain E0623`.
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ LL | x.push(y);

error: aborting due to previous error

For more information about this error, try `rustc --explain E0623`.
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ LL | x.push(z);

error: aborting due to previous error

For more information about this error, try `rustc --explain E0623`.
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ LL | let a: &mut Vec<Ref<i32>> = x;

error: aborting due to previous error

For more information about this error, try `rustc --explain E0623`.
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ LL | let a: &mut Vec<Ref<i32>> = x;

error: aborting due to previous error

For more information about this error, try `rustc --explain E0623`.
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ LL | *v = x;

error: aborting due to previous error

For more information about this error, try `rustc --explain E0623`.
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ LL | z.push((x,y));

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0623`.
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ LL | x.b = y.b;

error: aborting due to previous error

For more information about this error, try `rustc --explain E0623`.
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ LL | x.a = x.b;

error: aborting due to previous error

For more information about this error, try `rustc --explain E0623`.
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ LL | x.push(y);

error: aborting due to previous error

For more information about this error, try `rustc --explain E0623`.
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ LL | x.push(y);

error: aborting due to previous error

For more information about this error, try `rustc --explain E0623`.
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ LL | x.push(y);

error: aborting due to previous error

For more information about this error, try `rustc --explain E0623`.
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ LL | x.push(y);

error: aborting due to previous error

For more information about this error, try `rustc --explain E0623`.
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ LL | y = x.b;

error: aborting due to previous error

For more information about this error, try `rustc --explain E0623`.
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ LL | y.b = x;

error: aborting due to previous error

For more information about this error, try `rustc --explain E0623`.
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ LL | y.b = x;

error: aborting due to previous error

For more information about this error, try `rustc --explain E0623`.
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ LL | x.b = y;

error: aborting due to previous error

For more information about this error, try `rustc --explain E0623`.
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ LL | x

error: aborting due to previous error

For more information about this error, try `rustc --explain E0623`.
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ LL | if true { x } else { self }

error: aborting due to previous error

For more information about this error, try `rustc --explain E0623`.
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ LL | y.push(z);

error: aborting due to previous error

For more information about this error, try `rustc --explain E0623`.
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ LL | x.push(y);

error: aborting due to previous error

For more information about this error, try `rustc --explain E0623`.
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ LL | y.push(z);

error: aborting due to previous error

For more information about this error, try `rustc --explain E0623`.
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ LL | x.push(y);

error: aborting due to previous error

For more information about this error, try `rustc --explain E0623`.
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ LL | fn load2<'a>(ss: &MyBox<dyn SomeTrait + 'a>) -> MyBox<dyn SomeTrait + 'a> {

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0308`.
Some errors have detailed explanations: E0308, E0623.
For more information about an error, try `rustc --explain E0308`.
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ LL | let _: fn(&mut &isize, &mut &isize) = a;

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0308`.
Some errors have detailed explanations: E0308, E0623.
For more information about an error, try `rustc --explain E0308`.
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ LL | let _: fn(&mut &isize, &mut &isize, &mut &isize) = a;

error: aborting due to 4 previous errors

For more information about this error, try `rustc --explain E0308`.
Some errors have detailed explanations: E0308, E0623.
For more information about an error, try `rustc --explain E0308`.
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ LL | a.bigger_region(b)

error: aborting due to previous error

For more information about this error, try `rustc --explain E0623`.
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ LL | f.method(b);

error: aborting due to previous error

For more information about this error, try `rustc --explain E0623`.
1 change: 1 addition & 0 deletions src/test/ui/regions/regions-creating-enums3.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ LL | Ast::Add(x, y)

error: aborting due to previous error

For more information about this error, try `rustc --explain E0623`.
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ LL | let z: &'b usize = &*x;

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0623`.
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ LL | let z: Option<&'a &'b usize> = None;

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0623`.
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ LL | let _: Contravariant<'long> = c;

error: aborting due to previous error

For more information about this error, try `rustc --explain E0623`.
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ LL | let _: Covariant<'short> = c;

error: aborting due to previous error

For more information about this error, try `rustc --explain E0623`.
3 changes: 2 additions & 1 deletion src/test/ui/regions/regions-lifetime-bounds-on-fns.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ LL | let _: fn(&mut &isize, &mut &isize) = a;

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0308`.
Some errors have detailed explanations: E0308, E0623.
For more information about an error, try `rustc --explain E0308`.
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ LL | &mut ***p

error: aborting due to previous error

For more information about this error, try `rustc --explain E0623`.
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ LL | &mut **p

error: aborting due to previous error

For more information about this error, try `rustc --explain E0623`.
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ LL | let _: S<'long, 'long> = c;

error: aborting due to previous error

For more information about this error, try `rustc --explain E0623`.
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ LL | let _: Contravariant<'long> = c;

error: aborting due to previous error

For more information about this error, try `rustc --explain E0623`.
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ LL | let _: Covariant<'short> = c;

error: aborting due to previous error

For more information about this error, try `rustc --explain E0623`.
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ LL | let _: Invariant<'short> = c;

error: aborting due to previous error

For more information about this error, try `rustc --explain E0623`.
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ LL | async fn bar<'a>(self: Alias<&Self>, arg: &'a ()) -> &() { arg }

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0623`.
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ LL | fn bar<'a>(self: Alias<&Self>, arg: &'a ()) -> &() { arg }

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0623`.
1 change: 1 addition & 0 deletions src/test/ui/self/elision/lt-ref-self-async.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,4 @@ LL | f

error: aborting due to 6 previous errors

For more information about this error, try `rustc --explain E0623`.
1 change: 1 addition & 0 deletions src/test/ui/self/elision/lt-ref-self.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,4 @@ LL | f

error: aborting due to 6 previous errors

For more information about this error, try `rustc --explain E0623`.
1 change: 1 addition & 0 deletions src/test/ui/self/elision/ref-mut-self-async.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,4 @@ LL | f

error: aborting due to 6 previous errors

For more information about this error, try `rustc --explain E0623`.
1 change: 1 addition & 0 deletions src/test/ui/self/elision/ref-mut-self.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,4 @@ LL | f

error: aborting due to 6 previous errors

For more information about this error, try `rustc --explain E0623`.
1 change: 1 addition & 0 deletions src/test/ui/self/elision/ref-mut-struct-async.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,4 @@ LL | f

error: aborting due to 5 previous errors

For more information about this error, try `rustc --explain E0623`.
1 change: 1 addition & 0 deletions src/test/ui/self/elision/ref-mut-struct.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,4 @@ LL | f

error: aborting due to 5 previous errors

For more information about this error, try `rustc --explain E0623`.
Loading

0 comments on commit 0395fc7

Please sign in to comment.