diff options
| author | Aaron Hill <aa1ronham@gmail.com> | 2020-10-19 11:50:36 -0400 |
|---|---|---|
| committer | Aaron Hill <aa1ronham@gmail.com> | 2020-10-30 20:02:15 -0400 |
| commit | 4621ce9858856389c32f890725feac489bc94ac5 (patch) | |
| tree | 7889399f95811accfd55e278cfa308d2bb2b9f82 | |
| parent | 4b4f84f3274e2d5662c76f52769ac4b7e6826fcf (diff) | |
| download | rust-4621ce9858856389c32f890725feac489bc94ac5.tar.gz rust-4621ce9858856389c32f890725feac489bc94ac5.zip | |
Update into-iter-on-arrays test to check future-incompat-report
| -rw-r--r-- | src/test/ui/iterators/into-iter-on-arrays-lint.fixed | 5 | ||||
| -rw-r--r-- | src/test/ui/iterators/into-iter-on-arrays-lint.rs | 3 | ||||
| -rw-r--r-- | src/test/ui/iterators/into-iter-on-arrays-lint.stderr | 136 | ||||
| -rw-r--r-- | src/tools/compiletest/src/json.rs | 33 |
4 files changed, 165 insertions, 12 deletions
diff --git a/src/test/ui/iterators/into-iter-on-arrays-lint.fixed b/src/test/ui/iterators/into-iter-on-arrays-lint.fixed index 1e473a2b720..08df0cbe973 100644 --- a/src/test/ui/iterators/into-iter-on-arrays-lint.fixed +++ b/src/test/ui/iterators/into-iter-on-arrays-lint.fixed @@ -1,6 +1,6 @@ // run-pass // run-rustfix -// compiler-flags: -Z emit-future-compat-report +// compile-flags: -Z emit-future-incompat-report fn main() { let small = [1, 2]; @@ -56,4 +56,7 @@ fn main() { (&small as &[_]).into_iter(); small[..].into_iter(); std::iter::IntoIterator::into_iter(&[1, 2]); + + #[allow(array_into_iter)] + [0, 1].into_iter(); } diff --git a/src/test/ui/iterators/into-iter-on-arrays-lint.rs b/src/test/ui/iterators/into-iter-on-arrays-lint.rs index 8e441ed56a1..cd12698da7e 100644 --- a/src/test/ui/iterators/into-iter-on-arrays-lint.rs +++ b/src/test/ui/iterators/into-iter-on-arrays-lint.rs @@ -56,4 +56,7 @@ fn main() { (&small as &[_]).into_iter(); small[..].into_iter(); std::iter::IntoIterator::into_iter(&[1, 2]); + + #[allow(array_into_iter)] + [0, 1].into_iter(); } diff --git a/src/test/ui/iterators/into-iter-on-arrays-lint.stderr b/src/test/ui/iterators/into-iter-on-arrays-lint.stderr index 89e5881b955..87965bdda7a 100644 --- a/src/test/ui/iterators/into-iter-on-arrays-lint.stderr +++ b/src/test/ui/iterators/into-iter-on-arrays-lint.stderr @@ -109,3 +109,139 @@ LL | Box::new(Box::new([0u8; 33])).into_iter(); warning: 12 warnings emitted +Future incompatibility report: Future breakage date: None, diagnostic: +warning: this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` (due to autoref coercions), but that might change in the future when `IntoIterator` impls for arrays are added. + --> $DIR/into-iter-on-arrays-lint.rs:10:11 + | +LL | small.into_iter(); + | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` + | + = note: `#[warn(array_into_iter)]` on by default + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #66145 <https://github.com/rust-lang/rust/issues/66145> + +Future breakage date: None, diagnostic: +warning: this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` (due to autoref coercions), but that might change in the future when `IntoIterator` impls for arrays are added. + --> $DIR/into-iter-on-arrays-lint.rs:13:12 + | +LL | [1, 2].into_iter(); + | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #66145 <https://github.com/rust-lang/rust/issues/66145> + +Future breakage date: None, diagnostic: +warning: this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` (due to autoref coercions), but that might change in the future when `IntoIterator` impls for arrays are added. + --> $DIR/into-iter-on-arrays-lint.rs:16:9 + | +LL | big.into_iter(); + | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #66145 <https://github.com/rust-lang/rust/issues/66145> + +Future breakage date: None, diagnostic: +warning: this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` (due to autoref coercions), but that might change in the future when `IntoIterator` impls for arrays are added. + --> $DIR/into-iter-on-arrays-lint.rs:19:15 + | +LL | [0u8; 33].into_iter(); + | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #66145 <https://github.com/rust-lang/rust/issues/66145> + +Future breakage date: None, diagnostic: +warning: this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` (due to autoref coercions), but that might change in the future when `IntoIterator` impls for arrays are added. + --> $DIR/into-iter-on-arrays-lint.rs:23:21 + | +LL | Box::new(small).into_iter(); + | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #66145 <https://github.com/rust-lang/rust/issues/66145> + +Future breakage date: None, diagnostic: +warning: this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` (due to autoref coercions), but that might change in the future when `IntoIterator` impls for arrays are added. + --> $DIR/into-iter-on-arrays-lint.rs:26:22 + | +LL | Box::new([1, 2]).into_iter(); + | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #66145 <https://github.com/rust-lang/rust/issues/66145> + +Future breakage date: None, diagnostic: +warning: this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` (due to autoref coercions), but that might change in the future when `IntoIterator` impls for arrays are added. + --> $DIR/into-iter-on-arrays-lint.rs:29:19 + | +LL | Box::new(big).into_iter(); + | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #66145 <https://github.com/rust-lang/rust/issues/66145> + +Future breakage date: None, diagnostic: +warning: this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` (due to autoref coercions), but that might change in the future when `IntoIterator` impls for arrays are added. + --> $DIR/into-iter-on-arrays-lint.rs:32:25 + | +LL | Box::new([0u8; 33]).into_iter(); + | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #66145 <https://github.com/rust-lang/rust/issues/66145> + +Future breakage date: None, diagnostic: +warning: this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` (due to autoref coercions), but that might change in the future when `IntoIterator` impls for arrays are added. + --> $DIR/into-iter-on-arrays-lint.rs:36:31 + | +LL | Box::new(Box::new(small)).into_iter(); + | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #66145 <https://github.com/rust-lang/rust/issues/66145> + +Future breakage date: None, diagnostic: +warning: this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` (due to autoref coercions), but that might change in the future when `IntoIterator` impls for arrays are added. + --> $DIR/into-iter-on-arrays-lint.rs:39:32 + | +LL | Box::new(Box::new([1, 2])).into_iter(); + | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #66145 <https://github.com/rust-lang/rust/issues/66145> + +Future breakage date: None, diagnostic: +warning: this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` (due to autoref coercions), but that might change in the future when `IntoIterator` impls for arrays are added. + --> $DIR/into-iter-on-arrays-lint.rs:42:29 + | +LL | Box::new(Box::new(big)).into_iter(); + | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #66145 <https://github.com/rust-lang/rust/issues/66145> + +Future breakage date: None, diagnostic: +warning: this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` (due to autoref coercions), but that might change in the future when `IntoIterator` impls for arrays are added. + --> $DIR/into-iter-on-arrays-lint.rs:45:35 + | +LL | Box::new(Box::new([0u8; 33])).into_iter(); + | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #66145 <https://github.com/rust-lang/rust/issues/66145> + +Future breakage date: None, diagnostic: +warning: this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` (due to autoref coercions), but that might change in the future when `IntoIterator` impls for arrays are added. + --> $DIR/into-iter-on-arrays-lint.rs:61:12 + | +LL | [0, 1].into_iter(); + | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` + | +note: the lint level is defined here + --> $DIR/into-iter-on-arrays-lint.rs:60:13 + | +LL | #[allow(array_into_iter)] + | ^^^^^^^^^^^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #66145 <https://github.com/rust-lang/rust/issues/66145> + diff --git a/src/tools/compiletest/src/json.rs b/src/tools/compiletest/src/json.rs index 8eeaf8b1bb5..176c3219307 100644 --- a/src/tools/compiletest/src/json.rs +++ b/src/tools/compiletest/src/json.rs @@ -38,13 +38,13 @@ struct DiagnosticSpan { #[derive(Deserialize)] struct FutureIncompatReport { - future_incompat_report: Vec<FutureBreakageItem> + future_incompat_report: Vec<FutureBreakageItem>, } #[derive(Deserialize)] struct FutureBreakageItem { future_breakage_date: Option<String>, - diagnostic: Diagnostic + diagnostic: Diagnostic, } impl DiagnosticSpan { @@ -80,9 +80,10 @@ struct DiagnosticCode { } pub fn rustfix_diagnostics_only(output: &str) -> String { - output.lines().filter(|line| { - line.starts_with('{') && serde_json::from_str::<Diagnostic>(line).is_ok() - }).collect() + output + .lines() + .filter(|line| line.starts_with('{') && serde_json::from_str::<Diagnostic>(line).is_ok()) + .collect() } pub fn extract_rendered(output: &str) -> String { @@ -93,12 +94,22 @@ pub fn extract_rendered(output: &str) -> String { if let Ok(diagnostic) = serde_json::from_str::<Diagnostic>(line) { diagnostic.rendered } else if let Ok(report) = serde_json::from_str::<FutureIncompatReport>(line) { - Some(format!("Future incompatibility report: {}", - report.future_incompat_report.into_iter().map(|item| { - format!("Future breakage date: {}, diagnostic:\n{}", - item.future_breakage_date.unwrap_or_else(|| "None".to_string()), - item.diagnostic.rendered.unwrap_or_else(|| "Not rendered".to_string())) - }).collect::<String>())) + Some(format!( + "Future incompatibility report: {}", + report + .future_incompat_report + .into_iter() + .map(|item| { + format!( + "Future breakage date: {}, diagnostic:\n{}", + item.future_breakage_date.unwrap_or_else(|| "None".to_string()), + item.diagnostic + .rendered + .unwrap_or_else(|| "Not rendered".to_string()) + ) + }) + .collect::<String>() + )) } else if serde_json::from_str::<ArtifactNotification>(line).is_ok() { // Ignore the notification. None |
