Rollup merge of #66186 - GuillaumeGomez:long-err-explanation-E0623, r=Dylan-DPC
Add long error explanation for E0623 Part of #61137. r? @Dylan-DPC
This commit is contained in:
commit
be3fcf4832
|
@ -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.
|
||||
|
||||
|
@ -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
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -22,3 +22,4 @@ LL | (a, b)
|
|||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0623`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -11,3 +11,4 @@ LL | foo
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0623`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -22,3 +22,4 @@ LL | x
|
|||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0623`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -11,3 +11,4 @@ LL | x
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0623`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -8,3 +8,4 @@ LL | x.push(y);
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0623`.
|
||||
|
|
|
@ -9,3 +9,4 @@ LL | x.push(z);
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0623`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -8,3 +8,4 @@ LL | *v = x;
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0623`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -9,3 +9,4 @@ LL | x.push(y);
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0623`.
|
||||
|
|
|
@ -8,3 +8,4 @@ LL | x.push(y);
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0623`.
|
||||
|
|
|
@ -8,3 +8,4 @@ LL | x.push(y);
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0623`.
|
||||
|
|
|
@ -8,3 +8,4 @@ LL | x.push(y);
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0623`.
|
||||
|
|
|
@ -10,3 +10,4 @@ LL | y = x.b;
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0623`.
|
||||
|
|
|
@ -8,3 +8,4 @@ LL | y.b = x;
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0623`.
|
||||
|
|
|
@ -8,3 +8,4 @@ LL | y.b = x;
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0623`.
|
||||
|
|
|
@ -8,3 +8,4 @@ LL | x.b = y;
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0623`.
|
||||
|
|
|
@ -10,3 +10,4 @@ LL | x
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0623`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -8,3 +8,4 @@ LL | y.push(z);
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0623`.
|
||||
|
|
|
@ -8,3 +8,4 @@ LL | x.push(y);
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0623`.
|
||||
|
|
|
@ -8,3 +8,4 @@ LL | y.push(z);
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0623`.
|
||||
|
|
|
@ -8,3 +8,4 @@ LL | x.push(y);
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0623`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -9,3 +9,4 @@ LL | f.method(b);
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0623`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -10,3 +10,4 @@ LL | &mut ***p
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0623`.
|
||||
|
|
|
@ -10,3 +10,4 @@ LL | &mut **p
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0623`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -60,3 +60,4 @@ LL | f
|
|||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0623`.
|
||||
|
|
|
@ -60,3 +60,4 @@ LL | f
|
|||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0623`.
|
||||
|
|
|
@ -60,3 +60,4 @@ LL | f
|
|||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0623`.
|
||||
|
|
|
@ -60,3 +60,4 @@ LL | f
|
|||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0623`.
|
||||
|
|
|
@ -50,3 +50,4 @@ LL | f
|
|||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0623`.
|
||||
|
|
|
@ -50,3 +50,4 @@ LL | f
|
|||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0623`.
|
||||
|
|
|
@ -70,3 +70,4 @@ LL | f
|
|||
|
||||
error: aborting due to 7 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0623`.
|
||||
|
|
|
@ -70,3 +70,4 @@ LL | f
|
|||
|
||||
error: aborting due to 7 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0623`.
|
||||
|
|
|
@ -50,3 +50,4 @@ LL | f
|
|||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0623`.
|
||||
|
|
|
@ -50,3 +50,4 @@ LL | f
|
|||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0623`.
|
||||
|
|
|
@ -8,3 +8,4 @@ LL | fn foo(x: &mut Vec<&'_ u8>, y: &'_ u8) { x.push(y); }
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0623`.
|
||||
|
|
|
@ -12,3 +12,4 @@ LL | let _: Foo<'long> = c;
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0623`.
|
||||
|
|
Loading…
Reference in New Issue