]> git.proxmox.com Git - rustc.git/blob - tests/ui/nll/dont-print-desugared.rs
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / ui / nll / dont-print-desugared.rs
1 // Test that we don't show variables with from for loop desugaring
2
3 fn for_loop(s: &[i32]) {
4 for &ref mut x in s {}
5 //~^ ERROR cannot borrow data in a `&` reference as mutable [E0596]
6 }
7
8 struct D<'a>(&'a ());
9
10 impl Drop for D<'_> {
11 fn drop(&mut self) {}
12 }
13
14 fn for_loop_dropck(v: Vec<D<'static>>) {
15 for ref mut d in v {
16 let y = ();
17 *d = D(&y); //~ ERROR `y` does not live long enough
18 }
19 }
20
21 fn main() {}