]> git.proxmox.com Git - rustc.git/blame - src/test/ui/borrowck/issue-24267-flow-exit.rs
Update unsuspicious file list
[rustc.git] / src / test / ui / borrowck / issue-24267-flow-exit.rs
CommitLineData
9346a6ac
AL
1// Ensure that we reject code when a nonlocal exit (`break`,
2// `continue`) causes us to pop over a needed assignment.
3
4pub fn main() {
5 foo1();
6 foo2();
1a4d82fc 7}
223e47cc 8
9346a6ac
AL
9pub fn foo1() {
10 let x: i32;
11 loop { x = break; }
064997fb 12 println!("{}", x); //~ ERROR E0381
85aaf69f
SL
13}
14
9346a6ac
AL
15pub fn foo2() {
16 let x: i32;
17 for _ in 0..10 { x = continue; }
064997fb 18 println!("{}", x); //~ ERROR E0381
223e47cc 19}