Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f7ceb1a

Browse files
committedApr 21, 2020
Error on casting floats to integers
This is intended for a crater run to know the total (worst case) extent of slowdowns introduced by changing the behavior here.
1 parent 45d050c commit f7ceb1a

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed
 

‎src/librustc_typeck/check/cast.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,7 @@ impl<'a, 'tcx> CastCheck<'tcx> {
613613
(Int(CEnum), Int(_)) => Ok(CastKind::EnumCast),
614614
(Int(Char) | Int(Bool), Int(_)) => Ok(CastKind::PrimIntCast),
615615

616+
(Float, Int(_)) if std::env::var_os("RUSTC_BOOTSTRAP").is_none() => Err(CastError::IllegalCast),
616617
(Int(_) | Float, Int(_) | Float) => Ok(CastKind::NumericCast),
617618
}
618619
}

0 commit comments

Comments
 (0)
Please sign in to comment.