Update into-iter-on-arrays test to check future-incompat-report
This commit is contained in:
parent
4b4f84f327
commit
4621ce9858
src
test/ui/iterators
tools/compiletest/src
@ -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();
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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>
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user