]> git.lizzy.rs Git - rust.git/blob - src/test/ui/shift-various-bad-types.rs
Auto merge of #81507 - weiznich:add_diesel_to_cargo_test, r=Mark-Simulacrum
[rust.git] / src / test / ui / shift-various-bad-types.rs
1 // Test that we can do shifts by any integral type.
2
3 struct Panolpy {
4     char: char,
5     str: &'static str,
6 }
7
8 fn foo(p: &Panolpy) {
9     22 >> p.char;
10     //~^ ERROR E0277
11
12     22 >> p.str;
13     //~^ ERROR E0277
14
15     22 >> p;
16     //~^ ERROR E0277
17
18     let x;
19     22 >> x; // ambiguity error winds up being suppressed
20
21     22 >> 1;
22     // Integer literal types are OK
23
24     // Type of the result follows the LHS, not the RHS:
25     let _: i32 = 22_i64 >> 1_i32;
26     //~^ ERROR mismatched types
27     //~| expected `i32`, found `i64`
28 }
29
30 fn main() {
31 }