core::vec is missing methods for mutable slices

Fix #5984. Also, I found a problem on type inference and left a comment.