fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
2.0 KiB49 linesraw
1error[E0670]: `async fn` is not permitted in Rust 2015
2  --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-96258.rs:8:16
3   |
4LL |     pub(crate) async fn new(
5   |                ^^^^^ to use `async fn`, switch to Rust 2018 or later
6   |
7   = help: pass `--edition 2021` to `rustc`
8   = note: for more on editions, read https://doc.rust-lang.org/edition-guide
9
10error[E0412]: cannot find type `Duration` in this scope
11  --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-96258.rs:10:19
12   |
13LL |         interval: Duration,
14   |                   ^^^^^^^^ not found in this scope
15   |
16help: consider importing this struct
17   |
18LL + use std::time::Duration;
19   |
20
21warning: changes to closure capture in Rust 2021 will affect drop order
22  --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-96258.rs:12:19
23   |
24LL |           interval: Duration,
25   |           -------- in Rust 2018, this causes the closure to capture `interval`, but in Rust 2021, it has no effect
26LL |
27LL |       ) -> Numberer {
28   |  _________________-_^
29   | |                 |
30   | |                 in Rust 2018, `interval` is dropped here along with the closure, but in Rust 2021 `interval` is not part of the closure
31LL | |         Numberer {}
32LL | |     }
33   | |_____^
34   |
35   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/disjoint-capture-in-closures.html>
36note: the lint level is defined here
37  --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-96258.rs:1:9
38   |
39LL | #![warn(rust_2021_incompatible_closure_captures)]
40   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
41help: add a dummy let to cause `interval` to be fully captured
42   |
43LL |     ) -> Numberer { let _ = &interval;
44   |                     ++++++++++++++++++
45
46error: aborting due to 2 previous errors; 1 warning emitted
47
48Some errors have detailed explanations: E0412, E0670.
49For more information about an error, try `rustc --explain E0412`.