diff --git a/src/librustc/middle/typeck/check/method.rs b/src/librustc/middle/typeck/check/method.rs index 698bd0a6b4b..34b650aa180 100644 --- a/src/librustc/middle/typeck/check/method.rs +++ b/src/librustc/middle/typeck/check/method.rs @@ -438,10 +438,9 @@ pub impl LookupContext { let trait_methods = ty::trait_methods(tcx, init_trait_id); let pos = { - // FIXME #3453 can't use trait_methods.position - match vec::position(*trait_methods, - |m| (m.self_ty != ast::sty_static && - m.ident == self.m_name)) + match trait_methods.position(|m| { + m.self_ty != ast::sty_static && + m.ident == self.m_name }) { Some(pos) => pos, None => { @@ -624,9 +623,7 @@ pub impl LookupContext { } let idx = { - // FIXME #3453 can't use impl_info.methods.position - match vec::position(impl_info.methods, - |m| m.ident == self.m_name) { + match impl_info.methods.position(|m| m.ident == self.m_name) { Some(idx) => idx, None => { return; } // No method with the right name. } diff --git a/src/test/run-pass/vec-position.rs b/src/test/run-pass/vec-position.rs new file mode 100644 index 00000000000..fe186a78ed7 --- /dev/null +++ b/src/test/run-pass/vec-position.rs @@ -0,0 +1,16 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub fn main() { + let mut v = ~[1, 2, 3]; + assert v.position(|x| *x == 1) == Some(0); + assert v.position(|x| *x == 3) == Some(2); + assert v.position(|x| *x == 17) == None; +}