fork/rust

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

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

master
577 B25 linesraw
1// run-rustfix
2
3// See https://github.com/rust-lang/rust/issues/87955
4
5#![deny(rust_2021_incompatible_closure_captures)]
6//~^ NOTE: the lint level is defined here
7
8
9#[derive(Debug)]
10struct Foo(i32);
11impl Drop for Foo {
12    fn drop(&mut self) {
13        println!("{:?} dropped", self.0);
14    }
15}
16
17fn main() {
18    let a = (Foo(0), Foo(1));
19    let _ = || { let _ = &a; dbg!(a.0) };
20    //~^ ERROR: drop order
21    //~| NOTE: will only capture `a.0`
22    //~| NOTE: for more information, see
23    //~| HELP: add a dummy let to cause `a` to be fully captured
24}
25//~^ NOTE: dropped here