Closed
Description
The test case below fails to compile, apparently because the borrow checker doesn't think an unused argument is (not) used safely.
// rustc --test ignores2.rs && ./ignores2
use std;
use path::{Path};
type rsrc_loader = fn~ (path: &Path) -> result::Result<~str, ~str>;
#[test]
fn tester()
{
let loader: rsrc_loader = |_path| {result::Ok(~"more blah")};
let path = path::from_str("blah");
assert loader(&path).is_ok();
}
// ignores2.rs:10:25: 10:82 error: mismatched types: expected `rsrc_loader` but found `fn~(&core::path::Path) -> core::result::Result<~str,~str>` (lifetime re_bound(br_anon(0)) does not necessarily outlive the static lifetime)
// ignores2.rs:10 let loader: rsrc_loader = |_path| {result::Ok(~"unbalanced {{curly}} {{braces}")};
// ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~