mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 16:54:01 +00:00
19 lines
495 B
Rust
19 lines
495 B
Rust
//@ run-pass
|
|
#![allow(dead_code)]
|
|
// Test an edge case in region inference: the lifetime of the borrow
|
|
// of `*x` must be extended to at least 'a.
|
|
|
|
//@ pretty-expanded FIXME #23616
|
|
|
|
fn foo<'a,'b>(x: &'a &'b mut isize) -> &'a isize {
|
|
let y = &*x; // should be inferred to have type &'a &'b mut isize...
|
|
|
|
// ...because if we inferred, say, &'x &'b mut isize where 'x <= 'a,
|
|
// this reborrow would be illegal:
|
|
&**y
|
|
}
|
|
|
|
pub fn main() {
|
|
/* Just want to know that it compiles. */
|
|
}
|