diff options
| author | Ralf Jung <post@ralfj.de> | 2024-05-21 12:17:34 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2024-05-21 14:50:09 +0200 |
| commit | c0b4b454c3804aa1ffe8b500de87943c1f4099f7 (patch) | |
| tree | 27cfc2f21fdab58586e641ce896fb8b004b95950 /compiler/rustc_middle/src/mir/interpret/error.rs | |
| parent | 9cb6bb859912fc5458d8977a937adede5050bc22 (diff) | |
| download | rust-c0b4b454c3804aa1ffe8b500de87943c1f4099f7.tar.gz rust-c0b4b454c3804aa1ffe8b500de87943c1f4099f7.zip | |
interpret: make overflowing binops just normal binops
Diffstat (limited to 'compiler/rustc_middle/src/mir/interpret/error.rs')
| -rw-r--r-- | compiler/rustc_middle/src/mir/interpret/error.rs | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/compiler/rustc_middle/src/mir/interpret/error.rs b/compiler/rustc_middle/src/mir/interpret/error.rs index 6e152cbcb65..ed0e7c836c2 100644 --- a/compiler/rustc_middle/src/mir/interpret/error.rs +++ b/compiler/rustc_middle/src/mir/interpret/error.rs @@ -1,19 +1,22 @@ -use super::{AllocId, AllocRange, ConstAllocation, Pointer, Scalar}; +use std::borrow::Cow; +use std::{any::Any, backtrace::Backtrace, fmt}; -use crate::error; -use crate::mir::{ConstAlloc, ConstValue}; -use crate::ty::{self, layout, tls, Ty, TyCtxt, ValTree}; +use either::Either; use rustc_ast_ir::Mutability; use rustc_data_structures::sync::Lock; use rustc_errors::{DiagArgName, DiagArgValue, DiagMessage, ErrorGuaranteed, IntoDiagArg}; use rustc_macros::{HashStable, TyDecodable, TyEncodable}; use rustc_session::CtfeBacktrace; +use rustc_span::Symbol; use rustc_span::{def_id::DefId, Span, DUMMY_SP}; use rustc_target::abi::{call, Align, Size, VariantIdx, WrappingRange}; -use std::borrow::Cow; -use std::{any::Any, backtrace::Backtrace, fmt}; +use super::{AllocId, AllocRange, ConstAllocation, Pointer, Scalar}; + +use crate::error; +use crate::mir::{ConstAlloc, ConstValue}; +use crate::ty::{self, layout, tls, Ty, TyCtxt, ValTree}; #[derive(Debug, Copy, Clone, PartialEq, Eq, HashStable, TyEncodable, TyDecodable)] pub enum ErrorHandled { @@ -310,6 +313,10 @@ pub enum UndefinedBehaviorInfo<'tcx> { RemainderOverflow, /// Overflowing inbounds pointer arithmetic. PointerArithOverflow, + /// Overflow in arithmetic that may not overflow. + ArithOverflow { intrinsic: Symbol }, + /// Shift by too much. + ShiftOverflow { intrinsic: Symbol, shift_amount: Either<u128, i128> }, /// Invalid metadata in a wide pointer InvalidMeta(InvalidMetaKind), /// Reading a C string that does not end within its allocation. |
