rust/tests/ui/nll/loan_ends_mid_block_pair.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

30 lines
440 B
Rust
Raw Normal View History

2017-10-30 12:28:07 +00:00
#![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';
2019-05-02 22:34:15 +00:00
//~^ ERROR [E0506]
2017-10-30 12:28:07 +00:00
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) {
}