Change:
I'm seeing an internal compiler error on the following input, found by : The ICE happens after correctly reporting a malformed float error, so low priority. Note that slight modifications of the input fix the panic. For example using instead of results in no panic. Also there is no panic if compling only the string . Affected versions: I tried nightly 2021-11-30 and stable 1.56.1 and they both show the same ICE. <details<summary<strongBacktrace</strong</summary<p</p</details<!-- TRIAGEBOTSTART --<!-- TRIAGEBOTASSIGNSTART --<!-- TRIAGEBOTASSIGNDATASTARTTRIAGEBOTASSIGNDATAEND --<!-- TRIAGEBOTASSIGNEND --<!-- TRIAGEBOTEND --
claim
Might be related? Formatting of "1e-15" behavior seems to have changed on nightly for f64 and f32.
It may have a common cause, but you should open a separate issue because the pull request that fixes this doesn't fix your problem.

Discussion:
(ast::LitKind::Int(n, _), ty::Uint(_)) | (ast::LitKind::Int(n, _), ty::Int(_)) => { trunc(if neg { (*n as i128).overflowing_neg().0 as u128 } else { *n })? } <del> (ast::LitKind::Float(n, _), ty::Float(fty)) => parse_float(*n, *fty, neg), </del> <ins> (ast::LitKind::Float(n, _), ty::Float(fty)) => { parse_float(*n, *fty, neg).ok_or(LitToConstError::Reported)? } </ins> (ast::LitKind::Bool(b), ty::Bool) => ConstValue::Scalar(Scalar::from_bool(*b)), (ast::LitKind::Char(c), ty::Char) => ConstValue::Scalar(Scalar::from_char(*c)), (ast::LitKind::Err(_), _) => return Err(LitToConstError::Reported),

Ok(ty::Const::from_value(tcx, lit, ty)) } <del> fn parse_float<'tcx>(num: Symbol, fty: ty::FloatTy, neg: bool) -> ConstValue<'tcx> { </del> <ins> fn parse_float<'tcx>(num: Symbol, fty: ty::FloatTy, neg: bool) -> Option<ConstValue<'tcx>> { </ins> let num = num.as_str(); use rustc_apfloat::ieee::{Double, Single}; let scalar = match fty { ty::FloatTy::F32 => { <del> let rust_f = num .parse::<f32>() .unwrap_or_else(|e| panic!("f32 failed to parse `{}`: {:?}", num, e)); </del> <ins> let rust_f = match num.parse::<f32>() { Ok(f) => f, Err(_) => return None, }; </ins> let mut f = num.parse::<Single>().unwrap_or_else(|e| { panic!("apfloat::ieee::Single failed to parse `{}`: {:?}", num, e) });

Scalar::from_f32(f) } ty::FloatTy::F64 => { <del> let rust_f = num .parse::<f64>() .unwrap_or_else(|e| panic!("f64 failed to parse `{}`: {:?}", num, e)); </del> <ins> let rust_f = match num.parse::<f64>() { Ok(f) => f, Err(_) => return None, }; </ins> let mut f = num.parse::<Double>().unwrap_or_else(|e| { panic!("apfloat::ieee::Double failed to parse `{}`: {:?}", num, e) });

} }; <del> ConstValue::Scalar(scalar) </del> <ins> Some(ConstValue::Scalar(scalar)) </ins> }

<ins> fn main() { [9; [[9E; h]]]; //~^ ERROR: expected at least one digit in exponent //~| ERROR: cannot find value `h` in this scope [E0425] //~| ERROR: constant expression depends on a generic parameter } </ins>

<ins> error: expected at least one digit in exponent --> $DIR/issue-91434.rs:2:11 | LL |     [9; [[9E; h]]]; |           ^^ error[E0425]: cannot find value `h` in this scope --> $DIR/issue-91434.rs:2:15 | LL |     [9; [[9E; h]]]; |               ^ not found in this scope error: constant expression depends on a generic parameter --> $DIR/issue-91434.rs:2:9 | LL |     [9; [[9E; h]]]; |         ^^^^^^^^^ | = note: this may fail depending on what value the parameter takes error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0425`. </ins>