diff options
Diffstat (limited to 'compiler/rustc_codegen_ssa')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/back/symbol_export.rs | 6 | ||||
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/back/write.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/common.rs | 1 | ||||
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/mir/block.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/mir/debuginfo.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/mir/operand.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/mir/place.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/mir/rvalue.rs | 26 | ||||
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/traits/builder.rs | 12 |
10 files changed, 30 insertions, 33 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/symbol_export.rs b/compiler/rustc_codegen_ssa/src/back/symbol_export.rs index 6abe4fa1c38..b7ad09b055a 100644 --- a/compiler/rustc_codegen_ssa/src/back/symbol_export.rs +++ b/compiler/rustc_codegen_ssa/src/back/symbol_export.rs @@ -352,7 +352,7 @@ fn exported_symbols_provider_local( } MonoItem::Fn(Instance { def: InstanceKind::DropGlue(def_id, Some(ty)), args }) => { // A little sanity-check - debug_assert_eq!( + assert_eq!( args.non_erasable_generics(tcx, def_id).next(), Some(GenericArgKind::Type(ty)) ); @@ -370,7 +370,7 @@ fn exported_symbols_provider_local( args, }) => { // A little sanity-check - debug_assert_eq!( + assert_eq!( args.non_erasable_generics(tcx, def_id).next(), Some(GenericArgKind::Type(ty)) ); @@ -462,7 +462,7 @@ fn upstream_monomorphizations_for_provider( tcx: TyCtxt<'_>, def_id: DefId, ) -> Option<&UnordMap<GenericArgsRef<'_>, CrateNum>> { - debug_assert!(!def_id.is_local()); + assert!(!def_id.is_local()); tcx.upstream_monomorphizations(()).get(&def_id) } diff --git a/compiler/rustc_codegen_ssa/src/back/write.rs b/compiler/rustc_codegen_ssa/src/back/write.rs index 0e48eee3dd5..56e94529bc1 100644 --- a/compiler/rustc_codegen_ssa/src/back/write.rs +++ b/compiler/rustc_codegen_ssa/src/back/write.rs @@ -1512,7 +1512,7 @@ fn start_executing_work<B: ExtraBackendMethods>( // We reduce the `running` counter by one. The // `tokens.truncate()` below will take care of // giving the Token back. - debug_assert!(running_with_own_token > 0); + assert!(running_with_own_token > 0); running_with_own_token -= 1; main_thread_state = MainThreadState::Lending; } diff --git a/compiler/rustc_codegen_ssa/src/common.rs b/compiler/rustc_codegen_ssa/src/common.rs index 27b0f127e92..ea2fd482e1f 100644 --- a/compiler/rustc_codegen_ssa/src/common.rs +++ b/compiler/rustc_codegen_ssa/src/common.rs @@ -91,7 +91,6 @@ pub enum TypeKind { Pointer, Vector, Metadata, - X86_MMX, Token, ScalableVector, BFloat, diff --git a/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs b/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs index c4e5c858240..6a6d47fcbba 100644 --- a/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs +++ b/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs @@ -459,7 +459,7 @@ fn push_debuginfo_type_name<'tcx>( output: &mut String, visited: &mut FxHashSet<Ty<'tcx>>, ) { - debug_assert!(!wants_c_like_enum_debuginfo(ty_and_layout)); + assert!(!wants_c_like_enum_debuginfo(ty_and_layout)); output.push_str("enum2$<"); push_inner(output, visited); push_close_angle_bracket(true, output); @@ -660,7 +660,7 @@ fn push_generic_params_internal<'tcx>( output: &mut String, visited: &mut FxHashSet<Ty<'tcx>>, ) -> bool { - debug_assert_eq!(args, tcx.normalize_erasing_regions(ty::ParamEnv::reveal_all(), args)); + assert_eq!(args, tcx.normalize_erasing_regions(ty::ParamEnv::reveal_all(), args)); let mut args = args.non_erasable_generics(tcx, def_id).peekable(); if args.peek().is_none() { return false; diff --git a/compiler/rustc_codegen_ssa/src/mir/block.rs b/compiler/rustc_codegen_ssa/src/mir/block.rs index c9c8f02c491..9cb8b719b12 100644 --- a/compiler/rustc_codegen_ssa/src/mir/block.rs +++ b/compiler/rustc_codegen_ssa/src/mir/block.rs @@ -84,7 +84,7 @@ impl<'a, 'tcx> TerminatorCodegenHelper<'tcx> { } if is_cleanupret { // Cross-funclet jump - need a trampoline - debug_assert!(base::wants_new_eh_instructions(fx.cx.tcx().sess)); + assert!(base::wants_new_eh_instructions(fx.cx.tcx().sess)); debug!("llbb_with_cleanup: creating cleanup trampoline for {:?}", target); let name = &format!("{:?}_cleanup_trampoline_{:?}", self.bb, target); let trampoline_llbb = Bx::append_block(fx.cx, fx.llfn, name); diff --git a/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs b/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs index 6b89636b654..82ed5610d9e 100644 --- a/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs +++ b/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs @@ -194,7 +194,7 @@ fn calculate_debuginfo_offset< } _ => { // Sanity check for `can_use_in_debuginfo`. - debug_assert!(!elem.can_use_in_debuginfo()); + assert!(!elem.can_use_in_debuginfo()); bug!("unsupported var debuginfo projection `{:?}`", projection) } } @@ -502,7 +502,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { let DebugInfoOffset { direct_offset, indirect_offsets, result: fragment_layout } = calculate_debuginfo_offset(bx, &fragment.projection, var_layout); - debug_assert!(indirect_offsets.is_empty()); + assert!(indirect_offsets.is_empty()); if fragment_layout.size == Size::ZERO { // Fragment is a ZST, so does not represent anything. Avoid generating anything diff --git a/compiler/rustc_codegen_ssa/src/mir/operand.rs b/compiler/rustc_codegen_ssa/src/mir/operand.rs index cc0e9139650..e08d7a3e826 100644 --- a/compiler/rustc_codegen_ssa/src/mir/operand.rs +++ b/compiler/rustc_codegen_ssa/src/mir/operand.rs @@ -565,7 +565,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { for elem in place_ref.projection.iter() { match elem { mir::ProjectionElem::Field(ref f, _) => { - debug_assert!( + assert!( !o.layout.ty.is_any_ptr(), "Bad PlaceRef: destructing pointers should use cast/PtrMetadata, \ but tried to access field {f:?} of pointer {o:?}", diff --git a/compiler/rustc_codegen_ssa/src/mir/place.rs b/compiler/rustc_codegen_ssa/src/mir/place.rs index 97d5bb83128..4394ffb7a1c 100644 --- a/compiler/rustc_codegen_ssa/src/mir/place.rs +++ b/compiler/rustc_codegen_ssa/src/mir/place.rs @@ -55,7 +55,7 @@ impl<V: CodegenObject> PlaceValue<V> { /// Creates a `PlaceRef` to this location with the given type. pub fn with_type<'tcx>(self, layout: TyAndLayout<'tcx>) -> PlaceRef<'tcx, V> { - debug_assert!( + assert!( layout.is_unsized() || layout.abi.is_uninhabited() || self.llextra.is_none(), "Had pointer metadata {:?} for sized type {layout:?}", self.llextra, @@ -488,7 +488,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { cg_base = match *elem { mir::ProjectionElem::Deref => bx.load_operand(cg_base).deref(bx.cx()), mir::ProjectionElem::Field(ref field, _) => { - debug_assert!( + assert!( !cg_base.layout.ty.is_any_ptr(), "Bad PlaceRef: destructing pointers should use cast/PtrMetadata, \ but tried to access field {field:?} of pointer {cg_base:?}", diff --git a/compiler/rustc_codegen_ssa/src/mir/rvalue.rs b/compiler/rustc_codegen_ssa/src/mir/rvalue.rs index f9e928a84a7..0cd3e60b0cc 100644 --- a/compiler/rustc_codegen_ssa/src/mir/rvalue.rs +++ b/compiler/rustc_codegen_ssa/src/mir/rvalue.rs @@ -168,8 +168,8 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { dst: PlaceRef<'tcx, Bx::Value>, ) { // The MIR validator enforces no unsized transmutes. - debug_assert!(src.layout.is_sized()); - debug_assert!(dst.layout.is_sized()); + assert!(src.layout.is_sized()); + assert!(dst.layout.is_sized()); if let Some(val) = self.codegen_transmute_operand(bx, src, dst.layout) { val.store(bx, dst); @@ -223,8 +223,8 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { match operand.val { OperandValue::Ref(source_place_val) => { - debug_assert_eq!(source_place_val.llextra, None); - debug_assert!(matches!(operand_kind, OperandValueKind::Ref)); + assert_eq!(source_place_val.llextra, None); + assert!(matches!(operand_kind, OperandValueKind::Ref)); Some(bx.load_operand(source_place_val.with_type(cast)).val) } OperandValue::ZeroSized => { @@ -295,7 +295,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { to_scalar: abi::Scalar, to_backend_ty: Bx::Type, ) -> Bx::Value { - debug_assert_eq!(from_scalar.size(self.cx), to_scalar.size(self.cx)); + assert_eq!(from_scalar.size(self.cx), to_scalar.size(self.cx)); use abi::Primitive::*; imm = bx.from_immediate(imm); @@ -639,9 +639,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { (OperandValue::Immediate(llval), operand.layout) } mir::UnOp::PtrMetadata => { - debug_assert!( - operand.layout.ty.is_unsafe_ptr() || operand.layout.ty.is_ref(), - ); + assert!(operand.layout.ty.is_unsafe_ptr() || operand.layout.ty.is_ref(),); let (_, meta) = operand.val.pointer_parts(); assert_eq!(operand.layout.fields.count() > 1, meta.is_some()); if let Some(meta) = meta { @@ -651,7 +649,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { } } }; - debug_assert!( + assert!( val.is_expected_variant_for_type(self.cx, layout), "Made wrong variant {val:?} for type {layout:?}", ); @@ -742,7 +740,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { bug!("Field {field_idx:?} is {p:?} making {layout:?}"); }); let scalars = self.value_kind(op.layout).scalars().unwrap(); - debug_assert_eq!(values.len(), scalars.len()); + assert_eq!(values.len(), scalars.len()); inputs.extend(values); input_scalars.extend(scalars); } @@ -760,7 +758,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { ); let val = OperandValue::from_immediates(inputs); - debug_assert!( + assert!( val.is_expected_variant_for_type(self.cx, layout), "Made wrong variant {val:?} for type {layout:?}", ); @@ -805,7 +803,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { let val = cg_place.val.address(); let ty = cg_place.layout.ty; - debug_assert!( + assert!( if bx.cx().type_has_metadata(ty) { matches!(val, OperandValue::Pair(..)) } else { @@ -927,7 +925,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { } mir::BinOp::Cmp => { use std::cmp::Ordering; - debug_assert!(!is_float); + assert!(!is_float); let pred = |op| base::bin_op_to_icmp_predicate(op, is_signed); if bx.cx().tcx().sess.opts.optimize == OptLevel::No { // FIXME: This actually generates tighter assembly, and is a classic trick @@ -1111,7 +1109,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { if layout.is_zst() { OperandValueKind::ZeroSized } else if self.cx.is_backend_immediate(layout) { - debug_assert!(!self.cx.is_backend_scalar_pair(layout)); + assert!(!self.cx.is_backend_scalar_pair(layout)); OperandValueKind::Immediate(match layout.abi { abi::Abi::Scalar(s) => s, abi::Abi::Vector { element, .. } => element, diff --git a/compiler/rustc_codegen_ssa/src/traits/builder.rs b/compiler/rustc_codegen_ssa/src/traits/builder.rs index 2f0daefa46a..42980d9ebd2 100644 --- a/compiler/rustc_codegen_ssa/src/traits/builder.rs +++ b/compiler/rustc_codegen_ssa/src/traits/builder.rs @@ -165,7 +165,7 @@ pub trait BuilderMethods<'a, 'tcx>: size: Size, ) -> Self::Value; fn load_from_place(&mut self, ty: Self::Type, place: PlaceValue<Self::Value>) -> Self::Value { - debug_assert_eq!(place.llextra, None); + assert_eq!(place.llextra, None); self.load(ty, place.llval, place.align) } fn load_operand(&mut self, place: PlaceRef<'tcx, Self::Value>) @@ -184,7 +184,7 @@ pub trait BuilderMethods<'a, 'tcx>: fn store(&mut self, val: Self::Value, ptr: Self::Value, align: Align) -> Self::Value; fn store_to_place(&mut self, val: Self::Value, place: PlaceValue<Self::Value>) -> Self::Value { - debug_assert_eq!(place.llextra, None); + assert_eq!(place.llextra, None); self.store(val, place.llval, place.align) } fn store_with_flags( @@ -200,7 +200,7 @@ pub trait BuilderMethods<'a, 'tcx>: place: PlaceValue<Self::Value>, flags: MemFlags, ) -> Self::Value { - debug_assert_eq!(place.llextra, None); + assert_eq!(place.llextra, None); self.store_with_flags(val, place.llval, place.align, flags) } fn atomic_store( @@ -320,9 +320,9 @@ pub trait BuilderMethods<'a, 'tcx>: layout: TyAndLayout<'tcx>, flags: MemFlags, ) { - debug_assert!(layout.is_sized(), "cannot typed-copy an unsigned type"); - debug_assert!(src.llextra.is_none(), "cannot directly copy from unsized values"); - debug_assert!(dst.llextra.is_none(), "cannot directly copy into unsized values"); + assert!(layout.is_sized(), "cannot typed-copy an unsigned type"); + assert!(src.llextra.is_none(), "cannot directly copy from unsized values"); + assert!(dst.llextra.is_none(), "cannot directly copy into unsized values"); if flags.contains(MemFlags::NONTEMPORAL) { // HACK(nox): This is inefficient but there is no nontemporal memcpy. let ty = self.backend_type(layout); |
