Skip to content

Commit a640997

Browse files
authored
Unrolled build for rust-lang#123087
Rollup merge of rust-lang#123087 - tgross35:clippy-f16-f128-check-stubs, r=blyxyas Change `f16` and `f128` clippy stubs to be nonpanicking It turns out there is a bit of a circular dependency - I cannot add anything to `core` because Clippy fails, and I can't actually add correct Clippy implementations without new implementations from `core`. Change some of the Clippy stubs from `unimplemented!` to success values and leave a FIXME in their place to mitigate this. Fixes <rust-lang#122587>
2 parents 47ecded + 2cfd532 commit a640997

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/tools/clippy/clippy_lints/src/float_literal.rs

+11-4
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,10 @@ impl<'tcx> LateLintPass<'tcx> for FloatLiteral {
8383
LitFloatType::Unsuffixed => None,
8484
};
8585
let (is_whole, is_inf, mut float_str) = match fty {
86-
FloatTy::F16 => unimplemented!("f16_f128"),
86+
FloatTy::F16 => {
87+
// FIXME(f16_f128): do a check like the others when parsing is available
88+
return;
89+
},
8790
FloatTy::F32 => {
8891
let value = sym_str.parse::<f32>().unwrap();
8992

@@ -94,7 +97,10 @@ impl<'tcx> LateLintPass<'tcx> for FloatLiteral {
9497

9598
(value.fract() == 0.0, value.is_infinite(), formatter.format(value))
9699
},
97-
FloatTy::F128 => unimplemented!("f16_f128"),
100+
FloatTy::F128 => {
101+
// FIXME(f16_f128): do a check like the others when parsing is available
102+
return;
103+
},
98104
};
99105

100106
if is_inf {
@@ -139,10 +145,11 @@ impl<'tcx> LateLintPass<'tcx> for FloatLiteral {
139145
#[must_use]
140146
fn max_digits(fty: FloatTy) -> u32 {
141147
match fty {
142-
FloatTy::F16 => unimplemented!("f16_f128"),
148+
// FIXME(f16_f128): replace the magic numbers once `{f16,f128}::DIGITS` are available
149+
FloatTy::F16 => 3,
143150
FloatTy::F32 => f32::DIGITS,
144151
FloatTy::F64 => f64::DIGITS,
145-
FloatTy::F128 => unimplemented!("f16_f128"),
152+
FloatTy::F128 => 33,
146153
}
147154
}
148155

0 commit comments

Comments
 (0)