Skip to content

Commit ff0c986

Browse files
authored
Rollup merge of rust-lang#129760 - cuviper:old-timey, r=compiler-errors
Make the "detect-old-time" UI test more representative The test code did have an inference failure, but that would have failed on Rust 1.79 and earlier too. Now it is rewritten to be specifically affected by 1.80's `impl FromIterator<_> for Box<str>`.
2 parents 6b9ed71 + c339541 commit ff0c986

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
#![crate_name = "time"]
2+
#![crate_type = "lib"]
23

3-
fn main() {
4-
let items = Box::new(vec![]); //~ ERROR E0282
4+
// This code compiled without error in Rust 1.79, but started failing in 1.80
5+
// after the addition of several `impl FromIterator<_> for Box<str>`.
6+
7+
pub fn parse() -> Option<Vec<()>> {
8+
let iter = std::iter::once(Some(())).map(|o| o.map(Into::into));
9+
let items = iter.collect::<Option<Box<_>>>()?; //~ ERROR E0282
10+
//~^ NOTE this is an inference error on crate `time` caused by an API change in Rust 1.80.0; update `time` to version `>=0.3.35`
11+
Some(items.into())
512
//~^ NOTE type must be known at this point
6-
//~| NOTE this is an inference error on crate `time` caused by an API change in Rust 1.80.0; update `time` to version `>=0.3.35`
7-
items.into();
813
}

tests/ui/inference/detect-old-time-version-format_description-parse.stderr

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
error[E0282]: type annotations needed for `Box<Vec<_>>`
2-
--> $DIR/detect-old-time-version-format_description-parse.rs:4:9
1+
error[E0282]: type annotations needed for `Box<_>`
2+
--> $DIR/detect-old-time-version-format_description-parse.rs:9:9
33
|
4-
LL | let items = Box::new(vec![]);
5-
| ^^^^^ ---------------- type must be known at this point
4+
LL | let items = iter.collect::<Option<Box<_>>>()?;
5+
| ^^^^^
6+
LL |
7+
LL | Some(items.into())
8+
| ---- type must be known at this point
69
|
710
= note: this is an inference error on crate `time` caused by an API change in Rust 1.80.0; update `time` to version `>=0.3.35` by calling `cargo update`
811

0 commit comments

Comments
 (0)