2018-08-30 12:18:55 +00:00
|
|
|
// run-pass
|
2018-09-25 21:51:35 +00:00
|
|
|
#![allow(dead_code)]
|
2014-07-22 09:43:19 +00:00
|
|
|
// Test an edge case in region inference: the lifetime of the borrow
|
|
|
|
// of `*x` must be extended to at least 'a.
|
|
|
|
|
2015-03-22 20:13:15 +00:00
|
|
|
// pretty-expanded FIXME #23616
|
|
|
|
|
2015-03-26 00:06:52 +00:00
|
|
|
fn foo<'a,'b>(x: &'a &'b mut isize) -> &'a isize {
|
|
|
|
let y = &*x; // should be inferred to have type &'a &'b mut isize...
|
2014-07-22 09:43:19 +00:00
|
|
|
|
2015-03-26 00:06:52 +00:00
|
|
|
// ...because if we inferred, say, &'x &'b mut isize where 'x <= 'a,
|
2014-07-22 09:43:19 +00:00
|
|
|
// this reborrow would be illegal:
|
|
|
|
&**y
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn main() {
|
|
|
|
/* Just want to know that it compiles. */
|
|
|
|
}
|