]> git.lizzy.rs Git - rust.git/blob - tests/ui/nll/maybe-initialized-drop.rs
Rollup merge of #106397 - compiler-errors:new-solver-impl-wc, r=lcnr
[rust.git] / tests / ui / nll / maybe-initialized-drop.rs
1 #![allow(warnings)]
2
3 struct Wrap<'p> { p: &'p mut i32 }
4
5 impl<'p> Drop for Wrap<'p> {
6     fn drop(&mut self) {
7         *self.p += 1;
8     }
9 }
10
11 fn main() {
12     let mut x = 0;
13     let wrap = Wrap { p: &mut x };
14     x = 1; //~ ERROR cannot assign to `x` because it is borrowed [E0506]
15 }