diff --git a/compiler/rustc_codegen_cranelift/src/cast.rs b/compiler/rustc_codegen_cranelift/src/cast.rs index f124739d1e154..abf4326f91888 100644 --- a/compiler/rustc_codegen_cranelift/src/cast.rs +++ b/compiler/rustc_codegen_cranelift/src/cast.rs @@ -148,10 +148,6 @@ pub(crate) fn clif_int_or_float_cast( fx.bcx.ins().fcvt_to_uint_sat(to_ty, from) }; - if let Some(false) = fx.tcx.sess.opts.unstable_opts.saturating_float_casts { - return val; - } - let is_not_nan = fx.bcx.ins().fcmp(FloatCC::Equal, from, from); let zero = type_zero_value(&mut fx.bcx, to_ty); fx.bcx.ins().select(is_not_nan, val, zero) diff --git a/compiler/rustc_codegen_cranelift/src/codegen_f16_f128.rs b/compiler/rustc_codegen_cranelift/src/codegen_f16_f128.rs index 3dbd59c2fca4d..09762f1a451b6 100644 --- a/compiler/rustc_codegen_cranelift/src/codegen_f16_f128.rs +++ b/compiler/rustc_codegen_cranelift/src/codegen_f16_f128.rs @@ -265,10 +265,6 @@ pub(crate) fn codegen_cast( fx.bcx.ins().ireduce(to_ty, val) }; - if let Some(false) = fx.tcx.sess.opts.unstable_opts.saturating_float_casts { - return val; - } - let is_not_nan = fcmp(fx, FloatCC::Equal, from, from); let zero = type_zero_value(&mut fx.bcx, to_ty); fx.bcx.ins().select(is_not_nan, val, zero) diff --git a/compiler/rustc_codegen_ssa/src/traits/builder.rs b/compiler/rustc_codegen_ssa/src/traits/builder.rs index 56dc13b832032..cb0209a0ae369 100644 --- a/compiler/rustc_codegen_ssa/src/traits/builder.rs +++ b/compiler/rustc_codegen_ssa/src/traits/builder.rs @@ -404,10 +404,6 @@ pub trait BuilderMethods<'a, 'tcx>: ); assert_eq!(self.cx().type_kind(int_ty), TypeKind::Integer); - if let Some(false) = self.cx().sess().opts.unstable_opts.saturating_float_casts { - return if signed { self.fptosi(x, dest_ty) } else { self.fptoui(x, dest_ty) }; - } - if signed { self.fptosi_sat(x, dest_ty) } else { self.fptoui_sat(x, dest_ty) } } diff --git a/compiler/rustc_interface/src/tests.rs b/compiler/rustc_interface/src/tests.rs index d3c479f2a22f5..41ce4fb759dac 100644 --- a/compiler/rustc_interface/src/tests.rs +++ b/compiler/rustc_interface/src/tests.rs @@ -890,7 +890,6 @@ fn test_unstable_options_tracking_hash() { tracked!(sanitizer_kcfi_arity, Some(true)); tracked!(sanitizer_memory_track_origins, 2); tracked!(sanitizer_recover, SanitizerSet::ADDRESS); - tracked!(saturating_float_casts, Some(true)); tracked!(share_generics, Some(true)); tracked!(simulate_remapped_rust_src_base, Some(PathBuf::from("/rustc/abc"))); tracked!(small_data_threshold, Some(16)); diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 90459090ced87..d1cc7122236b7 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -2827,9 +2827,6 @@ written to standard error output)"), "enable origins tracking in MemorySanitizer"), sanitizer_recover: SanitizerSet = (SanitizerSet::empty(), parse_sanitizers, [TRACKED], "enable recovery for selected sanitizers"), - saturating_float_casts: Option = (None, parse_opt_bool, [TRACKED], - "make float->int casts UB-free: numbers outside the integer type's range are clipped to \ - the max/min integer respectively, and NaN is mapped to 0 (default: yes)"), self_profile: SwitchWithOptPath = (SwitchWithOptPath::Disabled, parse_switch_with_opt_path, [UNTRACKED], "run the self profiler and output the raw event data"),