Does Rust borrow checker analyze the program locally or globally?

In other words does borrow checker need information about the whole program or it works locally within the function scope?

I'm asking because I want to quantify it's algorithmic complexity. I'm wondering if the size of the borrow checking problem is the whole program of just the function.