]>
git.proxmox.com Git - rustc.git/blob - src/test/ui/issues/issue-41255.rs
1 // Matching against float literals should result in a linter error
3 #![feature(exclusive_range_pattern)]
4 #![feature(half_open_range_patterns)]
6 #![forbid(illegal_floating_point_literal_pattern)]
11 5.0 => {}
, //~ ERROR floating-point types cannot be used in patterns
12 //~| WARNING hard error
13 5.0f32 => {}
, //~ ERROR floating-point types cannot be used in patterns
14 //~| WARNING hard error
15 -5.0 => {}
, //~ ERROR floating-point types cannot be used in patterns
16 //~| WARNING hard error
17 1.0 .. 33.0 => {}
, //~ ERROR floating-point types cannot be used in patterns
18 //~| WARNING hard error
19 //~| ERROR floating-point types cannot be used in patterns
20 //~| WARNING hard error
21 39.0 ..= 70.0 => {}
, //~ ERROR floating-point types cannot be used in patterns
22 //~| ERROR floating-point types cannot be used in patterns
23 //~| WARNING hard error
24 //~| WARNING hard error
27 //~^ ERROR floating-point types cannot be used in patterns
28 //~| WARNING this was previously accepted by the compiler
30 //~^ ERROR floating-point types cannot be used in patterns
31 //~| WARNING this was previously accepted by the compiler
33 //~^ ERROR floating-point types cannot be used in patterns
34 //~| WARNING this was previously accepted by the compiler
40 (3.14, 1) => {}
, //~ ERROR floating-point types cannot be used
41 //~| WARNING hard error
45 struct Foo { x: f32 }
;
47 Foo { x: 2.0 }
=> {}
, //~ ERROR floating-point types cannot be used
48 //~| WARNING hard error