]> git.proxmox.com Git - rustc.git/blob - src/test/ui/suggestions/suggest-tryinto-edition-change.rs
Update unsuspicious file list
[rustc.git] / src / test / ui / suggestions / suggest-tryinto-edition-change.rs
1 // Make sure that trying to access `TryInto`, `TryFrom`, `FromIterator` in pre-2021 mentions
2 // Edition 2021 change
3 // edition:2018
4
5 fn test() {
6 let _i: i16 = 0_i32.try_into().unwrap();
7 //~^ ERROR no method named `try_into` found for type `i32` in the current scope
8 //~| NOTE method not found in `i32`
9 //~| NOTE 'std::convert::TryInto' is included in the prelude starting in Edition 2021
10
11 let _i: i16 = TryFrom::try_from(0_i32).unwrap();
12 //~^ ERROR failed to resolve: use of undeclared type
13 //~| NOTE use of undeclared type
14 //~| NOTE 'std::convert::TryFrom' is included in the prelude starting in Edition 2021
15 //~| NOTE 'core::convert::TryFrom' is included in the prelude starting in Edition 2021
16
17 let _i: i16 = TryInto::try_into(0_i32).unwrap();
18 //~^ ERROR failed to resolve: use of undeclared type
19 //~| NOTE use of undeclared type
20 //~| NOTE 'std::convert::TryInto' is included in the prelude starting in Edition 2021
21 //~| NOTE 'core::convert::TryInto' is included in the prelude starting in Edition 2021
22
23 let _v: Vec<_> = FromIterator::from_iter(&[1]);
24 //~^ ERROR failed to resolve: use of undeclared type
25 //~| NOTE use of undeclared type
26 //~| NOTE 'std::iter::FromIterator' is included in the prelude starting in Edition 2021
27 //~| NOTE 'core::iter::FromIterator' is included in the prelude starting in Edition 2021
28 }
29
30 fn main() {
31 test();
32 }