]> git.lizzy.rs Git - rust.git/blob - src/test/ui/nll/dont-print-desugared.rs
Rollup merge of #103146 - joboet:cleanup_pthread_condvar, r=Mark-Simulacrum
[rust.git] / src / test / 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() {}