2018-08-30 14:18:55 +02:00
|
|
|
// run-pass
|
2018-09-25 23:51:35 +02:00
|
|
|
#![allow(dead_code)]
|
2014-07-22 05:43:19 -04: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 13:13:15 -07:00
|
|
|
// pretty-expanded FIXME #23616
|
|
|
|
|
2015-03-25 17:06:52 -07: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 05:43:19 -04:00
|
|
|
|
2015-03-25 17:06:52 -07:00
|
|
|
// ...because if we inferred, say, &'x &'b mut isize where 'x <= 'a,
|
2014-07-22 05:43:19 -04:00
|
|
|
// this reborrow would be illegal:
|
|
|
|
&**y
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn main() {
|
|
|
|
/* Just want to know that it compiles. */
|
|
|
|
}
|