diff options
| author | Josh Stone <jistone@redhat.com> | 2024-08-29 13:58:43 -0700 |
|---|---|---|
| committer | Josh Stone <jistone@redhat.com> | 2024-08-29 13:58:43 -0700 |
| commit | c339541f731a3c26e104c0ff2f5ce32c206ecb6c (patch) | |
| tree | 71083f1b5645d6fcf0a6d31d3b3b62ff1afe3431 /tests/ui/inference/detect-old-time-version-format_description-parse.rs | |
| parent | 784d444733d65c3d305ce5edcbb41e3d0d0aee2e (diff) | |
| download | rust-c339541f731a3c26e104c0ff2f5ce32c206ecb6c.tar.gz rust-c339541f731a3c26e104c0ff2f5ce32c206ecb6c.zip | |
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>`.
Diffstat (limited to 'tests/ui/inference/detect-old-time-version-format_description-parse.rs')
| -rw-r--r-- | tests/ui/inference/detect-old-time-version-format_description-parse.rs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/tests/ui/inference/detect-old-time-version-format_description-parse.rs b/tests/ui/inference/detect-old-time-version-format_description-parse.rs index 453a795e768..386b2a3bf3c 100644 --- a/tests/ui/inference/detect-old-time-version-format_description-parse.rs +++ b/tests/ui/inference/detect-old-time-version-format_description-parse.rs @@ -1,8 +1,13 @@ #![crate_name = "time"] +#![crate_type = "lib"] -fn main() { - let items = Box::new(vec![]); //~ ERROR E0282 +// This code compiled without error in Rust 1.79, but started failing in 1.80 +// after the addition of several `impl FromIterator<_> for Box<str>`. + +pub fn parse() -> Option<Vec<()>> { + let iter = std::iter::once(Some(())).map(|o| o.map(Into::into)); + let items = iter.collect::<Option<Box<_>>>()?; //~ ERROR E0282 + //~^ 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` + Some(items.into()) //~^ NOTE type must be known at this point - //~| 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` - items.into(); } |
