|
| 1 | +error: this file contains an unclosed delimiter |
| 2 | + --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:18:53 |
| 3 | + | |
| 4 | +LL | trait C{async fn new(val: T) {} |
| 5 | + | - unclosed delimiter |
| 6 | +... |
| 7 | +LL | |
| 8 | + | ^ |
| 9 | + |
| 10 | +error[E0670]: `async fn` is not permitted in Rust 2015 |
| 11 | + --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:6:5 |
| 12 | + | |
| 13 | +LL | async fn create(path: impl AsRef<std::path::Path>) { |
| 14 | + | ^^^^^ to use `async fn`, switch to Rust 2018 or later |
| 15 | + | |
| 16 | + = help: pass `--edition 2021` to `rustc` |
| 17 | + = note: for more on editions, read https://doc.rust-lang.org/edition-guide |
| 18 | + |
| 19 | +error[E0670]: `async fn` is not permitted in Rust 2015 |
| 20 | + --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:13:9 |
| 21 | + | |
| 22 | +LL | trait C{async fn new(val: T) {} |
| 23 | + | ^^^^^ to use `async fn`, switch to Rust 2018 or later |
| 24 | + | |
| 25 | + = help: pass `--edition 2021` to `rustc` |
| 26 | + = note: for more on editions, read https://doc.rust-lang.org/edition-guide |
| 27 | + |
| 28 | +error[E0706]: functions in traits cannot be declared `async` |
| 29 | + --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:13:9 |
| 30 | + | |
| 31 | +LL | trait C{async fn new(val: T) {} |
| 32 | + | -----^^^^^^^^^^^^^^^^^^ |
| 33 | + | | |
| 34 | + | `async` because of this |
| 35 | + | |
| 36 | + = note: `async` trait functions are not currently supported |
| 37 | + = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait |
| 38 | + |
| 39 | +error[E0423]: expected function, found module `crate` |
| 40 | + --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:9:5 |
| 41 | + | |
| 42 | +LL | crate(move || {} ).await |
| 43 | + | ^^^^^ not a function |
| 44 | + |
| 45 | +error[E0412]: cannot find type `T` in this scope |
| 46 | + --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:13:27 |
| 47 | + | |
| 48 | +LL | pub struct A {} |
| 49 | + | ------------ similarly named struct `A` defined here |
| 50 | +... |
| 51 | +LL | trait C{async fn new(val: T) {} |
| 52 | + | ^ help: a struct with a similar name exists: `A` |
| 53 | + |
| 54 | +warning: changes to closure capture in Rust 2021 will affect drop order |
| 55 | + --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:6:57 |
| 56 | + | |
| 57 | +LL | async fn create(path: impl AsRef<std::path::Path>) { |
| 58 | + | _____________________----_____________________________-__^ |
| 59 | + | | | | |
| 60 | + | | | in Rust 2018, `path` is dropped here along with the closure, but in Rust 2021 `path` is not part of the closure |
| 61 | + | | in Rust 2018, this causes the closure to capture `path`, but in Rust 2021, it has no effect |
| 62 | +LL | | |
| 63 | +LL | | ; |
| 64 | +LL | | crate(move || {} ).await |
| 65 | +LL | | } |
| 66 | + | |_____^ |
| 67 | + | |
| 68 | + = note: requested on the command line with `-W rust-2021-incompatible-closure-captures` |
| 69 | + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/disjoint-capture-in-closures.html> |
| 70 | +help: add a dummy let to cause `path` to be fully captured |
| 71 | + | |
| 72 | +LL | async fn create(path: impl AsRef<std::path::Path>) { let _ = &path; |
| 73 | + | ++++++++++++++ |
| 74 | + |
| 75 | +warning: changes to closure capture in Rust 2021 will affect drop order |
| 76 | + --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:13:30 |
| 77 | + | |
| 78 | +LL | trait C{async fn new(val: T) {} |
| 79 | + | --- - ^^ |
| 80 | + | | | |
| 81 | + | | in Rust 2018, `val` is dropped here along with the closure, but in Rust 2021 `val` is not part of the closure |
| 82 | + | in Rust 2018, this causes the closure to capture `val`, but in Rust 2021, it has no effect |
| 83 | + | |
| 84 | + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/disjoint-capture-in-closures.html> |
| 85 | +help: add a dummy let to cause `val` to be fully captured |
| 86 | + | |
| 87 | +LL | trait C{async fn new(val: T) { let _ = &val;} |
| 88 | + | +++++++++++++ |
| 89 | + |
| 90 | +error: aborting due to 6 previous errors; 2 warnings emitted |
| 91 | + |
| 92 | +Some errors have detailed explanations: E0412, E0423, E0670, E0706. |
| 93 | +For more information about an error, try `rustc --explain E0412`. |
0 commit comments