Skip to content

Commit 52cd07a

Browse files
committed
Created multiple line test.
1 parent f41dc77 commit 52cd07a

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

src/test/ui/suggest-remove-refs-3.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
fn main() {
12+
let v = vec![0, 1, 2, 3];
13+
14+
for (i, n) in & & &
15+
& &v
16+
.iter()
17+
.enumerate() {
18+
//~^^^^ ERROR the trait bound
19+
println!("{}", i);
20+
}
21+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
error[E0277]: the trait bound `&&&&&std::iter::Enumerate<std::slice::Iter<'_, {integer}>>: std::iter::Iterator` is not satisfied
2+
--> $DIR/suggest-remove-refs-3.rs:14:19
3+
|
4+
LL | for (i, n) in & & &
5+
| ___________________^
6+
LL | | & &v
7+
LL | | .iter()
8+
LL | | .enumerate() {
9+
| |____________________^ `&&&&&std::iter::Enumerate<std::slice::Iter<'_, {integer}>>` is not an iterator; maybe try calling `.iter()` or a similar method
10+
|
11+
= help: the trait `std::iter::Iterator` is not implemented for `&&&&&std::iter::Enumerate<std::slice::Iter<'_, {integer}>>`
12+
= note: required by `std::iter::IntoIterator::into_iter`
13+
help: consider removing 5 references `&`
14+
|
15+
LL | for (i, n) in v
16+
LL | .iter()
17+
LL | .enumerate() {
18+
|
19+
20+
error: aborting due to previous error
21+
22+
If you want more information on this error, try using "rustc --explain E0277"

0 commit comments

Comments
 (0)