diff options
| author | bors <bors@rust-lang.org> | 2018-03-20 10:18:34 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-03-20 10:18:34 +0000 |
| commit | 75af15ee6ca0c12b699a17984b033363cd25e9c3 (patch) | |
| tree | 02642ba3cf3431e3bfd86a75287965ffa6603048 /src/test | |
| parent | b99172311c640c33f70676df7f75a899a999711c (diff) | |
| parent | 57b821112eccebaa2a00bfa1193da55f5b677dc5 (diff) | |
Auto merge of #49190 - kennytm:rollup, r=kennytm
Rollup of 17 pull requests - Successful merges: #46518, #48810, #48834, #48902, #49004, #49092, #49096, #49099, #49104, #49125, #49139, #49152, #49157, #49161, #49166, #49176, #49184 - Failed merges:
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/error-codes/E0449.stderr | 6 | ||||
| -rw-r--r-- | src/test/ui/issue-49040.rs | 12 | ||||
| -rw-r--r-- | src/test/ui/issue-49040.stderr | 8 | ||||
| -rw-r--r-- | src/test/ui/suggest-remove-refs-1.rs | 18 | ||||
| -rw-r--r-- | src/test/ui/suggest-remove-refs-1.stderr | 15 | ||||
| -rw-r--r-- | src/test/ui/suggest-remove-refs-2.rs | 18 | ||||
| -rw-r--r-- | src/test/ui/suggest-remove-refs-2.stderr | 15 | ||||
| -rw-r--r-- | src/test/ui/suggest-remove-refs-3.rs | 21 | ||||
| -rw-r--r-- | src/test/ui/suggest-remove-refs-3.stderr | 19 | ||||
| -rw-r--r-- | src/test/ui/suggestions/const-type-mismatch.rs | 21 | ||||
| -rw-r--r-- | src/test/ui/suggestions/const-type-mismatch.stderr | 15 |
11 files changed, 165 insertions, 3 deletions
diff --git a/src/test/ui/error-codes/E0449.stderr b/src/test/ui/error-codes/E0449.stderr index 480d8c40022..df3b09ba7c9 100644 --- a/src/test/ui/error-codes/E0449.stderr +++ b/src/test/ui/error-codes/E0449.stderr @@ -2,7 +2,7 @@ error[E0449]: unnecessary visibility qualifier --> $DIR/E0449.rs:17:1 | LL | pub impl Bar {} //~ ERROR E0449 - | ^^^ `pub` not needed here + | ^^^ `pub` not permitted here because it's implied | = note: place qualifiers on individual impl items instead @@ -10,13 +10,13 @@ error[E0449]: unnecessary visibility qualifier --> $DIR/E0449.rs:19:1 | LL | pub impl Foo for Bar { //~ ERROR E0449 - | ^^^ `pub` not needed here + | ^^^ `pub` not permitted here because it's implied error[E0449]: unnecessary visibility qualifier --> $DIR/E0449.rs:20:5 | LL | pub fn foo() {} //~ ERROR E0449 - | ^^^ `pub` not needed here + | ^^^ `pub` not permitted here because it's implied error: aborting due to 3 previous errors diff --git a/src/test/ui/issue-49040.rs b/src/test/ui/issue-49040.rs new file mode 100644 index 00000000000..866ecd9e1d9 --- /dev/null +++ b/src/test/ui/issue-49040.rs @@ -0,0 +1,12 @@ +// Copyright 2015 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 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(unused_variables)]; //~ ERROR expected item, found `;` +fn main() {} diff --git a/src/test/ui/issue-49040.stderr b/src/test/ui/issue-49040.stderr new file mode 100644 index 00000000000..b6f624dac7d --- /dev/null +++ b/src/test/ui/issue-49040.stderr @@ -0,0 +1,8 @@ +error: expected item, found `;` + --> $DIR/issue-49040.rs:11:28 + | +LL | #![allow(unused_variables)]; //~ ERROR expected item, found `;` + | ^ help: consider removing this semicolon + +error: aborting due to previous error + diff --git a/src/test/ui/suggest-remove-refs-1.rs b/src/test/ui/suggest-remove-refs-1.rs new file mode 100644 index 00000000000..0f19c48337b --- /dev/null +++ b/src/test/ui/suggest-remove-refs-1.rs @@ -0,0 +1,18 @@ +// Copyright 2014 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 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + let v = vec![0, 1, 2, 3]; + + for (i, n) in &v.iter().enumerate() { + //~^ ERROR the trait bound + println!("{}", i); + } +} diff --git a/src/test/ui/suggest-remove-refs-1.stderr b/src/test/ui/suggest-remove-refs-1.stderr new file mode 100644 index 00000000000..c47b4d283d7 --- /dev/null +++ b/src/test/ui/suggest-remove-refs-1.stderr @@ -0,0 +1,15 @@ +error[E0277]: the trait bound `&std::iter::Enumerate<std::slice::Iter<'_, {integer}>>: std::iter::Iterator` is not satisfied + --> $DIR/suggest-remove-refs-1.rs:14:19 + | +LL | for (i, n) in &v.iter().enumerate() { + | -^^^^^^^^^^^^^^^^^^^^ + | | + | `&std::iter::Enumerate<std::slice::Iter<'_, {integer}>>` is not an iterator; maybe try calling `.iter()` or a similar method + | help: consider removing 1 leading `&`-references + | + = help: the trait `std::iter::Iterator` is not implemented for `&std::iter::Enumerate<std::slice::Iter<'_, {integer}>>` + = note: required by `std::iter::IntoIterator::into_iter` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/suggest-remove-refs-2.rs b/src/test/ui/suggest-remove-refs-2.rs new file mode 100644 index 00000000000..c427f697ae1 --- /dev/null +++ b/src/test/ui/suggest-remove-refs-2.rs @@ -0,0 +1,18 @@ +// Copyright 2014 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 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + let v = vec![0, 1, 2, 3]; + + for (i, n) in & & & & &v.iter().enumerate() { + //~^ ERROR the trait bound + println!("{}", i); + } +} diff --git a/src/test/ui/suggest-remove-refs-2.stderr b/src/test/ui/suggest-remove-refs-2.stderr new file mode 100644 index 00000000000..fdd654ea392 --- /dev/null +++ b/src/test/ui/suggest-remove-refs-2.stderr @@ -0,0 +1,15 @@ +error[E0277]: the trait bound `&&&&&std::iter::Enumerate<std::slice::Iter<'_, {integer}>>: std::iter::Iterator` is not satisfied + --> $DIR/suggest-remove-refs-2.rs:14:19 + | +LL | for (i, n) in & & & & &v.iter().enumerate() { + | ---------^^^^^^^^^^^^^^^^^^^^ + | | + | `&&&&&std::iter::Enumerate<std::slice::Iter<'_, {integer}>>` is not an iterator; maybe try calling `.iter()` or a similar method + | help: consider removing 5 leading `&`-references + | + = help: the trait `std::iter::Iterator` is not implemented for `&&&&&std::iter::Enumerate<std::slice::Iter<'_, {integer}>>` + = note: required by `std::iter::IntoIterator::into_iter` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/suggest-remove-refs-3.rs b/src/test/ui/suggest-remove-refs-3.rs new file mode 100644 index 00000000000..f54ae30caeb --- /dev/null +++ b/src/test/ui/suggest-remove-refs-3.rs @@ -0,0 +1,21 @@ +// Copyright 2014 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 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + let v = vec![0, 1, 2, 3]; + + for (i, n) in & & & + & &v + .iter() + .enumerate() { + //~^^^^ ERROR the trait bound + println!("{}", i); + } +} diff --git a/src/test/ui/suggest-remove-refs-3.stderr b/src/test/ui/suggest-remove-refs-3.stderr new file mode 100644 index 00000000000..b0920a0fa52 --- /dev/null +++ b/src/test/ui/suggest-remove-refs-3.stderr @@ -0,0 +1,19 @@ +error[E0277]: the trait bound `&&&&&std::iter::Enumerate<std::slice::Iter<'_, {integer}>>: std::iter::Iterator` is not satisfied + --> $DIR/suggest-remove-refs-3.rs:14:19 + | +LL | for (i, n) in & & & + | ___________________^ + | |___________________| + | || +LL | || & &v + | ||___________- help: consider removing 5 leading `&`-references +LL | | .iter() +LL | | .enumerate() { + | |_____________________^ `&&&&&std::iter::Enumerate<std::slice::Iter<'_, {integer}>>` is not an iterator; maybe try calling `.iter()` or a similar method + | + = help: the trait `std::iter::Iterator` is not implemented for `&&&&&std::iter::Enumerate<std::slice::Iter<'_, {integer}>>` + = note: required by `std::iter::IntoIterator::into_iter` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/suggestions/const-type-mismatch.rs b/src/test/ui/suggestions/const-type-mismatch.rs new file mode 100644 index 00000000000..ddad4e79cfd --- /dev/null +++ b/src/test/ui/suggestions/const-type-mismatch.rs @@ -0,0 +1,21 @@ +// Copyright 2018 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 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// `const`s shouldn't suggest `.into()` + +const TEN: u8 = 10; +const TWELVE: u16 = TEN + 2; +//~^ ERROR mismatched types [E0308] + +fn main() { + const TEN: u8 = 10; + const ALSO_TEN: u16 = TEN; + //~^ ERROR mismatched types [E0308] +} diff --git a/src/test/ui/suggestions/const-type-mismatch.stderr b/src/test/ui/suggestions/const-type-mismatch.stderr new file mode 100644 index 00000000000..965995f82c5 --- /dev/null +++ b/src/test/ui/suggestions/const-type-mismatch.stderr @@ -0,0 +1,15 @@ +error[E0308]: mismatched types + --> $DIR/const-type-mismatch.rs:14:21 + | +LL | const TWELVE: u16 = TEN + 2; + | ^^^^^^^ expected u16, found u8 + +error[E0308]: mismatched types + --> $DIR/const-type-mismatch.rs:19:27 + | +LL | const ALSO_TEN: u16 = TEN; + | ^^^ expected u16, found u8 + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. |
