diff options
| author | Ralf Jung <post@ralfj.de> | 2024-01-06 14:39:51 +0100 | 
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2024-01-26 17:25:02 +0100 | 
| commit | 1254ee48c458a5fe8fc1847539169df013098e05 (patch) | |
| tree | 247e3df21358d1d88ebcd856f34bab142ecd8234 /compiler/rustc_mir_build/src | |
| parent | cda358857214bb5a2b3df4f011102ffee3843a72 (diff) | |
| download | rust-1254ee48c458a5fe8fc1847539169df013098e05.tar.gz rust-1254ee48c458a5fe8fc1847539169df013098e05.zip | |
remove illegal_floating_point_literal_pattern lint
Diffstat (limited to 'compiler/rustc_mir_build/src')
| -rw-r--r-- | compiler/rustc_mir_build/src/errors.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs | 12 | 
2 files changed, 3 insertions, 13 deletions
| diff --git a/compiler/rustc_mir_build/src/errors.rs b/compiler/rustc_mir_build/src/errors.rs index eef05051985..641822ae202 100644 --- a/compiler/rustc_mir_build/src/errors.rs +++ b/compiler/rustc_mir_build/src/errors.rs @@ -790,10 +790,6 @@ pub struct NaNPattern { } #[derive(LintDiagnostic)] -#[diag(mir_build_float_pattern)] -pub struct FloatPattern; - -#[derive(LintDiagnostic)] #[diag(mir_build_pointer_pattern)] pub struct PointerPattern; diff --git a/compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs b/compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs index cb67bc6b0b3..9d3a9bf6745 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs @@ -17,7 +17,7 @@ use std::cell::Cell; use super::PatCtxt; use crate::errors::{ - FloatPattern, IndirectStructuralMatch, InvalidPattern, NaNPattern, NonPartialEqMatch, + IndirectStructuralMatch, InvalidPattern, NaNPattern, NonPartialEqMatch, NontrivialStructuralMatch, PointerPattern, TypeNotStructural, UnionPattern, UnsizedPattern, }; @@ -488,16 +488,10 @@ impl<'tcx> ConstToPat<'tcx> { // Also see <https://github.com/rust-lang/rfcs/pull/3535>. let e = tcx.dcx().emit_err(NaNPattern { span }); self.saw_const_match_error.set(Some(e)); + return Err(FallbackToOpaqueConst); } else { - self.saw_const_match_lint.set(true); - tcx.emit_node_span_lint( - lint::builtin::ILLEGAL_FLOATING_POINT_LITERAL_PATTERN, - id, - span, - FloatPattern, - ); + PatKind::Constant { value: mir::Const::Ty(ty::Const::new_value(tcx, cv, ty)) } } - return Err(FallbackToOpaqueConst); } ty::Bool | ty::Char | ty::Int(_) | ty::Uint(_) | ty::RawPtr(..) => { // The raw pointers we see here have been "vetted" by valtree construction to be | 
