2021-12-21 18:00:00 -06:00
|
|
|
// Regression test for issue 81708 and issue 91816 where running a drop
|
|
|
|
// elaboration on a MIR which failed borrowck lead to an ICE.
|
|
|
|
|
|
|
|
static A: () = {
|
|
|
|
let a: [String; 1];
|
2022-09-23 09:22:36 -05:00
|
|
|
//~^ ERROR destructor of
|
2021-12-21 18:00:00 -06:00
|
|
|
a[0] = String::new();
|
2022-09-23 09:22:36 -05:00
|
|
|
//~^ ERROR destructor of
|
2022-06-21 13:57:45 -05:00
|
|
|
//~| ERROR binding `a` isn't initialized
|
2021-12-21 18:00:00 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
struct B<T>([T; 1]);
|
|
|
|
|
|
|
|
impl<T> B<T> {
|
|
|
|
pub const fn f(mut self, other: T) -> Self {
|
|
|
|
let _this = self;
|
2022-09-23 09:22:36 -05:00
|
|
|
//~^ ERROR destructor of
|
2021-12-21 18:00:00 -06:00
|
|
|
self.0[0] = other;
|
2022-09-23 09:22:36 -05:00
|
|
|
//~^ ERROR destructor of
|
2021-12-21 18:00:00 -06:00
|
|
|
//~| ERROR use of moved value
|
|
|
|
self
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|