]> git.lizzy.rs Git - rust.git/blob - tests/ui/mir/drop-elaboration-after-borrowck-error.rs
Rollup merge of #107015 - cuviper:ra-riscv64, r=Mark-Simulacrum
[rust.git] / tests / ui / mir / drop-elaboration-after-borrowck-error.rs
1 // Regression test for issue 81708 and issue 91816 where running a drop
2 // elaboration on a MIR which failed borrowck lead to an ICE.
3
4 static A: () = {
5     let a: [String; 1];
6     //~^ ERROR destructor of
7     a[0] = String::new();
8     //~^ ERROR destructor of
9     //~| ERROR binding `a` isn't initialized
10 };
11
12 struct B<T>([T; 1]);
13
14 impl<T> B<T> {
15     pub const fn f(mut self, other: T) -> Self {
16         let _this = self;
17         //~^ ERROR destructor of
18         self.0[0] = other;
19         //~^ ERROR destructor of
20         //~| ERROR use of moved value
21         self
22     }
23 }
24
25 fn main() {}