mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
Revert "stabilize const_float_bits_conv" for src/tools/clippy/clippy_lints
This reverts the part of commit 19908ff7a3
in
subdirectory src/tools/clippy/clippy_lints.
This commit is contained in:
parent
d0985bb524
commit
d195f80639
@ -619,10 +619,10 @@ impl<'tcx> LateLintPass<'tcx> for Transmute {
|
||||
| transmute_ref_to_ref::check(cx, e, from_ty, to_ty, arg, const_context)
|
||||
| transmute_ptr_to_ptr::check(cx, e, from_ty, to_ty, arg, &self.msrv)
|
||||
| transmute_int_to_bool::check(cx, e, from_ty, to_ty, arg)
|
||||
| transmute_int_to_float::check(cx, e, from_ty, to_ty, arg)
|
||||
| transmute_int_to_float::check(cx, e, from_ty, to_ty, arg, const_context)
|
||||
| transmute_int_to_non_zero::check(cx, e, from_ty, to_ty, arg)
|
||||
| transmute_float_to_int::check(cx, e, from_ty, to_ty, arg)
|
||||
| transmute_num_to_bytes::check(cx, e, from_ty, to_ty, arg)
|
||||
| transmute_float_to_int::check(cx, e, from_ty, to_ty, arg, const_context)
|
||||
| transmute_num_to_bytes::check(cx, e, from_ty, to_ty, arg, const_context)
|
||||
| (unsound_collection_transmute::check(cx, e, from_ty, to_ty)
|
||||
|| transmute_undefined_repr::check(cx, e, from_ty, to_ty))
|
||||
| (eager_transmute::check(cx, e, arg, from_ty, to_ty));
|
||||
|
@ -15,9 +15,10 @@ pub(super) fn check<'tcx>(
|
||||
from_ty: Ty<'tcx>,
|
||||
to_ty: Ty<'tcx>,
|
||||
mut arg: &'tcx Expr<'_>,
|
||||
const_context: bool,
|
||||
) -> bool {
|
||||
match (&from_ty.kind(), &to_ty.kind()) {
|
||||
(ty::Float(float_ty), ty::Int(_) | ty::Uint(_)) => {
|
||||
(ty::Float(float_ty), ty::Int(_) | ty::Uint(_)) if !const_context => {
|
||||
span_lint_and_then(
|
||||
cx,
|
||||
TRANSMUTE_FLOAT_TO_INT,
|
||||
|
@ -14,9 +14,10 @@ pub(super) fn check<'tcx>(
|
||||
from_ty: Ty<'tcx>,
|
||||
to_ty: Ty<'tcx>,
|
||||
arg: &'tcx Expr<'_>,
|
||||
const_context: bool,
|
||||
) -> bool {
|
||||
match (&from_ty.kind(), &to_ty.kind()) {
|
||||
(ty::Int(_) | ty::Uint(_), ty::Float(_)) => {
|
||||
(ty::Int(_) | ty::Uint(_), ty::Float(_)) if !const_context => {
|
||||
span_lint_and_then(
|
||||
cx,
|
||||
TRANSMUTE_INT_TO_FLOAT,
|
||||
|
@ -14,12 +14,18 @@ pub(super) fn check<'tcx>(
|
||||
from_ty: Ty<'tcx>,
|
||||
to_ty: Ty<'tcx>,
|
||||
arg: &'tcx Expr<'_>,
|
||||
const_context: bool,
|
||||
) -> bool {
|
||||
match (&from_ty.kind(), &to_ty.kind()) {
|
||||
(ty::Int(_) | ty::Uint(_) | ty::Float(_), ty::Array(arr_ty, _)) => {
|
||||
if !matches!(arr_ty.kind(), ty::Uint(UintTy::U8)) {
|
||||
return false;
|
||||
}
|
||||
if matches!(from_ty.kind(), ty::Float(_)) && const_context {
|
||||
// TODO: Remove when const_float_bits_conv is stabilized
|
||||
// rust#72447
|
||||
return false;
|
||||
}
|
||||
|
||||
span_lint_and_then(
|
||||
cx,
|
||||
|
Loading…
Reference in New Issue
Block a user