]>
git.proxmox.com Git - rustc.git/blob - tests/ui/nll/get_default.rs
1 // Basic test for free regions in the NLL code. This test ought to
2 // report an error due to a reborrowing constraint. Right now, we get
3 // a variety of errors from the older, AST-based machinery (notably
4 // borrowck), and then we get the NLL error at the end.
10 fn get(&self) -> Option
<&String
> { None }
11 fn set(&mut self, v
: String
) { }
14 fn ok(map
: &mut Map
) -> &String
{
21 map
.set(String
::new()); // Ideally, this would not error.
22 //~^ ERROR borrowed as immutable
28 fn err(map
: &mut Map
) -> &String
{
32 map
.set(String
::new()); // Both AST and MIR error here
33 //~^ ERROR borrowed as immutable
37 map
.set(String
::new()); // Ideally, just AST would error here
38 //~^ ERROR borrowed as immutable