about summary refs log tree commit diff
path: root/tests/ui/impl-trait/precise-capturing/foreign-2021.rs
blob: aee412ff7f13bddb4505464e0e6aec3c1f5135aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//@ aux-build: foreign.rs

extern crate foreign;

fn main() {
    let mut x = vec![];
    let h = foreign::hello(&x);
    //~^ NOTE this call may capture more lifetimes than intended
    //~| NOTE immutable borrow occurs here
    x.push(0);
    //~^ ERROR cannot borrow `x` as mutable
    //~| NOTE mutable borrow occurs here
    println!("{h}");
    //~^ NOTE immutable borrow later used here
}