diff --git a/compiler/rustc_ast_lowering/src/index.rs b/compiler/rustc_ast_lowering/src/index.rs index 11aa6b250b129..793fe9cfd5e2e 100644 --- a/compiler/rustc_ast_lowering/src/index.rs +++ b/compiler/rustc_ast_lowering/src/index.rs @@ -55,6 +55,7 @@ pub(super) fn index_hir<'hir>( OwnerNode::TraitItem(item) => collector.visit_trait_item(item), OwnerNode::ImplItem(item) => collector.visit_impl_item(item), OwnerNode::ForeignItem(item) => collector.visit_foreign_item(item), + OwnerNode::AssocOpaqueTy(..) => unreachable!(), }; for (local_id, node) in collector.nodes.iter_enumerated() { diff --git a/compiler/rustc_const_eval/messages.ftl b/compiler/rustc_const_eval/messages.ftl index f3af633b4e561..0046190d20cc7 100644 --- a/compiler/rustc_const_eval/messages.ftl +++ b/compiler/rustc_const_eval/messages.ftl @@ -374,12 +374,6 @@ const_eval_unallowed_op_in_const_context = const_eval_unavailable_target_features_for_fn = calling a function that requires unavailable target features: {$unavailable_feats} -const_eval_undefined_behavior = - it is undefined behavior to use this value - -const_eval_undefined_behavior_note = - The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. - const_eval_uninhabited_enum_variant_read = read discriminant of an uninhabited enum variant const_eval_uninhabited_enum_variant_written = @@ -434,6 +428,12 @@ const_eval_validation_expected_raw_ptr = expected a raw pointer const_eval_validation_expected_ref = expected a reference const_eval_validation_expected_str = expected a string +const_eval_validation_failure = + it is undefined behavior to use this value + +const_eval_validation_failure_note = + The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. + const_eval_validation_front_matter_invalid_value = constructing invalid value const_eval_validation_front_matter_invalid_value_with_path = constructing invalid value at {$path} diff --git a/compiler/rustc_const_eval/src/const_eval/error.rs b/compiler/rustc_const_eval/src/const_eval/error.rs index b6adee435ba3a..763344207c467 100644 --- a/compiler/rustc_const_eval/src/const_eval/error.rs +++ b/compiler/rustc_const_eval/src/const_eval/error.rs @@ -2,15 +2,16 @@ use std::mem; use rustc_errors::{DiagArgName, DiagArgValue, DiagMessage, Diagnostic, IntoDiagArg}; use rustc_hir::CRATE_HIR_ID; +use rustc_middle::mir::interpret::Provenance; use rustc_middle::mir::AssertKind; use rustc_middle::query::TyCtxtAt; use rustc_middle::ty::TyCtxt; use rustc_middle::ty::{layout::LayoutError, ConstInt}; use rustc_span::{Span, Symbol, DUMMY_SP}; -use super::{CompileTimeInterpreter, InterpCx}; +use super::CompileTimeInterpreter; use crate::errors::{self, FrameNote, ReportErrorExt}; -use crate::interpret::{ErrorHandled, InterpError, InterpErrorInfo, MachineStopType}; +use crate::interpret::{ErrorHandled, Frame, InterpError, InterpErrorInfo, MachineStopType}; /// The CTFE machine has some custom error kinds. #[derive(Clone, Debug)] @@ -58,15 +59,12 @@ impl<'tcx> Into> for ConstEvalErrKind { pub fn get_span_and_frames<'tcx, 'mir>( tcx: TyCtxtAt<'tcx>, - machine: &CompileTimeInterpreter<'mir, 'tcx>, + stack: &[Frame<'mir, 'tcx, impl Provenance, impl Sized>], ) -> (Span, Vec) where 'tcx: 'mir, { - let mut stacktrace = - InterpCx::>::generate_stacktrace_from_stack( - &machine.stack, - ); + let mut stacktrace = Frame::generate_stacktrace_from_stack(stack); // Filter out `requires_caller_location` frames. stacktrace.retain(|frame| !frame.instance.def.requires_caller_location(*tcx)); let span = stacktrace.first().map(|f| f.span).unwrap_or(tcx.span); @@ -170,7 +168,7 @@ pub(super) fn lint<'tcx, 'mir, L>( ) where L: for<'a> rustc_errors::LintDiagnostic<'a, ()>, { - let (span, frames) = get_span_and_frames(tcx, machine); + let (span, frames) = get_span_and_frames(tcx, &machine.stack); tcx.emit_node_span_lint( lint, diff --git a/compiler/rustc_const_eval/src/const_eval/eval_queries.rs b/compiler/rustc_const_eval/src/const_eval/eval_queries.rs index 5f4408ebbc6c2..5a1c7cc4209ad 100644 --- a/compiler/rustc_const_eval/src/const_eval/eval_queries.rs +++ b/compiler/rustc_const_eval/src/const_eval/eval_queries.rs @@ -18,18 +18,18 @@ use crate::errors; use crate::errors::ConstEvalError; use crate::interpret::eval_nullary_intrinsic; use crate::interpret::{ - create_static_alloc, intern_const_alloc_recursive, take_static_root_alloc, CtfeValidationMode, - GlobalId, Immediate, InternKind, InterpCx, InterpError, InterpResult, MPlaceTy, MemoryKind, - OpTy, RefTracking, StackPopCleanup, + create_static_alloc, intern_const_alloc_recursive, CtfeValidationMode, GlobalId, Immediate, + InternKind, InterpCx, InterpError, InterpResult, MPlaceTy, MemoryKind, OpTy, RefTracking, + StackPopCleanup, }; // Returns a pointer to where the result lives -#[instrument(level = "trace", skip(ecx, body), ret)] -fn eval_body_using_ecx<'mir, 'tcx>( +#[instrument(level = "trace", skip(ecx, body))] +fn eval_body_using_ecx<'mir, 'tcx, R: InterpretationResult<'tcx>>( ecx: &mut CompileTimeEvalContext<'mir, 'tcx>, cid: GlobalId<'tcx>, body: &'mir mir::Body<'tcx>, -) -> InterpResult<'tcx, MPlaceTy<'tcx>> { +) -> InterpResult<'tcx, R> { trace!(?ecx.param_env); let tcx = *ecx.tcx; assert!( @@ -84,7 +84,10 @@ fn eval_body_using_ecx<'mir, 'tcx>( // Intern the result intern_const_alloc_recursive(ecx, intern_kind, &ret)?; - Ok(ret) + // Since evaluation had no errors, validate the resulting constant. + const_validate_mplace(&ecx, &ret, cid)?; + + Ok(R::make_result(ret, ecx)) } /// The `InterpCx` is only meant to be used to do field and index projections into constants for @@ -282,18 +285,26 @@ pub fn eval_static_initializer_provider<'tcx>( let instance = ty::Instance::mono(tcx, def_id.to_def_id()); let cid = rustc_middle::mir::interpret::GlobalId { instance, promoted: None }; - let mut ecx = InterpCx::new( - tcx, - tcx.def_span(def_id), - ty::ParamEnv::reveal_all(), - // Statics (and promoteds inside statics) may access other statics, because unlike consts - // they do not have to behave "as if" they were evaluated at runtime. - CompileTimeInterpreter::new(CanAccessMutGlobal::Yes, CheckAlignment::Error), - ); - let alloc_id = eval_in_interpreter(&mut ecx, cid, true)?.alloc_id; - let alloc = take_static_root_alloc(&mut ecx, alloc_id); - let alloc = tcx.mk_const_alloc(alloc); - Ok(alloc) + eval_in_interpreter(tcx, cid, ty::ParamEnv::reveal_all()) +} + +pub trait InterpretationResult<'tcx> { + /// This function takes the place where the result of the evaluation is stored + /// and prepares it for returning it in the appropriate format needed by the specific + /// evaluation query. + fn make_result<'mir>( + mplace: MPlaceTy<'tcx>, + ecx: &mut InterpCx<'mir, 'tcx, CompileTimeInterpreter<'mir, 'tcx>>, + ) -> Self; +} + +impl<'tcx> InterpretationResult<'tcx> for ConstAlloc<'tcx> { + fn make_result<'mir>( + mplace: MPlaceTy<'tcx>, + _ecx: &mut InterpCx<'mir, 'tcx, CompileTimeInterpreter<'mir, 'tcx>>, + ) -> Self { + ConstAlloc { alloc_id: mplace.ptr().provenance.unwrap().alloc_id(), ty: mplace.layout.ty } + } } #[instrument(skip(tcx), level = "debug")] @@ -319,92 +330,64 @@ pub fn eval_to_allocation_raw_provider<'tcx>( trace!("const eval: {:?} ({})", key, instance); } - let cid = key.value; + eval_in_interpreter(tcx, key.value, key.param_env) +} + +fn eval_in_interpreter<'tcx, R: InterpretationResult<'tcx>>( + tcx: TyCtxt<'tcx>, + cid: GlobalId<'tcx>, + param_env: ty::ParamEnv<'tcx>, +) -> Result { let def = cid.instance.def.def_id(); let is_static = tcx.is_static(def); let mut ecx = InterpCx::new( tcx, tcx.def_span(def), - key.param_env, + param_env, // Statics (and promoteds inside statics) may access mutable global memory, because unlike consts // they do not have to behave "as if" they were evaluated at runtime. // For consts however we want to ensure they behave "as if" they were evaluated at runtime, // so we have to reject reading mutable global memory. CompileTimeInterpreter::new(CanAccessMutGlobal::from(is_static), CheckAlignment::Error), ); - eval_in_interpreter(&mut ecx, cid, is_static) -} - -pub fn eval_in_interpreter<'mir, 'tcx>( - ecx: &mut InterpCx<'mir, 'tcx, CompileTimeInterpreter<'mir, 'tcx>>, - cid: GlobalId<'tcx>, - is_static: bool, -) -> ::rustc_middle::mir::interpret::EvalToAllocationRawResult<'tcx> { - // `is_static` just means "in static", it could still be a promoted! - debug_assert_eq!(is_static, ecx.tcx.static_mutability(cid.instance.def_id()).is_some()); - let res = ecx.load_mir(cid.instance.def, cid.promoted); - match res.and_then(|body| eval_body_using_ecx(ecx, cid, body)) { - Err(error) => { - let (error, backtrace) = error.into_parts(); - backtrace.print_backtrace(); - - let (kind, instance) = if is_static { - ("static", String::new()) - } else { - // If the current item has generics, we'd like to enrich the message with the - // instance and its args: to show the actual compile-time values, in addition to - // the expression, leading to the const eval error. - let instance = &cid.instance; - if !instance.args.is_empty() { - let instance = with_no_trimmed_paths!(instance.to_string()); - ("const_with_path", instance) - } else { - ("const", String::new()) - } - }; - - Err(super::report( - *ecx.tcx, - error, - None, - || super::get_span_and_frames(ecx.tcx, &ecx.machine), - |span, frames| ConstEvalError { - span, - error_kind: kind, - instance, - frame_notes: frames, - }, - )) - } - Ok(mplace) => { - // Since evaluation had no errors, validate the resulting constant. - - // Temporarily allow access to the static_root_ids for the purpose of validation. - let static_root_ids = ecx.machine.static_root_ids.take(); - let res = const_validate_mplace(&ecx, &mplace, cid); - ecx.machine.static_root_ids = static_root_ids; - - let alloc_id = mplace.ptr().provenance.unwrap().alloc_id(); - - // Validation failed, report an error. - if let Err(error) = res { - Err(const_report_error(&ecx, error, alloc_id)) + res.and_then(|body| eval_body_using_ecx(&mut ecx, cid, body)).map_err(|error| { + let (error, backtrace) = error.into_parts(); + backtrace.print_backtrace(); + + let (kind, instance) = if ecx.tcx.is_static(cid.instance.def_id()) { + ("static", String::new()) + } else { + // If the current item has generics, we'd like to enrich the message with the + // instance and its args: to show the actual compile-time values, in addition to + // the expression, leading to the const eval error. + let instance = &cid.instance; + if !instance.args.is_empty() { + let instance = with_no_trimmed_paths!(instance.to_string()); + ("const_with_path", instance) } else { - // Convert to raw constant - Ok(ConstAlloc { alloc_id, ty: mplace.layout.ty }) + ("const", String::new()) } - } - } + }; + + super::report( + *ecx.tcx, + error, + None, + || super::get_span_and_frames(ecx.tcx, ecx.stack()), + |span, frames| ConstEvalError { span, error_kind: kind, instance, frame_notes: frames }, + ) + }) } #[inline(always)] -pub fn const_validate_mplace<'mir, 'tcx>( +fn const_validate_mplace<'mir, 'tcx>( ecx: &InterpCx<'mir, 'tcx, CompileTimeInterpreter<'mir, 'tcx>>, mplace: &MPlaceTy<'tcx>, cid: GlobalId<'tcx>, -) -> InterpResult<'tcx> { +) -> Result<(), ErrorHandled> { + let alloc_id = mplace.ptr().provenance.unwrap().alloc_id(); let mut ref_tracking = RefTracking::new(mplace.clone()); let mut inner = false; while let Some((mplace, path)) = ref_tracking.todo.pop() { @@ -418,7 +401,10 @@ pub fn const_validate_mplace<'mir, 'tcx>( CtfeValidationMode::Const { allow_immutable_unsafe_cell: !inner } } }; - ecx.const_validate_operand(&mplace.into(), path, &mut ref_tracking, mode)?; + ecx.const_validate_operand(&mplace.into(), path, &mut ref_tracking, mode) + // Instead of just reporting the `InterpError` via the usual machinery, we give a more targetted + // error about the validation failure. + .map_err(|error| report_validation_error(&ecx, error, alloc_id))?; inner = true; } @@ -426,7 +412,7 @@ pub fn const_validate_mplace<'mir, 'tcx>( } #[inline(always)] -pub fn const_report_error<'mir, 'tcx>( +fn report_validation_error<'mir, 'tcx>( ecx: &InterpCx<'mir, 'tcx, CompileTimeInterpreter<'mir, 'tcx>>, error: InterpErrorInfo<'tcx>, alloc_id: AllocId, @@ -444,7 +430,7 @@ pub fn const_report_error<'mir, 'tcx>( *ecx.tcx, error, None, - || crate::const_eval::get_span_and_frames(ecx.tcx, &ecx.machine), - move |span, frames| errors::UndefinedBehavior { span, ub_note, frames, raw_bytes }, + || crate::const_eval::get_span_and_frames(ecx.tcx, ecx.stack()), + move |span, frames| errors::ValidationFailure { span, ub_note, frames, raw_bytes }, ) } diff --git a/compiler/rustc_const_eval/src/const_eval/mod.rs b/compiler/rustc_const_eval/src/const_eval/mod.rs index 289dcb7d01d68..d0d6adbfad069 100644 --- a/compiler/rustc_const_eval/src/const_eval/mod.rs +++ b/compiler/rustc_const_eval/src/const_eval/mod.rs @@ -5,7 +5,7 @@ use rustc_middle::mir::interpret::InterpErrorInfo; use rustc_middle::query::TyCtxtAt; use rustc_middle::ty::{self, Ty}; -use crate::interpret::{format_interp_error, InterpCx}; +use crate::interpret::format_interp_error; mod error; mod eval_queries; diff --git a/compiler/rustc_const_eval/src/errors.rs b/compiler/rustc_const_eval/src/errors.rs index 249c02b75f7d2..077b411c60744 100644 --- a/compiler/rustc_const_eval/src/errors.rs +++ b/compiler/rustc_const_eval/src/errors.rs @@ -409,11 +409,11 @@ pub struct NullaryIntrinsicError { } #[derive(Diagnostic)] -#[diag(const_eval_undefined_behavior, code = E0080)] -pub struct UndefinedBehavior { +#[diag(const_eval_validation_failure, code = E0080)] +pub struct ValidationFailure { #[primary_span] pub span: Span, - #[note(const_eval_undefined_behavior_note)] + #[note(const_eval_validation_failure_note)] pub ub_note: Option<()>, #[subdiagnostic] pub frames: Vec, diff --git a/compiler/rustc_const_eval/src/interpret/eval_context.rs b/compiler/rustc_const_eval/src/interpret/eval_context.rs index a484fbd892c6d..fbf9c141d22e7 100644 --- a/compiler/rustc_const_eval/src/interpret/eval_context.rs +++ b/compiler/rustc_const_eval/src/interpret/eval_context.rs @@ -279,6 +279,32 @@ impl<'mir, 'tcx, Prov: Provenance, Extra> Frame<'mir, 'tcx, Prov, Extra> { } }) } + + #[must_use] + pub fn generate_stacktrace_from_stack(stack: &[Self]) -> Vec> { + let mut frames = Vec::new(); + // This deliberately does *not* honor `requires_caller_location` since it is used for much + // more than just panics. + for frame in stack.iter().rev() { + let span = match frame.loc { + Left(loc) => { + // If the stacktrace passes through MIR-inlined source scopes, add them. + let mir::SourceInfo { mut span, scope } = *frame.body.source_info(loc); + let mut scope_data = &frame.body.source_scopes[scope]; + while let Some((instance, call_span)) = scope_data.inlined { + frames.push(FrameInfo { span, instance }); + span = call_span; + scope_data = &frame.body.source_scopes[scope_data.parent_scope.unwrap()]; + } + span + } + Right(span) => span, + }; + frames.push(FrameInfo { span, instance: frame.instance }); + } + trace!("generate stacktrace: {:#?}", frames); + frames + } } // FIXME: only used by miri, should be removed once translatable. @@ -1166,37 +1192,9 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { PlacePrinter { ecx: self, place: *place.place() } } - #[must_use] - pub fn generate_stacktrace_from_stack( - stack: &[Frame<'mir, 'tcx, M::Provenance, M::FrameExtra>], - ) -> Vec> { - let mut frames = Vec::new(); - // This deliberately does *not* honor `requires_caller_location` since it is used for much - // more than just panics. - for frame in stack.iter().rev() { - let span = match frame.loc { - Left(loc) => { - // If the stacktrace passes through MIR-inlined source scopes, add them. - let mir::SourceInfo { mut span, scope } = *frame.body.source_info(loc); - let mut scope_data = &frame.body.source_scopes[scope]; - while let Some((instance, call_span)) = scope_data.inlined { - frames.push(FrameInfo { span, instance }); - span = call_span; - scope_data = &frame.body.source_scopes[scope_data.parent_scope.unwrap()]; - } - span - } - Right(span) => span, - }; - frames.push(FrameInfo { span, instance: frame.instance }); - } - trace!("generate stacktrace: {:#?}", frames); - frames - } - #[must_use] pub fn generate_stacktrace(&self) -> Vec> { - Self::generate_stacktrace_from_stack(self.stack()) + Frame::generate_stacktrace_from_stack(self.stack()) } } diff --git a/compiler/rustc_const_eval/src/interpret/intern.rs b/compiler/rustc_const_eval/src/interpret/intern.rs index 55d4b9edd59b8..b0fc0d7635065 100644 --- a/compiler/rustc_const_eval/src/interpret/intern.rs +++ b/compiler/rustc_const_eval/src/interpret/intern.rs @@ -175,7 +175,7 @@ pub fn intern_const_alloc_recursive< // This gives us the initial set of nested allocations, which will then all be processed // recursively in the loop below. let mut todo: Vec<_> = if is_static { - // Do not steal the root allocation, we need it later for `take_static_root_alloc` + // Do not steal the root allocation, we need it later to create the return value of `eval_static_initializer`. // But still change its mutability to match the requested one. let alloc = ecx.memory.alloc_map.get_mut(&base_alloc_id).unwrap(); alloc.1.mutability = base_mutability; diff --git a/compiler/rustc_const_eval/src/interpret/mod.rs b/compiler/rustc_const_eval/src/interpret/mod.rs index 2ed879ca72b5f..474d35b2aa3a2 100644 --- a/compiler/rustc_const_eval/src/interpret/mod.rs +++ b/compiler/rustc_const_eval/src/interpret/mod.rs @@ -39,5 +39,5 @@ use self::{ }; pub(crate) use self::intrinsics::eval_nullary_intrinsic; -pub(crate) use self::util::{create_static_alloc, take_static_root_alloc}; +pub(crate) use self::util::create_static_alloc; use eval_context::{from_known_layout, mir_assign_valid_types}; diff --git a/compiler/rustc_const_eval/src/interpret/util.rs b/compiler/rustc_const_eval/src/interpret/util.rs index 086475f72c5d4..c83ef14c03fe7 100644 --- a/compiler/rustc_const_eval/src/interpret/util.rs +++ b/compiler/rustc_const_eval/src/interpret/util.rs @@ -1,14 +1,15 @@ -use crate::const_eval::CompileTimeEvalContext; +use crate::const_eval::{CompileTimeEvalContext, CompileTimeInterpreter, InterpretationResult}; use crate::interpret::{MemPlaceMeta, MemoryKind}; use rustc_hir::def_id::LocalDefId; -use rustc_middle::mir::interpret::{AllocId, Allocation, InterpResult, Pointer}; +use rustc_middle::mir; +use rustc_middle::mir::interpret::{Allocation, InterpResult, Pointer}; use rustc_middle::ty::layout::TyAndLayout; use rustc_middle::ty::{ self, Ty, TyCtxt, TypeSuperVisitable, TypeVisitable, TypeVisitableExt, TypeVisitor, }; use std::ops::ControlFlow; -use super::MPlaceTy; +use super::{InterpCx, MPlaceTy}; /// Checks whether a type contains generic parameters which must be instantiated. /// @@ -80,11 +81,15 @@ where } } -pub(crate) fn take_static_root_alloc<'mir, 'tcx: 'mir>( - ecx: &mut CompileTimeEvalContext<'mir, 'tcx>, - alloc_id: AllocId, -) -> Allocation { - ecx.memory.alloc_map.swap_remove(&alloc_id).unwrap().1 +impl<'tcx> InterpretationResult<'tcx> for mir::interpret::ConstAllocation<'tcx> { + fn make_result<'mir>( + mplace: MPlaceTy<'tcx>, + ecx: &mut InterpCx<'mir, 'tcx, CompileTimeInterpreter<'mir, 'tcx>>, + ) -> Self { + let alloc_id = mplace.ptr().provenance.unwrap().alloc_id(); + let alloc = ecx.memory.alloc_map.swap_remove(&alloc_id).unwrap().1; + ecx.tcx.mk_const_alloc(alloc) + } } pub(crate) fn create_static_alloc<'mir, 'tcx: 'mir>( diff --git a/compiler/rustc_driver_impl/src/lib.rs b/compiler/rustc_driver_impl/src/lib.rs index c448835413571..938f9f0beaacd 100644 --- a/compiler/rustc_driver_impl/src/lib.rs +++ b/compiler/rustc_driver_impl/src/lib.rs @@ -28,7 +28,7 @@ use rustc_errors::{ markdown, ColorConfig, DiagCtxt, ErrCode, ErrorGuaranteed, FatalError, PResult, }; use rustc_feature::find_gated_cfg; -use rustc_interface::util::{self, collect_crate_types, get_codegen_backend}; +use rustc_interface::util::{self, get_codegen_backend}; use rustc_interface::{interface, Queries}; use rustc_lint::unerased_lint_store; use rustc_metadata::creader::MetadataLoader; @@ -37,6 +37,7 @@ use rustc_session::config::{nightly_options, CG_OPTIONS, Z_OPTIONS}; use rustc_session::config::{ErrorOutputType, Input, OutFileName, OutputType}; use rustc_session::getopts::{self, Matches}; use rustc_session::lint::{Lint, LintId}; +use rustc_session::output::collect_crate_types; use rustc_session::{config, filesearch, EarlyDiagCtxt, Session}; use rustc_span::def_id::LOCAL_CRATE; use rustc_span::source_map::FileLoader; diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index 57b8df52f4b79..4f033e3fefa0f 100644 --- a/compiler/rustc_errors/src/emitter.rs +++ b/compiler/rustc_errors/src/emitter.rs @@ -2086,7 +2086,7 @@ impl HumanEmitter { } if !self.short_message { for child in children { - assert!(child.level.can_be_top_or_sub().1); + assert!(child.level.can_be_subdiag()); let span = &child.span; if let Err(err) = self.emit_messages_default_inner( span, diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 286d4621850ee..723f13dbe8d31 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -526,12 +526,15 @@ pub enum StashKey { UndeterminedMacroResolution, } -fn default_track_diagnostic(diag: DiagInner, f: &mut dyn FnMut(DiagInner)) { +fn default_track_diagnostic(diag: DiagInner, f: &mut dyn FnMut(DiagInner) -> R) -> R { (*f)(diag) } -pub static TRACK_DIAGNOSTIC: AtomicRef = - AtomicRef::new(&(default_track_diagnostic as _)); +/// Diagnostics emitted by `DiagCtxtInner::emit_diagnostic` are passed through this function. Used +/// for tracking by incremental, to replay diagnostics as necessary. +pub static TRACK_DIAGNOSTIC: AtomicRef< + fn(DiagInner, &mut dyn FnMut(DiagInner) -> Option) -> Option, +> = AtomicRef::new(&(default_track_diagnostic as _)); #[derive(Copy, Clone, Default)] pub struct DiagCtxtFlags { @@ -1422,74 +1425,103 @@ impl DiagCtxtInner { // Return value is only `Some` if the level is `Error` or `DelayedBug`. fn emit_diagnostic(&mut self, mut diagnostic: DiagInner) -> Option { - assert!(diagnostic.level.can_be_top_or_sub().0); - - if let Some(expectation_id) = diagnostic.level.get_expectation_id() { - // The `LintExpectationId` can be stable or unstable depending on when it was created. - // Diagnostics created before the definition of `HirId`s are unstable and can not yet - // be stored. Instead, they are buffered until the `LintExpectationId` is replaced by - // a stable one by the `LintLevelsBuilder`. - if let LintExpectationId::Unstable { .. } = expectation_id { - self.unstable_expect_diagnostics.push(diagnostic); - return None; - } - self.suppressed_expected_diag = true; - self.fulfilled_expectations.insert(expectation_id.normalize()); - } - if diagnostic.has_future_breakage() { // Future breakages aren't emitted if they're `Level::Allow`, // but they still need to be constructed and stashed below, // so they'll trigger the must_produce_diag check. - self.suppressed_expected_diag = true; + assert!(matches!(diagnostic.level, Error | Warning | Allow)); self.future_breakage_diagnostics.push(diagnostic.clone()); } - // Note that because this comes before the `match` below, - // `-Zeagerly-emit-delayed-bugs` continues to work even after we've - // issued an error and stopped recording new delayed bugs. - if diagnostic.level == DelayedBug && self.flags.eagerly_emit_delayed_bugs { - diagnostic.level = Error; - } - + // We call TRACK_DIAGNOSTIC with an empty closure for the cases that + // return early *and* have some kind of side-effect, except where + // noted. match diagnostic.level { - // This must come after the possible promotion of `DelayedBug` to - // `Error` above. - Fatal | Error if self.treat_next_err_as_bug() => { - diagnostic.level = Bug; + Bug => {} + Fatal | Error => { + if self.treat_next_err_as_bug() { + // `Fatal` and `Error` can be promoted to `Bug`. + diagnostic.level = Bug; + } } DelayedBug => { - // If we have already emitted at least one error, we don't need - // to record the delayed bug, because it'll never be used. - return if let Some(guar) = self.has_errors() { - Some(guar) + // Note that because we check these conditions first, + // `-Zeagerly-emit-delayed-bugs` and `-Ztreat-err-as-bug` + // continue to work even after we've issued an error and + // stopped recording new delayed bugs. + if self.flags.eagerly_emit_delayed_bugs { + // `DelayedBug` can be promoted to `Error` or `Bug`. + if self.treat_next_err_as_bug() { + diagnostic.level = Bug; + } else { + diagnostic.level = Error; + } } else { - let backtrace = std::backtrace::Backtrace::capture(); - // This `unchecked_error_guaranteed` is valid. It is where the - // `ErrorGuaranteed` for delayed bugs originates. See - // `DiagCtxtInner::drop`. - #[allow(deprecated)] - let guar = ErrorGuaranteed::unchecked_error_guaranteed(); - self.delayed_bugs - .push((DelayedDiagInner::with_backtrace(diagnostic, backtrace), guar)); - Some(guar) - }; + // If we have already emitted at least one error, we don't need + // to record the delayed bug, because it'll never be used. + return if let Some(guar) = self.has_errors() { + Some(guar) + } else { + // No `TRACK_DIAGNOSTIC` call is needed, because the + // incremental session is deleted if there is a delayed + // bug. This also saves us from cloning the diagnostic. + let backtrace = std::backtrace::Backtrace::capture(); + // This `unchecked_error_guaranteed` is valid. It is where the + // `ErrorGuaranteed` for delayed bugs originates. See + // `DiagCtxtInner::drop`. + #[allow(deprecated)] + let guar = ErrorGuaranteed::unchecked_error_guaranteed(); + self.delayed_bugs + .push((DelayedDiagInner::with_backtrace(diagnostic, backtrace), guar)); + Some(guar) + }; + } + } + ForceWarning(None) => {} // `ForceWarning(Some(...))` is below, with `Expect` + Warning => { + if !self.flags.can_emit_warnings { + // We are not emitting warnings. + if diagnostic.has_future_breakage() { + // The side-effect is at the top of this method. + TRACK_DIAGNOSTIC(diagnostic, &mut |_| None); + } + return None; + } } - Warning if !self.flags.can_emit_warnings => { + Note | Help | FailureNote => {} + OnceNote | OnceHelp => panic!("bad level: {:?}", diagnostic.level), + Allow => { + // Nothing emitted for allowed lints. if diagnostic.has_future_breakage() { - (*TRACK_DIAGNOSTIC)(diagnostic, &mut |_| {}); + // The side-effect is at the top of this method. + TRACK_DIAGNOSTIC(diagnostic, &mut |_| None); + self.suppressed_expected_diag = true; } return None; } - Allow | Expect(_) => { - (*TRACK_DIAGNOSTIC)(diagnostic, &mut |_| {}); - return None; + Expect(expect_id) | ForceWarning(Some(expect_id)) => { + // Diagnostics created before the definition of `HirId`s are + // unstable and can not yet be stored. Instead, they are + // buffered until the `LintExpectationId` is replaced by a + // stable one by the `LintLevelsBuilder`. + if let LintExpectationId::Unstable { .. } = expect_id { + // We don't call TRACK_DIAGNOSTIC because we wait for the + // unstable ID to be updated, whereupon the diagnostic will + // be passed into this method again. + self.unstable_expect_diagnostics.push(diagnostic); + return None; + } + self.fulfilled_expectations.insert(expect_id.normalize()); + if let Expect(_) = diagnostic.level { + // Nothing emitted here for expected lints. + TRACK_DIAGNOSTIC(diagnostic, &mut |_| None); + self.suppressed_expected_diag = true; + return None; + } } - _ => {} } - let mut guaranteed = None; - (*TRACK_DIAGNOSTIC)(diagnostic, &mut |mut diagnostic| { + TRACK_DIAGNOSTIC(diagnostic, &mut |mut diagnostic| { if let Some(code) = diagnostic.code { self.emitted_diagnostic_codes.insert(code); } @@ -1552,17 +1584,17 @@ impl DiagCtxtInner { // `ErrorGuaranteed` for errors and lint errors originates. #[allow(deprecated)] let guar = ErrorGuaranteed::unchecked_error_guaranteed(); - guaranteed = Some(guar); if is_lint { self.lint_err_guars.push(guar); } else { self.err_guars.push(guar); } self.panic_if_treat_err_as_bug(); + Some(guar) + } else { + None } - }); - - guaranteed + }) } fn treat_err_as_bug(&self) -> bool { @@ -1863,23 +1895,13 @@ impl Level { matches!(*self, FailureNote) } - pub fn get_expectation_id(&self) -> Option { - match self { - Expect(id) | ForceWarning(Some(id)) => Some(*id), - _ => None, - } - } - - // Can this level be used in a top-level diagnostic message and/or a - // subdiagnostic message? - fn can_be_top_or_sub(&self) -> (bool, bool) { + // Can this level be used in a subdiagnostic message? + fn can_be_subdiag(&self) -> bool { match self { Bug | DelayedBug | Fatal | Error | ForceWarning(_) | FailureNote | Allow - | Expect(_) => (true, false), - - Warning | Note | Help => (true, true), + | Expect(_) => false, - OnceNote | OnceHelp => (false, true), + Warning | Note | Help | OnceNote | OnceHelp => true, } } } diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index 8a7d32997b022..a20ce56fd027b 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -2553,6 +2553,11 @@ pub struct OpaqueTy<'hir> { pub in_trait: bool, } +#[derive(Copy, Clone, Debug, HashStable_Generic)] +pub struct AssocOpaqueTy { + // Add some data if necessary +} + /// From whence the opaque type came. #[derive(Copy, Clone, PartialEq, Eq, Debug, HashStable_Generic)] pub enum OpaqueTyOrigin { @@ -3363,6 +3368,7 @@ pub enum OwnerNode<'hir> { TraitItem(&'hir TraitItem<'hir>), ImplItem(&'hir ImplItem<'hir>), Crate(&'hir Mod<'hir>), + AssocOpaqueTy(&'hir AssocOpaqueTy), } impl<'hir> OwnerNode<'hir> { @@ -3372,7 +3378,7 @@ impl<'hir> OwnerNode<'hir> { | OwnerNode::ForeignItem(ForeignItem { ident, .. }) | OwnerNode::ImplItem(ImplItem { ident, .. }) | OwnerNode::TraitItem(TraitItem { ident, .. }) => Some(*ident), - OwnerNode::Crate(..) => None, + OwnerNode::Crate(..) | OwnerNode::AssocOpaqueTy(..) => None, } } @@ -3385,6 +3391,7 @@ impl<'hir> OwnerNode<'hir> { | OwnerNode::ImplItem(ImplItem { span, .. }) | OwnerNode::TraitItem(TraitItem { span, .. }) => span, OwnerNode::Crate(Mod { spans: ModSpans { inner_span, .. }, .. }) => inner_span, + OwnerNode::AssocOpaqueTy(..) => unreachable!(), } } @@ -3443,6 +3450,7 @@ impl<'hir> OwnerNode<'hir> { | OwnerNode::ImplItem(ImplItem { owner_id, .. }) | OwnerNode::ForeignItem(ForeignItem { owner_id, .. }) => *owner_id, OwnerNode::Crate(..) => crate::CRATE_HIR_ID.owner, + OwnerNode::AssocOpaqueTy(..) => unreachable!(), } } @@ -3486,6 +3494,7 @@ impl<'hir> Into> for OwnerNode<'hir> { OwnerNode::ImplItem(n) => Node::ImplItem(n), OwnerNode::TraitItem(n) => Node::TraitItem(n), OwnerNode::Crate(n) => Node::Crate(n), + OwnerNode::AssocOpaqueTy(n) => Node::AssocOpaqueTy(n), } } } @@ -3523,6 +3532,7 @@ pub enum Node<'hir> { WhereBoundPredicate(&'hir WhereBoundPredicate<'hir>), // FIXME: Merge into `Node::Infer`. ArrayLenInfer(&'hir InferArg), + AssocOpaqueTy(&'hir AssocOpaqueTy), // Span by reference to minimize `Node`'s size #[allow(rustc::pass_by_value)] Err(&'hir Span), @@ -3573,6 +3583,7 @@ impl<'hir> Node<'hir> { | Node::Infer(..) | Node::WhereBoundPredicate(..) | Node::ArrayLenInfer(..) + | Node::AssocOpaqueTy(..) | Node::Err(..) => None, } } @@ -3678,6 +3689,7 @@ impl<'hir> Node<'hir> { Node::TraitItem(i) => Some(OwnerNode::TraitItem(i)), Node::ImplItem(i) => Some(OwnerNode::ImplItem(i)), Node::Crate(i) => Some(OwnerNode::Crate(i)), + Node::AssocOpaqueTy(i) => Some(OwnerNode::AssocOpaqueTy(i)), _ => None, } } diff --git a/compiler/rustc_hir_analysis/src/check/wfcheck.rs b/compiler/rustc_hir_analysis/src/check/wfcheck.rs index 09689b22e905f..ae15efc0764b7 100644 --- a/compiler/rustc_hir_analysis/src/check/wfcheck.rs +++ b/compiler/rustc_hir_analysis/src/check/wfcheck.rs @@ -196,6 +196,7 @@ fn check_well_formed(tcx: TyCtxt<'_>, def_id: hir::OwnerId) -> Result<(), ErrorG hir::OwnerNode::TraitItem(item) => check_trait_item(tcx, item), hir::OwnerNode::ImplItem(item) => check_impl_item(tcx, item), hir::OwnerNode::ForeignItem(item) => check_foreign_item(tcx, item), + hir::OwnerNode::AssocOpaqueTy(..) => unreachable!(), }; if let Some(generics) = node.generics() { diff --git a/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs b/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs index 7936621c86829..d1da2fa0fdc26 100644 --- a/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs +++ b/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs @@ -262,6 +262,7 @@ fn resolve_bound_vars(tcx: TyCtxt<'_>, local_def_id: hir::OwnerId) -> ResolveBou visitor.visit_impl_item(item) } hir::OwnerNode::Crate(_) => {} + hir::OwnerNode::AssocOpaqueTy(..) => unreachable!(), } let mut rl = ResolveBoundVars::default(); diff --git a/compiler/rustc_hir_pretty/src/lib.rs b/compiler/rustc_hir_pretty/src/lib.rs index b5bb063c5ed8c..1ace7cd201f96 100644 --- a/compiler/rustc_hir_pretty/src/lib.rs +++ b/compiler/rustc_hir_pretty/src/lib.rs @@ -121,6 +121,7 @@ impl<'a> State<'a> { self.print_bounds(":", pred.bounds); } Node::ArrayLenInfer(_) => self.word("_"), + Node::AssocOpaqueTy(..) => unreachable!(), Node::Err(_) => self.word("/*ERROR*/"), } } diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs index a08582a67d94c..2747700f3c136 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs @@ -2174,7 +2174,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let mut call_finder = FindClosureArg { tcx: self.tcx, calls: vec![] }; let node = self .tcx - .opt_local_def_id_to_hir_id(self.tcx.hir().get_parent_item(call_expr.hir_id)) + .opt_local_def_id_to_hir_id( + self.tcx.hir().get_parent_item(call_expr.hir_id).def_id, + ) .map(|hir_id| self.tcx.hir_node(hir_id)); match node { Some(hir::Node::Item(item)) => call_finder.visit_item(item), diff --git a/compiler/rustc_incremental/src/persist/fs.rs b/compiler/rustc_incremental/src/persist/fs.rs index dd9c16d006a96..1462037c8c8e7 100644 --- a/compiler/rustc_incremental/src/persist/fs.rs +++ b/compiler/rustc_incremental/src/persist/fs.rs @@ -110,8 +110,9 @@ use rustc_data_structures::unord::{UnordMap, UnordSet}; use rustc_data_structures::{base_n, flock}; use rustc_errors::ErrorGuaranteed; use rustc_fs_util::{link_or_copy, try_canonicalize, LinkOrCopy}; +use rustc_session::config::CrateType; +use rustc_session::output::{collect_crate_types, find_crate_name}; use rustc_session::{Session, StableCrateId}; -use rustc_span::Symbol; use std::fs as std_fs; use std::io::{self, ErrorKind}; @@ -205,11 +206,7 @@ pub fn in_incr_comp_dir(incr_comp_session_dir: &Path, file_name: &str) -> PathBu /// The garbage collection will take care of it. /// /// [`rustc_interface::queries::dep_graph`]: ../../rustc_interface/struct.Queries.html#structfield.dep_graph -pub(crate) fn prepare_session_directory( - sess: &Session, - crate_name: Symbol, - stable_crate_id: StableCrateId, -) -> Result<(), ErrorGuaranteed> { +pub(crate) fn prepare_session_directory(sess: &Session) -> Result<(), ErrorGuaranteed> { if sess.opts.incremental.is_none() { return Ok(()); } @@ -219,7 +216,7 @@ pub(crate) fn prepare_session_directory( debug!("prepare_session_directory"); // {incr-comp-dir}/{crate-name-and-disambiguator} - let crate_dir = crate_path(sess, crate_name, stable_crate_id); + let crate_dir = crate_path(sess); debug!("crate-dir: {}", crate_dir.display()); create_dir(sess, &crate_dir, "crate")?; @@ -604,9 +601,18 @@ fn string_to_timestamp(s: &str) -> Result { Ok(UNIX_EPOCH + duration) } -fn crate_path(sess: &Session, crate_name: Symbol, stable_crate_id: StableCrateId) -> PathBuf { +fn crate_path(sess: &Session) -> PathBuf { let incr_dir = sess.opts.incremental.as_ref().unwrap().clone(); + let crate_name = find_crate_name(sess, &[]); + let crate_types = collect_crate_types(sess, &[]); + let stable_crate_id = StableCrateId::new( + crate_name, + crate_types.contains(&CrateType::Executable), + sess.opts.cg.metadata.clone(), + sess.cfg_version, + ); + let stable_crate_id = base_n::encode(stable_crate_id.as_u64() as u128, INT_ENCODE_BASE); let crate_name = format!("{crate_name}-{stable_crate_id}"); diff --git a/compiler/rustc_incremental/src/persist/load.rs b/compiler/rustc_incremental/src/persist/load.rs index 96bfe766c20f5..357f2ae92d4c3 100644 --- a/compiler/rustc_incremental/src/persist/load.rs +++ b/compiler/rustc_incremental/src/persist/load.rs @@ -8,8 +8,8 @@ use rustc_middle::query::on_disk_cache::OnDiskCache; use rustc_serialize::opaque::MemDecoder; use rustc_serialize::Decodable; use rustc_session::config::IncrementalStateAssertion; -use rustc_session::{Session, StableCrateId}; -use rustc_span::{ErrorGuaranteed, Symbol}; +use rustc_session::Session; +use rustc_span::ErrorGuaranteed; use std::path::{Path, PathBuf}; use super::data::*; @@ -190,13 +190,9 @@ pub fn load_query_result_cache(sess: &Session) -> Option> { /// Setups the dependency graph by loading an existing graph from disk and set up streaming of a /// new graph to an incremental session directory. -pub fn setup_dep_graph( - sess: &Session, - crate_name: Symbol, - stable_crate_id: StableCrateId, -) -> Result { +pub fn setup_dep_graph(sess: &Session) -> Result { // `load_dep_graph` can only be called after `prepare_session_directory`. - prepare_session_directory(sess, crate_name, stable_crate_id)?; + prepare_session_directory(sess)?; let res = sess.opts.build_dep_graph().then(|| load_dep_graph(sess)); diff --git a/compiler/rustc_infer/src/infer/error_reporting/mod.rs b/compiler/rustc_infer/src/infer/error_reporting/mod.rs index 222c0a3954255..edd7f733ec96b 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/mod.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/mod.rs @@ -2554,6 +2554,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { hir::OwnerNode::ImplItem(i) => visitor.visit_impl_item(i), hir::OwnerNode::TraitItem(i) => visitor.visit_trait_item(i), hir::OwnerNode::Crate(_) => bug!("OwnerNode::Crate doesn't not have generics"), + hir::OwnerNode::AssocOpaqueTy(..) => unreachable!(), } let ast_generics = self.tcx.hir().get_generics(lifetime_scope).unwrap(); diff --git a/compiler/rustc_interface/messages.ftl b/compiler/rustc_interface/messages.ftl index bd9fad8b04296..47dfbc1d7fbf1 100644 --- a/compiler/rustc_interface/messages.ftl +++ b/compiler/rustc_interface/messages.ftl @@ -48,6 +48,3 @@ interface_rustc_error_unexpected_annotation = interface_temps_dir_error = failed to find or create the directory specified by `--temps-dir` - -interface_unsupported_crate_type_for_target = - dropping unsupported crate type `{$crate_type}` for target `{$target_triple}` diff --git a/compiler/rustc_interface/src/callbacks.rs b/compiler/rustc_interface/src/callbacks.rs index f44ae705a3c27..a27f73789cdef 100644 --- a/compiler/rustc_interface/src/callbacks.rs +++ b/compiler/rustc_interface/src/callbacks.rs @@ -29,7 +29,7 @@ fn track_span_parent(def_id: rustc_span::def_id::LocalDefId) { /// This is a callback from `rustc_errors` as it cannot access the implicit state /// in `rustc_middle` otherwise. It is used when diagnostic messages are /// emitted and stores them in the current query, if there is one. -fn track_diagnostic(diagnostic: DiagInner, f: &mut dyn FnMut(DiagInner)) { +fn track_diagnostic(diagnostic: DiagInner, f: &mut dyn FnMut(DiagInner) -> R) -> R { tls::with_context_opt(|icx| { if let Some(icx) = icx { if let Some(diagnostics) = icx.diagnostics { @@ -38,11 +38,11 @@ fn track_diagnostic(diagnostic: DiagInner, f: &mut dyn FnMut(DiagInner)) { // Diagnostics are tracked, we can ignore the dependency. let icx = tls::ImplicitCtxt { task_deps: TaskDepsRef::Ignore, ..icx.clone() }; - return tls::enter_context(&icx, move || (*f)(diagnostic)); + tls::enter_context(&icx, move || (*f)(diagnostic)) + } else { + // In any other case, invoke diagnostics anyway. + (*f)(diagnostic) } - - // In any other case, invoke diagnostics anyway. - (*f)(diagnostic); }) } diff --git a/compiler/rustc_interface/src/errors.rs b/compiler/rustc_interface/src/errors.rs index a9ab2720d89a5..29294003b8f29 100644 --- a/compiler/rustc_interface/src/errors.rs +++ b/compiler/rustc_interface/src/errors.rs @@ -1,7 +1,5 @@ use rustc_macros::Diagnostic; -use rustc_session::config::CrateType; use rustc_span::{Span, Symbol}; -use rustc_target::spec::TargetTriple; use std::io; use std::path::Path; @@ -90,13 +88,6 @@ pub struct FailedWritingFile<'a> { #[diag(interface_proc_macro_crate_panic_abort)] pub struct ProcMacroCratePanicAbort; -#[derive(Diagnostic)] -#[diag(interface_unsupported_crate_type_for_target)] -pub struct UnsupportedCrateTypeForTarget<'a> { - pub crate_type: CrateType, - pub target_triple: &'a TargetTriple, -} - #[derive(Diagnostic)] #[diag(interface_multiple_output_types_adaption)] pub struct MultipleOutputTypesAdaption; diff --git a/compiler/rustc_interface/src/queries.rs b/compiler/rustc_interface/src/queries.rs index c22188226961e..ee677a092e2f1 100644 --- a/compiler/rustc_interface/src/queries.rs +++ b/compiler/rustc_interface/src/queries.rs @@ -18,7 +18,7 @@ use rustc_middle::ty::{GlobalCtxt, TyCtxt}; use rustc_serialize::opaque::FileEncodeResult; use rustc_session::config::{self, CrateType, OutputFilenames, OutputType}; use rustc_session::cstore::Untracked; -use rustc_session::output::find_crate_name; +use rustc_session::output::{collect_crate_types, find_crate_name}; use rustc_session::Session; use rustc_span::symbol::sym; use std::any::Any; @@ -128,7 +128,7 @@ impl<'tcx> Queries<'tcx> { // parse `#[crate_name]` even if `--crate-name` was passed, to make sure it matches. let crate_name = find_crate_name(sess, &pre_configured_attrs); - let crate_types = util::collect_crate_types(sess, &pre_configured_attrs); + let crate_types = collect_crate_types(sess, &pre_configured_attrs); let stable_crate_id = StableCrateId::new( crate_name, crate_types.contains(&CrateType::Executable), @@ -136,7 +136,7 @@ impl<'tcx> Queries<'tcx> { sess.cfg_version, ); let outputs = util::build_output_filenames(&pre_configured_attrs, sess); - let dep_graph = setup_dep_graph(sess, crate_name, stable_crate_id)?; + let dep_graph = setup_dep_graph(sess)?; let cstore = FreezeLock::new(Box::new(CStore::new( self.compiler.codegen_backend.metadata_loader(), diff --git a/compiler/rustc_interface/src/util.rs b/compiler/rustc_interface/src/util.rs index 829b00aabc126..7d48f90db3625 100644 --- a/compiler/rustc_interface/src/util.rs +++ b/compiler/rustc_interface/src/util.rs @@ -7,14 +7,15 @@ use rustc_data_structures::sync; use rustc_metadata::{load_symbol_from_dylib, DylibError}; use rustc_parse::validate_attr; use rustc_session as session; -use rustc_session::config::{self, Cfg, CrateType, OutFileName, OutputFilenames, OutputTypes}; +use rustc_session::config::{Cfg, OutFileName, OutputFilenames, OutputTypes}; use rustc_session::filesearch::sysroot_candidates; use rustc_session::lint::{self, BuiltinLintDiag, LintBuffer}; -use rustc_session::{filesearch, output, Session}; +use rustc_session::{filesearch, Session}; use rustc_span::edit_distance::find_best_match_for_name; use rustc_span::edition::Edition; -use rustc_span::symbol::{sym, Symbol}; +use rustc_span::symbol::sym; use rustc_target::spec::Target; +use session::output::{categorize_crate_type, CRATE_TYPES}; use session::EarlyDiagCtxt; use std::env::consts::{DLL_PREFIX, DLL_SUFFIX}; use std::path::{Path, PathBuf}; @@ -399,67 +400,6 @@ pub(crate) fn check_attr_crate_type( } } -const CRATE_TYPES: &[(Symbol, CrateType)] = &[ - (sym::rlib, CrateType::Rlib), - (sym::dylib, CrateType::Dylib), - (sym::cdylib, CrateType::Cdylib), - (sym::lib, config::default_lib_output()), - (sym::staticlib, CrateType::Staticlib), - (sym::proc_dash_macro, CrateType::ProcMacro), - (sym::bin, CrateType::Executable), -]; - -fn categorize_crate_type(s: Symbol) -> Option { - Some(CRATE_TYPES.iter().find(|(key, _)| *key == s)?.1) -} - -pub fn collect_crate_types(session: &Session, attrs: &[ast::Attribute]) -> Vec { - // If we're generating a test executable, then ignore all other output - // styles at all other locations - if session.opts.test { - return vec![CrateType::Executable]; - } - - // Only check command line flags if present. If no types are specified by - // command line, then reuse the empty `base` Vec to hold the types that - // will be found in crate attributes. - // JUSTIFICATION: before wrapper fn is available - #[allow(rustc::bad_opt_access)] - let mut base = session.opts.crate_types.clone(); - if base.is_empty() { - let attr_types = attrs.iter().filter_map(|a| { - if a.has_name(sym::crate_type) - && let Some(s) = a.value_str() - { - categorize_crate_type(s) - } else { - None - } - }); - base.extend(attr_types); - if base.is_empty() { - base.push(output::default_output_for_target(session)); - } else { - base.sort(); - base.dedup(); - } - } - - base.retain(|crate_type| { - if output::invalid_output_for_target(session, *crate_type) { - session.dcx().emit_warn(errors::UnsupportedCrateTypeForTarget { - crate_type: *crate_type, - target_triple: &session.opts.target_triple, - }); - false - } else { - true - } - }); - - base -} - fn multiple_output_types_to_stdout( output_types: &OutputTypes, single_output_file_is_stdout: bool, diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs index 595dc08b081ed..82a153c740027 100644 --- a/compiler/rustc_lint/src/builtin.rs +++ b/compiler/rustc_lint/src/builtin.rs @@ -2468,6 +2468,8 @@ impl<'tcx> LateLintPass<'tcx> for InvalidValue { ty: Ty<'tcx>, init: InitKind, ) -> Option { + let ty = cx.tcx.try_normalize_erasing_regions(cx.param_env, ty).unwrap_or(ty); + use rustc_type_ir::TyKind::*; match ty.kind() { // Primitive types that don't like 0 as a value. diff --git a/compiler/rustc_lint/src/late.rs b/compiler/rustc_lint/src/late.rs index d3d7698e7f927..506716e39a1e8 100644 --- a/compiler/rustc_lint/src/late.rs +++ b/compiler/rustc_lint/src/late.rs @@ -356,7 +356,7 @@ pub fn late_lint_mod<'tcx, T: LateLintPass<'tcx> + 'tcx>( cached_typeck_results: Cell::new(None), param_env: ty::ParamEnv::empty(), effective_visibilities: tcx.effective_visibilities(()), - last_node_with_lint_attrs: tcx.local_def_id_to_hir_id(module_def_id.into()), + last_node_with_lint_attrs: tcx.local_def_id_to_hir_id(module_def_id), generics: None, only_module: true, }; diff --git a/compiler/rustc_lint/src/levels.rs b/compiler/rustc_lint/src/levels.rs index e89df1c9840c6..95f312a31b332 100644 --- a/compiler/rustc_lint/src/levels.rs +++ b/compiler/rustc_lint/src/levels.rs @@ -103,11 +103,12 @@ impl LintLevelSets { mut idx: LintStackIndex, aux: Option<&FxIndexMap>, ) -> (Option, LintLevelSource) { - if let Some(specs) = aux { - if let Some(&(level, src)) = specs.get(&id) { - return (Some(level), src); - } + if let Some(specs) = aux + && let Some(&(level, src)) = specs.get(&id) + { + return (Some(level), src); } + loop { let LintSet { ref specs, parent } = self.list[idx]; if let Some(&(level, src)) = specs.get(&id) { @@ -177,7 +178,7 @@ fn shallow_lint_levels_on(tcx: TyCtxt<'_>, owner: hir::OwnerId) -> ShallowLintLe // There is only something to do if there are attributes at all. [] => {} // Most of the time, there is only one attribute. Avoid fetching HIR in that case. - [(local_id, _)] => levels.add_id(HirId { owner, local_id: *local_id }), + &[(local_id, _)] => levels.add_id(HirId { owner, local_id }), // Otherwise, we need to visit the attributes in source code order, so we fetch HIR and do // a standard visit. // FIXME(#102522) Just iterate on attrs once that iteration order matches HIR's. @@ -190,6 +191,7 @@ fn shallow_lint_levels_on(tcx: TyCtxt<'_>, owner: hir::OwnerId) -> ShallowLintLe levels.add_id(hir::CRATE_HIR_ID); levels.visit_mod(mod_, mod_.spans.inner_span, hir::CRATE_HIR_ID) } + hir::OwnerNode::AssocOpaqueTy(..) => unreachable!(), }, } @@ -643,63 +645,61 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> { // // This means that this only errors if we're truly lowering the lint // level from forbid. - if self.lint_added_lints && level != Level::Forbid { - if let Level::Forbid = old_level { - // Backwards compatibility check: - // - // We used to not consider `forbid(lint_group)` - // as preventing `allow(lint)` for some lint `lint` in - // `lint_group`. For now, issue a future-compatibility - // warning for this case. - let id_name = id.lint.name_lower(); - let fcw_warning = match old_src { - LintLevelSource::Default => false, - LintLevelSource::Node { name, .. } => self.store.is_lint_group(name), - LintLevelSource::CommandLine(symbol, _) => self.store.is_lint_group(symbol), - }; - debug!( - "fcw_warning={:?}, specs.get(&id) = {:?}, old_src={:?}, id_name={:?}", - fcw_warning, - self.current_specs(), - old_src, - id_name - ); - let sub = match old_src { - LintLevelSource::Default => { - OverruledAttributeSub::DefaultSource { id: id.to_string() } - } - LintLevelSource::Node { span, reason, .. } => { - OverruledAttributeSub::NodeSource { span, reason } - } - LintLevelSource::CommandLine(_, _) => OverruledAttributeSub::CommandLineSource, - }; - if !fcw_warning { - self.sess.dcx().emit_err(OverruledAttribute { - span: src.span(), + if self.lint_added_lints && level != Level::Forbid && old_level == Level::Forbid { + // Backwards compatibility check: + // + // We used to not consider `forbid(lint_group)` + // as preventing `allow(lint)` for some lint `lint` in + // `lint_group`. For now, issue a future-compatibility + // warning for this case. + let id_name = id.lint.name_lower(); + let fcw_warning = match old_src { + LintLevelSource::Default => false, + LintLevelSource::Node { name, .. } => self.store.is_lint_group(name), + LintLevelSource::CommandLine(symbol, _) => self.store.is_lint_group(symbol), + }; + debug!( + "fcw_warning={:?}, specs.get(&id) = {:?}, old_src={:?}, id_name={:?}", + fcw_warning, + self.current_specs(), + old_src, + id_name + ); + let sub = match old_src { + LintLevelSource::Default => { + OverruledAttributeSub::DefaultSource { id: id.to_string() } + } + LintLevelSource::Node { span, reason, .. } => { + OverruledAttributeSub::NodeSource { span, reason } + } + LintLevelSource::CommandLine(_, _) => OverruledAttributeSub::CommandLineSource, + }; + if !fcw_warning { + self.sess.dcx().emit_err(OverruledAttribute { + span: src.span(), + overruled: src.span(), + lint_level: level.as_str(), + lint_source: src.name(), + sub, + }); + } else { + self.emit_span_lint( + FORBIDDEN_LINT_GROUPS, + src.span().into(), + OverruledAttributeLint { overruled: src.span(), lint_level: level.as_str(), lint_source: src.name(), sub, - }); - } else { - self.emit_span_lint( - FORBIDDEN_LINT_GROUPS, - src.span().into(), - OverruledAttributeLint { - overruled: src.span(), - lint_level: level.as_str(), - lint_source: src.name(), - sub, - }, - ); - } + }, + ); + } - // Retain the forbid lint level, unless we are - // issuing a FCW. In the FCW case, we want to - // respect the new setting. - if !fcw_warning { - return; - } + // Retain the forbid lint level, unless we are + // issuing a FCW. In the FCW case, we want to + // respect the new setting. + if !fcw_warning { + return; } } @@ -770,15 +770,15 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> { let Some(mut metas) = attr.meta_item_list() else { continue }; - if metas.is_empty() { + // Check whether `metas` is empty, and get its last element. + let Some(tail_li) = metas.last() else { // This emits the unused_attributes lint for `#[level()]` continue; - } + }; // Before processing the lint names, look for a reason (RFC 2383) // at the end. let mut reason = None; - let tail_li = &metas[metas.len() - 1]; if let Some(item) = tail_li.meta_item() { match item.kind { ast::MetaItemKind::Word => {} // actual lint names handled later @@ -834,21 +834,16 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> { let meta_item = match li { ast::NestedMetaItem::MetaItem(meta_item) if meta_item.is_word() => meta_item, _ => { - if let Some(item) = li.meta_item() { - if let ast::MetaItemKind::NameValue(_) = item.kind { - if item.path == sym::reason { - sess.dcx().emit_err(MalformedAttribute { - span: sp, - sub: MalformedAttributeSub::ReasonMustComeLast(sp), - }); - continue; - } - } - } - sess.dcx().emit_err(MalformedAttribute { - span: sp, - sub: MalformedAttributeSub::BadAttributeArgument(sp), - }); + let sub = if let Some(item) = li.meta_item() + && let ast::MetaItemKind::NameValue(_) = item.kind + && item.path == sym::reason + { + MalformedAttributeSub::ReasonMustComeLast(sp) + } else { + MalformedAttributeSub::BadAttributeArgument(sp) + }; + + sess.dcx().emit_err(MalformedAttribute { span: sp, sub }); continue; } }; @@ -987,11 +982,7 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> { } CheckLintNameResult::NoLint(suggestion) => { - let name = if let Some(tool_ident) = tool_ident { - format!("{}::{}", tool_ident.name, name) - } else { - name.to_string() - }; + let name = tool_ident.map(|tool| format!("{tool}::{name}")).unwrap_or(name); let suggestion = suggestion.map(|(replace, from_rustc)| { UnknownLintSuggestion::WithSpan { suggestion: sp, replace, from_rustc } }); @@ -1005,27 +996,24 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> { if let CheckLintNameResult::Renamed(new_name) = lint_result { // Ignore any errors or warnings that happen because the new name is inaccurate // NOTE: `new_name` already includes the tool name, so we don't have to add it again. - if let CheckLintNameResult::Ok(ids) = + let CheckLintNameResult::Ok(ids) = self.store.check_lint_name(&new_name, None, self.registered_tools) - { - let src = LintLevelSource::Node { - name: Symbol::intern(&new_name), - span: sp, - reason, - }; - for &id in ids { - if self.check_gated_lint(id, attr.span, false) { - self.insert_spec(id, (level, src)); - } - } - if let Level::Expect(expect_id) = level { - self.provider.push_expectation( - expect_id, - LintExpectation::new(reason, sp, false, tool_name), - ); - } - } else { + else { panic!("renamed lint does not exist: {new_name}"); + }; + + let src = + LintLevelSource::Node { name: Symbol::intern(&new_name), span: sp, reason }; + for &id in ids { + if self.check_gated_lint(id, attr.span, false) { + self.insert_spec(id, (level, src)); + } + } + if let Level::Expect(expect_id) = level { + self.provider.push_expectation( + expect_id, + LintExpectation::new(reason, sp, false, tool_name), + ); } } } @@ -1058,38 +1046,44 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> { /// Returns `true` if the lint's feature is enabled. #[track_caller] fn check_gated_lint(&self, lint_id: LintId, span: Span, lint_from_cli: bool) -> bool { - if let Some(feature) = lint_id.lint.feature_gate { - if !self.features.active(feature) { - if self.lint_added_lints { - let lint = builtin::UNKNOWN_LINTS; - let (level, src) = self.lint_level(builtin::UNKNOWN_LINTS); - // FIXME: make this translatable - #[allow(rustc::diagnostic_outside_of_impl)] - #[allow(rustc::untranslatable_diagnostic)] - lint_level( - self.sess, + let feature = if let Some(feature) = lint_id.lint.feature_gate + && !self.features.active(feature) + { + // Lint is behind a feature that is not enabled; eventually return false. + feature + } else { + // Lint is ungated or its feature is enabled; exit early. + return true; + }; + + if self.lint_added_lints { + let lint = builtin::UNKNOWN_LINTS; + let (level, src) = self.lint_level(builtin::UNKNOWN_LINTS); + // FIXME: make this translatable + #[allow(rustc::diagnostic_outside_of_impl)] + #[allow(rustc::untranslatable_diagnostic)] + lint_level( + self.sess, + lint, + level, + src, + Some(span.into()), + fluent::lint_unknown_gated_lint, + |lint| { + lint.arg("name", lint_id.lint.name_lower()); + lint.note(fluent::lint_note); + rustc_session::parse::add_feature_diagnostics_for_issue( lint, - level, - src, - Some(span.into()), - fluent::lint_unknown_gated_lint, - |lint| { - lint.arg("name", lint_id.lint.name_lower()); - lint.note(fluent::lint_note); - rustc_session::parse::add_feature_diagnostics_for_issue( - lint, - &self.sess, - feature, - GateIssue::Language, - lint_from_cli, - ); - }, + &self.sess, + feature, + GateIssue::Language, + lint_from_cli, ); - } - return false; - } + }, + ); } - true + + false } /// Find the lint level for a lint. diff --git a/compiler/rustc_lint/src/types.rs b/compiler/rustc_lint/src/types.rs index 5d36a8b3d0e9c..500efefbb1198 100644 --- a/compiler/rustc_lint/src/types.rs +++ b/compiler/rustc_lint/src/types.rs @@ -984,7 +984,14 @@ pub fn transparent_newtype_field<'a, 'tcx>( } /// Is type known to be non-null? -fn ty_is_known_nonnull<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, mode: CItemKind) -> bool { +fn ty_is_known_nonnull<'tcx>( + tcx: TyCtxt<'tcx>, + param_env: ty::ParamEnv<'tcx>, + ty: Ty<'tcx>, + mode: CItemKind, +) -> bool { + let ty = tcx.try_normalize_erasing_regions(param_env, ty).unwrap_or(ty); + match ty.kind() { ty::FnPtr(_) => true, ty::Ref(..) => true, @@ -1004,7 +1011,7 @@ fn ty_is_known_nonnull<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, mode: CItemKind) - def.variants() .iter() .filter_map(|variant| transparent_newtype_field(tcx, variant)) - .any(|field| ty_is_known_nonnull(tcx, field.ty(tcx, args), mode)) + .any(|field| ty_is_known_nonnull(tcx, param_env, field.ty(tcx, args), mode)) } _ => false, } @@ -1012,7 +1019,13 @@ fn ty_is_known_nonnull<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, mode: CItemKind) - /// Given a non-null scalar (or transparent) type `ty`, return the nullable version of that type. /// If the type passed in was not scalar, returns None. -fn get_nullable_type<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> Option> { +fn get_nullable_type<'tcx>( + tcx: TyCtxt<'tcx>, + param_env: ty::ParamEnv<'tcx>, + ty: Ty<'tcx>, +) -> Option> { + let ty = tcx.try_normalize_erasing_regions(param_env, ty).unwrap_or(ty); + Some(match *ty.kind() { ty::Adt(field_def, field_args) => { let inner_field_ty = { @@ -1028,22 +1041,19 @@ fn get_nullable_type<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> Option> .expect("No non-zst fields in transparent type.") .ty(tcx, field_args) }; - return get_nullable_type(tcx, inner_field_ty); + return get_nullable_type(tcx, param_env, inner_field_ty); } ty::Int(ty) => Ty::new_int(tcx, ty), ty::Uint(ty) => Ty::new_uint(tcx, ty), ty::RawPtr(ty_mut) => Ty::new_ptr(tcx, ty_mut), // As these types are always non-null, the nullable equivalent of - // Option of these types are their raw pointer counterparts. + // `Option` of these types are their raw pointer counterparts. ty::Ref(_region, ty, mutbl) => Ty::new_ptr(tcx, ty::TypeAndMut { ty, mutbl }), - ty::FnPtr(..) => { - // There is no nullable equivalent for Rust's function pointers -- you - // must use an Option _> to represent it. - ty - } - - // We should only ever reach this case if ty_is_known_nonnull is extended - // to other types. + // There is no nullable equivalent for Rust's function pointers, + // you must use an `Option _>` to represent it. + ty::FnPtr(..) => ty, + // We should only ever reach this case if `ty_is_known_nonnull` is + // extended to other types. ref unhandled => { debug!( "get_nullable_type: Unhandled scalar kind: {:?} while checking {:?}", @@ -1056,7 +1066,7 @@ fn get_nullable_type<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> Option> /// Check if this enum can be safely exported based on the "nullable pointer optimization". If it /// can, return the type that `ty` can be safely converted to, otherwise return `None`. -/// Currently restricted to function pointers, boxes, references, `core::num::NonZero*`, +/// Currently restricted to function pointers, boxes, references, `core::num::NonZero`, /// `core::ptr::NonNull`, and `#[repr(transparent)]` newtypes. /// FIXME: This duplicates code in codegen. pub(crate) fn repr_nullable_ptr<'tcx>( @@ -1075,7 +1085,7 @@ pub(crate) fn repr_nullable_ptr<'tcx>( _ => return None, }; - if !ty_is_known_nonnull(tcx, field_ty, ckind) { + if !ty_is_known_nonnull(tcx, param_env, field_ty, ckind) { return None; } @@ -1099,10 +1109,10 @@ pub(crate) fn repr_nullable_ptr<'tcx>( WrappingRange { start: 0, end } if end == field_ty_scalar.size(&tcx).unsigned_int_max() - 1 => { - return Some(get_nullable_type(tcx, field_ty).unwrap()); + return Some(get_nullable_type(tcx, param_env, field_ty).unwrap()); } WrappingRange { start: 1, .. } => { - return Some(get_nullable_type(tcx, field_ty).unwrap()); + return Some(get_nullable_type(tcx, param_env, field_ty).unwrap()); } WrappingRange { start, end } => { unreachable!("Unhandled start and end range: ({}, {})", start, end) diff --git a/compiler/rustc_middle/src/arena.rs b/compiler/rustc_middle/src/arena.rs index a532635669dfd..c90427256b85f 100644 --- a/compiler/rustc_middle/src/arena.rs +++ b/compiler/rustc_middle/src/arena.rs @@ -115,6 +115,7 @@ macro_rules! arena_types { [] features: rustc_feature::Features, [decode] specialization_graph: rustc_middle::traits::specialization_graph::Graph, [] crate_inherent_impls: rustc_middle::ty::CrateInherentImpls, + [] hir_owner_nodes: rustc_hir::OwnerNodes<'tcx>, ]); ) } diff --git a/compiler/rustc_middle/src/hir/map/mod.rs b/compiler/rustc_middle/src/hir/map/mod.rs index c05da36235851..a64fa74762c04 100644 --- a/compiler/rustc_middle/src/hir/map/mod.rs +++ b/compiler/rustc_middle/src/hir/map/mod.rs @@ -161,7 +161,7 @@ impl<'tcx> TyCtxt<'tcx> { /// Retrieves the `hir::Node` corresponding to `id`, returning `None` if cannot be found. #[inline] pub fn opt_hir_node_by_def_id(self, id: LocalDefId) -> Option> { - Some(self.hir_node(self.opt_local_def_id_to_hir_id(id)?)) + Some(self.hir_node_by_def_id(id)) } /// Retrieves the `hir::Node` corresponding to `id`. @@ -169,12 +169,10 @@ impl<'tcx> TyCtxt<'tcx> { self.hir_owner_nodes(id.owner).nodes[id.local_id].node } - /// Retrieves the `hir::Node` corresponding to `id`, panicking if it cannot be found. + /// Retrieves the `hir::Node` corresponding to `id`. #[inline] - #[track_caller] pub fn hir_node_by_def_id(self, id: LocalDefId) -> Node<'tcx> { - self.opt_hir_node_by_def_id(id) - .unwrap_or_else(|| bug!("couldn't find HIR node for def id {id:?}")) + self.hir_node(self.local_def_id_to_hir_id(id)) } /// Returns `HirId` of the parent HIR node of node with this `hir_id`. @@ -963,6 +961,7 @@ impl<'hir> Map<'hir> { Node::Crate(item) => item.spans.inner_span, Node::WhereBoundPredicate(pred) => pred.span, Node::ArrayLenInfer(inf) => inf.span, + Node::AssocOpaqueTy(..) => unreachable!(), Node::Err(span) => *span, } } @@ -1227,6 +1226,7 @@ fn hir_id_to_string(map: Map<'_>, id: HirId) -> String { Node::Crate(..) => String::from("(root_crate)"), Node::WhereBoundPredicate(_) => node_str("where bound predicate"), Node::ArrayLenInfer(_) => node_str("array len infer"), + Node::AssocOpaqueTy(..) => unreachable!(), Node::Err(_) => node_str("error"), } } diff --git a/compiler/rustc_middle/src/hir/mod.rs b/compiler/rustc_middle/src/hir/mod.rs index 4ef9bc16221f2..61bdb5d4bb705 100644 --- a/compiler/rustc_middle/src/hir/mod.rs +++ b/compiler/rustc_middle/src/hir/mod.rs @@ -127,12 +127,10 @@ pub fn provide(providers: &mut Providers) { providers.hir_crate_items = map::hir_crate_items; providers.crate_hash = map::crate_hash; providers.hir_module_items = map::hir_module_items; - providers.opt_local_def_id_to_hir_id = |tcx, def_id| { - Some(match tcx.hir_crate(()).owners[def_id] { - MaybeOwner::Owner(_) => HirId::make_owner(def_id), - MaybeOwner::NonOwner(hir_id) => hir_id, - MaybeOwner::Phantom => bug!("No HirId for {:?}", def_id), - }) + providers.local_def_id_to_hir_id = |tcx, def_id| match tcx.hir_crate(()).owners[def_id] { + MaybeOwner::Owner(_) => HirId::make_owner(def_id), + MaybeOwner::NonOwner(hir_id) => hir_id, + MaybeOwner::Phantom => bug!("No HirId for {:?}", def_id), }; providers.opt_hir_owner_nodes = |tcx, id| tcx.hir_crate(()).owners.get(id)?.as_owner().map(|i| &i.nodes); diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs index 83ded5859c67e..865299e15c803 100644 --- a/compiler/rustc_middle/src/query/mod.rs +++ b/compiler/rustc_middle/src/query/mod.rs @@ -174,10 +174,8 @@ rustc_queries! { cache_on_disk_if { true } } - /// Gives access to the HIR ID for the given `LocalDefId` owner `key` if any. - /// - /// Definitions that were generated with no HIR, would be fed to return `None`. - query opt_local_def_id_to_hir_id(key: LocalDefId) -> Option{ + /// Returns HIR ID for the given `LocalDefId`. + query local_def_id_to_hir_id(key: LocalDefId) -> hir::HirId { desc { |tcx| "getting HIR ID of `{}`", tcx.def_path_str(key) } feedable } @@ -196,6 +194,7 @@ rustc_queries! { /// Avoid calling this query directly. query opt_hir_owner_nodes(key: LocalDefId) -> Option<&'tcx hir::OwnerNodes<'tcx>> { desc { |tcx| "getting HIR owner items in `{}`", tcx.def_path_str(key) } + feedable } /// Gives access to the HIR attributes inside the HIR owner `key`. @@ -204,6 +203,7 @@ rustc_queries! { /// Avoid calling this query directly. query hir_attrs(key: hir::OwnerId) -> &'tcx hir::AttributeMap<'tcx> { desc { |tcx| "getting HIR owner attributes in `{}`", tcx.def_path_str(key) } + feedable } /// Given the def_id of a const-generic parameter, computes the associated default const diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index c415c06c21b96..5362b6d8b24ca 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -589,6 +589,11 @@ impl<'tcx> TyCtxtFeed<'tcx, LocalDefId> { pub fn def_id(&self) -> LocalDefId { self.key } + + // Caller must ensure that `self.key` ID is indeed an owner. + pub fn feed_owner_id(&self) -> TyCtxtFeed<'tcx, hir::OwnerId> { + TyCtxtFeed { tcx: self.tcx, key: hir::OwnerId { def_id: self.key } } + } } /// The central data structure of the compiler. It stores references @@ -2350,8 +2355,8 @@ impl<'tcx> TyCtxt<'tcx> { self.intrinsic_raw(def_id) } - pub fn local_def_id_to_hir_id(self, local_def_id: LocalDefId) -> HirId { - self.opt_local_def_id_to_hir_id(local_def_id).unwrap() + pub fn opt_local_def_id_to_hir_id(self, local_def_id: LocalDefId) -> Option { + Some(self.local_def_id_to_hir_id(local_def_id)) } pub fn next_trait_solver_globally(self) -> bool { diff --git a/compiler/rustc_passes/src/reachable.rs b/compiler/rustc_passes/src/reachable.rs index e86c0522b3cd4..2a78f47c34f67 100644 --- a/compiler/rustc_passes/src/reachable.rs +++ b/compiler/rustc_passes/src/reachable.rs @@ -270,7 +270,8 @@ impl<'tcx> ReachableContext<'tcx> { | Node::Ctor(..) | Node::Field(_) | Node::Ty(_) - | Node::Crate(_) => {} + | Node::Crate(_) + | Node::AssocOpaqueTy(..) => {} _ => { bug!( "found unexpected node kind in worklist: {} ({:?})", diff --git a/compiler/rustc_session/messages.ftl b/compiler/rustc_session/messages.ftl index af8c962a2ed6a..42c681e496174 100644 --- a/compiler/rustc_session/messages.ftl +++ b/compiler/rustc_session/messages.ftl @@ -111,4 +111,7 @@ session_unleashed_feature_help_unnamed = skipping check that does not even have session_unstable_virtual_function_elimination = `-Zvirtual-function-elimination` requires `-Clto` +session_unsupported_crate_type_for_target = + dropping unsupported crate type `{$crate_type}` for target `{$target_triple}` + session_unsupported_dwarf_version = requested DWARF version {$dwarf_version} is greater than 5 diff --git a/compiler/rustc_session/src/errors.rs b/compiler/rustc_session/src/errors.rs index 5f04915a9e755..d523da1ad7e38 100644 --- a/compiler/rustc_session/src/errors.rs +++ b/compiler/rustc_session/src/errors.rs @@ -10,7 +10,7 @@ use rustc_macros::Diagnostic; use rustc_span::{Span, Symbol}; use rustc_target::spec::{SplitDebuginfo, StackProtector, TargetTriple}; -use crate::parse::ParseSess; +use crate::{config::CrateType, parse::ParseSess}; pub struct FeatureGateError { pub span: MultiSpan, @@ -345,6 +345,13 @@ pub(crate) struct BinaryFloatLiteralNotSupported { pub span: Span, } +#[derive(Diagnostic)] +#[diag(session_unsupported_crate_type_for_target)] +pub struct UnsupportedCrateTypeForTarget<'a> { + pub crate_type: CrateType, + pub target_triple: &'a TargetTriple, +} + pub fn report_lit_error( psess: &ParseSess, err: LitError, diff --git a/compiler/rustc_session/src/output.rs b/compiler/rustc_session/src/output.rs index 74d26237f2463..35cd3cbab66ce 100644 --- a/compiler/rustc_session/src/output.rs +++ b/compiler/rustc_session/src/output.rs @@ -1,7 +1,7 @@ //! Related to out filenames of compilation (e.g. binaries). -use crate::config::{CrateType, Input, OutFileName, OutputFilenames, OutputType}; +use crate::config::{self, CrateType, Input, OutFileName, OutputFilenames, OutputType}; use crate::errors::{ - CrateNameDoesNotMatch, CrateNameEmpty, CrateNameInvalid, FileIsNotWriteable, + self, CrateNameDoesNotMatch, CrateNameEmpty, CrateNameInvalid, FileIsNotWriteable, InvalidCharacterInCrateName, InvalidCrateNameHelp, }; use crate::Session; @@ -200,3 +200,64 @@ pub fn invalid_output_for_target(sess: &Session, crate_type: CrateType) -> bool false } + +pub const CRATE_TYPES: &[(Symbol, CrateType)] = &[ + (sym::rlib, CrateType::Rlib), + (sym::dylib, CrateType::Dylib), + (sym::cdylib, CrateType::Cdylib), + (sym::lib, config::default_lib_output()), + (sym::staticlib, CrateType::Staticlib), + (sym::proc_dash_macro, CrateType::ProcMacro), + (sym::bin, CrateType::Executable), +]; + +pub fn categorize_crate_type(s: Symbol) -> Option { + Some(CRATE_TYPES.iter().find(|(key, _)| *key == s)?.1) +} + +pub fn collect_crate_types(session: &Session, attrs: &[ast::Attribute]) -> Vec { + // If we're generating a test executable, then ignore all other output + // styles at all other locations + if session.opts.test { + return vec![CrateType::Executable]; + } + + // Only check command line flags if present. If no types are specified by + // command line, then reuse the empty `base` Vec to hold the types that + // will be found in crate attributes. + // JUSTIFICATION: before wrapper fn is available + #[allow(rustc::bad_opt_access)] + let mut base = session.opts.crate_types.clone(); + if base.is_empty() { + let attr_types = attrs.iter().filter_map(|a| { + if a.has_name(sym::crate_type) + && let Some(s) = a.value_str() + { + categorize_crate_type(s) + } else { + None + } + }); + base.extend(attr_types); + if base.is_empty() { + base.push(default_output_for_target(session)); + } else { + base.sort(); + base.dedup(); + } + } + + base.retain(|crate_type| { + if invalid_output_for_target(session, *crate_type) { + session.dcx().emit_warn(errors::UnsupportedCrateTypeForTarget { + crate_type: *crate_type, + target_triple: &session.opts.target_triple, + }); + false + } else { + true + } + }); + + base +} diff --git a/compiler/rustc_smir/src/rustc_smir/context.rs b/compiler/rustc_smir/src/rustc_smir/context.rs index 8488777eda994..509f0def2568e 100644 --- a/compiler/rustc_smir/src/rustc_smir/context.rs +++ b/compiler/rustc_smir/src/rustc_smir/context.rs @@ -23,7 +23,8 @@ use stable_mir::mir::Body; use stable_mir::target::{MachineInfo, MachineSize}; use stable_mir::ty::{ AdtDef, AdtKind, Allocation, ClosureDef, ClosureKind, Const, FieldDef, FnDef, ForeignDef, - ForeignItemKind, GenericArgs, LineInfo, PolyFnSig, RigidTy, Span, Ty, TyKind, VariantDef, + ForeignItemKind, GenericArgs, LineInfo, PolyFnSig, RigidTy, Span, Ty, TyKind, UintTy, + VariantDef, }; use stable_mir::{Crate, CrateDef, CrateItem, CrateNum, DefId, Error, Filename, ItemKind, Symbol}; use std::cell::RefCell; @@ -341,15 +342,56 @@ impl<'tcx> Context for TablesWrapper<'tcx> { .ok_or_else(|| Error::new(format!("Const `{cnst:?}` cannot be encoded as u64"))) } - fn usize_to_const(&self, val: u64) -> Result { + fn try_new_const_zst(&self, ty: Ty) -> Result { let mut tables = self.0.borrow_mut(); - let ty = tables.tcx.types.usize; + let tcx = tables.tcx; + let ty_internal = ty.internal(&mut *tables, tcx); + let size = tables + .tcx + .layout_of(ParamEnv::empty().and(ty_internal)) + .map_err(|err| { + Error::new(format!( + "Cannot create a zero-sized constant for type `{ty_internal}`: {err}" + )) + })? + .size; + if size.bytes() != 0 { + return Err(Error::new(format!( + "Cannot create a zero-sized constant for type `{ty_internal}`: \ + Type `{ty_internal}` has {} bytes", + size.bytes() + ))); + } + + Ok(ty::Const::zero_sized(tables.tcx, ty_internal).stable(&mut *tables)) + } + + fn new_const_str(&self, value: &str) -> Const { + let mut tables = self.0.borrow_mut(); + let tcx = tables.tcx; + let ty = ty::Ty::new_static_str(tcx); + let bytes = value.as_bytes(); + let val_tree = ty::ValTree::from_raw_bytes(tcx, bytes); + + ty::Const::new_value(tcx, val_tree, ty).stable(&mut *tables) + } + + fn new_const_bool(&self, value: bool) -> Const { + let mut tables = self.0.borrow_mut(); + ty::Const::from_bool(tables.tcx, value).stable(&mut *tables) + } + + fn try_new_const_uint(&self, value: u128, uint_ty: UintTy) -> Result { + let mut tables = self.0.borrow_mut(); + let tcx = tables.tcx; + let ty = ty::Ty::new_uint(tcx, uint_ty.internal(&mut *tables, tcx)); let size = tables.tcx.layout_of(ParamEnv::empty().and(ty)).unwrap().size; - let scalar = ScalarInt::try_from_uint(val, size).ok_or_else(|| { - Error::new(format!("Value overflow: cannot convert `{val}` to usize.")) + // We don't use Const::from_bits since it doesn't have any error checking. + let scalar = ScalarInt::try_from_uint(value, size).ok_or_else(|| { + Error::new(format!("Value overflow: cannot convert `{value}` to `{ty}`.")) })?; - Ok(rustc_middle::ty::Const::new_value(tables.tcx, ValTree::from_scalar_int(scalar), ty) + Ok(ty::Const::new_value(tables.tcx, ValTree::from_scalar_int(scalar), ty) .stable(&mut *tables)) } @@ -556,7 +598,9 @@ impl<'tcx> Context for TablesWrapper<'tcx> { global_alloc: &GlobalAlloc, ) -> Option { let mut tables = self.0.borrow_mut(); - let GlobalAlloc::VTable(ty, trait_ref) = global_alloc else { return None }; + let GlobalAlloc::VTable(ty, trait_ref) = global_alloc else { + return None; + }; let tcx = tables.tcx; let alloc_id = tables.tcx.vtable_allocation(( ty.internal(&mut *tables, tcx), diff --git a/compiler/rustc_ty_utils/src/assoc.rs b/compiler/rustc_ty_utils/src/assoc.rs index 26d3370469a5d..3f628092190b5 100644 --- a/compiler/rustc_ty_utils/src/assoc.rs +++ b/compiler/rustc_ty_utils/src/assoc.rs @@ -1,10 +1,11 @@ use rustc_data_structures::fx::FxIndexSet; -use rustc_hir as hir; use rustc_hir::def::DefKind; use rustc_hir::def_id::{DefId, DefIdMap, LocalDefId}; use rustc_hir::intravisit::{self, Visitor}; +use rustc_hir::{self as hir, HirId}; +use rustc_index::IndexVec; use rustc_middle::query::Providers; -use rustc_middle::ty::{self, ImplTraitInTraitData, TyCtxt}; +use rustc_middle::ty::{self, ImplTraitInTraitData, TyCtxt, TyCtxtFeed}; use rustc_span::symbol::kw; pub(crate) fn provide(providers: &mut Providers) { @@ -237,6 +238,22 @@ fn associated_types_for_impl_traits_in_associated_fn( } } +fn feed_hir(feed: &TyCtxtFeed<'_, LocalDefId>) { + feed.local_def_id_to_hir_id(HirId::make_owner(feed.def_id())); + feed.opt_hir_owner_nodes(Some(feed.tcx.arena.alloc(hir::OwnerNodes { + opt_hash_including_bodies: None, + nodes: IndexVec::from_elem_n( + hir::ParentedNode { + parent: hir::ItemLocalId::INVALID, + node: hir::Node::AssocOpaqueTy(&hir::AssocOpaqueTy {}), + }, + 1, + ), + bodies: Default::default(), + }))); + feed.feed_owner_id().hir_attrs(hir::AttributeMap::EMPTY); +} + /// Given an `opaque_ty_def_id` corresponding to an `impl Trait` in an associated /// function from a trait, synthesize an associated type for that `impl Trait` /// that inherits properties that we infer from the method and the opaque type. @@ -258,9 +275,7 @@ fn associated_type_for_impl_trait_in_trait( let local_def_id = trait_assoc_ty.def_id(); let def_id = local_def_id.to_def_id(); - // There's no HIR associated with this new synthesized `def_id`, so feed - // `opt_local_def_id_to_hir_id` with `None`. - trait_assoc_ty.opt_local_def_id_to_hir_id(None); + feed_hir(&trait_assoc_ty); // Copy span of the opaque. trait_assoc_ty.def_ident_span(Some(span)); @@ -318,9 +333,7 @@ fn associated_type_for_impl_trait_in_impl( let local_def_id = impl_assoc_ty.def_id(); let def_id = local_def_id.to_def_id(); - // There's no HIR associated with this new synthesized `def_id`, so feed - // `opt_local_def_id_to_hir_id` with `None`. - impl_assoc_ty.opt_local_def_id_to_hir_id(None); + feed_hir(&impl_assoc_ty); // Copy span of the opaque. impl_assoc_ty.def_ident_span(Some(span)); diff --git a/compiler/stable_mir/src/compiler_interface.rs b/compiler/stable_mir/src/compiler_interface.rs index 1c51c175d81b5..f53dbcfbd966e 100644 --- a/compiler/stable_mir/src/compiler_interface.rs +++ b/compiler/stable_mir/src/compiler_interface.rs @@ -14,7 +14,7 @@ use crate::ty::{ AdtDef, AdtKind, Allocation, ClosureDef, ClosureKind, Const, FieldDef, FnDef, ForeignDef, ForeignItemKind, ForeignModule, ForeignModuleDef, GenericArgs, GenericPredicates, Generics, ImplDef, ImplTrait, LineInfo, PolyFnSig, RigidTy, Span, TraitDecl, TraitDef, Ty, TyKind, - VariantDef, + UintTy, VariantDef, }; use crate::{ mir, Crate, CrateItem, CrateItems, CrateNum, DefId, Error, Filename, ImplTraitDecls, ItemKind, @@ -101,8 +101,17 @@ pub trait Context { /// Evaluate constant as a target usize. fn eval_target_usize(&self, cnst: &Const) -> Result; - /// Create a target usize constant for the given value. - fn usize_to_const(&self, val: u64) -> Result; + /// Create a new zero-sized constant. + fn try_new_const_zst(&self, ty: Ty) -> Result; + + /// Create a new constant that represents the given string value. + fn new_const_str(&self, value: &str) -> Const; + + /// Create a new constant that represents the given boolean value. + fn new_const_bool(&self, value: bool) -> Const; + + /// Create a new constant that represents the given value. + fn try_new_const_uint(&self, value: u128, uint_ty: UintTy) -> Result; /// Create a new type from the given kind. fn new_rigid_ty(&self, kind: RigidTy) -> Ty; @@ -200,7 +209,7 @@ pub trait Context { // A thread local variable that stores a pointer to the tables mapping between TyCtxt // datastructures and stable MIR datastructures -scoped_thread_local! (static TLV: Cell<*const ()>); +scoped_thread_local!(static TLV: Cell<*const ()>); pub fn run(context: &dyn Context, f: F) -> Result where diff --git a/compiler/stable_mir/src/ty.rs b/compiler/stable_mir/src/ty.rs index 86cc748eaec93..a337675202871 100644 --- a/compiler/stable_mir/src/ty.rs +++ b/compiler/stable_mir/src/ty.rs @@ -128,13 +128,38 @@ impl Const { /// Creates an interned usize constant. fn try_from_target_usize(val: u64) -> Result { - with(|cx| cx.usize_to_const(val)) + with(|cx| cx.try_new_const_uint(val.into(), UintTy::Usize)) } /// Try to evaluate to a target `usize`. pub fn eval_target_usize(&self) -> Result { with(|cx| cx.eval_target_usize(self)) } + + /// Create a constant that represents a new zero-sized constant of type T. + /// Fails if the type is not a ZST or if it doesn't have a known size. + pub fn try_new_zero_sized(ty: Ty) -> Result { + with(|cx| cx.try_new_const_zst(ty)) + } + + /// Build a new constant that represents the given string. + /// + /// Note that there is no guarantee today about duplication of the same constant. + /// I.e.: Calling this function multiple times with the same argument may or may not return + /// the same allocation. + pub fn from_str(value: &str) -> Const { + with(|cx| cx.new_const_str(value)) + } + + /// Build a new constant that represents the given boolean value. + pub fn from_bool(value: bool) -> Const { + with(|cx| cx.new_const_bool(value)) + } + + /// Build a new constant that represents the given unsigned integer. + pub fn try_from_uint(value: u128, uint_ty: UintTy) -> Result { + with(|cx| cx.try_new_const_uint(value, uint_ty)) + } } #[derive(Clone, Copy, Debug, PartialEq, Eq)] diff --git a/library/core/src/ffi/c_str.rs b/library/core/src/ffi/c_str.rs index 111fb83088b82..30debbffec1aa 100644 --- a/library/core/src/ffi/c_str.rs +++ b/library/core/src/ffi/c_str.rs @@ -5,8 +5,11 @@ use crate::error::Error; use crate::ffi::c_char; use crate::fmt; use crate::intrinsics; +use crate::iter::FusedIterator; +use crate::marker::PhantomData; use crate::ops; use crate::ptr::addr_of; +use crate::ptr::NonNull; use crate::slice; use crate::slice::memchr; use crate::str; @@ -504,6 +507,13 @@ impl CStr { self.inner.as_ptr() } + /// We could eventually expose this publicly, if we wanted. + #[inline] + #[must_use] + const fn as_non_null_ptr(&self) -> NonNull { + NonNull::from(&self.inner).as_non_null_ptr() + } + /// Returns the length of `self`. Like C's `strlen`, this does not include the nul terminator. /// /// > **Note**: This method is currently implemented as a constant-time @@ -617,6 +627,26 @@ impl CStr { unsafe { &*(addr_of!(self.inner) as *const [u8]) } } + /// Iterates over the bytes in this C string. + /// + /// The returned iterator will **not** contain the trailing nul terminator + /// that this C string has. + /// + /// # Examples + /// + /// ``` + /// #![feature(cstr_bytes)] + /// use std::ffi::CStr; + /// + /// let cstr = CStr::from_bytes_with_nul(b"foo\0").expect("CStr::from_bytes_with_nul failed"); + /// assert!(cstr.bytes().eq(*b"foo")); + /// ``` + #[inline] + #[unstable(feature = "cstr_bytes", issue = "112115")] + pub fn bytes(&self) -> Bytes<'_> { + Bytes::new(self) + } + /// Yields a &[str] slice if the `CStr` contains valid UTF-8. /// /// If the contents of the `CStr` are valid UTF-8 data, this @@ -735,3 +765,64 @@ const unsafe fn const_strlen(ptr: *const c_char) -> usize { intrinsics::const_eval_select((ptr,), strlen_ct, strlen_rt) } } + +/// An iterator over the bytes of a [`CStr`], without the nul terminator. +/// +/// This struct is created by the [`bytes`] method on [`CStr`]. +/// See its documentation for more. +/// +/// [`bytes`]: CStr::bytes +#[must_use = "iterators are lazy and do nothing unless consumed"] +#[unstable(feature = "cstr_bytes", issue = "112115")] +#[derive(Clone, Debug)] +pub struct Bytes<'a> { + // since we know the string is nul-terminated, we only need one pointer + ptr: NonNull, + phantom: PhantomData<&'a u8>, +} +impl<'a> Bytes<'a> { + #[inline] + fn new(s: &'a CStr) -> Self { + Self { ptr: s.as_non_null_ptr().cast(), phantom: PhantomData } + } + + #[inline] + fn is_empty(&self) -> bool { + // SAFETY: We uphold that the pointer is always valid to dereference + // by starting with a valid C string and then never incrementing beyond + // the nul terminator. + unsafe { self.ptr.read() == 0 } + } +} + +#[unstable(feature = "cstr_bytes", issue = "112115")] +impl Iterator for Bytes<'_> { + type Item = u8; + + #[inline] + fn next(&mut self) -> Option { + // SAFETY: We only choose a pointer from a valid C string, which must + // be non-null and contain at least one value. Since we always stop at + // the nul terminator, which is guaranteed to exist, we can assume that + // the pointer is non-null and valid. This lets us safely dereference + // it and assume that adding 1 will create a new, non-null, valid + // pointer. + unsafe { + let ret = self.ptr.read(); + if ret == 0 { + None + } else { + self.ptr = self.ptr.offset(1); + Some(ret) + } + } + } + + #[inline] + fn size_hint(&self) -> (usize, Option) { + if self.is_empty() { (0, Some(0)) } else { (1, None) } + } +} + +#[unstable(feature = "cstr_bytes", issue = "112115")] +impl FusedIterator for Bytes<'_> {} diff --git a/library/core/src/num/nonzero.rs b/library/core/src/num/nonzero.rs index 6cbcac20ea1b4..85089fae60801 100644 --- a/library/core/src/num/nonzero.rs +++ b/library/core/src/num/nonzero.rs @@ -6,21 +6,13 @@ use crate::hash::{Hash, Hasher}; use crate::intrinsics; use crate::marker::StructuralPartialEq; use crate::ops::{BitOr, BitOrAssign, Div, Neg, Rem}; +use crate::panic::{RefUnwindSafe, UnwindSafe}; +use crate::ptr; use crate::str::FromStr; use super::from_str_radix; use super::{IntErrorKind, ParseIntError}; -mod private { - #[unstable( - feature = "nonzero_internals", - reason = "implementation detail which may disappear or be replaced at any time", - issue = "none" - )] - #[const_trait] - pub trait Sealed {} -} - /// A marker trait for primitive types which can be zero. /// /// This is an implementation detail for [NonZero]\ which may disappear or be replaced at any time. @@ -34,38 +26,70 @@ mod private { issue = "none" )] #[const_trait] -pub unsafe trait ZeroablePrimitive: Sized + Copy + private::Sealed {} +pub unsafe trait ZeroablePrimitive: Sized + Copy + private::Sealed { + #[doc(hidden)] + type NonZeroInner: Sized + Copy; +} macro_rules! impl_zeroable_primitive { - ($primitive:ty) => { - #[unstable( - feature = "nonzero_internals", - reason = "implementation detail which may disappear or be replaced at any time", - issue = "none" - )] - impl const private::Sealed for $primitive {} - - #[unstable( - feature = "nonzero_internals", - reason = "implementation detail which may disappear or be replaced at any time", - issue = "none" - )] - unsafe impl const ZeroablePrimitive for $primitive {} + ($($NonZeroInner:ident ( $primitive:ty )),+ $(,)?) => { + mod private { + #[unstable( + feature = "nonzero_internals", + reason = "implementation detail which may disappear or be replaced at any time", + issue = "none" + )] + #[const_trait] + pub trait Sealed {} + + $( + #[derive(Debug, Clone, Copy, PartialEq)] + #[repr(transparent)] + #[rustc_layout_scalar_valid_range_start(1)] + #[rustc_nonnull_optimization_guaranteed] + #[unstable( + feature = "nonzero_internals", + reason = "implementation detail which may disappear or be replaced at any time", + issue = "none" + )] + pub struct $NonZeroInner($primitive); + )+ + } + + $( + #[unstable( + feature = "nonzero_internals", + reason = "implementation detail which may disappear or be replaced at any time", + issue = "none" + )] + impl const private::Sealed for $primitive {} + + #[unstable( + feature = "nonzero_internals", + reason = "implementation detail which may disappear or be replaced at any time", + issue = "none" + )] + unsafe impl const ZeroablePrimitive for $primitive { + type NonZeroInner = private::$NonZeroInner; + } + )+ }; } -impl_zeroable_primitive!(u8); -impl_zeroable_primitive!(u16); -impl_zeroable_primitive!(u32); -impl_zeroable_primitive!(u64); -impl_zeroable_primitive!(u128); -impl_zeroable_primitive!(usize); -impl_zeroable_primitive!(i8); -impl_zeroable_primitive!(i16); -impl_zeroable_primitive!(i32); -impl_zeroable_primitive!(i64); -impl_zeroable_primitive!(i128); -impl_zeroable_primitive!(isize); +impl_zeroable_primitive!( + NonZeroU8Inner(u8), + NonZeroU16Inner(u16), + NonZeroU32Inner(u32), + NonZeroU64Inner(u64), + NonZeroU128Inner(u128), + NonZeroUsizeInner(usize), + NonZeroI8Inner(i8), + NonZeroI16Inner(i16), + NonZeroI32Inner(i32), + NonZeroI64Inner(i64), + NonZeroI128Inner(i128), + NonZeroIsizeInner(isize), +); /// A value that is known not to equal zero. /// @@ -80,10 +104,9 @@ impl_zeroable_primitive!(isize); /// ``` #[unstable(feature = "generic_nonzero", issue = "120257")] #[repr(transparent)] -#[rustc_layout_scalar_valid_range_start(1)] #[rustc_nonnull_optimization_guaranteed] #[rustc_diagnostic_item = "NonZero"] -pub struct NonZero(T); +pub struct NonZero(T::NonZeroInner); macro_rules! impl_nonzero_fmt { ($Trait:ident) => { @@ -107,6 +130,25 @@ impl_nonzero_fmt!(Octal); impl_nonzero_fmt!(LowerHex); impl_nonzero_fmt!(UpperHex); +macro_rules! impl_nonzero_auto_trait { + (unsafe $Trait:ident) => { + #[stable(feature = "nonzero", since = "1.28.0")] + unsafe impl $Trait for NonZero where T: ZeroablePrimitive + $Trait {} + }; + ($Trait:ident) => { + #[stable(feature = "nonzero", since = "1.28.0")] + impl $Trait for NonZero where T: ZeroablePrimitive + $Trait {} + }; +} + +// Implement auto-traits manually based on `T` to avoid docs exposing +// the `ZeroablePrimitive::NonZeroInner` implementation detail. +impl_nonzero_auto_trait!(RefUnwindSafe); +impl_nonzero_auto_trait!(unsafe Send); +impl_nonzero_auto_trait!(unsafe Sync); +impl_nonzero_auto_trait!(Unpin); +impl_nonzero_auto_trait!(UnwindSafe); + #[stable(feature = "nonzero", since = "1.28.0")] impl Clone for NonZero where @@ -114,8 +156,7 @@ where { #[inline] fn clone(&self) -> Self { - // SAFETY: The contained value is non-zero. - unsafe { Self(self.0) } + Self(self.0) } } @@ -188,19 +229,19 @@ where #[inline] fn max(self, other: Self) -> Self { // SAFETY: The maximum of two non-zero values is still non-zero. - unsafe { Self(self.get().max(other.get())) } + unsafe { Self::new_unchecked(self.get().max(other.get())) } } #[inline] fn min(self, other: Self) -> Self { // SAFETY: The minimum of two non-zero values is still non-zero. - unsafe { Self(self.get().min(other.get())) } + unsafe { Self::new_unchecked(self.get().min(other.get())) } } #[inline] fn clamp(self, min: Self, max: Self) -> Self { // SAFETY: A non-zero value clamped between two non-zero values is still non-zero. - unsafe { Self(self.get().clamp(min.get(), max.get())) } + unsafe { Self::new_unchecked(self.get().clamp(min.get(), max.get())) } } } @@ -240,7 +281,7 @@ where #[inline] fn bitor(self, rhs: Self) -> Self::Output { // SAFETY: Bitwise OR of two non-zero values is still non-zero. - unsafe { Self(self.get() | rhs.get()) } + unsafe { Self::new_unchecked(self.get() | rhs.get()) } } } @@ -254,7 +295,7 @@ where #[inline] fn bitor(self, rhs: T) -> Self::Output { // SAFETY: Bitwise OR of a non-zero value with anything is still non-zero. - unsafe { Self(self.get() | rhs) } + unsafe { Self::new_unchecked(self.get() | rhs) } } } @@ -268,7 +309,7 @@ where #[inline] fn bitor(self, rhs: NonZero) -> Self::Output { // SAFETY: Bitwise OR of anything with a non-zero value is still non-zero. - unsafe { NonZero(self | rhs.get()) } + unsafe { NonZero::new_unchecked(self | rhs.get()) } } } @@ -346,7 +387,7 @@ where pub fn from_mut(n: &mut T) -> Option<&mut Self> { // SAFETY: Memory layout optimization guarantees that `Option>` has // the same layout and size as `T`, with `0` representing `None`. - let opt_n = unsafe { &mut *(n as *mut T as *mut Option) }; + let opt_n = unsafe { &mut *(ptr::from_mut(n).cast::>()) }; opt_n.as_mut() } @@ -390,12 +431,17 @@ where // memory somewhere. If the value of `self` was from by-value argument // of some not-inlined function, LLVM don't have range metadata // to understand that the value cannot be zero. - match Self::new(self.0) { - Some(Self(n)) => n, + // + // SAFETY: `Self` is guaranteed to have the same layout as `Option`. + match unsafe { intrinsics::transmute_unchecked(self) } { None => { // SAFETY: `NonZero` is guaranteed to only contain non-zero values, so this is unreachable. unsafe { intrinsics::unreachable() } } + Some(Self(inner)) => { + // SAFETY: `T::NonZeroInner` is guaranteed to have the same layout as `T`. + unsafe { intrinsics::transmute_unchecked(inner) } + } } } } diff --git a/src/etc/gdb_providers.py b/src/etc/gdb_providers.py index 7d7277d240877..227695cdadd58 100644 --- a/src/etc/gdb_providers.py +++ b/src/etc/gdb_providers.py @@ -245,7 +245,14 @@ def __init__(self, valobj): fields = valobj.type.fields() assert len(fields) == 1 field = list(fields)[0] - self._value = str(valobj[field.name]) + + inner_valobj = valobj[field.name] + + inner_fields = inner_valobj.type.fields() + assert len(inner_fields) == 1 + inner_field = list(inner_fields)[0] + + self._value = str(inner_valobj[inner_field.name]) def to_string(self): return self._value diff --git a/src/etc/lldb_commands b/src/etc/lldb_commands index ed66ecf30729e..615d13ccd0ffd 100644 --- a/src/etc/lldb_commands +++ b/src/etc/lldb_commands @@ -15,5 +15,5 @@ type summary add -F lldb_lookup.summary_lookup -e -x -h "^(core::([a-z_]+::)+)C type summary add -F lldb_lookup.summary_lookup -e -x -h "^(core::([a-z_]+::)+)Ref<.+>$" --category Rust type summary add -F lldb_lookup.summary_lookup -e -x -h "^(core::([a-z_]+::)+)RefMut<.+>$" --category Rust type summary add -F lldb_lookup.summary_lookup -e -x -h "^(core::([a-z_]+::)+)RefCell<.+>$" --category Rust -type summary add -F lldb_lookup.summary_lookup -e -x -h "^core::num::([a-z_]+::)*NonZero.+$" --category Rust +type summary add -F lldb_lookup.summary_lookup -e -x -h "^(core::([a-z_]+::)+)NonZero<.+>$" --category Rust type category enable Rust diff --git a/src/etc/lldb_providers.py b/src/etc/lldb_providers.py index cfb3f0a4eaebe..5d2b6fd525c14 100644 --- a/src/etc/lldb_providers.py +++ b/src/etc/lldb_providers.py @@ -743,7 +743,12 @@ def has_children(self): def StdNonZeroNumberSummaryProvider(valobj, _dict): # type: (SBValue, dict) -> str - objtype = valobj.GetType() - field = objtype.GetFieldAtIndex(0) - element = valobj.GetChildMemberWithName(field.name) - return element.GetValue() + inner = valobj.GetChildAtIndex(0) + inner_inner = inner.GetChildAtIndex(0) + + # FIXME: Avoid printing as character literal, + # see https://github.com/llvm/llvm-project/issues/65076. + if inner_inner.GetTypeName() in ['char', 'unsigned char']: + return str(inner_inner.GetValueAsSigned()) + else: + return inner_inner.GetValue() diff --git a/src/etc/natvis/libcore.natvis b/src/etc/natvis/libcore.natvis index 5e0c21a13a9fe..8a441cf209356 100644 --- a/src/etc/natvis/libcore.natvis +++ b/src/etc/natvis/libcore.natvis @@ -42,7 +42,10 @@ - {__0} + {__0.__0} + + __0.__0 + diff --git a/src/etc/rust_types.py b/src/etc/rust_types.py index bf512bc99b8f2..2b06683ef93cb 100644 --- a/src/etc/rust_types.py +++ b/src/etc/rust_types.py @@ -34,23 +34,23 @@ class RustType(object): STD_NONZERO_NUMBER = "StdNonZeroNumber" -STD_STRING_REGEX = re.compile(r"^(alloc::(\w+::)+)String$") +STD_STRING_REGEX = re.compile(r"^(alloc::([a-z_]+::)+)String$") STD_STR_REGEX = re.compile(r"^&(mut )?str$") STD_SLICE_REGEX = re.compile(r"^&(mut )?\[.+\]$") -STD_OS_STRING_REGEX = re.compile(r"^(std::ffi::(\w+::)+)OsString$") -STD_VEC_REGEX = re.compile(r"^(alloc::(\w+::)+)Vec<.+>$") -STD_VEC_DEQUE_REGEX = re.compile(r"^(alloc::(\w+::)+)VecDeque<.+>$") -STD_BTREE_SET_REGEX = re.compile(r"^(alloc::(\w+::)+)BTreeSet<.+>$") -STD_BTREE_MAP_REGEX = re.compile(r"^(alloc::(\w+::)+)BTreeMap<.+>$") -STD_HASH_MAP_REGEX = re.compile(r"^(std::collections::(\w+::)+)HashMap<.+>$") -STD_HASH_SET_REGEX = re.compile(r"^(std::collections::(\w+::)+)HashSet<.+>$") -STD_RC_REGEX = re.compile(r"^(alloc::(\w+::)+)Rc<.+>$") -STD_ARC_REGEX = re.compile(r"^(alloc::(\w+::)+)Arc<.+>$") -STD_CELL_REGEX = re.compile(r"^(core::(\w+::)+)Cell<.+>$") -STD_REF_REGEX = re.compile(r"^(core::(\w+::)+)Ref<.+>$") -STD_REF_MUT_REGEX = re.compile(r"^(core::(\w+::)+)RefMut<.+>$") -STD_REF_CELL_REGEX = re.compile(r"^(core::(\w+::)+)RefCell<.+>$") -STD_NONZERO_NUMBER_REGEX = re.compile(r"^core::num::([a-z_]+::)*NonZero.+$") +STD_OS_STRING_REGEX = re.compile(r"^(std::ffi::([a-z_]+::)+)OsString$") +STD_VEC_REGEX = re.compile(r"^(alloc::([a-z_]+::)+)Vec<.+>$") +STD_VEC_DEQUE_REGEX = re.compile(r"^(alloc::([a-z_]+::)+)VecDeque<.+>$") +STD_BTREE_SET_REGEX = re.compile(r"^(alloc::([a-z_]+::)+)BTreeSet<.+>$") +STD_BTREE_MAP_REGEX = re.compile(r"^(alloc::([a-z_]+::)+)BTreeMap<.+>$") +STD_HASH_MAP_REGEX = re.compile(r"^(std::collections::([a-z_]+::)+)HashMap<.+>$") +STD_HASH_SET_REGEX = re.compile(r"^(std::collections::([a-z_]+::)+)HashSet<.+>$") +STD_RC_REGEX = re.compile(r"^(alloc::([a-z_]+::)+)Rc<.+>$") +STD_ARC_REGEX = re.compile(r"^(alloc::([a-z_]+::)+)Arc<.+>$") +STD_CELL_REGEX = re.compile(r"^(core::([a-z_]+::)+)Cell<.+>$") +STD_REF_REGEX = re.compile(r"^(core::([a-z_]+::)+)Ref<.+>$") +STD_REF_MUT_REGEX = re.compile(r"^(core::([a-z_]+::)+)RefMut<.+>$") +STD_REF_CELL_REGEX = re.compile(r"^(core::([a-z_]+::)+)RefCell<.+>$") +STD_NONZERO_NUMBER_REGEX = re.compile(r"^(core::([a-z_]+::)+)NonZero<.+>$") TUPLE_ITEM_REGEX = re.compile(r"__\d+$") diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 7be0571b1111b..f427055728fd7 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -1466,49 +1466,16 @@ impl<'test> TestCx<'test> { // Switch LLDB into "Rust mode" let rust_src_root = self.config.find_rust_src_root().expect("Could not find Rust source root"); - let rust_pp_module_rel_path = Path::new("./src/etc/lldb_lookup.py"); - let rust_pp_module_abs_path = - rust_src_root.join(rust_pp_module_rel_path).to_str().unwrap().to_owned(); - - let rust_type_regexes = vec![ - "^(alloc::([a-z_]+::)+)String$", - "^&(mut )?str$", - "^&(mut )?\\[.+\\]$", - "^(std::ffi::([a-z_]+::)+)OsString$", - "^(alloc::([a-z_]+::)+)Vec<.+>$", - "^(alloc::([a-z_]+::)+)VecDeque<.+>$", - "^(alloc::([a-z_]+::)+)BTreeSet<.+>$", - "^(alloc::([a-z_]+::)+)BTreeMap<.+>$", - "^(std::collections::([a-z_]+::)+)HashMap<.+>$", - "^(std::collections::([a-z_]+::)+)HashSet<.+>$", - "^(alloc::([a-z_]+::)+)Rc<.+>$", - "^(alloc::([a-z_]+::)+)Arc<.+>$", - "^(core::([a-z_]+::)+)Cell<.+>$", - "^(core::([a-z_]+::)+)Ref<.+>$", - "^(core::([a-z_]+::)+)RefMut<.+>$", - "^(core::([a-z_]+::)+)RefCell<.+>$", - "^core::num::([a-z_]+::)*NonZero.+$", - ]; + let rust_pp_module_rel_path = Path::new("./src/etc"); + let rust_pp_module_abs_path = rust_src_root.join(rust_pp_module_rel_path); - // In newer versions of lldb, persistent results (the `$N =` part at the start of - // expressions you have evaluated that let you re-use the result) aren't printed, but lots - // of rustc's debuginfo tests rely on these, so re-enable this. - // See . - script_str.push_str("command unalias print\n"); - script_str.push_str("command alias print expr --\n"); - script_str.push_str("command unalias p\n"); - script_str.push_str("command alias p expr --\n"); - - script_str - .push_str(&format!("command script import {}\n", &rust_pp_module_abs_path[..])[..]); - script_str.push_str("type synthetic add -l lldb_lookup.synthetic_lookup -x '.*' "); - script_str.push_str("--category Rust\n"); - for type_regex in rust_type_regexes { - script_str.push_str("type summary add -F lldb_lookup.summary_lookup -e -x -h "); - script_str.push_str(&format!("'{}' ", type_regex)); - script_str.push_str("--category Rust\n"); - } - script_str.push_str("type category enable Rust\n"); + script_str.push_str(&format!( + "command script import {}/lldb_lookup.py\n", + rust_pp_module_abs_path.to_str().unwrap() + )); + File::open(rust_pp_module_abs_path.join("lldb_commands")) + .and_then(|mut file| file.read_to_string(&mut script_str)) + .expect("Failed to read lldb_commands"); // Set breakpoints on every line that contains the string "#break" let source_file_name = self.testpaths.file.file_name().unwrap().to_string_lossy(); diff --git a/src/tools/miri/src/diagnostics.rs b/src/tools/miri/src/diagnostics.rs index 4683965159d73..6e612ea34a70f 100644 --- a/src/tools/miri/src/diagnostics.rs +++ b/src/tools/miri/src/diagnostics.rs @@ -528,7 +528,7 @@ impl<'mir, 'tcx> MiriMachine<'mir, 'tcx> { use NonHaltingDiagnostic::*; let stacktrace = - MiriInterpCx::generate_stacktrace_from_stack(self.threads.active_thread_stack()); + Frame::generate_stacktrace_from_stack(self.threads.active_thread_stack()); let (stacktrace, _was_pruned) = prune_stacktrace(stacktrace, self); let (title, diag_level) = match &e { diff --git a/src/tools/miri/tests/fail/validity/cast_fn_ptr_invalid_callee_ret.stderr b/src/tools/miri/tests/fail/validity/cast_fn_ptr_invalid_callee_ret.stderr index 7d481940acec9..35de453522257 100644 --- a/src/tools/miri/tests/fail/validity/cast_fn_ptr_invalid_callee_ret.stderr +++ b/src/tools/miri/tests/fail/validity/cast_fn_ptr_invalid_callee_ret.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: constructing invalid value: encountered 0, but expected something greater or equal to 1 +error: Undefined Behavior: constructing invalid value at .0: encountered 0, but expected something greater or equal to 1 --> $DIR/cast_fn_ptr_invalid_callee_ret.rs:LL:CC | LL | f(); - | ^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1 + | ^^^ constructing invalid value at .0: encountered 0, but expected something greater or equal to 1 | = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information diff --git a/src/tools/miri/tests/fail/validity/cast_fn_ptr_invalid_caller_arg.stderr b/src/tools/miri/tests/fail/validity/cast_fn_ptr_invalid_caller_arg.stderr index b1a2bd2c79a40..81d775f6d7f5f 100644 --- a/src/tools/miri/tests/fail/validity/cast_fn_ptr_invalid_caller_arg.stderr +++ b/src/tools/miri/tests/fail/validity/cast_fn_ptr_invalid_caller_arg.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: constructing invalid value: encountered 0, but expected something greater or equal to 1 +error: Undefined Behavior: constructing invalid value at .0: encountered 0, but expected something greater or equal to 1 --> $DIR/cast_fn_ptr_invalid_caller_arg.rs:LL:CC | LL | Call(_res = f(*ptr), ReturnTo(retblock), UnwindContinue()) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered 0, but expected something greater or equal to 1 | = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information diff --git a/tests/codegen/sanitizer/cfi-emit-type-metadata-id-itanium-cxx-abi.rs b/tests/codegen/sanitizer/cfi-emit-type-metadata-id-itanium-cxx-abi.rs deleted file mode 100644 index 5f49909712f96..0000000000000 --- a/tests/codegen/sanitizer/cfi-emit-type-metadata-id-itanium-cxx-abi.rs +++ /dev/null @@ -1,604 +0,0 @@ -// Verifies that type metadata identifiers for functions are emitted correctly. -// -//@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Copt-level=0 - -#![crate_type="lib"] -#![allow(dead_code)] -#![allow(incomplete_features)] -#![allow(unused_must_use)] -#![feature(adt_const_params, extern_types, inline_const, type_alias_impl_trait)] - -extern crate core; -use core::ffi::*; -use std::marker::PhantomData; - -// User-defined type (structure) -pub struct Struct1 { - member1: T, -} - -// User-defined type (enum) -pub enum Enum1 { - Variant1(T), -} - -// User-defined type (union) -pub union Union1 { - member1: std::mem::ManuallyDrop, -} - -// Extern type -extern { - pub type type1; -} - -// Trait -pub trait Trait1 { - fn foo(&self) { } -} - -// Trait implementation -impl Trait1 for i32 { - fn foo(&self) { } -} - -// Trait implementation -impl Trait1 for Struct1 { - fn foo(&self) { } -} - -// impl Trait type aliases for helping with defining other types (see below) -pub type Type1 = impl Send; -pub type Type2 = impl Send; -pub type Type3 = impl Send; -pub type Type4 = impl Send; -pub type Type5 = impl Send; -pub type Type6 = impl Send; -pub type Type7 = impl Send; -pub type Type8 = impl Send; -pub type Type9 = impl Send; -pub type Type10 = impl Send; -pub type Type11 = impl Send; - -pub fn fn1<'a>() where - Type1: 'static, - Type2: 'static, - Type3: 'static, - Type4: 'static, - Type5: 'static, - Type6: 'static, - Type7: 'static, - Type8: 'static, - Type9: 'static, - Type10: 'static, - Type11: 'static, -{ - // Closure - let closure1 = || { }; - let _: Type1 = closure1; - - // Constructor - pub struct Foo(i32); - let _: Type2 = Foo; - - // Type in extern path - extern { - fn foo(); - } - let _: Type3 = foo; - - // Type in closure path - || { - pub struct Foo; - let _: Type4 = Foo; - }; - - // Type in const path - const { - pub struct Foo; - fn foo() -> Type5 { Foo } - }; - - // Type in impl path - impl Struct1 { - fn foo(&self) { } - } - let _: Type6 = >::foo; - - // Trait method - let _: Type7 = >::foo; - - // Trait method - let _: Type8 = >::foo; - - // Trait method - let _: Type9 = as Trait1>::foo; - - // Const generics - pub struct Qux([T; N]); - let _: Type10 = Qux([0; 32]); - - // Lifetimes/regions - pub struct Quux<'a>(&'a i32); - pub struct Quuux<'a, 'b>(&'a i32, &'b Quux<'b>); - let _: Type11 = Quuux; -} - -// Helper type to make Type12 have an unique id -struct Foo(i32); - -// repr(transparent) user-defined type -#[repr(transparent)] -pub struct Type12 { - member1: (), - member2: PhantomData, - member3: Foo, -} - -// Self-referencing repr(transparent) user-defined type -#[repr(transparent)] -pub struct Type13<'a> { - member1: (), - member2: PhantomData, - member3: &'a Type13<'a>, -} - -// Helper type to make Type14 have an unique id -pub struct Bar; - -// repr(transparent) user-defined generic type -#[repr(transparent)] -pub struct Type14(T); - -pub fn foo0(_: ()) { } -// CHECK: define{{.*}}foo0{{.*}}!type ![[TYPE0:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo1(_: (), _: c_void) { } -// CHECK: define{{.*}}foo1{{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo2(_: (), _: c_void, _: c_void) { } -// CHECK: define{{.*}}foo2{{.*}}!type ![[TYPE2:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo3(_: *mut ()) { } -// CHECK: define{{.*}}foo3{{.*}}!type ![[TYPE3:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo4(_: *mut (), _: *mut c_void) { } -// CHECK: define{{.*}}foo4{{.*}}!type ![[TYPE4:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo5(_: *mut (), _: *mut c_void, _: *mut c_void) { } -// CHECK: define{{.*}}foo5{{.*}}!type ![[TYPE5:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo6(_: *const ()) { } -// CHECK: define{{.*}}foo6{{.*}}!type ![[TYPE6:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo7(_: *const (), _: *const c_void) { } -// CHECK: define{{.*}}foo7{{.*}}!type ![[TYPE7:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo8(_: *const (), _: *const c_void, _: *const c_void) { } -// CHECK: define{{.*}}foo8{{.*}}!type ![[TYPE8:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo9(_: bool) { } -// CHECK: define{{.*}}foo9{{.*}}!type ![[TYPE9:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo10(_: bool, _: bool) { } -// CHECK: define{{.*}}foo10{{.*}}!type ![[TYPE10:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo11(_: bool, _: bool, _: bool) { } -// CHECK: define{{.*}}foo11{{.*}}!type ![[TYPE11:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo12(_: i8) { } -// CHECK: define{{.*}}foo12{{.*}}!type ![[TYPE12:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo13(_: i8, _: i8) { } -// CHECK: define{{.*}}foo13{{.*}}!type ![[TYPE13:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo14(_: i8, _: i8, _: i8) { } -// CHECK: define{{.*}}foo14{{.*}}!type ![[TYPE14:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo15(_: i16) { } -// CHECK: define{{.*}}foo15{{.*}}!type ![[TYPE15:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo16(_: i16, _: i16) { } -// CHECK: define{{.*}}foo16{{.*}}!type ![[TYPE16:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo17(_: i16, _: i16, _: i16) { } -// CHECK: define{{.*}}foo17{{.*}}!type ![[TYPE17:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo18(_: i32) { } -// CHECK: define{{.*}}foo18{{.*}}!type ![[TYPE18:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo19(_: i32, _: i32) { } -// CHECK: define{{.*}}foo19{{.*}}!type ![[TYPE19:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo20(_: i32, _: i32, _: i32) { } -// CHECK: define{{.*}}foo20{{.*}}!type ![[TYPE20:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo21(_: i64) { } -// CHECK: define{{.*}}foo21{{.*}}!type ![[TYPE21:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo22(_: i64, _: i64) { } -// CHECK: define{{.*}}foo22{{.*}}!type ![[TYPE22:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo23(_: i64, _: i64, _: i64) { } -// CHECK: define{{.*}}foo23{{.*}}!type ![[TYPE23:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo24(_: i128) { } -// CHECK: define{{.*}}foo24{{.*}}!type ![[TYPE24:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo25(_: i128, _: i128) { } -// CHECK: define{{.*}}foo25{{.*}}!type ![[TYPE25:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo26(_: i128, _: i128, _: i128) { } -// CHECK: define{{.*}}foo26{{.*}}!type ![[TYPE26:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo27(_: isize) { } -// CHECK: define{{.*}}foo27{{.*}}!type ![[TYPE27:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo28(_: isize, _: isize) { } -// CHECK: define{{.*}}foo28{{.*}}!type ![[TYPE28:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo29(_: isize, _: isize, _: isize) { } -// CHECK: define{{.*}}foo29{{.*}}!type ![[TYPE29:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo30(_: u8) { } -// CHECK: define{{.*}}foo30{{.*}}!type ![[TYPE30:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo31(_: u8, _: u8) { } -// CHECK: define{{.*}}foo31{{.*}}!type ![[TYPE31:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo32(_: u8, _: u8, _: u8) { } -// CHECK: define{{.*}}foo32{{.*}}!type ![[TYPE32:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo33(_: u16) { } -// CHECK: define{{.*}}foo33{{.*}}!type ![[TYPE33:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo34(_: u16, _: u16) { } -// CHECK: define{{.*}}foo34{{.*}}!type ![[TYPE34:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo35(_: u16, _: u16, _: u16) { } -// CHECK: define{{.*}}foo35{{.*}}!type ![[TYPE35:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo36(_: u32) { } -// CHECK: define{{.*}}foo36{{.*}}!type ![[TYPE36:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo37(_: u32, _: u32) { } -// CHECK: define{{.*}}foo37{{.*}}!type ![[TYPE37:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo38(_: u32, _: u32, _: u32) { } -// CHECK: define{{.*}}foo38{{.*}}!type ![[TYPE38:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo39(_: u64) { } -// CHECK: define{{.*}}foo39{{.*}}!type ![[TYPE39:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo40(_: u64, _: u64) { } -// CHECK: define{{.*}}foo40{{.*}}!type ![[TYPE40:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo41(_: u64, _: u64, _: u64) { } -// CHECK: define{{.*}}foo41{{.*}}!type ![[TYPE41:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo42(_: u128) { } -// CHECK: define{{.*}}foo42{{.*}}!type ![[TYPE42:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo43(_: u128, _: u128) { } -// CHECK: define{{.*}}foo43{{.*}}!type ![[TYPE43:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo44(_: u128, _: u128, _: u128) { } -// CHECK: define{{.*}}foo44{{.*}}!type ![[TYPE44:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo45(_: usize) { } -// CHECK: define{{.*}}foo45{{.*}}!type ![[TYPE45:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo46(_: usize, _: usize) { } -// CHECK: define{{.*}}foo46{{.*}}!type ![[TYPE46:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo47(_: usize, _: usize, _: usize) { } -// CHECK: define{{.*}}foo47{{.*}}!type ![[TYPE47:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo48(_: f32) { } -// CHECK: define{{.*}}foo48{{.*}}!type ![[TYPE48:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo49(_: f32, _: f32) { } -// CHECK: define{{.*}}foo49{{.*}}!type ![[TYPE49:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo50(_: f32, _: f32, _: f32) { } -// CHECK: define{{.*}}foo50{{.*}}!type ![[TYPE50:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo51(_: f64) { } -// CHECK: define{{.*}}foo51{{.*}}!type ![[TYPE51:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo52(_: f64, _: f64) { } -// CHECK: define{{.*}}foo52{{.*}}!type ![[TYPE52:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo53(_: f64, _: f64, _: f64) { } -// CHECK: define{{.*}}foo53{{.*}}!type ![[TYPE53:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo54(_: char) { } -// CHECK: define{{.*}}foo54{{.*}}!type ![[TYPE54:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo55(_: char, _: char) { } -// CHECK: define{{.*}}foo55{{.*}}!type ![[TYPE55:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo56(_: char, _: char, _: char) { } -// CHECK: define{{.*}}foo56{{.*}}!type ![[TYPE56:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo57(_: &str) { } -// CHECK: define{{.*}}foo57{{.*}}!type ![[TYPE57:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo58(_: &str, _: &str) { } -// CHECK: define{{.*}}foo58{{.*}}!type ![[TYPE58:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo59(_: &str, _: &str, _: &str) { } -// CHECK: define{{.*}}foo59{{.*}}!type ![[TYPE59:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo60(_: (i32, i32)) { } -// CHECK: define{{.*}}foo60{{.*}}!type ![[TYPE60:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo61(_: (i32, i32), _: (i32, i32)) { } -// CHECK: define{{.*}}foo61{{.*}}!type ![[TYPE61:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo62(_: (i32, i32), _: (i32, i32), _: (i32, i32)) { } -// CHECK: define{{.*}}foo62{{.*}}!type ![[TYPE62:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo63(_: [i32; 32]) { } -// CHECK: define{{.*}}foo63{{.*}}!type ![[TYPE63:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo64(_: [i32; 32], _: [i32; 32]) { } -// CHECK: define{{.*}}foo64{{.*}}!type ![[TYPE64:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo65(_: [i32; 32], _: [i32; 32], _: [i32; 32]) { } -// CHECK: define{{.*}}foo65{{.*}}!type ![[TYPE65:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo66(_: &[i32]) { } -// CHECK: define{{.*}}foo66{{.*}}!type ![[TYPE66:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo67(_: &[i32], _: &[i32]) { } -// CHECK: define{{.*}}foo67{{.*}}!type ![[TYPE67:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo68(_: &[i32], _: &[i32], _: &[i32]) { } -// CHECK: define{{.*}}foo68{{.*}}!type ![[TYPE68:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo69(_: &Struct1::) { } -// CHECK: define{{.*}}foo69{{.*}}!type ![[TYPE69:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo70(_: &Struct1::, _: &Struct1::) { } -// CHECK: define{{.*}}foo70{{.*}}!type ![[TYPE70:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo71(_: &Struct1::, _: &Struct1::, _: &Struct1::) { } -// CHECK: define{{.*}}foo71{{.*}}!type ![[TYPE71:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo72(_: &Enum1::) { } -// CHECK: define{{.*}}foo72{{.*}}!type ![[TYPE72:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo73(_: &Enum1::, _: &Enum1::) { } -// CHECK: define{{.*}}foo73{{.*}}!type ![[TYPE73:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo74(_: &Enum1::, _: &Enum1::, _: &Enum1::) { } -// CHECK: define{{.*}}foo74{{.*}}!type ![[TYPE74:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo75(_: &Union1::) { } -// CHECK: define{{.*}}foo75{{.*}}!type ![[TYPE75:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo76(_: &Union1::, _: &Union1::) { } -// CHECK: define{{.*}}foo76{{.*}}!type ![[TYPE76:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo77(_: &Union1::, _: &Union1::, _: &Union1::) { } -// CHECK: define{{.*}}foo77{{.*}}!type ![[TYPE77:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo78(_: *mut type1) { } -// CHECK: define{{.*}}foo78{{.*}}!type ![[TYPE78:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo79(_: *mut type1, _: *mut type1) { } -// CHECK: define{{.*}}foo79{{.*}}!type ![[TYPE79:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo80(_: *mut type1, _: *mut type1, _: *mut type1) { } -// CHECK: define{{.*}}foo80{{.*}}!type ![[TYPE80:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo81(_: &mut i32) { } -// CHECK: define{{.*}}foo81{{.*}}!type ![[TYPE81:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo82(_: &mut i32, _: &i32) { } -// CHECK: define{{.*}}foo82{{.*}}!type ![[TYPE82:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo83(_: &mut i32, _: &i32, _: &i32) { } -// CHECK: define{{.*}}foo83{{.*}}!type ![[TYPE83:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo84(_: &i32) { } -// CHECK: define{{.*}}foo84{{.*}}!type ![[TYPE84:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo85(_: &i32, _: &mut i32) { } -// CHECK: define{{.*}}foo85{{.*}}!type ![[TYPE85:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo86(_: &i32, _: &mut i32, _: &mut i32) { } -// CHECK: define{{.*}}foo86{{.*}}!type ![[TYPE86:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo87(_: *mut i32) { } -// CHECK: define{{.*}}foo87{{.*}}!type ![[TYPE87:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo88(_: *mut i32, _: *const i32) { } -// CHECK: define{{.*}}foo88{{.*}}!type ![[TYPE88:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo89(_: *mut i32, _: *const i32, _: *const i32) { } -// CHECK: define{{.*}}foo89{{.*}}!type ![[TYPE89:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo90(_: *const i32) { } -// CHECK: define{{.*}}foo90{{.*}}!type ![[TYPE90:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo91(_: *const i32, _: *mut i32) { } -// CHECK: define{{.*}}foo91{{.*}}!type ![[TYPE91:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo92(_: *const i32, _: *mut i32, _: *mut i32) { } -// CHECK: define{{.*}}foo92{{.*}}!type ![[TYPE92:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo93(_: fn(i32) -> i32) { } -// CHECK: define{{.*}}foo93{{.*}}!type ![[TYPE93:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo94(_: fn(i32) -> i32, _: fn(i32) -> i32) { } -// CHECK: define{{.*}}foo94{{.*}}!type ![[TYPE94:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo95(_: fn(i32) -> i32, _: fn(i32) -> i32, _: fn(i32) -> i32) { } -// CHECK: define{{.*}}foo95{{.*}}!type ![[TYPE95:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo96(_: &dyn Fn(i32) -> i32) { } -// CHECK: define{{.*}}foo96{{.*}}!type ![[TYPE96:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo97(_: &dyn Fn(i32) -> i32, _: &dyn Fn(i32) -> i32) { } -// CHECK: define{{.*}}foo97{{.*}}!type ![[TYPE97:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo98(_: &dyn Fn(i32) -> i32, _: &dyn Fn(i32) -> i32, _: &dyn Fn(i32) -> i32) { } -// CHECK: define{{.*}}foo98{{.*}}!type ![[TYPE98:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo99(_: &dyn FnMut(i32) -> i32) { } -// CHECK: define{{.*}}foo99{{.*}}!type ![[TYPE99:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo100(_: &dyn FnMut(i32) -> i32, _: &dyn FnMut(i32) -> i32) { } -// CHECK: define{{.*}}foo100{{.*}}!type ![[TYPE100:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo101(_: &dyn FnMut(i32) -> i32, _: &dyn FnMut(i32) -> i32, _: &dyn FnMut(i32) -> i32) { } -// CHECK: define{{.*}}foo101{{.*}}!type ![[TYPE101:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo102(_: &dyn FnOnce(i32) -> i32) { } -// CHECK: define{{.*}}foo102{{.*}}!type ![[TYPE102:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo103(_: &dyn FnOnce(i32) -> i32, _: &dyn FnOnce(i32) -> i32) { } -// CHECK: define{{.*}}foo103{{.*}}!type ![[TYPE103:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo104(_: &dyn FnOnce(i32) -> i32, _: &dyn FnOnce(i32) -> i32, _: &dyn FnOnce(i32) -> i32) {} -// CHECK: define{{.*}}foo104{{.*}}!type ![[TYPE104:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo105(_: &dyn Send) { } -// CHECK: define{{.*}}foo105{{.*}}!type ![[TYPE105:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo106(_: &dyn Send, _: &dyn Send) { } -// CHECK: define{{.*}}foo106{{.*}}!type ![[TYPE106:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo107(_: &dyn Send, _: &dyn Send, _: &dyn Send) { } -// CHECK: define{{.*}}foo107{{.*}}!type ![[TYPE107:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo108(_: Type1) { } -// CHECK: define{{.*}}foo108{{.*}}!type ![[TYPE108:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo109(_: Type1, _: Type1) { } -// CHECK: define{{.*}}foo109{{.*}}!type ![[TYPE109:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo110(_: Type1, _: Type1, _: Type1) { } -// CHECK: define{{.*}}foo110{{.*}}!type ![[TYPE110:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo111(_: Type2) { } -// CHECK: define{{.*}}foo111{{.*}}!type ![[TYPE111:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo112(_: Type2, _: Type2) { } -// CHECK: define{{.*}}foo112{{.*}}!type ![[TYPE112:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo113(_: Type2, _: Type2, _: Type2) { } -// CHECK: define{{.*}}foo113{{.*}}!type ![[TYPE113:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo114(_: Type3) { } -// CHECK: define{{.*}}foo114{{.*}}!type ![[TYPE114:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo115(_: Type3, _: Type3) { } -// CHECK: define{{.*}}foo115{{.*}}!type ![[TYPE115:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo116(_: Type3, _: Type3, _: Type3) { } -// CHECK: define{{.*}}foo116{{.*}}!type ![[TYPE116:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo117(_: Type4) { } -// CHECK: define{{.*}}foo117{{.*}}!type ![[TYPE117:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo118(_: Type4, _: Type4) { } -// CHECK: define{{.*}}foo118{{.*}}!type ![[TYPE118:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo119(_: Type4, _: Type4, _: Type4) { } -// CHECK: define{{.*}}foo119{{.*}}!type ![[TYPE119:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo120(_: Type5) { } -// CHECK: define{{.*}}foo120{{.*}}!type ![[TYPE120:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo121(_: Type5, _: Type5) { } -// CHECK: define{{.*}}foo121{{.*}}!type ![[TYPE121:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo122(_: Type5, _: Type5, _: Type5) { } -// CHECK: define{{.*}}foo122{{.*}}!type ![[TYPE122:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo123(_: Type6) { } -// CHECK: define{{.*}}foo123{{.*}}!type ![[TYPE123:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo124(_: Type6, _: Type6) { } -// CHECK: define{{.*}}foo124{{.*}}!type ![[TYPE124:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo125(_: Type6, _: Type6, _: Type6) { } -// CHECK: define{{.*}}foo125{{.*}}!type ![[TYPE125:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo126(_: Type7) { } -// CHECK: define{{.*}}foo126{{.*}}!type ![[TYPE126:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo127(_: Type7, _: Type7) { } -// CHECK: define{{.*}}foo127{{.*}}!type ![[TYPE127:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo128(_: Type7, _: Type7, _: Type7) { } -// CHECK: define{{.*}}foo128{{.*}}!type ![[TYPE128:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo129(_: Type8) { } -// CHECK: define{{.*}}foo129{{.*}}!type ![[TYPE129:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo130(_: Type8, _: Type8) { } -// CHECK: define{{.*}}foo130{{.*}}!type ![[TYPE130:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo131(_: Type8, _: Type8, _: Type8) { } -// CHECK: define{{.*}}foo131{{.*}}!type ![[TYPE131:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo132(_: Type9) { } -// CHECK: define{{.*}}foo132{{.*}}!type ![[TYPE132:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo133(_: Type9, _: Type9) { } -// CHECK: define{{.*}}foo133{{.*}}!type ![[TYPE133:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo134(_: Type9, _: Type9, _: Type9) { } -// CHECK: define{{.*}}foo134{{.*}}!type ![[TYPE134:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo135(_: Type10) { } -// CHECK: define{{.*}}foo135{{.*}}!type ![[TYPE135:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo136(_: Type10, _: Type10) { } -// CHECK: define{{.*}}foo136{{.*}}!type ![[TYPE136:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo137(_: Type10, _: Type10, _: Type10) { } -// CHECK: define{{.*}}foo137{{.*}}!type ![[TYPE137:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo138(_: Type11) { } -// CHECK: define{{.*}}foo138{{.*}}!type ![[TYPE138:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo139(_: Type11, _: Type11) { } -// CHECK: define{{.*}}foo139{{.*}}!type ![[TYPE139:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo140(_: Type11, _: Type11, _: Type11) { } -// CHECK: define{{.*}}foo140{{.*}}!type ![[TYPE140:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo141(_: Type12) { } -// CHECK: define{{.*}}foo141{{.*}}!type ![[TYPE141:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo142(_: Type12, _: Type12) { } -// CHECK: define{{.*}}foo142{{.*}}!type ![[TYPE142:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo143(_: Type12, _: Type12, _: Type12) { } -// CHECK: define{{.*}}foo143{{.*}}!type ![[TYPE143:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo144(_: Type13) { } -// CHECK: define{{.*}}foo144{{.*}}!type ![[TYPE144:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo145(_: Type13, _: Type13) { } -// CHECK: define{{.*}}foo145{{.*}}!type ![[TYPE145:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo146(_: Type13, _: Type13, _: Type13) { } -// CHECK: define{{.*}}foo146{{.*}}!type ![[TYPE146:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo147(_: Type14) { } -// CHECK: define{{.*}}foo147{{.*}}!type ![[TYPE147:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo148(_: Type14, _: Type14) { } -// CHECK: define{{.*}}foo148{{.*}}!type ![[TYPE148:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo149(_: Type14, _: Type14, _: Type14) { } -// CHECK: define{{.*}}foo149{{.*}}!type ![[TYPE149:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} - -// CHECK: ![[TYPE0]] = !{i64 0, !"_ZTSFvvE"} -// CHECK: ![[TYPE1]] = !{i64 0, !"_ZTSFvvvE"} -// CHECK: ![[TYPE2]] = !{i64 0, !"_ZTSFvvvvE"} -// CHECK: ![[TYPE3]] = !{i64 0, !"_ZTSFvPvE"} -// CHECK: ![[TYPE4]] = !{i64 0, !"_ZTSFvPvS_E"} -// CHECK: ![[TYPE5]] = !{i64 0, !"_ZTSFvPvS_S_E"} -// CHECK: ![[TYPE6]] = !{i64 0, !"_ZTSFvPKvE"} -// CHECK: ![[TYPE7]] = !{i64 0, !"_ZTSFvPKvS0_E"} -// CHECK: ![[TYPE8]] = !{i64 0, !"_ZTSFvPKvS0_S0_E"} -// CHECK: ![[TYPE9]] = !{i64 0, !"_ZTSFvbE"} -// CHECK: ![[TYPE10]] = !{i64 0, !"_ZTSFvbbE"} -// CHECK: ![[TYPE11]] = !{i64 0, !"_ZTSFvbbbE"} -// CHECK: ![[TYPE12]] = !{i64 0, !"_ZTSFvu2i8E"} -// CHECK: ![[TYPE13]] = !{i64 0, !"_ZTSFvu2i8S_E"} -// CHECK: ![[TYPE14]] = !{i64 0, !"_ZTSFvu2i8S_S_E"} -// CHECK: ![[TYPE15]] = !{i64 0, !"_ZTSFvu3i16E"} -// CHECK: ![[TYPE16]] = !{i64 0, !"_ZTSFvu3i16S_E"} -// CHECK: ![[TYPE17]] = !{i64 0, !"_ZTSFvu3i16S_S_E"} -// CHECK: ![[TYPE18]] = !{i64 0, !"_ZTSFvu3i32E"} -// CHECK: ![[TYPE19]] = !{i64 0, !"_ZTSFvu3i32S_E"} -// CHECK: ![[TYPE20]] = !{i64 0, !"_ZTSFvu3i32S_S_E"} -// CHECK: ![[TYPE21]] = !{i64 0, !"_ZTSFvu3i64E"} -// CHECK: ![[TYPE22]] = !{i64 0, !"_ZTSFvu3i64S_E"} -// CHECK: ![[TYPE23]] = !{i64 0, !"_ZTSFvu3i64S_S_E"} -// CHECK: ![[TYPE24]] = !{i64 0, !"_ZTSFvu4i128E"} -// CHECK: ![[TYPE25]] = !{i64 0, !"_ZTSFvu4i128S_E"} -// CHECK: ![[TYPE26]] = !{i64 0, !"_ZTSFvu4i128S_S_E"} -// CHECK: ![[TYPE27]] = !{i64 0, !"_ZTSFvu5isizeE"} -// CHECK: ![[TYPE28]] = !{i64 0, !"_ZTSFvu5isizeS_E"} -// CHECK: ![[TYPE29]] = !{i64 0, !"_ZTSFvu5isizeS_S_E"} -// CHECK: ![[TYPE30]] = !{i64 0, !"_ZTSFvu2u8E"} -// CHECK: ![[TYPE31]] = !{i64 0, !"_ZTSFvu2u8S_E"} -// CHECK: ![[TYPE32]] = !{i64 0, !"_ZTSFvu2u8S_S_E"} -// CHECK: ![[TYPE33]] = !{i64 0, !"_ZTSFvu3u16E"} -// CHECK: ![[TYPE34]] = !{i64 0, !"_ZTSFvu3u16S_E"} -// CHECK: ![[TYPE35]] = !{i64 0, !"_ZTSFvu3u16S_S_E"} -// CHECK: ![[TYPE36]] = !{i64 0, !"_ZTSFvu3u32E"} -// CHECK: ![[TYPE37]] = !{i64 0, !"_ZTSFvu3u32S_E"} -// CHECK: ![[TYPE38]] = !{i64 0, !"_ZTSFvu3u32S_S_E"} -// CHECK: ![[TYPE39]] = !{i64 0, !"_ZTSFvu3u64E"} -// CHECK: ![[TYPE40]] = !{i64 0, !"_ZTSFvu3u64S_E"} -// CHECK: ![[TYPE41]] = !{i64 0, !"_ZTSFvu3u64S_S_E"} -// CHECK: ![[TYPE42]] = !{i64 0, !"_ZTSFvu4u128E"} -// CHECK: ![[TYPE43]] = !{i64 0, !"_ZTSFvu4u128S_E"} -// CHECK: ![[TYPE44]] = !{i64 0, !"_ZTSFvu4u128S_S_E"} -// CHECK: ![[TYPE45]] = !{i64 0, !"_ZTSFvu5usizeE"} -// CHECK: ![[TYPE46]] = !{i64 0, !"_ZTSFvu5usizeS_E"} -// CHECK: ![[TYPE47]] = !{i64 0, !"_ZTSFvu5usizeS_S_E"} -// CHECK: ![[TYPE48]] = !{i64 0, !"_ZTSFvfE"} -// CHECK: ![[TYPE49]] = !{i64 0, !"_ZTSFvffE"} -// CHECK: ![[TYPE50]] = !{i64 0, !"_ZTSFvfffE"} -// CHECK: ![[TYPE51]] = !{i64 0, !"_ZTSFvdE"} -// CHECK: ![[TYPE52]] = !{i64 0, !"_ZTSFvddE"} -// CHECK: ![[TYPE53]] = !{i64 0, !"_ZTSFvdddE"} -// CHECK: ![[TYPE54]] = !{i64 0, !"_ZTSFvu4charE"} -// CHECK: ![[TYPE55]] = !{i64 0, !"_ZTSFvu4charS_E"} -// CHECK: ![[TYPE56]] = !{i64 0, !"_ZTSFvu4charS_S_E"} -// CHECK: ![[TYPE57]] = !{i64 0, !"_ZTSFvu3refIu3strEE"} -// CHECK: ![[TYPE58]] = !{i64 0, !"_ZTSFvu3refIu3strES0_E"} -// CHECK: ![[TYPE59]] = !{i64 0, !"_ZTSFvu3refIu3strES0_S0_E"} -// CHECK: ![[TYPE60]] = !{i64 0, !"_ZTSFvu5tupleIu3i32S_EE"} -// CHECK: ![[TYPE61]] = !{i64 0, !"_ZTSFvu5tupleIu3i32S_ES0_E"} -// CHECK: ![[TYPE62]] = !{i64 0, !"_ZTSFvu5tupleIu3i32S_ES0_S0_E"} -// CHECK: ![[TYPE63]] = !{i64 0, !"_ZTSFvA32u3i32E"} -// CHECK: ![[TYPE64]] = !{i64 0, !"_ZTSFvA32u3i32S0_E"} -// CHECK: ![[TYPE65]] = !{i64 0, !"_ZTSFvA32u3i32S0_S0_E"} -// CHECK: ![[TYPE66]] = !{i64 0, !"_ZTSFvu3refIu5sliceIu3i32EEE"} -// CHECK: ![[TYPE67]] = !{i64 0, !"_ZTSFvu3refIu5sliceIu3i32EES1_E"} -// CHECK: ![[TYPE68]] = !{i64 0, !"_ZTSFvu3refIu5sliceIu3i32EES1_S1_E"} -// CHECK: ![[TYPE69]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME:[0-9]{1,2}[a-z_]{1,99}]]7Struct1Iu3i32EEE"} -// CHECK: ![[TYPE70]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]7Struct1Iu3i32EES1_E"} -// CHECK: ![[TYPE71]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]7Struct1Iu3i32EES1_S1_E"} -// CHECK: ![[TYPE72]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]5Enum1Iu3i32EEE"} -// CHECK: ![[TYPE73]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]5Enum1Iu3i32EES1_E"} -// CHECK: ![[TYPE74]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]5Enum1Iu3i32EES1_S1_E"} -// CHECK: ![[TYPE75]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]6Union1Iu3i32EEE"} -// CHECK: ![[TYPE76]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]6Union1Iu3i32EES1_E"} -// CHECK: ![[TYPE77]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]6Union1Iu3i32EES1_S1_E"} -// CHECK: ![[TYPE78]] = !{i64 0, !"_ZTSFvP5type1E"} -// CHECK: ![[TYPE79]] = !{i64 0, !"_ZTSFvP5type1S0_E"} -// CHECK: ![[TYPE80]] = !{i64 0, !"_ZTSFvP5type1S0_S0_E"} -// CHECK: ![[TYPE81]] = !{i64 0, !"_ZTSFvU3mutu3refIu3i32EE"} -// CHECK: ![[TYPE82]] = !{i64 0, !"_ZTSFvU3mutu3refIu3i32ES0_E"} -// CHECK: ![[TYPE83]] = !{i64 0, !"_ZTSFvU3mutu3refIu3i32ES0_S0_E"} -// CHECK: ![[TYPE84]] = !{i64 0, !"_ZTSFvu3refIu3i32EE"} -// CHECK: ![[TYPE85]] = !{i64 0, !"_ZTSFvu3refIu3i32EU3mutS0_E"} -// CHECK: ![[TYPE86]] = !{i64 0, !"_ZTSFvu3refIu3i32EU3mutS0_S1_E"} -// CHECK: ![[TYPE87]] = !{i64 0, !"_ZTSFvPu3i32E"} -// CHECK: ![[TYPE88]] = !{i64 0, !"_ZTSFvPu3i32PKS_E"} -// CHECK: ![[TYPE89]] = !{i64 0, !"_ZTSFvPu3i32PKS_S2_E"} -// CHECK: ![[TYPE90]] = !{i64 0, !"_ZTSFvPKu3i32E"} -// CHECK: ![[TYPE91]] = !{i64 0, !"_ZTSFvPKu3i32PS_E"} -// CHECK: ![[TYPE92]] = !{i64 0, !"_ZTSFvPKu3i32PS_S2_E"} -// CHECK: ![[TYPE93]] = !{i64 0, !"_ZTSFvPFu3i32S_EE"} -// CHECK: ![[TYPE94]] = !{i64 0, !"_ZTSFvPFu3i32S_ES0_E"} -// CHECK: ![[TYPE95]] = !{i64 0, !"_ZTSFvPFu3i32S_ES0_S0_E"} -// CHECK: ![[TYPE96]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtNtNtC{{[[:print:]]+}}_4core3ops8function2FnIu5paramEu6regionEEE"} -// CHECK: ![[TYPE97]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtNtNtC{{[[:print:]]+}}_4core3ops8function2FnIu5paramEu6regionEES3_E"} -// CHECK: ![[TYPE98]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtNtNtC{{[[:print:]]+}}_4core3ops8function2FnIu5paramEu6regionEES3_S3_E"} -// CHECK: ![[TYPE99]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtNtNtC{{[[:print:]]+}}_4core3ops8function5FnMutIu5paramEu6regionEEE"} -// CHECK: ![[TYPE100]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtNtNtC{{[[:print:]]+}}_4core3ops8function5FnMutIu5paramEu6regionEES3_E"} -// CHECK: ![[TYPE101]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtNtNtC{{[[:print:]]+}}_4core3ops8function5FnMutIu5paramEu6regionEES3_S3_E"} -// CHECK: ![[TYPE102]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtNtNtC{{[[:print:]]+}}_4core3ops8function6FnOnceIu5paramEu6regionEEE"} -// CHECK: ![[TYPE103]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtNtNtC{{[[:print:]]+}}_4core3ops8function6FnOnceIu5paramEu6regionEES3_E"} -// CHECK: ![[TYPE104]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtNtNtC{{[[:print:]]+}}_4core3ops8function6FnOnceIu5paramEu6regionEES3_S3_E"} -// CHECK: ![[TYPE105]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtNtC{{[[:print:]]+}}_4core6marker4Sendu6regionEEE"} -// CHECK: ![[TYPE106]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtNtC{{[[:print:]]+}}_4core6marker4Sendu6regionEES2_E"} -// CHECK: ![[TYPE107]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtNtC{{[[:print:]]+}}_4core6marker4Sendu6regionEES2_S2_E"} -// CHECK: ![[TYPE108]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NCNvC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3fn111{{[{}][{}]}}closure{{[}][}]}}Iu2i8PFvvEvEE"} -// CHECK: ![[TYPE109]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NCNvC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3fn111{{[{}][{}]}}closure{{[}][}]}}Iu2i8PFvvEvES1_E"} -// CHECK: ![[TYPE110]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NCNvC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3fn111{{[{}][{}]}}closure{{[}][}]}}Iu2i8PFvvEvES1_S1_E"} -// CHECK: ![[TYPE111]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NcNtNvC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3fn13Foo15{{[{}][{}]}}constructor{{[}][}]}}E"} -// CHECK: ![[TYPE112]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NcNtNvC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3fn13Foo15{{[{}][{}]}}constructor{{[}][}]}}S_E"} -// CHECK: ![[TYPE113]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NcNtNvC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3fn13Foo15{{[{}][{}]}}constructor{{[}][}]}}S_S_E"} -// CHECK: ![[TYPE114]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNFNvC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3fn110{{[{}][{}]}}extern{{[}][}]}}3fooE"} -// CHECK: ![[TYPE115]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNFNvC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3fn110{{[{}][{}]}}extern{{[}][}]}}3fooS_E"} -// CHECK: ![[TYPE116]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNFNvC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3fn110{{[{}][{}]}}extern{{[}][}]}}3fooS_S_E"} -// CHECK: ![[TYPE117]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtNCNvC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3fn1s0_11{{[{}][{}]}}closure{{[}][}]}}3FooE"} -// CHECK: ![[TYPE118]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtNCNvC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3fn1s0_11{{[{}][{}]}}closure{{[}][}]}}3FooS_E"} -// CHECK: ![[TYPE119]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtNCNvC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3fn1s0_11{{[{}][{}]}}closure{{[}][}]}}3FooS_S_E"} -// CHECK: ![[TYPE120]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtNkNvC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3fn112{{[{}][{}]}}constant{{[}][}]}}3FooE"} -// CHECK: ![[TYPE121]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtNkNvC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3fn112{{[{}][{}]}}constant{{[}][}]}}3FooS_E"} -// CHECK: ![[TYPE122]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtNkNvC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3fn112{{[{}][{}]}}constant{{[}][}]}}3FooS_S_E"} -// CHECK: ![[TYPE123]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNINvC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3fn18{{[{}][{}]}}impl{{[}][}]}}3fooIu3i32EE"} -// CHECK: ![[TYPE124]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNINvC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3fn18{{[{}][{}]}}impl{{[}][}]}}3fooIu3i32ES0_E"} -// CHECK: ![[TYPE125]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNINvC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3fn18{{[{}][{}]}}impl{{[}][}]}}3fooIu3i32ES0_S0_E"} -// CHECK: ![[TYPE126]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]6Trait13fooIu3dynIu{{[0-9]+}}NtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]6Trait1Iu5paramEu6regionEu3i32EE"} -// CHECK: ![[TYPE127]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]6Trait13fooIu3dynIu{{[0-9]+}}NtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]6Trait1Iu5paramEu6regionEu3i32ES4_E"} -// CHECK: ![[TYPE128]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]6Trait13fooIu3dynIu{{[0-9]+}}NtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]6Trait1Iu5paramEu6regionEu3i32ES4_S4_E"} -// CHECK: ![[TYPE129]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]6Trait13fooIu3i32S_EE"} -// CHECK: ![[TYPE130]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]6Trait13fooIu3i32S_ES0_E"} -// CHECK: ![[TYPE131]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]6Trait13fooIu3i32S_ES0_S0_E"} -// CHECK: ![[TYPE132]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]6Trait13fooIu{{[0-9]+}}NtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]7Struct1Iu3i32ES_EE"} -// CHECK: ![[TYPE133]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]6Trait13fooIu{{[0-9]+}}NtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]7Struct1Iu3i32ES_ES1_E"} -// CHECK: ![[TYPE134]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]6Trait13fooIu{{[0-9]+}}NtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]7Struct1Iu3i32ES_ES1_S1_E"} -// CHECK: ![[TYPE135]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtNvC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3fn13QuxIu3i32Lu5usize32EEE"} -// CHECK: ![[TYPE136]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtNvC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3fn13QuxIu3i32Lu5usize32EES2_E"} -// CHECK: ![[TYPE137]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtNvC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3fn13QuxIu3i32Lu5usize32EES2_S2_E"} -// CHECK: ![[TYPE138]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NcNtNvC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3fn15Quuux15{{[{}][{}]}}constructor{{[}][}]}}Iu6regionS_EE"} -// CHECK: ![[TYPE139]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NcNtNvC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3fn15Quuux15{{[{}][{}]}}constructor{{[}][}]}}Iu6regionS_ES0_E"} -// CHECK: ![[TYPE140]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NcNtNvC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3fn15Quuux15{{[{}][{}]}}constructor{{[}][}]}}Iu6regionS_ES0_S0_E"} -// CHECK: ![[TYPE141]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3FooE"} -// CHECK: ![[TYPE142]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3FooS_E"} -// CHECK: ![[TYPE143]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3FooS_S_E"} -// CHECK: ![[TYPE144]] = !{i64 0, !"_ZTSFvu3refIvEE"} -// CHECK: ![[TYPE145]] = !{i64 0, !"_ZTSFvu3refIvES_E"} -// CHECK: ![[TYPE146]] = !{i64 0, !"_ZTSFvu3refIvES_S_E"} -// CHECK: ![[TYPE147]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3BarE"} -// CHECK: ![[TYPE148]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3BarS_E"} -// CHECK: ![[TYPE149]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3BarS_S_E"} diff --git a/tests/codegen/sanitizer/cfi-add-canonical-jump-tables-flag.rs b/tests/codegen/sanitizer/cfi/add-canonical-jump-tables-flag.rs similarity index 100% rename from tests/codegen/sanitizer/cfi-add-canonical-jump-tables-flag.rs rename to tests/codegen/sanitizer/cfi/add-canonical-jump-tables-flag.rs diff --git a/tests/codegen/sanitizer/cfi-add-enable-split-lto-unit-flag.rs b/tests/codegen/sanitizer/cfi/add-enable-split-lto-unit-flag.rs similarity index 100% rename from tests/codegen/sanitizer/cfi-add-enable-split-lto-unit-flag.rs rename to tests/codegen/sanitizer/cfi/add-enable-split-lto-unit-flag.rs diff --git a/tests/codegen/sanitizer/cfi-emit-type-checks-attr-no-sanitize.rs b/tests/codegen/sanitizer/cfi/emit-type-checks-attr-no-sanitize.rs similarity index 90% rename from tests/codegen/sanitizer/cfi-emit-type-checks-attr-no-sanitize.rs rename to tests/codegen/sanitizer/cfi/emit-type-checks-attr-no-sanitize.rs index 9e0cc346afba0..9f72de2ebcc96 100644 --- a/tests/codegen/sanitizer/cfi-emit-type-checks-attr-no-sanitize.rs +++ b/tests/codegen/sanitizer/cfi/emit-type-checks-attr-no-sanitize.rs @@ -8,7 +8,7 @@ #[no_sanitize(cfi)] pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 { - // CHECK-LABEL: cfi_emit_type_checks_attr_no_sanitize::foo + // CHECK-LABEL: emit_type_checks_attr_no_sanitize::foo // CHECK: Function Attrs: {{.*}} // CHECK-LABEL: define{{.*}}foo{{.*}}!type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} // CHECK: start: diff --git a/tests/codegen/sanitizer/cfi-emit-type-checks.rs b/tests/codegen/sanitizer/cfi/emit-type-checks.rs similarity index 100% rename from tests/codegen/sanitizer/cfi-emit-type-checks.rs rename to tests/codegen/sanitizer/cfi/emit-type-checks.rs diff --git a/tests/codegen/sanitizer/cfi-emit-type-metadata-attr-cfi-encoding.rs b/tests/codegen/sanitizer/cfi/emit-type-metadata-attr-cfi-encoding.rs similarity index 100% rename from tests/codegen/sanitizer/cfi-emit-type-metadata-attr-cfi-encoding.rs rename to tests/codegen/sanitizer/cfi/emit-type-metadata-attr-cfi-encoding.rs diff --git a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-const-generics.rs b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-const-generics.rs new file mode 100644 index 0000000000000..6608caca8af81 --- /dev/null +++ b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-const-generics.rs @@ -0,0 +1,30 @@ +// Verifies that type metadata identifiers for functions are emitted correctly +// for const generics. +// +//@ needs-sanitizer-cfi +//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Copt-level=0 + +#![crate_type="lib"] +#![feature(type_alias_impl_trait)] + +extern crate core; + +pub type Type1 = impl Send; + +pub fn foo() where + Type1: 'static, +{ + pub struct Foo([T; N]); + let _: Type1 = Foo([0; 32]); +} + +pub fn foo1(_: Type1) { } +// CHECK: define{{.*}}4foo1{{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo2(_: Type1, _: Type1) { } +// CHECK: define{{.*}}4foo2{{.*}}!type ![[TYPE2:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo3(_: Type1, _: Type1, _: Type1) { } +// CHECK: define{{.*}}4foo3{{.*}}!type ![[TYPE3:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} + +// CHECK: ![[TYPE1]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtNvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo3FooIu3i32Lu5usize32EEE"} +// CHECK: ![[TYPE2]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtNvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo3FooIu3i32Lu5usize32EES2_E"} +// CHECK: ![[TYPE3]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtNvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo3FooIu3i32Lu5usize32EES2_S2_E"} diff --git a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-function-types.rs b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-function-types.rs new file mode 100644 index 0000000000000..ab3d339989b38 --- /dev/null +++ b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-function-types.rs @@ -0,0 +1,45 @@ +// Verifies that type metadata identifiers for functions are emitted correctly +// for function types. +// +//@ needs-sanitizer-cfi +//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static + +#![crate_type="lib"] + +pub fn foo1(_: fn(i32) -> i32) { } +// CHECK: define{{.*}}4foo1{{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo2(_: fn(i32) -> i32, _: fn(i32) -> i32) { } +// CHECK: define{{.*}}4foo2{{.*}}!type ![[TYPE2:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo3(_: fn(i32) -> i32, _: fn(i32) -> i32, _: fn(i32) -> i32) { } +// CHECK: define{{.*}}4foo3{{.*}}!type ![[TYPE3:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo4(_: &dyn Fn(i32) -> i32) { } +// CHECK: define{{.*}}4foo4{{.*}}!type ![[TYPE4:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo5(_: &dyn Fn(i32) -> i32, _: &dyn Fn(i32) -> i32) { } +// CHECK: define{{.*}}4foo5{{.*}}!type ![[TYPE5:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo6(_: &dyn Fn(i32) -> i32, _: &dyn Fn(i32) -> i32, _: &dyn Fn(i32) -> i32) { } +// CHECK: define{{.*}}4foo6{{.*}}!type ![[TYPE6:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo7(_: &dyn FnMut(i32) -> i32) { } +// CHECK: define{{.*}}4foo7{{.*}}!type ![[TYPE7:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo8(_: &dyn FnMut(i32) -> i32, _: &dyn FnMut(i32) -> i32) { } +// CHECK: define{{.*}}4foo8{{.*}}!type ![[TYPE8:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo9(_: &dyn FnMut(i32) -> i32, _: &dyn FnMut(i32) -> i32, _: &dyn FnMut(i32) -> i32) { } +// CHECK: define{{.*}}4foo9{{.*}}!type ![[TYPE9:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo10(_: &dyn FnOnce(i32) -> i32) { } +// CHECK: define{{.*}}5foo10{{.*}}!type ![[TYPE10:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo11(_: &dyn FnOnce(i32) -> i32, _: &dyn FnOnce(i32) -> i32) { } +// CHECK: define{{.*}}5foo11{{.*}}!type ![[TYPE11:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo12(_: &dyn FnOnce(i32) -> i32, _: &dyn FnOnce(i32) -> i32, _: &dyn FnOnce(i32) -> i32) {} +// CHECK: define{{.*}}5foo12{{.*}}!type ![[TYPE12:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} + +// CHECK: ![[TYPE1]] = !{i64 0, !"_ZTSFvPFu3i32S_EE"} +// CHECK: ![[TYPE2]] = !{i64 0, !"_ZTSFvPFu3i32S_ES0_E"} +// CHECK: ![[TYPE3]] = !{i64 0, !"_ZTSFvPFu3i32S_ES0_S0_E"} +// CHECK: ![[TYPE4]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtNtNtC{{[[:print:]]+}}_4core3ops8function2FnIu5paramEu6regionEEE"} +// CHECK: ![[TYPE5]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtNtNtC{{[[:print:]]+}}_4core3ops8function2FnIu5paramEu6regionEES3_E"} +// CHECK: ![[TYPE6]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtNtNtC{{[[:print:]]+}}_4core3ops8function2FnIu5paramEu6regionEES3_S3_E"} +// CHECK: ![[TYPE7]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtNtNtC{{[[:print:]]+}}_4core3ops8function5FnMutIu5paramEu6regionEEE"} +// CHECK: ![[TYPE8]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtNtNtC{{[[:print:]]+}}_4core3ops8function5FnMutIu5paramEu6regionEES3_E"} +// CHECK: ![[TYPE9]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtNtNtC{{[[:print:]]+}}_4core3ops8function5FnMutIu5paramEu6regionEES3_S3_E"} +// CHECK: ![[TYPE10]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtNtNtC{{[[:print:]]+}}_4core3ops8function6FnOnceIu5paramEu6regionEEE"} +// CHECK: ![[TYPE11]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtNtNtC{{[[:print:]]+}}_4core3ops8function6FnOnceIu5paramEu6regionEES3_E"} +// CHECK: ![[TYPE12]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtNtNtC{{[[:print:]]+}}_4core3ops8function6FnOnceIu5paramEu6regionEES3_S3_E"} diff --git a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-lifetimes.rs b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-lifetimes.rs new file mode 100644 index 0000000000000..4d08c0c3039a3 --- /dev/null +++ b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-lifetimes.rs @@ -0,0 +1,27 @@ +// Verifies that type metadata identifiers for functions are emitted correctly +// for lifetimes/regions. +// +//@ needs-sanitizer-cfi +//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Copt-level=0 + +#![crate_type="lib"] +#![feature(type_alias_impl_trait)] + +extern crate core; + +pub type Type1 = impl Send; + +pub fn foo<'a>() where + Type1: 'static, +{ + pub struct Foo<'a>(&'a i32); + pub struct Bar<'a, 'b>(&'a i32, &'b Foo<'b>); + let _: Type1 = Bar; +} + +pub fn foo1(_: Type1) { } +// CHECK: define{{.*}}4foo1{{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo2(_: Type1, _: Type1) { } +// CHECK: define{{.*}}4foo2{{.*}}!type ![[TYPE2:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo3(_: Type1, _: Type1, _: Type1) { } +// CHECK: define{{.*}}4foo3{{.*}}!type ![[TYPE3:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} diff --git a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-paths.rs b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-paths.rs new file mode 100644 index 0000000000000..c5d8e0f22a2a0 --- /dev/null +++ b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-paths.rs @@ -0,0 +1,86 @@ +// Verifies that type metadata identifiers for functions are emitted correctly +// for paths. +// +//@ needs-sanitizer-cfi +//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static + +#![crate_type="lib"] +#![feature(inline_const, type_alias_impl_trait)] + +extern crate core; + +pub type Type1 = impl Send; +pub type Type2 = impl Send; +pub type Type3 = impl Send; +pub type Type4 = impl Send; + +pub fn foo() where + Type1: 'static, + Type2: 'static, + Type3: 'static, + Type4: 'static, +{ + // Type in extern path + extern { + fn bar(); + } + let _: Type1 = bar; + + // Type in closure path + || { + pub struct Foo; + let _: Type2 = Foo; + }; + + // Type in const path + const { + pub struct Foo; + fn bar() -> Type3 { Foo } + }; + + + // Type in impl path + struct Foo; + impl Foo { + fn bar(&self) { } + } + let _: Type4 = ::bar; +} + +pub fn foo1(_: Type1) { } +// CHECK: define{{.*}}4foo1{{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo2(_: Type1, _: Type1) { } +// CHECK: define{{.*}}4foo2{{.*}}!type ![[TYPE2:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo3(_: Type1, _: Type1, _: Type1) { } +// CHECK: define{{.*}}4foo3{{.*}}!type ![[TYPE3:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo4(_: Type2) { } +// CHECK: define{{.*}}4foo4{{.*}}!type ![[TYPE4:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo5(_: Type2, _: Type2) { } +// CHECK: define{{.*}}4foo5{{.*}}!type ![[TYPE5:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo6(_: Type2, _: Type2, _: Type2) { } +// CHECK: define{{.*}}4foo6{{.*}}!type ![[TYPE6:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo7(_: Type3) { } +// CHECK: define{{.*}}4foo7{{.*}}!type ![[TYPE7:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo8(_: Type3, _: Type3) { } +// CHECK: define{{.*}}4foo8{{.*}}!type ![[TYPE8:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo9(_: Type3, _: Type3, _: Type3) { } +// CHECK: define{{.*}}4foo9{{.*}}!type ![[TYPE9:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo10(_: Type4) { } +// CHECK: define{{.*}}5foo10{{.*}}!type ![[TYPE10:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo11(_: Type4, _: Type4) { } +// CHECK: define{{.*}}5foo11{{.*}}!type ![[TYPE11:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo12(_: Type4, _: Type4, _: Type4) { } +// CHECK: define{{.*}}5foo12{{.*}}!type ![[TYPE12:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} + +// CHECK: ![[TYPE1]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNFNvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo10{{[{}][{}]}}extern{{[}][}]}}3barE"} +// CHECK: ![[TYPE2]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNFNvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo10{{[{}][{}]}}extern{{[}][}]}}3barS_E"} +// CHECK: ![[TYPE3]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNFNvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo10{{[{}][{}]}}extern{{[}][}]}}3barS_S_E"} +// CHECK: ![[TYPE4]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtNCNvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo11{{[{}][{}]}}closure{{[}][}]}}3FooE"} +// CHECK: ![[TYPE5]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtNCNvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo11{{[{}][{}]}}closure{{[}][}]}}3FooS_E"} +// CHECK: ![[TYPE6]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtNCNvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo11{{[{}][{}]}}closure{{[}][}]}}3FooS_S_E"} +// CHECK: ![[TYPE7]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtNkNvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo12{{[{}][{}]}}constant{{[}][}]}}3FooE"} +// CHECK: ![[TYPE8]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtNkNvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo12{{[{}][{}]}}constant{{[}][}]}}3FooS_E"} +// CHECK: ![[TYPE9]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtNkNvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo12{{[{}][{}]}}constant{{[}][}]}}3FooS_S_E"} +// CHECK: ![[TYPE10]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNINvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo8{{[{}][{}]}}impl{{[}][}]}}3barE"} +// CHECK: ![[TYPE11]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNINvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo8{{[{}][{}]}}impl{{[}][}]}}3barS_E"} +// CHECK: ![[TYPE12]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNINvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo8{{[{}][{}]}}impl{{[}][}]}}3barS_S_E"} diff --git a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-pointer-types.rs b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-pointer-types.rs new file mode 100644 index 0000000000000..6ad6f3ac3489c --- /dev/null +++ b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-pointer-types.rs @@ -0,0 +1,54 @@ +// Verifies that type metadata identifiers for functions are emitted correctly +// for pointer types. +// +//@ needs-sanitizer-cfi +//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static + +#![crate_type="lib"] + +pub fn foo1(_: &mut i32) { } +// CHECK: define{{.*}}4foo1{{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo2(_: &mut i32, _: &i32) { } +// CHECK: define{{.*}}4foo2{{.*}}!type ![[TYPE2:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo3(_: &mut i32, _: &i32, _: &i32) { } +// CHECK: define{{.*}}4foo3{{.*}}!type ![[TYPE3:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo4(_: &i32) { } +// CHECK: define{{.*}}4foo4{{.*}}!type ![[TYPE4:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo5(_: &i32, _: &mut i32) { } +// CHECK: define{{.*}}4foo5{{.*}}!type ![[TYPE5:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo6(_: &i32, _: &mut i32, _: &mut i32) { } +// CHECK: define{{.*}}4foo6{{.*}}!type ![[TYPE6:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo7(_: *mut i32) { } +// CHECK: define{{.*}}4foo7{{.*}}!type ![[TYPE7:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo8(_: *mut i32, _: *const i32) { } +// CHECK: define{{.*}}4foo8{{.*}}!type ![[TYPE8:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo9(_: *mut i32, _: *const i32, _: *const i32) { } +// CHECK: define{{.*}}4foo9{{.*}}!type ![[TYPE9:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo10(_: *const i32) { } +// CHECK: define{{.*}}5foo10{{.*}}!type ![[TYPE10:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo11(_: *const i32, _: *mut i32) { } +// CHECK: define{{.*}}5foo11{{.*}}!type ![[TYPE11:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo12(_: *const i32, _: *mut i32, _: *mut i32) { } +// CHECK: define{{.*}}5foo12{{.*}}!type ![[TYPE12:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo13(_: fn(i32) -> i32) { } +// CHECK: define{{.*}}5foo13{{.*}}!type ![[TYPE13:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo14(_: fn(i32) -> i32, _: fn(i32) -> i32) { } +// CHECK: define{{.*}}5foo14{{.*}}!type ![[TYPE14:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo15(_: fn(i32) -> i32, _: fn(i32) -> i32, _: fn(i32) -> i32) { } +// CHECK: define{{.*}}5foo15{{.*}}!type ![[TYPE15:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} + +// CHECK: ![[TYPE1]] = !{i64 0, !"_ZTSFvU3mutu3refIu3i32EE"} +// CHECK: ![[TYPE2]] = !{i64 0, !"_ZTSFvU3mutu3refIu3i32ES0_E"} +// CHECK: ![[TYPE3]] = !{i64 0, !"_ZTSFvU3mutu3refIu3i32ES0_S0_E"} +// CHECK: ![[TYPE4]] = !{i64 0, !"_ZTSFvu3refIu3i32EE"} +// CHECK: ![[TYPE5]] = !{i64 0, !"_ZTSFvu3refIu3i32EU3mutS0_E"} +// CHECK: ![[TYPE6]] = !{i64 0, !"_ZTSFvu3refIu3i32EU3mutS0_S1_E"} +// CHECK: ![[TYPE7]] = !{i64 0, !"_ZTSFvPu3i32E"} +// CHECK: ![[TYPE8]] = !{i64 0, !"_ZTSFvPu3i32PKS_E"} +// CHECK: ![[TYPE9]] = !{i64 0, !"_ZTSFvPu3i32PKS_S2_E"} +// CHECK: ![[TYPE10]] = !{i64 0, !"_ZTSFvPKu3i32E"} +// CHECK: ![[TYPE11]] = !{i64 0, !"_ZTSFvPKu3i32PS_E"} +// CHECK: ![[TYPE12]] = !{i64 0, !"_ZTSFvPKu3i32PS_S2_E"} +// CHECK: ![[TYPE13]] = !{i64 0, !"_ZTSFvPFu3i32S_EE"} +// CHECK: ![[TYPE14]] = !{i64 0, !"_ZTSFvPFu3i32S_ES0_E"} +// CHECK: ![[TYPE15]] = !{i64 0, !"_ZTSFvPFu3i32S_ES0_S0_E"} diff --git a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-primitive-types.rs b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-primitive-types.rs new file mode 100644 index 0000000000000..3a1a09150eae9 --- /dev/null +++ b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-primitive-types.rs @@ -0,0 +1,192 @@ +// Verifies that type metadata identifiers for functions are emitted correctly +// for primitive types. +// +//@ needs-sanitizer-cfi +//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static + +#![crate_type="lib"] + +extern crate core; +use core::ffi::*; + +pub fn foo1(_: ()) { } +// CHECK: define{{.*}}4foo1{{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo2(_: (), _: c_void) { } +// CHECK: define{{.*}}4foo2{{.*}}!type ![[TYPE2:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo3(_: (), _: c_void, _: c_void) { } +// CHECK: define{{.*}}4foo3{{.*}}!type ![[TYPE3:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo4(_: *mut ()) { } +// CHECK: define{{.*}}4foo4{{.*}}!type ![[TYPE4:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo5(_: *mut (), _: *mut c_void) { } +// CHECK: define{{.*}}4foo5{{.*}}!type ![[TYPE5:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo6(_: *mut (), _: *mut c_void, _: *mut c_void) { } +// CHECK: define{{.*}}4foo6{{.*}}!type ![[TYPE6:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo7(_: *const ()) { } +// CHECK: define{{.*}}4foo7{{.*}}!type ![[TYPE7:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo8(_: *const (), _: *const c_void) { } +// CHECK: define{{.*}}4foo8{{.*}}!type ![[TYPE8:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo9(_: *const (), _: *const c_void, _: *const c_void) { } +// CHECK: define{{.*}}4foo9{{.*}}!type ![[TYPE9:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo10(_: bool) { } +// CHECK: define{{.*}}5foo10{{.*}}!type ![[TYPE10:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo11(_: bool, _: bool) { } +// CHECK: define{{.*}}5foo11{{.*}}!type ![[TYPE11:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo12(_: bool, _: bool, _: bool) { } +// CHECK: define{{.*}}5foo12{{.*}}!type ![[TYPE12:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo13(_: i8) { } +// CHECK: define{{.*}}5foo13{{.*}}!type ![[TYPE13:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo14(_: i8, _: i8) { } +// CHECK: define{{.*}}5foo14{{.*}}!type ![[TYPE14:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo15(_: i8, _: i8, _: i8) { } +// CHECK: define{{.*}}5foo15{{.*}}!type ![[TYPE15:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo16(_: i16) { } +// CHECK: define{{.*}}5foo16{{.*}}!type ![[TYPE16:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo17(_: i16, _: i16) { } +// CHECK: define{{.*}}5foo17{{.*}}!type ![[TYPE17:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo18(_: i16, _: i16, _: i16) { } +// CHECK: define{{.*}}5foo18{{.*}}!type ![[TYPE18:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo19(_: i32) { } +// CHECK: define{{.*}}5foo19{{.*}}!type ![[TYPE19:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo20(_: i32, _: i32) { } +// CHECK: define{{.*}}5foo20{{.*}}!type ![[TYPE20:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo21(_: i32, _: i32, _: i32) { } +// CHECK: define{{.*}}5foo21{{.*}}!type ![[TYPE21:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo22(_: i64) { } +// CHECK: define{{.*}}5foo22{{.*}}!type ![[TYPE22:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo23(_: i64, _: i64) { } +// CHECK: define{{.*}}5foo23{{.*}}!type ![[TYPE23:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo24(_: i64, _: i64, _: i64) { } +// CHECK: define{{.*}}5foo24{{.*}}!type ![[TYPE24:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo25(_: i128) { } +// CHECK: define{{.*}}5foo25{{.*}}!type ![[TYPE25:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo26(_: i128, _: i128) { } +// CHECK: define{{.*}}5foo26{{.*}}!type ![[TYPE26:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo27(_: i128, _: i128, _: i128) { } +// CHECK: define{{.*}}5foo27{{.*}}!type ![[TYPE27:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo28(_: isize) { } +// CHECK: define{{.*}}5foo28{{.*}}!type ![[TYPE28:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo29(_: isize, _: isize) { } +// CHECK: define{{.*}}5foo29{{.*}}!type ![[TYPE29:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo30(_: isize, _: isize, _: isize) { } +// CHECK: define{{.*}}5foo30{{.*}}!type ![[TYPE30:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo31(_: u8) { } +// CHECK: define{{.*}}5foo31{{.*}}!type ![[TYPE31:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo32(_: u8, _: u8) { } +// CHECK: define{{.*}}5foo32{{.*}}!type ![[TYPE32:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo33(_: u8, _: u8, _: u8) { } +// CHECK: define{{.*}}5foo33{{.*}}!type ![[TYPE33:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo34(_: u16) { } +// CHECK: define{{.*}}5foo34{{.*}}!type ![[TYPE34:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo35(_: u16, _: u16) { } +// CHECK: define{{.*}}5foo35{{.*}}!type ![[TYPE35:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo36(_: u16, _: u16, _: u16) { } +// CHECK: define{{.*}}5foo36{{.*}}!type ![[TYPE36:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo37(_: u32) { } +// CHECK: define{{.*}}5foo37{{.*}}!type ![[TYPE37:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo38(_: u32, _: u32) { } +// CHECK: define{{.*}}5foo38{{.*}}!type ![[TYPE38:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo39(_: u32, _: u32, _: u32) { } +// CHECK: define{{.*}}5foo39{{.*}}!type ![[TYPE39:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo40(_: u64) { } +// CHECK: define{{.*}}5foo40{{.*}}!type ![[TYPE40:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo41(_: u64, _: u64) { } +// CHECK: define{{.*}}5foo41{{.*}}!type ![[TYPE41:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo42(_: u64, _: u64, _: u64) { } +// CHECK: define{{.*}}5foo42{{.*}}!type ![[TYPE42:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo43(_: u128) { } +// CHECK: define{{.*}}5foo43{{.*}}!type ![[TYPE43:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo44(_: u128, _: u128) { } +// CHECK: define{{.*}}5foo44{{.*}}!type ![[TYPE44:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo45(_: u128, _: u128, _: u128) { } +// CHECK: define{{.*}}5foo45{{.*}}!type ![[TYPE45:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo46(_: usize) { } +// CHECK: define{{.*}}5foo46{{.*}}!type ![[TYPE46:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo47(_: usize, _: usize) { } +// CHECK: define{{.*}}5foo47{{.*}}!type ![[TYPE47:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo48(_: usize, _: usize, _: usize) { } +// CHECK: define{{.*}}5foo48{{.*}}!type ![[TYPE48:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo49(_: f32) { } +// CHECK: define{{.*}}5foo49{{.*}}!type ![[TYPE49:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo50(_: f32, _: f32) { } +// CHECK: define{{.*}}5foo50{{.*}}!type ![[TYPE50:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo51(_: f32, _: f32, _: f32) { } +// CHECK: define{{.*}}5foo51{{.*}}!type ![[TYPE51:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo52(_: f64) { } +// CHECK: define{{.*}}5foo52{{.*}}!type ![[TYPE52:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo53(_: f64, _: f64) { } +// CHECK: define{{.*}}5foo53{{.*}}!type ![[TYPE53:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo54(_: f64, _: f64, _: f64) { } +// CHECK: define{{.*}}5foo54{{.*}}!type ![[TYPE54:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo55(_: char) { } +// CHECK: define{{.*}}5foo55{{.*}}!type ![[TYPE55:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo56(_: char, _: char) { } +// CHECK: define{{.*}}5foo56{{.*}}!type ![[TYPE56:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo57(_: char, _: char, _: char) { } +// CHECK: define{{.*}}5foo57{{.*}}!type ![[TYPE57:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo58(_: &str) { } +// CHECK: define{{.*}}5foo58{{.*}}!type ![[TYPE58:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo59(_: &str, _: &str) { } +// CHECK: define{{.*}}5foo59{{.*}}!type ![[TYPE59:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo60(_: &str, _: &str, _: &str) { } +// CHECK: define{{.*}}5foo60{{.*}}!type ![[TYPE60:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} + +// CHECK: ![[TYPE1]] = !{i64 0, !"_ZTSFvvE"} +// CHECK: ![[TYPE2]] = !{i64 0, !"_ZTSFvvvE"} +// CHECK: ![[TYPE3]] = !{i64 0, !"_ZTSFvvvvE"} +// CHECK: ![[TYPE4]] = !{i64 0, !"_ZTSFvPvE"} +// CHECK: ![[TYPE5]] = !{i64 0, !"_ZTSFvPvS_E"} +// CHECK: ![[TYPE6]] = !{i64 0, !"_ZTSFvPvS_S_E"} +// CHECK: ![[TYPE7]] = !{i64 0, !"_ZTSFvPKvE"} +// CHECK: ![[TYPE8]] = !{i64 0, !"_ZTSFvPKvS0_E"} +// CHECK: ![[TYPE9]] = !{i64 0, !"_ZTSFvPKvS0_S0_E"} +// CHECK: ![[TYPE10]] = !{i64 0, !"_ZTSFvbE"} +// CHECK: ![[TYPE11]] = !{i64 0, !"_ZTSFvbbE"} +// CHECK: ![[TYPE12]] = !{i64 0, !"_ZTSFvbbbE"} +// CHECK: ![[TYPE13]] = !{i64 0, !"_ZTSFvu2i8E"} +// CHECK: ![[TYPE14]] = !{i64 0, !"_ZTSFvu2i8S_E"} +// CHECK: ![[TYPE15]] = !{i64 0, !"_ZTSFvu2i8S_S_E"} +// CHECK: ![[TYPE16]] = !{i64 0, !"_ZTSFvu3i16E"} +// CHECK: ![[TYPE17]] = !{i64 0, !"_ZTSFvu3i16S_E"} +// CHECK: ![[TYPE18]] = !{i64 0, !"_ZTSFvu3i16S_S_E"} +// CHECK: ![[TYPE19]] = !{i64 0, !"_ZTSFvu3i32E"} +// CHECK: ![[TYPE20]] = !{i64 0, !"_ZTSFvu3i32S_E"} +// CHECK: ![[TYPE21]] = !{i64 0, !"_ZTSFvu3i32S_S_E"} +// CHECK: ![[TYPE22]] = !{i64 0, !"_ZTSFvu3i64E"} +// CHECK: ![[TYPE23]] = !{i64 0, !"_ZTSFvu3i64S_E"} +// CHECK: ![[TYPE24]] = !{i64 0, !"_ZTSFvu3i64S_S_E"} +// CHECK: ![[TYPE25]] = !{i64 0, !"_ZTSFvu4i128E"} +// CHECK: ![[TYPE26]] = !{i64 0, !"_ZTSFvu4i128S_E"} +// CHECK: ![[TYPE27]] = !{i64 0, !"_ZTSFvu4i128S_S_E"} +// CHECK: ![[TYPE28]] = !{i64 0, !"_ZTSFvu5isizeE"} +// CHECK: ![[TYPE29]] = !{i64 0, !"_ZTSFvu5isizeS_E"} +// CHECK: ![[TYPE30]] = !{i64 0, !"_ZTSFvu5isizeS_S_E"} +// CHECK: ![[TYPE31]] = !{i64 0, !"_ZTSFvu2u8E"} +// CHECK: ![[TYPE32]] = !{i64 0, !"_ZTSFvu2u8S_E"} +// CHECK: ![[TYPE33]] = !{i64 0, !"_ZTSFvu2u8S_S_E"} +// CHECK: ![[TYPE34]] = !{i64 0, !"_ZTSFvu3u16E"} +// CHECK: ![[TYPE35]] = !{i64 0, !"_ZTSFvu3u16S_E"} +// CHECK: ![[TYPE36]] = !{i64 0, !"_ZTSFvu3u16S_S_E"} +// CHECK: ![[TYPE37]] = !{i64 0, !"_ZTSFvu3u32E"} +// CHECK: ![[TYPE38]] = !{i64 0, !"_ZTSFvu3u32S_E"} +// CHECK: ![[TYPE39]] = !{i64 0, !"_ZTSFvu3u32S_S_E"} +// CHECK: ![[TYPE40]] = !{i64 0, !"_ZTSFvu3u64E"} +// CHECK: ![[TYPE41]] = !{i64 0, !"_ZTSFvu3u64S_E"} +// CHECK: ![[TYPE42]] = !{i64 0, !"_ZTSFvu3u64S_S_E"} +// CHECK: ![[TYPE43]] = !{i64 0, !"_ZTSFvu4u128E"} +// CHECK: ![[TYPE44]] = !{i64 0, !"_ZTSFvu4u128S_E"} +// CHECK: ![[TYPE45]] = !{i64 0, !"_ZTSFvu4u128S_S_E"} +// CHECK: ![[TYPE46]] = !{i64 0, !"_ZTSFvu5usizeE"} +// CHECK: ![[TYPE47]] = !{i64 0, !"_ZTSFvu5usizeS_E"} +// CHECK: ![[TYPE48]] = !{i64 0, !"_ZTSFvu5usizeS_S_E"} +// CHECK: ![[TYPE49]] = !{i64 0, !"_ZTSFvfE"} +// CHECK: ![[TYPE50]] = !{i64 0, !"_ZTSFvffE"} +// CHECK: ![[TYPE51]] = !{i64 0, !"_ZTSFvfffE"} +// CHECK: ![[TYPE52]] = !{i64 0, !"_ZTSFvdE"} +// CHECK: ![[TYPE53]] = !{i64 0, !"_ZTSFvddE"} +// CHECK: ![[TYPE54]] = !{i64 0, !"_ZTSFvdddE"} +// CHECK: ![[TYPE55]] = !{i64 0, !"_ZTSFvu4charE"} +// CHECK: ![[TYPE56]] = !{i64 0, !"_ZTSFvu4charS_E"} +// CHECK: ![[TYPE57]] = !{i64 0, !"_ZTSFvu4charS_S_E"} +// CHECK: ![[TYPE58]] = !{i64 0, !"_ZTSFvu3refIu3strEE"} +// CHECK: ![[TYPE59]] = !{i64 0, !"_ZTSFvu3refIu3strES0_E"} +// CHECK: ![[TYPE60]] = !{i64 0, !"_ZTSFvu3refIu3strES0_S0_E"} diff --git a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-repr-transparent-types.rs b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-repr-transparent-types.rs new file mode 100644 index 0000000000000..0deda029c4b09 --- /dev/null +++ b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-repr-transparent-types.rs @@ -0,0 +1,64 @@ +// Verifies that type metadata identifiers for functions are emitted correctly +// for repr transparent types. +// +//@ needs-sanitizer-cfi +//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static + +#![crate_type="lib"] + +extern crate core; +use core::ffi::*; +use std::marker::PhantomData; + +struct Foo(i32); + +// repr(transparent) user-defined type +#[repr(transparent)] +pub struct Type1 { + member1: (), + member2: PhantomData, + member3: Foo, +} + +// Self-referencing repr(transparent) user-defined type +#[repr(transparent)] +pub struct Type2<'a> { + member1: (), + member2: PhantomData, + member3: &'a Type2<'a>, +} + +pub struct Bar; + +// repr(transparent) user-defined generic type +#[repr(transparent)] +pub struct Type3(T); + +pub fn foo1(_: Type1) { } +// CHECK: define{{.*}}4foo1{{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo2(_: Type1, _: Type1) { } +// CHECK: define{{.*}}4foo2{{.*}}!type ![[TYPE2:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo3(_: Type1, _: Type1, _: Type1) { } +// CHECK: define{{.*}}4foo3{{.*}}!type ![[TYPE3:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo4(_: Type2) { } +// CHECK: define{{.*}}4foo4{{.*}}!type ![[TYPE4:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo5(_: Type2, _: Type2) { } +// CHECK: define{{.*}}4foo5{{.*}}!type ![[TYPE5:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo6(_: Type2, _: Type2, _: Type2) { } +// CHECK: define{{.*}}4foo6{{.*}}!type ![[TYPE6:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo7(_: Type3) { } +// CHECK: define{{.*}}4foo7{{.*}}!type ![[TYPE7:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo8(_: Type3, _: Type3) { } +// CHECK: define{{.*}}4foo8{{.*}}!type ![[TYPE8:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo9(_: Type3, _: Type3, _: Type3) { } +// CHECK: define{{.*}}4foo9{{.*}}!type ![[TYPE9:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} + +// CHECK: ![[TYPE1]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtC{{[[:print:]]+}}_{{[[:print:]]+}}3FooE"} +// CHECK: ![[TYPE2]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtC{{[[:print:]]+}}_{{[[:print:]]+}}3FooS_E"} +// CHECK: ![[TYPE3]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtC{{[[:print:]]+}}_{{[[:print:]]+}}3FooS_S_E"} +// CHECK: ![[TYPE4]] = !{i64 0, !"_ZTSFvu3refIvEE"} +// CHECK: ![[TYPE5]] = !{i64 0, !"_ZTSFvu3refIvES_E"} +// CHECK: ![[TYPE6]] = !{i64 0, !"_ZTSFvu3refIvES_S_E"} +// CHECK: ![[TYPE7]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtC{{[[:print:]]+}}_{{[[:print:]]+}}3BarE"} +// CHECK: ![[TYPE8]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtC{{[[:print:]]+}}_{{[[:print:]]+}}3BarS_E"} +// CHECK: ![[TYPE9]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtC{{[[:print:]]+}}_{{[[:print:]]+}}3BarS_S_E"} diff --git a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-sequence-types.rs b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-sequence-types.rs new file mode 100644 index 0000000000000..dd2e05dd2ec62 --- /dev/null +++ b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-sequence-types.rs @@ -0,0 +1,36 @@ +// Verifies that type metadata identifiers for functions are emitted correctly +// for sequence types. +// +//@ needs-sanitizer-cfi +//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static + +#![crate_type="lib"] + +pub fn foo1(_: (i32, i32)) { } +// CHECK: define{{.*}}4foo1{{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo2(_: (i32, i32), _: (i32, i32)) { } +// CHECK: define{{.*}}4foo2{{.*}}!type ![[TYPE2:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo3(_: (i32, i32), _: (i32, i32), _: (i32, i32)) { } +// CHECK: define{{.*}}4foo3{{.*}}!type ![[TYPE3:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo4(_: [i32; 32]) { } +// CHECK: define{{.*}}4foo4{{.*}}!type ![[TYPE4:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo5(_: [i32; 32], _: [i32; 32]) { } +// CHECK: define{{.*}}4foo5{{.*}}!type ![[TYPE5:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo6(_: [i32; 32], _: [i32; 32], _: [i32; 32]) { } +// CHECK: define{{.*}}4foo6{{.*}}!type ![[TYPE6:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo7(_: &[i32]) { } +// CHECK: define{{.*}}4foo7{{.*}}!type ![[TYPE7:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo8(_: &[i32], _: &[i32]) { } +// CHECK: define{{.*}}4foo8{{.*}}!type ![[TYPE8:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo9(_: &[i32], _: &[i32], _: &[i32]) { } +// CHECK: define{{.*}}4foo9{{.*}}!type ![[TYPE9:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} + +// CHECK: ![[TYPE1]] = !{i64 0, !"_ZTSFvu5tupleIu3i32S_EE"} +// CHECK: ![[TYPE2]] = !{i64 0, !"_ZTSFvu5tupleIu3i32S_ES0_E"} +// CHECK: ![[TYPE3]] = !{i64 0, !"_ZTSFvu5tupleIu3i32S_ES0_S0_E"} +// CHECK: ![[TYPE4]] = !{i64 0, !"_ZTSFvA32u3i32E"} +// CHECK: ![[TYPE5]] = !{i64 0, !"_ZTSFvA32u3i32S0_E"} +// CHECK: ![[TYPE6]] = !{i64 0, !"_ZTSFvA32u3i32S0_S0_E"} +// CHECK: ![[TYPE7]] = !{i64 0, !"_ZTSFvu3refIu5sliceIu3i32EEE"} +// CHECK: ![[TYPE8]] = !{i64 0, !"_ZTSFvu3refIu5sliceIu3i32EES1_E"} +// CHECK: ![[TYPE9]] = !{i64 0, !"_ZTSFvu3refIu5sliceIu3i32EES1_S1_E"} diff --git a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-trait-types.rs b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-trait-types.rs new file mode 100644 index 0000000000000..997ae3dd25dc4 --- /dev/null +++ b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-trait-types.rs @@ -0,0 +1,161 @@ +// Verifies that type metadata identifiers for functions are emitted correctly +// for trait types. +// +//@ needs-sanitizer-cfi +//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static + +#![crate_type="lib"] + +extern crate core; + +pub trait Trait1 { + fn foo(&self); +} + +#[derive(Clone, Copy)] +pub struct Type1; + +impl Trait1 for Type1 { + fn foo(&self) { + } +} + +pub trait Trait2 { + fn bar(&self); +} + +pub struct Type2; + +impl Trait2 for Type2 { + fn bar(&self) { + } +} + +pub trait Trait3 { + fn baz(&self, _: &T); +} + +pub struct Type3; + +impl Trait3 for T { + fn baz(&self, _: &U) { + } +} + +pub trait Trait4<'a, T> { + type Output: 'a; + fn qux(&self, _: &T) -> Self::Output; +} + +pub struct Type4; + +impl<'a, T, U> Trait4<'a, U> for T { + type Output = &'a i32; + fn qux(&self, _: &U) -> Self::Output { + &0 + } +} + +pub trait Trait5 { + fn quux(&self, _: &[T; N]); +} + +#[derive(Copy, Clone)] +pub struct Type5; + +impl Trait5 for T { + fn quux(&self, _: &[U; N]) { + } +} + +pub fn foo1(_: &dyn Send) { } +// CHECK: define{{.*}}4foo1{{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo2(_: &dyn Send, _: &dyn Send) { } +// CHECK: define{{.*}}4foo2{{.*}}!type ![[TYPE2:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo3(_: &dyn Send, _: &dyn Send, _: &dyn Send) { } +// CHECK: define{{.*}}4foo3{{.*}}!type ![[TYPE3:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo4(_: &(dyn Send + Sync)) { } +// CHECK: define{{.*}}4foo4{{.*}}!type ![[TYPE4:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo5(_: &(dyn Send + Sync), _: &(dyn Sync + Send)) { } +// CHECK: define{{.*}}4foo5{{.*}}!type ![[TYPE5:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo6(_: &(dyn Send + Sync), _: &(dyn Sync + Send), _: &(dyn Sync + Send)) { } +// CHECK: define{{.*}}4foo6{{.*}}!type ![[TYPE6:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo7(_: &(dyn Trait1 + Send)) { } +// CHECK: define{{.*}}4foo7{{.*}}!type ![[TYPE7:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo8(_: &(dyn Trait1 + Send), _: &(dyn Trait1 + Send)) { } +// CHECK: define{{.*}}4foo8{{.*}}!type ![[TYPE8:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo9(_: &(dyn Trait1 + Send), _: &(dyn Trait1 + Send), _: &(dyn Trait1 + Send)) { } +// CHECK: define{{.*}}4foo9{{.*}}!type ![[TYPE9:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo10(_: &(dyn Trait1 + Send + Sync)) { } +// CHECK: define{{.*}}5foo10{{.*}}!type ![[TYPE10:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo11(_: &(dyn Trait1 + Send + Sync), _: &(dyn Trait1 + Sync + Send)) { } +// CHECK: define{{.*}}5foo11{{.*}}!type ![[TYPE11:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo12(_: &(dyn Trait1 + Send + Sync), + _: &(dyn Trait1 + Sync + Send), + _: &(dyn Trait1 + Sync + Send)) { } +// CHECK: define{{.*}}5foo12{{.*}}!type ![[TYPE12:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo13(_: &dyn Trait1) { } +// CHECK: define{{.*}}5foo13{{.*}}!type ![[TYPE13:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo14(_: &dyn Trait1, _: &dyn Trait1) { } +// CHECK: define{{.*}}5foo14{{.*}}!type ![[TYPE14:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo15(_: &dyn Trait1, _: &dyn Trait1, _: &dyn Trait1) { } +// CHECK: define{{.*}}5foo15{{.*}}!type ![[TYPE15:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo16(_: &dyn Trait2) { } +pub fn bar16() { let a = Type2; foo16(&a); } +// CHECK: define{{.*}}5foo16{{.*}}!type ![[TYPE16:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo17(_: &dyn Trait2, _: &dyn Trait2) { } +pub fn bar17() { let a = Type2; foo17(&a, &a); } +// CHECK: define{{.*}}5foo17{{.*}}!type ![[TYPE17:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo18(_: &dyn Trait2, _: &dyn Trait2, _: &dyn Trait2) { } +pub fn bar18() { let a = Type2; foo18(&a, &a, &a); } +// CHECK: define{{.*}}5foo18{{.*}}!type ![[TYPE18:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo19(_: &dyn Trait3) { } +// CHECK: define{{.*}}5foo19{{.*}}!type ![[TYPE19:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo20(_: &dyn Trait3, _: &dyn Trait3) { } +// CHECK: define{{.*}}5foo20{{.*}}!type ![[TYPE20:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo21(_: &dyn Trait3, _: &dyn Trait3, _: &dyn Trait3) { } +// CHECK: define{{.*}}5foo21{{.*}}!type ![[TYPE21:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo22<'a>(_: &dyn Trait4<'a, Type4, Output = &'a i32>) { } +// CHECK: define{{.*}}5foo22{{.*}}!type ![[TYPE22:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo23<'a>(_: &dyn Trait4<'a, Type4, Output = &'a i32>, + _: &dyn Trait4<'a, Type4, Output = &'a i32>) { } +// CHECK: define{{.*}}5foo23{{.*}}!type ![[TYPE23:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo24<'a>(_: &dyn Trait4<'a, Type4, Output = &'a i32>, + _: &dyn Trait4<'a, Type4, Output = &'a i32>, + _: &dyn Trait4<'a, Type4, Output = &'a i32>) { } +// CHECK: define{{.*}}5foo24{{.*}}!type ![[TYPE24:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo25(_: &dyn Trait5) { } +// CHECK: define{{.*}}5foo25{{.*}}!type ![[TYPE25:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo26(_: &dyn Trait5, _: &dyn Trait5) { } +// CHECK: define{{.*}}5foo26{{.*}}!type ![[TYPE26:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo27(_: &dyn Trait5, _: &dyn Trait5, _: &dyn Trait5) { } +// CHECK: define{{.*}}5foo27{{.*}}!type ![[TYPE27:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} + +// CHECK: ![[TYPE13]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtC{{[[:print:]]+}}_{{[[:print:]]+}}6Trait1u6regionEEE"} +// CHECK: ![[TYPE16]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtC{{[[:print:]]+}}_{{[[:print:]]+}}6Trait2Iu5paramEu6regionEEE"} +// CHECK: ![[TYPE1]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtNtC{{[[:print:]]+}}_4core6marker4Sendu6regionEEE"} +// CHECK: ![[TYPE2]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtNtC{{[[:print:]]+}}_4core6marker4Sendu6regionEES2_E"} +// CHECK: ![[TYPE3]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtNtC{{[[:print:]]+}}_4core6marker4Sendu6regionEES2_S2_E"} +// FIXME(rcvalle): Enforce autotraits ordering when encoding (e.g., alphabetical order) +// CHECK: ![[TYPE4]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtNtC{{[[:print:]]+}}_4core6marker{{(4Send|4Sync)}}u{{[0-9]+}}NtNtC{{[[:print:]]+}}_4core6marker{{(4Send|4Sync)}}u6regionEEE"} +// CHECK: ![[TYPE5]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtNtC{{[[:print:]]+}}_4core6marker{{(4Send|4Sync)}}u{{[0-9]+}}NtNtC{{[[:print:]]+}}_4core6marker{{(4Send|4Sync)}}u6regionEES3_E"} +// CHECK: ![[TYPE6]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtNtC{{[[:print:]]+}}_4core6marker{{(4Send|4Sync)}}u{{[0-9]+}}NtNtC{{[[:print:]]+}}_4core6marker{{(4Send|4Sync)}}u6regionEES3_S3_E"} +// CHECK: ![[TYPE7]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtC{{[[:print:]]+}}_{{[[:print:]]+}}6Trait1u{{[0-9]+}}NtNtC{{[[:print:]]+}}_4core6marker4Sendu6regionEEE"} +// CHECK: ![[TYPE8]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtC{{[[:print:]]+}}_{{[[:print:]]+}}6Trait1u{{[0-9]+}}NtNtC{{[[:print:]]+}}_4core6marker4Sendu6regionEES3_E"} +// CHECK: ![[TYPE9]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtC{{[[:print:]]+}}_{{[[:print:]]+}}6Trait1u{{[0-9]+}}NtNtC{{[[:print:]]+}}_4core6marker4Sendu6regionEES3_S3_E"} +// CHECK: ![[TYPE10]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtC{{[[:print:]]+}}_{{[[:print:]]+}}6Trait1u{{[0-9]+}}NtNtC{{[[:print:]]+}}_4core6marker4Sendu{{[0-9]+}}NtNtC{{[[:print:]]+}}_4core6marker4Syncu6regionEEE"} +// CHECK: ![[TYPE11]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtC{{[[:print:]]+}}_{{[[:print:]]+}}6Trait1u{{[0-9]+}}NtNtC{{[[:print:]]+}}_4core6marker4Sendu{{[0-9]+}}NtNtC{{[[:print:]]+}}_4core6marker4Syncu6regionEES4_E"} +// CHECK: ![[TYPE12]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtC{{[[:print:]]+}}_{{[[:print:]]+}}6Trait1u{{[0-9]+}}NtNtC{{[[:print:]]+}}_4core6marker4Sendu{{[0-9]+}}NtNtC{{[[:print:]]+}}_4core6marker4Syncu6regionEES4_S4_E"} +// CHECK: ![[TYPE14]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtC{{[[:print:]]+}}_{{[[:print:]]+}}6Trait1u6regionEES2_E"} +// CHECK: ![[TYPE15]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtC{{[[:print:]]+}}_{{[[:print:]]+}}6Trait1u6regionEES2_S2_E"} +// CHECK: ![[TYPE17]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtC{{[[:print:]]+}}_{{[[:print:]]+}}6Trait2Iu5paramEu6regionEES3_E"} +// CHECK: ![[TYPE18]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtC{{[[:print:]]+}}_{{[[:print:]]+}}6Trait2Iu5paramEu6regionEES3_S3_E"} +// CHECK: ![[TYPE19]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtC{{[[:print:]]+}}_{{[[:print:]]+}}6Trait3Iu5paramEu6regionEEE"} +// CHECK: ![[TYPE20]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtC{{[[:print:]]+}}_{{[[:print:]]+}}6Trait3Iu5paramEu6regionEES3_E"} +// CHECK: ![[TYPE21]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtC{{[[:print:]]+}}_{{[[:print:]]+}}6Trait3Iu5paramEu6regionEES3_S3_E"} +// CHECK: ![[TYPE22]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtC{{[[:print:]]+}}_{{[[:print:]]+}}6Trait4Iu6regionu5paramEu6regionEEE"} +// CHECK: ![[TYPE23]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtC{{[[:print:]]+}}_{{[[:print:]]+}}6Trait4Iu6regionu5paramEu6regionEES4_E"} +// CHECK: ![[TYPE24]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtC{{[[:print:]]+}}_{{[[:print:]]+}}6Trait4Iu6regionu5paramEu6regionEES4_S4_E"} +// CHECK: ![[TYPE25]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtC{{[[:print:]]+}}_{{[[:print:]]+}}6Trait5Iu5paramLu5usizeEEu6regionEEE"} +// CHECK: ![[TYPE26]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtC{{[[:print:]]+}}_{{[[:print:]]+}}6Trait5Iu5paramLu5usizeEEu6regionEES5_E"} +// CHECK: ![[TYPE27]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtC{{[[:print:]]+}}_{{[[:print:]]+}}6Trait5Iu5paramLu5usizeEEu6regionEES5_S5_E"} diff --git a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-user-defined-types.rs b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-user-defined-types.rs new file mode 100644 index 0000000000000..4eaf42bf87d15 --- /dev/null +++ b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-user-defined-types.rs @@ -0,0 +1,62 @@ +// Verifies that type metadata identifiers for functions are emitted correctly +// for user-defined types. +// +//@ needs-sanitizer-cfi +//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static + +#![crate_type="lib"] +#![feature(extern_types)] + +pub struct Struct1 { + member1: T, +} + +pub enum Enum1 { + Variant1(T), +} + +pub union Union1 { + member1: std::mem::ManuallyDrop, +} + +extern { + pub type type1; +} + +pub fn foo1(_: &Struct1::) { } +// CHECK: define{{.*}}4foo1{{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo2(_: &Struct1::, _: &Struct1::) { } +// CHECK: define{{.*}}4foo2{{.*}}!type ![[TYPE2:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo3(_: &Struct1::, _: &Struct1::, _: &Struct1::) { } +// CHECK: define{{.*}}4foo3{{.*}}!type ![[TYPE3:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo4(_: &Enum1::) { } +// CHECK: define{{.*}}4foo4{{.*}}!type ![[TYPE4:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo5(_: &Enum1::, _: &Enum1::) { } +// CHECK: define{{.*}}4foo5{{.*}}!type ![[TYPE5:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo6(_: &Enum1::, _: &Enum1::, _: &Enum1::) { } +// CHECK: define{{.*}}4foo6{{.*}}!type ![[TYPE6:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo7(_: &Union1::) { } +// CHECK: define{{.*}}4foo7{{.*}}!type ![[TYPE7:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo8(_: &Union1::, _: &Union1::) { } +// CHECK: define{{.*}}4foo8{{.*}}!type ![[TYPE8:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo9(_: &Union1::, _: &Union1::, _: &Union1::) { } +// CHECK: define{{.*}}4foo9{{.*}}!type ![[TYPE9:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo10(_: *mut type1) { } +// CHECK: define{{.*}}5foo10{{.*}}!type ![[TYPE10:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo11(_: *mut type1, _: *mut type1) { } +// CHECK: define{{.*}}5foo11{{.*}}!type ![[TYPE11:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo12(_: *mut type1, _: *mut type1, _: *mut type1) { } +// CHECK: define{{.*}}5foo12{{.*}}!type ![[TYPE12:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} + +// CHECK: ![[TYPE1]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtC{{[[:print:]]+}}_{{[[:print:]]+}}7Struct1Iu3i32EEE"} +// CHECK: ![[TYPE2]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtC{{[[:print:]]+}}_{{[[:print:]]+}}7Struct1Iu3i32EES1_E"} +// CHECK: ![[TYPE3]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtC{{[[:print:]]+}}_{{[[:print:]]+}}7Struct1Iu3i32EES1_S1_E"} +// CHECK: ![[TYPE4]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtC{{[[:print:]]+}}_{{[[:print:]]+}}5Enum1Iu3i32EEE"} +// CHECK: ![[TYPE5]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtC{{[[:print:]]+}}_{{[[:print:]]+}}5Enum1Iu3i32EES1_E"} +// CHECK: ![[TYPE6]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtC{{[[:print:]]+}}_{{[[:print:]]+}}5Enum1Iu3i32EES1_S1_E"} +// CHECK: ![[TYPE7]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtC{{[[:print:]]+}}_{{[[:print:]]+}}6Union1Iu3i32EEE"} +// CHECK: ![[TYPE8]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtC{{[[:print:]]+}}_{{[[:print:]]+}}6Union1Iu3i32EES1_E"} +// CHECK: ![[TYPE9]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtC{{[[:print:]]+}}_{{[[:print:]]+}}6Union1Iu3i32EES1_S1_E"} +// CHECK: ![[TYPE10]] = !{i64 0, !"_ZTSFvP5type1E"} +// CHECK: ![[TYPE11]] = !{i64 0, !"_ZTSFvP5type1S0_E"} +// CHECK: ![[TYPE12]] = !{i64 0, !"_ZTSFvP5type1S0_S0_E"} diff --git a/tests/codegen/sanitizer/cfi-emit-type-metadata-itanium-cxx-abi-generalized.rs b/tests/codegen/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-generalized.rs similarity index 100% rename from tests/codegen/sanitizer/cfi-emit-type-metadata-itanium-cxx-abi-generalized.rs rename to tests/codegen/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-generalized.rs diff --git a/tests/codegen/sanitizer/cfi-emit-type-metadata-itanium-cxx-abi-normalized-generalized.rs b/tests/codegen/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-normalized-generalized.rs similarity index 100% rename from tests/codegen/sanitizer/cfi-emit-type-metadata-itanium-cxx-abi-normalized-generalized.rs rename to tests/codegen/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-normalized-generalized.rs diff --git a/tests/codegen/sanitizer/cfi-emit-type-metadata-itanium-cxx-abi-normalized.rs b/tests/codegen/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-normalized.rs similarity index 100% rename from tests/codegen/sanitizer/cfi-emit-type-metadata-itanium-cxx-abi-normalized.rs rename to tests/codegen/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-normalized.rs diff --git a/tests/codegen/sanitizer/cfi-emit-type-metadata-itanium-cxx-abi.rs b/tests/codegen/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi.rs similarity index 100% rename from tests/codegen/sanitizer/cfi-emit-type-metadata-itanium-cxx-abi.rs rename to tests/codegen/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi.rs diff --git a/tests/codegen/sanitizer/cfi-emit-type-metadata-trait-objects.rs b/tests/codegen/sanitizer/cfi/emit-type-metadata-trait-objects.rs similarity index 100% rename from tests/codegen/sanitizer/cfi-emit-type-metadata-trait-objects.rs rename to tests/codegen/sanitizer/cfi/emit-type-metadata-trait-objects.rs diff --git a/tests/codegen/sanitizer/cfi-generalize-pointers.rs b/tests/codegen/sanitizer/cfi/generalize-pointers.rs similarity index 100% rename from tests/codegen/sanitizer/cfi-generalize-pointers.rs rename to tests/codegen/sanitizer/cfi/generalize-pointers.rs diff --git a/tests/codegen/sanitizer/cfi-normalize-integers.rs b/tests/codegen/sanitizer/cfi/normalize-integers.rs similarity index 100% rename from tests/codegen/sanitizer/cfi-normalize-integers.rs rename to tests/codegen/sanitizer/cfi/normalize-integers.rs diff --git a/tests/codegen/sanitizer/kcfi-add-kcfi-flag.rs b/tests/codegen/sanitizer/kcfi/add-kcfi-flag.rs similarity index 100% rename from tests/codegen/sanitizer/kcfi-add-kcfi-flag.rs rename to tests/codegen/sanitizer/kcfi/add-kcfi-flag.rs diff --git a/tests/codegen/sanitizer/kcfi-emit-kcfi-operand-bundle-attr-no-sanitize.rs b/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-attr-no-sanitize.rs similarity index 92% rename from tests/codegen/sanitizer/kcfi-emit-kcfi-operand-bundle-attr-no-sanitize.rs rename to tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-attr-no-sanitize.rs index 50e591ba06bed..8055c63a2f8f4 100644 --- a/tests/codegen/sanitizer/kcfi-emit-kcfi-operand-bundle-attr-no-sanitize.rs +++ b/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-attr-no-sanitize.rs @@ -20,7 +20,7 @@ impl Copy for i32 {} #[no_sanitize(kcfi)] pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 { - // CHECK-LABEL: kcfi_emit_kcfi_operand_bundle_attr_no_sanitize::foo + // CHECK-LABEL: emit_kcfi_operand_bundle_attr_no_sanitize::foo // CHECK: Function Attrs: {{.*}} // CHECK-LABEL: define{{.*}}foo{{.*}}!{{|kcfi_type}} !{{[0-9]+}} // CHECK: start: diff --git a/tests/codegen/sanitizer/kcfi-emit-kcfi-operand-bundle-itanium-cxx-abi-generalized.rs b/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-generalized.rs similarity index 100% rename from tests/codegen/sanitizer/kcfi-emit-kcfi-operand-bundle-itanium-cxx-abi-generalized.rs rename to tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-generalized.rs diff --git a/tests/codegen/sanitizer/kcfi-emit-kcfi-operand-bundle-itanium-cxx-abi-normalized-generalized.rs b/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized-generalized.rs similarity index 100% rename from tests/codegen/sanitizer/kcfi-emit-kcfi-operand-bundle-itanium-cxx-abi-normalized-generalized.rs rename to tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized-generalized.rs diff --git a/tests/codegen/sanitizer/kcfi-emit-kcfi-operand-bundle-itanium-cxx-abi-normalized.rs b/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized.rs similarity index 100% rename from tests/codegen/sanitizer/kcfi-emit-kcfi-operand-bundle-itanium-cxx-abi-normalized.rs rename to tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized.rs diff --git a/tests/codegen/sanitizer/kcfi-emit-kcfi-operand-bundle-itanium-cxx-abi.rs b/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi.rs similarity index 100% rename from tests/codegen/sanitizer/kcfi-emit-kcfi-operand-bundle-itanium-cxx-abi.rs rename to tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi.rs diff --git a/tests/codegen/sanitizer/kcfi-emit-kcfi-operand-bundle.rs b/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle.rs similarity index 100% rename from tests/codegen/sanitizer/kcfi-emit-kcfi-operand-bundle.rs rename to tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle.rs diff --git a/tests/codegen/sanitizer/kcfi-emit-type-metadata-trait-objects.rs b/tests/codegen/sanitizer/kcfi/emit-type-metadata-trait-objects.rs similarity index 100% rename from tests/codegen/sanitizer/kcfi-emit-type-metadata-trait-objects.rs rename to tests/codegen/sanitizer/kcfi/emit-type-metadata-trait-objects.rs diff --git a/tests/debuginfo/associated-types.rs b/tests/debuginfo/associated-types.rs index ab41073b7c44f..182541b038a0f 100644 --- a/tests/debuginfo/associated-types.rs +++ b/tests/debuginfo/associated-types.rs @@ -43,41 +43,41 @@ // lldb-command:run // lldb-command:print arg -// lldbg-check:[...]$0 = { b = -1, b1 = 0 } +// lldbg-check:[...] { b = -1, b1 = 0 } // lldbr-check:(associated_types::Struct) arg = { b = -1, b1 = 0 } // lldb-command:continue // lldb-command:print inferred -// lldbg-check:[...]$1 = 1 +// lldbg-check:[...] 1 // lldbr-check:(i64) inferred = 1 // lldb-command:print explicitly -// lldbg-check:[...]$2 = 1 +// lldbg-check:[...] 1 // lldbr-check:(i64) explicitly = 1 // lldb-command:continue // lldb-command:print arg -// lldbg-check:[...]$3 = 2 +// lldbg-check:[...] 2 // lldbr-check:(i64) arg = 2 // lldb-command:continue // lldb-command:print arg -// lldbg-check:[...]$4 = (4, 5) +// lldbg-check:[...] (4, 5) // lldbr-check:((i32, i64)) arg = { = 4 = 5 } // lldb-command:continue // lldb-command:print a -// lldbg-check:[...]$5 = 6 +// lldbg-check:[...] 6 // lldbr-check:(i32) a = 6 // lldb-command:print b -// lldbg-check:[...]$6 = 7 +// lldbg-check:[...] 7 // lldbr-check:(i64) b = 7 // lldb-command:continue // lldb-command:print a -// lldbg-check:[...]$7 = 8 +// lldbg-check:[...] 8 // lldbr-check:(i64) a = 8 // lldb-command:print b -// lldbg-check:[...]$8 = 9 +// lldbg-check:[...] 9 // lldbr-check:(i32) b = 9 // lldb-command:continue diff --git a/tests/debuginfo/basic-types.rs b/tests/debuginfo/basic-types.rs index 8319b71bfcdaa..3a023a890f373 100644 --- a/tests/debuginfo/basic-types.rs +++ b/tests/debuginfo/basic-types.rs @@ -51,10 +51,10 @@ // lldb-command:run // lldb-command:print b -// lldbg-check:[...]$0 = false +// lldbg-check:[...] false // lldbr-check:(bool) b = false // lldb-command:print i -// lldbg-check:[...]$1 = -1 +// lldbg-check:[...] -1 // lldbr-check:(isize) i = -1 // NOTE: only rust-enabled lldb supports 32bit chars @@ -62,37 +62,37 @@ // lldbr-check:(char) c = 'a' // lldb-command:print i8 -// lldbg-check:[...]$2 = 'D' +// lldbg-check:[...] 'D' // lldbr-check:(i8) i8 = 68 // lldb-command:print i16 -// lldbg-check:[...]$3 = -16 +// lldbg-check:[...] -16 // lldbr-check:(i16) i16 = -16 // lldb-command:print i32 -// lldbg-check:[...]$4 = -32 +// lldbg-check:[...] -32 // lldbr-check:(i32) i32 = -32 // lldb-command:print i64 -// lldbg-check:[...]$5 = -64 +// lldbg-check:[...] -64 // lldbr-check:(i64) i64 = -64 // lldb-command:print u -// lldbg-check:[...]$6 = 1 +// lldbg-check:[...] 1 // lldbr-check:(usize) u = 1 // lldb-command:print u8 -// lldbg-check:[...]$7 = 'd' +// lldbg-check:[...] 'd' // lldbr-check:(u8) u8 = 100 // lldb-command:print u16 -// lldbg-check:[...]$8 = 16 +// lldbg-check:[...] 16 // lldbr-check:(u16) u16 = 16 // lldb-command:print u32 -// lldbg-check:[...]$9 = 32 +// lldbg-check:[...] 32 // lldbr-check:(u32) u32 = 32 // lldb-command:print u64 -// lldbg-check:[...]$10 = 64 +// lldbg-check:[...] 64 // lldbr-check:(u64) u64 = 64 // lldb-command:print f32 -// lldbg-check:[...]$11 = 2.5 +// lldbg-check:[...] 2.5 // lldbr-check:(f32) f32 = 2.5 // lldb-command:print f64 -// lldbg-check:[...]$12 = 3.5 +// lldbg-check:[...] 3.5 // lldbr-check:(f64) f64 = 3.5 // === CDB TESTS =================================================================================== diff --git a/tests/debuginfo/borrowed-basic.rs b/tests/debuginfo/borrowed-basic.rs index 52d61f33e7c0f..e30131190af5c 100644 --- a/tests/debuginfo/borrowed-basic.rs +++ b/tests/debuginfo/borrowed-basic.rs @@ -53,11 +53,11 @@ // lldb-command:run // lldb-command:print *bool_ref -// lldbg-check:[...]$0 = true +// lldbg-check:[...] true // lldbr-check:(bool) *bool_ref = true // lldb-command:print *int_ref -// lldbg-check:[...]$1 = -1 +// lldbg-check:[...] -1 // lldbr-check:(isize) *int_ref = -1 // NOTE: only rust-enabled lldb supports 32bit chars @@ -65,47 +65,47 @@ // lldbr-check:(char) *char_ref = 'a' // lldb-command:print *i8_ref -// lldbg-check:[...]$2 = 'D' +// lldbg-check:[...] 'D' // lldbr-check:(i8) *i8_ref = 68 // lldb-command:print *i16_ref -// lldbg-check:[...]$3 = -16 +// lldbg-check:[...] -16 // lldbr-check:(i16) *i16_ref = -16 // lldb-command:print *i32_ref -// lldbg-check:[...]$4 = -32 +// lldbg-check:[...] -32 // lldbr-check:(i32) *i32_ref = -32 // lldb-command:print *i64_ref -// lldbg-check:[...]$5 = -64 +// lldbg-check:[...] -64 // lldbr-check:(i64) *i64_ref = -64 // lldb-command:print *uint_ref -// lldbg-check:[...]$6 = 1 +// lldbg-check:[...] 1 // lldbr-check:(usize) *uint_ref = 1 // lldb-command:print *u8_ref -// lldbg-check:[...]$7 = 'd' +// lldbg-check:[...] 'd' // lldbr-check:(u8) *u8_ref = 100 // lldb-command:print *u16_ref -// lldbg-check:[...]$8 = 16 +// lldbg-check:[...] 16 // lldbr-check:(u16) *u16_ref = 16 // lldb-command:print *u32_ref -// lldbg-check:[...]$9 = 32 +// lldbg-check:[...] 32 // lldbr-check:(u32) *u32_ref = 32 // lldb-command:print *u64_ref -// lldbg-check:[...]$10 = 64 +// lldbg-check:[...] 64 // lldbr-check:(u64) *u64_ref = 64 // lldb-command:print *f32_ref -// lldbg-check:[...]$11 = 2.5 +// lldbg-check:[...] 2.5 // lldbr-check:(f32) *f32_ref = 2.5 // lldb-command:print *f64_ref -// lldbg-check:[...]$12 = 3.5 +// lldbg-check:[...] 3.5 // lldbr-check:(f64) *f64_ref = 3.5 #![allow(unused_variables)] diff --git a/tests/debuginfo/borrowed-c-style-enum.rs b/tests/debuginfo/borrowed-c-style-enum.rs index 950a05a0992fa..c6a8bf953866b 100644 --- a/tests/debuginfo/borrowed-c-style-enum.rs +++ b/tests/debuginfo/borrowed-c-style-enum.rs @@ -23,15 +23,15 @@ // lldb-command:run // lldb-command:print *the_a_ref -// lldbg-check:[...]$0 = TheA +// lldbg-check:[...] TheA // lldbr-check:(borrowed_c_style_enum::ABC) *the_a_ref = borrowed_c_style_enum::ABC::TheA // lldb-command:print *the_b_ref -// lldbg-check:[...]$1 = TheB +// lldbg-check:[...] TheB // lldbr-check:(borrowed_c_style_enum::ABC) *the_b_ref = borrowed_c_style_enum::ABC::TheB // lldb-command:print *the_c_ref -// lldbg-check:[...]$2 = TheC +// lldbg-check:[...] TheC // lldbr-check:(borrowed_c_style_enum::ABC) *the_c_ref = borrowed_c_style_enum::ABC::TheC #![allow(unused_variables)] diff --git a/tests/debuginfo/borrowed-struct.rs b/tests/debuginfo/borrowed-struct.rs index 467de7878ee76..96ceec42ab557 100644 --- a/tests/debuginfo/borrowed-struct.rs +++ b/tests/debuginfo/borrowed-struct.rs @@ -35,31 +35,31 @@ // lldb-command:run // lldb-command:print *stack_val_ref -// lldbg-check:[...]$0 = { x = 10 y = 23.5 } +// lldbg-check:[...] { x = 10 y = 23.5 } // lldbr-check:(borrowed_struct::SomeStruct) *stack_val_ref = (x = 10, y = 23.5) // lldb-command:print *stack_val_interior_ref_1 -// lldbg-check:[...]$1 = 10 +// lldbg-check:[...] 10 // lldbr-check:(isize) *stack_val_interior_ref_1 = 10 // lldb-command:print *stack_val_interior_ref_2 -// lldbg-check:[...]$2 = 23.5 +// lldbg-check:[...] 23.5 // lldbr-check:(f64) *stack_val_interior_ref_2 = 23.5 // lldb-command:print *ref_to_unnamed -// lldbg-check:[...]$3 = { x = 11 y = 24.5 } +// lldbg-check:[...] { x = 11 y = 24.5 } // lldbr-check:(borrowed_struct::SomeStruct) *ref_to_unnamed = (x = 11, y = 24.5) // lldb-command:print *unique_val_ref -// lldbg-check:[...]$4 = { x = 13 y = 26.5 } +// lldbg-check:[...] { x = 13 y = 26.5 } // lldbr-check:(borrowed_struct::SomeStruct) *unique_val_ref = (x = 13, y = 26.5) // lldb-command:print *unique_val_interior_ref_1 -// lldbg-check:[...]$5 = 13 +// lldbg-check:[...] 13 // lldbr-check:(isize) *unique_val_interior_ref_1 = 13 // lldb-command:print *unique_val_interior_ref_2 -// lldbg-check:[...]$6 = 26.5 +// lldbg-check:[...] 26.5 // lldbr-check:(f64) *unique_val_interior_ref_2 = 26.5 #![allow(unused_variables)] diff --git a/tests/debuginfo/borrowed-tuple.rs b/tests/debuginfo/borrowed-tuple.rs index 4fe1abbaba2c8..8d9c5e9fd2d43 100644 --- a/tests/debuginfo/borrowed-tuple.rs +++ b/tests/debuginfo/borrowed-tuple.rs @@ -24,15 +24,15 @@ // lldb-command:run // lldb-command:print *stack_val_ref -// lldbg-check:[...]$0 = { 0 = -14 1 = -19 } +// lldbg-check:[...] { 0 = -14 1 = -19 } // lldbr-check:((i16, f32)) *stack_val_ref = { 0 = -14 1 = -19 } // lldb-command:print *ref_to_unnamed -// lldbg-check:[...]$1 = { 0 = -15 1 = -20 } +// lldbg-check:[...] { 0 = -15 1 = -20 } // lldbr-check:((i16, f32)) *ref_to_unnamed = { 0 = -15 1 = -20 } // lldb-command:print *unique_val_ref -// lldbg-check:[...]$2 = { 0 = -17 1 = -22 } +// lldbg-check:[...] { 0 = -17 1 = -22 } // lldbr-check:((i16, f32)) *unique_val_ref = { 0 = -17 1 = -22 } diff --git a/tests/debuginfo/borrowed-unique-basic.rs b/tests/debuginfo/borrowed-unique-basic.rs index ae843c355bc5b..38e6ce0a6ae54 100644 --- a/tests/debuginfo/borrowed-unique-basic.rs +++ b/tests/debuginfo/borrowed-unique-basic.rs @@ -56,11 +56,11 @@ // lldb-command:run // lldb-command:print *bool_ref -// lldbg-check:[...]$0 = true +// lldbg-check:[...] true // lldbr-check:(bool) *bool_ref = true // lldb-command:print *int_ref -// lldbg-check:[...]$1 = -1 +// lldbg-check:[...] -1 // lldbr-check:(isize) *int_ref = -1 // NOTE: only rust-enabled lldb supports 32bit chars @@ -68,47 +68,47 @@ // lldbr-check:(char) *char_ref = 97 // lldb-command:print *i8_ref -// lldbg-check:[...]$2 = 68 +// lldbg-check:[...] 68 // lldbr-check:(i8) *i8_ref = 68 // lldb-command:print *i16_ref -// lldbg-check:[...]$3 = -16 +// lldbg-check:[...] -16 // lldbr-check:(i16) *i16_ref = -16 // lldb-command:print *i32_ref -// lldbg-check:[...]$4 = -32 +// lldbg-check:[...] -32 // lldbr-check:(i32) *i32_ref = -32 // lldb-command:print *i64_ref -// lldbg-check:[...]$5 = -64 +// lldbg-check:[...] -64 // lldbr-check:(i64) *i64_ref = -64 // lldb-command:print *uint_ref -// lldbg-check:[...]$6 = 1 +// lldbg-check:[...] 1 // lldbr-check:(usize) *uint_ref = 1 // lldb-command:print *u8_ref -// lldbg-check:[...]$7 = 100 +// lldbg-check:[...] 100 // lldbr-check:(u8) *u8_ref = 100 // lldb-command:print *u16_ref -// lldbg-check:[...]$8 = 16 +// lldbg-check:[...] 16 // lldbr-check:(u16) *u16_ref = 16 // lldb-command:print *u32_ref -// lldbg-check:[...]$9 = 32 +// lldbg-check:[...] 32 // lldbr-check:(u32) *u32_ref = 32 // lldb-command:print *u64_ref -// lldbg-check:[...]$10 = 64 +// lldbg-check:[...] 64 // lldbr-check:(u64) *u64_ref = 64 // lldb-command:print *f32_ref -// lldbg-check:[...]$11 = 2.5 +// lldbg-check:[...] 2.5 // lldbr-check:(f32) *f32_ref = 2.5 // lldb-command:print *f64_ref -// lldbg-check:[...]$12 = 3.5 +// lldbg-check:[...] 3.5 // lldbr-check:(f64) *f64_ref = 3.5 #![allow(unused_variables)] diff --git a/tests/debuginfo/box.rs b/tests/debuginfo/box.rs index f2e744e87b914..2c309a4eb2877 100644 --- a/tests/debuginfo/box.rs +++ b/tests/debuginfo/box.rs @@ -17,10 +17,10 @@ // lldb-command:run // lldb-command:print *a -// lldbg-check:[...]$0 = 1 +// lldbg-check:[...] 1 // lldbr-check:(i32) *a = 1 // lldb-command:print *b -// lldbg-check:[...]$1 = { 0 = 2 1 = 3.5 } +// lldbg-check:[...] { 0 = 2 1 = 3.5 } // lldbr-check:((i32, f64)) *b = { 0 = 2 1 = 3.5 } #![allow(unused_variables)] diff --git a/tests/debuginfo/boxed-struct.rs b/tests/debuginfo/boxed-struct.rs index c47bffb3a384b..be2f1a7a8677c 100644 --- a/tests/debuginfo/boxed-struct.rs +++ b/tests/debuginfo/boxed-struct.rs @@ -20,11 +20,11 @@ // lldb-command:run // lldb-command:print *boxed_with_padding -// lldbg-check:[...]$0 = { x = 99 y = 999 z = 9999 w = 99999 } +// lldbg-check:[...] { x = 99 y = 999 z = 9999 w = 99999 } // lldbr-check:(boxed_struct::StructWithSomePadding) *boxed_with_padding = { x = 99 y = 999 z = 9999 w = 99999 } // lldb-command:print *boxed_with_dtor -// lldbg-check:[...]$1 = { x = 77 y = 777 z = 7777 w = 77777 } +// lldbg-check:[...] { x = 77 y = 777 z = 7777 w = 77777 } // lldbr-check:(boxed_struct::StructWithDestructor) *boxed_with_dtor = { x = 77 y = 777 z = 7777 w = 77777 } #![allow(unused_variables)] diff --git a/tests/debuginfo/by-value-non-immediate-argument.rs b/tests/debuginfo/by-value-non-immediate-argument.rs index 52e3dc9a76bc8..413eefa3f2ded 100644 --- a/tests/debuginfo/by-value-non-immediate-argument.rs +++ b/tests/debuginfo/by-value-non-immediate-argument.rs @@ -42,27 +42,27 @@ // lldb-command:run // lldb-command:print s -// lldb-check:[...]$0 = Struct { a: 1, b: 2.5 } +// lldb-check:[...] Struct { a: 1, b: 2.5 } // lldb-command:continue // lldb-command:print x -// lldb-check:[...]$1 = Struct { a: 3, b: 4.5 } +// lldb-check:[...] Struct { a: 3, b: 4.5 } // lldb-command:print y -// lldb-check:[...]$2 = 5 +// lldb-check:[...] 5 // lldb-command:print z -// lldb-check:[...]$3 = 6.5 +// lldb-check:[...] 6.5 // lldb-command:continue // lldb-command:print a -// lldb-check:[...]$4 = (7, 8, 9.5, 10.5) +// lldb-check:[...] (7, 8, 9.5, 10.5) // lldb-command:continue // lldb-command:print a -// lldb-check:[...]$5 = Newtype(11.5, 12.5, 13, 14) +// lldb-check:[...] Newtype(11.5, 12.5, 13, 14) // lldb-command:continue // lldb-command:print x -// lldb-check:[...]$6 = Case1 { x: 0, y: 8970181431921507452 } +// lldb-check:[...] Case1 { x: 0, y: 8970181431921507452 } // lldb-command:continue #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/by-value-self-argument-in-trait-impl.rs b/tests/debuginfo/by-value-self-argument-in-trait-impl.rs index 247d6c27a06eb..7b52d054b3217 100644 --- a/tests/debuginfo/by-value-self-argument-in-trait-impl.rs +++ b/tests/debuginfo/by-value-self-argument-in-trait-impl.rs @@ -26,17 +26,17 @@ // lldb-command:run // lldb-command:print self -// lldbg-check:[...]$0 = 1111 +// lldbg-check:[...] 1111 // lldbr-check:(isize) self = 1111 // lldb-command:continue // lldb-command:print self -// lldbg-check:[...]$1 = { x = 2222 y = 3333 } +// lldbg-check:[...] { x = 2222 y = 3333 } // lldbr-check:(by_value_self_argument_in_trait_impl::Struct) self = { x = 2222 y = 3333 } // lldb-command:continue // lldb-command:print self -// lldbg-check:[...] $2 = { 0 = 4444.5 1 = 5555 2 = 6666 3 = 7777.5 } +// lldbg-check:[...] { 0 = 4444.5 1 = 5555 2 = 6666 3 = 7777.5 } // lldbr-check:((f64, isize, isize, f64)) self = { 0 = 4444.5 1 = 5555 2 = 6666 3 = 7777.5 } // lldb-command:continue diff --git a/tests/debuginfo/c-style-enum-in-composite.rs b/tests/debuginfo/c-style-enum-in-composite.rs index 3f0968f09afd3..82d38038eafa9 100644 --- a/tests/debuginfo/c-style-enum-in-composite.rs +++ b/tests/debuginfo/c-style-enum-in-composite.rs @@ -39,31 +39,31 @@ // lldb-command:run // lldb-command:print tuple_interior_padding -// lldbg-check:[...]$0 = { 0 = 0 1 = OneHundred } +// lldbg-check:[...] { 0 = 0 1 = OneHundred } // lldbr-check:((i16, c_style_enum_in_composite::AnEnum)) tuple_interior_padding = { 0 = 0 1 = OneHundred } // lldb-command:print tuple_padding_at_end -// lldbg-check:[...]$1 = { 0 = { 0 = 1 1 = OneThousand } 1 = 2 } +// lldbg-check:[...] { 0 = { 0 = 1 1 = OneThousand } 1 = 2 } // lldbr-check:(((u64, c_style_enum_in_composite::AnEnum), u64)) tuple_padding_at_end = { 0 = { 0 = 1 1 = OneThousand } 1 = 2 } // lldb-command:print tuple_different_enums -// lldbg-check:[...]$2 = { 0 = OneThousand 1 = MountainView 2 = OneMillion 3 = Vienna } +// lldbg-check:[...] { 0 = OneThousand 1 = MountainView 2 = OneMillion 3 = Vienna } // lldbr-check:((c_style_enum_in_composite::AnEnum, c_style_enum_in_composite::AnotherEnum, c_style_enum_in_composite::AnEnum, c_style_enum_in_composite::AnotherEnum)) tuple_different_enums = { 0 = c_style_enum_in_composite::AnEnum::OneThousand 1 = c_style_enum_in_composite::AnotherEnum::MountainView 2 = c_style_enum_in_composite::AnEnum::OneMillion 3 = c_style_enum_in_composite::AnotherEnum::Vienna } // lldb-command:print padded_struct -// lldbg-check:[...]$3 = { a = 3 b = OneMillion c = 4 d = Toronto e = 5 } +// lldbg-check:[...] { a = 3 b = OneMillion c = 4 d = Toronto e = 5 } // lldbr-check:(c_style_enum_in_composite::PaddedStruct) padded_struct = { a = 3 b = c_style_enum_in_composite::AnEnum::OneMillion c = 4 d = Toronto e = 5 } // lldb-command:print packed_struct -// lldbg-check:[...]$4 = { a = 6 b = OneHundred c = 7 d = Vienna e = 8 } +// lldbg-check:[...] { a = 6 b = OneHundred c = 7 d = Vienna e = 8 } // lldbr-check:(c_style_enum_in_composite::PackedStruct) packed_struct = { a = 6 b = c_style_enum_in_composite::AnEnum::OneHundred c = 7 d = Vienna e = 8 } // lldb-command:print non_padded_struct -// lldbg-check:[...]$5 = { a = OneMillion b = MountainView c = OneThousand d = Toronto } +// lldbg-check:[...] { a = OneMillion b = MountainView c = OneThousand d = Toronto } // lldbr-check:(c_style_enum_in_composite::NonPaddedStruct) non_padded_struct = { a = c_style_enum_in_composite::AnEnum::OneMillion, b = c_style_enum_in_composite::AnotherEnum::MountainView, c = c_style_enum_in_composite::AnEnum::OneThousand, d = c_style_enum_in_composite::AnotherEnum::Toronto } // lldb-command:print struct_with_drop -// lldbg-check:[...]$6 = { 0 = { a = OneHundred b = Vienna } 1 = 9 } +// lldbg-check:[...] { 0 = { a = OneHundred b = Vienna } 1 = 9 } // lldbr-check:((c_style_enum_in_composite::StructWithDrop, i64)) struct_with_drop = { 0 = { a = c_style_enum_in_composite::AnEnum::OneHundred b = c_style_enum_in_composite::AnotherEnum::Vienna } 1 = 9 } #![allow(unused_variables)] diff --git a/tests/debuginfo/c-style-enum.rs b/tests/debuginfo/c-style-enum.rs index 2794575d3287b..4d84324df2cf3 100644 --- a/tests/debuginfo/c-style-enum.rs +++ b/tests/debuginfo/c-style-enum.rs @@ -97,31 +97,31 @@ // lldb-command:run // lldb-command:print auto_one -// lldbg-check:[...]$0 = One +// lldbg-check:[...] One // lldbr-check:(c_style_enum::AutoDiscriminant) auto_one = c_style_enum::AutoDiscriminant::One // lldb-command:print auto_two -// lldbg-check:[...]$1 = Two +// lldbg-check:[...] Two // lldbr-check:(c_style_enum::AutoDiscriminant) auto_two = c_style_enum::AutoDiscriminant::Two // lldb-command:print auto_three -// lldbg-check:[...]$2 = Three +// lldbg-check:[...] Three // lldbr-check:(c_style_enum::AutoDiscriminant) auto_three = c_style_enum::AutoDiscriminant::Three // lldb-command:print manual_one_hundred -// lldbg-check:[...]$3 = OneHundred +// lldbg-check:[...] OneHundred // lldbr-check:(c_style_enum::ManualDiscriminant) manual_one_hundred = c_style_enum::ManualDiscriminant::OneHundred // lldb-command:print manual_one_thousand -// lldbg-check:[...]$4 = OneThousand +// lldbg-check:[...] OneThousand // lldbr-check:(c_style_enum::ManualDiscriminant) manual_one_thousand = c_style_enum::ManualDiscriminant::OneThousand // lldb-command:print manual_one_million -// lldbg-check:[...]$5 = OneMillion +// lldbg-check:[...] OneMillion // lldbr-check:(c_style_enum::ManualDiscriminant) manual_one_million = c_style_enum::ManualDiscriminant::OneMillion // lldb-command:print single_variant -// lldbg-check:[...]$6 = TheOnlyVariant +// lldbg-check:[...] TheOnlyVariant // lldbr-check:(c_style_enum::SingleVariant) single_variant = c_style_enum::SingleVariant::TheOnlyVariant #![allow(unused_variables)] diff --git a/tests/debuginfo/captured-fields-1.rs b/tests/debuginfo/captured-fields-1.rs index f5fdf4fb3d9c6..bcc5a17968768 100644 --- a/tests/debuginfo/captured-fields-1.rs +++ b/tests/debuginfo/captured-fields-1.rs @@ -26,22 +26,22 @@ // lldb-command:run // lldb-command:print test -// lldbg-check:(captured_fields_1::main::{closure_env#0}) $0 = { _ref__my_ref__my_field1 = 0x[...] } +// lldbg-check:(captured_fields_1::main::{closure_env#0}) { _ref__my_ref__my_field1 = 0x[...] } // lldb-command:continue // lldb-command:print test -// lldbg-check:(captured_fields_1::main::{closure_env#1}) $1 = { _ref__my_ref__my_field2 = 0x[...] } +// lldbg-check:(captured_fields_1::main::{closure_env#1}) { _ref__my_ref__my_field2 = 0x[...] } // lldb-command:continue // lldb-command:print test -// lldbg-check:(captured_fields_1::main::{closure_env#2}) $2 = { _ref__my_ref = 0x[...] } +// lldbg-check:(captured_fields_1::main::{closure_env#2}) { _ref__my_ref = 0x[...] } // lldb-command:continue // lldb-command:print test -// lldbg-check:(captured_fields_1::main::{closure_env#3}) $3 = { my_ref = 0x[...] } +// lldbg-check:(captured_fields_1::main::{closure_env#3}) { my_ref = 0x[...] } // lldb-command:continue // lldb-command:print test -// lldbg-check:(captured_fields_1::main::{closure_env#4}) $4 = { my_var__my_field2 = 22 } +// lldbg-check:(captured_fields_1::main::{closure_env#4}) { my_var__my_field2 = 22 } // lldb-command:continue // lldb-command:print test -// lldbg-check:(captured_fields_1::main::{closure_env#5}) $5 = { my_var = { my_field1 = 11 my_field2 = 22 } } +// lldbg-check:(captured_fields_1::main::{closure_env#5}) { my_var = { my_field1 = 11 my_field2 = 22 } } // lldb-command:continue #![allow(unused)] diff --git a/tests/debuginfo/captured-fields-2.rs b/tests/debuginfo/captured-fields-2.rs index aaf4fa1bc4546..7191d3f84d2a7 100644 --- a/tests/debuginfo/captured-fields-2.rs +++ b/tests/debuginfo/captured-fields-2.rs @@ -14,10 +14,10 @@ // lldb-command:run // lldb-command:print my_ref__my_field1 -// lldbg-check:(unsigned int) $0 = 11 +// lldbg-check:(unsigned int) 11 // lldb-command:continue // lldb-command:print my_var__my_field2 -// lldbg-check:(unsigned int) $1 = 22 +// lldbg-check:(unsigned int) 22 // lldb-command:continue #![allow(unused)] diff --git a/tests/debuginfo/closure-in-generic-function.rs b/tests/debuginfo/closure-in-generic-function.rs index 676a624191c2f..c48858e4a0a55 100644 --- a/tests/debuginfo/closure-in-generic-function.rs +++ b/tests/debuginfo/closure-in-generic-function.rs @@ -24,18 +24,18 @@ // lldb-command:run // lldb-command:print x -// lldbg-check:[...]$0 = 0.5 +// lldbg-check:[...] 0.5 // lldbr-check:(f64) x = 0.5 // lldb-command:print y -// lldbg-check:[...]$1 = 10 +// lldbg-check:[...] 10 // lldbr-check:(i32) y = 10 // lldb-command:continue // lldb-command:print *x -// lldbg-check:[...]$2 = 29 +// lldbg-check:[...] 29 // lldbr-check:(i32) *x = 29 // lldb-command:print *y -// lldbg-check:[...]$3 = 110 +// lldbg-check:[...] 110 // lldbr-check:(i32) *y = 110 // lldb-command:continue diff --git a/tests/debuginfo/coroutine-locals.rs b/tests/debuginfo/coroutine-locals.rs index 0430e1d313bd7..80a68434dab58 100644 --- a/tests/debuginfo/coroutine-locals.rs +++ b/tests/debuginfo/coroutine-locals.rs @@ -28,30 +28,30 @@ // lldb-command:run // lldb-command:print a -// lldbg-check:(int) $0 = 5 +// lldbg-check:(int) 5 // lldbr-check:(int) a = 5 // lldb-command:print c -// lldbg-check:(int) $1 = 6 +// lldbg-check:(int) 6 // lldbr-check:(int) c = 6 // lldb-command:print d -// lldbg-check:(int) $2 = 7 +// lldbg-check:(int) 7 // lldbr-check:(int) d = 7 // lldb-command:continue // lldb-command:print a -// lldbg-check:(int) $3 = 7 +// lldbg-check:(int) 7 // lldbr-check:(int) a = 7 // lldb-command:print c -// lldbg-check:(int) $4 = 6 +// lldbg-check:(int) 6 // lldbr-check:(int) c = 6 // lldb-command:print e -// lldbg-check:(int) $5 = 8 +// lldbg-check:(int) 8 // lldbr-check:(int) e = 8 // lldb-command:continue // lldb-command:print a -// lldbg-check:(int) $6 = 8 +// lldbg-check:(int) 8 // lldbr-check:(int) a = 8 // lldb-command:print c -// lldbg-check:(int) $7 = 6 +// lldbg-check:(int) 6 // lldbr-check:(int) c = 6 #![feature(omit_gdb_pretty_printer_section, coroutines, coroutine_trait)] diff --git a/tests/debuginfo/coroutine-objects.rs b/tests/debuginfo/coroutine-objects.rs index 98b37ac2001d4..9f14cb3f8ec43 100644 --- a/tests/debuginfo/coroutine-objects.rs +++ b/tests/debuginfo/coroutine-objects.rs @@ -26,16 +26,16 @@ // lldb-command:run // lldb-command:print b -// lldbg-check:(coroutine_objects::main::{coroutine_env#0}) $0 = +// lldbg-check:(coroutine_objects::main::{coroutine_env#0}) // lldb-command:continue // lldb-command:print b -// lldbg-check:(coroutine_objects::main::{coroutine_env#0}) $1 = +// lldbg-check:(coroutine_objects::main::{coroutine_env#0}) // lldb-command:continue // lldb-command:print b -// lldbg-check:(coroutine_objects::main::{coroutine_env#0}) $2 = +// lldbg-check:(coroutine_objects::main::{coroutine_env#0}) // lldb-command:continue // lldb-command:print b -// lldbg-check:(coroutine_objects::main::{coroutine_env#0}) $3 = +// lldbg-check:(coroutine_objects::main::{coroutine_env#0}) // === CDB TESTS =================================================================================== diff --git a/tests/debuginfo/cross-crate-spans.rs b/tests/debuginfo/cross-crate-spans.rs index 75550e1794cc6..9f3538c4e1d49 100644 --- a/tests/debuginfo/cross-crate-spans.rs +++ b/tests/debuginfo/cross-crate-spans.rs @@ -44,24 +44,24 @@ extern crate cross_crate_spans; // lldb-command:run // lldb-command:print result -// lldbg-check:[...]$0 = { 0 = 17 1 = 17 } +// lldbg-check:[...] { 0 = 17 1 = 17 } // lldbr-check:((u32, u32)) result = { 0 = 17 1 = 17 } // lldb-command:print a_variable -// lldbg-check:[...]$1 = 123456789 +// lldbg-check:[...] 123456789 // lldbr-check:(u32) a_variable = 123456789 // lldb-command:print another_variable -// lldbg-check:[...]$2 = 123456789.5 +// lldbg-check:[...] 123456789.5 // lldbr-check:(f64) another_variable = 123456789.5 // lldb-command:continue // lldb-command:print result -// lldbg-check:[...]$3 = { 0 = 1212 1 = 1212 } +// lldbg-check:[...] { 0 = 1212 1 = 1212 } // lldbr-check:((i16, i16)) result = { 0 = 1212 1 = 1212 } // lldb-command:print a_variable -// lldbg-check:[...]$4 = 123456789 +// lldbg-check:[...] 123456789 // lldbr-check:(u32) a_variable = 123456789 // lldb-command:print another_variable -// lldbg-check:[...]$5 = 123456789.5 +// lldbg-check:[...] 123456789.5 // lldbr-check:(f64) another_variable = 123456789.5 // lldb-command:continue diff --git a/tests/debuginfo/destructured-fn-argument.rs b/tests/debuginfo/destructured-fn-argument.rs index e6e697c518a19..2748bdb08b964 100644 --- a/tests/debuginfo/destructured-fn-argument.rs +++ b/tests/debuginfo/destructured-fn-argument.rs @@ -164,195 +164,195 @@ // lldb-command:run // lldb-command:print a -// lldbg-check:[...]$0 = 1 +// lldbg-check:[...] 1 // lldbr-check:(isize) a = 1 // lldb-command:print b -// lldbg-check:[...]$1 = false +// lldbg-check:[...] false // lldbr-check:(bool) b = false // lldb-command:continue // lldb-command:print a -// lldbg-check:[...]$2 = 2 +// lldbg-check:[...] 2 // lldbr-check:(isize) a = 2 // lldb-command:print b -// lldbg-check:[...]$3 = 3 +// lldbg-check:[...] 3 // lldbr-check:(u16) b = 3 // lldb-command:print c -// lldbg-check:[...]$4 = 4 +// lldbg-check:[...] 4 // lldbr-check:(u16) c = 4 // lldb-command:continue // lldb-command:print a -// lldbg-check:[...]$5 = 5 +// lldbg-check:[...] 5 // lldbr-check:(isize) a = 5 // lldb-command:print b -// lldbg-check:[...]$6 = { 0 = 6 1 = 7 } +// lldbg-check:[...] { 0 = 6 1 = 7 } // lldbr-check:((u32, u32)) b = { 0 = 6 1 = 7 } // lldb-command:continue // lldb-command:print h -// lldbg-check:[...]$7 = 8 +// lldbg-check:[...] 8 // lldbr-check:(i16) h = 8 // lldb-command:print i -// lldbg-check:[...]$8 = { a = 9 b = 10 } +// lldbg-check:[...] { a = 9 b = 10 } // lldbr-check:(destructured_fn_argument::Struct) i = { a = 9 b = 10 } // lldb-command:print j -// lldbg-check:[...]$9 = 11 +// lldbg-check:[...] 11 // lldbr-check:(i16) j = 11 // lldb-command:continue // lldb-command:print k -// lldbg-check:[...]$10 = 12 +// lldbg-check:[...] 12 // lldbr-check:(i64) k = 12 // lldb-command:print l -// lldbg-check:[...]$11 = 13 +// lldbg-check:[...] 13 // lldbr-check:(i32) l = 13 // lldb-command:continue // lldb-command:print m -// lldbg-check:[...]$12 = 14 +// lldbg-check:[...] 14 // lldbr-check:(isize) m = 14 // lldb-command:print n -// lldbg-check:[...]$13 = 16 +// lldbg-check:[...] 16 // lldbr-check:(i32) n = 16 // lldb-command:continue // lldb-command:print o -// lldbg-check:[...]$14 = 18 +// lldbg-check:[...] 18 // lldbr-check:(i32) o = 18 // lldb-command:continue // lldb-command:print p -// lldbg-check:[...]$15 = 19 +// lldbg-check:[...] 19 // lldbr-check:(i64) p = 19 // lldb-command:print q -// lldbg-check:[...]$16 = 20 +// lldbg-check:[...] 20 // lldbr-check:(i32) q = 20 // lldb-command:print r -// lldbg-check:[...]$17 = { a = 21 b = 22 } +// lldbg-check:[...] { a = 21 b = 22 } // lldbr-check:(destructured_fn_argument::Struct) r = { a = 21, b = 22 } // lldb-command:continue // lldb-command:print s -// lldbg-check:[...]$18 = 24 +// lldbg-check:[...] 24 // lldbr-check:(i32) s = 24 // lldb-command:print t -// lldbg-check:[...]$19 = 23 +// lldbg-check:[...] 23 // lldbr-check:(i64) t = 23 // lldb-command:continue // lldb-command:print u -// lldbg-check:[...]$20 = 25 +// lldbg-check:[...] 25 // lldbr-check:(i16) u = 25 // lldb-command:print v -// lldbg-check:[...]$21 = 26 +// lldbg-check:[...] 26 // lldbr-check:(i32) v = 26 // lldb-command:print w -// lldbg-check:[...]$22 = 27 +// lldbg-check:[...] 27 // lldbr-check:(i64) w = 27 // lldb-command:print x -// lldbg-check:[...]$23 = 28 +// lldbg-check:[...] 28 // lldbr-check:(i32) x = 28 // lldb-command:print y -// lldbg-check:[...]$24 = 29 +// lldbg-check:[...] 29 // lldbr-check:(i64) y = 29 // lldb-command:print z -// lldbg-check:[...]$25 = 30 +// lldbg-check:[...] 30 // lldbr-check:(i32) z = 30 // lldb-command:print ae -// lldbg-check:[...]$26 = 31 +// lldbg-check:[...] 31 // lldbr-check:(i64) ae = 31 // lldb-command:print oe -// lldbg-check:[...]$27 = 32 +// lldbg-check:[...] 32 // lldbr-check:(i32) oe = 32 // lldb-command:print ue -// lldbg-check:[...]$28 = 33 +// lldbg-check:[...] 33 // lldbr-check:(u16) ue = 33 // lldb-command:continue // lldb-command:print aa -// lldbg-check:[...]$29 = { 0 = 34 1 = 35 } +// lldbg-check:[...] { 0 = 34 1 = 35 } // lldbr-check:((isize, isize)) aa = { 0 = 34 1 = 35 } // lldb-command:continue // lldb-command:print bb -// lldbg-check:[...]$30 = { 0 = 36 1 = 37 } +// lldbg-check:[...] { 0 = 36 1 = 37 } // lldbr-check:((isize, isize)) bb = { 0 = 36 1 = 37 } // lldb-command:continue // lldb-command:print cc -// lldbg-check:[...]$31 = 38 +// lldbg-check:[...] 38 // lldbr-check:(isize) cc = 38 // lldb-command:continue // lldb-command:print dd -// lldbg-check:[...]$32 = { 0 = 40 1 = 41 2 = 42 } +// lldbg-check:[...] { 0 = 40 1 = 41 2 = 42 } // lldbr-check:((isize, isize, isize)) dd = { 0 = 40 1 = 41 2 = 42 } // lldb-command:continue // lldb-command:print *ee -// lldbg-check:[...]$33 = { 0 = 43 1 = 44 2 = 45 } +// lldbg-check:[...] { 0 = 43 1 = 44 2 = 45 } // lldbr-check:((isize, isize, isize)) *ee = { 0 = 43 1 = 44 2 = 45 } // lldb-command:continue // lldb-command:print *ff -// lldbg-check:[...]$34 = 46 +// lldbg-check:[...] 46 // lldbr-check:(isize) *ff = 46 // lldb-command:print gg -// lldbg-check:[...]$35 = { 0 = 47 1 = 48 } +// lldbg-check:[...] { 0 = 47 1 = 48 } // lldbr-check:((isize, isize)) gg = { 0 = 47 1 = 48 } // lldb-command:continue // lldb-command:print *hh -// lldbg-check:[...]$36 = 50 +// lldbg-check:[...] 50 // lldbr-check:(i32) *hh = 50 // lldb-command:continue // lldb-command:print ii -// lldbg-check:[...]$37 = 51 +// lldbg-check:[...] 51 // lldbr-check:(i32) ii = 51 // lldb-command:continue // lldb-command:print *jj -// lldbg-check:[...]$38 = 52 +// lldbg-check:[...] 52 // lldbr-check:(i32) *jj = 52 // lldb-command:continue // lldb-command:print kk -// lldbg-check:[...]$39 = 53 +// lldbg-check:[...] 53 // lldbr-check:(f64) kk = 53 // lldb-command:print ll -// lldbg-check:[...]$40 = 54 +// lldbg-check:[...] 54 // lldbr-check:(isize) ll = 54 // lldb-command:continue // lldb-command:print mm -// lldbg-check:[...]$41 = 55 +// lldbg-check:[...] 55 // lldbr-check:(f64) mm = 55 // lldb-command:print *nn -// lldbg-check:[...]$42 = 56 +// lldbg-check:[...] 56 // lldbr-check:(isize) *nn = 56 // lldb-command:continue // lldb-command:print oo -// lldbg-check:[...]$43 = 57 +// lldbg-check:[...] 57 // lldbr-check:(isize) oo = 57 // lldb-command:print pp -// lldbg-check:[...]$44 = 58 +// lldbg-check:[...] 58 // lldbr-check:(isize) pp = 58 // lldb-command:print qq -// lldbg-check:[...]$45 = 59 +// lldbg-check:[...] 59 // lldbr-check:(isize) qq = 59 // lldb-command:continue // lldb-command:print rr -// lldbg-check:[...]$46 = 60 +// lldbg-check:[...] 60 // lldbr-check:(isize) rr = 60 // lldb-command:print ss -// lldbg-check:[...]$47 = 61 +// lldbg-check:[...] 61 // lldbr-check:(isize) ss = 61 // lldb-command:print tt -// lldbg-check:[...]$48 = 62 +// lldbg-check:[...] 62 // lldbr-check:(isize) tt = 62 // lldb-command:continue diff --git a/tests/debuginfo/destructured-for-loop-variable.rs b/tests/debuginfo/destructured-for-loop-variable.rs index 3e27d122c4beb..e583804cb1e9e 100644 --- a/tests/debuginfo/destructured-for-loop-variable.rs +++ b/tests/debuginfo/destructured-for-loop-variable.rs @@ -85,89 +85,89 @@ // DESTRUCTURED STRUCT // lldb-command:print x -// lldbg-check:[...]$0 = 400 +// lldbg-check:[...] 400 // lldbr-check:(i16) x = 400 // lldb-command:print y -// lldbg-check:[...]$1 = 401.5 +// lldbg-check:[...] 401.5 // lldbr-check:(f32) y = 401.5 // lldb-command:print z -// lldbg-check:[...]$2 = true +// lldbg-check:[...] true // lldbr-check:(bool) z = true // lldb-command:continue // DESTRUCTURED TUPLE // lldb-command:print _i8 -// lldbg-check:[...]$3 = 0x6f +// lldbg-check:[...] 0x6f // lldbr-check:(i8) _i8 = 111 // lldb-command:print _u8 -// lldbg-check:[...]$4 = 0x70 +// lldbg-check:[...] 0x70 // lldbr-check:(u8) _u8 = 112 // lldb-command:print _i16 -// lldbg-check:[...]$5 = -113 +// lldbg-check:[...] -113 // lldbr-check:(i16) _i16 = -113 // lldb-command:print _u16 -// lldbg-check:[...]$6 = 114 +// lldbg-check:[...] 114 // lldbr-check:(u16) _u16 = 114 // lldb-command:print _i32 -// lldbg-check:[...]$7 = -115 +// lldbg-check:[...] -115 // lldbr-check:(i32) _i32 = -115 // lldb-command:print _u32 -// lldbg-check:[...]$8 = 116 +// lldbg-check:[...] 116 // lldbr-check:(u32) _u32 = 116 // lldb-command:print _i64 -// lldbg-check:[...]$9 = -117 +// lldbg-check:[...] -117 // lldbr-check:(i64) _i64 = -117 // lldb-command:print _u64 -// lldbg-check:[...]$10 = 118 +// lldbg-check:[...] 118 // lldbr-check:(u64) _u64 = 118 // lldb-command:print _f32 -// lldbg-check:[...]$11 = 119.5 +// lldbg-check:[...] 119.5 // lldbr-check:(f32) _f32 = 119.5 // lldb-command:print _f64 -// lldbg-check:[...]$12 = 120.5 +// lldbg-check:[...] 120.5 // lldbr-check:(f64) _f64 = 120.5 // lldb-command:continue // MORE COMPLEX CASE // lldb-command:print v1 -// lldbg-check:[...]$13 = 80000 +// lldbg-check:[...] 80000 // lldbr-check:(i32) v1 = 80000 // lldb-command:print x1 -// lldbg-check:[...]$14 = 8000 +// lldbg-check:[...] 8000 // lldbr-check:(i16) x1 = 8000 // lldb-command:print *y1 -// lldbg-check:[...]$15 = 80001.5 +// lldbg-check:[...] 80001.5 // lldbr-check:(f32) *y1 = 80001.5 // lldb-command:print z1 -// lldbg-check:[...]$16 = false +// lldbg-check:[...] false // lldbr-check:(bool) z1 = false // lldb-command:print *x2 -// lldbg-check:[...]$17 = -30000 +// lldbg-check:[...] -30000 // lldbr-check:(i16) *x2 = -30000 // lldb-command:print y2 -// lldbg-check:[...]$18 = -300001.5 +// lldbg-check:[...] -300001.5 // lldbr-check:(f32) y2 = -300001.5 // lldb-command:print *z2 -// lldbg-check:[...]$19 = true +// lldbg-check:[...] true // lldbr-check:(bool) *z2 = true // lldb-command:print v2 -// lldbg-check:[...]$20 = 854237.5 +// lldbg-check:[...] 854237.5 // lldbr-check:(f64) v2 = 854237.5 // lldb-command:continue // SIMPLE IDENTIFIER // lldb-command:print i -// lldbg-check:[...]$21 = 1234 +// lldbg-check:[...] 1234 // lldbr-check:(i32) i = 1234 // lldb-command:continue // lldb-command:print simple_struct_ident -// lldbg-check:[...]$22 = { x = 3537 y = 35437.5 z = true } +// lldbg-check:[...] { x = 3537 y = 35437.5 z = true } // lldbr-check:(destructured_for_loop_variable::Struct) simple_struct_ident = { x = 3537 y = 35437.5 z = true } // lldb-command:continue // lldb-command:print simple_tuple_ident -// lldbg-check:[...]$23 = { 0 = 34903493 1 = 232323 } +// lldbg-check:[...] { 0 = 34903493 1 = 232323 } // lldbr-check:((u32, i64)) simple_tuple_ident = { 0 = 34903493 1 = 232323 } // lldb-command:continue diff --git a/tests/debuginfo/destructured-local.rs b/tests/debuginfo/destructured-local.rs index 3e0557382b3ca..9993407815e0a 100644 --- a/tests/debuginfo/destructured-local.rs +++ b/tests/debuginfo/destructured-local.rs @@ -130,156 +130,156 @@ // lldb-command:run // lldb-command:print a -// lldbg-check:[...]$0 = 1 +// lldbg-check:[...] 1 // lldbr-check:(isize) a = 1 // lldb-command:print b -// lldbg-check:[...]$1 = false +// lldbg-check:[...] false // lldbr-check:(bool) b = false // lldb-command:print c -// lldbg-check:[...]$2 = 2 +// lldbg-check:[...] 2 // lldbr-check:(isize) c = 2 // lldb-command:print d -// lldbg-check:[...]$3 = 3 +// lldbg-check:[...] 3 // lldbr-check:(u16) d = 3 // lldb-command:print e -// lldbg-check:[...]$4 = 4 +// lldbg-check:[...] 4 // lldbr-check:(u16) e = 4 // lldb-command:print f -// lldbg-check:[...]$5 = 5 +// lldbg-check:[...] 5 // lldbr-check:(isize) f = 5 // lldb-command:print g -// lldbg-check:[...]$6 = { 0 = 6 1 = 7 } +// lldbg-check:[...] { 0 = 6 1 = 7 } // lldbr-check:((u32, u32)) g = { 0 = 6 1 = 7 } // lldb-command:print h -// lldbg-check:[...]$7 = 8 +// lldbg-check:[...] 8 // lldbr-check:(i16) h = 8 // lldb-command:print i -// lldbg-check:[...]$8 = { a = 9 b = 10 } +// lldbg-check:[...] { a = 9 b = 10 } // lldbr-check:(destructured_local::Struct) i = { a = 9 b = 10 } // lldb-command:print j -// lldbg-check:[...]$9 = 11 +// lldbg-check:[...] 11 // lldbr-check:(i16) j = 11 // lldb-command:print k -// lldbg-check:[...]$10 = 12 +// lldbg-check:[...] 12 // lldbr-check:(i64) k = 12 // lldb-command:print l -// lldbg-check:[...]$11 = 13 +// lldbg-check:[...] 13 // lldbr-check:(i32) l = 13 // lldb-command:print m -// lldbg-check:[...]$12 = 14 +// lldbg-check:[...] 14 // lldbr-check:(i32) m = 14 // lldb-command:print n -// lldbg-check:[...]$13 = 16 +// lldbg-check:[...] 16 // lldbr-check:(i32) n = 16 // lldb-command:print o -// lldbg-check:[...]$14 = 18 +// lldbg-check:[...] 18 // lldbr-check:(i32) o = 18 // lldb-command:print p -// lldbg-check:[...]$15 = 19 +// lldbg-check:[...] 19 // lldbr-check:(i64) p = 19 // lldb-command:print q -// lldbg-check:[...]$16 = 20 +// lldbg-check:[...] 20 // lldbr-check:(i32) q = 20 // lldb-command:print r -// lldbg-check:[...]$17 = { a = 21 b = 22 } +// lldbg-check:[...] { a = 21 b = 22 } // lldbr-check:(destructured_local::Struct) r = { a = 21 b = 22 } // lldb-command:print s -// lldbg-check:[...]$18 = 24 +// lldbg-check:[...] 24 // lldbr-check:(i32) s = 24 // lldb-command:print t -// lldbg-check:[...]$19 = 23 +// lldbg-check:[...] 23 // lldbr-check:(i64) t = 23 // lldb-command:print u -// lldbg-check:[...]$20 = 25 +// lldbg-check:[...] 25 // lldbr-check:(i32) u = 25 // lldb-command:print v -// lldbg-check:[...]$21 = 26 +// lldbg-check:[...] 26 // lldbr-check:(i32) v = 26 // lldb-command:print w -// lldbg-check:[...]$22 = 27 +// lldbg-check:[...] 27 // lldbr-check:(i32) w = 27 // lldb-command:print x -// lldbg-check:[...]$23 = 28 +// lldbg-check:[...] 28 // lldbr-check:(i32) x = 28 // lldb-command:print y -// lldbg-check:[...]$24 = 29 +// lldbg-check:[...] 29 // lldbr-check:(i64) y = 29 // lldb-command:print z -// lldbg-check:[...]$25 = 30 +// lldbg-check:[...] 30 // lldbr-check:(i32) z = 30 // lldb-command:print ae -// lldbg-check:[...]$26 = 31 +// lldbg-check:[...] 31 // lldbr-check:(i64) ae = 31 // lldb-command:print oe -// lldbg-check:[...]$27 = 32 +// lldbg-check:[...] 32 // lldbr-check:(i32) oe = 32 // lldb-command:print ue -// lldbg-check:[...]$28 = 33 +// lldbg-check:[...] 33 // lldbr-check:(i32) ue = 33 // lldb-command:print aa -// lldbg-check:[...]$29 = { 0 = 34 1 = 35 } +// lldbg-check:[...] { 0 = 34 1 = 35 } // lldbr-check:((i32, i32)) aa = { 0 = 34 1 = 35 } // lldb-command:print bb -// lldbg-check:[...]$30 = { 0 = 36 1 = 37 } +// lldbg-check:[...] { 0 = 36 1 = 37 } // lldbr-check:((i32, i32)) bb = { 0 = 36 1 = 37 } // lldb-command:print cc -// lldbg-check:[...]$31 = 38 +// lldbg-check:[...] 38 // lldbr-check:(i32) cc = 38 // lldb-command:print dd -// lldbg-check:[...]$32 = { 0 = 40 1 = 41 2 = 42 } +// lldbg-check:[...] { 0 = 40 1 = 41 2 = 42 } // lldbr-check:((i32, i32, i32)) dd = { 0 = 40 1 = 41 2 = 42} // lldb-command:print *ee -// lldbg-check:[...]$33 = { 0 = 43 1 = 44 2 = 45 } +// lldbg-check:[...] { 0 = 43 1 = 44 2 = 45 } // lldbr-check:((i32, i32, i32)) *ee = { 0 = 43 1 = 44 2 = 45} // lldb-command:print *ff -// lldbg-check:[...]$34 = 46 +// lldbg-check:[...] 46 // lldbr-check:(i32) *ff = 46 // lldb-command:print gg -// lldbg-check:[...]$35 = { 0 = 47 1 = 48 } +// lldbg-check:[...] { 0 = 47 1 = 48 } // lldbr-check:((i32, i32)) gg = { 0 = 47 1 = 48 } // lldb-command:print *hh -// lldbg-check:[...]$36 = 50 +// lldbg-check:[...] 50 // lldbr-check:(i32) *hh = 50 // lldb-command:print ii -// lldbg-check:[...]$37 = 51 +// lldbg-check:[...] 51 // lldbr-check:(i32) ii = 51 // lldb-command:print *jj -// lldbg-check:[...]$38 = 52 +// lldbg-check:[...] 52 // lldbr-check:(i32) *jj = 52 // lldb-command:print kk -// lldbg-check:[...]$39 = 53 +// lldbg-check:[...] 53 // lldbr-check:(f64) kk = 53 // lldb-command:print ll -// lldbg-check:[...]$40 = 54 +// lldbg-check:[...] 54 // lldbr-check:(isize) ll = 54 // lldb-command:print mm -// lldbg-check:[...]$41 = 55 +// lldbg-check:[...] 55 // lldbr-check:(f64) mm = 55 // lldb-command:print *nn -// lldbg-check:[...]$42 = 56 +// lldbg-check:[...] 56 // lldbr-check:(isize) *nn = 56 diff --git a/tests/debuginfo/drop-locations.rs b/tests/debuginfo/drop-locations.rs index 6404bf9c3dad5..15b2d0de7fe99 100644 --- a/tests/debuginfo/drop-locations.rs +++ b/tests/debuginfo/drop-locations.rs @@ -43,22 +43,22 @@ // lldb-command:run // lldb-command:next // lldb-command:frame select -// lldb-check:[...]#loc1[...] +// lldb-check:[...] #loc1 [...] // lldb-command:next // lldb-command:frame select -// lldb-check:[...]#loc2[...] +// lldb-check:[...] #loc2 [...] // lldb-command:next // lldb-command:frame select -// lldb-check:[...]#loc3[...] +// lldb-check:[...] #loc3 [...] // lldb-command:next // lldb-command:frame select -// lldb-check:[...]#loc4[...] +// lldb-check:[...] #loc4 [...] // lldb-command:next // lldb-command:frame select -// lldb-check:[...]#loc5[...] +// lldb-check:[...] #loc5 [...] // lldb-command:next // lldb-command:frame select -// lldb-check:[...]#loc6[...] +// lldb-check:[...] #loc6 [...] fn main() { diff --git a/tests/debuginfo/empty-string.rs b/tests/debuginfo/empty-string.rs index 838e160e74ea6..2afdfc8ad04ba 100644 --- a/tests/debuginfo/empty-string.rs +++ b/tests/debuginfo/empty-string.rs @@ -20,10 +20,10 @@ // lldb-command: run // lldb-command: fr v empty_string -// lldb-check:[...]empty_string = "" { vec = size=0 } +// lldb-check:[...] empty_string = "" { vec = size=0 } // lldb-command: fr v empty_str -// lldb-check:[...]empty_str = "" { data_ptr = [...] length = 0 } +// lldb-check:[...] empty_str = "" { data_ptr = [...] length = 0 } fn main() { let empty_string = String::new(); diff --git a/tests/debuginfo/enum-thinlto.rs b/tests/debuginfo/enum-thinlto.rs index 5c27fe4271cad..2e541663147f9 100644 --- a/tests/debuginfo/enum-thinlto.rs +++ b/tests/debuginfo/enum-thinlto.rs @@ -15,7 +15,7 @@ // lldb-command:run // lldb-command:print *abc -// lldbg-check:(enum_thinlto::ABC) $0 = +// lldbg-check:(enum_thinlto::ABC) // lldbr-check:(enum_thinlto::ABC) *abc = (x = 0, y = 8970181431921507452) #![allow(unused_variables)] diff --git a/tests/debuginfo/evec-in-struct.rs b/tests/debuginfo/evec-in-struct.rs index d238cc9eded18..0e6565830a9b7 100644 --- a/tests/debuginfo/evec-in-struct.rs +++ b/tests/debuginfo/evec-in-struct.rs @@ -31,22 +31,22 @@ // lldb-command:run // lldb-command:print no_padding1 -// lldbg-check:[...]$0 = { x = { [0] = 0 [1] = 1 [2] = 2 } y = -3 z = { [0] = 4.5 [1] = 5.5 } } +// lldbg-check:[...] { x = { [0] = 0 [1] = 1 [2] = 2 } y = -3 z = { [0] = 4.5 [1] = 5.5 } } // lldbr-check:(evec_in_struct::NoPadding1) no_padding1 = { x = { [0] = 0 [1] = 1 [2] = 2 } y = -3 z = { [0] = 4.5 [1] = 5.5 } } // lldb-command:print no_padding2 -// lldbg-check:[...]$1 = { x = { [0] = 6 [1] = 7 [2] = 8 } y = { [0] = { [0] = 9 [1] = 10 } [1] = { [0] = 11 [1] = 12 } } } +// lldbg-check:[...] { x = { [0] = 6 [1] = 7 [2] = 8 } y = { [0] = { [0] = 9 [1] = 10 } [1] = { [0] = 11 [1] = 12 } } } // lldbr-check:(evec_in_struct::NoPadding2) no_padding2 = { x = { [0] = 6 [1] = 7 [2] = 8 } y = { [0] = { [0] = 9 [1] = 10 } [1] = { [0] = 11 [1] = 12 } } } // lldb-command:print struct_internal_padding -// lldbg-check:[...]$2 = { x = { [0] = 13 [1] = 14 } y = { [0] = 15 [1] = 16 } } +// lldbg-check:[...] { x = { [0] = 13 [1] = 14 } y = { [0] = 15 [1] = 16 } } // lldbr-check:(evec_in_struct::StructInternalPadding) struct_internal_padding = { x = { [0] = 13 [1] = 14 } y = { [0] = 15 [1] = 16 } } // lldb-command:print single_vec -// lldbg-check:[...]$3 = { x = { [0] = 17 [1] = 18 [2] = 19 [3] = 20 [4] = 21 } } +// lldbg-check:[...] { x = { [0] = 17 [1] = 18 [2] = 19 [3] = 20 [4] = 21 } } // lldbr-check:(evec_in_struct::SingleVec) single_vec = { x = { [0] = 17 [1] = 18 [2] = 19 [3] = 20 [4] = 21 } } // lldb-command:print struct_padded_at_end -// lldbg-check:[...]$4 = { x = { [0] = 22 [1] = 23 } y = { [0] = 24 [1] = 25 } } +// lldbg-check:[...] { x = { [0] = 22 [1] = 23 } y = { [0] = 24 [1] = 25 } } // lldbr-check:(evec_in_struct::StructPaddedAtEnd) struct_padded_at_end = { x = { [0] = 22 [1] = 23 } y = { [0] = 24 [1] = 25 } } #![allow(unused_variables)] diff --git a/tests/debuginfo/extern-c-fn.rs b/tests/debuginfo/extern-c-fn.rs index 62c2b60996927..0d2eb9e6daf00 100644 --- a/tests/debuginfo/extern-c-fn.rs +++ b/tests/debuginfo/extern-c-fn.rs @@ -22,16 +22,16 @@ // lldb-command:run // lldb-command:print len -// lldbg-check:[...]$0 = 20 +// lldbg-check:[...] 20 // lldbr-check:(i32) len = 20 // lldb-command:print local0 -// lldbg-check:[...]$1 = 19 +// lldbg-check:[...] 19 // lldbr-check:(i32) local0 = 19 // lldb-command:print local1 -// lldbg-check:[...]$2 = true +// lldbg-check:[...] true // lldbr-check:(bool) local1 = true // lldb-command:print local2 -// lldbg-check:[...]$3 = 20.5 +// lldbg-check:[...] 20.5 // lldbr-check:(f64) local2 = 20.5 // lldb-command:continue diff --git a/tests/debuginfo/function-arg-initialization.rs b/tests/debuginfo/function-arg-initialization.rs index 4bdaefd9bdd23..5288aa2e6f16a 100644 --- a/tests/debuginfo/function-arg-initialization.rs +++ b/tests/debuginfo/function-arg-initialization.rs @@ -120,99 +120,99 @@ // IMMEDIATE ARGS // lldb-command:print a -// lldb-check:[...]$0 = 1 +// lldb-check:[...] 1 // lldb-command:print b -// lldb-check:[...]$1 = true +// lldb-check:[...] true // lldb-command:print c -// lldb-check:[...]$2 = 2.5 +// lldb-check:[...] 2.5 // lldb-command:continue // NON IMMEDIATE ARGS // lldb-command:print a -// lldb-check:[...]$3 = BigStruct { a: 3, b: 4, c: 5, d: 6, e: 7, f: 8, g: 9, h: 10 } +// lldb-check:[...] BigStruct { a: 3, b: 4, c: 5, d: 6, e: 7, f: 8, g: 9, h: 10 } // lldb-command:print b -// lldb-check:[...]$4 = BigStruct { a: 11, b: 12, c: 13, d: 14, e: 15, f: 16, g: 17, h: 18 } +// lldb-check:[...] BigStruct { a: 11, b: 12, c: 13, d: 14, e: 15, f: 16, g: 17, h: 18 } // lldb-command:continue // BINDING // lldb-command:print a -// lldb-check:[...]$5 = 19 +// lldb-check:[...] 19 // lldb-command:print b -// lldb-check:[...]$6 = 20 +// lldb-check:[...] 20 // lldb-command:print c -// lldb-check:[...]$7 = 21.5 +// lldb-check:[...] 21.5 // lldb-command:continue // ASSIGNMENT // lldb-command:print a -// lldb-check:[...]$8 = 22 +// lldb-check:[...] 22 // lldb-command:print b -// lldb-check:[...]$9 = 23 +// lldb-check:[...] 23 // lldb-command:print c -// lldb-check:[...]$10 = 24.5 +// lldb-check:[...] 24.5 // lldb-command:continue // FUNCTION CALL // lldb-command:print x -// lldb-check:[...]$11 = 25 +// lldb-check:[...] 25 // lldb-command:print y -// lldb-check:[...]$12 = 26 +// lldb-check:[...] 26 // lldb-command:print z -// lldb-check:[...]$13 = 27.5 +// lldb-check:[...] 27.5 // lldb-command:continue // EXPR // lldb-command:print x -// lldb-check:[...]$14 = 28 +// lldb-check:[...] 28 // lldb-command:print y -// lldb-check:[...]$15 = 29 +// lldb-check:[...] 29 // lldb-command:print z -// lldb-check:[...]$16 = 30.5 +// lldb-check:[...] 30.5 // lldb-command:continue // RETURN EXPR // lldb-command:print x -// lldb-check:[...]$17 = 31 +// lldb-check:[...] 31 // lldb-command:print y -// lldb-check:[...]$18 = 32 +// lldb-check:[...] 32 // lldb-command:print z -// lldb-check:[...]$19 = 33.5 +// lldb-check:[...] 33.5 // lldb-command:continue // ARITHMETIC EXPR // lldb-command:print x -// lldb-check:[...]$20 = 34 +// lldb-check:[...] 34 // lldb-command:print y -// lldb-check:[...]$21 = 35 +// lldb-check:[...] 35 // lldb-command:print z -// lldb-check:[...]$22 = 36.5 +// lldb-check:[...] 36.5 // lldb-command:continue // IF EXPR // lldb-command:print x -// lldb-check:[...]$23 = 37 +// lldb-check:[...] 37 // lldb-command:print y -// lldb-check:[...]$24 = 38 +// lldb-check:[...] 38 // lldb-command:print z -// lldb-check:[...]$25 = 39.5 +// lldb-check:[...] 39.5 // lldb-command:continue // WHILE EXPR // lldb-command:print x -// lldb-check:[...]$26 = 40 +// lldb-check:[...] 40 // lldb-command:print y -// lldb-check:[...]$27 = 41 +// lldb-check:[...] 41 // lldb-command:print z -// lldb-check:[...]$28 = 42 +// lldb-check:[...] 42 // lldb-command:continue // LOOP EXPR // lldb-command:print x -// lldb-check:[...]$29 = 43 +// lldb-check:[...] 43 // lldb-command:print y -// lldb-check:[...]$30 = 44 +// lldb-check:[...] 44 // lldb-command:print z -// lldb-check:[...]$31 = 45 +// lldb-check:[...] 45 // lldb-command:continue diff --git a/tests/debuginfo/function-arguments.rs b/tests/debuginfo/function-arguments.rs index c6b865bd458e1..84271d07b389f 100644 --- a/tests/debuginfo/function-arguments.rs +++ b/tests/debuginfo/function-arguments.rs @@ -23,18 +23,18 @@ // lldb-command:run // lldb-command:print x -// lldbg-check:[...]$0 = 111102 +// lldbg-check:[...] 111102 // lldbr-check:(isize) x = 111102 // lldb-command:print y -// lldbg-check:[...]$1 = true +// lldbg-check:[...] true // lldbr-check:(bool) y = true // lldb-command:continue // lldb-command:print a -// lldbg-check:[...]$2 = 2000 +// lldbg-check:[...] 2000 // lldbr-check:(i32) a = 2000 // lldb-command:print b -// lldbg-check:[...]$3 = 3000 +// lldbg-check:[...] 3000 // lldbr-check:(i64) b = 3000 // lldb-command:continue diff --git a/tests/debuginfo/function-prologue-stepping-regular.rs b/tests/debuginfo/function-prologue-stepping-regular.rs index e52d17a70bd7b..02567fd013e52 100644 --- a/tests/debuginfo/function-prologue-stepping-regular.rs +++ b/tests/debuginfo/function-prologue-stepping-regular.rs @@ -21,99 +21,99 @@ // IMMEDIATE ARGS // lldb-command:print a -// lldb-check:[...]$0 = 1 +// lldb-check:[...] 1 // lldb-command:print b -// lldb-check:[...]$1 = true +// lldb-check:[...] true // lldb-command:print c -// lldb-check:[...]$2 = 2.5 +// lldb-check:[...] 2.5 // lldb-command:continue // NON IMMEDIATE ARGS // lldb-command:print a -// lldb-check:[...]$3 = { a = 3, b = 4, c = 5, d = 6, e = 7, f = 8, g = 9, h = 10 } +// lldb-check:[...] { a = 3, b = 4, c = 5, d = 6, e = 7, f = 8, g = 9, h = 10 } // lldb-command:print b -// lldb-check:[...]$4 = { a = 11, b = 12, c = 13, d = 14, e = 15, f = 16, g = 17, h = 18 } +// lldb-check:[...] { a = 11, b = 12, c = 13, d = 14, e = 15, f = 16, g = 17, h = 18 } // lldb-command:continue // BINDING // lldb-command:print a -// lldb-check:[...]$5 = 19 +// lldb-check:[...] 19 // lldb-command:print b -// lldb-check:[...]$6 = 20 +// lldb-check:[...] 20 // lldb-command:print c -// lldb-check:[...]$7 = 21.5 +// lldb-check:[...] 21.5 // lldb-command:continue // ASSIGNMENT // lldb-command:print a -// lldb-check:[...]$8 = 22 +// lldb-check:[...] 22 // lldb-command:print b -// lldb-check:[...]$9 = 23 +// lldb-check:[...] 23 // lldb-command:print c -// lldb-check:[...]$10 = 24.5 +// lldb-check:[...] 24.5 // lldb-command:continue // FUNCTION CALL // lldb-command:print x -// lldb-check:[...]$11 = 25 +// lldb-check:[...] 25 // lldb-command:print y -// lldb-check:[...]$12 = 26 +// lldb-check:[...] 26 // lldb-command:print z -// lldb-check:[...]$13 = 27.5 +// lldb-check:[...] 27.5 // lldb-command:continue // EXPR // lldb-command:print x -// lldb-check:[...]$14 = 28 +// lldb-check:[...] 28 // lldb-command:print y -// lldb-check:[...]$15 = 29 +// lldb-check:[...] 29 // lldb-command:print z -// lldb-check:[...]$16 = 30.5 +// lldb-check:[...] 30.5 // lldb-command:continue // RETURN EXPR // lldb-command:print x -// lldb-check:[...]$17 = 31 +// lldb-check:[...] 31 // lldb-command:print y -// lldb-check:[...]$18 = 32 +// lldb-check:[...] 32 // lldb-command:print z -// lldb-check:[...]$19 = 33.5 +// lldb-check:[...] 33.5 // lldb-command:continue // ARITHMETIC EXPR // lldb-command:print x -// lldb-check:[...]$20 = 34 +// lldb-check:[...] 34 // lldb-command:print y -// lldb-check:[...]$21 = 35 +// lldb-check:[...] 35 // lldb-command:print z -// lldb-check:[...]$22 = 36.5 +// lldb-check:[...] 36.5 // lldb-command:continue // IF EXPR // lldb-command:print x -// lldb-check:[...]$23 = 37 +// lldb-check:[...] 37 // lldb-command:print y -// lldb-check:[...]$24 = 38 +// lldb-check:[...] 38 // lldb-command:print z -// lldb-check:[...]$25 = 39.5 +// lldb-check:[...] 39.5 // lldb-command:continue // WHILE EXPR // lldb-command:print x -// lldb-check:[...]$26 = 40 +// lldb-check:[...] 40 // lldb-command:print y -// lldb-check:[...]$27 = 41 +// lldb-check:[...] 41 // lldb-command:print z -// lldb-check:[...]$28 = 42 +// lldb-check:[...] 42 // lldb-command:continue // LOOP EXPR // lldb-command:print x -// lldb-check:[...]$29 = 43 +// lldb-check:[...] 43 // lldb-command:print y -// lldb-check:[...]$30 = 44 +// lldb-check:[...] 44 // lldb-command:print z -// lldb-check:[...]$31 = 45 +// lldb-check:[...] 45 // lldb-command:continue #![allow(unused_variables)] diff --git a/tests/debuginfo/generic-enum-with-different-disr-sizes.rs b/tests/debuginfo/generic-enum-with-different-disr-sizes.rs index 6a8aa831c404d..a7e97194e5df0 100644 --- a/tests/debuginfo/generic-enum-with-different-disr-sizes.rs +++ b/tests/debuginfo/generic-enum-with-different-disr-sizes.rs @@ -40,22 +40,22 @@ // lldb-command:run // lldb-command:print eight_bytes1 -// lldb-check:[...]$0 = Variant1(100) +// lldb-check:[...] Variant1(100) // lldb-command:print four_bytes1 -// lldb-check:[...]$1 = Variant1(101) +// lldb-check:[...] Variant1(101) // lldb-command:print two_bytes1 -// lldb-check:[...]$2 = Variant1(102) +// lldb-check:[...] Variant1(102) // lldb-command:print one_byte1 -// lldb-check:[...]$3 = Variant1('A') +// lldb-check:[...] Variant1('A') // lldb-command:print eight_bytes2 -// lldb-check:[...]$4 = Variant2(100) +// lldb-check:[...] Variant2(100) // lldb-command:print four_bytes2 -// lldb-check:[...]$5 = Variant2(101) +// lldb-check:[...] Variant2(101) // lldb-command:print two_bytes2 -// lldb-check:[...]$6 = Variant2(102) +// lldb-check:[...] Variant2(102) // lldb-command:print one_byte2 -// lldb-check:[...]$7 = Variant2('A') +// lldb-check:[...] Variant2('A') // lldb-command:continue diff --git a/tests/debuginfo/generic-function.rs b/tests/debuginfo/generic-function.rs index eab781d2150d3..5c33d0d8520bb 100644 --- a/tests/debuginfo/generic-function.rs +++ b/tests/debuginfo/generic-function.rs @@ -30,26 +30,26 @@ // lldb-command:run // lldb-command:print *t0 -// lldbg-check:[...]$0 = 1 +// lldbg-check:[...] 1 // lldbr-check:(i32) *t0 = 1 // lldb-command:print *t1 -// lldbg-check:[...]$1 = 2.5 +// lldbg-check:[...] 2.5 // lldbr-check:(f64) *t1 = 2.5 // lldb-command:continue // lldb-command:print *t0 -// lldbg-check:[...]$2 = 3.5 +// lldbg-check:[...] 3.5 // lldbr-check:(f64) *t0 = 3.5 // lldb-command:print *t1 -// lldbg-check:[...]$3 = 4 +// lldbg-check:[...] 4 // lldbr-check:(u16) *t1 = 4 // lldb-command:continue // lldb-command:print *t0 -// lldbg-check:[...]$4 = 5 +// lldbg-check:[...] 5 // lldbr-check:(i32) *t0 = 5 // lldb-command:print *t1 -// lldbg-check:[...]$5 = { a = 6 b = 7.5 } +// lldbg-check:[...] { a = 6 b = 7.5 } // lldbr-check:(generic_function::Struct) *t1 = { a = 6 b = 7.5 } // lldb-command:continue diff --git a/tests/debuginfo/generic-functions-nested.rs b/tests/debuginfo/generic-functions-nested.rs index a146015246e86..4be0ab80f650f 100644 --- a/tests/debuginfo/generic-functions-nested.rs +++ b/tests/debuginfo/generic-functions-nested.rs @@ -36,34 +36,34 @@ // lldb-command:run // lldb-command:print x -// lldbg-check:[...]$0 = -1 +// lldbg-check:[...] -1 // lldbr-check:(i32) x = -1 // lldb-command:print y -// lldbg-check:[...]$1 = 1 +// lldbg-check:[...] 1 // lldbr-check:(i32) y = 1 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$2 = -1 +// lldbg-check:[...] -1 // lldbr-check:(i32) x = -1 // lldb-command:print y -// lldbg-check:[...]$3 = 2.5 +// lldbg-check:[...] 2.5 // lldbr-check:(f64) y = 2.5 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$4 = -2.5 +// lldbg-check:[...] -2.5 // lldbr-check:(f64) x = -2.5 // lldb-command:print y -// lldbg-check:[...]$5 = 1 +// lldbg-check:[...] 1 // lldbr-check:(i32) y = 1 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$6 = -2.5 +// lldbg-check:[...] -2.5 // lldbr-check:(f64) x = -2.5 // lldb-command:print y -// lldbg-check:[...]$7 = 2.5 +// lldbg-check:[...] 2.5 // lldbr-check:(f64) y = 2.5 // lldb-command:continue diff --git a/tests/debuginfo/generic-method-on-generic-struct.rs b/tests/debuginfo/generic-method-on-generic-struct.rs index dd1f482f3fa66..dea1c17ad416b 100644 --- a/tests/debuginfo/generic-method-on-generic-struct.rs +++ b/tests/debuginfo/generic-method-on-generic-struct.rs @@ -65,61 +65,61 @@ // STACK BY REF // lldb-command:print *self -// lldbg-check:[...]$0 = { x = { 0 = 8888, 1 = -8888 } } +// lldbg-check:[...] { x = { 0 = 8888, 1 = -8888 } } // lldbr-check:(generic_method_on_generic_struct::Struct<(u32, i32)>) *self = { x = { 0 = 8888 1 = -8888 } } // lldb-command:print arg1 -// lldbg-check:[...]$1 = -1 +// lldbg-check:[...] -1 // lldbr-check:(isize) arg1 = -1 // lldb-command:print arg2 -// lldbg-check:[...]$2 = 2 +// lldbg-check:[...] 2 // lldbr-check:(u16) arg2 = 2 // lldb-command:continue // STACK BY VAL // lldb-command:print self -// lldbg-check:[...]$3 = { x = { 0 = 8888, 1 = -8888 } } +// lldbg-check:[...] { x = { 0 = 8888, 1 = -8888 } } // lldbr-check:(generic_method_on_generic_struct::Struct<(u32, i32)>) self = { x = { 0 = 8888, 1 = -8888 } } // lldb-command:print arg1 -// lldbg-check:[...]$4 = -3 +// lldbg-check:[...] -3 // lldbr-check:(isize) arg1 = -3 // lldb-command:print arg2 -// lldbg-check:[...]$5 = -4 +// lldbg-check:[...] -4 // lldbr-check:(i16) arg2 = -4 // lldb-command:continue // OWNED BY REF // lldb-command:print *self -// lldbg-check:[...]$6 = { x = 1234.5 } +// lldbg-check:[...] { x = 1234.5 } // lldbr-check:(generic_method_on_generic_struct::Struct) *self = { x = 1234.5 } // lldb-command:print arg1 -// lldbg-check:[...]$7 = -5 +// lldbg-check:[...] -5 // lldbr-check:(isize) arg1 = -5 // lldb-command:print arg2 -// lldbg-check:[...]$8 = -6 +// lldbg-check:[...] -6 // lldbr-check:(i32) arg2 = -6 // lldb-command:continue // OWNED BY VAL // lldb-command:print self -// lldbg-check:[...]$9 = { x = 1234.5 } +// lldbg-check:[...] { x = 1234.5 } // lldbr-check:(generic_method_on_generic_struct::Struct) self = { x = 1234.5 } // lldb-command:print arg1 -// lldbg-check:[...]$10 = -7 +// lldbg-check:[...] -7 // lldbr-check:(isize) arg1 = -7 // lldb-command:print arg2 -// lldbg-check:[...]$11 = -8 +// lldbg-check:[...] -8 // lldbr-check:(i64) arg2 = -8 // lldb-command:continue // OWNED MOVED // lldb-command:print *self -// lldbg-check:[...]$12 = { x = 1234.5 } +// lldbg-check:[...] { x = 1234.5 } // lldbr-check:(generic_method_on_generic_struct::Struct) *self = { x = 1234.5 } // lldb-command:print arg1 -// lldbg-check:[...]$13 = -9 +// lldbg-check:[...] -9 // lldbr-check:(isize) arg1 = -9 // lldb-command:print arg2 -// lldbg-check:[...]$14 = -10.5 +// lldbg-check:[...] -10.5 // lldbr-check:(f32) arg2 = -10.5 // lldb-command:continue diff --git a/tests/debuginfo/generic-struct.rs b/tests/debuginfo/generic-struct.rs index 82ed17618aaac..4c442feec6ac1 100644 --- a/tests/debuginfo/generic-struct.rs +++ b/tests/debuginfo/generic-struct.rs @@ -26,17 +26,17 @@ // lldb-command:run // lldb-command:print int_int -// lldbg-check:[...]$0 = AGenericStruct { key: 0, value: 1 } +// lldbg-check:[...] AGenericStruct { key: 0, value: 1 } // lldbr-check:(generic_struct::AGenericStruct) int_int = AGenericStruct { key: 0, value: 1 } // lldb-command:print int_float -// lldbg-check:[...]$1 = AGenericStruct { key: 2, value: 3.5 } +// lldbg-check:[...] AGenericStruct { key: 2, value: 3.5 } // lldbr-check:(generic_struct::AGenericStruct) int_float = AGenericStruct { key: 2, value: 3.5 } // lldb-command:print float_int -// lldbg-check:[...]$2 = AGenericStruct { key: 4.5, value: 5 } +// lldbg-check:[...] AGenericStruct { key: 4.5, value: 5 } // lldbr-check:(generic_struct::AGenericStruct) float_int = AGenericStruct { key: 4.5, value: 5 } // lldb-command:print float_int_float -// lldbg-check:[...]$3 = AGenericStruct> { key: 6.5, value: AGenericStruct { key: 7, value: 8.5 } } +// lldbg-check:[...] AGenericStruct> { key: 6.5, value: AGenericStruct { key: 7, value: 8.5 } } // lldbr-check:(generic_struct::AGenericStruct>) float_int_float = AGenericStruct> { key: 6.5, value: AGenericStruct { key: 7, value: 8.5 } } // === CDB TESTS =================================================================================== diff --git a/tests/debuginfo/include_string.rs b/tests/debuginfo/include_string.rs index 6f7d2b28b4186..77b2d7dec5f9b 100644 --- a/tests/debuginfo/include_string.rs +++ b/tests/debuginfo/include_string.rs @@ -16,13 +16,13 @@ // lldb-command:run // lldb-command:print string1.length -// lldbg-check:[...]$0 = 48 +// lldbg-check:[...] 48 // lldbr-check:(usize) length = 48 // lldb-command:print string2.length -// lldbg-check:[...]$1 = 49 +// lldbg-check:[...] 49 // lldbr-check:(usize) length = 49 // lldb-command:print string3.length -// lldbg-check:[...]$2 = 50 +// lldbg-check:[...] 50 // lldbr-check:(usize) length = 50 // lldb-command:continue diff --git a/tests/debuginfo/issue-22656.rs b/tests/debuginfo/issue-22656.rs index acbe2b12a248a..375967f2072a5 100644 --- a/tests/debuginfo/issue-22656.rs +++ b/tests/debuginfo/issue-22656.rs @@ -11,10 +11,10 @@ // lldb-command:run // lldb-command:print v -// lldbg-check:[...]$0 = size=3 { [0] = 1 [1] = 2 [2] = 3 } +// lldbg-check:[...] size=3 { [0] = 1 [1] = 2 [2] = 3 } // lldbr-check:(alloc::vec::Vec) v = size=3 { [0] = 1 [1] = 2 [2] = 3 } // lldb-command:print zs -// lldbg-check:[...]$1 = { x = y = 123 z = w = 456 } +// lldbg-check:[...] { x = y = 123 z = w = 456 } // lldbr-check:(issue_22656::StructWithZeroSizedField) zs = { x = y = 123 z = w = 456 } // lldbr-command:continue diff --git a/tests/debuginfo/issue-57822.rs b/tests/debuginfo/issue-57822.rs index f4ef45f1d74b7..5d0973c1d6b3a 100644 --- a/tests/debuginfo/issue-57822.rs +++ b/tests/debuginfo/issue-57822.rs @@ -21,10 +21,10 @@ // lldb-command:run // lldb-command:print g -// lldbg-check:(issue_57822::main::{closure_env#1}) $0 = { f = { x = 1 } } +// lldbg-check:(issue_57822::main::{closure_env#1}) { f = { x = 1 } } // lldb-command:print b -// lldbg-check:(issue_57822::main::{coroutine_env#3}) $1 = +// lldbg-check:(issue_57822::main::{coroutine_env#3}) #![feature(omit_gdb_pretty_printer_section, coroutines, coroutine_trait)] #![omit_gdb_pretty_printer_section] diff --git a/tests/debuginfo/lexical-scope-in-for-loop.rs b/tests/debuginfo/lexical-scope-in-for-loop.rs index 93be5288a640a..6d8ff2970ef14 100644 --- a/tests/debuginfo/lexical-scope-in-for-loop.rs +++ b/tests/debuginfo/lexical-scope-in-for-loop.rs @@ -45,40 +45,40 @@ // FIRST ITERATION // lldb-command:print x -// lldbg-check:[...]$0 = 1 +// lldbg-check:[...] 1 // lldbr-check:(i32) x = 1 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$1 = -1 +// lldbg-check:[...] -1 // lldbr-check:(i32) x = -1 // lldb-command:continue // SECOND ITERATION // lldb-command:print x -// lldbg-check:[...]$2 = 2 +// lldbg-check:[...] 2 // lldbr-check:(i32) x = 2 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$3 = -2 +// lldbg-check:[...] -2 // lldbr-check:(i32) x = -2 // lldb-command:continue // THIRD ITERATION // lldb-command:print x -// lldbg-check:[...]$4 = 3 +// lldbg-check:[...] 3 // lldbr-check:(i32) x = 3 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$5 = -3 +// lldbg-check:[...] -3 // lldbr-check:(i32) x = -3 // lldb-command:continue // AFTER LOOP // lldb-command:print x -// lldbg-check:[...]$6 = 1000000 +// lldbg-check:[...] 1000000 // lldbr-check:(i32) x = 1000000 // lldb-command:continue diff --git a/tests/debuginfo/lexical-scope-in-if.rs b/tests/debuginfo/lexical-scope-in-if.rs index 88b4244a503ea..3e473acbda25e 100644 --- a/tests/debuginfo/lexical-scope-in-if.rs +++ b/tests/debuginfo/lexical-scope-in-if.rs @@ -69,73 +69,73 @@ // BEFORE if // lldb-command:print x -// lldbg-check:[...]$0 = 999 +// lldbg-check:[...] 999 // lldbr-check:(i32) x = 999 // lldb-command:print y -// lldbg-check:[...]$1 = -1 +// lldbg-check:[...] -1 // lldbr-check:(i32) y = -1 // lldb-command:continue // AT BEGINNING of 'then' block // lldb-command:print x -// lldbg-check:[...]$2 = 999 +// lldbg-check:[...] 999 // lldbr-check:(i32) x = 999 // lldb-command:print y -// lldbg-check:[...]$3 = -1 +// lldbg-check:[...] -1 // lldbr-check:(i32) y = -1 // lldb-command:continue // AFTER 1st redeclaration of 'x' // lldb-command:print x -// lldbg-check:[...]$4 = 1001 +// lldbg-check:[...] 1001 // lldbr-check:(i32) x = 1001 // lldb-command:print y -// lldbg-check:[...]$5 = -1 +// lldbg-check:[...] -1 // lldbr-check:(i32) y = -1 // lldb-command:continue // AFTER 2st redeclaration of 'x' // lldb-command:print x -// lldbg-check:[...]$6 = 1002 +// lldbg-check:[...] 1002 // lldbr-check:(i32) x = 1002 // lldb-command:print y -// lldbg-check:[...]$7 = 1003 +// lldbg-check:[...] 1003 // lldbr-check:(i32) y = 1003 // lldb-command:continue // AFTER 1st if expression // lldb-command:print x -// lldbg-check:[...]$8 = 999 +// lldbg-check:[...] 999 // lldbr-check:(i32) x = 999 // lldb-command:print y -// lldbg-check:[...]$9 = -1 +// lldbg-check:[...] -1 // lldbr-check:(i32) y = -1 // lldb-command:continue // BEGINNING of else branch // lldb-command:print x -// lldbg-check:[...]$10 = 999 +// lldbg-check:[...] 999 // lldbr-check:(i32) x = 999 // lldb-command:print y -// lldbg-check:[...]$11 = -1 +// lldbg-check:[...] -1 // lldbr-check:(i32) y = -1 // lldb-command:continue // BEGINNING of else branch // lldb-command:print x -// lldbg-check:[...]$12 = 1004 +// lldbg-check:[...] 1004 // lldbr-check:(i32) x = 1004 // lldb-command:print y -// lldbg-check:[...]$13 = 1005 +// lldbg-check:[...] 1005 // lldbr-check:(i32) y = 1005 // lldb-command:continue // BEGINNING of else branch // lldb-command:print x -// lldbg-check:[...]$14 = 999 +// lldbg-check:[...] 999 // lldbr-check:(i32) x = 999 // lldb-command:print y -// lldbg-check:[...]$15 = -1 +// lldbg-check:[...] -1 // lldbr-check:(i32) y = -1 // lldb-command:continue diff --git a/tests/debuginfo/lexical-scope-in-match.rs b/tests/debuginfo/lexical-scope-in-match.rs index 8a9ecfad249ed..0959f020ca315 100644 --- a/tests/debuginfo/lexical-scope-in-match.rs +++ b/tests/debuginfo/lexical-scope-in-match.rs @@ -64,72 +64,72 @@ // lldb-command:run // lldb-command:print shadowed -// lldbg-check:[...]$0 = 231 +// lldbg-check:[...] 231 // lldbr-check:(i32) shadowed = 231 // lldb-command:print not_shadowed -// lldbg-check:[...]$1 = 232 +// lldbg-check:[...] 232 // lldbr-check:(i32) not_shadowed = 232 // lldb-command:continue // lldb-command:print shadowed -// lldbg-check:[...]$2 = 233 +// lldbg-check:[...] 233 // lldbr-check:(i32) shadowed = 233 // lldb-command:print not_shadowed -// lldbg-check:[...]$3 = 232 +// lldbg-check:[...] 232 // lldbr-check:(i32) not_shadowed = 232 // lldb-command:print local_to_arm -// lldbg-check:[...]$4 = 234 +// lldbg-check:[...] 234 // lldbr-check:(i32) local_to_arm = 234 // lldb-command:continue // lldb-command:print shadowed -// lldbg-check:[...]$5 = 236 +// lldbg-check:[...] 236 // lldbr-check:(i32) shadowed = 236 // lldb-command:print not_shadowed -// lldbg-check:[...]$6 = 232 +// lldbg-check:[...] 232 // lldbr-check:(i32) not_shadowed = 232 // lldb-command:continue // lldb-command:print shadowed -// lldbg-check:[...]$7 = 237 +// lldbg-check:[...] 237 // lldbr-check:(isize) shadowed = 237 // lldb-command:print not_shadowed -// lldbg-check:[...]$8 = 232 +// lldbg-check:[...] 232 // lldbr-check:(i32) not_shadowed = 232 // lldb-command:print local_to_arm -// lldbg-check:[...]$9 = 238 +// lldbg-check:[...] 238 // lldbr-check:(isize) local_to_arm = 238 // lldb-command:continue // lldb-command:print shadowed -// lldbg-check:[...]$10 = 239 +// lldbg-check:[...] 239 // lldbr-check:(isize) shadowed = 239 // lldb-command:print not_shadowed -// lldbg-check:[...]$11 = 232 +// lldbg-check:[...] 232 // lldbr-check:(i32) not_shadowed = 232 // lldb-command:continue // lldb-command:print shadowed -// lldbg-check:[...]$12 = 241 +// lldbg-check:[...] 241 // lldbr-check:(isize) shadowed = 241 // lldb-command:print not_shadowed -// lldbg-check:[...]$13 = 232 +// lldbg-check:[...] 232 // lldbr-check:(i32) not_shadowed = 232 // lldb-command:continue // lldb-command:print shadowed -// lldbg-check:[...]$14 = 243 +// lldbg-check:[...] 243 // lldbr-check:(i32) shadowed = 243 // lldb-command:print *local_to_arm -// lldbg-check:[...]$15 = 244 +// lldbg-check:[...] 244 // lldbr-check:(i32) *local_to_arm = 244 // lldb-command:continue // lldb-command:print shadowed -// lldbg-check:[...]$16 = 231 +// lldbg-check:[...] 231 // lldbr-check:(i32) shadowed = 231 // lldb-command:print not_shadowed -// lldbg-check:[...]$17 = 232 +// lldbg-check:[...] 232 // lldbr-check:(i32) not_shadowed = 232 // lldb-command:continue diff --git a/tests/debuginfo/lexical-scope-in-stack-closure.rs b/tests/debuginfo/lexical-scope-in-stack-closure.rs index eeafed9f4db12..4d26b2f5c9abe 100644 --- a/tests/debuginfo/lexical-scope-in-stack-closure.rs +++ b/tests/debuginfo/lexical-scope-in-stack-closure.rs @@ -36,32 +36,32 @@ // lldb-command:run // lldb-command:print x -// lldbg-check:[...]$0 = false +// lldbg-check:[...] false // lldbr-check:(bool) x = false // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$1 = false +// lldbg-check:[...] false // lldbr-check:(bool) x = false // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$2 = 1000 +// lldbg-check:[...] 1000 // lldbr-check:(isize) x = 1000 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$3 = 2.5 +// lldbg-check:[...] 2.5 // lldbr-check:(f64) x = 2.5 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$4 = true +// lldbg-check:[...] true // lldbr-check:(bool) x = true // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$5 = false +// lldbg-check:[...] false // lldbr-check:(bool) x = false // lldb-command:continue diff --git a/tests/debuginfo/lexical-scope-in-unconditional-loop.rs b/tests/debuginfo/lexical-scope-in-unconditional-loop.rs index ec998975bc7c5..cf908b1a510a3 100644 --- a/tests/debuginfo/lexical-scope-in-unconditional-loop.rs +++ b/tests/debuginfo/lexical-scope-in-unconditional-loop.rs @@ -68,69 +68,69 @@ // FIRST ITERATION // lldb-command:print x -// lldbg-check:[...]$0 = 0 +// lldbg-check:[...] 0 // lldbr-check:(i32) x = 0 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$1 = 1 +// lldbg-check:[...] 1 // lldbr-check:(i32) x = 1 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$2 = 101 +// lldbg-check:[...] 101 // lldbr-check:(i32) x = 101 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$3 = 101 +// lldbg-check:[...] 101 // lldbr-check:(i32) x = 101 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$4 = -987 +// lldbg-check:[...] -987 // lldbr-check:(i32) x = -987 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$5 = 101 +// lldbg-check:[...] 101 // lldbr-check:(i32) x = 101 // lldb-command:continue // SECOND ITERATION // lldb-command:print x -// lldbg-check:[...]$6 = 1 +// lldbg-check:[...] 1 // lldbr-check:(i32) x = 1 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$7 = 2 +// lldbg-check:[...] 2 // lldbr-check:(i32) x = 2 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$8 = 102 +// lldbg-check:[...] 102 // lldbr-check:(i32) x = 102 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$9 = 102 +// lldbg-check:[...] 102 // lldbr-check:(i32) x = 102 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$10 = -987 +// lldbg-check:[...] -987 // lldbr-check:(i32) x = -987 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$11 = 102 +// lldbg-check:[...] 102 // lldbr-check:(i32) x = 102 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$12 = 2 +// lldbg-check:[...] 2 // lldbr-check:(i32) x = 2 // lldb-command:continue diff --git a/tests/debuginfo/lexical-scope-in-unique-closure.rs b/tests/debuginfo/lexical-scope-in-unique-closure.rs index 9376d0391875d..df8c2598e384c 100644 --- a/tests/debuginfo/lexical-scope-in-unique-closure.rs +++ b/tests/debuginfo/lexical-scope-in-unique-closure.rs @@ -36,32 +36,32 @@ // lldb-command:run // lldb-command:print x -// lldbg-check:[...]$0 = false +// lldbg-check:[...] false // lldbr-check:(bool) x = false // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$1 = false +// lldbg-check:[...] false // lldbr-check:(bool) x = false // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$2 = 1000 +// lldbg-check:[...] 1000 // lldbr-check:(isize) x = 1000 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$3 = 2.5 +// lldbg-check:[...] 2.5 // lldbr-check:(f64) x = 2.5 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$4 = true +// lldbg-check:[...] true // lldbr-check:(bool) x = true // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$5 = false +// lldbg-check:[...] false // lldbr-check:(bool) x = false // lldb-command:continue diff --git a/tests/debuginfo/lexical-scope-in-while.rs b/tests/debuginfo/lexical-scope-in-while.rs index f70ef9c2dd17b..98c580e479c1a 100644 --- a/tests/debuginfo/lexical-scope-in-while.rs +++ b/tests/debuginfo/lexical-scope-in-while.rs @@ -68,69 +68,69 @@ // FIRST ITERATION // lldb-command:print x -// lldbg-check:[...]$0 = 0 +// lldbg-check:[...] 0 // lldbr-check:(i32) x = 0 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$1 = 1 +// lldbg-check:[...] 1 // lldbr-check:(i32) x = 1 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$2 = 101 +// lldbg-check:[...] 101 // lldbr-check:(i32) x = 101 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$3 = 101 +// lldbg-check:[...] 101 // lldbr-check:(i32) x = 101 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$4 = -987 +// lldbg-check:[...] -987 // lldbr-check:(i32) x = -987 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$5 = 101 +// lldbg-check:[...] 101 // lldbr-check:(i32) x = 101 // lldb-command:continue // SECOND ITERATION // lldb-command:print x -// lldbg-check:[...]$6 = 1 +// lldbg-check:[...] 1 // lldbr-check:(i32) x = 1 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$7 = 2 +// lldbg-check:[...] 2 // lldbr-check:(i32) x = 2 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$8 = 102 +// lldbg-check:[...] 102 // lldbr-check:(i32) x = 102 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$9 = 102 +// lldbg-check:[...] 102 // lldbr-check:(i32) x = 102 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$10 = -987 +// lldbg-check:[...] -987 // lldbr-check:(i32) x = -987 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$11 = 102 +// lldbg-check:[...] 102 // lldbr-check:(i32) x = 102 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$12 = 2 +// lldbg-check:[...] 2 // lldbr-check:(i32) x = 2 // lldb-command:continue diff --git a/tests/debuginfo/lexical-scope-with-macro.rs b/tests/debuginfo/lexical-scope-with-macro.rs index 400dde6af313b..a38aba8b16ab7 100644 --- a/tests/debuginfo/lexical-scope-with-macro.rs +++ b/tests/debuginfo/lexical-scope-with-macro.rs @@ -57,56 +57,56 @@ // lldb-command:run // lldb-command:print a -// lldbg-check:[...]$0 = 10 +// lldbg-check:[...] 10 // lldbr-check:(i32) a = 10 // lldb-command:print b -// lldbg-check:[...]$1 = 34 +// lldbg-check:[...] 34 // lldbr-check:(i32) b = 34 // lldb-command:continue // lldb-command:print a -// lldbg-check:[...]$2 = 890242 +// lldbg-check:[...] 890242 // lldbr-check:(i32) a = 10 // lldb-command:print b -// lldbg-check:[...]$3 = 34 +// lldbg-check:[...] 34 // lldbr-check:(i32) b = 34 // lldb-command:continue // lldb-command:print a -// lldbg-check:[...]$4 = 10 +// lldbg-check:[...] 10 // lldbr-check:(i32) a = 10 // lldb-command:print b -// lldbg-check:[...]$5 = 34 +// lldbg-check:[...] 34 // lldbr-check:(i32) b = 34 // lldb-command:continue // lldb-command:print a -// lldbg-check:[...]$6 = 102 +// lldbg-check:[...] 102 // lldbr-check:(i32) a = 10 // lldb-command:print b -// lldbg-check:[...]$7 = 34 +// lldbg-check:[...] 34 // lldbr-check:(i32) b = 34 // lldb-command:continue // Don't test this with rust-enabled lldb for now; see issue #48807 // lldbg-command:print a -// lldbg-check:[...]$8 = 110 +// lldbg-check:[...] 110 // lldbg-command:print b -// lldbg-check:[...]$9 = 34 +// lldbg-check:[...] 34 // lldbg-command:continue // lldbg-command:print a -// lldbg-check:[...]$10 = 10 +// lldbg-check:[...] 10 // lldbg-command:print b -// lldbg-check:[...]$11 = 34 +// lldbg-check:[...] 34 // lldbg-command:continue // lldbg-command:print a -// lldbg-check:[...]$12 = 10 +// lldbg-check:[...] 10 // lldbg-command:print b -// lldbg-check:[...]$13 = 34 +// lldbg-check:[...] 34 // lldbg-command:print c -// lldbg-check:[...]$14 = 400 +// lldbg-check:[...] 400 // lldbg-command:continue diff --git a/tests/debuginfo/lexical-scopes-in-block-expression.rs b/tests/debuginfo/lexical-scopes-in-block-expression.rs index 09cb81424747f..5a82dc6e3f350 100644 --- a/tests/debuginfo/lexical-scopes-in-block-expression.rs +++ b/tests/debuginfo/lexical-scopes-in-block-expression.rs @@ -195,202 +195,202 @@ // STRUCT EXPRESSION // lldb-command:print val -// lldbg-check:[...]$0 = -1 +// lldbg-check:[...] -1 // lldbr-check:(i32) val = -1 // lldb-command:print ten -// lldbg-check:[...]$1 = 10 +// lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // lldb-command:print val -// lldbg-check:[...]$2 = 11 +// lldbg-check:[...] 11 // lldbr-check:(isize) val = 11 // lldb-command:print ten -// lldbg-check:[...]$3 = 10 +// lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // lldb-command:print val -// lldbg-check:[...]$4 = -1 +// lldbg-check:[...] -1 // lldbr-check:(i32) val = -1 // lldb-command:print ten -// lldbg-check:[...]$5 = 10 +// lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // FUNCTION CALL // lldb-command:print val -// lldbg-check:[...]$6 = -1 +// lldbg-check:[...] -1 // lldbr-check:(i32) val = -1 // lldb-command:print ten -// lldbg-check:[...]$7 = 10 +// lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // lldb-command:print val -// lldbg-check:[...]$8 = 12 +// lldbg-check:[...] 12 // lldbr-check:(isize) val = 12 // lldb-command:print ten -// lldbg-check:[...]$9 = 10 +// lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // lldb-command:print val -// lldbg-check:[...]$10 = -1 +// lldbg-check:[...] -1 // lldbr-check:(i32) val = -1 // lldb-command:print ten -// lldbg-check:[...]$11 = 10 +// lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // TUPLE EXPRESSION // lldb-command:print val -// lldbg-check:[...]$12 = -1 +// lldbg-check:[...] -1 // lldbr-check:(i32) val = -1 // lldb-command:print ten -// lldbg-check:[...]$13 = 10 +// lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // lldb-command:print val -// lldbg-check:[...]$14 = 13 +// lldbg-check:[...] 13 // lldbr-check:(isize) val = 13 // lldb-command:print ten -// lldbg-check:[...]$15 = 10 +// lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // lldb-command:print val -// lldbg-check:[...]$16 = -1 +// lldbg-check:[...] -1 // lldbr-check:(i32) val = -1 // lldb-command:print ten -// lldbg-check:[...]$17 = 10 +// lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // VEC EXPRESSION // lldb-command:print val -// lldbg-check:[...]$18 = -1 +// lldbg-check:[...] -1 // lldbr-check:(i32) val = -1 // lldb-command:print ten -// lldbg-check:[...]$19 = 10 +// lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // lldb-command:print val -// lldbg-check:[...]$20 = 14 +// lldbg-check:[...] 14 // lldbr-check:(isize) val = 14 // lldb-command:print ten -// lldbg-check:[...]$21 = 10 +// lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // lldb-command:print val -// lldbg-check:[...]$22 = -1 +// lldbg-check:[...] -1 // lldbr-check:(i32) val = -1 // lldb-command:print ten -// lldbg-check:[...]$23 = 10 +// lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // REPEAT VEC EXPRESSION // lldb-command:print val -// lldbg-check:[...]$24 = -1 +// lldbg-check:[...] -1 // lldbr-check:(i32) val = -1 // lldb-command:print ten -// lldbg-check:[...]$25 = 10 +// lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // lldb-command:print val -// lldbg-check:[...]$26 = 15 +// lldbg-check:[...] 15 // lldbr-check:(isize) val = 15 // lldb-command:print ten -// lldbg-check:[...]$27 = 10 +// lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // lldb-command:print val -// lldbg-check:[...]$28 = -1 +// lldbg-check:[...] -1 // lldbr-check:(i32) val = -1 // lldb-command:print ten -// lldbg-check:[...]$29 = 10 +// lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // ASSIGNMENT EXPRESSION // lldb-command:print val -// lldbg-check:[...]$30 = -1 +// lldbg-check:[...] -1 // lldbr-check:(i32) val = -1 // lldb-command:print ten -// lldbg-check:[...]$31 = 10 +// lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // lldb-command:print val -// lldbg-check:[...]$32 = 16 +// lldbg-check:[...] 16 // lldbr-check:(isize) val = 16 // lldb-command:print ten -// lldbg-check:[...]$33 = 10 +// lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // lldb-command:print val -// lldbg-check:[...]$34 = -1 +// lldbg-check:[...] -1 // lldbr-check:(i32) val = -1 // lldb-command:print ten -// lldbg-check:[...]$35 = 10 +// lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // ARITHMETIC EXPRESSION // lldb-command:print val -// lldbg-check:[...]$36 = -1 +// lldbg-check:[...] -1 // lldbr-check:(i32) val = -1 // lldb-command:print ten -// lldbg-check:[...]$37 = 10 +// lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // lldb-command:print val -// lldbg-check:[...]$38 = 17 +// lldbg-check:[...] 17 // lldbr-check:(isize) val = 17 // lldb-command:print ten -// lldbg-check:[...]$39 = 10 +// lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // lldb-command:print val -// lldbg-check:[...]$40 = -1 +// lldbg-check:[...] -1 // lldbr-check:(i32) val = -1 // lldb-command:print ten -// lldbg-check:[...]$41 = 10 +// lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // INDEX EXPRESSION // lldb-command:print val -// lldbg-check:[...]$42 = -1 +// lldbg-check:[...] -1 // lldbr-check:(i32) val = -1 // lldb-command:print ten -// lldbg-check:[...]$43 = 10 +// lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // lldb-command:print val -// lldbg-check:[...]$44 = 18 +// lldbg-check:[...] 18 // lldbr-check:(isize) val = 18 // lldb-command:print ten -// lldbg-check:[...]$45 = 10 +// lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // lldb-command:print val -// lldbg-check:[...]$46 = -1 +// lldbg-check:[...] -1 // lldbr-check:(i32) val = -1 // lldb-command:print ten -// lldbg-check:[...]$47 = 10 +// lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue diff --git a/tests/debuginfo/macro-stepping.rs b/tests/debuginfo/macro-stepping.rs index 69cabd92298c9..71ff9798079fa 100644 --- a/tests/debuginfo/macro-stepping.rs +++ b/tests/debuginfo/macro-stepping.rs @@ -56,36 +56,36 @@ extern crate macro_stepping; // exports new_scope!() // lldb-command:run // lldb-command:next // lldb-command:frame select -// lldb-check:[...]#loc1[...] +// lldb-check:[...] #loc1 [...] // lldb-command:next // lldb-command:frame select -// lldb-check:[...]#loc2[...] +// lldb-check:[...] #loc2 [...] // lldb-command:next // lldb-command:frame select -// lldb-check:[...]#loc3[...] +// lldb-check:[...] #loc3 [...] // lldb-command:next // lldb-command:frame select -// lldb-check:[...]#loc4[...] +// lldb-check:[...] #loc4 [...] // lldb-command:next // lldb-command:frame select -// lldb-check:[...]#loc5[...] +// lldb-check:[...] #loc5 [...] // lldb-command:continue // lldb-command:step // lldb-command:frame select -// lldb-check:[...]#inc-loc1[...] +// lldb-check:[...] #inc-loc1 [...] // lldb-command:next // lldb-command:frame select -// lldb-check:[...]#inc-loc2[...] +// lldb-check:[...] #inc-loc2 [...] // lldb-command:next // lldb-command:frame select -// lldb-check:[...]#inc-loc1[...] +// lldb-check:[...] #inc-loc1 [...] // lldb-command:next // lldb-command:frame select -// lldb-check:[...]#inc-loc2[...] +// lldb-check:[...] #inc-loc2 [...] // lldb-command:next // lldb-command:frame select -// lldb-check:[...]#inc-loc3[...] +// lldb-check:[...] #inc-loc3 [...] macro_rules! foo { () => { diff --git a/tests/debuginfo/method-on-enum.rs b/tests/debuginfo/method-on-enum.rs index 454967c6cb71b..f947ba350e7f9 100644 --- a/tests/debuginfo/method-on-enum.rs +++ b/tests/debuginfo/method-on-enum.rs @@ -64,47 +64,47 @@ // STACK BY REF // lldb-command:print *self -// lldb-check:[...]$0 = Variant2(117901063) +// lldb-check:[...] Variant2(117901063) // lldb-command:print arg1 -// lldb-check:[...]$1 = -1 +// lldb-check:[...] -1 // lldb-command:print arg2 -// lldb-check:[...]$2 = -2 +// lldb-check:[...] -2 // lldb-command:continue // STACK BY VAL // lldb-command:print self -// lldb-check:[...]$3 = Variant2(117901063) +// lldb-check:[...] Variant2(117901063) // lldb-command:print arg1 -// lldb-check:[...]$4 = -3 +// lldb-check:[...] -3 // lldb-command:print arg2 -// lldb-check:[...]$5 = -4 +// lldb-check:[...] -4 // lldb-command:continue // OWNED BY REF // lldb-command:print *self -// lldb-check:[...]$6 = Variant1 { x: 1799, y: 1799 } +// lldb-check:[...] Variant1 { x: 1799, y: 1799 } // lldb-command:print arg1 -// lldb-check:[...]$7 = -5 +// lldb-check:[...] -5 // lldb-command:print arg2 -// lldb-check:[...]$8 = -6 +// lldb-check:[...] -6 // lldb-command:continue // OWNED BY VAL // lldb-command:print self -// lldb-check:[...]$9 = Variant1 { x: 1799, y: 1799 } +// lldb-check:[...] Variant1 { x: 1799, y: 1799 } // lldb-command:print arg1 -// lldb-check:[...]$10 = -7 +// lldb-check:[...] -7 // lldb-command:print arg2 -// lldb-check:[...]$11 = -8 +// lldb-check:[...] -8 // lldb-command:continue // OWNED MOVED // lldb-command:print *self -// lldb-check:[...]$12 = Variant1 { x: 1799, y: 1799 } +// lldb-check:[...] Variant1 { x: 1799, y: 1799 } // lldb-command:print arg1 -// lldb-check:[...]$13 = -9 +// lldb-check:[...] -9 // lldb-command:print arg2 -// lldb-check:[...]$14 = -10 +// lldb-check:[...] -10 // lldb-command:continue #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/method-on-generic-struct.rs b/tests/debuginfo/method-on-generic-struct.rs index 562798c27daa8..16793fb9bc658 100644 --- a/tests/debuginfo/method-on-generic-struct.rs +++ b/tests/debuginfo/method-on-generic-struct.rs @@ -65,61 +65,61 @@ // STACK BY REF // lldb-command:print *self -// lldbg-check:[...]$0 = Struct<(u32, i32)> { x: (8888, -8888) } +// lldbg-check:[...] Struct<(u32, i32)> { x: (8888, -8888) } // lldbr-check:(method_on_generic_struct::Struct<(u32, i32)>) *self = { x = { = 8888 = -8888 } } // lldb-command:print arg1 -// lldbg-check:[...]$1 = -1 +// lldbg-check:[...] -1 // lldbr-check:(isize) arg1 = -1 // lldb-command:print arg2 -// lldbg-check:[...]$2 = -2 +// lldbg-check:[...] -2 // lldbr-check:(isize) arg2 = -2 // lldb-command:continue // STACK BY VAL // lldb-command:print self -// lldbg-check:[...]$3 = Struct<(u32, i32)> { x: (8888, -8888) } +// lldbg-check:[...] Struct<(u32, i32)> { x: (8888, -8888) } // lldbr-check:(method_on_generic_struct::Struct<(u32, i32)>) self = { x = { = 8888 = -8888 } } // lldb-command:print arg1 -// lldbg-check:[...]$4 = -3 +// lldbg-check:[...] -3 // lldbr-check:(isize) arg1 = -3 // lldb-command:print arg2 -// lldbg-check:[...]$5 = -4 +// lldbg-check:[...] -4 // lldbr-check:(isize) arg2 = -4 // lldb-command:continue // OWNED BY REF // lldb-command:print *self -// lldbg-check:[...]$6 = Struct { x: 1234.5 } +// lldbg-check:[...] Struct { x: 1234.5 } // lldbr-check:(method_on_generic_struct::Struct) *self = Struct { x: 1234.5 } // lldb-command:print arg1 -// lldbg-check:[...]$7 = -5 +// lldbg-check:[...] -5 // lldbr-check:(isize) arg1 = -5 // lldb-command:print arg2 -// lldbg-check:[...]$8 = -6 +// lldbg-check:[...] -6 // lldbr-check:(isize) arg2 = -6 // lldb-command:continue // OWNED BY VAL // lldb-command:print self -// lldbg-check:[...]$9 = Struct { x: 1234.5 } +// lldbg-check:[...] Struct { x: 1234.5 } // lldbr-check:(method_on_generic_struct::Struct) self = Struct { x: 1234.5 } // lldb-command:print arg1 -// lldbg-check:[...]$10 = -7 +// lldbg-check:[...] -7 // lldbr-check:(isize) arg1 = -7 // lldb-command:print arg2 -// lldbg-check:[...]$11 = -8 +// lldbg-check:[...] -8 // lldbr-check:(isize) arg2 = -8 // lldb-command:continue // OWNED MOVED // lldb-command:print *self -// lldbg-check:[...]$12 = Struct { x: 1234.5 } +// lldbg-check:[...] Struct { x: 1234.5 } // lldbr-check:(method_on_generic_struct::Struct) *self = Struct { x: 1234.5 } // lldb-command:print arg1 -// lldbg-check:[...]$13 = -9 +// lldbg-check:[...] -9 // lldbr-check:(isize) arg1 = -9 // lldb-command:print arg2 -// lldbg-check:[...]$14 = -10 +// lldbg-check:[...] -10 // lldbr-check:(isize) arg2 = -10 // lldb-command:continue diff --git a/tests/debuginfo/method-on-struct.rs b/tests/debuginfo/method-on-struct.rs index bb94ced305d63..56bcb462cb36f 100644 --- a/tests/debuginfo/method-on-struct.rs +++ b/tests/debuginfo/method-on-struct.rs @@ -63,61 +63,61 @@ // STACK BY REF // lldb-command:print *self -// lldbg-check:[...]$0 = { x = 100 } +// lldbg-check:[...] { x = 100 } // lldbr-check:(method_on_struct::Struct) *self = Struct { x: 100 } // lldb-command:print arg1 -// lldbg-check:[...]$1 = -1 +// lldbg-check:[...] -1 // lldbr-check:(isize) arg1 = -1 // lldb-command:print arg2 -// lldbg-check:[...]$2 = -2 +// lldbg-check:[...] -2 // lldbr-check:(isize) arg2 = -2 // lldb-command:continue // STACK BY VAL // lldb-command:print self -// lldbg-check:[...]$3 = { x = 100 } +// lldbg-check:[...] { x = 100 } // lldbr-check:(method_on_struct::Struct) self = Struct { x: 100 } // lldb-command:print arg1 -// lldbg-check:[...]$4 = -3 +// lldbg-check:[...] -3 // lldbr-check:(isize) arg1 = -3 // lldb-command:print arg2 -// lldbg-check:[...]$5 = -4 +// lldbg-check:[...] -4 // lldbr-check:(isize) arg2 = -4 // lldb-command:continue // OWNED BY REF // lldb-command:print *self -// lldbg-check:[...]$6 = { x = 200 } +// lldbg-check:[...] { x = 200 } // lldbr-check:(method_on_struct::Struct) *self = Struct { x: 200 } // lldb-command:print arg1 -// lldbg-check:[...]$7 = -5 +// lldbg-check:[...] -5 // lldbr-check:(isize) arg1 = -5 // lldb-command:print arg2 -// lldbg-check:[...]$8 = -6 +// lldbg-check:[...] -6 // lldbr-check:(isize) arg2 = -6 // lldb-command:continue // OWNED BY VAL // lldb-command:print self -// lldbg-check:[...]$9 = { x = 200 } +// lldbg-check:[...] { x = 200 } // lldbr-check:(method_on_struct::Struct) self = Struct { x: 200 } // lldb-command:print arg1 -// lldbg-check:[...]$10 = -7 +// lldbg-check:[...] -7 // lldbr-check:(isize) arg1 = -7 // lldb-command:print arg2 -// lldbg-check:[...]$11 = -8 +// lldbg-check:[...] -8 // lldbr-check:(isize) arg2 = -8 // lldb-command:continue // OWNED MOVED // lldb-command:print *self -// lldbg-check:[...]$12 = { x = 200 } +// lldbg-check:[...] { x = 200 } // lldbr-check:(method_on_struct::Struct) *self = Struct { x: 200 } // lldb-command:print arg1 -// lldbg-check:[...]$13 = -9 +// lldbg-check:[...] -9 // lldbr-check:(isize) arg1 = -9 // lldb-command:print arg2 -// lldbg-check:[...]$14 = -10 +// lldbg-check:[...] -10 // lldbr-check:(isize) arg2 = -10 // lldb-command:continue diff --git a/tests/debuginfo/method-on-trait.rs b/tests/debuginfo/method-on-trait.rs index bc8def40105c7..0264ff68d1b02 100644 --- a/tests/debuginfo/method-on-trait.rs +++ b/tests/debuginfo/method-on-trait.rs @@ -63,61 +63,61 @@ // STACK BY REF // lldb-command:print *self -// lldbg-check:[...]$0 = { x = 100 } +// lldbg-check:[...] { x = 100 } // lldbr-check:(method_on_trait::Struct) *self = { x = 100 } // lldb-command:print arg1 -// lldbg-check:[...]$1 = -1 +// lldbg-check:[...] -1 // lldbr-check:(isize) arg1 = -1 // lldb-command:print arg2 -// lldbg-check:[...]$2 = -2 +// lldbg-check:[...] -2 // lldbr-check:(isize) arg2 = -2 // lldb-command:continue // STACK BY VAL // lldb-command:print self -// lldbg-check:[...]$3 = { x = 100 } +// lldbg-check:[...] { x = 100 } // lldbr-check:(method_on_trait::Struct) self = { x = 100 } // lldb-command:print arg1 -// lldbg-check:[...]$4 = -3 +// lldbg-check:[...] -3 // lldbr-check:(isize) arg1 = -3 // lldb-command:print arg2 -// lldbg-check:[...]$5 = -4 +// lldbg-check:[...] -4 // lldbr-check:(isize) arg2 = -4 // lldb-command:continue // OWNED BY REF // lldb-command:print *self -// lldbg-check:[...]$6 = { x = 200 } +// lldbg-check:[...] { x = 200 } // lldbr-check:(method_on_trait::Struct) *self = { x = 200 } // lldb-command:print arg1 -// lldbg-check:[...]$7 = -5 +// lldbg-check:[...] -5 // lldbr-check:(isize) arg1 = -5 // lldb-command:print arg2 -// lldbg-check:[...]$8 = -6 +// lldbg-check:[...] -6 // lldbr-check:(isize) arg2 = -6 // lldb-command:continue // OWNED BY VAL // lldb-command:print self -// lldbg-check:[...]$9 = { x = 200 } +// lldbg-check:[...] { x = 200 } // lldbr-check:(method_on_trait::Struct) self = { x = 200 } // lldb-command:print arg1 -// lldbg-check:[...]$10 = -7 +// lldbg-check:[...] -7 // lldbr-check:(isize) arg1 = -7 // lldb-command:print arg2 -// lldbg-check:[...]$11 = -8 +// lldbg-check:[...] -8 // lldbr-check:(isize) arg2 = -8 // lldb-command:continue // OWNED MOVED // lldb-command:print *self -// lldbg-check:[...]$12 = { x = 200 } +// lldbg-check:[...] { x = 200 } // lldbr-check:(method_on_trait::Struct) *self = { x = 200 } // lldb-command:print arg1 -// lldbg-check:[...]$13 = -9 +// lldbg-check:[...] -9 // lldbr-check:(isize) arg1 = -9 // lldb-command:print arg2 -// lldbg-check:[...]$14 = -10 +// lldbg-check:[...] -10 // lldbr-check:(isize) arg2 = -10 // lldb-command:continue diff --git a/tests/debuginfo/method-on-tuple-struct.rs b/tests/debuginfo/method-on-tuple-struct.rs index 7ac0a2d857483..872f6ea57c213 100644 --- a/tests/debuginfo/method-on-tuple-struct.rs +++ b/tests/debuginfo/method-on-tuple-struct.rs @@ -63,61 +63,61 @@ // STACK BY REF // lldb-command:print *self -// lldbg-check:[...]$0 = { 0 = 100 1 = -100.5 } +// lldbg-check:[...] { 0 = 100 1 = -100.5 } // lldbr-check:(method_on_tuple_struct::TupleStruct) *self = { 0 = 100 1 = -100.5 } // lldb-command:print arg1 -// lldbg-check:[...]$1 = -1 +// lldbg-check:[...] -1 // lldbr-check:(isize) arg1 = -1 // lldb-command:print arg2 -// lldbg-check:[...]$2 = -2 +// lldbg-check:[...] -2 // lldbr-check:(isize) arg2 = -2 // lldb-command:continue // STACK BY VAL // lldb-command:print self -// lldbg-check:[...]$3 = { 0 = 100 1 = -100.5 } +// lldbg-check:[...] { 0 = 100 1 = -100.5 } // lldbr-check:(method_on_tuple_struct::TupleStruct) self = { 0 = 100 1 = -100.5 } // lldb-command:print arg1 -// lldbg-check:[...]$4 = -3 +// lldbg-check:[...] -3 // lldbr-check:(isize) arg1 = -3 // lldb-command:print arg2 -// lldbg-check:[...]$5 = -4 +// lldbg-check:[...] -4 // lldbr-check:(isize) arg2 = -4 // lldb-command:continue // OWNED BY REF // lldb-command:print *self -// lldbg-check:[...]$6 = { 0 = 200 1 = -200.5 } +// lldbg-check:[...] { 0 = 200 1 = -200.5 } // lldbr-check:(method_on_tuple_struct::TupleStruct) *self = { 0 = 200 1 = -200.5 } // lldb-command:print arg1 -// lldbg-check:[...]$7 = -5 +// lldbg-check:[...] -5 // lldbr-check:(isize) arg1 = -5 // lldb-command:print arg2 -// lldbg-check:[...]$8 = -6 +// lldbg-check:[...] -6 // lldbr-check:(isize) arg2 = -6 // lldb-command:continue // OWNED BY VAL // lldb-command:print self -// lldbg-check:[...]$9 = { 0 = 200 1 = -200.5 } +// lldbg-check:[...] { 0 = 200 1 = -200.5 } // lldbr-check:(method_on_tuple_struct::TupleStruct) self = { 0 = 200 1 = -200.5 } // lldb-command:print arg1 -// lldbg-check:[...]$10 = -7 +// lldbg-check:[...] -7 // lldbr-check:(isize) arg1 = -7 // lldb-command:print arg2 -// lldbg-check:[...]$11 = -8 +// lldbg-check:[...] -8 // lldbr-check:(isize) arg2 = -8 // lldb-command:continue // OWNED MOVED // lldb-command:print *self -// lldbg-check:[...]$12 = { 0 = 200 1 = -200.5 } +// lldbg-check:[...] { 0 = 200 1 = -200.5 } // lldbr-check:(method_on_tuple_struct::TupleStruct) *self = { 0 = 200 1 = -200.5 } // lldb-command:print arg1 -// lldbg-check:[...]$13 = -9 +// lldbg-check:[...] -9 // lldbr-check:(isize) arg1 = -9 // lldb-command:print arg2 -// lldbg-check:[...]$14 = -10 +// lldbg-check:[...] -10 // lldbr-check:(isize) arg2 = -10 // lldb-command:continue diff --git a/tests/debuginfo/multi-cgu.rs b/tests/debuginfo/multi-cgu.rs index b2ad1d3cd95c5..42aa25c14212f 100644 --- a/tests/debuginfo/multi-cgu.rs +++ b/tests/debuginfo/multi-cgu.rs @@ -24,12 +24,12 @@ // lldb-command:run // lldb-command:print xxx -// lldbg-check:[...]$0 = 12345 +// lldbg-check:[...] 12345 // lldbr-check:(u32) xxx = 12345 // lldb-command:continue // lldb-command:print yyy -// lldbg-check:[...]$1 = 67890 +// lldbg-check:[...] 67890 // lldbr-check:(u64) yyy = 67890 // lldb-command:continue diff --git a/tests/debuginfo/multiple-functions-equal-var-names.rs b/tests/debuginfo/multiple-functions-equal-var-names.rs index 08446997b424e..113eac29256bd 100644 --- a/tests/debuginfo/multiple-functions-equal-var-names.rs +++ b/tests/debuginfo/multiple-functions-equal-var-names.rs @@ -23,17 +23,17 @@ // lldb-command:run // lldb-command:print abc -// lldbg-check:[...]$0 = 10101 +// lldbg-check:[...] 10101 // lldbr-check:(i32) abc = 10101 // lldb-command:continue // lldb-command:print abc -// lldbg-check:[...]$1 = 20202 +// lldbg-check:[...] 20202 // lldbr-check:(i32) abc = 20202 // lldb-command:continue // lldb-command:print abc -// lldbg-check:[...]$2 = 30303 +// lldbg-check:[...] 30303 // lldbr-check:(i32) abc = 30303 #![allow(unused_variables)] diff --git a/tests/debuginfo/multiple-functions.rs b/tests/debuginfo/multiple-functions.rs index 2c4092fd5a33c..81fdc4f3d4033 100644 --- a/tests/debuginfo/multiple-functions.rs +++ b/tests/debuginfo/multiple-functions.rs @@ -23,17 +23,17 @@ // lldb-command:run // lldb-command:print a -// lldbg-check:[...]$0 = 10101 +// lldbg-check:[...] 10101 // lldbr-check:(i32) a = 10101 // lldb-command:continue // lldb-command:print b -// lldbg-check:[...]$1 = 20202 +// lldbg-check:[...] 20202 // lldbr-check:(i32) b = 20202 // lldb-command:continue // lldb-command:print c -// lldbg-check:[...]$2 = 30303 +// lldbg-check:[...] 30303 // lldbr-check:(i32) c = 30303 #![allow(unused_variables)] diff --git a/tests/debuginfo/name-shadowing-and-scope-nesting.rs b/tests/debuginfo/name-shadowing-and-scope-nesting.rs index e8860b2d1048e..42df966681062 100644 --- a/tests/debuginfo/name-shadowing-and-scope-nesting.rs +++ b/tests/debuginfo/name-shadowing-and-scope-nesting.rs @@ -48,50 +48,50 @@ // lldb-command:run // lldb-command:print x -// lldbg-check:[...]$0 = false +// lldbg-check:[...] false // lldbr-check:(bool) x = false // lldb-command:print y -// lldbg-check:[...]$1 = true +// lldbg-check:[...] true // lldbr-check:(bool) y = true // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$2 = 10 +// lldbg-check:[...] 10 // lldbr-check:(i32) x = 10 // lldb-command:print y -// lldbg-check:[...]$3 = true +// lldbg-check:[...] true // lldbr-check:(bool) y = true // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$4 = 10.5 +// lldbg-check:[...] 10.5 // lldbr-check:(f64) x = 10.5 // lldb-command:print y -// lldbg-check:[...]$5 = 20 +// lldbg-check:[...] 20 // lldbr-check:(i32) y = 20 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$6 = true +// lldbg-check:[...] true // lldbr-check:(bool) x = true // lldb-command:print y -// lldbg-check:[...]$7 = 2220 +// lldbg-check:[...] 2220 // lldbr-check:(i32) y = 2220 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$8 = 203203.5 +// lldbg-check:[...] 203203.5 // lldbr-check:(f64) x = 203203.5 // lldb-command:print y -// lldbg-check:[...]$9 = 2220 +// lldbg-check:[...] 2220 // lldbr-check:(i32) y = 2220 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$10 = 10.5 +// lldbg-check:[...] 10.5 // lldbr-check:(f64) x = 10.5 // lldb-command:print y -// lldbg-check:[...]$11 = 20 +// lldbg-check:[...] 20 // lldbr-check:(i32) y = 20 // lldb-command:continue diff --git a/tests/debuginfo/no_mangle-info.rs b/tests/debuginfo/no_mangle-info.rs index 15629d217ba76..9cb42656f2a44 100644 --- a/tests/debuginfo/no_mangle-info.rs +++ b/tests/debuginfo/no_mangle-info.rs @@ -11,9 +11,9 @@ // === LLDB TESTS ================================================================================== // lldb-command:run // lldb-command:p TEST -// lldb-check: (unsigned long) $0 = 3735928559 +// lldb-check: (unsigned long) 3735928559 // lldb-command:p OTHER_TEST -// lldb-check: (unsigned long) $1 = 42 +// lldb-check: (unsigned long) 42 // === CDB TESTS ================================================================================== // cdb-command: g diff --git a/tests/debuginfo/numeric-types.rs b/tests/debuginfo/numeric-types.rs index 74c9e5e1dc3f3..615f365173f53 100644 --- a/tests/debuginfo/numeric-types.rs +++ b/tests/debuginfo/numeric-types.rs @@ -203,40 +203,40 @@ // lldb-command:run // lldb-command:print/d nz_i8 -// lldb-check:[...]$0 = 11 { __0 = 11 } +// lldb-check:[...] 11 { __0 = { 0 = 11 } } // lldb-command:print nz_i16 -// lldb-check:[...]$1 = 22 { __0 = 22 } +// lldb-check:[...] 22 { __0 = { 0 = 22 } } // lldb-command:print nz_i32 -// lldb-check:[...]$2 = 33 { __0 = 33 } +// lldb-check:[...] 33 { __0 = { 0 = 33 } } // lldb-command:print nz_i64 -// lldb-check:[...]$3 = 44 { __0 = 44 } +// lldb-check:[...] 44 { __0 = { 0 = 44 } } // lldb-command:print nz_i128 -// lldb-check:[...]$4 = 55 { __0 = 55 } +// lldb-check:[...] 55 { __0 = { 0 = 55 } } // lldb-command:print nz_isize -// lldb-check:[...]$5 = 66 { __0 = 66 } +// lldb-check:[...] 66 { __0 = { 0 = 66 } } // lldb-command:print/d nz_u8 -// lldb-check:[...]$6 = 77 { __0 = 77 } +// lldb-check:[...] 77 { __0 = { 0 = 77 } } // lldb-command:print nz_u16 -// lldb-check:[...]$7 = 88 { __0 = 88 } +// lldb-check:[...] 88 { __0 = { 0 = 88 } } // lldb-command:print nz_u32 -// lldb-check:[...]$8 = 99 { __0 = 99 } +// lldb-check:[...] 99 { __0 = { 0 = 99 } } // lldb-command:print nz_u64 -// lldb-check:[...]$9 = 100 { __0 = 100 } +// lldb-check:[...] 100 { __0 = { 0 = 100 } } // lldb-command:print nz_u128 -// lldb-check:[...]$10 = 111 { __0 = 111 } +// lldb-check:[...] 111 { __0 = { 0 = 111 } } // lldb-command:print nz_usize -// lldb-check:[...]$11 = 122 { __0 = 122 } +// lldb-check:[...] 122 { __0 = { 0 = 122 } } #![feature(generic_nonzero)] use std::num::*; diff --git a/tests/debuginfo/option-like-enum.rs b/tests/debuginfo/option-like-enum.rs index b2a8aa1c29a0d..03646c99f6484 100644 --- a/tests/debuginfo/option-like-enum.rs +++ b/tests/debuginfo/option-like-enum.rs @@ -48,34 +48,34 @@ // lldb-command:run // lldb-command:print some -// lldb-check:[...]$0 = Some(&0x12345678) +// lldb-check:[...] Some(&0x12345678) // lldb-command:print none -// lldb-check:[...]$1 = None +// lldb-check:[...] None // lldb-command:print full -// lldb-check:[...]$2 = Full(454545, &0x87654321, 9988) +// lldb-check:[...] Full(454545, &0x87654321, 9988) // lldb-command:print empty -// lldb-check:[...]$3 = Empty +// lldb-check:[...] Empty // lldb-command:print droid -// lldb-check:[...]$4 = Droid { id: 675675, range: 10000001, internals: &0x43218765 } +// lldb-check:[...] Droid { id: 675675, range: 10000001, internals: &0x43218765 } // lldb-command:print void_droid -// lldb-check:[...]$5 = Void +// lldb-check:[...] Void // lldb-command:print some_str -// lldb-check:[...]$6 = Some("abc") +// lldb-check:[...] Some("abc") // lldb-command:print none_str -// lldb-check:[...]$7 = None +// lldb-check:[...] None // lldb-command:print nested_non_zero_yep -// lldb-check:[...]$8 = Yep(10.5, NestedNonZeroField { a: 10, b: 20, c: &[...] }) +// lldb-check:[...] Yep(10.5, NestedNonZeroField { a: 10, b: 20, c: &[...] }) // lldb-command:print nested_non_zero_nope -// lldb-check:[...]$9 = Nope +// lldb-check:[...] Nope #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/packed-struct-with-destructor.rs b/tests/debuginfo/packed-struct-with-destructor.rs index 19788339efa9a..b1f237db81489 100644 --- a/tests/debuginfo/packed-struct-with-destructor.rs +++ b/tests/debuginfo/packed-struct-with-destructor.rs @@ -45,35 +45,35 @@ // lldb-command:run // lldb-command:print packed -// lldbg-check:[...]$0 = { x = 123 y = 234 z = 345 } +// lldbg-check:[...] { x = 123 y = 234 z = 345 } // lldbr-check:(packed_struct_with_destructor::Packed) packed = { x = 123 y = 234 z = 345 } // lldb-command:print packedInPacked -// lldbg-check:[...]$1 = { a = 1111 b = { x = 2222 y = 3333 z = 4444 } c = 5555 d = { x = 6666 y = 7777 z = 8888 } } +// lldbg-check:[...] { a = 1111 b = { x = 2222 y = 3333 z = 4444 } c = 5555 d = { x = 6666 y = 7777 z = 8888 } } // lldbr-check:(packed_struct_with_destructor::PackedInPacked) packedInPacked = { a = 1111 b = { x = 2222 y = 3333 z = 4444 } c = 5555 d = { x = 6666 y = 7777 z = 8888 } } // lldb-command:print packedInUnpacked -// lldbg-check:[...]$2 = { a = -1111 b = { x = -2222 y = -3333 z = -4444 } c = -5555 d = { x = -6666 y = -7777 z = -8888 } } +// lldbg-check:[...] { a = -1111 b = { x = -2222 y = -3333 z = -4444 } c = -5555 d = { x = -6666 y = -7777 z = -8888 } } // lldbr-check:(packed_struct_with_destructor::PackedInUnpacked) packedInUnpacked = { a = -1111 b = { x = -2222 y = -3333 z = -4444 } c = -5555 d = { x = -6666 y = -7777 z = -8888 } } // lldb-command:print unpackedInPacked -// lldbg-check:[...]$3 = { a = 987 b = { x = 876 y = 765 z = 654 } c = { x = 543 y = 432 z = 321 } d = 210 } +// lldbg-check:[...] { a = 987 b = { x = 876 y = 765 z = 654 } c = { x = 543 y = 432 z = 321 } d = 210 } // lldbr-check:(packed_struct_with_destructor::UnpackedInPacked) unpackedInPacked = { a = 987 b = { x = 876 y = 765 z = 654 } c = { x = 543 y = 432 z = 321 } d = 210 } // lldb-command:print packedInPackedWithDrop -// lldbg-check:[...]$4 = { a = 11 b = { x = 22 y = 33 z = 44 } c = 55 d = { x = 66 y = 77 z = 88 } } +// lldbg-check:[...] { a = 11 b = { x = 22 y = 33 z = 44 } c = 55 d = { x = 66 y = 77 z = 88 } } // lldbr-check:(packed_struct_with_destructor::PackedInPackedWithDrop) packedInPackedWithDrop = { a = 11 b = { x = 22 y = 33 z = 44 } c = 55 d = { x = 66 y = 77 z = 88 } } // lldb-command:print packedInUnpackedWithDrop -// lldbg-check:[...]$5 = { a = -11 b = { x = -22 y = -33 z = -44 } c = -55 d = { x = -66 y = -77 z = -88 } } +// lldbg-check:[...] { a = -11 b = { x = -22 y = -33 z = -44 } c = -55 d = { x = -66 y = -77 z = -88 } } // lldbr-check:(packed_struct_with_destructor::PackedInUnpackedWithDrop) packedInUnpackedWithDrop = { a = -11 b = { x = -22 y = -33 z = -44 } c = -55 d = { x = -66 y = -77 z = -88 } } // lldb-command:print unpackedInPackedWithDrop -// lldbg-check:[...]$6 = { a = 98 b = { x = 87 y = 76 z = 65 } c = { x = 54 y = 43 z = 32 } d = 21 } +// lldbg-check:[...] { a = 98 b = { x = 87 y = 76 z = 65 } c = { x = 54 y = 43 z = 32 } d = 21 } // lldbr-check:(packed_struct_with_destructor::UnpackedInPackedWithDrop) unpackedInPackedWithDrop = { a = 98 b = { x = 87 y = 76 z = 65 } c = { x = 54 y = 43 z = 32 } d = 21 } // lldb-command:print deeplyNested -// lldbg-check:[...]$7 = { a = { a = 1 b = { x = 2 y = 3 z = 4 } c = 5 d = { x = 6 y = 7 z = 8 } } b = { a = 9 b = { x = 10 y = 11 z = 12 } c = { x = 13 y = 14 z = 15 } d = 16 } c = { a = 17 b = { x = 18 y = 19 z = 20 } c = 21 d = { x = 22 y = 23 z = 24 } } d = { a = 25 b = { x = 26 y = 27 z = 28 } c = 29 d = { x = 30 y = 31 z = 32 } } e = { a = 33 b = { x = 34 y = 35 z = 36 } c = { x = 37 y = 38 z = 39 } d = 40 } f = { a = 41 b = { x = 42 y = 43 z = 44 } c = 45 d = { x = 46 y = 47 z = 48 } } } +// lldbg-check:[...] { a = { a = 1 b = { x = 2 y = 3 z = 4 } c = 5 d = { x = 6 y = 7 z = 8 } } b = { a = 9 b = { x = 10 y = 11 z = 12 } c = { x = 13 y = 14 z = 15 } d = 16 } c = { a = 17 b = { x = 18 y = 19 z = 20 } c = 21 d = { x = 22 y = 23 z = 24 } } d = { a = 25 b = { x = 26 y = 27 z = 28 } c = 29 d = { x = 30 y = 31 z = 32 } } e = { a = 33 b = { x = 34 y = 35 z = 36 } c = { x = 37 y = 38 z = 39 } d = 40 } f = { a = 41 b = { x = 42 y = 43 z = 44 } c = 45 d = { x = 46 y = 47 z = 48 } } } // lldbr-check:(packed_struct_with_destructor::DeeplyNested) deeplyNested = { a = { a = 1 b = { x = 2 y = 3 z = 4 } c = 5 d = { x = 6 y = 7 z = 8 } } b = { a = 9 b = { x = 10 y = 11 z = 12 } c = { x = 13 y = 14 z = 15 } d = 16 } c = { a = 17 b = { x = 18 y = 19 z = 20 } c = 21 d = { x = 22 y = 23 z = 24 } } d = { a = 25 b = { x = 26 y = 27 z = 28 } c = 29 d = { x = 30 y = 31 z = 32 } } e = { a = 33 b = { x = 34 y = 35 z = 36 } c = { x = 37 y = 38 z = 39 } d = 40 } f = { a = 41 b = { x = 42 y = 43 z = 44 } c = 45 d = { x = 46 y = 47 z = 48 } } } diff --git a/tests/debuginfo/packed-struct.rs b/tests/debuginfo/packed-struct.rs index 0276a0ffb082a..b61da04124361 100644 --- a/tests/debuginfo/packed-struct.rs +++ b/tests/debuginfo/packed-struct.rs @@ -35,27 +35,27 @@ // lldb-command:run // lldb-command:print packed -// lldbg-check:[...]$0 = { x = 123 y = 234 z = 345 } +// lldbg-check:[...] { x = 123 y = 234 z = 345 } // lldbr-check:(packed_struct::Packed) packed = { x = 123 y = 234 z = 345 } // lldb-command:print packedInPacked -// lldbg-check:[...]$1 = { a = 1111 b = { x = 2222 y = 3333 z = 4444 } c = 5555 d = { x = 6666 y = 7777 z = 8888 } } +// lldbg-check:[...] { a = 1111 b = { x = 2222 y = 3333 z = 4444 } c = 5555 d = { x = 6666 y = 7777 z = 8888 } } // lldbr-check:(packed_struct::PackedInPacked) packedInPacked = { a = 1111 b = { x = 2222 y = 3333 z = 4444 } c = 5555 d = { x = 6666 y = 7777 z = 8888 } } // lldb-command:print packedInUnpacked -// lldbg-check:[...]$2 = { a = -1111 b = { x = -2222 y = -3333 z = -4444 } c = -5555 d = { x = -6666 y = -7777 z = -8888 } } +// lldbg-check:[...] { a = -1111 b = { x = -2222 y = -3333 z = -4444 } c = -5555 d = { x = -6666 y = -7777 z = -8888 } } // lldbr-check:(packed_struct::PackedInUnpacked) packedInUnpacked = { a = -1111 b = { x = -2222 y = -3333 z = -4444 } c = -5555 d = { x = -6666 y = -7777 z = -8888 } } // lldb-command:print unpackedInPacked -// lldbg-check:[...]$3 = { a = 987 b = { x = 876 y = 765 z = 654 w = 543 } c = { x = 432 y = 321 z = 210 w = 109 } d = -98 } +// lldbg-check:[...] { a = 987 b = { x = 876 y = 765 z = 654 w = 543 } c = { x = 432 y = 321 z = 210 w = 109 } d = -98 } // lldbr-check:(packed_struct::UnpackedInPacked) unpackedInPacked = { a = 987 b = { x = 876 y = 765 z = 654 w = 543 } c = { x = 432 y = 321 z = 210 w = 109 } d = -98 } // lldb-command:print sizeof(packed) -// lldbg-check:[...]$4 = 14 +// lldbg-check:[...] 14 // lldbr-check:(usize) = 14 // lldb-command:print sizeof(packedInPacked) -// lldbg-check:[...]$5 = 40 +// lldbg-check:[...] 40 // lldbr-check:(usize) = 40 #![allow(unused_variables)] diff --git a/tests/debuginfo/pretty-slices.rs b/tests/debuginfo/pretty-slices.rs index 4faa317d6a19a..4507453a10704 100644 --- a/tests/debuginfo/pretty-slices.rs +++ b/tests/debuginfo/pretty-slices.rs @@ -21,16 +21,16 @@ // lldb-command: run // lldb-command: print slice -// lldb-check: (&[i32]) $0 = size=3 { [0] = 0 [1] = 1 [2] = 2 } +// lldb-check: (&[i32]) size=3 { [0] = 0 [1] = 1 [2] = 2 } // lldb-command: print mut_slice -// lldb-check: (&mut [i32]) $1 = size=4 { [0] = 2 [1] = 3 [2] = 5 [3] = 7 } +// lldb-check: (&mut [i32]) size=4 { [0] = 2 [1] = 3 [2] = 5 [3] = 7 } // lldb-command: print str_slice -// lldb-check: (&str) $2 = "string slice" { data_ptr = [...] length = 12 } +// lldb-check: (&str) "string slice" { data_ptr = [...] length = 12 } // lldb-command: print mut_str_slice -// lldb-check: (&mut str) $3 = "mutable string slice" { data_ptr = [...] length = 20 } +// lldb-check: (&mut str) "mutable string slice" { data_ptr = [...] length = 20 } fn b() {} diff --git a/tests/debuginfo/pretty-std-collections.rs b/tests/debuginfo/pretty-std-collections.rs index 6e7c8dfbbe826..903a9f9a27278 100644 --- a/tests/debuginfo/pretty-std-collections.rs +++ b/tests/debuginfo/pretty-std-collections.rs @@ -59,19 +59,19 @@ // lldb-command:run // lldb-command:print vec_deque -// lldbg-check:[...]$0 = size=3 { [0] = 5 [1] = 3 [2] = 7 } +// lldbg-check:[...] size=3 { [0] = 5 [1] = 3 [2] = 7 } // lldbr-check:(alloc::collections::vec_deque::VecDeque) vec_deque = size=3 = { [0] = 5 [1] = 3 [2] = 7 } // lldb-command:print vec_deque2 -// lldbg-check:[...]$1 = size=7 { [0] = 2 [1] = 3 [2] = 4 [3] = 5 [4] = 6 [5] = 7 [6] = 8 } +// lldbg-check:[...] size=7 { [0] = 2 [1] = 3 [2] = 4 [3] = 5 [4] = 6 [5] = 7 [6] = 8 } // lldbr-check:(alloc::collections::vec_deque::VecDeque) vec_deque2 = size=7 = { [0] = 2 [1] = 3 [2] = 4 [3] = 5 [4] = 6 [5] = 7 [6] = 8 } // lldb-command:print hash_map -// lldbg-check:[...]$2 = size=4 { [0] = { 0 = 1 1 = 10 } [1] = { 0 = 2 1 = 20 } [2] = { 0 = 3 1 = 30 } [3] = { 0 = 4 1 = 40 } } +// lldbg-check:[...] size=4 { [0] = { 0 = 1 1 = 10 } [1] = { 0 = 2 1 = 20 } [2] = { 0 = 3 1 = 30 } [3] = { 0 = 4 1 = 40 } } // lldbr-check:(std::collections::hash::map::HashMap) hash_map = size=4 size=4 { [0] = { 0 = 1 1 = 10 } [1] = { 0 = 2 1 = 20 } [2] = { 0 = 3 1 = 30 } [3] = { 0 = 4 1 = 40 } } // lldb-command:print hash_set -// lldbg-check:[...]$3 = size=4 { [0] = 1 [1] = 2 [2] = 3 [3] = 4 } +// lldbg-check:[...] size=4 { [0] = 1 [1] = 2 [2] = 3 [3] = 4 } // lldbr-check:(std::collections::hash::set::HashSet) hash_set = size=4 { [0] = 1 [1] = 2 [2] = 3 [3] = 4 } #![allow(unused_variables)] diff --git a/tests/debuginfo/pretty-std.rs b/tests/debuginfo/pretty-std.rs index 2c2795379c937..74eba9af78614 100644 --- a/tests/debuginfo/pretty-std.rs +++ b/tests/debuginfo/pretty-std.rs @@ -45,25 +45,25 @@ // lldb-command: run // lldb-command: print slice -// lldb-check:[...]$0 = &[0, 1, 2, 3] +// lldb-check:[...] &[0, 1, 2, 3] // lldb-command: print vec -// lldb-check:[...]$1 = vec![4, 5, 6, 7] +// lldb-check:[...] vec![4, 5, 6, 7] // lldb-command: print str_slice -// lldb-check:[...]$2 = "IAMA string slice!" +// lldb-check:[...] "IAMA string slice!" // lldb-command: print string -// lldb-check:[...]$3 = "IAMA string!" +// lldb-check:[...] "IAMA string!" // lldb-command: print some -// lldb-check:[...]$4 = Some(8) +// lldb-check:[...] Some(8) // lldb-command: print none -// lldb-check:[...]$5 = None +// lldb-check:[...] None // lldb-command: print os_string -// lldb-check:[...]$6 = "IAMA OS string 😃"[...] +// lldb-check:[...] "IAMA OS string 😃"[...] // === CDB TESTS ================================================================================== diff --git a/tests/debuginfo/rc_arc.rs b/tests/debuginfo/rc_arc.rs index 3cf6635a173b7..e340fe85e1d81 100644 --- a/tests/debuginfo/rc_arc.rs +++ b/tests/debuginfo/rc_arc.rs @@ -18,9 +18,9 @@ // lldb-command:run // lldb-command:print rc -// lldb-check:[...]$0 = strong=11, weak=1 { value = 111 } +// lldb-check:[...] strong=11, weak=1 { value = 111 } // lldb-command:print arc -// lldb-check:[...]$1 = strong=21, weak=1 { data = 222 } +// lldb-check:[...] strong=21, weak=1 { data = 222 } // === CDB TESTS ================================================================================== diff --git a/tests/debuginfo/reference-debuginfo.rs b/tests/debuginfo/reference-debuginfo.rs index 1051cc7113c46..b1a6aef50cb9d 100644 --- a/tests/debuginfo/reference-debuginfo.rs +++ b/tests/debuginfo/reference-debuginfo.rs @@ -60,11 +60,11 @@ // lldb-command:run // lldb-command:print *bool_ref -// lldbg-check:[...]$0 = true +// lldbg-check:[...] true // lldbr-check:(bool) *bool_ref = true // lldb-command:print *int_ref -// lldbg-check:[...]$1 = -1 +// lldbg-check:[...] -1 // lldbr-check:(isize) *int_ref = -1 // NOTE: only rust-enabled lldb supports 32bit chars @@ -72,51 +72,51 @@ // lldbr-check:(char) *char_ref = 'a' // lldb-command:print *i8_ref -// lldbg-check:[...]$2 = 'D' +// lldbg-check:[...] 'D' // lldbr-check:(i8) *i8_ref = 68 // lldb-command:print *i16_ref -// lldbg-check:[...]$3 = -16 +// lldbg-check:[...] -16 // lldbr-check:(i16) *i16_ref = -16 // lldb-command:print *i32_ref -// lldbg-check:[...]$4 = -32 +// lldbg-check:[...] -32 // lldbr-check:(i32) *i32_ref = -32 // lldb-command:print *i64_ref -// lldbg-check:[...]$5 = -64 +// lldbg-check:[...] -64 // lldbr-check:(i64) *i64_ref = -64 // lldb-command:print *uint_ref -// lldbg-check:[...]$6 = 1 +// lldbg-check:[...] 1 // lldbr-check:(usize) *uint_ref = 1 // lldb-command:print *u8_ref -// lldbg-check:[...]$7 = 'd' +// lldbg-check:[...] 'd' // lldbr-check:(u8) *u8_ref = 100 // lldb-command:print *u16_ref -// lldbg-check:[...]$8 = 16 +// lldbg-check:[...] 16 // lldbr-check:(u16) *u16_ref = 16 // lldb-command:print *u32_ref -// lldbg-check:[...]$9 = 32 +// lldbg-check:[...] 32 // lldbr-check:(u32) *u32_ref = 32 // lldb-command:print *u64_ref -// lldbg-check:[...]$10 = 64 +// lldbg-check:[...] 64 // lldbr-check:(u64) *u64_ref = 64 // lldb-command:print *f32_ref -// lldbg-check:[...]$11 = 2.5 +// lldbg-check:[...] 2.5 // lldbr-check:(f32) *f32_ref = 2.5 // lldb-command:print *f64_ref -// lldbg-check:[...]$12 = 3.5 +// lldbg-check:[...] 3.5 // lldbr-check:(f64) *f64_ref = 3.5 // lldb-command:print *f64_double_ref -// lldbg-check:[...]$13 = 3.5 +// lldbg-check:[...] 3.5 // lldbr-check:(f64) **f64_double_ref = 3.5 #![allow(unused_variables)] diff --git a/tests/debuginfo/regression-bad-location-list-67992.rs b/tests/debuginfo/regression-bad-location-list-67992.rs index c397b403026d6..df1e9fb26fcea 100644 --- a/tests/debuginfo/regression-bad-location-list-67992.rs +++ b/tests/debuginfo/regression-bad-location-list-67992.rs @@ -11,7 +11,7 @@ // lldb-command:run // lldb-command:print a -// lldbg-check:(regression_bad_location_list_67992::Foo) $0 = [...] +// lldbg-check:(regression_bad_location_list_67992::Foo) [...] // lldbr-check:(regression_bad_location_list_67992::Foo) a = [...] const ARRAY_SIZE: usize = 1024; diff --git a/tests/debuginfo/self-in-default-method.rs b/tests/debuginfo/self-in-default-method.rs index eae1d58c12447..9a4ecee4bf6d3 100644 --- a/tests/debuginfo/self-in-default-method.rs +++ b/tests/debuginfo/self-in-default-method.rs @@ -63,61 +63,61 @@ // STACK BY REF // lldb-command:print *self -// lldbg-check:[...]$0 = { x = 100 } +// lldbg-check:[...] { x = 100 } // lldbr-check:(self_in_default_method::Struct) *self = Struct { x: 100 } // lldb-command:print arg1 -// lldbg-check:[...]$1 = -1 +// lldbg-check:[...] -1 // lldbr-check:(isize) arg1 = -1 // lldb-command:print arg2 -// lldbg-check:[...]$2 = -2 +// lldbg-check:[...] -2 // lldbr-check:(isize) arg2 = -2 // lldb-command:continue // STACK BY VAL // lldb-command:print self -// lldbg-check:[...]$3 = { x = 100 } +// lldbg-check:[...] { x = 100 } // lldbr-check:(self_in_default_method::Struct) self = Struct { x: 100 } // lldb-command:print arg1 -// lldbg-check:[...]$4 = -3 +// lldbg-check:[...] -3 // lldbr-check:(isize) arg1 = -3 // lldb-command:print arg2 -// lldbg-check:[...]$5 = -4 +// lldbg-check:[...] -4 // lldbr-check:(isize) arg2 = -4 // lldb-command:continue // OWNED BY REF // lldb-command:print *self -// lldbg-check:[...]$6 = { x = 200 } +// lldbg-check:[...] { x = 200 } // lldbr-check:(self_in_default_method::Struct) *self = Struct { x: 200 } // lldb-command:print arg1 -// lldbg-check:[...]$7 = -5 +// lldbg-check:[...] -5 // lldbr-check:(isize) arg1 = -5 // lldb-command:print arg2 -// lldbg-check:[...]$8 = -6 +// lldbg-check:[...] -6 // lldbr-check:(isize) arg2 = -6 // lldb-command:continue // OWNED BY VAL // lldb-command:print self -// lldbg-check:[...]$9 = { x = 200 } +// lldbg-check:[...] { x = 200 } // lldbr-check:(self_in_default_method::Struct) self = Struct { x: 200 } // lldb-command:print arg1 -// lldbg-check:[...]$10 = -7 +// lldbg-check:[...] -7 // lldbr-check:(isize) arg1 = -7 // lldb-command:print arg2 -// lldbg-check:[...]$11 = -8 +// lldbg-check:[...] -8 // lldbr-check:(isize) arg2 = -8 // lldb-command:continue // OWNED MOVED // lldb-command:print *self -// lldbg-check:[...]$12 = { x = 200 } +// lldbg-check:[...] { x = 200 } // lldbr-check:(self_in_default_method::Struct) *self = Struct { x: 200 } // lldb-command:print arg1 -// lldbg-check:[...]$13 = -9 +// lldbg-check:[...] -9 // lldbr-check:(isize) arg1 = -9 // lldb-command:print arg2 -// lldbg-check:[...]$14 = -10 +// lldbg-check:[...] -10 // lldbr-check:(isize) arg2 = -10 // lldb-command:continue diff --git a/tests/debuginfo/self-in-generic-default-method.rs b/tests/debuginfo/self-in-generic-default-method.rs index 92be253e18aba..a21280620b5f3 100644 --- a/tests/debuginfo/self-in-generic-default-method.rs +++ b/tests/debuginfo/self-in-generic-default-method.rs @@ -63,61 +63,61 @@ // STACK BY REF // lldb-command:print *self -// lldbg-check:[...]$0 = { x = 987 } +// lldbg-check:[...] { x = 987 } // lldbr-check:(self_in_generic_default_method::Struct) *self = Struct { x: 987 } // lldb-command:print arg1 -// lldbg-check:[...]$1 = -1 +// lldbg-check:[...] -1 // lldbr-check:(isize) arg1 = -1 // lldb-command:print arg2 -// lldbg-check:[...]$2 = 2 +// lldbg-check:[...] 2 // lldbr-check:(u16) arg2 = 2 // lldb-command:continue // STACK BY VAL // lldb-command:print self -// lldbg-check:[...]$3 = { x = 987 } +// lldbg-check:[...] { x = 987 } // lldbr-check:(self_in_generic_default_method::Struct) self = Struct { x: 987 } // lldb-command:print arg1 -// lldbg-check:[...]$4 = -3 +// lldbg-check:[...] -3 // lldbr-check:(isize) arg1 = -3 // lldb-command:print arg2 -// lldbg-check:[...]$5 = -4 +// lldbg-check:[...] -4 // lldbr-check:(i16) arg2 = -4 // lldb-command:continue // OWNED BY REF // lldb-command:print *self -// lldbg-check:[...]$6 = { x = 879 } +// lldbg-check:[...] { x = 879 } // lldbr-check:(self_in_generic_default_method::Struct) *self = Struct { x: 879 } // lldb-command:print arg1 -// lldbg-check:[...]$7 = -5 +// lldbg-check:[...] -5 // lldbr-check:(isize) arg1 = -5 // lldb-command:print arg2 -// lldbg-check:[...]$8 = -6 +// lldbg-check:[...] -6 // lldbr-check:(i32) arg2 = -6 // lldb-command:continue // OWNED BY VAL // lldb-command:print self -// lldbg-check:[...]$9 = { x = 879 } +// lldbg-check:[...] { x = 879 } // lldbr-check:(self_in_generic_default_method::Struct) self = Struct { x: 879 } // lldb-command:print arg1 -// lldbg-check:[...]$10 = -7 +// lldbg-check:[...] -7 // lldbr-check:(isize) arg1 = -7 // lldb-command:print arg2 -// lldbg-check:[...]$11 = -8 +// lldbg-check:[...] -8 // lldbr-check:(i64) arg2 = -8 // lldb-command:continue // OWNED MOVED // lldb-command:print *self -// lldbg-check:[...]$12 = { x = 879 } +// lldbg-check:[...] { x = 879 } // lldbr-check:(self_in_generic_default_method::Struct) *self = Struct { x: 879 } // lldb-command:print arg1 -// lldbg-check:[...]$13 = -9 +// lldbg-check:[...] -9 // lldbr-check:(isize) arg1 = -9 // lldb-command:print arg2 -// lldbg-check:[...]$14 = -10.5 +// lldbg-check:[...] -10.5 // lldbr-check:(f32) arg2 = -10.5 // lldb-command:continue diff --git a/tests/debuginfo/shadowed-argument.rs b/tests/debuginfo/shadowed-argument.rs index 33f73340a832c..2be8cbbdfebe4 100644 --- a/tests/debuginfo/shadowed-argument.rs +++ b/tests/debuginfo/shadowed-argument.rs @@ -30,26 +30,26 @@ // lldb-command:run // lldb-command:print x -// lldbg-check:[...]$0 = false +// lldbg-check:[...] false // lldbr-check:(bool) x = false // lldb-command:print y -// lldbg-check:[...]$1 = true +// lldbg-check:[...] true // lldbr-check:(bool) y = true // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$2 = 10 +// lldbg-check:[...] 10 // lldbr-check:(i32) x = 10 // lldb-command:print y -// lldbg-check:[...]$3 = true +// lldbg-check:[...] true // lldbr-check:(bool) y = true // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$4 = 10.5 +// lldbg-check:[...] 10.5 // lldbr-check:(f64) x = 10.5 // lldb-command:print y -// lldbg-check:[...]$5 = 20 +// lldbg-check:[...] 20 // lldbr-check:(i32) y = 20 // lldb-command:continue diff --git a/tests/debuginfo/shadowed-variable.rs b/tests/debuginfo/shadowed-variable.rs index 60c392b15cb08..66cadf2913bbd 100644 --- a/tests/debuginfo/shadowed-variable.rs +++ b/tests/debuginfo/shadowed-variable.rs @@ -40,42 +40,42 @@ // lldb-command:run // lldb-command:print x -// lldbg-check:[...]$0 = false +// lldbg-check:[...] false // lldbr-check:(bool) x = false // lldb-command:print y -// lldbg-check:[...]$1 = true +// lldbg-check:[...] true // lldbr-check:(bool) y = true // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$2 = 10 +// lldbg-check:[...] 10 // lldbr-check:(i32) x = 10 // lldb-command:print y -// lldbg-check:[...]$3 = true +// lldbg-check:[...] true // lldbr-check:(bool) y = true // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$4 = 10.5 +// lldbg-check:[...] 10.5 // lldbr-check:(f64) x = 10.5 // lldb-command:print y -// lldbg-check:[...]$5 = 20 +// lldbg-check:[...] 20 // lldbr-check:(i32) y = 20 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$6 = 10.5 +// lldbg-check:[...] 10.5 // lldbr-check:(f64) x = 10.5 // lldb-command:print y -// lldbg-check:[...]$7 = 20 +// lldbg-check:[...] 20 // lldbr-check:(i32) y = 20 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$8 = 11.5 +// lldbg-check:[...] 11.5 // lldbr-check:(f64) x = 11.5 // lldb-command:print y -// lldbg-check:[...]$9 = 20 +// lldbg-check:[...] 20 // lldbr-check:(i32) y = 20 // lldb-command:continue diff --git a/tests/debuginfo/should-fail.rs b/tests/debuginfo/should-fail.rs index f3a8f52e0fa5a..4211baeee22d8 100644 --- a/tests/debuginfo/should-fail.rs +++ b/tests/debuginfo/should-fail.rs @@ -17,7 +17,7 @@ // lldb-command:run // lldb-command:print x -// lldb-check:[...]$0 = 5 +// lldb-check:[...] 5 // === CDB TESTS ================================================================================== diff --git a/tests/debuginfo/simple-lexical-scope.rs b/tests/debuginfo/simple-lexical-scope.rs index f4be2035d3cba..dfcd701017ecb 100644 --- a/tests/debuginfo/simple-lexical-scope.rs +++ b/tests/debuginfo/simple-lexical-scope.rs @@ -40,37 +40,37 @@ // lldb-command:run // lldb-command:print x -// lldbg-check:[...]$0 = false +// lldbg-check:[...] false // lldbr-check:(bool) x = false // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$1 = false +// lldbg-check:[...] false // lldbr-check:(bool) x = false // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$2 = 10 +// lldbg-check:[...] 10 // lldbr-check:(i32) x = 10 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$3 = 10 +// lldbg-check:[...] 10 // lldbr-check:(i32) x = 10 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$4 = 10.5 +// lldbg-check:[...] 10.5 // lldbr-check:(f64) x = 10.5 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$5 = 10 +// lldbg-check:[...] 10 // lldbr-check:(i32) x = 10 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$6 = false +// lldbg-check:[...] false // lldbr-check:(bool) x = false // lldb-command:continue diff --git a/tests/debuginfo/simple-struct.rs b/tests/debuginfo/simple-struct.rs index 100763f60b6fe..89c0cb491bfdf 100644 --- a/tests/debuginfo/simple-struct.rs +++ b/tests/debuginfo/simple-struct.rs @@ -98,27 +98,27 @@ // lldb-command:run // lldb-command:print no_padding16 -// lldbg-check:[...]$0 = { x = 10000 y = -10001 } +// lldbg-check:[...] { x = 10000 y = -10001 } // lldbr-check:(simple_struct::NoPadding16) no_padding16 = { x = 10000 y = -10001 } // lldb-command:print no_padding32 -// lldbg-check:[...]$1 = { x = -10002 y = -10003.5 z = 10004 } +// lldbg-check:[...] { x = -10002 y = -10003.5 z = 10004 } // lldbr-check:(simple_struct::NoPadding32) no_padding32 = { x = -10002 y = -10003.5 z = 10004 } // lldb-command:print no_padding64 -// lldbg-check:[...]$2 = { x = -10005.5 y = 10006 z = 10007 } +// lldbg-check:[...] { x = -10005.5 y = 10006 z = 10007 } // lldbr-check:(simple_struct::NoPadding64) no_padding64 = { x = -10005.5 y = 10006 z = 10007 } // lldb-command:print no_padding163264 -// lldbg-check:[...]$3 = { a = -10008 b = 10009 c = 10010 d = 10011 } +// lldbg-check:[...] { a = -10008 b = 10009 c = 10010 d = 10011 } // lldbr-check:(simple_struct::NoPadding163264) no_padding163264 = { a = -10008 b = 10009 c = 10010 d = 10011 } // lldb-command:print internal_padding -// lldbg-check:[...]$4 = { x = 10012 y = -10013 } +// lldbg-check:[...] { x = 10012 y = -10013 } // lldbr-check:(simple_struct::InternalPadding) internal_padding = { x = 10012 y = -10013 } // lldb-command:print padding_at_end -// lldbg-check:[...]$5 = { x = -10014 y = 10015 } +// lldbg-check:[...] { x = -10014 y = 10015 } // lldbr-check:(simple_struct::PaddingAtEnd) padding_at_end = { x = -10014 y = 10015 } #![allow(unused_variables)] diff --git a/tests/debuginfo/simple-tuple.rs b/tests/debuginfo/simple-tuple.rs index 2d8905a77bf7f..93f56d117ad84 100644 --- a/tests/debuginfo/simple-tuple.rs +++ b/tests/debuginfo/simple-tuple.rs @@ -100,27 +100,27 @@ // lldb-command:run // lldb-command:print/d noPadding8 -// lldbg-check:[...]$0 = { 0 = -100 1 = 100 } +// lldbg-check:[...] { 0 = -100 1 = 100 } // lldbr-check:((i8, u8)) noPadding8 = { 0 = -100 1 = 100 } // lldb-command:print noPadding16 -// lldbg-check:[...]$1 = { 0 = 0 1 = 1 2 = 2 } +// lldbg-check:[...] { 0 = 0 1 = 1 2 = 2 } // lldbr-check:((i16, i16, u16)) noPadding16 = { 0 = 0 1 = 1 2 = 2 } // lldb-command:print noPadding32 -// lldbg-check:[...]$2 = { 0 = 3 1 = 4.5 2 = 5 } +// lldbg-check:[...] { 0 = 3 1 = 4.5 2 = 5 } // lldbr-check:((i32, f32, u32)) noPadding32 = { 0 = 3 1 = 4.5 2 = 5 } // lldb-command:print noPadding64 -// lldbg-check:[...]$3 = { 0 = 6 1 = 7.5 2 = 8 } +// lldbg-check:[...] { 0 = 6 1 = 7.5 2 = 8 } // lldbr-check:((i64, f64, u64)) noPadding64 = { 0 = 6 1 = 7.5 2 = 8 } // lldb-command:print internalPadding1 -// lldbg-check:[...]$4 = { 0 = 9 1 = 10 } +// lldbg-check:[...] { 0 = 9 1 = 10 } // lldbr-check:((i16, i32)) internalPadding1 = { 0 = 9 1 = 10 } // lldb-command:print internalPadding2 -// lldbg-check:[...]$5 = { 0 = 11 1 = 12 2 = 13 3 = 14 } +// lldbg-check:[...] { 0 = 11 1 = 12 2 = 13 3 = 14 } // lldbr-check:((i16, i32, u32, u64)) internalPadding2 = { 0 = 11 1 = 12 2 = 13 3 = 14 } // lldb-command:print paddingAtEnd -// lldbg-check:[...]$6 = { 0 = 15 1 = 16 } +// lldbg-check:[...] { 0 = 15 1 = 16 } // lldbr-check:((i32, i16)) paddingAtEnd = { 0 = 15 1 = 16 } diff --git a/tests/debuginfo/static-method-on-struct-and-enum.rs b/tests/debuginfo/static-method-on-struct-and-enum.rs index ad078122ddebe..23384e0c33a7d 100644 --- a/tests/debuginfo/static-method-on-struct-and-enum.rs +++ b/tests/debuginfo/static-method-on-struct-and-enum.rs @@ -29,22 +29,22 @@ // STRUCT // lldb-command:print arg1 -// lldbg-check:[...]$0 = 1 +// lldbg-check:[...] 1 // lldbr-check:(isize) arg1 = 1 // lldb-command:print arg2 -// lldbg-check:[...]$1 = 2 +// lldbg-check:[...] 2 // lldbr-check:(isize) arg2 = 2 // lldb-command:continue // ENUM // lldb-command:print arg1 -// lldbg-check:[...]$2 = -3 +// lldbg-check:[...] -3 // lldbr-check:(isize) arg1 = -3 // lldb-command:print arg2 -// lldbg-check:[...]$3 = 4.5 +// lldbg-check:[...] 4.5 // lldbr-check:(f64) arg2 = 4.5 // lldb-command:print arg3 -// lldbg-check:[...]$4 = 5 +// lldbg-check:[...] 5 // lldbr-check:(usize) arg3 = 5 // lldb-command:continue diff --git a/tests/debuginfo/struct-in-enum.rs b/tests/debuginfo/struct-in-enum.rs index c340f71a6cc4f..a91f24a3f5c89 100644 --- a/tests/debuginfo/struct-in-enum.rs +++ b/tests/debuginfo/struct-in-enum.rs @@ -27,12 +27,12 @@ // lldb-command:run // lldb-command:print case1 -// lldb-check:[...]$0 = Case1(0, Struct { x: 2088533116, y: 2088533116, z: 31868 }) +// lldb-check:[...] Case1(0, Struct { x: 2088533116, y: 2088533116, z: 31868 }) // lldb-command:print case2 -// lldb-check:[...]$1 = Case2(0, 1229782938247303441, 4369) +// lldb-check:[...] Case2(0, 1229782938247303441, 4369) // lldb-command:print univariant -// lldb-check:[...]$2 = TheOnlyCase(Struct { x: 123, y: 456, z: 789 }) +// lldb-check:[...] TheOnlyCase(Struct { x: 123, y: 456, z: 789 }) #![allow(unused_variables)] #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/struct-in-struct.rs b/tests/debuginfo/struct-in-struct.rs index 287564a36cd3f..e88d955b6e970 100644 --- a/tests/debuginfo/struct-in-struct.rs +++ b/tests/debuginfo/struct-in-struct.rs @@ -24,35 +24,35 @@ // lldb-command:run // lldb-command:print three_simple_structs -// lldbg-check:[...]$0 = { x = { x = 1 } y = { x = 2 } z = { x = 3 } } +// lldbg-check:[...] { x = { x = 1 } y = { x = 2 } z = { x = 3 } } // lldbr-check:(struct_in_struct::ThreeSimpleStructs) three_simple_structs = { x = { x = 1 } y = { x = 2 } z = { x = 3 } } // lldb-command:print internal_padding_parent -// lldbg-check:[...]$1 = { x = { x = 4 y = 5 } y = { x = 6 y = 7 } z = { x = 8 y = 9 } } +// lldbg-check:[...] { x = { x = 4 y = 5 } y = { x = 6 y = 7 } z = { x = 8 y = 9 } } // lldbr-check:(struct_in_struct::InternalPaddingParent) internal_padding_parent = { x = { x = 4 y = 5 } y = { x = 6 y = 7 } z = { x = 8 y = 9 } } // lldb-command:print padding_at_end_parent -// lldbg-check:[...]$2 = { x = { x = 10 y = 11 } y = { x = 12 y = 13 } z = { x = 14 y = 15 } } +// lldbg-check:[...] { x = { x = 10 y = 11 } y = { x = 12 y = 13 } z = { x = 14 y = 15 } } // lldbr-check:(struct_in_struct::PaddingAtEndParent) padding_at_end_parent = { x = { x = 10 y = 11 } y = { x = 12 y = 13 } z = { x = 14 y = 15 } } // lldb-command:print mixed -// lldbg-check:[...]$3 = { x = { x = 16 y = 17 } y = { x = 18 y = 19 } z = { x = 20 } w = 21 } +// lldbg-check:[...] { x = { x = 16 y = 17 } y = { x = 18 y = 19 } z = { x = 20 } w = 21 } // lldbr-check:(struct_in_struct::Mixed) mixed = { x = { x = 16 y = 17 } y = { x = 18 y = 19 } z = { x = 20 } w = 21 } // lldb-command:print bag -// lldbg-check:[...]$4 = { x = { x = 22 } } +// lldbg-check:[...] { x = { x = 22 } } // lldbr-check:(struct_in_struct::Bag) bag = { x = { x = 22 } } // lldb-command:print bag_in_bag -// lldbg-check:[...]$5 = { x = { x = { x = 23 } } } +// lldbg-check:[...] { x = { x = { x = 23 } } } // lldbr-check:(struct_in_struct::BagInBag) bag_in_bag = { x = { x = { x = 23 } } } // lldb-command:print tjo -// lldbg-check:[...]$6 = { x = { x = { x = { x = 24 } } } } +// lldbg-check:[...] { x = { x = { x = { x = 24 } } } } // lldbr-check:(struct_in_struct::ThatsJustOverkill) tjo = { x = { x = { x = { x = 24 } } } } // lldb-command:print tree -// lldbg-check:[...]$7 = { x = { x = 25 } y = { x = { x = 26 y = 27 } y = { x = 28 y = 29 } z = { x = 30 y = 31 } } z = { x = { x = { x = 32 } } } } +// lldbg-check:[...] { x = { x = 25 } y = { x = { x = 26 y = 27 } y = { x = 28 y = 29 } z = { x = 30 y = 31 } } z = { x = { x = { x = 32 } } } } // lldbr-check:(struct_in_struct::Tree) tree = { x = { x = 25 } y = { x = { x = 26 y = 27 } y = { x = 28 y = 29 } z = { x = 30 y = 31 } } z = { x = { x = { x = 32 } } } } #![allow(unused_variables)] diff --git a/tests/debuginfo/struct-namespace.rs b/tests/debuginfo/struct-namespace.rs index f9262a458d52b..d641a788a6fa6 100644 --- a/tests/debuginfo/struct-namespace.rs +++ b/tests/debuginfo/struct-namespace.rs @@ -6,17 +6,17 @@ // lldb-command:run // lldb-command:p struct1 -// lldbg-check:(struct_namespace::Struct1) $0 = [...] +// lldbg-check:(struct_namespace::Struct1)[...] // lldbr-check:(struct_namespace::Struct1) struct1 = Struct1 { a: 0, b: 1 } // lldb-command:p struct2 -// lldbg-check:(struct_namespace::Struct2) $1 = [...] +// lldbg-check:(struct_namespace::Struct2)[...] // lldbr-check:(struct_namespace::Struct2) struct2 = { = 2 } // lldb-command:p mod1_struct1 -// lldbg-check:(struct_namespace::mod1::Struct1) $2 = [...] +// lldbg-check:(struct_namespace::mod1::Struct1)[...] // lldbr-check:(struct_namespace::mod1::Struct1) mod1_struct1 = Struct1 { a: 3, b: 4 } // lldb-command:p mod1_struct2 -// lldbg-check:(struct_namespace::mod1::Struct2) $3 = [...] +// lldbg-check:(struct_namespace::mod1::Struct2)[...] // lldbr-check:(struct_namespace::mod1::Struct2) mod1_struct2 = { = 5 } #![allow(unused_variables)] diff --git a/tests/debuginfo/struct-with-destructor.rs b/tests/debuginfo/struct-with-destructor.rs index 9b81136e7a88f..d6686be662cd7 100644 --- a/tests/debuginfo/struct-with-destructor.rs +++ b/tests/debuginfo/struct-with-destructor.rs @@ -26,19 +26,19 @@ // lldb-command:run // lldb-command:print simple -// lldbg-check:[...]$0 = { x = 10 y = 20 } +// lldbg-check:[...] { x = 10 y = 20 } // lldbr-check:(struct_with_destructor::WithDestructor) simple = { x = 10 y = 20 } // lldb-command:print noDestructor -// lldbg-check:[...]$1 = { a = { x = 10 y = 20 } guard = -1 } +// lldbg-check:[...] { a = { x = 10 y = 20 } guard = -1 } // lldbr-check:(struct_with_destructor::NoDestructorGuarded) noDestructor = { a = { x = 10 y = 20 } guard = -1 } // lldb-command:print withDestructor -// lldbg-check:[...]$2 = { a = { x = 10 y = 20 } guard = -1 } +// lldbg-check:[...] { a = { x = 10 y = 20 } guard = -1 } // lldbr-check:(struct_with_destructor::WithDestructorGuarded) withDestructor = { a = { x = 10 y = 20 } guard = -1 } // lldb-command:print nested -// lldbg-check:[...]$3 = { a = { a = { x = 7890 y = 9870 } } } +// lldbg-check:[...] { a = { a = { x = 7890 y = 9870 } } } // lldbr-check:(struct_with_destructor::NestedOuter) nested = { a = { a = { x = 7890 y = 9870 } } } #![allow(unused_variables)] diff --git a/tests/debuginfo/tuple-in-tuple.rs b/tests/debuginfo/tuple-in-tuple.rs index c1cfe64a52e96..b6b20cea9b629 100644 --- a/tests/debuginfo/tuple-in-tuple.rs +++ b/tests/debuginfo/tuple-in-tuple.rs @@ -36,27 +36,27 @@ // lldb-command:run // lldb-command:print no_padding1 -// lldbg-check:[...]$0 = { 0 = { 0 = 0 1 = 1 } 1 = 2 2 = 3 } +// lldbg-check:[...] { 0 = { 0 = 0 1 = 1 } 1 = 2 2 = 3 } // lldbr-check:(((u32, u32), u32, u32)) no_padding1 = { 0 = { 0 = 0 1 = 1 } 1 = 2 2 = 3 } // lldb-command:print no_padding2 -// lldbg-check:[...]$1 = { 0 = 4 1 = { 0 = 5 1 = 6 } 2 = 7 } +// lldbg-check:[...] { 0 = 4 1 = { 0 = 5 1 = 6 } 2 = 7 } // lldbr-check:((u32, (u32, u32), u32)) no_padding2 = { 0 = 4 1 = { 0 = 5 1 = 6 } 2 = 7 } // lldb-command:print no_padding3 -// lldbg-check:[...]$2 = { 0 = 8 1 = 9 2 = { 0 = 10 1 = 11 } } +// lldbg-check:[...] { 0 = 8 1 = 9 2 = { 0 = 10 1 = 11 } } // lldbr-check:((u32, u32, (u32, u32))) no_padding3 = { 0 = 8 1 = 9 2 = { 0 = 10 1 = 11 } } // lldb-command:print internal_padding1 -// lldbg-check:[...]$3 = { 0 = 12 1 = { 0 = 13 1 = 14 } } +// lldbg-check:[...] { 0 = 12 1 = { 0 = 13 1 = 14 } } // lldbr-check:((i16, (i32, i32))) internal_padding1 = { 0 = 12 1 = { 0 = 13 1 = 14 } } // lldb-command:print internal_padding2 -// lldbg-check:[...]$4 = { 0 = 15 1 = { 0 = 16 1 = 17 } } +// lldbg-check:[...] { 0 = 15 1 = { 0 = 16 1 = 17 } } // lldbr-check:((i16, (i16, i32))) internal_padding2 = { 0 = 15 1 = { 0 = 16 1 = 17 } } // lldb-command:print padding_at_end1 -// lldbg-check:[...]$5 = { 0 = 18 1 = { 0 = 19 1 = 20 } } +// lldbg-check:[...] { 0 = 18 1 = { 0 = 19 1 = 20 } } // lldbr-check:((i32, (i32, i16))) padding_at_end1 = { 0 = 18 1 = { 0 = 19 1 = 20 } } // lldb-command:print padding_at_end2 -// lldbg-check:[...]$6 = { 0 = { 0 = 21 1 = 22 } 1 = 23 } +// lldbg-check:[...] { 0 = { 0 = 21 1 = 22 } 1 = 23 } // lldbr-check:(((i32, i16), i32)) padding_at_end2 = { 0 = { 0 = 21 1 = 22 } 1 = 23 } diff --git a/tests/debuginfo/tuple-struct.rs b/tests/debuginfo/tuple-struct.rs index 5eeb1a6eed4ec..e912f63a8b2d9 100644 --- a/tests/debuginfo/tuple-struct.rs +++ b/tests/debuginfo/tuple-struct.rs @@ -36,27 +36,27 @@ // lldb-command:run // lldb-command:print no_padding16 -// lldbg-check:[...]$0 = { 0 = 10000 1 = -10001 } +// lldbg-check:[...] { 0 = 10000 1 = -10001 } // lldbr-check:(tuple_struct::NoPadding16) no_padding16 = { 0 = 10000 1 = -10001 } // lldb-command:print no_padding32 -// lldbg-check:[...]$1 = { 0 = -10002 1 = -10003.5 2 = 10004 } +// lldbg-check:[...] { 0 = -10002 1 = -10003.5 2 = 10004 } // lldbr-check:(tuple_struct::NoPadding32) no_padding32 = { 0 = -10002 1 = -10003.5 2 = 10004 } // lldb-command:print no_padding64 -// lldbg-check:[...]$2 = { 0 = -10005.5 1 = 10006 2 = 10007 } +// lldbg-check:[...] { 0 = -10005.5 1 = 10006 2 = 10007 } // lldbr-check:(tuple_struct::NoPadding64) no_padding64 = { 0 = -10005.5 1 = 10006 2 = 10007 } // lldb-command:print no_padding163264 -// lldbg-check:[...]$3 = { 0 = -10008 1 = 10009 2 = 10010 3 = 10011 } +// lldbg-check:[...] { 0 = -10008 1 = 10009 2 = 10010 3 = 10011 } // lldbr-check:(tuple_struct::NoPadding163264) no_padding163264 = { 0 = -10008 1 = 10009 2 = 10010 3 = 10011 } // lldb-command:print internal_padding -// lldbg-check:[...]$4 = { 0 = 10012 1 = -10013 } +// lldbg-check:[...] { 0 = 10012 1 = -10013 } // lldbr-check:(tuple_struct::InternalPadding) internal_padding = { 0 = 10012 1 = -10013 } // lldb-command:print padding_at_end -// lldbg-check:[...]$5 = { 0 = -10014 1 = 10015 } +// lldbg-check:[...] { 0 = -10014 1 = 10015 } // lldbr-check:(tuple_struct::PaddingAtEnd) padding_at_end = { 0 = -10014 1 = 10015 } // This test case mainly makes sure that no field names are generated for tuple structs (as opposed diff --git a/tests/debuginfo/union-smoke.rs b/tests/debuginfo/union-smoke.rs index aa57ebdc844c8..8df4c9dbf96a6 100644 --- a/tests/debuginfo/union-smoke.rs +++ b/tests/debuginfo/union-smoke.rs @@ -19,13 +19,13 @@ // lldb-command:run // lldb-command:print u -// lldbg-check:[...]$0 = { a = { 0 = '\x02' 1 = '\x02' } b = 514 } +// lldbg-check:[...] { a = { 0 = '\x02' 1 = '\x02' } b = 514 } // lldbr-check:(union_smoke::U) u = { a = { 0 = '\x02' 1 = '\x02' } b = 514 } // Don't test this with rust-enabled lldb for now; see // https://github.com/rust-lang-nursery/lldb/issues/18 // lldbg-command:print union_smoke::SU -// lldbg-check:[...]$1 = { a = { 0 = '\x01' 1 = '\x01' } b = 257 } +// lldbg-check:[...] { a = { 0 = '\x01' 1 = '\x01' } b = 257 } #![allow(unused)] #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/var-captured-in-nested-closure.rs b/tests/debuginfo/var-captured-in-nested-closure.rs index 75ab245e13e02..62cb87e4f994b 100644 --- a/tests/debuginfo/var-captured-in-nested-closure.rs +++ b/tests/debuginfo/var-captured-in-nested-closure.rs @@ -44,42 +44,42 @@ // lldb-command:run // lldb-command:print variable -// lldbg-check:[...]$0 = 1 +// lldbg-check:[...] 1 // lldbr-check:(isize) variable = 1 // lldb-command:print constant -// lldbg-check:[...]$1 = 2 +// lldbg-check:[...] 2 // lldbr-check:(isize) constant = 2 // lldb-command:print a_struct -// lldbg-check:[...]$2 = { a = -3 b = 4.5 c = 5 } +// lldbg-check:[...] { a = -3 b = 4.5 c = 5 } // lldbr-check:(var_captured_in_nested_closure::Struct) a_struct = { a = -3 b = 4.5 c = 5 } // lldb-command:print *struct_ref -// lldbg-check:[...]$3 = { a = -3 b = 4.5 c = 5 } +// lldbg-check:[...] { a = -3 b = 4.5 c = 5 } // lldbr-check:(var_captured_in_nested_closure::Struct) *struct_ref = { a = -3 b = 4.5 c = 5 } // lldb-command:print *owned -// lldbg-check:[...]$4 = 6 +// lldbg-check:[...] 6 // lldbr-check:(isize) *owned = 6 // lldb-command:print closure_local -// lldbg-check:[...]$5 = 8 +// lldbg-check:[...] 8 // lldbr-check:(isize) closure_local = 8 // lldb-command:continue // lldb-command:print variable -// lldbg-check:[...]$6 = 1 +// lldbg-check:[...] 1 // lldbr-check:(isize) variable = 1 // lldb-command:print constant -// lldbg-check:[...]$7 = 2 +// lldbg-check:[...] 2 // lldbr-check:(isize) constant = 2 // lldb-command:print a_struct -// lldbg-check:[...]$8 = { a = -3 b = 4.5 c = 5 } +// lldbg-check:[...] { a = -3 b = 4.5 c = 5 } // lldbr-check:(var_captured_in_nested_closure::Struct) a_struct = { a = -3 b = 4.5 c = 5 } // lldb-command:print *struct_ref -// lldbg-check:[...]$9 = { a = -3 b = 4.5 c = 5 } +// lldbg-check:[...] { a = -3 b = 4.5 c = 5 } // lldbr-check:(var_captured_in_nested_closure::Struct) *struct_ref = { a = -3 b = 4.5 c = 5 } // lldb-command:print *owned -// lldbg-check:[...]$10 = 6 +// lldbg-check:[...] 6 // lldbr-check:(isize) *owned = 6 // lldb-command:print closure_local -// lldbg-check:[...]$11 = 8 +// lldbg-check:[...] 8 // lldbr-check:(isize) closure_local = 8 // lldb-command:continue diff --git a/tests/debuginfo/var-captured-in-sendable-closure.rs b/tests/debuginfo/var-captured-in-sendable-closure.rs index b7992deef44cc..e2e154e91cb43 100644 --- a/tests/debuginfo/var-captured-in-sendable-closure.rs +++ b/tests/debuginfo/var-captured-in-sendable-closure.rs @@ -24,13 +24,13 @@ // lldb-command:run // lldb-command:print constant -// lldbg-check:[...]$0 = 1 +// lldbg-check:[...] 1 // lldbr-check:(isize) constant = 1 // lldb-command:print a_struct -// lldbg-check:[...]$1 = { a = -2 b = 3.5 c = 4 } +// lldbg-check:[...] { a = -2 b = 3.5 c = 4 } // lldbr-check:(var_captured_in_sendable_closure::Struct) a_struct = { a = -2 b = 3.5 c = 4 } // lldb-command:print *owned -// lldbg-check:[...]$2 = 5 +// lldbg-check:[...] 5 // lldbr-check:(isize) *owned = 5 #![allow(unused_variables)] diff --git a/tests/debuginfo/var-captured-in-stack-closure.rs b/tests/debuginfo/var-captured-in-stack-closure.rs index eb68b081a6d85..c704b53ef853a 100644 --- a/tests/debuginfo/var-captured-in-stack-closure.rs +++ b/tests/debuginfo/var-captured-in-stack-closure.rs @@ -40,37 +40,37 @@ // lldb-command:run // lldb-command:print variable -// lldbg-check:[...]$0 = 1 +// lldbg-check:[...] 1 // lldbr-check:(isize) variable = 1 // lldb-command:print constant -// lldbg-check:[...]$1 = 2 +// lldbg-check:[...] 2 // lldbr-check:(isize) constant = 2 // lldb-command:print a_struct -// lldbg-check:[...]$2 = { a = -3 b = 4.5 c = 5 } +// lldbg-check:[...] { a = -3 b = 4.5 c = 5 } // lldbr-check:(var_captured_in_stack_closure::Struct) a_struct = { a = -3 b = 4.5 c = 5 } // lldb-command:print *struct_ref -// lldbg-check:[...]$3 = { a = -3 b = 4.5 c = 5 } +// lldbg-check:[...] { a = -3 b = 4.5 c = 5 } // lldbr-check:(var_captured_in_stack_closure::Struct) *struct_ref = { a = -3 b = 4.5 c = 5 } // lldb-command:print *owned -// lldbg-check:[...]$4 = 6 +// lldbg-check:[...] 6 // lldbr-check:(isize) *owned = 6 // lldb-command:continue // lldb-command:print variable -// lldbg-check:[...]$5 = 2 +// lldbg-check:[...] 2 // lldbr-check:(isize) variable = 2 // lldb-command:print constant -// lldbg-check:[...]$6 = 2 +// lldbg-check:[...] 2 // lldbr-check:(isize) constant = 2 // lldb-command:print a_struct -// lldbg-check:[...]$7 = { a = -3 b = 4.5 c = 5 } +// lldbg-check:[...] { a = -3 b = 4.5 c = 5 } // lldbr-check:(var_captured_in_stack_closure::Struct) a_struct = { a = -3 b = 4.5 c = 5 } // lldb-command:print *struct_ref -// lldbg-check:[...]$8 = { a = -3 b = 4.5 c = 5 } +// lldbg-check:[...] { a = -3 b = 4.5 c = 5 } // lldbr-check:(var_captured_in_stack_closure::Struct) *struct_ref = { a = -3 b = 4.5 c = 5 } // lldb-command:print *owned -// lldbg-check:[...]$9 = 6 +// lldbg-check:[...] 6 // lldbr-check:(isize) *owned = 6 diff --git a/tests/debuginfo/vec-slices.rs b/tests/debuginfo/vec-slices.rs index b044110fc7892..bf3cad30faf92 100644 --- a/tests/debuginfo/vec-slices.rs +++ b/tests/debuginfo/vec-slices.rs @@ -71,27 +71,27 @@ // lldb-command:run // lldb-command:print empty -// lldbg-check:[...]$0 = size=0 +// lldbg-check:[...] size=0 // lldbr-check:(&[i64]) empty = size=0 // lldb-command:print singleton -// lldbg-check:[...]$1 = size=1 { [0] = 1 } +// lldbg-check:[...] size=1 { [0] = 1 } // lldbr-check:(&[i64]) singleton = &[1] // lldb-command:print multiple -// lldbg-check:[...]$2 = size=4 { [0] = 2 [1] = 3 [2] = 4 [3] = 5 } +// lldbg-check:[...] size=4 { [0] = 2 [1] = 3 [2] = 4 [3] = 5 } // lldbr-check:(&[i64]) multiple = size=4 { [0] = 2 [1] = 3 [2] = 4 [3] = 5 } // lldb-command:print slice_of_slice -// lldbg-check:[...]$3 = size=2 { [0] = 3 [1] = 4 } +// lldbg-check:[...] size=2 { [0] = 3 [1] = 4 } // lldbr-check:(&[i64]) slice_of_slice = size=2 { [0] = 3 [1] = 4 } // lldb-command:print padded_tuple -// lldbg-check:[...]$4 = size=2 { [0] = { 0 = 6 1 = 7 } [1] = { 0 = 8 1 = 9 } } +// lldbg-check:[...] size=2 { [0] = { 0 = 6 1 = 7 } [1] = { 0 = 8 1 = 9 } } // lldbr-check:(&[(i32, i16)]) padded_tuple = size=2 { [0] = { 0 = 6 1 = 7 } [1] = { 0 = 8 1 = 9 } } // lldb-command:print padded_struct -// lldbg-check:[...]$5 = size=2 { [0] = { x = 10 y = 11 z = 12 } [1] = { x = 13 y = 14 z = 15 } } +// lldbg-check:[...] size=2 { [0] = { x = 10 y = 11 z = 12 } [1] = { x = 13 y = 14 z = 15 } } // lldbr-check:(&[vec_slices::AStruct]) padded_struct = size=2 { [0] = { x = 10 y = 11 z = 12 } [1] = { x = 13 y = 14 z = 15 } } #![allow(dead_code, unused_variables)] diff --git a/tests/debuginfo/vec.rs b/tests/debuginfo/vec.rs index 27d04094e3c6d..0ac2f2acb596e 100644 --- a/tests/debuginfo/vec.rs +++ b/tests/debuginfo/vec.rs @@ -18,7 +18,7 @@ // lldb-command:run // lldb-command:print a -// lldbg-check:[...]$0 = { [0] = 1 [1] = 2 [2] = 3 } +// lldbg-check:[...] { [0] = 1 [1] = 2 [2] = 3 } // lldbr-check:([i32; 3]) a = { [0] = 1 [1] = 2 [2] = 3 } #![allow(unused_variables)] diff --git a/tests/ui-fulldeps/stable-mir/check_transform.rs b/tests/ui-fulldeps/stable-mir/check_transform.rs new file mode 100644 index 0000000000000..e7d852a27df0e --- /dev/null +++ b/tests/ui-fulldeps/stable-mir/check_transform.rs @@ -0,0 +1,147 @@ +//@ run-pass +//! Test a few methods to transform StableMIR. + +//@ ignore-stage1 +//@ ignore-cross-compile +//@ ignore-remote +//@ ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837 + +#![feature(rustc_private)] +#![feature(assert_matches)] +#![feature(control_flow_enum)] +#![feature(ascii_char, ascii_char_variants)] + +extern crate rustc_hir; +#[macro_use] +extern crate rustc_smir; +extern crate rustc_driver; +extern crate rustc_interface; +extern crate stable_mir; + +use rustc_smir::rustc_internal; +use stable_mir::mir::alloc::GlobalAlloc; +use stable_mir::mir::mono::Instance; +use stable_mir::mir::{Body, Constant, Operand, Rvalue, StatementKind, TerminatorKind}; +use stable_mir::ty::{Const, ConstantKind}; +use stable_mir::{CrateDef, CrateItems, ItemKind}; +use std::convert::TryFrom; +use std::io::Write; +use std::ops::ControlFlow; + +const CRATE_NAME: &str = "input"; + +/// This function uses the Stable MIR APIs to transform the MIR. +fn test_transform() -> ControlFlow<()> { + // Find items in the local crate. + let items = stable_mir::all_local_items(); + + // Test fn_abi + let target_fn = *get_item(&items, (ItemKind::Fn, "dummy")).unwrap(); + let instance = Instance::try_from(target_fn).unwrap(); + let body = instance.body().unwrap(); + check_msg(&body, "oops"); + + let new_msg = "new panic message"; + let new_body = change_panic_msg(body, new_msg); + check_msg(&new_body, new_msg); + + ControlFlow::Continue(()) +} + +/// Check that the body panic message matches the given message. +fn check_msg(body: &Body, expected: &str) { + let msg = body + .blocks + .iter() + .find_map(|bb| match &bb.terminator.kind { + TerminatorKind::Call { args, .. } => { + assert_eq!(args.len(), 1, "Expected panic message, but found {args:?}"); + let msg_const = match &args[0] { + Operand::Constant(msg_const) => msg_const, + Operand::Copy(place) | Operand::Move(place) => { + assert!(place.projection.is_empty()); + bb.statements + .iter() + .find_map(|stmt| match &stmt.kind { + StatementKind::Assign( + destination, + Rvalue::Use(Operand::Constant(msg_const)), + ) if destination == place => Some(msg_const), + _ => None, + }) + .unwrap() + } + }; + let ConstantKind::Allocated(alloc) = msg_const.literal.kind() else { + unreachable!() + }; + assert_eq!(alloc.provenance.ptrs.len(), 1); + + let alloc_prov_id = alloc.provenance.ptrs[0].1 .0; + let GlobalAlloc::Memory(val) = GlobalAlloc::from(alloc_prov_id) else { + unreachable!() + }; + let bytes = val.raw_bytes().unwrap(); + Some(std::str::from_utf8(&bytes).unwrap().to_string()) + } + _ => None, + }) + .expect("Failed to find panic message"); + assert_eq!(&msg, expected); +} + +/// Modify body to use a different panic message. +fn change_panic_msg(mut body: Body, new_msg: &str) -> Body { + for bb in &mut body.blocks { + match &mut bb.terminator.kind { + TerminatorKind::Call { args, .. } => { + let new_const = Const::from_str(new_msg); + args[0] = Operand::Constant(Constant { + literal: new_const, + span: bb.terminator.span, + user_ty: None, + }); + } + _ => {} + } + } + body +} + +fn get_item<'a>( + items: &'a CrateItems, + item: (ItemKind, &str), +) -> Option<&'a stable_mir::CrateItem> { + items.iter().find(|crate_item| (item.0 == crate_item.kind()) && crate_item.name() == item.1) +} + +/// This test will generate and analyze a dummy crate using the stable mir. +/// For that, it will first write the dummy crate into a file. +/// Then it will create a `StableMir` using custom arguments and then +/// it will run the compiler. +fn main() { + let path = "transform_input.rs"; + generate_input(&path).unwrap(); + let args = vec![ + "rustc".to_string(), + "--crate-type=lib".to_string(), + "--crate-name".to_string(), + CRATE_NAME.to_string(), + path.to_string(), + ]; + run!(args, test_transform).unwrap(); +} + +fn generate_input(path: &str) -> std::io::Result<()> { + let mut file = std::fs::File::create(path)?; + write!( + file, + r#" + #![feature(panic_internals)] + pub fn dummy() {{ + core::panicking::panic_str("oops"); + }} + "# + )?; + Ok(()) +} diff --git a/tests/ui/consts/const-eval/erroneous-const.stderr b/tests/ui/consts/const-eval/erroneous-const.stderr deleted file mode 100644 index bd25e96c2cf13..0000000000000 --- a/tests/ui/consts/const-eval/erroneous-const.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0080]: evaluation of `PrintName::::VOID` failed - --> $DIR/erroneous-const.rs:6:22 - | -LL | const VOID: () = [()][2]; - | ^^^^^^^ index out of bounds: the length is 1 but the index is 2 - -note: erroneous constant encountered - --> $DIR/erroneous-const.rs:13:13 - | -LL | PrintName::::VOID; - | ^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/consts/const-eval/erroneous-const2.rs b/tests/ui/consts/const-eval/erroneous-const2.rs deleted file mode 100644 index 61f2955f2d822..0000000000000 --- a/tests/ui/consts/const-eval/erroneous-const2.rs +++ /dev/null @@ -1,19 +0,0 @@ -//! Make sure we error on erroneous consts even if they are unused. -#![allow(unconditional_panic)] - -struct PrintName(T); -impl PrintName { - const VOID: () = [()][2]; //~ERROR evaluation of `PrintName::::VOID` failed -} - -pub static FOO: () = { - if false { - // This bad constant is only used in dead code in a static initializer... and yet we still - // must make sure that the build fails. - PrintName::::VOID; //~ constant - } -}; - -fn main() { - FOO -} diff --git a/tests/ui/consts/const-eval/erroneous-const2.stderr b/tests/ui/consts/const-eval/erroneous-const2.stderr deleted file mode 100644 index 6a5839e3dfb41..0000000000000 --- a/tests/ui/consts/const-eval/erroneous-const2.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0080]: evaluation of `PrintName::::VOID` failed - --> $DIR/erroneous-const2.rs:6:22 - | -LL | const VOID: () = [()][2]; - | ^^^^^^^ index out of bounds: the length is 1 but the index is 2 - -note: erroneous constant encountered - --> $DIR/erroneous-const2.rs:13:9 - | -LL | PrintName::::VOID; - | ^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/consts/const-eval/raw-bytes.32bit.stderr b/tests/ui/consts/const-eval/raw-bytes.32bit.stderr index c06c30741164a..c1748c2e23769 100644 --- a/tests/ui/consts/const-eval/raw-bytes.32bit.stderr +++ b/tests/ui/consts/const-eval/raw-bytes.32bit.stderr @@ -68,7 +68,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/raw-bytes.rs:59:1 | LL | const NULL_U8: NonZero = unsafe { mem::transmute(0u8) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered 0, but expected something greater or equal to 1 | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 1, align: 1) { @@ -79,7 +79,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/raw-bytes.rs:61:1 | LL | const NULL_USIZE: NonZero = unsafe { mem::transmute(0usize) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered 0, but expected something greater or equal to 1 | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 4, align: 4) { diff --git a/tests/ui/consts/const-eval/raw-bytes.64bit.stderr b/tests/ui/consts/const-eval/raw-bytes.64bit.stderr index 0589280524cab..eb97eab9db756 100644 --- a/tests/ui/consts/const-eval/raw-bytes.64bit.stderr +++ b/tests/ui/consts/const-eval/raw-bytes.64bit.stderr @@ -68,7 +68,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/raw-bytes.rs:59:1 | LL | const NULL_U8: NonZero = unsafe { mem::transmute(0u8) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered 0, but expected something greater or equal to 1 | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 1, align: 1) { @@ -79,7 +79,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/raw-bytes.rs:61:1 | LL | const NULL_USIZE: NonZero = unsafe { mem::transmute(0usize) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered 0, but expected something greater or equal to 1 | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 8) { diff --git a/tests/ui/consts/const-eval/ub-nonnull.stderr b/tests/ui/consts/const-eval/ub-nonnull.stderr index 70b961fe1cd4f..ab0fb2abdb309 100644 --- a/tests/ui/consts/const-eval/ub-nonnull.stderr +++ b/tests/ui/consts/const-eval/ub-nonnull.stderr @@ -19,7 +19,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-nonnull.rs:24:1 | LL | const NULL_U8: NonZero = unsafe { mem::transmute(0u8) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered 0, but expected something greater or equal to 1 | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) { @@ -30,7 +30,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-nonnull.rs:26:1 | LL | const NULL_USIZE: NonZero = unsafe { mem::transmute(0usize) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered 0, but expected something greater or equal to 1 | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) { diff --git a/tests/ui/consts/const-eval/unused-broken-const-late.stderr b/tests/ui/consts/const-eval/unused-broken-const-late.stderr deleted file mode 100644 index c2cf2f3813c5e..0000000000000 --- a/tests/ui/consts/const-eval/unused-broken-const-late.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0080]: evaluation of `PrintName::::VOID` failed - --> $DIR/unused-broken-const-late.rs:8:22 - | -LL | const VOID: () = panic!(); - | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/unused-broken-const-late.rs:8:22 - | - = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/consts/required-consts/collect-in-called-fn.noopt.stderr b/tests/ui/consts/required-consts/collect-in-called-fn.noopt.stderr new file mode 100644 index 0000000000000..c7ff1328917fc --- /dev/null +++ b/tests/ui/consts/required-consts/collect-in-called-fn.noopt.stderr @@ -0,0 +1,17 @@ +error[E0080]: evaluation of `Fail::::C` failed + --> $DIR/collect-in-called-fn.rs:9:19 + | +LL | const C: () = panic!(); + | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-called-fn.rs:9:19 + | + = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) + +note: the above error was encountered while instantiating `fn called::` + --> $DIR/collect-in-called-fn.rs:23:5 + | +LL | called::(); + | ^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/consts/required-consts/collect-in-called-fn.opt.stderr b/tests/ui/consts/required-consts/collect-in-called-fn.opt.stderr new file mode 100644 index 0000000000000..c7ff1328917fc --- /dev/null +++ b/tests/ui/consts/required-consts/collect-in-called-fn.opt.stderr @@ -0,0 +1,17 @@ +error[E0080]: evaluation of `Fail::::C` failed + --> $DIR/collect-in-called-fn.rs:9:19 + | +LL | const C: () = panic!(); + | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-called-fn.rs:9:19 + | + = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) + +note: the above error was encountered while instantiating `fn called::` + --> $DIR/collect-in-called-fn.rs:23:5 + | +LL | called::(); + | ^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/consts/const-eval/unused-broken-const-late.rs b/tests/ui/consts/required-consts/collect-in-called-fn.rs similarity index 55% rename from tests/ui/consts/const-eval/unused-broken-const-late.rs rename to tests/ui/consts/required-consts/collect-in-called-fn.rs index c4916061f9e5a..55133a10cd988 100644 --- a/tests/ui/consts/const-eval/unused-broken-const-late.rs +++ b/tests/ui/consts/required-consts/collect-in-called-fn.rs @@ -1,20 +1,24 @@ +//@revisions: noopt opt //@ build-fail -//@ compile-flags: -O +//@[opt] compile-flags: -O //! Make sure we detect erroneous constants post-monomorphization even when they are unused. This is //! crucial, people rely on it for soundness. (https://github.com/rust-lang/rust/issues/112090) -struct PrintName(T); -impl PrintName { - const VOID: () = panic!(); //~ERROR evaluation of `PrintName::::VOID` failed +struct Fail(T); +impl Fail { + const C: () = panic!(); //~ERROR evaluation of `Fail::::C` failed } -fn no_codegen() { +#[inline(never)] +fn called() { // Any function that is called is guaranteed to have all consts that syntactically // appear in its body evaluated, even if they only appear in dead code. + // This relies on mono-item collection checking `required_consts` in collected functions. if false { - let _ = PrintName::::VOID; + let _ = Fail::::C; } } + pub fn main() { - no_codegen::(); + called::(); } diff --git a/tests/ui/consts/required-consts/collect-in-dead-drop.noopt.stderr b/tests/ui/consts/required-consts/collect-in-dead-drop.noopt.stderr new file mode 100644 index 0000000000000..b7010e787633b --- /dev/null +++ b/tests/ui/consts/required-consts/collect-in-dead-drop.noopt.stderr @@ -0,0 +1,14 @@ +error[E0080]: evaluation of `Fail::::C` failed + --> $DIR/collect-in-dead-drop.rs:12:19 + | +LL | const C: () = panic!(); + | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-dead-drop.rs:12:19 + | + = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) + +note: the above error was encountered while instantiating `fn as std::ops::Drop>::drop` + --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/consts/required-consts/collect-in-dead-drop.rs b/tests/ui/consts/required-consts/collect-in-dead-drop.rs new file mode 100644 index 0000000000000..c9ffcec690317 --- /dev/null +++ b/tests/ui/consts/required-consts/collect-in-dead-drop.rs @@ -0,0 +1,33 @@ +//@revisions: noopt opt +//@[noopt] build-fail +//@[opt] compile-flags: -O +//FIXME: `opt` revision currently does not stop with an error due to +//. +//@[opt] build-pass +//! Make sure we detect erroneous constants post-monomorphization even when they are unused. This is +//! crucial, people rely on it for soundness. (https://github.com/rust-lang/rust/issues/112090) + +struct Fail(T); +impl Fail { + const C: () = panic!(); //[noopt]~ERROR evaluation of `Fail::::C` failed +} + +// This function is not actually called, but is mentioned implicitly as destructor in dead code in a +// function that is called. Make sure we still find this error. +impl Drop for Fail { + fn drop(&mut self) { + let _ = Fail::::C; + } +} + +#[inline(never)] +fn called(x: T) { + if false { + let v = Fail(x); + // Now it gest dropped implicitly, at the end of this scope. + } +} + +pub fn main() { + called::(0); +} diff --git a/tests/ui/consts/required-consts/collect-in-dead-fn.noopt.stderr b/tests/ui/consts/required-consts/collect-in-dead-fn.noopt.stderr new file mode 100644 index 0000000000000..2162c35c83702 --- /dev/null +++ b/tests/ui/consts/required-consts/collect-in-dead-fn.noopt.stderr @@ -0,0 +1,17 @@ +error[E0080]: evaluation of `Fail::::C` failed + --> $DIR/collect-in-dead-fn.rs:12:19 + | +LL | const C: () = panic!(); + | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-dead-fn.rs:12:19 + | + = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) + +note: the above error was encountered while instantiating `fn not_called::` + --> $DIR/collect-in-dead-fn.rs:29:9 + | +LL | not_called::(); + | ^^^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/consts/required-consts/collect-in-dead-fn.rs b/tests/ui/consts/required-consts/collect-in-dead-fn.rs new file mode 100644 index 0000000000000..9e6b151915331 --- /dev/null +++ b/tests/ui/consts/required-consts/collect-in-dead-fn.rs @@ -0,0 +1,35 @@ +//@revisions: noopt opt +//@[noopt] build-fail +//@[opt] compile-flags: -O +//FIXME: `opt` revision currently does not stop with an error due to +//. +//@[opt] build-pass +//! Make sure we detect erroneous constants post-monomorphization even when they are unused. This is +//! crucial, people rely on it for soundness. (https://github.com/rust-lang/rust/issues/112090) + +struct Fail(T); +impl Fail { + const C: () = panic!(); //[noopt]~ERROR evaluation of `Fail::::C` failed +} + +// This function is not actually called, but it is mentioned in dead code in a function that is +// called. Make sure we still find this error. +// This relies on mono-item collection checking `required_consts` in functions that syntactically +// are called in collected functions (even inside dead code). +#[inline(never)] +fn not_called() { + if false { + let _ = Fail::::C; + } +} + +#[inline(never)] +fn called() { + if false { + not_called::(); + } +} + +pub fn main() { + called::(); +} diff --git a/tests/ui/consts/required-consts/collect-in-dead-forget.rs b/tests/ui/consts/required-consts/collect-in-dead-forget.rs new file mode 100644 index 0000000000000..720b7a499f781 --- /dev/null +++ b/tests/ui/consts/required-consts/collect-in-dead-forget.rs @@ -0,0 +1,32 @@ +//@revisions: noopt opt +//@build-pass +//@[opt] compile-flags: -O +//! Make sure we detect erroneous constants post-monomorphization even when they are unused. This is +//! crucial, people rely on it for soundness. (https://github.com/rust-lang/rust/issues/112090) + +struct Fail(T); +impl Fail { + const C: () = panic!(); +} + +// This function is not actually called, but is mentioned implicitly as destructor in dead code in a +// function that is called. Make sure we still find this error. +impl Drop for Fail { + fn drop(&mut self) { + let _ = Fail::::C; + } +} + +#[inline(never)] +fn called(x: T) { + if false { + let v = Fail(x); + std::mem::forget(v); + // Now the destructor never gets "mentioned" so this build should *not* fail. + // IOW, this demonstrates that we are using a post-drop-elab notion of "mentioned". + } +} + +pub fn main() { + called::(0); +} diff --git a/tests/ui/consts/required-consts/collect-in-dead-move.noopt.stderr b/tests/ui/consts/required-consts/collect-in-dead-move.noopt.stderr new file mode 100644 index 0000000000000..8c853127e044c --- /dev/null +++ b/tests/ui/consts/required-consts/collect-in-dead-move.noopt.stderr @@ -0,0 +1,14 @@ +error[E0080]: evaluation of `Fail::::C` failed + --> $DIR/collect-in-dead-move.rs:12:19 + | +LL | const C: () = panic!(); + | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-dead-move.rs:12:19 + | + = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) + +note: the above error was encountered while instantiating `fn as std::ops::Drop>::drop` + --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/consts/required-consts/collect-in-dead-move.rs b/tests/ui/consts/required-consts/collect-in-dead-move.rs new file mode 100644 index 0000000000000..f3a6ba8a6577c --- /dev/null +++ b/tests/ui/consts/required-consts/collect-in-dead-move.rs @@ -0,0 +1,33 @@ +//@revisions: noopt opt +//@[noopt] build-fail +//@[opt] compile-flags: -O +//FIXME: `opt` revision currently does not stop with an error due to +//. +//@[opt] build-pass +//! Make sure we detect erroneous constants post-monomorphization even when they are unused. This is +//! crucial, people rely on it for soundness. (https://github.com/rust-lang/rust/issues/112090) + +struct Fail(T); +impl Fail { + const C: () = panic!(); //[noopt]~ERROR evaluation of `Fail::::C` failed +} + +// This function is not actually called, but is mentioned implicitly as destructor in dead code in a +// function that is called. Make sure we still find this error. +impl Drop for Fail { + fn drop(&mut self) { + let _ = Fail::::C; + } +} + +#[inline(never)] +fn called(x: T) { + if false { + let v = Fail(x); + drop(v); // move `v` away (and it then gets dropped there so build still fails) + } +} + +pub fn main() { + called::(0); +} diff --git a/tests/ui/consts/required-consts/collect-in-dead-vtable.noopt.stderr b/tests/ui/consts/required-consts/collect-in-dead-vtable.noopt.stderr new file mode 100644 index 0000000000000..6fd82777bd364 --- /dev/null +++ b/tests/ui/consts/required-consts/collect-in-dead-vtable.noopt.stderr @@ -0,0 +1,17 @@ +error[E0080]: evaluation of `Fail::::C` failed + --> $DIR/collect-in-dead-vtable.rs:12:19 + | +LL | const C: () = panic!(); + | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-dead-vtable.rs:12:19 + | + = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) + +note: the above error was encountered while instantiating `fn as MyTrait>::not_called` + --> $DIR/collect-in-dead-vtable.rs:35:40 + | +LL | let gen_vtable: &dyn MyTrait = &v; // vtable "appears" here + | ^^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/consts/required-consts/collect-in-dead-vtable.rs b/tests/ui/consts/required-consts/collect-in-dead-vtable.rs new file mode 100644 index 0000000000000..f21a1cc1fc2fd --- /dev/null +++ b/tests/ui/consts/required-consts/collect-in-dead-vtable.rs @@ -0,0 +1,41 @@ +//@revisions: noopt opt +//@[noopt] build-fail +//@[opt] compile-flags: -O +//FIXME: `opt` revision currently does not stop with an error due to +//. +//@[opt] build-pass +//! Make sure we detect erroneous constants post-monomorphization even when they are unused. This is +//! crucial, people rely on it for soundness. (https://github.com/rust-lang/rust/issues/112090) + +struct Fail(T); +impl Fail { + const C: () = panic!(); //[noopt]~ERROR evaluation of `Fail::::C` failed +} + +trait MyTrait { + fn not_called(&self); +} + +// This function is not actually called, but it is mentioned in a vtable in a function that is +// called. Make sure we still find this error. +// This relies on mono-item collection checking `required_consts` in functions that are referenced +// in vtables that syntactically appear in collected functions (even inside dead code). +impl MyTrait for Vec { + fn not_called(&self) { + if false { + let _ = Fail::::C; + } + } +} + +#[inline(never)] +fn called() { + if false { + let v: Vec = Vec::new(); + let gen_vtable: &dyn MyTrait = &v; // vtable "appears" here + } +} + +pub fn main() { + called::(); +} diff --git a/tests/ui/consts/required-consts/interpret-in-const-called-fn.noopt.stderr b/tests/ui/consts/required-consts/interpret-in-const-called-fn.noopt.stderr new file mode 100644 index 0000000000000..75304591b9f05 --- /dev/null +++ b/tests/ui/consts/required-consts/interpret-in-const-called-fn.noopt.stderr @@ -0,0 +1,17 @@ +error[E0080]: evaluation of `Fail::::C` failed + --> $DIR/interpret-in-const-called-fn.rs:7:19 + | +LL | const C: () = panic!(); + | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/interpret-in-const-called-fn.rs:7:19 + | + = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) + +note: erroneous constant encountered + --> $DIR/interpret-in-const-called-fn.rs:16:9 + | +LL | Fail::::C; + | ^^^^^^^^^^^^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/consts/required-consts/interpret-in-const-called-fn.opt.stderr b/tests/ui/consts/required-consts/interpret-in-const-called-fn.opt.stderr new file mode 100644 index 0000000000000..75304591b9f05 --- /dev/null +++ b/tests/ui/consts/required-consts/interpret-in-const-called-fn.opt.stderr @@ -0,0 +1,17 @@ +error[E0080]: evaluation of `Fail::::C` failed + --> $DIR/interpret-in-const-called-fn.rs:7:19 + | +LL | const C: () = panic!(); + | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/interpret-in-const-called-fn.rs:7:19 + | + = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) + +note: erroneous constant encountered + --> $DIR/interpret-in-const-called-fn.rs:16:9 + | +LL | Fail::::C; + | ^^^^^^^^^^^^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/consts/const-eval/erroneous-const.rs b/tests/ui/consts/required-consts/interpret-in-const-called-fn.rs similarity index 52% rename from tests/ui/consts/const-eval/erroneous-const.rs rename to tests/ui/consts/required-consts/interpret-in-const-called-fn.rs index 74d44c5259a3e..c409fae0bb905 100644 --- a/tests/ui/consts/const-eval/erroneous-const.rs +++ b/tests/ui/consts/required-consts/interpret-in-const-called-fn.rs @@ -1,16 +1,19 @@ +//@revisions: noopt opt +//@[opt] compile-flags: -O //! Make sure we error on erroneous consts even if they are unused. -#![allow(unconditional_panic)] -struct PrintName(T); -impl PrintName { - const VOID: () = [()][2]; //~ERROR evaluation of `PrintName::::VOID` failed +struct Fail(T); +impl Fail { + const C: () = panic!(); //~ERROR evaluation of `Fail::::C` failed } +#[inline(never)] const fn no_codegen() { if false { // This bad constant is only used in dead code in a no-codegen function... and yet we still // must make sure that the build fails. - PrintName::::VOID; //~ constant + // This relies on const-eval evaluating all `required_consts` of `const fn`. + Fail::::C; //~ constant } } diff --git a/tests/ui/consts/required-consts/interpret-in-promoted.noopt.stderr b/tests/ui/consts/required-consts/interpret-in-promoted.noopt.stderr new file mode 100644 index 0000000000000..491131daf8de4 --- /dev/null +++ b/tests/ui/consts/required-consts/interpret-in-promoted.noopt.stderr @@ -0,0 +1,27 @@ +error[E0080]: evaluation of constant value failed + --> $SRC_DIR/core/src/hint.rs:LL:COL + | + = note: entering unreachable code + | +note: inside `unreachable_unchecked` + --> $SRC_DIR/core/src/hint.rs:LL:COL +note: inside `ub` + --> $DIR/interpret-in-promoted.rs:6:5 + | +LL | std::hint::unreachable_unchecked(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: inside `FOO` + --> $DIR/interpret-in-promoted.rs:12:28 + | +LL | let _x: &'static () = &ub(); + | ^^^^ + +note: erroneous constant encountered + --> $DIR/interpret-in-promoted.rs:12:27 + | +LL | let _x: &'static () = &ub(); + | ^^^^^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/consts/required-consts/interpret-in-promoted.opt.stderr b/tests/ui/consts/required-consts/interpret-in-promoted.opt.stderr new file mode 100644 index 0000000000000..491131daf8de4 --- /dev/null +++ b/tests/ui/consts/required-consts/interpret-in-promoted.opt.stderr @@ -0,0 +1,27 @@ +error[E0080]: evaluation of constant value failed + --> $SRC_DIR/core/src/hint.rs:LL:COL + | + = note: entering unreachable code + | +note: inside `unreachable_unchecked` + --> $SRC_DIR/core/src/hint.rs:LL:COL +note: inside `ub` + --> $DIR/interpret-in-promoted.rs:6:5 + | +LL | std::hint::unreachable_unchecked(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: inside `FOO` + --> $DIR/interpret-in-promoted.rs:12:28 + | +LL | let _x: &'static () = &ub(); + | ^^^^ + +note: erroneous constant encountered + --> $DIR/interpret-in-promoted.rs:12:27 + | +LL | let _x: &'static () = &ub(); + | ^^^^^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/consts/required-consts/interpret-in-promoted.rs b/tests/ui/consts/required-consts/interpret-in-promoted.rs new file mode 100644 index 0000000000000..9c2cf4e70d3fb --- /dev/null +++ b/tests/ui/consts/required-consts/interpret-in-promoted.rs @@ -0,0 +1,15 @@ +//@revisions: noopt opt +//@[opt] compile-flags: -O +//! Make sure we error on erroneous consts even if they are unused. + +const unsafe fn ub() { + std::hint::unreachable_unchecked(); +} + +pub const FOO: () = unsafe { + // Make sure that this gets promoted and then fails to evaluate, and we deal with that + // correctly. + let _x: &'static () = &ub(); //~ erroneous constant +}; + +fn main() {} diff --git a/tests/ui/consts/required-consts/interpret-in-static.noopt.stderr b/tests/ui/consts/required-consts/interpret-in-static.noopt.stderr new file mode 100644 index 0000000000000..159c9449fc041 --- /dev/null +++ b/tests/ui/consts/required-consts/interpret-in-static.noopt.stderr @@ -0,0 +1,17 @@ +error[E0080]: evaluation of `Fail::::C` failed + --> $DIR/interpret-in-static.rs:7:19 + | +LL | const C: () = panic!(); + | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/interpret-in-static.rs:7:19 + | + = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) + +note: erroneous constant encountered + --> $DIR/interpret-in-static.rs:15:9 + | +LL | Fail::::C; + | ^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/consts/required-consts/interpret-in-static.opt.stderr b/tests/ui/consts/required-consts/interpret-in-static.opt.stderr new file mode 100644 index 0000000000000..159c9449fc041 --- /dev/null +++ b/tests/ui/consts/required-consts/interpret-in-static.opt.stderr @@ -0,0 +1,17 @@ +error[E0080]: evaluation of `Fail::::C` failed + --> $DIR/interpret-in-static.rs:7:19 + | +LL | const C: () = panic!(); + | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/interpret-in-static.rs:7:19 + | + = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) + +note: erroneous constant encountered + --> $DIR/interpret-in-static.rs:15:9 + | +LL | Fail::::C; + | ^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/consts/required-consts/interpret-in-static.rs b/tests/ui/consts/required-consts/interpret-in-static.rs new file mode 100644 index 0000000000000..559e281b2b038 --- /dev/null +++ b/tests/ui/consts/required-consts/interpret-in-static.rs @@ -0,0 +1,21 @@ +//@revisions: noopt opt +//@[opt] compile-flags: -O +//! Make sure we error on erroneous consts even if they are unused. + +struct Fail(T); +impl Fail { + const C: () = panic!(); //~ERROR evaluation of `Fail::::C` failed +} + +pub static FOO: () = { + if false { + // This bad constant is only used in dead code in a static initializer... and yet we still + // must make sure that the build fails. + // This relies on const-eval evaluating all `required_consts` of the `static` MIR body. + Fail::::C; //~ constant + } +}; + +fn main() { + FOO +} diff --git a/tests/ui/lint/invalid_value.stderr b/tests/ui/lint/invalid_value.stderr index 955d01bd5d904..b4e7421829f82 100644 --- a/tests/ui/lint/invalid_value.stderr +++ b/tests/ui/lint/invalid_value.stderr @@ -320,23 +320,19 @@ error: the type `(NonZero, i32)` does not permit zero-initialization --> $DIR/invalid_value.rs:94:41 | LL | let _val: (NonZero, i32) = mem::zeroed(); - | ^^^^^^^^^^^^^ - | | - | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done + | ^^^^^^^^^^^^^ this code causes undefined behavior when executed | = note: `std::num::NonZero` must be non-null + = note: because `core::num::nonzero::private::NonZeroU32Inner` must be non-null error: the type `(NonZero, i32)` does not permit being left uninitialized --> $DIR/invalid_value.rs:95:41 | LL | let _val: (NonZero, i32) = mem::uninitialized(); - | ^^^^^^^^^^^^^^^^^^^^ - | | - | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done + | ^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed | = note: `std::num::NonZero` must be non-null + = note: because `core::num::nonzero::private::NonZeroU32Inner` must be non-null = note: integers must be initialized error: the type `*const dyn Send` does not permit zero-initialization @@ -411,10 +407,7 @@ error: the type `OneFruitNonZero` does not permit zero-initialization --> $DIR/invalid_value.rs:106:37 | LL | let _val: OneFruitNonZero = mem::zeroed(); - | ^^^^^^^^^^^^^ - | | - | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done + | ^^^^^^^^^^^^^ this code causes undefined behavior when executed | = note: `OneFruitNonZero` must be non-null note: because `std::num::NonZero` must be non-null (in this field of the only potentially inhabited enum variant) @@ -422,15 +415,13 @@ note: because `std::num::NonZero` must be non-null (in this field of the on | LL | Banana(NonZero), | ^^^^^^^^^^^^ + = note: because `core::num::nonzero::private::NonZeroU32Inner` must be non-null error: the type `OneFruitNonZero` does not permit being left uninitialized --> $DIR/invalid_value.rs:107:37 | LL | let _val: OneFruitNonZero = mem::uninitialized(); - | ^^^^^^^^^^^^^^^^^^^^ - | | - | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done + | ^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed | = note: `OneFruitNonZero` must be non-null note: because `std::num::NonZero` must be non-null (in this field of the only potentially inhabited enum variant) @@ -438,6 +429,7 @@ note: because `std::num::NonZero` must be non-null (in this field of the on | LL | Banana(NonZero), | ^^^^^^^^^^^^ + = note: because `core::num::nonzero::private::NonZeroU32Inner` must be non-null = note: integers must be initialized error: the type `bool` does not permit being left uninitialized @@ -607,12 +599,10 @@ error: the type `NonZero` does not permit zero-initialization --> $DIR/invalid_value.rs:153:34 | LL | let _val: NonZero = mem::transmute(0); - | ^^^^^^^^^^^^^^^^^ - | | - | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done + | ^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed | = note: `std::num::NonZero` must be non-null + = note: because `core::num::nonzero::private::NonZeroU32Inner` must be non-null error: the type `NonNull` does not permit zero-initialization --> $DIR/invalid_value.rs:156:34 diff --git a/tests/ui/print_type_sizes/niche-filling.stdout b/tests/ui/print_type_sizes/niche-filling.stdout index 53a58ccc4eef8..eeb5de5324121 100644 --- a/tests/ui/print_type_sizes/niche-filling.stdout +++ b/tests/ui/print_type_sizes/niche-filling.stdout @@ -68,6 +68,8 @@ print-type-size type: `Union2, u32>`: 4 bytes, alignment: print-type-size variant `Union2`: 4 bytes print-type-size field `.a`: 4 bytes print-type-size field `.b`: 4 bytes, offset: 0 bytes, alignment: 4 bytes +print-type-size type: `core::num::nonzero::private::NonZeroU32Inner`: 4 bytes, alignment: 4 bytes +print-type-size field `.0`: 4 bytes print-type-size type: `std::num::NonZero`: 4 bytes, alignment: 4 bytes print-type-size field `.0`: 4 bytes print-type-size type: `std::option::Option>`: 4 bytes, alignment: 4 bytes