rust/tests/ui/nll/loan_ends_mid_block_pair.rs
2023-01-11 09:32:08 +00:00

30 lines
440 B
Rust

#![allow(warnings)]
#![feature(rustc_attrs)]
fn main() {
}
fn nll_fail() {
let mut data = ('a', 'b', 'c');
let c = &mut data.0;
capitalize(c);
data.0 = 'e';
//~^ ERROR [E0506]
data.0 = 'f';
data.0 = 'g';
capitalize(c);
}
fn nll_ok() {
let mut data = ('a', 'b', 'c');
let c = &mut data.0;
capitalize(c);
data.0 = 'e';
data.0 = 'f';
data.0 = 'g';
}
fn capitalize(_: &mut char) {
}