2021-10-25 19:04:35 -05:00
|
|
|
// Make sure that trying to access `TryInto`, `TryFrom`, `FromIterator` in pre-2021 mentions
|
|
|
|
// Edition 2021 change
|
2021-10-24 20:09:52 -05:00
|
|
|
// edition:2018
|
|
|
|
|
2021-10-26 20:18:04 -05:00
|
|
|
fn test() {
|
|
|
|
let _i: i16 = 0_i32.try_into().unwrap();
|
2021-10-24 20:09:52 -05:00
|
|
|
//~^ ERROR no method named `try_into` found for type `i32` in the current scope
|
|
|
|
//~| NOTE method not found in `i32`
|
2021-10-26 20:18:04 -05:00
|
|
|
//~| NOTE 'std::convert::TryInto' is included in the prelude starting in Edition 2021
|
2021-10-25 19:04:35 -05:00
|
|
|
|
2021-10-26 20:18:04 -05:00
|
|
|
let _i: i16 = TryFrom::try_from(0_i32).unwrap();
|
2021-10-25 19:04:35 -05:00
|
|
|
//~^ ERROR failed to resolve: use of undeclared type
|
2022-10-27 01:36:07 -05:00
|
|
|
//~| NOTE use of undeclared type
|
2021-10-26 20:18:04 -05:00
|
|
|
//~| NOTE 'std::convert::TryFrom' is included in the prelude starting in Edition 2021
|
2021-10-25 19:04:35 -05:00
|
|
|
//~| NOTE 'core::convert::TryFrom' is included in the prelude starting in Edition 2021
|
|
|
|
|
2021-10-26 20:18:04 -05:00
|
|
|
let _i: i16 = TryInto::try_into(0_i32).unwrap();
|
2021-10-25 19:04:35 -05:00
|
|
|
//~^ ERROR failed to resolve: use of undeclared type
|
2022-10-27 01:36:07 -05:00
|
|
|
//~| NOTE use of undeclared type
|
2021-10-26 20:18:04 -05:00
|
|
|
//~| NOTE 'std::convert::TryInto' is included in the prelude starting in Edition 2021
|
2021-10-25 19:04:35 -05:00
|
|
|
//~| NOTE 'core::convert::TryInto' is included in the prelude starting in Edition 2021
|
|
|
|
|
2021-10-26 20:18:04 -05:00
|
|
|
let _v: Vec<_> = FromIterator::from_iter(&[1]);
|
2021-10-25 19:04:35 -05:00
|
|
|
//~^ ERROR failed to resolve: use of undeclared type
|
2022-10-27 01:36:07 -05:00
|
|
|
//~| NOTE use of undeclared type
|
2021-10-26 20:18:04 -05:00
|
|
|
//~| NOTE 'std::iter::FromIterator' is included in the prelude starting in Edition 2021
|
2021-10-25 19:04:35 -05:00
|
|
|
//~| NOTE 'core::iter::FromIterator' is included in the prelude starting in Edition 2021
|
2021-10-24 20:09:52 -05:00
|
|
|
}
|
2021-10-26 20:18:04 -05:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
test();
|
|
|
|
}
|