-
Notifications
You must be signed in to change notification settings - Fork 14k
Closed
Labels
A-type-systemArea: Type systemArea: Type system
Description
Hello,
The following code:
#[allow(unstable)]
extern crate test;
fn foo(_: &mut[f64]) {
}
fn bar(bencher: &mut test::Bencher) {
let mut a = vec![1.0, 2.0, 3.0];
bencher.iter(|&mut:| foo(&mut a[])); // Works with a.as_mut_slice()
}
fn main() {
let mut a = vec![1.0, 2.0, 3.0];
foo(&mut a[]);
}yields the following error:
<anon>:9:13: 9:40 error: unable to infer enough type information about `closure[<anon>:9:18: 9:39]`; type annotations required
<anon>:9 bencher.iter(|&mut:| foo(&mut a[])); // Works with a.as_mut_slice()
^~~~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to previous error
playpen: application terminated with error code 101
However, replacing the new &mut a[] with the old a.as_mut_slice() makes it compile just fine. Presumably the type inference should work identically in the two cases.
Regards,
Ivan
Metadata
Metadata
Assignees
Labels
A-type-systemArea: Type systemArea: Type system