-
Notifications
You must be signed in to change notification settings - Fork 14k
Closed
Labels
E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
Description
The following example shows that in method h(), it returns the result of the function nested inside the method f().
pub struct X;
impl X {
fn f(&self) -> int {
#[inline(never)]
fn inner() -> int {
0
}
inner()
}
fn g(&self) -> int {
#[inline(never)]
fn inner_2() -> int {
1
}
inner_2()
}
fn h(&self) -> int {
#[inline(never)]
fn inner() -> int {
2
}
inner()
}
}
mod tests {
use super::*;
#[test]
fn test_function() {
let n = X;
assert_eq!(n.f(), 0);
assert_eq!(n.g(), 1);
assert_eq!(n.h(), 2); // This test fails!
}
}
Output:
running 1 test
task <unnamed> failed at 'assertion failed: `(left == right) && (right == left)` (left: `0`, right: `2`)', nestf.rs:38
test tests::test_function ... FAILED
failures:
tests::test_function
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured
Metadata
Metadata
Assignees
Labels
E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.