Change compare mode to use -Zborrowck=mir

This commit is contained in:
Matthew Jasper 2019-01-27 11:03:21 +00:00
parent 0df1e57991
commit ff71b80a85
197 changed files with 4503 additions and 10 deletions

View file

@ -49,14 +49,14 @@ pub fn add_parameter() {
// Change parameter pattern ----------------------------------------------------
#[cfg(cfail1)]
pub fn change_parameter_pattern() {
let _ = |x: &u32| x;
let _ = |x: (u32,)| x;
}
#[cfg(not(cfail1))]
#[rustc_clean(cfg="cfail2", except="HirBody, mir_built, typeck_tables_of")]
#[rustc_clean(cfg="cfail3")]
pub fn change_parameter_pattern() {
let _ = |&x: &u32| x;
let _ = |(x,): (u32,)| x;
}

View file

@ -0,0 +1,24 @@
error: lifetime may not live long enough
--> $DIR/associated-types-project-from-hrtb-in-fn-body.rs:22:29
|
LL | fn bar<'a, 'b, I : for<'x> Foo<&'x isize>>(
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
...
LL | let z: I::A = if cond { x } else { y };
| ^ assignment requires that `'a` must outlive `'b`
error: lifetime may not live long enough
--> $DIR/associated-types-project-from-hrtb-in-fn-body.rs:22:40
|
LL | fn bar<'a, 'b, I : for<'x> Foo<&'x isize>>(
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
...
LL | let z: I::A = if cond { x } else { y };
| ^ assignment requires that `'b` must outlive `'a`
error: aborting due to 2 previous errors

View file

@ -0,0 +1,24 @@
error: lifetime may not live long enough
--> $DIR/associated-types-subtyping-1.rs:24:12
|
LL | fn method2<'a,'b,T>(x: &'a T, y: &'b T)
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
...
LL | let a: <T as Trait<'a>>::Type = make_any();
| ^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a`
error: lifetime may not live long enough
--> $DIR/associated-types-subtyping-1.rs:35:13
|
LL | fn method3<'a,'b,T>(x: &'a T, y: &'b T)
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
...
LL | let _c: <T as Trait<'a>>::Type = b;
| ^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a`
error: aborting due to 2 previous errors

View file

@ -0,0 +1,24 @@
error: lifetime may not live long enough
--> $DIR/project-fn-ret-contravariant.rs:45:4
|
LL | fn transmute<'a,'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
...
LL | (a, b)
| ^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
error: lifetime may not live long enough
--> $DIR/project-fn-ret-contravariant.rs:45:4
|
LL | fn transmute<'a,'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
...
LL | (a, b)
| ^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
error: aborting due to 2 previous errors

View file

@ -0,0 +1,10 @@
error: lifetime may not live long enough
--> $DIR/project-fn-ret-contravariant.rs:38:4
|
LL | fn baz<'a,'b>(x: &'a u32) -> &'static u32 {
| -- lifetime `'a` defined here
LL | bar(foo, x)
| ^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
error: aborting due to previous error

View file

@ -0,0 +1,24 @@
error: lifetime may not live long enough
--> $DIR/project-fn-ret-invariant.rs:55:4
|
LL | fn transmute<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
...
LL | (a, b)
| ^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
error: lifetime may not live long enough
--> $DIR/project-fn-ret-invariant.rs:55:4
|
LL | fn transmute<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
...
LL | (a, b)
| ^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
error: aborting due to 2 previous errors

View file

@ -0,0 +1,24 @@
error: lifetime may not live long enough
--> $DIR/project-fn-ret-invariant.rs:38:12
|
LL | fn baz<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
LL | let f = foo; // <-- No consistent type can be inferred for `f` here.
LL | let a = bar(f, x);
| ^^^^^^^^^ argument requires that `'a` must outlive `'b`
error: lifetime may not live long enough
--> $DIR/project-fn-ret-invariant.rs:39:12
|
LL | fn baz<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
...
LL | let b = bar(f, y);
| ^^^^^^^^^ argument requires that `'b` must outlive `'a`
error: aborting due to 2 previous errors

View file

@ -0,0 +1,11 @@
error: lifetime may not live long enough
--> $DIR/project-fn-ret-invariant.rs:48:4
|
LL | fn baz<'a,'b>(x: Type<'a>) -> Type<'static> {
| -- lifetime `'a` defined here
...
LL | bar(foo, x)
| ^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
error: aborting due to previous error

View file

@ -0,0 +1,40 @@
error[E0503]: cannot use `y` because it was mutably borrowed
--> $DIR/borrowck-anon-fields-variant.rs:17:7
|
LL | Foo::Y(ref mut a, _) => a,
| --------- borrow of `y.0` occurs here
...
LL | Foo::Y(_, ref mut b) => b,
| ^^^^^^^^^^^^^^^^^^^^ use of borrowed `y.0`
...
LL | *a += 1;
| ------- borrow later used here
error[E0503]: cannot use `y` because it was mutably borrowed
--> $DIR/borrowck-anon-fields-variant.rs:37:7
|
LL | Foo::Y(ref mut a, _) => a,
| --------- borrow of `y.0` occurs here
...
LL | Foo::Y(ref mut b, _) => b,
| ^^^^^^^^^^^^^^^^^^^^ use of borrowed `y.0`
...
LL | *a += 1;
| ------- borrow later used here
error[E0499]: cannot borrow `y.0` as mutable more than once at a time
--> $DIR/borrowck-anon-fields-variant.rs:37:14
|
LL | Foo::Y(ref mut a, _) => a,
| --------- first mutable borrow occurs here
...
LL | Foo::Y(ref mut b, _) => b,
| ^^^^^^^^^ second mutable borrow occurs here
...
LL | *a += 1;
| ------- first borrow later used here
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0499, E0503.
For more information about an error, try `rustc --explain E0499`.

View file

@ -0,0 +1,366 @@
error[E0499]: cannot borrow `x` as mutable more than once at a time
--> $DIR/borrowck-describe-lvalue.rs:262:13
|
LL | let y = &mut x;
| ------ first mutable borrow occurs here
LL | &mut x;
| ^^^^^^ second mutable borrow occurs here
LL | *y = 1;
| ------ first borrow later used here
error[E0499]: cannot borrow `x` as mutable more than once at a time
--> $DIR/borrowck-describe-lvalue.rs:272:20
|
LL | let y = &mut x;
| ------ first mutable borrow occurs here
LL | &mut x;
| ^^^^^^ second mutable borrow occurs here
LL | *y = 1;
| ------ first borrow later used here
error: captured variable cannot escape `FnMut` closure body
--> $DIR/borrowck-describe-lvalue.rs:270:16
|
LL | || {
| - inferred to be a `FnMut` closure
LL | / || {
LL | | let y = &mut x;
LL | | &mut x;
LL | | *y = 1;
LL | | drop(y);
LL | | }
| |_________________^ returns a closure that contains a reference to a captured variable, which then escapes the closure body
|
= note: `FnMut` closures only have access to their captured variables while they are executing...
= note: ...therefore, they cannot allow references to captured variables to escape
error[E0503]: cannot use `f.x` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:41:9
|
LL | let x = f.x();
| - borrow of `f` occurs here
LL | f.x;
| ^^^ use of borrowed `f`
LL | drop(x);
| - borrow later used here
error[E0503]: cannot use `g.0` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:48:9
|
LL | let x = g.x();
| - borrow of `g` occurs here
LL | g.0;
| ^^^ use of borrowed `g`
LL | drop(x);
| - borrow later used here
error[E0503]: cannot use `h.0` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:55:9
|
LL | let x = &mut h.0;
| -------- borrow of `h.0` occurs here
LL | h.0;
| ^^^ use of borrowed `h.0`
LL | drop(x);
| - borrow later used here
error[E0503]: cannot use `e.0` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:63:20
|
LL | let x = e.x();
| - borrow of `e` occurs here
LL | match e {
LL | Baz::X(value) => value
| ^^^^^ use of borrowed `e`
LL | };
LL | drop(x);
| - borrow later used here
error[E0503]: cannot use `u.a` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:71:9
|
LL | let x = &mut u.a;
| -------- borrow of `u.a` occurs here
LL | u.a;
| ^^^ use of borrowed `u.a`
LL | drop(x);
| - borrow later used here
error[E0503]: cannot use `f.x` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:78:9
|
LL | let x = f.x();
| - borrow of `*f` occurs here
LL | f.x;
| ^^^ use of borrowed `*f`
LL | drop(x);
| - borrow later used here
error[E0503]: cannot use `g.0` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:85:9
|
LL | let x = g.x();
| - borrow of `*g` occurs here
LL | g.0;
| ^^^ use of borrowed `*g`
LL | drop(x);
| - borrow later used here
error[E0503]: cannot use `h.0` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:92:9
|
LL | let x = &mut h.0;
| -------- borrow of `h.0` occurs here
LL | h.0;
| ^^^ use of borrowed `h.0`
LL | drop(x);
| - borrow later used here
error[E0503]: cannot use `e.0` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:100:20
|
LL | let x = e.x();
| - borrow of `*e` occurs here
LL | match *e {
LL | Baz::X(value) => value
| ^^^^^ use of borrowed `*e`
...
LL | drop(x);
| - borrow later used here
error[E0503]: cannot use `u.a` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:109:9
|
LL | let x = &mut u.a;
| -------- borrow of `u.a` occurs here
LL | u.a;
| ^^^ use of borrowed `u.a`
LL | drop(x);
| - borrow later used here
error[E0503]: cannot use `v[..]` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:117:15
|
LL | let x = &mut v;
| ------ borrow of `v` occurs here
LL | match v {
LL | &[x, _, .., _, _] => println!("{}", x),
| ^ use of borrowed `v`
...
LL | drop(x);
| - borrow later used here
error[E0503]: cannot use `v[..]` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:122:18
|
LL | let x = &mut v;
| ------ borrow of `v` occurs here
...
LL | &[_, x, .., _, _] => println!("{}", x),
| ^ use of borrowed `v`
...
LL | drop(x);
| - borrow later used here
error[E0503]: cannot use `v[..]` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:127:25
|
LL | let x = &mut v;
| ------ borrow of `v` occurs here
...
LL | &[_, _, .., x, _] => println!("{}", x),
| ^ use of borrowed `v`
...
LL | drop(x);
| - borrow later used here
error[E0503]: cannot use `v[..]` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:132:28
|
LL | let x = &mut v;
| ------ borrow of `v` occurs here
...
LL | &[_, _, .., _, x] => println!("{}", x),
| ^ use of borrowed `v`
...
LL | drop(x);
| - borrow later used here
error[E0503]: cannot use `v[..]` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:143:15
|
LL | let x = &mut v;
| ------ borrow of `v` occurs here
LL | match v {
LL | &[x..] => println!("{:?}", x),
| ^ use of borrowed `v`
...
LL | drop(x);
| - borrow later used here
error[E0503]: cannot use `v[..]` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:148:18
|
LL | let x = &mut v;
| ------ borrow of `v` occurs here
...
LL | &[_, x..] => println!("{:?}", x),
| ^ use of borrowed `v`
...
LL | drop(x);
| - borrow later used here
error[E0503]: cannot use `v[..]` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:153:15
|
LL | let x = &mut v;
| ------ borrow of `v` occurs here
...
LL | &[x.., _] => println!("{:?}", x),
| ^ use of borrowed `v`
...
LL | drop(x);
| - borrow later used here
error[E0503]: cannot use `v[..]` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:158:18
|
LL | let x = &mut v;
| ------ borrow of `v` occurs here
...
LL | &[_, x.., _] => println!("{:?}", x),
| ^ use of borrowed `v`
...
LL | drop(x);
| - borrow later used here
error[E0503]: cannot use `e` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:171:13
|
LL | let x = &mut e;
| ------ borrow of `e` occurs here
LL | match e {
LL | E::A(ref ax) =>
| ^^^^^^^^^^^^ use of borrowed `e`
...
LL | drop(x);
| - borrow later used here
error[E0502]: cannot borrow `e.0` as immutable because it is also borrowed as mutable
--> $DIR/borrowck-describe-lvalue.rs:171:18
|
LL | let x = &mut e;
| ------ mutable borrow occurs here
LL | match e {
LL | E::A(ref ax) =>
| ^^^^^^ immutable borrow occurs here
...
LL | drop(x);
| - mutable borrow later used here
error[E0502]: cannot borrow `e.x` as immutable because it is also borrowed as mutable
--> $DIR/borrowck-describe-lvalue.rs:175:23
|
LL | let x = &mut e;
| ------ mutable borrow occurs here
...
LL | E::B { x: ref bx } =>
| ^^^^^^ immutable borrow occurs here
...
LL | drop(x);
| - mutable borrow later used here
error[E0502]: cannot borrow `s.y.0` as immutable because it is also borrowed as mutable
--> $DIR/borrowck-describe-lvalue.rs:188:22
|
LL | let x = &mut s;
| ------ mutable borrow occurs here
LL | match s {
LL | S { y: (ref y0, _), .. } =>
| ^^^^^^ immutable borrow occurs here
...
LL | drop(x);
| - mutable borrow later used here
error[E0502]: cannot borrow `s.x.y` as immutable because it is also borrowed as mutable
--> $DIR/borrowck-describe-lvalue.rs:194:28
|
LL | let x = &mut s;
| ------ mutable borrow occurs here
...
LL | S { x: F { y: ref x0, .. }, .. } =>
| ^^^^^^ immutable borrow occurs here
...
LL | drop(x);
| - mutable borrow later used here
error[E0503]: cannot use `*v` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:240:9
|
LL | let x = &mut v;
| ------ borrow of `v` occurs here
LL | v[0].y;
| ^^^^ use of borrowed `v`
...
LL | drop(x);
| - borrow later used here
error[E0503]: cannot use `v[_].y` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:240:9
|
LL | let x = &mut v;
| ------ borrow of `v` occurs here
LL | v[0].y;
| ^^^^^^ use of borrowed `v`
...
LL | drop(x);
| - borrow later used here
error[E0502]: cannot borrow `v[..].x` as immutable because it is also borrowed as mutable
--> $DIR/borrowck-describe-lvalue.rs:251:24
|
LL | let x = &mut v;
| ------ mutable borrow occurs here
LL | match v {
LL | &[_, F {x: ref xf, ..}] => println!("{}", xf),
| ^^^^^^ immutable borrow occurs here
...
LL | drop(x);
| - mutable borrow later used here
error[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable
--> $DIR/borrowck-describe-lvalue.rs:210:29
|
LL | let x = &mut block;
| ---------- mutable borrow occurs here
LL | let p: &'a u8 = &*block.current;
| ^^^^^^^^^^^^^^^ immutable borrow occurs here
...
LL | drop(x);
| - mutable borrow later used here
error[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable
--> $DIR/borrowck-describe-lvalue.rs:227:33
|
LL | let x = &mut block;
| ---------- mutable borrow occurs here
LL | let p : *const u8 = &*(*block).current;
| ^^^^^^^^^^^^^^^^^^ immutable borrow occurs here
...
LL | drop(x);
| - mutable borrow later used here
error[E0382]: use of moved value: `x`
--> $DIR/borrowck-describe-lvalue.rs:282:22
|
LL | drop(x);
| - value moved here
LL | drop(x);
| ^ value used here after move
|
= note: move occurs because `x` has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait
error: aborting due to 32 previous errors
Some errors have detailed explanations: E0382, E0499, E0502, E0503.
For more information about an error, try `rustc --explain E0382`.

View file

@ -0,0 +1,27 @@
error[E0502]: cannot borrow `vector` as mutable because it is also borrowed as immutable
--> $DIR/borrowck-for-loop-head-linkage.rs:7:9
|
LL | for &x in &vector {
| -------
| |
| immutable borrow occurs here
| immutable borrow later used here
LL | let cap = vector.capacity();
LL | vector.extend(repeat(0));
| ^^^^^^ mutable borrow occurs here
error[E0502]: cannot borrow `vector` as mutable because it is also borrowed as immutable
--> $DIR/borrowck-for-loop-head-linkage.rs:8:9
|
LL | for &x in &vector {
| -------
| |
| immutable borrow occurs here
| immutable borrow later used here
...
LL | vector[1] = 5;
| ^^^^^^ mutable borrow occurs here
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0502`.

View file

@ -0,0 +1,41 @@
error[E0302]: cannot assign in a pattern guard
--> $DIR/borrowck-mutate-in-guard.rs:10:25
|
LL | Enum::A(_) if { x = Enum::B(false); false } => 1,
| ^^^^^^^^^^^^^^^^^^ assignment in pattern guard
error[E0301]: cannot mutably borrow in a pattern guard
--> $DIR/borrowck-mutate-in-guard.rs:15:38
|
LL | Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1,
| ^ borrowed mutably in pattern guard
|
= help: add #![feature(bind_by_move_pattern_guards)] to the crate attributes to enable
error[E0302]: cannot assign in a pattern guard
--> $DIR/borrowck-mutate-in-guard.rs:15:41
|
LL | Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1,
| ^^^^^^^^^^^^^^^^^^^ assignment in pattern guard
error[E0510]: cannot assign `x` in match guard
--> $DIR/borrowck-mutate-in-guard.rs:10:25
|
LL | match x {
| - value is immutable in match guard
LL | Enum::A(_) if { x = Enum::B(false); false } => 1,
| ^^^^^^^^^^^^^^^^^^ cannot assign
error[E0510]: cannot mutably borrow `x` in match guard
--> $DIR/borrowck-mutate-in-guard.rs:15:33
|
LL | match x {
| - value is immutable in match guard
...
LL | Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1,
| ^^^^^^ cannot mutably borrow
error: aborting due to 5 previous errors
Some errors have detailed explanations: E0301, E0302, E0510.
For more information about an error, try `rustc --explain E0301`.

View file

@ -0,0 +1,23 @@
error[E0502]: cannot borrow `*x` as mutable because it is also borrowed as immutable
--> $DIR/borrowck-object-lifetime.rs:20:13
|
LL | let y = x.borrowed();
| - immutable borrow occurs here
LL | let z = x.mut_borrowed();
| ^ mutable borrow occurs here
LL | y.use_ref();
| - immutable borrow later used here
error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
--> $DIR/borrowck-object-lifetime.rs:26:13
|
LL | let y = x.borrowed();
| - immutable borrow occurs here
LL | let z = &mut x;
| ^^^^^^ mutable borrow occurs here
LL | y.use_ref();
| - immutable borrow later used here
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0502`.

View file

@ -0,0 +1,12 @@
error: lifetime may not live long enough
--> $DIR/borrowck-reborrow-from-shorter-lived-andmut.rs:9:5
|
LL | fn copy_borrowed_ptr<'a,'b>(p: &'a mut S<'b>) -> S<'b> {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
LL | S { pointer: &mut *p.pointer }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
error: aborting due to previous error

View file

@ -0,0 +1,14 @@
error[E0521]: borrowed data escapes outside of closure
--> $DIR/issue-7573.rs:21:9
|
LL | let mut lines_to_use: Vec<&CrateId> = Vec::new();
| ---------------- `lines_to_use` is declared here, outside of the closure body
LL |
LL | let push_id = |installed_id: &CrateId| {
| ------------ `installed_id` is a reference that is only valid in the closure body
...
LL | lines_to_use.push(installed_id);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `installed_id` escapes the closure body here
error: aborting due to previous error

View file

@ -0,0 +1,12 @@
error[E0521]: borrowed data escapes outside of closure
--> $DIR/regions-escape-bound-fn-2.rs:8:18
|
LL | let mut x = None;
| ----- `x` is declared here, outside of the closure body
LL | with_int(|y| x = Some(y));
| - ^^^^^^^^^^^ `y` escapes the closure body here
| |
| `y` is a reference that is only valid in the closure body
error: aborting due to previous error

View file

@ -0,0 +1,12 @@
error[E0521]: borrowed data escapes outside of closure
--> $DIR/regions-escape-bound-fn.rs:8:18
|
LL | let mut x: Option<&isize> = None;
| ----- `x` is declared here, outside of the closure body
LL | with_int(|y| x = Some(y));
| - ^^^^^^^^^^^ `y` escapes the closure body here
| |
| `y` is a reference that is only valid in the closure body
error: aborting due to previous error

View file

@ -0,0 +1,12 @@
error[E0521]: borrowed data escapes outside of closure
--> $DIR/regions-escape-unboxed-closure.rs:6:23
|
LL | let mut x: Option<&isize> = None;
| ----- `x` is declared here, outside of the closure body
LL | with_int(&mut |y| x = Some(y));
| - ^^^^^^^^^^^ `y` escapes the closure body here
| |
| `y` is a reference that is only valid in the closure body
error: aborting due to previous error

View file

@ -0,0 +1,36 @@
error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
--> $DIR/two-phase-reservation-sharing-interference-future-compat-lint.rs:13:9
|
LL | let shared = &v;
| -- immutable borrow occurs here
LL |
LL | v.push(shared.len());
| ^ ------ immutable borrow later used here
| |
| mutable borrow occurs here
error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
--> $DIR/two-phase-reservation-sharing-interference-future-compat-lint.rs:24:9
|
LL | let shared = &v;
| -- immutable borrow occurs here
LL |
LL | v.push(shared.len());
| ^ ------ immutable borrow later used here
| |
| mutable borrow occurs here
error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
--> $DIR/two-phase-reservation-sharing-interference-future-compat-lint.rs:37:9
|
LL | let shared = &v;
| -- immutable borrow occurs here
LL |
LL | v.push(shared.len());
| ^ ------ immutable borrow later used here
| |
| mutable borrow occurs here
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0502`.

View file

@ -0,0 +1,81 @@
error[E0621]: explicit lifetime required in the type of `ap`
--> $DIR/variadic-ffi-4.rs:8:5
|
LL | pub unsafe extern "C" fn no_escape0<'a>(_: usize, ap: ...) -> VaList<'a> {
| --- help: add explicit lifetime `'a` to the type of `ap`: `core::ffi::VaList<'a>`
LL | ap
| ^^ lifetime `'a` required
error[E0621]: explicit lifetime required in the type of `ap`
--> $DIR/variadic-ffi-4.rs:12:5
|
LL | pub unsafe extern "C" fn no_escape1(_: usize, ap: ...) -> VaList<'static> {
| --- help: add explicit lifetime `'static` to the type of `ap`: `core::ffi::VaList<'static>`
LL | ap
| ^^ lifetime `'static` required
error: lifetime may not live long enough
--> $DIR/variadic-ffi-4.rs:16:33
|
LL | let _ = ap.with_copy(|ap| { ap });
| --- ^^ returning this value requires that `'1` must outlive `'2`
| | |
| | return type of closure is core::ffi::VaList<'2>
| has type `core::ffi::VaList<'1>`
error: lifetime may not live long enough
--> $DIR/variadic-ffi-4.rs:20:5
|
LL | pub unsafe extern "C" fn no_escape3(_: usize, mut ap0: &mut VaList, mut ap1: ...) {
| ------- ------- has type `core::ffi::VaList<'1>`
| |
| has type `&mut core::ffi::VaList<'2>`
LL | *ap0 = ap1;
| ^^^^^^^^^^ assignment requires that `'1` must outlive `'2`
error: lifetime may not live long enough
--> $DIR/variadic-ffi-4.rs:24:5
|
LL | pub unsafe extern "C" fn no_escape4(_: usize, ap0: &mut VaList, mut ap1: ...) {
| --- ------- has type `core::ffi::VaList<'2>`
| |
| has type `&mut core::ffi::VaList<'1>`
LL | ap0 = &mut ap1;
| ^^^^^^^^^^^^^^ assignment requires that `'1` must outlive `'2`
error: lifetime may not live long enough
--> $DIR/variadic-ffi-4.rs:24:5
|
LL | pub unsafe extern "C" fn no_escape4(_: usize, ap0: &mut VaList, mut ap1: ...) {
| --- ------- has type `core::ffi::VaList<'1>`
| |
| has type `&mut core::ffi::VaList<'2>`
LL | ap0 = &mut ap1;
| ^^^^^^^^^^^^^^ assignment requires that `'1` must outlive `'2`
error[E0384]: cannot assign to immutable argument `ap0`
--> $DIR/variadic-ffi-4.rs:24:5
|
LL | pub unsafe extern "C" fn no_escape4(_: usize, ap0: &mut VaList, mut ap1: ...) {
| --- help: make this binding mutable: `mut ap0`
LL | ap0 = &mut ap1;
| ^^^^^^^^^^^^^^ cannot assign to immutable argument
error[E0597]: `ap1` does not live long enough
--> $DIR/variadic-ffi-4.rs:24:11
|
LL | pub unsafe extern "C" fn no_escape4(_: usize, ap0: &mut VaList, mut ap1: ...) {
| - let's call the lifetime of this reference `'1`
LL | ap0 = &mut ap1;
| ------^^^^^^^^
| | |
| | borrowed value does not live long enough
| assignment requires that `ap1` is borrowed for `'1`
...
LL | }
| - `ap1` dropped here while still borrowed
error: aborting due to 8 previous errors
Some errors have detailed explanations: E0384, E0597, E0621.
For more information about an error, try `rustc --explain E0384`.

View file

@ -0,0 +1,53 @@
error[E0631]: type mismatch in closure arguments
--> $DIR/expect-fn-supply-fn.rs:30:5
|
LL | with_closure_expecting_fn_with_free_region(|x: fn(&u32), y| {});
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ---------------- found signature of `fn(for<'r> fn(&'r u32), _) -> _`
| |
| expected signature of `fn(fn(&'a u32), &i32) -> _`
|
note: required by `with_closure_expecting_fn_with_free_region`
--> $DIR/expect-fn-supply-fn.rs:1:1
|
LL | / fn with_closure_expecting_fn_with_free_region<F>(_: F)
LL | | where F: for<'a> FnOnce(fn(&'a u32), &i32)
LL | | {
LL | | }
| |_^
error[E0631]: type mismatch in closure arguments
--> $DIR/expect-fn-supply-fn.rs:37:5
|
LL | with_closure_expecting_fn_with_bound_region(|x: fn(&'x u32), y| {});
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ------------------- found signature of `fn(fn(&'x u32), _) -> _`
| |
| expected signature of `fn(for<'r> fn(&'r u32), &i32) -> _`
|
note: required by `with_closure_expecting_fn_with_bound_region`
--> $DIR/expect-fn-supply-fn.rs:6:1
|
LL | / fn with_closure_expecting_fn_with_bound_region<F>(_: F)
LL | | where F: FnOnce(fn(&u32), &i32)
LL | | {
LL | | }
| |_^
error[E0631]: type mismatch in closure arguments
--> $DIR/expect-fn-supply-fn.rs:46:5
|
LL | with_closure_expecting_fn_with_bound_region(|x: Foo<'_>, y| {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ --------------- found signature of `for<'r> fn(fn(&'r u32), _) -> _`
| |
| expected signature of `fn(for<'r> fn(&'r u32), &i32) -> _`
|
note: required by `with_closure_expecting_fn_with_bound_region`
--> $DIR/expect-fn-supply-fn.rs:6:1
|
LL | / fn with_closure_expecting_fn_with_bound_region<F>(_: F)
LL | | where F: FnOnce(fn(&u32), &i32)
LL | | {
LL | | }
| |_^
error: aborting due to 3 previous errors

View file

@ -0,0 +1,37 @@
error[E0621]: explicit lifetime required in the type of `x`
--> $DIR/closure-bounds-static-cant-capture-borrowed.rs:5:5
|
LL | fn foo(x: &()) {
| --- help: add explicit lifetime `'static` to the type of `x`: `&'static ()`
LL | / bar(|| {
LL | |
LL | | let _ = x;
LL | | })
| |______^ lifetime `'static` required
error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function
--> $DIR/closure-bounds-static-cant-capture-borrowed.rs:5:9
|
LL | bar(|| {
| ^^ may outlive borrowed value `x`
LL |
LL | let _ = x;
| - `x` is borrowed here
|
note: function requires argument type to outlive `'static`
--> $DIR/closure-bounds-static-cant-capture-borrowed.rs:5:5
|
LL | / bar(|| {
LL | |
LL | | let _ = x;
LL | | })
| |______^
help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword
|
LL | bar(move || {
| ^^^^^^^
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0373, E0621.
For more information about an error, try `rustc --explain E0373`.

View file

@ -0,0 +1,42 @@
error[E0521]: borrowed data escapes outside of closure
--> $DIR/expect-region-supply-region.rs:18:9
|
LL | let mut f: Option<&u32> = None;
| ----- `f` is declared here, outside of the closure body
LL | closure_expecting_bound(|x| {
| - `x` is a reference that is only valid in the closure body
LL | f = Some(x);
| ^^^^^^^^^^^ `x` escapes the closure body here
error[E0521]: borrowed data escapes outside of closure
--> $DIR/expect-region-supply-region.rs:28:9
|
LL | let mut f: Option<&u32> = None;
| ----- `f` is declared here, outside of the closure body
LL | closure_expecting_bound(|x: &u32| {
| - `x` is a reference that is only valid in the closure body
LL | f = Some(x);
| ^^^^^^^^^^^ `x` escapes the closure body here
error: lifetime may not live long enough
--> $DIR/expect-region-supply-region.rs:37:30
|
LL | fn expect_bound_supply_named<'x>() {
| -- lifetime `'x` defined here
...
LL | closure_expecting_bound(|x: &'x u32| {
| ^ - let's call the lifetime of this reference `'1`
| |
| requires that `'1` must outlive `'x`
error: lifetime may not live long enough
--> $DIR/expect-region-supply-region.rs:37:30
|
LL | fn expect_bound_supply_named<'x>() {
| -- lifetime `'x` defined here
...
LL | closure_expecting_bound(|x: &'x u32| {
| ^ requires that `'x` must outlive `'static`
error: aborting due to 4 previous errors

View file

@ -0,0 +1,31 @@
error[E0005]: refutable pattern in function argument: `&[]` not covered
--> $DIR/const_let_refutable.rs:3:16
|
LL | const fn slice([a, b]: &[i32]) -> i32 {
| ^^^^^^ pattern `&[]` not covered
error[E0723]: can only call other `const fn` within a `const fn`, but `const std::ops::Add::add` is not stable as `const fn`
--> $DIR/const_let_refutable.rs:4:5
|
LL | a + b
| ^^^^^
|
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
= help: add #![feature(const_fn)] to the crate attributes to enable
error[E0381]: use of possibly uninitialized variable: `a`
--> $DIR/const_let_refutable.rs:4:5
|
LL | a + b
| ^ use of possibly uninitialized `a`
error[E0381]: use of possibly uninitialized variable: `b`
--> $DIR/const_let_refutable.rs:4:9
|
LL | a + b
| ^ use of possibly uninitialized `b`
error: aborting due to 4 previous errors
Some errors have detailed explanations: E0005, E0381, E0723.
For more information about an error, try `rustc --explain E0005`.

View file

@ -0,0 +1,328 @@
error[E0493]: destructors cannot be evaluated at compile-time
--> $DIR/min_const_fn.rs:37:25
|
LL | const fn into_inner(self) -> T { self.0 }
| ^^^^ constant functions cannot evaluate destructors
error[E0723]: mutable references in const fn are unstable
--> $DIR/min_const_fn.rs:39:36
|
LL | const fn get_mut(&mut self) -> &mut T { &mut self.0 }
| ^^^^^^
|
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
= help: add #![feature(const_fn)] to the crate attributes to enable
error[E0493]: destructors cannot be evaluated at compile-time
--> $DIR/min_const_fn.rs:44:28
|
LL | const fn into_inner_lt(self) -> T { self.0 }
| ^^^^ constant functions cannot evaluate destructors
error[E0723]: mutable references in const fn are unstable
--> $DIR/min_const_fn.rs:46:42
|
LL | const fn get_mut_lt(&'a mut self) -> &mut T { &mut self.0 }
| ^^^^^^
|
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
= help: add #![feature(const_fn)] to the crate attributes to enable
error[E0493]: destructors cannot be evaluated at compile-time
--> $DIR/min_const_fn.rs:51:27
|
LL | const fn into_inner_s(self) -> T { self.0 }
| ^^^^ constant functions cannot evaluate destructors
error[E0723]: mutable references in const fn are unstable
--> $DIR/min_const_fn.rs:53:38
|
LL | const fn get_mut_s(&mut self) -> &mut T { &mut self.0 }
| ^^^^^^
|
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
= help: add #![feature(const_fn)] to the crate attributes to enable
error[E0723]: mutable references in const fn are unstable
--> $DIR/min_const_fn.rs:58:39
|
LL | const fn get_mut_sq(&mut self) -> &mut T { &mut self.0 }
| ^^^^^^
|
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
= help: add #![feature(const_fn)] to the crate attributes to enable
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
--> $DIR/min_const_fn.rs:76:16
|
LL | const fn foo11<T: std::fmt::Display>(t: T) -> T { t }
| ^
|
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
= help: add #![feature(const_fn)] to the crate attributes to enable
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
--> $DIR/min_const_fn.rs:78:18
|
LL | const fn foo11_2<T: Send>(t: T) -> T { t }
| ^
|
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
= help: add #![feature(const_fn)] to the crate attributes to enable
error[E0723]: only int, `bool` and `char` operations are stable in const fn
--> $DIR/min_const_fn.rs:80:33
|
LL | const fn foo19(f: f32) -> f32 { f * 2.0 }
| ^^^^^^^
|
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
= help: add #![feature(const_fn)] to the crate attributes to enable
error[E0723]: only int, `bool` and `char` operations are stable in const fn
--> $DIR/min_const_fn.rs:82:35
|
LL | const fn foo19_2(f: f32) -> f32 { 2.0 - f }
| ^^^^^^^
|
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
= help: add #![feature(const_fn)] to the crate attributes to enable
error[E0723]: only int and `bool` operations are stable in const fn
--> $DIR/min_const_fn.rs:84:35
|
LL | const fn foo19_3(f: f32) -> f32 { -f }
| ^^
|
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
= help: add #![feature(const_fn)] to the crate attributes to enable
error[E0723]: only int, `bool` and `char` operations are stable in const fn
--> $DIR/min_const_fn.rs:86:43
|
LL | const fn foo19_4(f: f32, g: f32) -> f32 { f / g }
| ^^^^^
|
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
= help: add #![feature(const_fn)] to the crate attributes to enable
error[E0723]: cannot access `static` items in const fn
--> $DIR/min_const_fn.rs:90:27
|
LL | const fn foo25() -> u32 { BAR }
| ^^^
|
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
= help: add #![feature(const_fn)] to the crate attributes to enable
error[E0723]: cannot access `static` items in const fn
--> $DIR/min_const_fn.rs:91:36
|
LL | const fn foo26() -> &'static u32 { &BAR }
| ^^^^
|
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
= help: add #![feature(const_fn)] to the crate attributes to enable
error[E0723]: casting pointers to ints is unstable in const fn
--> $DIR/min_const_fn.rs:92:42
|
LL | const fn foo30(x: *const u32) -> usize { x as usize }
| ^^^^^^^^^^
|
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
= help: add #![feature(const_fn)] to the crate attributes to enable
error[E0723]: casting pointers to ints is unstable in const fn
--> $DIR/min_const_fn.rs:94:63
|
LL | const fn foo30_with_unsafe(x: *const u32) -> usize { unsafe { x as usize } }
| ^^^^^^^^^^
|
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
= help: add #![feature(const_fn)] to the crate attributes to enable
error[E0723]: casting pointers to ints is unstable in const fn
--> $DIR/min_const_fn.rs:96:42
|
LL | const fn foo30_2(x: *mut u32) -> usize { x as usize }
| ^^^^^^^^^^
|
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
= help: add #![feature(const_fn)] to the crate attributes to enable
error[E0723]: casting pointers to ints is unstable in const fn
--> $DIR/min_const_fn.rs:98:63
|
LL | const fn foo30_2_with_unsafe(x: *mut u32) -> usize { unsafe { x as usize } }
| ^^^^^^^^^^
|
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
= help: add #![feature(const_fn)] to the crate attributes to enable
error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn
--> $DIR/min_const_fn.rs:100:38
|
LL | const fn foo30_4(b: bool) -> usize { if b { 1 } else { 42 } }
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
= help: add #![feature(const_fn)] to the crate attributes to enable
error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn
--> $DIR/min_const_fn.rs:102:29
|
LL | const fn foo30_5(b: bool) { while b { } }
| ^^^^^^^^^^^
|
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
= help: add #![feature(const_fn)] to the crate attributes to enable
error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn
--> $DIR/min_const_fn.rs:104:44
|
LL | const fn foo36(a: bool, b: bool) -> bool { a && b }
| ^^^^^^
|
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
= help: add #![feature(const_fn)] to the crate attributes to enable
error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn
--> $DIR/min_const_fn.rs:106:44
|
LL | const fn foo37(a: bool, b: bool) -> bool { a || b }
| ^^^^^^
|
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
= help: add #![feature(const_fn)] to the crate attributes to enable
error[E0723]: mutable references in const fn are unstable
--> $DIR/min_const_fn.rs:108:14
|
LL | const fn inc(x: &mut i32) { *x += 1 }
| ^
|
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
= help: add #![feature(const_fn)] to the crate attributes to enable
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
--> $DIR/min_const_fn.rs:113:6
|
LL | impl<T: std::fmt::Debug> Foo<T> {
| ^
|
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
= help: add #![feature(const_fn)] to the crate attributes to enable
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
--> $DIR/min_const_fn.rs:118:6
|
LL | impl<T: std::fmt::Debug + Sized> Foo<T> {
| ^
|
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
= help: add #![feature(const_fn)] to the crate attributes to enable
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
--> $DIR/min_const_fn.rs:123:6
|
LL | impl<T: Sync + Sized> Foo<T> {
| ^
|
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
= help: add #![feature(const_fn)] to the crate attributes to enable
error[E0723]: `impl Trait` in const fn is unstable
--> $DIR/min_const_fn.rs:129:24
|
LL | const fn no_rpit2() -> AlanTuring<impl std::fmt::Debug> { AlanTuring(0) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
= help: add #![feature(const_fn)] to the crate attributes to enable
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
--> $DIR/min_const_fn.rs:131:34
|
LL | const fn no_apit2(_x: AlanTuring<impl std::fmt::Debug>) {}
| ^^^^^^^^^^^^^^^^^^^^
|
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
= help: add #![feature(const_fn)] to the crate attributes to enable
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
--> $DIR/min_const_fn.rs:133:22
|
LL | const fn no_apit(_x: impl std::fmt::Debug) {}
| ^^^^^^^^^^^^^^^^^^^^
|
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
= help: add #![feature(const_fn)] to the crate attributes to enable
error[E0723]: `impl Trait` in const fn is unstable
--> $DIR/min_const_fn.rs:134:23
|
LL | const fn no_rpit() -> impl std::fmt::Debug {}
| ^^^^^^^^^^^^^^^^^^^^
|
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
= help: add #![feature(const_fn)] to the crate attributes to enable
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
--> $DIR/min_const_fn.rs:135:23
|
LL | const fn no_dyn_trait(_x: &dyn std::fmt::Debug) {}
| ^^
|
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
= help: add #![feature(const_fn)] to the crate attributes to enable
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
--> $DIR/min_const_fn.rs:136:32
|
LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
= help: add #![feature(const_fn)] to the crate attributes to enable
error[E0515]: cannot return reference to temporary value
--> $DIR/min_const_fn.rs:136:63
|
LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() }
| ^--
| ||
| |temporary value created here
| returns a reference to data owned by the current function
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
--> $DIR/min_const_fn.rs:144:41
|
LL | const fn really_no_traits_i_mean_it() { (&() as &std::fmt::Debug, ()).1 }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
= help: add #![feature(const_fn)] to the crate attributes to enable
error[E0723]: function pointers in const fn are unstable
--> $DIR/min_const_fn.rs:147:21
|
LL | const fn no_fn_ptrs(_x: fn()) {}
| ^^
|
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
= help: add #![feature(const_fn)] to the crate attributes to enable
error[E0723]: function pointers in const fn are unstable
--> $DIR/min_const_fn.rs:149:27
|
LL | const fn no_fn_ptrs2() -> fn() { fn foo() {} foo }
| ^^^^
|
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
= help: add #![feature(const_fn)] to the crate attributes to enable
error: aborting due to 37 previous errors
Some errors have detailed explanations: E0515, E0723.
For more information about an error, try `rustc --explain E0515`.

View file

@ -0,0 +1,31 @@
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
--> $DIR/min_const_fn_dyn.rs:9:5
|
LL | x.0.field;
| ^^^^^^^^^
|
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
= help: add #![feature(const_fn)] to the crate attributes to enable
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
--> $DIR/min_const_fn_dyn.rs:12:66
|
LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasDyn { field: &0 }) }
| ^^
|
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
= help: add #![feature(const_fn)] to the crate attributes to enable
error[E0716]: temporary value dropped while borrowed
--> $DIR/min_const_fn_dyn.rs:12:67
|
LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasDyn { field: &0 }) }
| -^ - temporary value is freed at the end of this statement
| ||
| |creates a temporary which is freed while still in use
| cast requires that borrow lasts for `'static`
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0716, E0723.
For more information about an error, try `rustc --explain E0716`.

View file

@ -0,0 +1,7 @@
error[E0601]: `main` function not found in crate `continue_after_missing_main`
|
= note: consider adding a `main` function to `$DIR/continue-after-missing-main.rs`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0601`.

View file

@ -0,0 +1,23 @@
error[E0005]: refutable pattern in local binding: `T(_, _)` not covered
--> $DIR/empty-never-array.rs:10:9
|
LL | / enum Helper<T, U> {
LL | | T(T, [!; 0]),
LL | | #[allow(dead_code)]
LL | | U(U),
LL | | }
| |_- `Helper<T, U>` defined here
...
LL | let Helper::U(u) = Helper::T(t, []);
| ^^^^^^^^^^^^ pattern `T(_, _)` not covered
error[E0381]: use of possibly uninitialized variable: `u`
--> $DIR/empty-never-array.rs:12:5
|
LL | u
| ^ use of possibly uninitialized `u`
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0005, E0381.
For more information about an error, try `rustc --explain E0005`.

View file

@ -0,0 +1,13 @@
error[E0502]: cannot borrow `*a` as mutable because it is also borrowed as immutable
--> $DIR/E0502.rs:4:9
|
LL | let ref y = a;
| ----- immutable borrow occurs here
LL | bar(a);
| ^ mutable borrow occurs here
LL | y.use_ref();
| - immutable borrow later used here
error: aborting due to previous error
For more information about this error, try `rustc --explain E0502`.

View file

@ -0,0 +1,11 @@
error: lifetime may not live long enough
--> $DIR/E0621-does-not-trigger-for-closures.rs:15:45
|
LL | invoke(&x, |a, b| if a > b { a } else { b });
| -- ^ returning this value requires that `'1` must outlive `'2`
| ||
| |return type of closure is &'2 i32
| has type `&'1 i32`
error: aborting due to previous error

View file

@ -0,0 +1,18 @@
error: at least one trait must be specified
--> $DIR/generic_type_does_not_live_long_enough.rs:9:35
|
LL | existential type WrongGeneric<T>: 'static;
| ^^^^^^^
error[E0308]: mismatched types
--> $DIR/generic_type_does_not_live_long_enough.rs:6:18
|
LL | let z: i32 = x;
| ^ expected i32, found opaque type
|
= note: expected type `i32`
found type `WrongGeneric::<&{integer}>`
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0308`.

View file

@ -0,0 +1,41 @@
error[E0716]: temporary value dropped while borrowed
--> $DIR/auto-trait-regions.rs:44:24
|
LL | let a = A(&mut true, &mut true, No);
| ^^^^ - temporary value is freed at the end of this statement
| |
| creates a temporary which is freed while still in use
LL | yield;
LL | assert_foo(a);
| - borrow later used here
|
= note: consider using a `let` binding to create a longer lived value
error[E0716]: temporary value dropped while borrowed
--> $DIR/auto-trait-regions.rs:44:35
|
LL | let a = A(&mut true, &mut true, No);
| ^^^^ - temporary value is freed at the end of this statement
| |
| creates a temporary which is freed while still in use
LL | yield;
LL | assert_foo(a);
| - borrow later used here
|
= note: consider using a `let` binding to create a longer lived value
error: higher-ranked subtype error
--> $DIR/auto-trait-regions.rs:30:5
|
LL | assert_foo(gen);
| ^^^^^^^^^^^^^^^
error: higher-ranked subtype error
--> $DIR/auto-trait-regions.rs:48:5
|
LL | assert_foo(gen);
| ^^^^^^^^^^^^^^^
error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0716`.

View file

@ -0,0 +1,15 @@
error[E0502]: cannot borrow `my_stuff` as mutable because it is also borrowed as immutable
--> $DIR/hashmap-iter-value-lifetime.rs:7:5
|
LL | let (_, thing) = my_stuff.iter().next().unwrap();
| -------- immutable borrow occurs here
LL |
LL | my_stuff.clear();
| ^^^^^^^^ mutable borrow occurs here
LL |
LL | println!("{}", *thing);
| ------ immutable borrow later used here
error: aborting due to previous error
For more information about this error, try `rustc --explain E0502`.

View file

@ -0,0 +1,13 @@
error[E0502]: cannot borrow `my_stuff` as mutable because it is also borrowed as immutable
--> $DIR/hashmap-lifetimes.rs:6:5
|
LL | let mut it = my_stuff.iter();
| -------- immutable borrow occurs here
LL | my_stuff.insert(1, 43);
| ^^^^^^^^ mutable borrow occurs here
LL | it;
| -- immutable borrow later used here
error: aborting due to previous error
For more information about this error, try `rustc --explain E0502`.

View file

@ -0,0 +1,30 @@
error: lifetime may not live long enough
--> $DIR/hr-subtype.rs:33:13
|
LL | fn subtype<'x,'y:'x,'z:'y>() {
| -- -- lifetime `'y` defined here
| |
| lifetime `'x` defined here
LL | gimme::<$t2>(None::<$t1>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'x` must outlive `'y`
...
LL | / check! { free_inv_x_vs_free_inv_y: (fn(Inv<'x>),
LL | | fn(Inv<'y>)) }
| |__________________________________________________- in this macro invocation
error: lifetime may not live long enough
--> $DIR/hr-subtype.rs:39:13
|
LL | fn supertype<'x,'y:'x,'z:'y>() {
| -- -- lifetime `'y` defined here
| |
| lifetime `'x` defined here
LL | gimme::<$t1>(None::<$t2>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'x` must outlive `'y`
...
LL | / check! { free_inv_x_vs_free_inv_y: (fn(Inv<'x>),
LL | | fn(Inv<'y>)) }
| |__________________________________________________- in this macro invocation
error: aborting due to 2 previous errors

View file

@ -0,0 +1,16 @@
error: lifetime may not live long enough
--> $DIR/hr-subtype.rs:39:13
|
LL | fn supertype<'x,'y:'x,'z:'y>() {
| -- -- lifetime `'y` defined here
| |
| lifetime `'x` defined here
LL | gimme::<$t1>(None::<$t2>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'x` must outlive `'y`
...
LL | / check! { free_x_vs_free_y: (fn(&'x u32),
LL | | fn(&'y u32)) }
| |__________________________________________- in this macro invocation
error: aborting due to previous error

View file

@ -0,0 +1,8 @@
error: higher-ranked subtype error
--> $DIR/hrtb-cache-issue-54302.rs:19:5
|
LL | assert_deserialize_owned::<&'static str>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error

View file

@ -0,0 +1,77 @@
warning: function cannot return without recursing
--> $DIR/hrtb-perfect-forwarding.rs:22:1
|
LL | / fn no_hrtb<'b,T>(mut t: T)
LL | | where T : Bar<&'b isize>
LL | | {
LL | | // OK -- `T : Bar<&'b isize>`, and thus the impl above ensures that
LL | | // `&mut T : Bar<&'b isize>`.
LL | | no_hrtb(&mut t);
| | --------------- recursive call site
LL | | }
| |_^ cannot return without recursing
|
= note: #[warn(unconditional_recursion)] on by default
= help: a `loop` may express intention better if this is on purpose
warning: function cannot return without recursing
--> $DIR/hrtb-perfect-forwarding.rs:30:1
|
LL | / fn bar_hrtb<T>(mut t: T)
LL | | where T : for<'b> Bar<&'b isize>
LL | | {
LL | | // OK -- `T : for<'b> Bar<&'b isize>`, and thus the impl above
... |
LL | | bar_hrtb(&mut t);
| | ---------------- recursive call site
LL | | }
| |_^ cannot return without recursing
|
= help: a `loop` may express intention better if this is on purpose
warning: function cannot return without recursing
--> $DIR/hrtb-perfect-forwarding.rs:39:1
|
LL | / fn foo_hrtb_bar_not<'b,T>(mut t: T)
LL | | where T : for<'a> Foo<&'a isize> + Bar<&'b isize>
LL | | {
LL | | // Not OK -- The forwarding impl for `Foo` requires that `Bar` also
... |
LL | | foo_hrtb_bar_not(&mut t);
| | ------------------------ recursive call site
LL | | }
| |_^ cannot return without recursing
|
= help: a `loop` may express intention better if this is on purpose
error: higher-ranked subtype error
--> $DIR/hrtb-perfect-forwarding.rs:46:5
|
LL | foo_hrtb_bar_not(&mut t);
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: lifetime may not live long enough
--> $DIR/hrtb-perfect-forwarding.rs:46:5
|
LL | fn foo_hrtb_bar_not<'b,T>(mut t: T)
| -- lifetime `'b` defined here
...
LL | foo_hrtb_bar_not(&mut t);
| ^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'b` must outlive `'static`
warning: function cannot return without recursing
--> $DIR/hrtb-perfect-forwarding.rs:49:1
|
LL | / fn foo_hrtb_bar_hrtb<T>(mut t: T)
LL | | where T : for<'a> Foo<&'a isize> + for<'b> Bar<&'b isize>
LL | | {
LL | | // OK -- now we have `T : for<'b> Bar&'b isize>`.
LL | | foo_hrtb_bar_hrtb(&mut t);
| | ------------------------- recursive call site
LL | | }
| |_^ cannot return without recursing
|
= help: a `loop` may express intention better if this is on purpose
error: aborting due to 2 previous errors

View file

@ -0,0 +1,10 @@
error[E0521]: borrowed data escapes outside of function
--> $DIR/dyn-trait.rs:20:5
|
LL | fn with_dyn_debug_static<'a>(x: Box<dyn Debug + 'a>) {
| - `x` is a reference that is only valid in the function body
LL | static_val(x);
| ^^^^^^^^^^^^^ `x` escapes the function body here
error: aborting due to previous error

View file

@ -0,0 +1,51 @@
error: lifetime may not live long enough
--> $DIR/must_outlive_least_region_or_bound.rs:3:23
|
LL | fn elided(x: &i32) -> impl Copy { x }
| - ^^^^^^^^^ opaque type requires that `'1` must outlive `'static`
| |
| let's call the lifetime of this reference `'1`
help: to allow this impl Trait to capture borrowed data with lifetime `'1`, add `'_` as a constraint
|
LL | fn elided(x: &i32) -> impl Copy + '_ { x }
| ^^^^^^^^^^^^^^
error: lifetime may not live long enough
--> $DIR/must_outlive_least_region_or_bound.rs:6:32
|
LL | fn explicit<'a>(x: &'a i32) -> impl Copy { x }
| -- ^^^^^^^^^ opaque type requires that `'a` must outlive `'static`
| |
| lifetime `'a` defined here
help: to allow this impl Trait to capture borrowed data with lifetime `'a`, add `'a` as a constraint
|
LL | fn explicit<'a>(x: &'a i32) -> impl Copy + 'a { x }
| ^^^^^^^^^^^^^^
error: lifetime may not live long enough
--> $DIR/must_outlive_least_region_or_bound.rs:12:69
|
LL | fn with_bound<'a>(x: &'a i32) -> impl LifetimeTrait<'a> + 'static { x }
| -- lifetime `'a` defined here ^ returning this value requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: lifetime may not live long enough
--> $DIR/must_outlive_least_region_or_bound.rs:17:61
|
LL | fn move_lifetime_into_fn<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Fn(&'a u32) {
| -- -- lifetime `'b` defined here ^^^^^^^^^^^^^^^^ opaque type requires that `'b` must outlive `'a`
| |
| lifetime `'a` defined here
error[E0310]: the parameter type `T` may not live long enough
--> $DIR/must_outlive_least_region_or_bound.rs:22:51
|
LL | fn ty_param_wont_outlive_static<T:Debug>(x: T) -> impl Debug + 'static {
| ^^^^^^^^^^^^^^^^^^^^
|
= help: consider adding an explicit lifetime bound `T: 'static`...
error: aborting due to 5 previous errors
For more information about this error, try `rustc --explain E0310`.

View file

@ -0,0 +1,26 @@
error: lifetime may not live long enough
--> $DIR/static-return-lifetime-infered.rs:6:35
|
LL | fn iter_values_anon(&self) -> impl Iterator<Item=u32> {
| - ^^^^^^^^^^^^^^^^^^^^^^^ opaque type requires that `'1` must outlive `'static`
| |
| let's call the lifetime of this reference `'1`
help: to allow this impl Trait to capture borrowed data with lifetime `'1`, add `'_` as a constraint
|
LL | fn iter_values_anon(&self) -> impl Iterator<Item=u32> + '_ {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: lifetime may not live long enough
--> $DIR/static-return-lifetime-infered.rs:10:37
|
LL | fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> {
| -- ^^^^^^^^^^^^^^^^^^^^^^^ opaque type requires that `'a` must outlive `'static`
| |
| lifetime `'a` defined here
help: to allow this impl Trait to capture borrowed data with lifetime `'a`, add `'a` as a constraint
|
LL | fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> + 'a {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors

View file

@ -0,0 +1,11 @@
error[E0310]: the parameter type `T` may not live long enough
--> $DIR/type_parameters_captured.rs:7:20
|
LL | fn foo<T>(x: T) -> impl Any + 'static {
| ^^^^^^^^^^^^^^^^^^
|
= help: consider adding an explicit lifetime bound `T: 'static`...
error: aborting due to previous error
For more information about this error, try `rustc --explain E0310`.

View file

@ -0,0 +1,20 @@
error[E0621]: explicit lifetime required in the type of `y`
--> $DIR/mismatched.rs:4:42
|
LL | fn foo(x: &'a u32, y: &u32) -> &'a u32 { y }
| ---- ^ lifetime `'a` required
| |
| help: add explicit lifetime `'a` to the type of `y`: `&'a u32`
error: lifetime may not live long enough
--> $DIR/mismatched.rs:6:46
|
LL | fn foo2(x: &'a u32, y: &'b u32) -> &'a u32 { y }
| -- -- ^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
| | |
| | lifetime `'b` defined here
| lifetime `'a` defined here
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0621`.

View file

@ -0,0 +1,24 @@
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter 'a in generic type due to conflicting requirements
--> $DIR/mismatched_trait_impl.rs:9:5
|
LL | fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the method body at 9:5...
--> $DIR/mismatched_trait_impl.rs:9:5
|
LL | / fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 {
LL | | x
LL | | }
| |_____^
note: ...but the lifetime must also be valid for the lifetime 'a as defined on the method body at 9:32...
--> $DIR/mismatched_trait_impl.rs:9:32
|
LL | fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 {
| ^^
= note: ...so that the method type is compatible with trait:
expected fn(&i32, &'a u32, &u32) -> &'a u32
found fn(&i32, &u32, &u32) -> &u32
error: aborting due to previous error

View file

@ -0,0 +1,11 @@
error: lifetime may not live long enough
--> $DIR/issue-10291.rs:3:9
|
LL | fn test<'x>(x: &'x isize) {
| -- lifetime `'x` defined here
LL | drop::<Box<for<'z> FnMut(&'z isize) -> &'z isize>>(Box::new(|z| {
LL | x
| ^ returning this value requires that `'x` must outlive `'static`
error: aborting due to previous error

View file

@ -0,0 +1,12 @@
error[E0621]: explicit lifetime required in the type of `cont`
--> $DIR/issue-13058.rs:14:21
|
LL | fn check<'r, I: Iterator<Item=usize>, T: Itble<'r, usize, I>>(cont: &T) -> bool
| -- help: add explicit lifetime `'r` to the type of `cont`: `&'r T`
LL | {
LL | let cont_iter = cont.iter();
| ^^^^^^^^^^^ lifetime `'r` required
error: aborting due to previous error
For more information about this error, try `rustc --explain E0621`.

View file

@ -0,0 +1,11 @@
error[E0621]: explicit lifetime required in the type of `lexer`
--> $DIR/issue-15034.rs:17:9
|
LL | pub fn new(lexer: &'a mut Lexer) -> Parser<'a> {
| ------------- help: add explicit lifetime `'a` to the type of `lexer`: `&'a mut Lexer<'a>`
LL | Parser { lexer: lexer }
| ^^^^^^^^^^^^^^^^^^^^^^^ lifetime `'a` required
error: aborting due to previous error
For more information about this error, try `rustc --explain E0621`.

View file

@ -0,0 +1,16 @@
error[E0005]: refutable pattern in `for` loop binding: `&[]` not covered
--> $DIR/issue-15381.rs:4:9
|
LL | for &[x,y,z] in values.chunks(3).filter(|&xs| xs.len() == 3) {
| ^^^^^^^^ pattern `&[]` not covered
error[E0381]: borrow of possibly uninitialized variable: `y`
--> $DIR/issue-15381.rs:6:26
|
LL | println!("y={}", y);
| ^ use of possibly uninitialized `y`
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0005, E0381.
For more information about an error, try `rustc --explain E0005`.

View file

@ -0,0 +1,10 @@
error[E0521]: borrowed data escapes outside of function
--> $DIR/issue-16683.rs:4:9
|
LL | fn b(&self) {
| ----- `self` is a reference that is only valid in the function body
LL | self.a();
| ^^^^^^^^ `self` escapes the function body here
error: aborting due to previous error

View file

@ -0,0 +1,21 @@
error[E0308]: match arms have incompatible types
--> $DIR/issue-17728.rs:109:14
|
LL | / match to_parse {
LL | | "w" | "west" => RoomDirection::West,
LL | | "e" | "east" => RoomDirection::East,
LL | | "n" | "north" => RoomDirection::North,
... |
LL | | "down" => RoomDirection::Down,
| | ------------------- this and all prior arms are found to be of type `RoomDirection`
LL | | _ => None
| | ^^^^ expected enum `RoomDirection`, found enum `std::option::Option`
LL | | }
| |_____- `match` arms have incompatible types
|
= note: expected type `RoomDirection`
found type `std::option::Option<_>`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0308`.

View file

@ -0,0 +1,10 @@
error[E0521]: borrowed data escapes outside of function
--> $DIR/issue-17758.rs:7:9
|
LL | fn bar(&self) {
| ----- `self` is a reference that is only valid in the function body
LL | self.foo();
| ^^^^^^^^^^ `self` escapes the function body here
error: aborting due to previous error

View file

@ -0,0 +1,10 @@
error: lifetime may not live long enough
--> $DIR/issue-26217.rs:4:5
|
LL | fn bar<'a>() {
| -- lifetime `'a` defined here
LL | foo::<&'a i32>();
| ^^^^^^^^^^^^^^ requires that `'a` must outlive `'static`
error: aborting due to previous error

View file

@ -0,0 +1,12 @@
error: lifetime may not live long enough
--> $DIR/issue-28848.rs:10:5
|
LL | pub fn foo<'a, 'b>(u: &'b ()) -> &'a () {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
LL | Foo::<'a, 'b>::xmute(u)
| ^^^^^^^^^^^^^^^^^^^^ requires that `'b` must outlive `'a`
error: aborting due to previous error

View file

@ -0,0 +1,13 @@
error: captured variable cannot escape `FnMut` closure body
--> $DIR/issue-40510-1.rs:11:9
|
LL | || {
| - inferred to be a `FnMut` closure
LL | &mut x
| ^^^^^^ returns a reference to a captured variable which escapes the closure body
|
= note: `FnMut` closures only have access to their captured variables while they are executing...
= note: ...therefore, they cannot allow references to captured variables to escape
error: aborting due to previous error

View file

@ -1,5 +1,5 @@
warning: captured variable cannot escape `FnMut` closure body
--> $DIR/issue-40510-1.rs:8:9
--> $DIR/issue-40510-1.rs:11:9
|
LL | || {
| - inferred to be a `FnMut` closure
@ -11,3 +11,11 @@ LL | &mut x
= warning: this error has been downgraded to a warning for backwards compatibility with previous releases
= warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
error: compilation successful
--> $DIR/issue-40510-1.rs:20:1
|
LL | fn main() {}
| ^^^^^^^^^^^^
error: aborting due to previous error

View file

@ -0,0 +1,13 @@
error: captured variable cannot escape `FnMut` closure body
--> $DIR/issue-40510-1.rs:11:9
|
LL | || {
| - inferred to be a `FnMut` closure
LL | &mut x
| ^^^^^^ returns a reference to a captured variable which escapes the closure body
|
= note: `FnMut` closures only have access to their captured variables while they are executing...
= note: ...therefore, they cannot allow references to captured variables to escape
error: aborting due to previous error

View file

@ -1,13 +1,21 @@
// compile-pass
#![feature(rustc_attrs)]
#![allow(unused)]
// revisions: migrate nll
#![cfg_attr(nll, feature(nll))]
fn f() {
let mut x: Box<()> = Box::new(());
|| {
&mut x
};
//[migrate]~^^ WARNING captured variable cannot escape `FnMut` closure body
//[migrate]~| WARNING this error has been downgraded to a warning
//[migrate]~| WARNING this warning will become a hard error in the future
//[nll]~^^^^^ ERROR captured variable cannot escape `FnMut` closure body
}
#[rustc_error]
fn main() {}
//[migrate]~^ ERROR

View file

@ -0,0 +1,15 @@
error: captured variable cannot escape `FnMut` closure body
--> $DIR/issue-40510-3.rs:11:9
|
LL | || {
| - inferred to be a `FnMut` closure
LL | / || {
LL | | x.push(())
LL | | }
| |_________^ returns a closure that contains a reference to a captured variable, which then escapes the closure body
|
= note: `FnMut` closures only have access to their captured variables while they are executing...
= note: ...therefore, they cannot allow references to captured variables to escape
error: aborting due to previous error

View file

@ -1,5 +1,5 @@
warning: captured variable cannot escape `FnMut` closure body
--> $DIR/issue-40510-3.rs:8:9
--> $DIR/issue-40510-3.rs:11:9
|
LL | || {
| - inferred to be a `FnMut` closure
@ -13,3 +13,11 @@ LL | | }
= warning: this error has been downgraded to a warning for backwards compatibility with previous releases
= warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
error: compilation successful
--> $DIR/issue-40510-3.rs:22:1
|
LL | fn main() {}
| ^^^^^^^^^^^^
error: aborting due to previous error

View file

@ -0,0 +1,15 @@
error: captured variable cannot escape `FnMut` closure body
--> $DIR/issue-40510-3.rs:11:9
|
LL | || {
| - inferred to be a `FnMut` closure
LL | / || {
LL | | x.push(())
LL | | }
| |_________^ returns a closure that contains a reference to a captured variable, which then escapes the closure body
|
= note: `FnMut` closures only have access to their captured variables while they are executing...
= note: ...therefore, they cannot allow references to captured variables to escape
error: aborting due to previous error

View file

@ -1,6 +1,9 @@
// compile-pass
#![feature(rustc_attrs)]
#![allow(unused)]
// revisions: migrate nll
#![cfg_attr(nll, feature(nll))]
fn f() {
let mut x: Vec<()> = Vec::new();
@ -8,8 +11,13 @@ fn f() {
|| {
x.push(())
}
//[migrate]~^^^ WARNING captured variable cannot escape `FnMut` closure body
//[migrate]~| WARNING this error has been downgraded to a warning
//[migrate]~| WARNING this warning will become a hard error in the future
//[nll]~^^^^^^ ERROR captured variable cannot escape `FnMut` closure body
};
}
#[rustc_error]
fn main() {}
//[migrate]~^ ERROR

View file

@ -0,0 +1,18 @@
error: captured variable cannot escape `FnMut` closure body
--> $DIR/issue-49824.rs:10:9
|
LL | || {
| - inferred to be a `FnMut` closure
LL | / || {
LL | |
LL | |
LL | |
LL | | let _y = &mut x;
LL | | }
| |_________^ returns a closure that contains a reference to a captured variable, which then escapes the closure body
|
= note: `FnMut` closures only have access to their captured variables while they are executing...
= note: ...therefore, they cannot allow references to captured variables to escape
error: aborting due to previous error

View file

@ -0,0 +1,13 @@
error: lifetime may not live long enough
--> $DIR/issue-52213.rs:3:20
|
LL | fn transmute_lifetime<'a, 'b, T>(t: &'a (T,)) -> &'b T {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
LL | match (&t,) {
LL | ((u,),) => u,
| ^ returning this value requires that `'a` must outlive `'b`
error: aborting due to previous error

View file

@ -0,0 +1,11 @@
error: lifetime may not live long enough
--> $DIR/issue-52533-1.rs:9:18
|
LL | gimme(|x, y| y)
| - - ^ closure was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
| | |
| | has type `&Foo<'_, '1, u32>`
| has type `&Foo<'_, '2, u32>`
error: aborting due to previous error

View file

@ -0,0 +1,11 @@
error: lifetime may not live long enough
--> $DIR/issue-52533.rs:5:16
|
LL | foo(|a, b| b)
| - - ^ closure was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
| | |
| | has type `&'1 u32`
| has type `&'2 u32`
error: aborting due to previous error

View file

@ -0,0 +1,26 @@
error: higher-ranked subtype error
--> $DIR/issue-54302-cases.rs:63:5
|
LL | <u32 as RefFoo<u32>>::ref_foo(a)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: higher-ranked subtype error
--> $DIR/issue-54302-cases.rs:69:5
|
LL | <i32 as RefFoo<i32>>::ref_foo(a)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: higher-ranked subtype error
--> $DIR/issue-54302-cases.rs:75:5
|
LL | <u64 as RefFoo<u64>>::ref_foo(a)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: higher-ranked subtype error
--> $DIR/issue-54302-cases.rs:81:5
|
LL | <i64 as RefFoo<i64>>::ref_foo(a)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 4 previous errors

View file

@ -0,0 +1,8 @@
error: higher-ranked subtype error
--> $DIR/issue-54302.rs:13:5
|
LL | assert_deserialize_owned::<&'static str>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error

View file

@ -0,0 +1,11 @@
error: higher-ranked subtype error
--> $DIR/issue-55731.rs:48:5
|
LL | / multi(Map {
LL | | i: Cloned(PhantomData),
LL | | f: X,
LL | | });
| |______^
error: aborting due to previous error

View file

@ -0,0 +1,20 @@
error: lifetime may not live long enough
--> $DIR/issue-55796.rs:16:9
|
LL | pub trait Graph<'a> {
| -- lifetime `'a` defined here
...
LL | Box::new(self.out_edges(u).map(|e| e.target()))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
error: lifetime may not live long enough
--> $DIR/issue-55796.rs:21:9
|
LL | pub trait Graph<'a> {
| -- lifetime `'a` defined here
...
LL | Box::new(self.in_edges(u).map(|e| e.target()))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
error: aborting due to 2 previous errors

View file

@ -0,0 +1,8 @@
error: higher-ranked subtype error
--> $DIR/issue-57843.rs:23:9
|
LL | Foo(Box::new(|_| ()));
| ^^^^^^^^^^^^^^^^
error: aborting due to previous error

View file

@ -0,0 +1,63 @@
error[E0277]: `T` cannot be sent between threads safely
--> $DIR/kindck-impl-type-params.rs:18:13
|
LL | let a = &t as &Gettable<T>;
| ^^ `T` cannot be sent between threads safely
|
= help: the trait `std::marker::Send` is not implemented for `T`
= help: consider adding a `where T: std::marker::Send` bound
= note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
= note: required for the cast to the object type `dyn Gettable<T>`
error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
--> $DIR/kindck-impl-type-params.rs:18:13
|
LL | let a = &t as &Gettable<T>;
| ^^ the trait `std::marker::Copy` is not implemented for `T`
|
= help: consider adding a `where T: std::marker::Copy` bound
= note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
= note: required for the cast to the object type `dyn Gettable<T>`
error[E0277]: `T` cannot be sent between threads safely
--> $DIR/kindck-impl-type-params.rs:25:27
|
LL | let a: &Gettable<T> = &t;
| ^^ `T` cannot be sent between threads safely
|
= help: the trait `std::marker::Send` is not implemented for `T`
= help: consider adding a `where T: std::marker::Send` bound
= note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
= note: required for the cast to the object type `dyn Gettable<T>`
error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
--> $DIR/kindck-impl-type-params.rs:25:27
|
LL | let a: &Gettable<T> = &t;
| ^^ the trait `std::marker::Copy` is not implemented for `T`
|
= help: consider adding a `where T: std::marker::Copy` bound
= note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
= note: required for the cast to the object type `dyn Gettable<T>`
error[E0277]: the trait bound `std::string::String: std::marker::Copy` is not satisfied
--> $DIR/kindck-impl-type-params.rs:38:13
|
LL | let a = t as Box<Gettable<String>>;
| ^ the trait `std::marker::Copy` is not implemented for `std::string::String`
|
= note: required because of the requirements on the impl of `Gettable<std::string::String>` for `S<std::string::String>`
= note: required for the cast to the object type `dyn Gettable<std::string::String>`
error[E0277]: the trait bound `foo3::Foo: std::marker::Copy` is not satisfied
--> $DIR/kindck-impl-type-params.rs:46:33
|
LL | let a: Box<Gettable<Foo>> = t;
| ^ the trait `std::marker::Copy` is not implemented for `foo3::Foo`
|
= note: required because of the requirements on the impl of `Gettable<foo3::Foo>` for `S<foo3::Foo>`
= note: required for the cast to the object type `dyn Gettable<foo3::Foo>`
error: aborting due to 6 previous errors
For more information about this error, try `rustc --explain E0277`.

View file

@ -0,0 +1,32 @@
error[E0277]: `(dyn Dummy + 'a)` cannot be shared between threads safely
--> $DIR/kindck-send-object1.rs:10:5
|
LL | assert_send::<&'a Dummy>();
| ^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be shared between threads safely
|
= help: the trait `std::marker::Sync` is not implemented for `(dyn Dummy + 'a)`
= note: required because of the requirements on the impl of `std::marker::Send` for `&'a (dyn Dummy + 'a)`
note: required by `assert_send`
--> $DIR/kindck-send-object1.rs:5:1
|
LL | fn assert_send<T:Send+'static>() { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0277]: `(dyn Dummy + 'a)` cannot be sent between threads safely
--> $DIR/kindck-send-object1.rs:29:5
|
LL | assert_send::<Box<Dummy+'a>>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be sent between threads safely
|
= help: the trait `std::marker::Send` is not implemented for `(dyn Dummy + 'a)`
= note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique<(dyn Dummy + 'a)>`
= note: required because it appears within the type `std::boxed::Box<(dyn Dummy + 'a)>`
note: required by `assert_send`
--> $DIR/kindck-send-object1.rs:5:1
|
LL | fn assert_send<T:Send+'static>() { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0277`.

View file

@ -0,0 +1,20 @@
error[E0521]: borrowed data escapes outside of function
--> $DIR/lifetime-bound-will-change-warning.rs:34:5
|
LL | fn test2<'a>(x: &'a Box<Fn()+'a>) {
| - `x` is a reference that is only valid in the function body
LL | // but ref_obj will not, so warn.
LL | ref_obj(x)
| ^^^^^^^^^^ `x` escapes the function body here
error[E0521]: borrowed data escapes outside of function
--> $DIR/lifetime-bound-will-change-warning.rs:39:5
|
LL | fn test2cc<'a>(x: &'a Box<Fn()+'a>) {
| - `x` is a reference that is only valid in the function body
LL | // same as test2, but cross crate
LL | lib::ref_obj(x)
| ^^^^^^^^^^^^^^^ `x` escapes the function body here
error: aborting due to 2 previous errors

View file

@ -0,0 +1,13 @@
error: lifetime may not live long enough
--> $DIR/ex1-return-one-existing-name-if-else-using-impl.rs:11:20
|
LL | fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32 {
| -- - let's call the lifetime of this reference `'1`
| |
| lifetime `'a` defined here
LL |
LL | if x > y { x } else { y }
| ^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1`
error: aborting due to previous error

View file

@ -0,0 +1,13 @@
error: lifetime may not live long enough
--> $DIR/ex1-return-one-existing-name-return-type-is-anon.rs:8:5
|
LL | fn foo<'a>(&self, x: &'a i32) -> &i32 {
| -- - let's call the lifetime of this reference `'1`
| |
| lifetime `'a` defined here
LL |
LL | x
| ^ function was supposed to return data with lifetime `'1` but it is returning data with lifetime `'a`
error: aborting due to previous error

View file

@ -0,0 +1,13 @@
error: lifetime may not live long enough
--> $DIR/ex1-return-one-existing-name-self-is-anon.rs:8:30
|
LL | fn foo<'a>(&self, x: &'a Foo) -> &'a Foo {
| -- - let's call the lifetime of this reference `'1`
| |
| lifetime `'a` defined here
LL |
LL | if true { x } else { self }
| ^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1`
error: aborting due to previous error

View file

@ -0,0 +1,11 @@
error[E0621]: explicit lifetime required in the type of `x`
--> $DIR/ex2a-push-one-existing-name-2.rs:6:5
|
LL | fn foo<'a>(x: Ref<i32>, y: &mut Vec<Ref<'a, i32>>) {
| -------- help: add explicit lifetime `'a` to the type of `x`: `Ref<'a, i32>`
LL | y.push(x);
| ^^^^^^^^^ lifetime `'a` required
error: aborting due to previous error
For more information about this error, try `rustc --explain E0621`.

View file

@ -0,0 +1,12 @@
error[E0621]: explicit lifetime required in the type of `y`
--> $DIR/ex2a-push-one-existing-name-early-bound.rs:8:5
|
LL | fn baz<'a, 'b, T>(x: &mut Vec<&'a T>, y: &T)
| -- help: add explicit lifetime `'a` to the type of `y`: `&'a T`
...
LL | x.push(y);
| ^^^^^^^^^ lifetime `'a` required
error: aborting due to previous error
For more information about this error, try `rustc --explain E0621`.

View file

@ -0,0 +1,11 @@
error[E0621]: explicit lifetime required in the type of `y`
--> $DIR/ex2a-push-one-existing-name.rs:6:5
|
LL | fn foo<'a>(x: &mut Vec<Ref<'a, i32>>, y: Ref<i32>) {
| -------- help: add explicit lifetime `'a` to the type of `y`: `Ref<'a, i32>`
LL | x.push(y);
| ^^^^^^^^^ lifetime `'a` required
error: aborting due to previous error
For more information about this error, try `rustc --explain E0621`.

View file

@ -0,0 +1,12 @@
error: lifetime may not live long enough
--> $DIR/ex2b-push-no-existing-names.rs:6:5
|
LL | fn foo(x: &mut Vec<Ref<i32>>, y: Ref<i32>) {
| - - has type `Ref<'1, i32>`
| |
| has type `&mut std::vec::Vec<Ref<'2, i32>>`
LL | x.push(y);
| ^^^^^^^^^ argument requires that `'1` must outlive `'2`
error: aborting due to previous error

View file

@ -0,0 +1,13 @@
error: lifetime may not live long enough
--> $DIR/ex2c-push-inference-variable.rs:7:5
|
LL | fn foo<'a, 'b, 'c>(x: &'a mut Vec<Ref<'b, i32>>, y: Ref<'c, i32>) {
| -- -- lifetime `'c` defined here
| |
| lifetime `'b` defined here
LL | let z = Ref { data: y.data };
LL | x.push(z);
| ^^^^^^^^^ argument requires that `'c` must outlive `'b`
error: aborting due to previous error

View file

@ -0,0 +1,13 @@
error: lifetime may not live long enough
--> $DIR/ex2d-push-inference-variable-2.rs:8:5
|
LL | fn foo<'a, 'b, 'c>(x: &'a mut Vec<Ref<'b, i32>>, y: Ref<'c, i32>) {
| -- -- lifetime `'c` defined here
| |
| lifetime `'b` defined here
...
LL | a.push(b);
| ^^^^^^^^^ argument requires that `'c` must outlive `'b`
error: aborting due to previous error

View file

@ -0,0 +1,13 @@
error: lifetime may not live long enough
--> $DIR/ex2e-push-inference-variable-3.rs:8:5
|
LL | fn foo<'a, 'b, 'c>(x: &'a mut Vec<Ref<'b, i32>>, y: Ref<'c, i32>) {
| -- -- lifetime `'c` defined here
| |
| lifetime `'b` defined here
...
LL | Vec::push(a, b);
| ^^^^^^^^^^^^^^^ argument requires that `'c` must outlive `'b`
error: aborting due to previous error

View file

@ -0,0 +1,12 @@
error: lifetime may not live long enough
--> $DIR/ex3-both-anon-regions-2.rs:2:5
|
LL | fn foo(&mut (ref mut v, w): &mut (&u8, &u8), x: &u8) {
| - - let's call the lifetime of this reference `'1`
| |
| let's call the lifetime of this reference `'2`
LL | *v = x;
| ^^^^^^ assignment requires that `'1` must outlive `'2`
error: aborting due to previous error

View file

@ -0,0 +1,22 @@
error: lifetime may not live long enough
--> $DIR/ex3-both-anon-regions-3.rs:2:5
|
LL | fn foo(z: &mut Vec<(&u8,&u8)>, (x, y): (&u8, &u8)) {
| - - let's call the lifetime of this reference `'1`
| |
| let's call the lifetime of this reference `'2`
LL | z.push((x,y));
| ^^^^^^^^^^^^^ argument requires that `'1` must outlive `'2`
error: lifetime may not live long enough
--> $DIR/ex3-both-anon-regions-3.rs:2:5
|
LL | fn foo(z: &mut Vec<(&u8,&u8)>, (x, y): (&u8, &u8)) {
| - - let's call the lifetime of this reference `'1`
| |
| let's call the lifetime of this reference `'2`
LL | z.push((x,y));
| ^^^^^^^^^^^^^ argument requires that `'1` must outlive `'2`
error: aborting due to 2 previous errors

View file

@ -0,0 +1,12 @@
error: lifetime may not live long enough
--> $DIR/ex3-both-anon-regions-both-are-structs-2.rs:7:5
|
LL | fn foo(mut x: Ref, y: Ref) {
| ----- - has type `Ref<'_, '1>`
| |
| has type `Ref<'_, '2>`
LL | x.b = y.b;
| ^^^^^^^^^ assignment requires that `'1` must outlive `'2`
error: aborting due to previous error

View file

@ -0,0 +1,13 @@
error: lifetime may not live long enough
--> $DIR/ex3-both-anon-regions-both-are-structs-3.rs:7:5
|
LL | fn foo(mut x: Ref) {
| -----
| |
| has type `Ref<'_, '1>`
| has type `Ref<'2, '_>`
LL | x.a = x.b;
| ^^^^^^^^^ assignment requires that `'1` must outlive `'2`
error: aborting due to previous error

View file

@ -0,0 +1,13 @@
error: lifetime may not live long enough
--> $DIR/ex3-both-anon-regions-both-are-structs-earlybound-regions.rs:9:5
|
LL | fn foo<'a, 'b>(mut x: Vec<Ref<'a>>, y: Ref<'b>)
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
...
LL | x.push(y);
| ^^^^^^^^^ argument requires that `'b` must outlive `'a`
error: aborting due to previous error

View file

@ -0,0 +1,12 @@
error: lifetime may not live long enough
--> $DIR/ex3-both-anon-regions-both-are-structs-latebound-regions.rs:6:5
|
LL | fn foo<'a, 'b>(mut x: Vec<Ref<'a>>, y: Ref<'b>) {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
LL | x.push(y);
| ^^^^^^^^^ argument requires that `'b` must outlive `'a`
error: aborting due to previous error

View file

@ -0,0 +1,12 @@
error: lifetime may not live long enough
--> $DIR/ex3-both-anon-regions-both-are-structs.rs:6:5
|
LL | fn foo(mut x: Vec<Ref>, y: Ref) {
| ----- - has type `Ref<'1>`
| |
| has type `std::vec::Vec<Ref<'2>>`
LL | x.push(y);
| ^^^^^^^^^ argument requires that `'1` must outlive `'2`
error: aborting due to previous error

View file

@ -0,0 +1,12 @@
error: lifetime may not live long enough
--> $DIR/ex3-both-anon-regions-latebound-regions.rs:2:5
|
LL | fn foo<'a,'b>(x: &mut Vec<&'a u8>, y: &'b u8) {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
LL | x.push(y);
| ^^^^^^^^^ argument requires that `'b` must outlive `'a`
error: aborting due to previous error

View file

@ -0,0 +1,21 @@
error: lifetime may not live long enough
--> $DIR/ex3-both-anon-regions-one-is-struct-2.rs:4:5
|
LL | fn foo(mut x: Ref, y: &u32) {
| ----- - let's call the lifetime of this reference `'2`
| |
| has type `Ref<'_, '1>`
LL | y = x.b;
| ^^^^^^^ assignment requires that `'1` must outlive `'2`
error[E0384]: cannot assign to immutable argument `y`
--> $DIR/ex3-both-anon-regions-one-is-struct-2.rs:4:5
|
LL | fn foo(mut x: Ref, y: &u32) {
| - help: make this binding mutable: `mut y`
LL | y = x.b;
| ^^^^^^^ cannot assign to immutable argument
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0384`.

View file

@ -0,0 +1,12 @@
error: lifetime may not live long enough
--> $DIR/ex3-both-anon-regions-one-is-struct-3.rs:4:5
|
LL | fn foo(mut y: Ref, x: &u32) {
| ----- - let's call the lifetime of this reference `'1`
| |
| has type `Ref<'_, '2>`
LL | y.b = x;
| ^^^^^^^ assignment requires that `'1` must outlive `'2`
error: aborting due to previous error

View file

@ -0,0 +1,12 @@
error: lifetime may not live long enough
--> $DIR/ex3-both-anon-regions-one-is-struct-4.rs:4:5
|
LL | fn foo(mut y: Ref, x: &u32) {
| ----- - let's call the lifetime of this reference `'1`
| |
| has type `Ref<'_, '2>`
LL | y.b = x;
| ^^^^^^^ assignment requires that `'1` must outlive `'2`
error: aborting due to previous error

View file

@ -0,0 +1,12 @@
error: lifetime may not live long enough
--> $DIR/ex3-both-anon-regions-one-is-struct.rs:7:5
|
LL | fn foo(mut x: Ref, y: &u32) {
| ----- - let's call the lifetime of this reference `'1`
| |
| has type `Ref<'_, '2>`
LL | x.b = y;
| ^^^^^^^ assignment requires that `'1` must outlive `'2`
error: aborting due to previous error

View file

@ -0,0 +1,12 @@
error: lifetime may not live long enough
--> $DIR/ex3-both-anon-regions-return-type-is-anon.rs:7:5
|
LL | fn foo<'a>(&self, x: &i32) -> &i32 {
| - - let's call the lifetime of this reference `'1`
| |
| let's call the lifetime of this reference `'2`
LL | x
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
error: aborting due to previous error

View file

@ -0,0 +1,12 @@
error: lifetime may not live long enough
--> $DIR/ex3-both-anon-regions-self-is-anon.rs:7:19
|
LL | fn foo<'a>(&self, x: &Foo) -> &Foo {
| - - let's call the lifetime of this reference `'1`
| |
| let's call the lifetime of this reference `'2`
LL | if true { x } else { self }
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
error: aborting due to previous error

View file

@ -0,0 +1,21 @@
error[E0596]: cannot borrow `y` as mutable, as it is not declared as mutable
--> $DIR/ex3-both-anon-regions-using-fn-items.rs:2:3
|
LL | fn foo(x:fn(&u8, &u8), y: Vec<&u8>, z: &u8) {
| - help: consider changing this to be mutable: `mut y`
LL | y.push(z);
| ^ cannot borrow as mutable
error: lifetime may not live long enough
--> $DIR/ex3-both-anon-regions-using-fn-items.rs:2:3
|
LL | fn foo(x:fn(&u8, &u8), y: Vec<&u8>, z: &u8) {
| - - let's call the lifetime of this reference `'1`
| |
| let's call the lifetime of this reference `'2`
LL | y.push(z);
| ^^^^^^^^^ argument requires that `'1` must outlive `'2`
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0596`.

View file

@ -0,0 +1,12 @@
error: lifetime may not live long enough
--> $DIR/ex3-both-anon-regions-using-impl-items.rs:6:9
|
LL | fn foo(x: &mut Vec<&u8>, y: &u8) {
| - - let's call the lifetime of this reference `'1`
| |
| let's call the lifetime of this reference `'2`
LL | x.push(y);
| ^^^^^^^^^ argument requires that `'1` must outlive `'2`
error: aborting due to previous error

View file

@ -0,0 +1,21 @@
error[E0596]: cannot borrow `y` as mutable, as it is not declared as mutable
--> $DIR/ex3-both-anon-regions-using-trait-objects.rs:2:3
|
LL | fn foo(x:Box<Fn(&u8, &u8)> , y: Vec<&u8>, z: &u8) {
| - help: consider changing this to be mutable: `mut y`
LL | y.push(z);
| ^ cannot borrow as mutable
error: lifetime may not live long enough
--> $DIR/ex3-both-anon-regions-using-trait-objects.rs:2:3
|
LL | fn foo(x:Box<Fn(&u8, &u8)> , y: Vec<&u8>, z: &u8) {
| - - let's call the lifetime of this reference `'1`
| |
| let's call the lifetime of this reference `'2`
LL | y.push(z);
| ^^^^^^^^^ argument requires that `'1` must outlive `'2`
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0596`.

Some files were not shown because too many files have changed in this diff Show more