Reformat use
declarations.
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
This commit is contained in:
parent
118f9350c5
commit
84ac80f192
1865 changed files with 8367 additions and 9199 deletions
|
@ -1,5 +1,8 @@
|
|||
//! The `Visitor` responsible for actually checking a `mir::Body` for invalid operations.
|
||||
|
||||
use std::mem;
|
||||
use std::ops::Deref;
|
||||
|
||||
use rustc_errors::{Diag, ErrorGuaranteed};
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::{self as hir, LangItem};
|
||||
|
@ -9,17 +12,13 @@ use rustc_infer::traits::ObligationCause;
|
|||
use rustc_middle::mir::visit::{MutatingUseContext, NonMutatingUseContext, PlaceContext, Visitor};
|
||||
use rustc_middle::mir::*;
|
||||
use rustc_middle::span_bug;
|
||||
use rustc_middle::ty::{self, adjustment::PointerCoercion, Ty, TyCtxt};
|
||||
use rustc_middle::ty::{Instance, InstanceKind, TypeVisitableExt};
|
||||
use rustc_middle::ty::adjustment::PointerCoercion;
|
||||
use rustc_middle::ty::{self, Instance, InstanceKind, Ty, TyCtxt, TypeVisitableExt};
|
||||
use rustc_mir_dataflow::Analysis;
|
||||
use rustc_span::{sym, Span, Symbol, DUMMY_SP};
|
||||
use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
|
||||
use rustc_trait_selection::traits::{self, ObligationCauseCode, ObligationCtxt};
|
||||
use rustc_type_ir::visit::{TypeSuperVisitable, TypeVisitor};
|
||||
|
||||
use std::mem;
|
||||
use std::ops::Deref;
|
||||
|
||||
use tracing::{debug, instrument, trace};
|
||||
|
||||
use super::ops::{self, NonConstOp, Status};
|
||||
|
|
|
@ -4,14 +4,12 @@
|
|||
//! has interior mutability or needs to be dropped, as well as the visitor that emits errors when
|
||||
//! it finds operations that are invalid in a certain context.
|
||||
|
||||
use rustc_attr as attr;
|
||||
use rustc_errors::DiagCtxtHandle;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::mir;
|
||||
use rustc_middle::ty::{self, PolyFnSig, TyCtxt};
|
||||
use rustc_middle::{bug, mir};
|
||||
use rustc_span::Symbol;
|
||||
use {rustc_attr as attr, rustc_hir as hir};
|
||||
|
||||
pub use self::qualifs::Qualif;
|
||||
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
|
||||
use hir::def_id::LocalDefId;
|
||||
use hir::{ConstContext, LangItem};
|
||||
use rustc_errors::{codes::*, Diag};
|
||||
use rustc_errors::codes::*;
|
||||
use rustc_errors::Diag;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_infer::infer::TyCtxtInferExt;
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
use rustc_middle::mir::visit::Visitor;
|
||||
use rustc_middle::mir::{self, BasicBlock, Location};
|
||||
use rustc_middle::ty::{Ty, TyCtxt};
|
||||
use rustc_span::{symbol::sym, Span};
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_span::Span;
|
||||
use tracing::trace;
|
||||
|
||||
use super::check::Qualifs;
|
||||
|
|
|
@ -5,11 +5,10 @@
|
|||
use rustc_errors::ErrorGuaranteed;
|
||||
use rustc_hir::LangItem;
|
||||
use rustc_infer::infer::TyCtxtInferExt;
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::mir;
|
||||
use rustc_middle::mir::*;
|
||||
use rustc_middle::traits::BuiltinImplSource;
|
||||
use rustc_middle::ty::{self, AdtDef, GenericArgsRef, Ty};
|
||||
use rustc_middle::{bug, mir};
|
||||
use rustc_trait_selection::traits::{
|
||||
ImplSource, Obligation, ObligationCause, ObligationCtxt, SelectionContext,
|
||||
};
|
||||
|
|
|
@ -2,17 +2,16 @@
|
|||
//!
|
||||
//! This contains the dataflow analysis used to track `Qualif`s on complex control-flow graphs.
|
||||
|
||||
use std::fmt;
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use rustc_index::bit_set::BitSet;
|
||||
use rustc_middle::mir::visit::Visitor;
|
||||
use rustc_middle::mir::{
|
||||
self, BasicBlock, CallReturnPlaces, Local, Location, Statement, StatementKind, TerminatorEdges,
|
||||
};
|
||||
use rustc_mir_dataflow::fmt::DebugWithContext;
|
||||
use rustc_mir_dataflow::JoinSemiLattice;
|
||||
use rustc_mir_dataflow::{Analysis, AnalysisDomain};
|
||||
|
||||
use std::fmt;
|
||||
use std::marker::PhantomData;
|
||||
use rustc_mir_dataflow::{Analysis, AnalysisDomain, JoinSemiLattice};
|
||||
|
||||
use super::{qualifs, ConstCx, Qualif};
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
use crate::interpret::{
|
||||
self, throw_machine_stop, HasStaticRootDefId, ImmTy, Immediate, InterpCx, PointerArithmetic,
|
||||
};
|
||||
use rustc_middle::mir::interpret::{AllocId, ConstAllocation, InterpResult};
|
||||
use rustc_middle::mir::*;
|
||||
use rustc_middle::query::TyCtxtAt;
|
||||
use rustc_middle::ty;
|
||||
use rustc_middle::ty::layout::TyAndLayout;
|
||||
use rustc_middle::{bug, span_bug};
|
||||
use rustc_middle::{bug, span_bug, ty};
|
||||
use rustc_span::def_id::DefId;
|
||||
|
||||
use crate::interpret::{
|
||||
self, throw_machine_stop, HasStaticRootDefId, ImmTy, Immediate, InterpCx, PointerArithmetic,
|
||||
};
|
||||
|
||||
/// Macro for machine-specific `InterpError` without allocation.
|
||||
/// (These will never be shown to the user, but they help diagnose ICEs.)
|
||||
pub macro throw_machine_stop_str($($tt:tt)*) {{
|
||||
|
|
|
@ -4,14 +4,15 @@ use rustc_errors::{DiagArgName, DiagArgValue, DiagMessage, Diagnostic, IntoDiagA
|
|||
use rustc_middle::mir::interpret::{Provenance, ReportedErrorInfo};
|
||||
use rustc_middle::mir::AssertKind;
|
||||
use rustc_middle::query::TyCtxtAt;
|
||||
use rustc_middle::ty::TyCtxt;
|
||||
use rustc_middle::ty::{layout::LayoutError, ConstInt};
|
||||
use rustc_middle::ty::layout::LayoutError;
|
||||
use rustc_middle::ty::{ConstInt, TyCtxt};
|
||||
use rustc_span::{Span, Symbol};
|
||||
|
||||
use super::CompileTimeMachine;
|
||||
use crate::errors::{self, FrameNote, ReportErrorExt};
|
||||
use crate::interpret::{err_inval, err_machine_stop};
|
||||
use crate::interpret::{ErrorHandled, Frame, InterpError, InterpErrorInfo, MachineStopType};
|
||||
use crate::interpret::{
|
||||
err_inval, err_machine_stop, ErrorHandled, Frame, InterpError, InterpErrorInfo, MachineStopType,
|
||||
};
|
||||
|
||||
/// The CTFE machine has some custom error kinds.
|
||||
#[derive(Clone, Debug)]
|
||||
|
@ -25,8 +26,9 @@ pub enum ConstEvalErrKind {
|
|||
|
||||
impl MachineStopType for ConstEvalErrKind {
|
||||
fn diagnostic_message(&self) -> DiagMessage {
|
||||
use crate::fluent_generated::*;
|
||||
use ConstEvalErrKind::*;
|
||||
|
||||
use crate::fluent_generated::*;
|
||||
match self {
|
||||
ConstAccessesMutGlobal => const_eval_const_accesses_mut_global,
|
||||
ModifiedGlobal => const_eval_modified_global,
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
use std::sync::atomic::Ordering::Relaxed;
|
||||
|
||||
use either::{Left, Right};
|
||||
use tracing::{debug, instrument, trace};
|
||||
|
||||
use rustc_hir::def::DefKind;
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::mir::interpret::{AllocId, ErrorHandled, InterpErrorInfo};
|
||||
|
@ -16,17 +14,16 @@ use rustc_session::lint;
|
|||
use rustc_span::def_id::LocalDefId;
|
||||
use rustc_span::{Span, DUMMY_SP};
|
||||
use rustc_target::abi::{self, Abi};
|
||||
use tracing::{debug, instrument, trace};
|
||||
|
||||
use super::{CanAccessMutGlobal, CompileTimeInterpCx, CompileTimeMachine};
|
||||
use crate::const_eval::CheckAlignment;
|
||||
use crate::errors::ConstEvalError;
|
||||
use crate::errors::{self, DanglingPtrInFinal};
|
||||
use crate::errors::{self, ConstEvalError, DanglingPtrInFinal};
|
||||
use crate::interpret::{
|
||||
create_static_alloc, intern_const_alloc_recursive, CtfeValidationMode, GlobalId, Immediate,
|
||||
InternKind, InterpCx, InterpError, InterpResult, MPlaceTy, MemoryKind, OpTy, RefTracking,
|
||||
StackPopCleanup,
|
||||
create_static_alloc, eval_nullary_intrinsic, intern_const_alloc_recursive, throw_exhaust,
|
||||
CtfeValidationMode, GlobalId, Immediate, InternKind, InternResult, InterpCx, InterpError,
|
||||
InterpResult, MPlaceTy, MemoryKind, OpTy, RefTracking, StackPopCleanup,
|
||||
};
|
||||
use crate::interpret::{eval_nullary_intrinsic, throw_exhaust, InternResult};
|
||||
use crate::CTRL_C_RECEIVED;
|
||||
|
||||
// Returns a pointer to where the result lives
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
use rustc_attr as attr;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::DefKind;
|
||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
use rustc_middle::query::Providers;
|
||||
use rustc_middle::ty::TyCtxt;
|
||||
use rustc_span::symbol::Symbol;
|
||||
use {rustc_attr as attr, rustc_hir as hir};
|
||||
|
||||
/// Whether the `def_id` is an unstable const fn and what feature gate(s) are necessary to enable
|
||||
/// it.
|
||||
|
|
|
@ -4,18 +4,14 @@ use std::hash::Hash;
|
|||
use std::ops::ControlFlow;
|
||||
|
||||
use rustc_ast::Mutability;
|
||||
use rustc_data_structures::fx::FxIndexMap;
|
||||
use rustc_data_structures::fx::IndexEntry;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::def_id::LocalDefId;
|
||||
use rustc_hir::LangItem;
|
||||
use rustc_hir::{self as hir, CRATE_HIR_ID};
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::mir;
|
||||
use rustc_data_structures::fx::{FxIndexMap, IndexEntry};
|
||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
use rustc_hir::{self as hir, LangItem, CRATE_HIR_ID};
|
||||
use rustc_middle::mir::AssertMessage;
|
||||
use rustc_middle::query::TyCtxtAt;
|
||||
use rustc_middle::ty::layout::{FnAbiOf, TyAndLayout};
|
||||
use rustc_middle::ty::{self, TyCtxt};
|
||||
use rustc_middle::{bug, mir};
|
||||
use rustc_session::lint::builtin::WRITES_THROUGH_IMMUTABLE_POINTER;
|
||||
use rustc_span::symbol::{sym, Symbol};
|
||||
use rustc_span::Span;
|
||||
|
@ -23,6 +19,7 @@ use rustc_target::abi::{Align, Size};
|
|||
use rustc_target::spec::abi::Abi as CallAbi;
|
||||
use tracing::debug;
|
||||
|
||||
use super::error::*;
|
||||
use crate::errors::{LongRunning, LongRunningWarn};
|
||||
use crate::fluent_generated as fluent;
|
||||
use crate::interpret::{
|
||||
|
@ -31,8 +28,6 @@ use crate::interpret::{
|
|||
GlobalAlloc, ImmTy, InterpCx, InterpResult, MPlaceTy, OpTy, Pointer, PointerArithmetic, Scalar,
|
||||
};
|
||||
|
||||
use super::error::*;
|
||||
|
||||
/// When hitting this many interpreted terminators we emit a deny by default lint
|
||||
/// that notfies the user that their constant takes a long time to evaluate. If that's
|
||||
/// what they intended, they can just allow the lint.
|
||||
|
@ -201,7 +196,8 @@ impl<'tcx> CompileTimeInterpCx<'tcx> {
|
|||
let topmost = span.ctxt().outer_expn().expansion_cause().unwrap_or(span);
|
||||
let caller = self.tcx.sess.source_map().lookup_char_pos(topmost.lo());
|
||||
|
||||
use rustc_session::{config::RemapPathScopeComponents, RemapFileNameExt};
|
||||
use rustc_session::config::RemapPathScopeComponents;
|
||||
use rustc_session::RemapFileNameExt;
|
||||
(
|
||||
Symbol::intern(
|
||||
&caller
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
// Not in interpret to make sure we do not use private implementation details
|
||||
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::mir;
|
||||
use rustc_middle::mir::interpret::InterpErrorInfo;
|
||||
use rustc_middle::query::{Key, TyCtxtAt};
|
||||
use rustc_middle::ty::{self, Ty, TyCtxt};
|
||||
use rustc_middle::{bug, mir};
|
||||
use rustc_target::abi::VariantIdx;
|
||||
use tracing::instrument;
|
||||
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
use rustc_data_structures::stack::ensure_sufficient_stack;
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::mir;
|
||||
use rustc_middle::mir::interpret::{EvalToValTreeResult, GlobalId};
|
||||
use rustc_middle::ty::layout::{LayoutCx, LayoutOf, TyAndLayout};
|
||||
use rustc_middle::ty::{self, ScalarInt, Ty, TyCtxt};
|
||||
use rustc_middle::{bug, mir};
|
||||
use rustc_span::DUMMY_SP;
|
||||
use rustc_target::abi::{Abi, VariantIdx};
|
||||
use tracing::{debug, instrument, trace};
|
||||
|
@ -13,10 +12,9 @@ use super::machine::CompileTimeInterpCx;
|
|||
use super::{ValTreeCreationError, ValTreeCreationResult, VALTREE_MAX_NODES};
|
||||
use crate::const_eval::CanAccessMutGlobal;
|
||||
use crate::errors::MaxNumNodesInConstErr;
|
||||
use crate::interpret::MPlaceTy;
|
||||
use crate::interpret::{
|
||||
intern_const_alloc_recursive, ImmTy, Immediate, InternKind, MemPlaceMeta, MemoryKind, PlaceTy,
|
||||
Projectable, Scalar,
|
||||
intern_const_alloc_recursive, ImmTy, Immediate, InternKind, MPlaceTy, MemPlaceMeta, MemoryKind,
|
||||
PlaceTy, Projectable, Scalar,
|
||||
};
|
||||
|
||||
#[instrument(skip(ecx), level = "debug")]
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
use std::borrow::Cow;
|
||||
|
||||
use either::Either;
|
||||
use rustc_errors::codes::*;
|
||||
use rustc_errors::{
|
||||
codes::*, Diag, DiagArgValue, DiagCtxtHandle, DiagMessage, Diagnostic, EmissionGuarantee, Level,
|
||||
Diag, DiagArgValue, DiagCtxtHandle, DiagMessage, Diagnostic, EmissionGuarantee, Level,
|
||||
};
|
||||
use rustc_hir::ConstContext;
|
||||
use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
|
||||
|
@ -468,8 +469,9 @@ fn bad_pointer_message(msg: CheckInAllocMsg, dcx: DiagCtxtHandle<'_>) -> String
|
|||
|
||||
impl<'a> ReportErrorExt for UndefinedBehaviorInfo<'a> {
|
||||
fn diagnostic_message(&self) -> DiagMessage {
|
||||
use crate::fluent_generated::*;
|
||||
use UndefinedBehaviorInfo::*;
|
||||
|
||||
use crate::fluent_generated::*;
|
||||
match self {
|
||||
Ub(msg) => msg.clone().into(),
|
||||
Custom(x) => (x.msg)(),
|
||||
|
@ -630,8 +632,9 @@ impl<'a> ReportErrorExt for UndefinedBehaviorInfo<'a> {
|
|||
|
||||
impl<'tcx> ReportErrorExt for ValidationErrorInfo<'tcx> {
|
||||
fn diagnostic_message(&self) -> DiagMessage {
|
||||
use crate::fluent_generated::*;
|
||||
use rustc_middle::mir::interpret::ValidationErrorKind::*;
|
||||
|
||||
use crate::fluent_generated::*;
|
||||
match self.kind {
|
||||
PtrToUninhabited { ptr_kind: PointerKind::Box, .. } => {
|
||||
const_eval_validation_box_to_uninhabited
|
||||
|
@ -702,9 +705,10 @@ impl<'tcx> ReportErrorExt for ValidationErrorInfo<'tcx> {
|
|||
}
|
||||
|
||||
fn add_args<G: EmissionGuarantee>(self, err: &mut Diag<'_, G>) {
|
||||
use crate::fluent_generated as fluent;
|
||||
use rustc_middle::mir::interpret::ValidationErrorKind::*;
|
||||
|
||||
use crate::fluent_generated as fluent;
|
||||
|
||||
if let PointerAsInt { .. } | PartialPointer = self.kind {
|
||||
err.help(fluent::const_eval_ptr_as_bytes_1);
|
||||
err.help(fluent::const_eval_ptr_as_bytes_2);
|
||||
|
@ -835,9 +839,9 @@ impl ReportErrorExt for UnsupportedOpInfo {
|
|||
}
|
||||
}
|
||||
fn add_args<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
|
||||
use crate::fluent_generated::*;
|
||||
|
||||
use UnsupportedOpInfo::*;
|
||||
|
||||
use crate::fluent_generated::*;
|
||||
if let ReadPointerAsInt(_) | OverwritePartialPointer(_) | ReadPartialPointer(_) = self {
|
||||
diag.help(const_eval_ptr_as_bytes_1);
|
||||
diag.help(const_eval_ptr_as_bytes_2);
|
||||
|
|
|
@ -12,11 +12,10 @@ use rustc_target::abi::Integer;
|
|||
use rustc_type_ir::TyKind::*;
|
||||
use tracing::trace;
|
||||
|
||||
use super::util::ensure_monomorphic_enough;
|
||||
use super::{
|
||||
err_inval, throw_ub, throw_ub_custom, util::ensure_monomorphic_enough, FnVal, ImmTy, Immediate,
|
||||
InterpCx, Machine, OpTy, PlaceTy,
|
||||
err_inval, throw_ub, throw_ub_custom, FnVal, ImmTy, Immediate, InterpCx, Machine, OpTy, PlaceTy,
|
||||
};
|
||||
|
||||
use crate::fluent_generated as fluent;
|
||||
|
||||
impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
//! Functions for reading and writing discriminants of multi-variant layouts (enums and coroutines).
|
||||
|
||||
use rustc_middle::mir;
|
||||
use rustc_middle::span_bug;
|
||||
use rustc_middle::ty::layout::{LayoutOf, PrimitiveExt};
|
||||
use rustc_middle::ty::{self, CoroutineArgsExt, ScalarInt, Ty};
|
||||
use rustc_target::abi::{self, TagEncoding};
|
||||
use rustc_target::abi::{VariantIdx, Variants};
|
||||
use rustc_middle::{mir, span_bug};
|
||||
use rustc_target::abi::{self, TagEncoding, VariantIdx, Variants};
|
||||
use tracing::{instrument, trace};
|
||||
|
||||
use super::{
|
||||
|
|
|
@ -2,16 +2,14 @@ use std::cell::Cell;
|
|||
use std::{fmt, mem};
|
||||
|
||||
use either::{Either, Left, Right};
|
||||
use rustc_infer::infer::at::ToTrace;
|
||||
use rustc_infer::traits::ObligationCause;
|
||||
use rustc_trait_selection::traits::ObligationCtxt;
|
||||
use tracing::{debug, info, info_span, instrument, trace};
|
||||
|
||||
use rustc_errors::DiagCtxtHandle;
|
||||
use rustc_hir::{self as hir, def_id::DefId, definitions::DefPathData};
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::definitions::DefPathData;
|
||||
use rustc_hir::{self as hir};
|
||||
use rustc_index::IndexVec;
|
||||
use rustc_infer::infer::at::ToTrace;
|
||||
use rustc_infer::infer::TyCtxtInferExt;
|
||||
use rustc_middle::mir;
|
||||
use rustc_infer::traits::ObligationCause;
|
||||
use rustc_middle::mir::interpret::{
|
||||
CtfeProvenance, ErrorHandled, InvalidMetaKind, ReportedErrorInfo,
|
||||
};
|
||||
|
@ -21,11 +19,14 @@ use rustc_middle::ty::layout::{
|
|||
TyAndLayout,
|
||||
};
|
||||
use rustc_middle::ty::{self, GenericArgsRef, ParamEnv, Ty, TyCtxt, TypeFoldable, Variance};
|
||||
use rustc_middle::{bug, span_bug};
|
||||
use rustc_middle::{bug, mir, span_bug};
|
||||
use rustc_mir_dataflow::storage::always_storage_live_locals;
|
||||
use rustc_session::Limit;
|
||||
use rustc_span::Span;
|
||||
use rustc_target::abi::{call::FnAbi, Align, HasDataLayout, Size, TargetDataLayout};
|
||||
use rustc_target::abi::call::FnAbi;
|
||||
use rustc_target::abi::{Align, HasDataLayout, Size, TargetDataLayout};
|
||||
use rustc_trait_selection::traits::ObligationCtxt;
|
||||
use tracing::{debug, info, info_span, instrument, trace};
|
||||
|
||||
use super::{
|
||||
err_inval, throw_inval, throw_ub, throw_ub_custom, throw_unsup, GlobalId, Immediate,
|
||||
|
@ -33,9 +34,7 @@ use super::{
|
|||
OpTy, Operand, Place, PlaceTy, Pointer, PointerArithmetic, Projectable, Provenance,
|
||||
ReturnAction, Scalar,
|
||||
};
|
||||
use crate::errors;
|
||||
use crate::util;
|
||||
use crate::{fluent_generated as fluent, ReportErrorExt};
|
||||
use crate::{errors, fluent_generated as fluent, util, ReportErrorExt};
|
||||
|
||||
pub struct InterpCx<'tcx, M: Machine<'tcx>> {
|
||||
/// Stores the `Machine` instance.
|
||||
|
|
|
@ -3,26 +3,21 @@
|
|||
//! and miri.
|
||||
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_middle::ty;
|
||||
use rustc_middle::ty::layout::{LayoutOf as _, ValidityRequirement};
|
||||
use rustc_middle::ty::GenericArgsRef;
|
||||
use rustc_middle::ty::{Ty, TyCtxt};
|
||||
use rustc_middle::{
|
||||
bug,
|
||||
mir::{self, BinOp, ConstValue, NonDivergingIntrinsic},
|
||||
ty::layout::TyAndLayout,
|
||||
};
|
||||
use rustc_middle::mir::{self, BinOp, ConstValue, NonDivergingIntrinsic};
|
||||
use rustc_middle::ty::layout::{LayoutOf as _, TyAndLayout, ValidityRequirement};
|
||||
use rustc_middle::ty::{GenericArgsRef, Ty, TyCtxt};
|
||||
use rustc_middle::{bug, ty};
|
||||
use rustc_span::symbol::{sym, Symbol};
|
||||
use rustc_target::abi::Size;
|
||||
use tracing::trace;
|
||||
|
||||
use super::memory::MemoryKind;
|
||||
use super::util::ensure_monomorphic_enough;
|
||||
use super::{
|
||||
err_inval, err_ub_custom, err_unsup_format, memory::MemoryKind, throw_inval, throw_ub_custom,
|
||||
throw_ub_format, util::ensure_monomorphic_enough, Allocation, CheckInAllocMsg, ConstAllocation,
|
||||
GlobalId, ImmTy, InterpCx, InterpResult, MPlaceTy, Machine, OpTy, Pointer, PointerArithmetic,
|
||||
Provenance, Scalar,
|
||||
err_inval, err_ub_custom, err_unsup_format, throw_inval, throw_ub_custom, throw_ub_format,
|
||||
Allocation, CheckInAllocMsg, ConstAllocation, GlobalId, ImmTy, InterpCx, InterpResult,
|
||||
MPlaceTy, Machine, OpTy, Pointer, PointerArithmetic, Provenance, Scalar,
|
||||
};
|
||||
|
||||
use crate::fluent_generated as fluent;
|
||||
|
||||
/// Directly returns an `Allocation` containing an absolute path representation of the given type.
|
||||
|
|
|
@ -8,10 +8,9 @@ use std::hash::Hash;
|
|||
|
||||
use rustc_apfloat::{Float, FloatConvert};
|
||||
use rustc_ast::{InlineAsmOptions, InlineAsmTemplatePiece};
|
||||
use rustc_middle::mir;
|
||||
use rustc_middle::query::TyCtxtAt;
|
||||
use rustc_middle::ty;
|
||||
use rustc_middle::ty::layout::TyAndLayout;
|
||||
use rustc_middle::{mir, ty};
|
||||
use rustc_span::def_id::DefId;
|
||||
use rustc_span::Span;
|
||||
use rustc_target::abi::{Align, Size};
|
||||
|
|
|
@ -10,8 +10,7 @@ use std::assert_matches::assert_matches;
|
|||
use std::borrow::Cow;
|
||||
use std::cell::Cell;
|
||||
use std::collections::VecDeque;
|
||||
use std::fmt;
|
||||
use std::ptr;
|
||||
use std::{fmt, ptr};
|
||||
|
||||
use rustc_ast::Mutability;
|
||||
use rustc_data_structures::fx::{FxHashSet, FxIndexMap};
|
||||
|
@ -20,17 +19,15 @@ use rustc_middle::bug;
|
|||
use rustc_middle::mir::display_allocation;
|
||||
use rustc_middle::ty::{self, Instance, ParamEnv, Ty, TyCtxt};
|
||||
use rustc_target::abi::{Align, HasDataLayout, Size};
|
||||
|
||||
use tracing::{debug, instrument, trace};
|
||||
|
||||
use crate::fluent_generated as fluent;
|
||||
|
||||
use super::{
|
||||
alloc_range, err_ub, err_ub_custom, throw_ub, throw_ub_custom, throw_unsup, throw_unsup_format,
|
||||
AllocBytes, AllocId, AllocMap, AllocRange, Allocation, CheckAlignMsg, CheckInAllocMsg,
|
||||
CtfeProvenance, GlobalAlloc, InterpCx, InterpResult, Machine, MayLeak, Misalignment, Pointer,
|
||||
PointerArithmetic, Provenance, Scalar,
|
||||
};
|
||||
use crate::fluent_generated as fluent;
|
||||
|
||||
#[derive(Debug, PartialEq, Copy, Clone)]
|
||||
pub enum MemoryKind<T> {
|
||||
|
|
|
@ -18,6 +18,7 @@ mod util;
|
|||
mod validity;
|
||||
mod visitor;
|
||||
|
||||
use eval_context::{from_known_layout, mir_assign_valid_types};
|
||||
#[doc(no_inline)]
|
||||
pub use rustc_middle::mir::interpret::*; // have all the `interpret` symbols in one place: here
|
||||
|
||||
|
@ -26,20 +27,15 @@ pub use self::intern::{
|
|||
intern_const_alloc_for_constprop, intern_const_alloc_recursive, HasStaticRootDefId, InternKind,
|
||||
InternResult,
|
||||
};
|
||||
pub(crate) use self::intrinsics::eval_nullary_intrinsic;
|
||||
pub use self::machine::{compile_time_machine, AllocMap, Machine, MayLeak, ReturnAction};
|
||||
pub use self::memory::{AllocKind, AllocRef, AllocRefMut, FnVal, Memory, MemoryKind};
|
||||
use self::operand::Operand;
|
||||
pub use self::operand::{ImmTy, Immediate, OpTy, Readable};
|
||||
pub use self::place::{MPlaceTy, MemPlaceMeta, PlaceTy, Writeable};
|
||||
use self::place::{MemPlace, Place};
|
||||
pub use self::projection::{OffsetMode, Projectable};
|
||||
pub use self::terminator::FnArg;
|
||||
pub(crate) use self::util::create_static_alloc;
|
||||
pub use self::validity::{CtfeValidationMode, RefTracking};
|
||||
pub use self::visitor::ValueVisitor;
|
||||
|
||||
use self::{
|
||||
operand::Operand,
|
||||
place::{MemPlace, Place},
|
||||
};
|
||||
|
||||
pub(crate) use self::intrinsics::eval_nullary_intrinsic;
|
||||
pub(crate) use self::util::create_static_alloc;
|
||||
use eval_context::{from_known_layout, mir_assign_valid_types};
|
||||
|
|
|
@ -4,16 +4,14 @@
|
|||
use std::assert_matches::assert_matches;
|
||||
|
||||
use either::{Either, Left, Right};
|
||||
use tracing::trace;
|
||||
|
||||
use rustc_hir::def::Namespace;
|
||||
use rustc_middle::mir::interpret::ScalarSizeMismatch;
|
||||
use rustc_middle::ty::layout::{HasParamEnv, HasTyCtxt, LayoutOf, TyAndLayout};
|
||||
use rustc_middle::ty::print::{FmtPrinter, PrettyPrinter};
|
||||
use rustc_middle::ty::{ConstInt, ScalarInt, Ty, TyCtxt};
|
||||
use rustc_middle::{bug, span_bug};
|
||||
use rustc_middle::{mir, ty};
|
||||
use rustc_middle::{bug, mir, span_bug, ty};
|
||||
use rustc_target::abi::{self, Abi, HasDataLayout, Size};
|
||||
use tracing::trace;
|
||||
|
||||
use super::{
|
||||
alloc_range, err_ub, from_known_layout, mir_assign_valid_types, throw_ub, CtfeProvenance,
|
||||
|
@ -835,8 +833,9 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
|
|||
// Some nodes are used a lot. Make sure they don't unintentionally get bigger.
|
||||
#[cfg(target_pointer_width = "64")]
|
||||
mod size_asserts {
|
||||
use super::*;
|
||||
use rustc_data_structures::static_assert_size;
|
||||
|
||||
use super::*;
|
||||
// tidy-alphabetical-start
|
||||
static_assert_size!(Immediate, 48);
|
||||
static_assert_size!(ImmTy<'_>, 64);
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
use either::Either;
|
||||
|
||||
use rustc_apfloat::{Float, FloatConvert};
|
||||
use rustc_middle::mir;
|
||||
use rustc_middle::mir::interpret::{InterpResult, Scalar};
|
||||
use rustc_middle::ty::layout::{LayoutOf, TyAndLayout};
|
||||
use rustc_middle::ty::{self, FloatTy, ScalarInt};
|
||||
use rustc_middle::{bug, span_bug};
|
||||
use rustc_middle::{bug, mir, span_bug};
|
||||
use rustc_span::symbol::sym;
|
||||
use tracing::trace;
|
||||
|
||||
|
|
|
@ -5,14 +5,12 @@
|
|||
use std::assert_matches::assert_matches;
|
||||
|
||||
use either::{Either, Left, Right};
|
||||
use tracing::{instrument, trace};
|
||||
|
||||
use rustc_ast::Mutability;
|
||||
use rustc_middle::mir;
|
||||
use rustc_middle::ty::layout::{LayoutOf, TyAndLayout};
|
||||
use rustc_middle::ty::Ty;
|
||||
use rustc_middle::{bug, span_bug};
|
||||
use rustc_middle::{bug, mir, span_bug};
|
||||
use rustc_target::abi::{Abi, Align, HasDataLayout, Size};
|
||||
use tracing::{instrument, trace};
|
||||
|
||||
use super::{
|
||||
alloc_range, mir_assign_valid_types, throw_ub, AllocRef, AllocRefMut, CheckAlignMsg,
|
||||
|
@ -1034,8 +1032,9 @@ where
|
|||
// Some nodes are used a lot. Make sure they don't unintentionally get bigger.
|
||||
#[cfg(target_pointer_width = "64")]
|
||||
mod size_asserts {
|
||||
use super::*;
|
||||
use rustc_data_structures::static_assert_size;
|
||||
|
||||
use super::*;
|
||||
// tidy-alphabetical-start
|
||||
static_assert_size!(MemPlace, 48);
|
||||
static_assert_size!(MemPlaceMeta, 24);
|
||||
|
|
|
@ -10,14 +10,10 @@
|
|||
use std::marker::PhantomData;
|
||||
use std::ops::Range;
|
||||
|
||||
use rustc_middle::mir;
|
||||
use rustc_middle::ty;
|
||||
use rustc_middle::ty::layout::{LayoutOf, TyAndLayout};
|
||||
use rustc_middle::ty::Ty;
|
||||
use rustc_middle::{bug, span_bug};
|
||||
use rustc_target::abi::Size;
|
||||
use rustc_target::abi::{self, VariantIdx};
|
||||
|
||||
use rustc_middle::{bug, mir, span_bug, ty};
|
||||
use rustc_target::abi::{self, Size, VariantIdx};
|
||||
use tracing::{debug, instrument};
|
||||
|
||||
use super::{
|
||||
|
|
|
@ -3,13 +3,11 @@
|
|||
//! The main entry point is the `step` method.
|
||||
|
||||
use either::Either;
|
||||
use tracing::{info, instrument, trace};
|
||||
|
||||
use rustc_index::IndexSlice;
|
||||
use rustc_middle::mir;
|
||||
use rustc_middle::ty::layout::LayoutOf;
|
||||
use rustc_middle::{bug, span_bug};
|
||||
use rustc_middle::{bug, mir, span_bug};
|
||||
use rustc_target::abi::{FieldIdx, FIRST_VARIANT};
|
||||
use tracing::{info, instrument, trace};
|
||||
|
||||
use super::{
|
||||
ImmTy, Immediate, InterpCx, InterpResult, Machine, MemPlaceMeta, PlaceTy, Projectable, Scalar,
|
||||
|
|
|
@ -1,33 +1,24 @@
|
|||
use std::borrow::Cow;
|
||||
|
||||
use either::Either;
|
||||
use tracing::trace;
|
||||
|
||||
use rustc_middle::{
|
||||
bug, mir, span_bug,
|
||||
ty::{
|
||||
self,
|
||||
layout::{FnAbiOf, IntegerExt, LayoutOf, TyAndLayout},
|
||||
AdtDef, Instance, Ty,
|
||||
},
|
||||
};
|
||||
use rustc_span::{source_map::Spanned, sym};
|
||||
use rustc_target::abi::{self, FieldIdx};
|
||||
use rustc_target::abi::{
|
||||
call::{ArgAbi, FnAbi, PassMode},
|
||||
Integer,
|
||||
};
|
||||
use rustc_middle::ty::layout::{FnAbiOf, IntegerExt, LayoutOf, TyAndLayout};
|
||||
use rustc_middle::ty::{self, AdtDef, Instance, Ty};
|
||||
use rustc_middle::{bug, mir, span_bug};
|
||||
use rustc_span::source_map::Spanned;
|
||||
use rustc_span::sym;
|
||||
use rustc_target::abi::call::{ArgAbi, FnAbi, PassMode};
|
||||
use rustc_target::abi::{self, FieldIdx, Integer};
|
||||
use rustc_target::spec::abi::Abi;
|
||||
use tracing::trace;
|
||||
|
||||
use super::{
|
||||
throw_ub, throw_ub_custom, throw_unsup_format, CtfeProvenance, FnVal, ImmTy, InterpCx,
|
||||
InterpResult, MPlaceTy, Machine, OpTy, PlaceTy, Projectable, Provenance, Scalar,
|
||||
StackPopCleanup,
|
||||
};
|
||||
use crate::{
|
||||
fluent_generated as fluent,
|
||||
interpret::{eval_context::StackPopInfo, ReturnAction},
|
||||
};
|
||||
use crate::fluent_generated as fluent;
|
||||
use crate::interpret::eval_context::StackPopInfo;
|
||||
use crate::interpret::ReturnAction;
|
||||
|
||||
/// An argment passed to a function.
|
||||
#[derive(Clone, Debug)]
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use crate::const_eval::{CompileTimeInterpCx, CompileTimeMachine, InterpretationResult};
|
||||
use std::ops::ControlFlow;
|
||||
|
||||
use rustc_hir::def_id::LocalDefId;
|
||||
use rustc_middle::mir;
|
||||
use rustc_middle::mir::interpret::{Allocation, InterpResult, Pointer};
|
||||
|
@ -6,10 +7,10 @@ use rustc_middle::ty::layout::TyAndLayout;
|
|||
use rustc_middle::ty::{
|
||||
self, Ty, TyCtxt, TypeSuperVisitable, TypeVisitable, TypeVisitableExt, TypeVisitor,
|
||||
};
|
||||
use std::ops::ControlFlow;
|
||||
use tracing::debug;
|
||||
|
||||
use super::{throw_inval, InterpCx, MPlaceTy, MemPlaceMeta, MemoryKind};
|
||||
use crate::const_eval::{CompileTimeInterpCx, CompileTimeMachine, InterpretationResult};
|
||||
|
||||
/// Checks whether a type contains generic parameters which must be instantiated.
|
||||
///
|
||||
|
|
|
@ -9,17 +9,15 @@ use std::hash::Hash;
|
|||
use std::num::NonZero;
|
||||
|
||||
use either::{Left, Right};
|
||||
use tracing::trace;
|
||||
|
||||
use hir::def::DefKind;
|
||||
use rustc_ast::Mutability;
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_hir as hir;
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::mir::interpret::ValidationErrorKind::{self, *};
|
||||
use rustc_middle::mir::interpret::{
|
||||
ExpectedKind, InterpError, InvalidMetaKind, Misalignment, PointerKind, Provenance,
|
||||
UnsupportedOpInfo, ValidationErrorInfo,
|
||||
ValidationErrorKind::{self, *},
|
||||
};
|
||||
use rustc_middle::ty::layout::{LayoutOf, TyAndLayout};
|
||||
use rustc_middle::ty::{self, Ty};
|
||||
|
@ -27,11 +25,13 @@ use rustc_span::symbol::{sym, Symbol};
|
|||
use rustc_target::abi::{
|
||||
Abi, FieldIdx, Scalar as ScalarAbi, Size, VariantIdx, Variants, WrappingRange,
|
||||
};
|
||||
use tracing::trace;
|
||||
|
||||
use super::machine::AllocMap;
|
||||
use super::{
|
||||
err_ub, format_interp_error, machine::AllocMap, throw_ub, AllocId, AllocKind, CheckInAllocMsg,
|
||||
GlobalAlloc, ImmTy, Immediate, InterpCx, InterpResult, MPlaceTy, Machine, MemPlaceMeta, OpTy,
|
||||
Pointer, Projectable, Scalar, ValueVisitor,
|
||||
err_ub, format_interp_error, throw_ub, AllocId, AllocKind, CheckInAllocMsg, GlobalAlloc, ImmTy,
|
||||
Immediate, InterpCx, InterpResult, MPlaceTy, Machine, MemPlaceMeta, OpTy, Pointer, Projectable,
|
||||
Scalar, ValueVisitor,
|
||||
};
|
||||
|
||||
// for the validation errors
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
//! Visitor for a run-time value with a given layout: Traverse enums, structs and other compound
|
||||
//! types until we arrive at the leaves, with custom handling for primitive types.
|
||||
|
||||
use std::num::NonZero;
|
||||
|
||||
use rustc_index::IndexVec;
|
||||
use rustc_middle::mir::interpret::InterpResult;
|
||||
use rustc_middle::ty::{self, Ty};
|
||||
use rustc_target::abi::FieldIdx;
|
||||
use rustc_target::abi::{FieldsShape, VariantIdx, Variants};
|
||||
use rustc_target::abi::{FieldIdx, FieldsShape, VariantIdx, Variants};
|
||||
use tracing::trace;
|
||||
|
||||
use std::num::NonZero;
|
||||
|
||||
use super::{throw_inval, InterpCx, MPlaceTy, Machine, Projectable};
|
||||
|
||||
/// How to traverse a value and what to do when we are at the leaves.
|
||||
|
|
|
@ -26,8 +26,8 @@ pub mod util;
|
|||
use std::sync::atomic::AtomicBool;
|
||||
|
||||
pub use errors::ReportErrorExt;
|
||||
|
||||
use rustc_middle::{ty, util::Providers};
|
||||
use rustc_middle::ty;
|
||||
use rustc_middle::util::Providers;
|
||||
|
||||
rustc_fluent_macro::fluent_messages! { "../messages.ftl" }
|
||||
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
use rustc_hir::LangItem;
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::mir;
|
||||
use rustc_middle::query::TyCtxtAt;
|
||||
use rustc_middle::ty::layout::LayoutOf;
|
||||
use rustc_middle::ty::{self, Mutability};
|
||||
use rustc_middle::{bug, mir};
|
||||
use rustc_span::symbol::Symbol;
|
||||
use tracing::trace;
|
||||
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
use std::fmt::Write;
|
||||
|
||||
use rustc_data_structures::intern::Interned;
|
||||
use rustc_hir::def_id::CrateNum;
|
||||
use rustc_hir::definitions::DisambiguatedDefPathData;
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::ty::{
|
||||
self,
|
||||
print::{PrettyPrinter, Print, PrintError, Printer},
|
||||
GenericArg, GenericArgKind, Ty, TyCtxt,
|
||||
};
|
||||
use std::fmt::Write;
|
||||
use rustc_middle::ty::print::{PrettyPrinter, Print, PrintError, Printer};
|
||||
use rustc_middle::ty::{self, GenericArg, GenericArgKind, Ty, TyCtxt};
|
||||
|
||||
struct AbsolutePathPrinter<'tcx> {
|
||||
tcx: TyCtxt<'tcx>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue