]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/issue-28934.rs
Rollup merge of #106726 - cmorin6:fix-comment-typos, r=Nilstrieb
[rust.git] / tests / ui / borrowck / issue-28934.rs
1 // Regression test: issue had to do with "givens" in region inference,
2 // which were not being considered during the contraction phase.
3
4 // run-fail
5 // error-pattern:explicit panic
6 // ignore-emscripten no processes
7
8 struct Parser<'i: 't, 't>(&'i u8, &'t u8);
9
10 impl<'i, 't> Parser<'i, 't> {
11     fn parse_nested_block<F, T>(&mut self, parse: F) -> Result<T, ()>
12         where for<'tt> F: FnOnce(&mut Parser<'i, 'tt>) -> T
13     {
14         panic!()
15     }
16
17     fn expect_exhausted(&mut self) -> Result<(), ()> {
18         Ok(())
19     }
20 }
21
22 fn main() {
23     let x = 0u8;
24     Parser(&x, &x).parse_nested_block(|input| input.expect_exhausted()).unwrap();
25 }