2019-07-26 21:54:25 +00:00
|
|
|
// run-pass
|
2013-09-09 14:01:42 +00:00
|
|
|
// Make sure nested functions are separate, even if they have
|
|
|
|
// equal name.
|
|
|
|
//
|
|
|
|
// Issue #8587
|
|
|
|
|
2015-03-22 20:13:15 +00:00
|
|
|
|
2013-09-09 14:01:42 +00:00
|
|
|
pub struct X;
|
|
|
|
|
|
|
|
impl X {
|
2015-03-26 00:06:52 +00:00
|
|
|
fn f(&self) -> isize {
|
2013-09-09 14:01:42 +00:00
|
|
|
#[inline(never)]
|
2015-03-26 00:06:52 +00:00
|
|
|
fn inner() -> isize {
|
2013-09-09 14:01:42 +00:00
|
|
|
0
|
|
|
|
}
|
|
|
|
inner()
|
|
|
|
}
|
|
|
|
|
2015-03-26 00:06:52 +00:00
|
|
|
fn g(&self) -> isize {
|
2013-09-09 14:01:42 +00:00
|
|
|
#[inline(never)]
|
2015-03-26 00:06:52 +00:00
|
|
|
fn inner_2() -> isize {
|
2013-09-09 14:01:42 +00:00
|
|
|
1
|
|
|
|
}
|
|
|
|
inner_2()
|
|
|
|
}
|
|
|
|
|
2015-03-26 00:06:52 +00:00
|
|
|
fn h(&self) -> isize {
|
2013-09-09 14:01:42 +00:00
|
|
|
#[inline(never)]
|
2015-03-26 00:06:52 +00:00
|
|
|
fn inner() -> isize {
|
2013-09-09 14:01:42 +00:00
|
|
|
2
|
|
|
|
}
|
|
|
|
inner()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-25 07:43:37 +00:00
|
|
|
pub fn main() {
|
2013-09-09 14:01:42 +00:00
|
|
|
let n = X;
|
|
|
|
assert_eq!(n.f(), 0);
|
|
|
|
assert_eq!(n.g(), 1);
|
|
|
|
// This test `h` used to fail.
|
|
|
|
assert_eq!(n.h(), 2);
|
|
|
|
}
|