|
1 | 1 | error[E0433]: failed to resolve: use of undeclared type `TryFrom` |
2 | | - --> $DIR/suggest-tryinto-edition-change.rs:16:30 |
| 2 | + --> $DIR/suggest-tryinto-edition-change.rs:11:19 |
3 | 3 | | |
4 | | -LL | let _i: Result<i16, _> = TryFrom::try_from(0_i32); |
5 | | - | ^^^^^^^ not found in this scope |
| 4 | +LL | let _i: i16 = TryFrom::try_from(0_i32).unwrap(); |
| 5 | + | ^^^^^^^ not found in this scope |
6 | 6 | | |
| 7 | + = note: 'std::convert::TryFrom' is included in the prelude starting in Edition 2021 |
7 | 8 | = note: 'core::convert::TryFrom' is included in the prelude starting in Edition 2021 |
8 | | -help: consider importing this trait |
| 9 | +help: consider importing one of these items |
9 | 10 | | |
10 | 11 | LL | use core::convert::TryFrom; |
11 | 12 | | |
| 13 | +LL | use std::convert::TryFrom; |
| 14 | + | |
12 | 15 |
|
13 | 16 | error[E0433]: failed to resolve: use of undeclared type `TryInto` |
14 | | - --> $DIR/suggest-tryinto-edition-change.rs:21:30 |
| 17 | + --> $DIR/suggest-tryinto-edition-change.rs:17:19 |
15 | 18 | | |
16 | | -LL | let _i: Result<i16, _> = TryInto::try_into(0_i32); |
17 | | - | ^^^^^^^ not found in this scope |
| 19 | +LL | let _i: i16 = TryInto::try_into(0_i32).unwrap(); |
| 20 | + | ^^^^^^^ not found in this scope |
18 | 21 | | |
| 22 | + = note: 'std::convert::TryInto' is included in the prelude starting in Edition 2021 |
19 | 23 | = note: 'core::convert::TryInto' is included in the prelude starting in Edition 2021 |
20 | | -help: consider importing this trait |
| 24 | +help: consider importing one of these items |
21 | 25 | | |
22 | 26 | LL | use core::convert::TryInto; |
23 | 27 | | |
| 28 | +LL | use std::convert::TryInto; |
| 29 | + | |
24 | 30 |
|
25 | 31 | error[E0433]: failed to resolve: use of undeclared type `FromIterator` |
26 | | - --> $DIR/suggest-tryinto-edition-change.rs:26:18 |
| 32 | + --> $DIR/suggest-tryinto-edition-change.rs:23:22 |
27 | 33 | | |
28 | | -LL | let _i: () = FromIterator::from_iter(core::iter::empty()); |
29 | | - | ^^^^^^^^^^^^ |
| 34 | +LL | let _v: Vec<_> = FromIterator::from_iter(&[1]); |
| 35 | + | ^^^^^^^^^^^^ |
30 | 36 | | |
31 | 37 | ::: $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL |
32 | 38 | | |
33 | 39 | LL | pub trait IntoIterator { |
34 | 40 | | ---------------------- similarly named trait `IntoIterator` defined here |
35 | 41 | | |
| 42 | + = note: 'std::iter::FromIterator' is included in the prelude starting in Edition 2021 |
36 | 43 | = note: 'core::iter::FromIterator' is included in the prelude starting in Edition 2021 |
37 | 44 | help: a trait with a similar name exists |
38 | 45 | | |
39 | | -LL | let _i: () = IntoIterator::from_iter(core::iter::empty()); |
40 | | - | ~~~~~~~~~~~~ |
41 | | -help: consider importing this trait |
| 46 | +LL | let _v: Vec<_> = IntoIterator::from_iter(&[1]); |
| 47 | + | ~~~~~~~~~~~~ |
| 48 | +help: consider importing one of these items |
42 | 49 | | |
43 | 50 | LL | use core::iter::FromIterator; |
44 | 51 | | |
| 52 | +LL | use std::iter::FromIterator; |
| 53 | + | |
45 | 54 |
|
46 | 55 | error[E0599]: no method named `try_into` found for type `i32` in the current scope |
47 | | - --> $DIR/suggest-tryinto-edition-change.rs:11:36 |
| 56 | + --> $DIR/suggest-tryinto-edition-change.rs:6:25 |
48 | 57 | | |
49 | | -LL | let _i: Result<i16, _> = 0_i32.try_into(); |
50 | | - | ^^^^^^^^ method not found in `i32` |
| 58 | +LL | let _i: i16 = 0_i32.try_into().unwrap(); |
| 59 | + | ^^^^^^^^ method not found in `i32` |
51 | 60 | | |
52 | 61 | ::: $SRC_DIR/core/src/convert/mod.rs:LL:COL |
53 | 62 | | |
54 | 63 | LL | fn try_into(self) -> Result<T, Self::Error>; |
55 | 64 | | -------- the method is available for `i32` here |
56 | 65 | | |
57 | 66 | = help: items from traits can only be used if the trait is in scope |
58 | | - = note: 'core::convert::TryInto' is included in the prelude starting in Edition 2021 |
| 67 | + = note: 'std::convert::TryInto' is included in the prelude starting in Edition 2021 |
59 | 68 | help: the following trait is implemented but not in scope; perhaps add a `use` for it: |
60 | 69 | | |
61 | | -LL | use core::convert::TryInto; |
| 70 | +LL | use std::convert::TryInto; |
62 | 71 | | |
63 | 72 |
|
64 | 73 | error: aborting due to 4 previous errors |
|
0 commit comments