blob: 83de98d80cae657c8516093deb70edd3c0abfecf [file]
error[E0282]: type annotations needed
--> $DIR/index-expr-ambiguous-type.rs:9:34
|
LL | let _foo = [1, 2, 3][bad_idx.into()] as i32;
| ^^^^ cannot infer type
error[E0284]: type annotations needed
--> $DIR/index-expr-ambiguous-type.rs:15:38
|
LL | let _foo = 0 + [1, 2, 3][bad_idx.into()];
| ^^^^ cannot infer type
|
= note: cannot satisfy `<i32 as Add<_>>::Output == _`
error[E0283]: type annotations needed
--> $DIR/index-expr-ambiguous-type.rs:21:34
|
LL | let _foo = [1, 2, 3][bad_idx.into()];
| ^^^^
|
= note: the type must implement `From<u8>`
= note: required for `u8` to implement `Into<_>`
help: try using a fully qualified path to specify the expected types
|
LL - let _foo = [1, 2, 3][bad_idx.into()];
LL + let _foo = [1, 2, 3][<u8 as Into<T>>::into(bad_idx)];
|
error[E0369]: cannot add `_` to `bool`
--> $DIR/index-expr-ambiguous-type.rs:32:21
|
LL | let _foo = true + [1, 2, 3][bad_idx.into()];
| ---- ^ ------------------------- _
| |
| bool
error[E0284]: type annotations needed
--> $DIR/index-expr-ambiguous-type.rs:38:21
|
LL | let _foo = 0u64 + [1i32, 2, 3][bad_idx.into()];
| ^ cannot infer type
|
= note: cannot satisfy `<u64 as Add<_>>::Output == _`
error[E0284]: type annotations needed
--> $DIR/index-expr-ambiguous-type.rs:44:38
|
LL | let _foo = 1u32 << [0u8][bad_idx.into()];
| ^^^^ cannot infer type
|
= note: cannot satisfy `<u32 as Shl<_>>::Output == _`
error[E0283]: type annotations needed
--> $DIR/index-expr-ambiguous-type.rs:50:45
|
LL | let _foo = String::new() + [""][bad_idx.into()];
| ^^^^
|
= note: the type must implement `From<u8>`
= note: required for `u8` to implement `Into<_>`
help: try using a fully qualified path to specify the expected types
|
LL - let _foo = String::new() + [""][bad_idx.into()];
LL + let _foo = String::new() + [""][<u8 as Into<T>>::into(bad_idx)];
|
error: aborting due to 7 previous errors
Some errors have detailed explanations: E0282, E0283, E0284, E0369.
For more information about an error, try `rustc --explain E0282`.