|
2 | 2 |
|
3 | 3 | use crate::utils::{clip, sext, unsext};
|
4 | 4 | use if_chain::if_chain;
|
5 |
| -use rustc_ast::ast::{FloatTy, LitFloatType, LitKind}; |
| 5 | +use rustc_ast::ast::{self, LitFloatType, LitKind}; |
6 | 6 | use rustc_data_structures::sync::Lrc;
|
7 | 7 | use rustc_hir::def::{DefKind, Res};
|
8 | 8 | use rustc_hir::{BinOp, BinOpKind, Block, Expr, ExprKind, HirId, QPath, UnOp};
|
9 | 9 | use rustc_lint::LateContext;
|
10 | 10 | use rustc_middle::mir::interpret::Scalar;
|
11 | 11 | use rustc_middle::ty::subst::{Subst, SubstsRef};
|
12 |
| -use rustc_middle::ty::{self, ScalarInt, Ty, TyCtxt}; |
| 12 | +use rustc_middle::ty::{self, FloatTy, ScalarInt, Ty, TyCtxt}; |
13 | 13 | use rustc_middle::{bug, span_bug};
|
14 | 14 | use rustc_span::symbol::Symbol;
|
15 | 15 | use std::cmp::Ordering::{self, Equal};
|
@@ -167,8 +167,8 @@ pub fn lit_to_constant(lit: &LitKind, ty: Option<Ty<'_>>) -> Constant {
|
167 | 167 | LitKind::Char(c) => Constant::Char(c),
|
168 | 168 | LitKind::Int(n, _) => Constant::Int(n),
|
169 | 169 | LitKind::Float(ref is, LitFloatType::Suffixed(fty)) => match fty {
|
170 |
| - FloatTy::F32 => Constant::F32(is.as_str().parse().unwrap()), |
171 |
| - FloatTy::F64 => Constant::F64(is.as_str().parse().unwrap()), |
| 170 | + ast::FloatTy::F32 => Constant::F32(is.as_str().parse().unwrap()), |
| 171 | + ast::FloatTy::F64 => Constant::F64(is.as_str().parse().unwrap()), |
172 | 172 | },
|
173 | 173 | LitKind::Float(ref is, LitFloatType::Unsuffixed) => match ty.expect("type of float is known").kind() {
|
174 | 174 | ty::Float(FloatTy::F32) => Constant::F32(is.as_str().parse().unwrap()),
|
|
0 commit comments