1 // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // Matching against float literals should result in a linter error
13 #![feature(slice_patterns)]
14 #![feature(exclusive_range_pattern)]
16 #![forbid(illegal_floating_point_literal_pattern)]
21 5.0 => {}, //~ ERROR floating-point literals cannot be used
22 //~| WARNING hard error
23 5.0f32 => {}, //~ ERROR floating-point literals cannot be used
24 //~| WARNING hard error
25 -5.0 => {}, //~ ERROR floating-point literals cannot be used
26 //~| WARNING hard error
27 1.0 .. 33.0 => {}, //~ ERROR floating-point literals cannot be used
28 //~| WARNING hard error
29 //~| ERROR floating-point literals cannot be used
30 //~| WARNING hard error
31 39.0 ... 70.0 => {}, //~ ERROR floating-point literals cannot be used
32 //~| WARNING hard error
33 //~| ERROR floating-point literals cannot be used
34 //~| WARNING hard error
40 (3.14, 1) => {}, //~ ERROR floating-point literals cannot be used
41 //~| WARNING hard error
42 //~| ERROR floating-point literals cannot be used
43 //~| WARNING hard error
47 struct Foo { x: f32 };
49 Foo { x: 2.0 } => {}, //~ ERROR floating-point literals cannot be used
50 //~| WARNING hard error
51 //~| ERROR floating-point literals cannot be used
52 //~| WARNING hard error