rust/tests/ui/nll/loan_ends_mid_block_vec.rs

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

31 lines
523 B
Rust
Raw Normal View History

2017-10-30 07:28:07 -05:00
#![allow(warnings)]
#![feature(rustc_attrs)]
fn main() {
}
fn nll_fail() {
let mut data = vec!['a', 'b', 'c'];
let slice = &mut data;
capitalize(slice);
data.push('d');
2019-05-02 17:34:15 -05:00
//~^ ERROR [E0499]
2017-10-30 07:28:07 -05:00
data.push('e');
2019-05-02 17:34:15 -05:00
//~^ ERROR [E0499]
2017-10-30 07:28:07 -05:00
data.push('f');
2019-05-02 17:34:15 -05:00
//~^ ERROR [E0499]
2017-10-30 07:28:07 -05:00
capitalize(slice);
}
fn nll_ok() {
let mut data = vec!['a', 'b', 'c'];
let slice = &mut data;
capitalize(slice);
data.push('d');
data.push('e');
data.push('f');
}
fn capitalize(_: &mut [char]) {
}