diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index d23682596fd3..663ace48e9e8 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -20,3 +20,6 @@ f97fddab91fbf290ea5b691fe355d6f915220b6e cc907f80b95c6ec530c5ee1b05b044a468f07eca # format let-chains b2d2184edea578109a48ec3d8decbee5948e8f35 +# test directives migration +6e48b96692d63a79a14563f27fe5185f122434f8 +ec2cc761bc7067712ecc7734502f703fe3b024c8 diff --git a/Cargo.lock b/Cargo.lock index a6e016afd82d..8518bb2a91f1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1224,19 +1224,6 @@ dependencies = [ "regex", ] -[[package]] -name = "env_logger" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cd405aab171cb85d6735e5c8d9db038c17d3ca007a4d2c25f337935c3d90580" -dependencies = [ - "humantime", - "is-terminal", - "log", - "regex", - "termcolor", -] - [[package]] name = "env_logger" version = "0.11.2" @@ -2058,17 +2045,6 @@ version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" -[[package]] -name = "is-terminal" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f23ff5ef2b80d608d61efee834934d862cd92461afc0560dedf493e4c033738b" -dependencies = [ - "hermit-abi", - "libc", - "windows-sys 0.52.0", -] - [[package]] name = "itertools" version = "0.11.0" @@ -2364,7 +2340,7 @@ dependencies = [ "clap", "clap_complete", "elasticlunr-rs", - "env_logger 0.11.2", + "env_logger", "handlebars", "log", "memchr", @@ -2709,7 +2685,7 @@ dependencies = [ "camino", "clap", "derive_builder", - "env_logger 0.10.2", + "env_logger", "fs_extra", "glob", "humansize", @@ -2788,9 +2764,9 @@ dependencies = [ [[package]] name = "papergrid" -version = "0.10.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2ccbe15f2b6db62f9a9871642746427e297b0ceb85f9a7f1ee5ff47d184d0c8" +checksum = "9ad43c07024ef767f9160710b3a6773976194758c7919b17e63b863db0bdf7fb" dependencies = [ "bytecount", "fnv", @@ -3326,7 +3302,7 @@ name = "rustbook" version = "0.1.0" dependencies = [ "clap", - "env_logger 0.10.2", + "env_logger", "mdbook", ] @@ -5271,16 +5247,16 @@ dependencies = [ [[package]] name = "sysinfo" -version = "0.29.11" +version = "0.30.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd727fc423c2060f6c92d9534cef765c65a6ed3f428a03d7def74a8c4348e666" +checksum = "1fb4f3438c8f6389c864e61221cbc97e9bca98b4daf39a5beb7bea660f528bb2" dependencies = [ "cfg-if", "core-foundation-sys", "libc", "ntapi", "once_cell", - "winapi", + "windows", ] [[package]] @@ -5315,9 +5291,9 @@ dependencies = [ [[package]] name = "tabled" -version = "0.13.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d38d39c754ae037a9bc3ca1580a985db7371cd14f1229172d1db9093feb6739" +checksum = "4c998b0c8b921495196a48aabaf1901ff28be0760136e31604f7967b0792050e" dependencies = [ "papergrid", "unicode-width", diff --git a/compiler/rustc_ast_lowering/src/delegation.rs b/compiler/rustc_ast_lowering/src/delegation.rs index d1ba93f06755..77dd03d15f52 100644 --- a/compiler/rustc_ast_lowering/src/delegation.rs +++ b/compiler/rustc_ast_lowering/src/delegation.rs @@ -138,7 +138,7 @@ impl<'hir> LoweringContext<'_, 'hir> { } else { self.tcx.fn_arg_names(sig_id).len() }; - let inputs = self.arena.alloc_from_iter((0..args_count).into_iter().map(|arg| hir::Ty { + let inputs = self.arena.alloc_from_iter((0..args_count).map(|arg| hir::Ty { hir_id: self.next_id(), kind: hir::TyKind::InferDelegation(sig_id, hir::InferDelegationKind::Input(arg)), span: self.lower_span(param_span), diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index ef843da7307d..a5be91bb8720 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -1636,7 +1636,9 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { if let Some(old_def_id) = self.orig_opt_local_def_id(param) { old_def_id } else { - self.dcx().span_bug(lifetime.ident.span, "no def-id for fresh lifetime"); + self.dcx() + .span_delayed_bug(lifetime.ident.span, "no def-id for fresh lifetime"); + continue; } } diff --git a/compiler/rustc_borrowck/messages.ftl b/compiler/rustc_borrowck/messages.ftl index 8c5a1d897092..bf14d5eb9a0a 100644 --- a/compiler/rustc_borrowck/messages.ftl +++ b/compiler/rustc_borrowck/messages.ftl @@ -163,7 +163,13 @@ borrowck_returned_lifetime_wrong = borrowck_returned_ref_escaped = returns a reference to a captured variable which escapes the closure body -borrowck_simd_shuffle_last_const = last argument of `simd_shuffle` is required to be a `const` item +borrowck_simd_intrinsic_arg_const = + {$arg -> + [1] 1st + [2] 2nd + [3] 3rd + *[other] {$arg}th + } argument of `{$intrinsic}` is required to be a `const` item borrowck_suggest_create_freash_reborrow = consider reborrowing the `Pin` instead of moving it diff --git a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs index e1509da913a5..3c6bd1d36fd3 100644 --- a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs @@ -1559,7 +1559,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { // A bare path doesn't need a `let` assignment, it's already a simple // binding access. // As a new binding wasn't added, we don't need to modify the advancing call. - sugg.push((loop_span.with_hi(pat_span.lo()), format!("while let Some("))); + sugg.push((loop_span.with_hi(pat_span.lo()), "while let Some(".to_string())); sugg.push(( pat_span.shrink_to_hi().with_hi(head.span.lo()), ") = ".to_string(), diff --git a/compiler/rustc_borrowck/src/diagnostics/outlives_suggestion.rs b/compiler/rustc_borrowck/src/diagnostics/outlives_suggestion.rs index b2c7a98142ee..6beae61ca7f0 100644 --- a/compiler/rustc_borrowck/src/diagnostics/outlives_suggestion.rs +++ b/compiler/rustc_borrowck/src/diagnostics/outlives_suggestion.rs @@ -134,14 +134,13 @@ impl OutlivesSuggestionBuilder { for (r, bound) in unified.into_iter() { if !unified_already.contains(fr) { - suggested.push(SuggestedConstraint::Equal(fr_name.clone(), bound)); + suggested.push(SuggestedConstraint::Equal(fr_name, bound)); unified_already.insert(r); } } if !other.is_empty() { - let other = - other.iter().map(|(_, rname)| rname.clone()).collect::>(); + let other = other.iter().map(|(_, rname)| *rname).collect::>(); suggested.push(SuggestedConstraint::Outlives(fr_name, other)) } } diff --git a/compiler/rustc_borrowck/src/diagnostics/region_errors.rs b/compiler/rustc_borrowck/src/diagnostics/region_errors.rs index 50d22881c3e6..e586c58781cf 100644 --- a/compiler/rustc_borrowck/src/diagnostics/region_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/region_errors.rs @@ -280,7 +280,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { .iter() .rfind(|param| param.def_id.to_def_id() == defid) .is_some() { - suggestions.push((bounded_span.shrink_to_hi(), format!(" + 'static"))); + suggestions.push((bounded_span.shrink_to_hi(), " + 'static".to_string())); } }); }); diff --git a/compiler/rustc_borrowck/src/region_infer/opaque_types.rs b/compiler/rustc_borrowck/src/region_infer/opaque_types.rs index a5a906658b89..4b096a592344 100644 --- a/compiler/rustc_borrowck/src/region_infer/opaque_types.rs +++ b/compiler/rustc_borrowck/src/region_infer/opaque_types.rs @@ -153,12 +153,14 @@ impl<'tcx> RegionInferenceContext<'tcx> { if let Some(prev) = result.get_mut(&opaque_type_key.def_id) { if prev.ty != ty { let guar = ty.error_reported().err().unwrap_or_else(|| { - prev.report_mismatch( - &OpaqueHiddenType { ty, span: concrete_type.span }, - opaque_type_key.def_id, - infcx.tcx, - ) - .emit() + let (Ok(e) | Err(e)) = prev + .build_mismatch_error( + &OpaqueHiddenType { ty, span: concrete_type.span }, + opaque_type_key.def_id, + infcx.tcx, + ) + .map(|d| d.emit()); + e }); prev.ty = Ty::new_error(infcx.tcx, guar); } diff --git a/compiler/rustc_borrowck/src/session_diagnostics.rs b/compiler/rustc_borrowck/src/session_diagnostics.rs index 1685624f2477..a055ce95e8ef 100644 --- a/compiler/rustc_borrowck/src/session_diagnostics.rs +++ b/compiler/rustc_borrowck/src/session_diagnostics.rs @@ -454,8 +454,10 @@ pub(crate) enum TypeNoCopy<'a, 'tcx> { } #[derive(Diagnostic)] -#[diag(borrowck_simd_shuffle_last_const)] -pub(crate) struct SimdShuffleLastConst { +#[diag(borrowck_simd_intrinsic_arg_const)] +pub(crate) struct SimdIntrinsicArgConst { #[primary_span] pub span: Span, + pub arg: usize, + pub intrinsic: String, } diff --git a/compiler/rustc_borrowck/src/type_check/mod.rs b/compiler/rustc_borrowck/src/type_check/mod.rs index 81193902f9b3..75cc28bcab0b 100644 --- a/compiler/rustc_borrowck/src/type_check/mod.rs +++ b/compiler/rustc_borrowck/src/type_check/mod.rs @@ -49,7 +49,7 @@ use rustc_mir_dataflow::impls::MaybeInitializedPlaces; use rustc_mir_dataflow::move_paths::MoveData; use rustc_mir_dataflow::ResultsCursor; -use crate::session_diagnostics::{MoveUnsized, SimdShuffleLastConst}; +use crate::session_diagnostics::{MoveUnsized, SimdIntrinsicArgConst}; use crate::{ borrow_set::BorrowSet, constraints::{OutlivesConstraint, OutlivesConstraintSet}, @@ -1664,9 +1664,22 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> { let func_ty = func.ty(body, self.infcx.tcx); if let ty::FnDef(def_id, _) = *func_ty.kind() { - if let Some(sym::simd_shuffle) = self.tcx().intrinsic(def_id) { - if !matches!(args[2], Spanned { node: Operand::Constant(_), .. }) { - self.tcx().dcx().emit_err(SimdShuffleLastConst { span: term.source_info.span }); + // Some of the SIMD intrinsics are special: they need a particular argument to be a constant. + // (Eventually this should use const-generics, but those are not up for the task yet: + // https://github.com/rust-lang/rust/issues/85229.) + if let Some(name @ (sym::simd_shuffle | sym::simd_insert | sym::simd_extract)) = + self.tcx().intrinsic(def_id) + { + let idx = match name { + sym::simd_shuffle => 2, + _ => 1, + }; + if !matches!(args[idx], Spanned { node: Operand::Constant(_), .. }) { + self.tcx().dcx().emit_err(SimdIntrinsicArgConst { + span: term.source_info.span, + arg: idx + 1, + intrinsic: name.to_string(), + }); } } } diff --git a/compiler/rustc_borrowck/src/type_check/relate_tys.rs b/compiler/rustc_borrowck/src/type_check/relate_tys.rs index dd355c3525c3..61b803ea38d4 100644 --- a/compiler/rustc_borrowck/src/type_check/relate_tys.rs +++ b/compiler/rustc_borrowck/src/type_check/relate_tys.rs @@ -123,7 +123,11 @@ impl<'me, 'bccx, 'tcx> NllTypeRelating<'me, 'bccx, 'tcx> { // `handle_opaque_type` cannot handle subtyping, so to support subtyping // we instead eagerly generalize here. This is a bit of a mess but will go // away once we're using the new solver. - let mut enable_subtyping = |ty, ty_is_expected| { + // + // Given `opaque rel B`, we create a new infer var `ty_vid` constrain it + // by using `ty_vid rel B` and then finally and end by equating `ty_vid` to + // the opaque. + let mut enable_subtyping = |ty, opaque_is_expected| { let ty_vid = infcx.next_ty_var_id_in_universe( TypeVariableOrigin { kind: TypeVariableOriginKind::MiscVariable, @@ -132,7 +136,7 @@ impl<'me, 'bccx, 'tcx> NllTypeRelating<'me, 'bccx, 'tcx> { ty::UniverseIndex::ROOT, ); - let variance = if ty_is_expected { + let variance = if opaque_is_expected { self.ambient_variance } else { self.ambient_variance.xform(ty::Contravariant) @@ -140,7 +144,7 @@ impl<'me, 'bccx, 'tcx> NllTypeRelating<'me, 'bccx, 'tcx> { self.type_checker.infcx.instantiate_ty_var( self, - ty_is_expected, + opaque_is_expected, ty_vid, variance, ty, @@ -149,8 +153,8 @@ impl<'me, 'bccx, 'tcx> NllTypeRelating<'me, 'bccx, 'tcx> { }; let (a, b) = match (a.kind(), b.kind()) { - (&ty::Alias(ty::Opaque, ..), _) => (a, enable_subtyping(b, false)?), - (_, &ty::Alias(ty::Opaque, ..)) => (enable_subtyping(a, true)?, b), + (&ty::Alias(ty::Opaque, ..), _) => (a, enable_subtyping(b, true)?), + (_, &ty::Alias(ty::Opaque, ..)) => (enable_subtyping(a, false)?, b), _ => unreachable!( "expected at least one opaque type in `relate_opaques`, got {a} and {b}." ), diff --git a/compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs b/compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs index ebdc744bcd83..8f662808522b 100644 --- a/compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs +++ b/compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs @@ -743,7 +743,7 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>( simd_reduce(fx, v, None, ret, &|fx, _ty, a, b| fx.bcx.ins().bxor(a, b)); } - sym::simd_reduce_min | sym::simd_reduce_min_nanless => { + sym::simd_reduce_min => { intrinsic_args!(fx, args => (v); intrinsic); if !v.layout().ty.is_simd() { @@ -762,7 +762,7 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>( }); } - sym::simd_reduce_max | sym::simd_reduce_max_nanless => { + sym::simd_reduce_max => { intrinsic_args!(fx, args => (v); intrinsic); if !v.layout().ty.is_simd() { diff --git a/compiler/rustc_codegen_gcc/src/builder.rs b/compiler/rustc_codegen_gcc/src/builder.rs index 5f1e45383765..7e2139866f49 100644 --- a/compiler/rustc_codegen_gcc/src/builder.rs +++ b/compiler/rustc_codegen_gcc/src/builder.rs @@ -1752,7 +1752,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> { self.vector_reduce(src, |a, b, context| context.new_binary_op(None, op, a.get_type(), a, b)) } - pub fn vector_reduce_fadd_fast(&mut self, _acc: RValue<'gcc>, _src: RValue<'gcc>) -> RValue<'gcc> { + pub fn vector_reduce_fadd_reassoc(&mut self, _acc: RValue<'gcc>, _src: RValue<'gcc>) -> RValue<'gcc> { unimplemented!(); } @@ -1772,7 +1772,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> { unimplemented!(); } - pub fn vector_reduce_fmul_fast(&mut self, _acc: RValue<'gcc>, _src: RValue<'gcc>) -> RValue<'gcc> { + pub fn vector_reduce_fmul_reassoc(&mut self, _acc: RValue<'gcc>, _src: RValue<'gcc>) -> RValue<'gcc> { unimplemented!(); } diff --git a/compiler/rustc_codegen_gcc/src/intrinsic/simd.rs b/compiler/rustc_codegen_gcc/src/intrinsic/simd.rs index 9fa978cd2ef7..d8091724d864 100644 --- a/compiler/rustc_codegen_gcc/src/intrinsic/simd.rs +++ b/compiler/rustc_codegen_gcc/src/intrinsic/simd.rs @@ -989,14 +989,14 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>( arith_red!( simd_reduce_add_unordered: BinaryOp::Plus, - vector_reduce_fadd_fast, + vector_reduce_fadd_reassoc, false, add, 0.0 // TODO: Use this argument. ); arith_red!( simd_reduce_mul_unordered: BinaryOp::Mult, - vector_reduce_fmul_fast, + vector_reduce_fmul_reassoc, false, mul, 1.0 @@ -1041,9 +1041,6 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>( minmax_red!(simd_reduce_min: vector_reduce_min, vector_reduce_fmin); minmax_red!(simd_reduce_max: vector_reduce_max, vector_reduce_fmax); - // TODO(sadlerap): revisit these intrinsics to generate more optimal reductions - minmax_red!(simd_reduce_min_nanless: vector_reduce_min, vector_reduce_fmin); - minmax_red!(simd_reduce_max_nanless: vector_reduce_max, vector_reduce_fmax); macro_rules! bitwise_red { ($name:ident : $op:expr, $boolean:expr) => { diff --git a/compiler/rustc_codegen_llvm/src/back/archive.rs b/compiler/rustc_codegen_llvm/src/back/archive.rs index 67bc86e4c902..b6bbc81732ee 100644 --- a/compiler/rustc_codegen_llvm/src/back/archive.rs +++ b/compiler/rustc_codegen_llvm/src/back/archive.rs @@ -313,7 +313,7 @@ fn get_llvm_object_symbols( llvm::LLVMRustGetSymbols( buf.as_ptr(), buf.len(), - &mut *state as *mut &mut _ as *mut c_void, + std::ptr::addr_of_mut!(*state) as *mut c_void, callback, error_callback, ) diff --git a/compiler/rustc_codegen_llvm/src/builder.rs b/compiler/rustc_codegen_llvm/src/builder.rs index cfa266720d2a..8cab2a3f27c1 100644 --- a/compiler/rustc_codegen_llvm/src/builder.rs +++ b/compiler/rustc_codegen_llvm/src/builder.rs @@ -1367,17 +1367,17 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> { pub fn vector_reduce_fmul(&mut self, acc: &'ll Value, src: &'ll Value) -> &'ll Value { unsafe { llvm::LLVMRustBuildVectorReduceFMul(self.llbuilder, acc, src) } } - pub fn vector_reduce_fadd_algebraic(&mut self, acc: &'ll Value, src: &'ll Value) -> &'ll Value { + pub fn vector_reduce_fadd_reassoc(&mut self, acc: &'ll Value, src: &'ll Value) -> &'ll Value { unsafe { let instr = llvm::LLVMRustBuildVectorReduceFAdd(self.llbuilder, acc, src); - llvm::LLVMRustSetAlgebraicMath(instr); + llvm::LLVMRustSetAllowReassoc(instr); instr } } - pub fn vector_reduce_fmul_algebraic(&mut self, acc: &'ll Value, src: &'ll Value) -> &'ll Value { + pub fn vector_reduce_fmul_reassoc(&mut self, acc: &'ll Value, src: &'ll Value) -> &'ll Value { unsafe { let instr = llvm::LLVMRustBuildVectorReduceFMul(self.llbuilder, acc, src); - llvm::LLVMRustSetAlgebraicMath(instr); + llvm::LLVMRustSetAllowReassoc(instr); instr } } @@ -1406,22 +1406,6 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> { llvm::LLVMRustBuildVectorReduceFMax(self.llbuilder, src, /*NoNaNs:*/ false) } } - pub fn vector_reduce_fmin_fast(&mut self, src: &'ll Value) -> &'ll Value { - unsafe { - let instr = - llvm::LLVMRustBuildVectorReduceFMin(self.llbuilder, src, /*NoNaNs:*/ true); - llvm::LLVMRustSetFastMath(instr); - instr - } - } - pub fn vector_reduce_fmax_fast(&mut self, src: &'ll Value) -> &'ll Value { - unsafe { - let instr = - llvm::LLVMRustBuildVectorReduceFMax(self.llbuilder, src, /*NoNaNs:*/ true); - llvm::LLVMRustSetFastMath(instr); - instr - } - } pub fn vector_reduce_min(&mut self, src: &'ll Value, is_signed: bool) -> &'ll Value { unsafe { llvm::LLVMRustBuildVectorReduceMin(self.llbuilder, src, is_signed) } } diff --git a/compiler/rustc_codegen_llvm/src/errors.rs b/compiler/rustc_codegen_llvm/src/errors.rs index 87e3774068bc..24b3aa4223a4 100644 --- a/compiler/rustc_codegen_llvm/src/errors.rs +++ b/compiler/rustc_codegen_llvm/src/errors.rs @@ -103,8 +103,7 @@ impl IntoDiagnostic<'_, G> for ParseTargetMachineConfig<'_ fn into_diagnostic(self, dcx: &'_ DiagCtxt, level: Level) -> DiagnosticBuilder<'_, G> { let diag: DiagnosticBuilder<'_, G> = self.0.into_diagnostic(dcx, level); let (message, _) = diag.messages.first().expect("`LlvmError` with no message"); - let message = dcx.eagerly_translate_to_string(message.clone(), diag.args()); - + let message = dcx.eagerly_translate_to_string(message.clone(), diag.args.iter()); DiagnosticBuilder::new(dcx, level, fluent::codegen_llvm_parse_target_machine_config) .with_arg("error", message) } diff --git a/compiler/rustc_codegen_llvm/src/intrinsic.rs b/compiler/rustc_codegen_llvm/src/intrinsic.rs index 3b091fca28bc..1eac2157cac3 100644 --- a/compiler/rustc_codegen_llvm/src/intrinsic.rs +++ b/compiler/rustc_codegen_llvm/src/intrinsic.rs @@ -1079,7 +1079,7 @@ fn generic_simd_intrinsic<'ll, 'tcx>( .map(|(arg_idx, val)| { let idx = val.unwrap_leaf().try_to_i32().unwrap(); if idx >= i32::try_from(total_len).unwrap() { - bx.sess().dcx().emit_err(InvalidMonomorphization::ShuffleIndexOutOfBounds { + bx.sess().dcx().emit_err(InvalidMonomorphization::SimdIndexOutOfBounds { span, name, arg_idx: arg_idx as u64, @@ -1138,24 +1138,15 @@ fn generic_simd_intrinsic<'ll, 'tcx>( let val = bx.const_get_elt(vector, i as u64); match bx.const_to_opt_u128(val, true) { None => { - bx.sess().dcx().emit_err( - InvalidMonomorphization::ShuffleIndexNotConstant { - span, - name, - arg_idx, - }, - ); - None + bug!("typeck should have already ensured that these are const") } Some(idx) if idx >= total_len => { - bx.sess().dcx().emit_err( - InvalidMonomorphization::ShuffleIndexOutOfBounds { - span, - name, - arg_idx, - total_len, - }, - ); + bx.sess().dcx().emit_err(InvalidMonomorphization::SimdIndexOutOfBounds { + span, + name, + arg_idx, + total_len, + }); None } Some(idx) => Some(bx.const_i32(idx as i32)), @@ -1184,10 +1175,22 @@ fn generic_simd_intrinsic<'ll, 'tcx>( out_ty: arg_tys[2] } ); + let idx = bx + .const_to_opt_u128(args[1].immediate(), false) + .expect("typeck should have ensure that this is a const"); + if idx >= in_len.into() { + bx.sess().dcx().emit_err(InvalidMonomorphization::SimdIndexOutOfBounds { + span, + name, + arg_idx: 1, + total_len: in_len.into(), + }); + return Ok(bx.const_null(llret_ty)); + } return Ok(bx.insert_element( args[0].immediate(), args[2].immediate(), - args[1].immediate(), + bx.const_i32(idx as i32), )); } if name == sym::simd_extract { @@ -1195,7 +1198,19 @@ fn generic_simd_intrinsic<'ll, 'tcx>( ret_ty == in_elem, InvalidMonomorphization::ReturnType { span, name, in_elem, in_ty, ret_ty } ); - return Ok(bx.extract_element(args[0].immediate(), args[1].immediate())); + let idx = bx + .const_to_opt_u128(args[1].immediate(), false) + .expect("typeck should have ensure that this is a const"); + if idx >= in_len.into() { + bx.sess().dcx().emit_err(InvalidMonomorphization::SimdIndexOutOfBounds { + span, + name, + arg_idx: 1, + total_len: in_len.into(), + }); + return Ok(bx.const_null(llret_ty)); + } + return Ok(bx.extract_element(args[0].immediate(), bx.const_i32(idx as i32))); } if name == sym::simd_select { @@ -1880,14 +1895,14 @@ fn generic_simd_intrinsic<'ll, 'tcx>( arith_red!(simd_reduce_mul_ordered: vector_reduce_mul, vector_reduce_fmul, true, mul, 1.0); arith_red!( simd_reduce_add_unordered: vector_reduce_add, - vector_reduce_fadd_algebraic, + vector_reduce_fadd_reassoc, false, add, 0.0 ); arith_red!( simd_reduce_mul_unordered: vector_reduce_mul, - vector_reduce_fmul_algebraic, + vector_reduce_fmul_reassoc, false, mul, 1.0 @@ -1920,9 +1935,6 @@ fn generic_simd_intrinsic<'ll, 'tcx>( minmax_red!(simd_reduce_min: vector_reduce_min, vector_reduce_fmin); minmax_red!(simd_reduce_max: vector_reduce_max, vector_reduce_fmax); - minmax_red!(simd_reduce_min_nanless: vector_reduce_min, vector_reduce_fmin_fast); - minmax_red!(simd_reduce_max_nanless: vector_reduce_max, vector_reduce_fmax_fast); - macro_rules! bitwise_red { ($name:ident : $red:ident, $boolean:expr) => { if name == sym::$name { diff --git a/compiler/rustc_codegen_llvm/src/lib.rs b/compiler/rustc_codegen_llvm/src/lib.rs index 35210b0b2e86..c84461e53eb1 100644 --- a/compiler/rustc_codegen_llvm/src/lib.rs +++ b/compiler/rustc_codegen_llvm/src/lib.rs @@ -169,7 +169,7 @@ impl WriteBackendMethods for LlvmCodegenBackend { fn print_pass_timings(&self) { unsafe { let mut size = 0; - let cstr = llvm::LLVMRustPrintPassTimings(&mut size as *mut usize); + let cstr = llvm::LLVMRustPrintPassTimings(std::ptr::addr_of_mut!(size)); if cstr.is_null() { println!("failed to get pass timings"); } else { @@ -182,7 +182,7 @@ impl WriteBackendMethods for LlvmCodegenBackend { fn print_statistics(&self) { unsafe { let mut size = 0; - let cstr = llvm::LLVMRustPrintStatistics(&mut size as *mut usize); + let cstr = llvm::LLVMRustPrintStatistics(std::ptr::addr_of_mut!(size)); if cstr.is_null() { println!("failed to get pass stats"); } else { diff --git a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs index f9eb1da5dc7a..dbf35e5f4995 100644 --- a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs +++ b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs @@ -1619,6 +1619,7 @@ extern "C" { pub fn LLVMRustSetFastMath(Instr: &Value); pub fn LLVMRustSetAlgebraicMath(Instr: &Value); + pub fn LLVMRustSetAllowReassoc(Instr: &Value); // Miscellaneous instructions pub fn LLVMRustGetInstrProfIncrementIntrinsic(M: &Module) -> &Value; diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs b/compiler/rustc_codegen_llvm/src/llvm_util.rs index 54e8ed85e325..1b2beac56a20 100644 --- a/compiler/rustc_codegen_llvm/src/llvm_util.rs +++ b/compiler/rustc_codegen_llvm/src/llvm_util.rs @@ -435,7 +435,7 @@ pub(crate) fn print(req: &PrintRequest, mut out: &mut dyn PrintBackendInfo, sess &tm, cpu_cstring.as_ptr(), callback, - &mut out as *mut &mut dyn PrintBackendInfo as *mut c_void, + std::ptr::addr_of_mut!(out) as *mut c_void, ); } } diff --git a/compiler/rustc_codegen_ssa/messages.ftl b/compiler/rustc_codegen_ssa/messages.ftl index fa7719d89716..5ba66d1be432 100644 --- a/compiler/rustc_codegen_ssa/messages.ftl +++ b/compiler/rustc_codegen_ssa/messages.ftl @@ -106,14 +106,12 @@ codegen_ssa_invalid_monomorphization_return_type = invalid monomorphization of ` codegen_ssa_invalid_monomorphization_second_argument_length = invalid monomorphization of `{$name}` intrinsic: expected second argument with length {$in_len} (same as input type `{$in_ty}`), found `{$arg_ty}` with length {$out_len} -codegen_ssa_invalid_monomorphization_shuffle_index_not_constant = invalid monomorphization of `{$name}` intrinsic: shuffle index #{$arg_idx} is not a constant - -codegen_ssa_invalid_monomorphization_shuffle_index_out_of_bounds = invalid monomorphization of `{$name}` intrinsic: shuffle index #{$arg_idx} is out of bounds (limit {$total_len}) - codegen_ssa_invalid_monomorphization_simd_argument = invalid monomorphization of `{$name}` intrinsic: expected SIMD argument type, found non-SIMD `{$ty}` codegen_ssa_invalid_monomorphization_simd_first = invalid monomorphization of `{$name}` intrinsic: expected SIMD first type, found non-SIMD `{$ty}` +codegen_ssa_invalid_monomorphization_simd_index_out_of_bounds = invalid monomorphization of `{$name}` intrinsic: SIMD index #{$arg_idx} is out of bounds (limit {$total_len}) + codegen_ssa_invalid_monomorphization_simd_input = invalid monomorphization of `{$name}` intrinsic: expected SIMD input type, found non-SIMD `{$ty}` codegen_ssa_invalid_monomorphization_simd_return = invalid monomorphization of `{$name}` intrinsic: expected SIMD return type, found non-SIMD `{$ty}` diff --git a/compiler/rustc_codegen_ssa/src/back/metadata.rs b/compiler/rustc_codegen_ssa/src/back/metadata.rs index 8e76e47cfefc..c6b04431fab1 100644 --- a/compiler/rustc_codegen_ssa/src/back/metadata.rs +++ b/compiler/rustc_codegen_ssa/src/back/metadata.rs @@ -623,7 +623,7 @@ pub fn create_compressed_metadata_file_for_xcoff( /// that contains a custom section of the name `section_name` with contents /// `data`. /// -/// NB: the `object` crate does not yet have support for writing the the wasm +/// NB: the `object` crate does not yet have support for writing the wasm /// object file format. The format is simple enough that for now an extra crate /// from crates.io (such as `wasm-encoder`). The file format is: /// diff --git a/compiler/rustc_codegen_ssa/src/back/write.rs b/compiler/rustc_codegen_ssa/src/back/write.rs index 7a981217b525..c2fc32130ea0 100644 --- a/compiler/rustc_codegen_ssa/src/back/write.rs +++ b/compiler/rustc_codegen_ssa/src/back/write.rs @@ -16,8 +16,8 @@ use rustc_data_structures::sync::Lrc; use rustc_errors::emitter::Emitter; use rustc_errors::translation::Translate; use rustc_errors::{ - DiagCtxt, DiagnosticArgName, DiagnosticArgValue, DiagnosticBuilder, DiagnosticMessage, ErrCode, - FatalError, FluentBundle, Level, Style, + DiagCtxt, DiagnosticArgMap, DiagnosticBuilder, DiagnosticMessage, ErrCode, FatalError, + FluentBundle, Level, MultiSpan, Style, }; use rustc_fs_util::link_or_copy; use rustc_hir::def_id::{CrateNum, LOCAL_CRATE}; @@ -999,11 +999,29 @@ pub(crate) enum Message { /// process another codegen unit. pub struct CguMessage; +// A cut-down version of `rustc_errors::Diagnostic` that impls `Send`, which +// can be used to send diagnostics from codegen threads to the main thread. +// It's missing the following fields from `rustc_errors::Diagnostic`. +// - `span`: it doesn't impl `Send`. +// - `suggestions`: it doesn't impl `Send`, and isn't used for codegen +// diagnostics. +// - `sort_span`: it doesn't impl `Send`. +// - `is_lint`: lints aren't relevant during codegen. +// - `emitted_at`: not used for codegen diagnostics. struct Diagnostic { - msgs: Vec<(DiagnosticMessage, Style)>, - args: FxIndexMap, + level: Level, + messages: Vec<(DiagnosticMessage, Style)>, code: Option, - lvl: Level, + children: Vec, + args: DiagnosticArgMap, +} + +// A cut-down version of `rustc_errors::SubDiagnostic` that impls `Send`. It's +// missing the following fields from `rustc_errors::SubDiagnostic`. +// - `span`: it doesn't impl `Send`. +pub struct Subdiagnostic { + level: Level, + messages: Vec<(DiagnosticMessage, Style)>, } #[derive(PartialEq, Clone, Copy, Debug)] @@ -1766,7 +1784,6 @@ fn spawn_work<'a, B: ExtraBackendMethods>( enum SharedEmitterMessage { Diagnostic(Diagnostic), InlineAsmError(u32, String, Level, Option<(String, Vec)>), - AbortIfErrors, Fatal(String), } @@ -1812,24 +1829,29 @@ impl Translate for SharedEmitter { } impl Emitter for SharedEmitter { - fn emit_diagnostic(&mut self, diag: rustc_errors::Diagnostic) { - let args: FxIndexMap = - diag.args().map(|(name, arg)| (name.clone(), arg.clone())).collect(); - drop(self.sender.send(SharedEmitterMessage::Diagnostic(Diagnostic { - msgs: diag.messages.clone(), - args: args.clone(), - code: diag.code, - lvl: diag.level(), - }))); - for child in &diag.children { - drop(self.sender.send(SharedEmitterMessage::Diagnostic(Diagnostic { - msgs: child.messages.clone(), - args: args.clone(), - code: None, - lvl: child.level, - }))); - } - drop(self.sender.send(SharedEmitterMessage::AbortIfErrors)); + fn emit_diagnostic(&mut self, mut diag: rustc_errors::Diagnostic) { + // Check that we aren't missing anything interesting when converting to + // the cut-down local `Diagnostic`. + assert_eq!(diag.span, MultiSpan::new()); + assert_eq!(diag.suggestions, Ok(vec![])); + assert_eq!(diag.sort_span, rustc_span::DUMMY_SP); + assert_eq!(diag.is_lint, None); + // No sensible check for `diag.emitted_at`. + + let args = mem::replace(&mut diag.args, DiagnosticArgMap::default()); + drop( + self.sender.send(SharedEmitterMessage::Diagnostic(Diagnostic { + level: diag.level(), + messages: diag.messages, + code: diag.code, + children: diag + .children + .into_iter() + .map(|child| Subdiagnostic { level: child.level, messages: child.messages }) + .collect(), + args, + })), + ); } fn source_map(&self) -> Option<&Lrc> { @@ -1854,11 +1876,24 @@ impl SharedEmitterMain { match message { Ok(SharedEmitterMessage::Diagnostic(diag)) => { + // The diagnostic has been received on the main thread. + // Convert it back to a full `Diagnostic` and emit. let dcx = sess.dcx(); - let mut d = rustc_errors::Diagnostic::new_with_messages(diag.lvl, diag.msgs); + let mut d = + rustc_errors::Diagnostic::new_with_messages(diag.level, diag.messages); d.code = diag.code; // may be `None`, that's ok - d.replace_args(diag.args); + d.children = diag + .children + .into_iter() + .map(|sub| rustc_errors::SubDiagnostic { + level: sub.level, + messages: sub.messages, + span: MultiSpan::new(), + }) + .collect(); + d.args = diag.args; dcx.emit_diagnostic(d); + sess.dcx().abort_if_errors(); } Ok(SharedEmitterMessage::InlineAsmError(cookie, msg, level, source)) => { assert!(matches!(level, Level::Error | Level::Warning | Level::Note)); @@ -1891,9 +1926,6 @@ impl SharedEmitterMain { err.emit(); } - Ok(SharedEmitterMessage::AbortIfErrors) => { - sess.dcx().abort_if_errors(); - } Ok(SharedEmitterMessage::Fatal(msg)) => { sess.dcx().fatal(msg); } diff --git a/compiler/rustc_codegen_ssa/src/errors.rs b/compiler/rustc_codegen_ssa/src/errors.rs index e42a8bd9ed98..a7ac502b2483 100644 --- a/compiler/rustc_codegen_ssa/src/errors.rs +++ b/compiler/rustc_codegen_ssa/src/errors.rs @@ -797,16 +797,8 @@ pub enum InvalidMonomorphization<'tcx> { out_ty: Ty<'tcx>, }, - #[diag(codegen_ssa_invalid_monomorphization_shuffle_index_not_constant, code = E0511)] - ShuffleIndexNotConstant { - #[primary_span] - span: Span, - name: Symbol, - arg_idx: u64, - }, - - #[diag(codegen_ssa_invalid_monomorphization_shuffle_index_out_of_bounds, code = E0511)] - ShuffleIndexOutOfBounds { + #[diag(codegen_ssa_invalid_monomorphization_simd_index_out_of_bounds, code = E0511)] + SimdIndexOutOfBounds { #[primary_span] span: Span, name: Symbol, diff --git a/compiler/rustc_codegen_ssa/src/mir/block.rs b/compiler/rustc_codegen_ssa/src/mir/block.rs index 75d413dedad3..9c7aadb81f82 100644 --- a/compiler/rustc_codegen_ssa/src/mir/block.rs +++ b/compiler/rustc_codegen_ssa/src/mir/block.rs @@ -319,7 +319,15 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { targets: &SwitchTargets, ) { let discr = self.codegen_operand(bx, discr); + let discr_value = discr.immediate(); let switch_ty = discr.layout.ty; + // If our discriminant is a constant we can branch directly + if let Some(const_discr) = bx.const_to_opt_u128(discr_value, false) { + let target = targets.target_for_value(const_discr); + bx.br(helper.llbb_with_cleanup(self, target)); + return; + }; + let mut target_iter = targets.iter(); if target_iter.len() == 1 { // If there are two targets (one conditional, one fallback), emit `br` instead of @@ -330,14 +338,14 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { if switch_ty == bx.tcx().types.bool { // Don't generate trivial icmps when switching on bool. match test_value { - 0 => bx.cond_br(discr.immediate(), llfalse, lltrue), - 1 => bx.cond_br(discr.immediate(), lltrue, llfalse), + 0 => bx.cond_br(discr_value, llfalse, lltrue), + 1 => bx.cond_br(discr_value, lltrue, llfalse), _ => bug!(), } } else { let switch_llty = bx.immediate_backend_type(bx.layout_of(switch_ty)); let llval = bx.const_uint_big(switch_llty, test_value); - let cmp = bx.icmp(IntPredicate::IntEQ, discr.immediate(), llval); + let cmp = bx.icmp(IntPredicate::IntEQ, discr_value, llval); bx.cond_br(cmp, lltrue, llfalse); } } else if self.cx.sess().opts.optimize == OptLevel::No @@ -362,11 +370,11 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { let ll2 = helper.llbb_with_cleanup(self, target2); let switch_llty = bx.immediate_backend_type(bx.layout_of(switch_ty)); let llval = bx.const_uint_big(switch_llty, test_value1); - let cmp = bx.icmp(IntPredicate::IntEQ, discr.immediate(), llval); + let cmp = bx.icmp(IntPredicate::IntEQ, discr_value, llval); bx.cond_br(cmp, ll1, ll2); } else { bx.switch( - discr.immediate(), + discr_value, helper.llbb_with_cleanup(self, targets.otherwise()), target_iter.map(|(value, target)| (value, helper.llbb_with_cleanup(self, target))), ); @@ -864,8 +872,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { .map(|(i, arg)| { // The indices passed to simd_shuffle in the // third argument must be constant. This is - // checked by const-qualification, which also - // promotes any complex rvalues to constants. + // checked by the type-checker. if i == 2 && intrinsic == sym::simd_shuffle { if let mir::Operand::Constant(constant) = &arg.node { let (llval, ty) = self.simd_shuffle_indices(bx, constant); diff --git a/compiler/rustc_const_eval/src/errors.rs b/compiler/rustc_const_eval/src/errors.rs index 2fd34b3c7fc3..267f3acaaa5b 100644 --- a/compiler/rustc_const_eval/src/errors.rs +++ b/compiler/rustc_const_eval/src/errors.rs @@ -437,7 +437,7 @@ pub trait ReportErrorExt { let mut diag = dcx.struct_allow(DiagnosticMessage::Str(String::new().into())); let message = self.diagnostic_message(); self.add_args(&mut diag); - let s = dcx.eagerly_translate_to_string(message, diag.args()); + let s = dcx.eagerly_translate_to_string(message, diag.args.iter()); diag.cancel(); s }) @@ -864,7 +864,7 @@ impl<'tcx> ReportErrorExt for InvalidProgramInfo<'tcx> { let dummy_level = Level::Bug; let dummy_diag: DiagnosticBuilder<'_, ()> = e.into_diagnostic().into_diagnostic(diag.dcx, dummy_level); - for (name, val) in dummy_diag.args() { + for (name, val) in dummy_diag.args.iter() { diag.arg(name.clone(), val.clone()); } dummy_diag.cancel(); diff --git a/compiler/rustc_const_eval/src/interpret/eval_context.rs b/compiler/rustc_const_eval/src/interpret/eval_context.rs index 517994d47416..cb308ab53ecf 100644 --- a/compiler/rustc_const_eval/src/interpret/eval_context.rs +++ b/compiler/rustc_const_eval/src/interpret/eval_context.rs @@ -446,7 +446,7 @@ pub fn format_interp_error<'tcx>(dcx: &DiagCtxt, e: InterpErrorInfo<'tcx>) -> St let mut diag = dcx.struct_allow(""); let msg = e.diagnostic_message(); e.add_args(&mut diag); - let s = dcx.eagerly_translate_to_string(msg, diag.args()); + let s = dcx.eagerly_translate_to_string(msg, diag.args.iter()); diag.cancel(); s } diff --git a/compiler/rustc_const_eval/src/interpret/intern.rs b/compiler/rustc_const_eval/src/interpret/intern.rs index 959ec2ca8655..82ce9ecd21d1 100644 --- a/compiler/rustc_const_eval/src/interpret/intern.rs +++ b/compiler/rustc_const_eval/src/interpret/intern.rs @@ -140,7 +140,7 @@ pub fn intern_const_alloc_recursive< alloc.1.mutability = base_mutability; alloc.1.provenance().ptrs().iter().map(|&(_, prov)| prov).collect() } else { - intern_shallow(ecx, base_alloc_id, base_mutability).unwrap().map(|prov| prov).collect() + intern_shallow(ecx, base_alloc_id, base_mutability).unwrap().collect() }; // We need to distinguish "has just been interned" from "was already in `tcx`", // so we track this in a separate set. @@ -277,7 +277,7 @@ impl<'mir, 'tcx: 'mir, M: super::intern::CompileTimeMachine<'mir, 'tcx, !>> // We are not doing recursive interning, so we don't currently support provenance. // (If this assertion ever triggers, we should just implement a // proper recursive interning loop -- or just call `intern_const_alloc_recursive`. - if !self.tcx.try_get_global_alloc(prov.alloc_id()).is_some() { + if self.tcx.try_get_global_alloc(prov.alloc_id()).is_none() { panic!("`intern_with_temp_alloc` with nested allocations"); } } diff --git a/compiler/rustc_const_eval/src/interpret/intrinsics.rs b/compiler/rustc_const_eval/src/interpret/intrinsics.rs index f020616f6d8c..1cb991b38f7e 100644 --- a/compiler/rustc_const_eval/src/interpret/intrinsics.rs +++ b/compiler/rustc_const_eval/src/interpret/intrinsics.rs @@ -379,10 +379,12 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { let (input, input_len) = self.operand_to_simd(&args[0])?; let (dest, dest_len) = self.place_to_simd(dest)?; assert_eq!(input_len, dest_len, "Return vector length must match input length"); - assert!( - index < dest_len, - "Index `{index}` must be in bounds of vector with length {dest_len}" - ); + // Bounds are not checked by typeck so we have to do it ourselves. + if index >= input_len { + throw_ub_format!( + "`simd_insert` index {index} is out-of-bounds of vector with length {input_len}" + ); + } for i in 0..dest_len { let place = self.project_index(&dest, i)?; @@ -397,10 +399,12 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { sym::simd_extract => { let index = u64::from(self.read_scalar(&args[1])?.to_u32()?); let (input, input_len) = self.operand_to_simd(&args[0])?; - assert!( - index < input_len, - "index `{index}` must be in bounds of vector with length {input_len}" - ); + // Bounds are not checked by typeck so we have to do it ourselves. + if index >= input_len { + throw_ub_format!( + "`simd_extract` index {index} is out-of-bounds of vector with length {input_len}" + ); + } self.copy_op(&self.project_index(&input, index)?, dest)?; } sym::likely | sym::unlikely | sym::black_box => { diff --git a/compiler/rustc_data_structures/src/sync.rs b/compiler/rustc_data_structures/src/sync.rs index adcb6ceaebf8..32202ac3eded 100644 --- a/compiler/rustc_data_structures/src/sync.rs +++ b/compiler/rustc_data_structures/src/sync.rs @@ -429,7 +429,7 @@ impl RwLock { #[inline(always)] pub fn leak(&self) -> &T { let guard = self.read(); - let ret = unsafe { &*(&*guard as *const T) }; + let ret = unsafe { &*std::ptr::addr_of!(*guard) }; std::mem::forget(guard); ret } diff --git a/compiler/rustc_errors/src/annotate_snippet_emitter_writer.rs b/compiler/rustc_errors/src/annotate_snippet_emitter_writer.rs index 1a34a83c1a44..52b5a7eff48f 100644 --- a/compiler/rustc_errors/src/annotate_snippet_emitter_writer.rs +++ b/compiler/rustc_errors/src/annotate_snippet_emitter_writer.rs @@ -45,7 +45,7 @@ impl Translate for AnnotateSnippetEmitter { impl Emitter for AnnotateSnippetEmitter { /// The entry point for the diagnostics generation fn emit_diagnostic(&mut self, mut diag: Diagnostic) { - let fluent_args = to_fluent_args(diag.args()); + let fluent_args = to_fluent_args(diag.args.iter()); let mut suggestions = diag.suggestions.unwrap_or(vec![]); self.primary_span_formatted(&mut diag.span, &mut suggestions, &fluent_args); diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs index f096f0159104..65c49a6085c4 100644 --- a/compiler/rustc_errors/src/diagnostic.rs +++ b/compiler/rustc_errors/src/diagnostic.rs @@ -43,6 +43,8 @@ pub enum DiagnosticArgValue { StrListSepByAnd(Vec>), } +pub type DiagnosticArgMap = FxIndexMap; + /// Trait for types that `DiagnosticBuilder::emit` can return as a "guarantee" /// (or "proof") token that the emission happened. pub trait EmissionGuarantee: Sized { @@ -275,7 +277,7 @@ pub struct Diagnostic { pub span: MultiSpan, pub children: Vec, pub suggestions: Result, SuggestionsDisabled>, - args: FxIndexMap, + pub args: DiagnosticArgMap, /// This is not used for highlighting or rendering any error message. Rather, it can be used /// as a sort key to sort a buffer of diagnostics. By default, it is the primary span of @@ -403,14 +405,6 @@ impl Diagnostic { self.args.insert(name.into(), arg.into_diagnostic_arg()); } - pub fn args(&self) -> impl Iterator> { - self.args.iter() - } - - pub fn replace_args(&mut self, args: FxIndexMap) { - self.args = args; - } - /// Fields used for Hash, and PartialEq trait. fn keys( &self, @@ -431,7 +425,7 @@ impl Diagnostic { &self.span, &self.children, &self.suggestions, - self.args().collect(), + self.args.iter().collect(), // omit self.sort_span &self.is_lint, // omit self.emitted_at @@ -1165,7 +1159,7 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> { subdiagnostic: impl AddToDiagnostic, ) -> &mut Self { subdiagnostic.add_to_diagnostic_with(self, |diag, msg| { - let args = diag.args(); + let args = diag.args.iter(); let msg = diag.subdiagnostic_message_to_diagnostic_message(msg); dcx.eagerly_translate(msg, args) }); diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index df94b69004b7..c4b2c28fc231 100644 --- a/compiler/rustc_errors/src/emitter.rs +++ b/compiler/rustc_errors/src/emitter.rs @@ -519,7 +519,7 @@ impl Emitter for HumanEmitter { } fn emit_diagnostic(&mut self, mut diag: Diagnostic) { - let fluent_args = to_fluent_args(diag.args()); + let fluent_args = to_fluent_args(diag.args.iter()); let mut suggestions = diag.suggestions.unwrap_or(vec![]); self.primary_span_formatted(&mut diag.span, &mut suggestions, &fluent_args); diff --git a/compiler/rustc_errors/src/json.rs b/compiler/rustc_errors/src/json.rs index 470e3d52452c..e57b414c52df 100644 --- a/compiler/rustc_errors/src/json.rs +++ b/compiler/rustc_errors/src/json.rs @@ -341,7 +341,7 @@ struct UnusedExterns<'a, 'b, 'c> { impl Diagnostic { fn from_errors_diagnostic(diag: crate::Diagnostic, je: &JsonEmitter) -> Diagnostic { - let args = to_fluent_args(diag.args()); + let args = to_fluent_args(diag.args.iter()); let sugg = diag.suggestions.iter().flatten().map(|sugg| { let translated_message = je.translate_message(&sugg.msg, &args).map_err(Report::new).unwrap(); diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 7e3d15ffc921..3f667e264e85 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -37,9 +37,10 @@ extern crate self as rustc_errors; pub use codes::*; pub use diagnostic::{ - AddToDiagnostic, BugAbort, DecorateLint, Diagnostic, DiagnosticArg, DiagnosticArgName, - DiagnosticArgValue, DiagnosticBuilder, DiagnosticStyledString, EmissionGuarantee, FatalAbort, - IntoDiagnostic, IntoDiagnosticArg, StringPart, SubDiagnostic, SubdiagnosticMessageOp, + AddToDiagnostic, BugAbort, DecorateLint, Diagnostic, DiagnosticArg, DiagnosticArgMap, + DiagnosticArgName, DiagnosticArgValue, DiagnosticBuilder, DiagnosticStyledString, + EmissionGuarantee, FatalAbort, IntoDiagnostic, IntoDiagnosticArg, StringPart, SubDiagnostic, + SubdiagnosticMessageOp, }; pub use diagnostic_impls::{ DiagnosticArgFromDisplay, DiagnosticSymbolList, ExpectedLifetimeParameter, @@ -843,7 +844,7 @@ impl DiagCtxt { .emitted_diagnostic_codes .iter() .filter_map(|&code| { - if registry.try_find_description(code).is_ok().clone() { + if registry.try_find_description(code).is_ok() { Some(code.to_string()) } else { None @@ -1496,9 +1497,8 @@ impl DiagCtxtInner { diag: &Diagnostic, msg: impl Into, ) -> SubdiagnosticMessage { - let args = diag.args(); let msg = diag.subdiagnostic_message_to_diagnostic_message(msg); - self.eagerly_translate(msg, args) + self.eagerly_translate(msg, diag.args.iter()) } fn flush_delayed(&mut self) { diff --git a/compiler/rustc_expand/src/mbe/transcribe.rs b/compiler/rustc_expand/src/mbe/transcribe.rs index 519e4a634d8a..4a18055d4ca0 100644 --- a/compiler/rustc_expand/src/mbe/transcribe.rs +++ b/compiler/rustc_expand/src/mbe/transcribe.rs @@ -555,23 +555,14 @@ fn count_repetitions<'a>( ) -> PResult<'a, usize> { // Recursively count the number of matches in `matched` at given depth // (or at the top-level of `matched` if no depth is given). - fn count<'a>( - cx: &ExtCtxt<'a>, - depth_curr: usize, - depth_max: usize, - matched: &NamedMatch, - sp: &DelimSpan, - ) -> PResult<'a, usize> { + fn count<'a>(depth_curr: usize, depth_max: usize, matched: &NamedMatch) -> PResult<'a, usize> { match matched { MatchedTokenTree(_) | MatchedNonterminal(_) => Ok(1), MatchedSeq(named_matches) => { if depth_curr == depth_max { Ok(named_matches.len()) } else { - named_matches - .iter() - .map(|elem| count(cx, depth_curr + 1, depth_max, elem, sp)) - .sum() + named_matches.iter().map(|elem| count(depth_curr + 1, depth_max, elem)).sum() } } } @@ -612,7 +603,7 @@ fn count_repetitions<'a>( return Err(cx.dcx().create_err(CountRepetitionMisplaced { span: sp.entire() })); } - count(cx, depth_user, depth_max, matched, sp) + count(depth_user, depth_max, matched) } /// Returns a `NamedMatch` item declared on the LHS given an arbitrary [Ident] diff --git a/compiler/rustc_expand/src/proc_macro_server.rs b/compiler/rustc_expand/src/proc_macro_server.rs index b80ecbc9c659..62d0deb2d3a6 100644 --- a/compiler/rustc_expand/src/proc_macro_server.rs +++ b/compiler/rustc_expand/src/proc_macro_server.rs @@ -510,7 +510,7 @@ impl server::FreeFunctions for Rustc<'_, '_> { fn emit_diagnostic(&mut self, diagnostic: Diagnostic) { let message = rustc_errors::DiagnosticMessage::from(diagnostic.message); - let mut diag: DiagnosticBuilder<'_, rustc_errors::ErrorGuaranteed> = + let mut diag: DiagnosticBuilder<'_, ()> = DiagnosticBuilder::new(&self.sess().dcx, diagnostic.level.to_internal(), message); diag.span(MultiSpan::from_spans(diagnostic.spans)); for child in diagnostic.children { diff --git a/compiler/rustc_feature/src/builtin_attrs.rs b/compiler/rustc_feature/src/builtin_attrs.rs index 99875ec54054..003baf071b8c 100644 --- a/compiler/rustc_feature/src/builtin_attrs.rs +++ b/compiler/rustc_feature/src/builtin_attrs.rs @@ -792,6 +792,10 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ rustc_intrinsic, Normal, template!(Word), ErrorFollowing, "the `#[rustc_intrinsic]` attribute is used to declare intrinsics with function bodies", ), + rustc_attr!( + rustc_no_mir_inline, Normal, template!(Word), WarnFollowing, + "#[rustc_no_mir_inline] prevents the MIR inliner from inlining a function while not affecting codegen" + ), // ========================================================================== // Internal attributes, Testing: diff --git a/compiler/rustc_feature/src/unstable.rs b/compiler/rustc_feature/src/unstable.rs index 9012b731a132..93c183a65ef3 100644 --- a/compiler/rustc_feature/src/unstable.rs +++ b/compiler/rustc_feature/src/unstable.rs @@ -518,7 +518,7 @@ declare_features! ( (unstable, marker_trait_attr, "1.30.0", Some(29864)), /// Allows exhaustive pattern matching on types that contain uninhabited types in cases that are /// unambiguously sound. - (incomplete, min_exhaustive_patterns, "1.77.0", Some(119612)), + (unstable, min_exhaustive_patterns, "1.77.0", Some(119612)), /// A minimal, sound subset of specialization intended to be used by the /// standard library until the soundness issues with specialization /// are fixed. diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index fcb15925f6a7..78e7c636a3e7 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -3004,6 +3004,11 @@ impl<'hir> Item<'hir> { matches!(self.kind, ItemKind::Enum(..) | ItemKind::Struct(..) | ItemKind::Union(..)) } + /// Check if this is an [`ItemKind::Struct`] or [`ItemKind::Union`]. + pub fn is_struct_or_union(&self) -> bool { + matches!(self.kind, ItemKind::Struct(..) | ItemKind::Union(..)) + } + expect_methods_self_kind! { expect_extern_crate, Option, ItemKind::ExternCrate(s), *s; diff --git a/compiler/rustc_hir_analysis/src/check/check.rs b/compiler/rustc_hir_analysis/src/check/check.rs index b945eed54d04..deabb9c37385 100644 --- a/compiler/rustc_hir_analysis/src/check/check.rs +++ b/compiler/rustc_hir_analysis/src/check/check.rs @@ -477,7 +477,7 @@ fn sanity_check_found_hidden_type<'tcx>( } else { let span = tcx.def_span(key.def_id); let other = ty::OpaqueHiddenType { ty: hidden_ty, span }; - Err(ty.report_mismatch(&other, key.def_id, tcx).emit()) + Err(ty.build_mismatch_error(&other, key.def_id, tcx)?.emit()) } } diff --git a/compiler/rustc_hir_analysis/src/check/compare_impl_item/refine.rs b/compiler/rustc_hir_analysis/src/check/compare_impl_item/refine.rs index 7bdbab4325cb..b5e69b8e3766 100644 --- a/compiler/rustc_hir_analysis/src/check/compare_impl_item/refine.rs +++ b/compiler/rustc_hir_analysis/src/check/compare_impl_item/refine.rs @@ -154,10 +154,8 @@ pub(super) fn check_refining_return_position_impl_trait_in_trait<'tcx>( trait_m_sig.inputs_and_output, )); if !ocx.select_all_or_error().is_empty() { - // This code path is not reached in any tests, but may be reachable. If - // this is triggered, it should be converted to `delayed_bug` and the - // triggering case turned into a test. - tcx.dcx().bug("encountered errors when checking RPITIT refinement (selection)"); + tcx.dcx().delayed_bug("encountered errors when checking RPITIT refinement (selection)"); + return; } let outlives_env = OutlivesEnvironment::with_bounds( param_env, @@ -165,10 +163,8 @@ pub(super) fn check_refining_return_position_impl_trait_in_trait<'tcx>( ); let errors = infcx.resolve_regions(&outlives_env); if !errors.is_empty() { - // This code path is not reached in any tests, but may be reachable. If - // this is triggered, it should be converted to `delayed_bug` and the - // triggering case turned into a test. - tcx.dcx().bug("encountered errors when checking RPITIT refinement (regions)"); + tcx.dcx().delayed_bug("encountered errors when checking RPITIT refinement (regions)"); + return; } // Resolve any lifetime variables that may have been introduced during normalization. let Ok((trait_bounds, impl_bounds)) = infcx.fully_resolve((trait_bounds, impl_bounds)) else { diff --git a/compiler/rustc_hir_analysis/src/check/intrinsic.rs b/compiler/rustc_hir_analysis/src/check/intrinsic.rs index 05fab60fd8df..d7277b22c841 100644 --- a/compiler/rustc_hir_analysis/src/check/intrinsic.rs +++ b/compiler/rustc_hir_analysis/src/check/intrinsic.rs @@ -606,9 +606,7 @@ pub fn check_platform_intrinsic_type( | sym::simd_reduce_or | sym::simd_reduce_xor | sym::simd_reduce_min - | sym::simd_reduce_max - | sym::simd_reduce_min_nanless - | sym::simd_reduce_max_nanless => (2, 0, vec![param(0)], param(1)), + | sym::simd_reduce_max => (2, 0, vec![param(0)], param(1)), sym::simd_shuffle => (3, 0, vec![param(0), param(0), param(1)], param(2)), sym::simd_shuffle_generic => (2, 1, vec![param(0), param(0)], param(1)), _ => { diff --git a/compiler/rustc_hir_analysis/src/collect.rs b/compiler/rustc_hir_analysis/src/collect.rs index 6a42fdb1079f..e9c9ec6ba53f 100644 --- a/compiler/rustc_hir_analysis/src/collect.rs +++ b/compiler/rustc_hir_analysis/src/collect.rs @@ -1025,9 +1025,17 @@ fn adt_def(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::AdtDef<'_> { let is_anonymous = item.ident.name == kw::Empty; let repr = if is_anonymous { - tcx.adt_def(tcx.local_parent(def_id)).repr() + let parent = tcx.local_parent(def_id); + if let Node::Item(item) = tcx.hir_node_by_def_id(parent) + && item.is_struct_or_union() + { + tcx.adt_def(parent).repr() + } else { + tcx.dcx().span_delayed_bug(item.span, "anonymous field inside non struct/union"); + ty::ReprOptions::default() + } } else { - tcx.repr_options_of_def(def_id.to_def_id()) + tcx.repr_options_of_def(def_id) }; let (kind, variants) = match &item.kind { ItemKind::Enum(def, _) => { diff --git a/compiler/rustc_hir_analysis/src/collect/generics_of.rs b/compiler/rustc_hir_analysis/src/collect/generics_of.rs index 410a069f9568..9cc6c16c1263 100644 --- a/compiler/rustc_hir_analysis/src/collect/generics_of.rs +++ b/compiler/rustc_hir_analysis/src/collect/generics_of.rs @@ -315,7 +315,7 @@ pub(super) fn generics_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Generics { if is_host_effect { if let Some(idx) = host_effect_index { - tcx.dcx().span_bug( + tcx.dcx().span_delayed_bug( param.span, format!("parent also has host effect param? index: {idx}, def: {def_id:?}"), ); diff --git a/compiler/rustc_hir_analysis/src/collect/type_of/opaque.rs b/compiler/rustc_hir_analysis/src/collect/type_of/opaque.rs index 79cb384c5bde..f0e998b7a003 100644 --- a/compiler/rustc_hir_analysis/src/collect/type_of/opaque.rs +++ b/compiler/rustc_hir_analysis/src/collect/type_of/opaque.rs @@ -58,10 +58,10 @@ pub(super) fn find_opaque_ty_constraints_for_impl_trait_in_assoc_type( // Only check against typeck if we didn't already error if !hidden.ty.references_error() { for concrete_type in locator.typeck_types { - if concrete_type.ty != tcx.erase_regions(hidden.ty) - && !(concrete_type, hidden).references_error() - { - hidden.report_mismatch(&concrete_type, def_id, tcx).emit(); + if concrete_type.ty != tcx.erase_regions(hidden.ty) { + if let Ok(d) = hidden.build_mismatch_error(&concrete_type, def_id, tcx) { + d.emit(); + } } } } @@ -134,10 +134,10 @@ pub(super) fn find_opaque_ty_constraints_for_tait(tcx: TyCtxt<'_>, def_id: Local // Only check against typeck if we didn't already error if !hidden.ty.references_error() { for concrete_type in locator.typeck_types { - if concrete_type.ty != tcx.erase_regions(hidden.ty) - && !(concrete_type, hidden).references_error() - { - hidden.report_mismatch(&concrete_type, def_id, tcx).emit(); + if concrete_type.ty != tcx.erase_regions(hidden.ty) { + if let Ok(d) = hidden.build_mismatch_error(&concrete_type, def_id, tcx) { + d.emit(); + } } } } @@ -287,8 +287,10 @@ impl TaitConstraintLocator<'_> { if let Some(&concrete_type) = borrowck_results.concrete_opaque_types.get(&self.def_id) { debug!(?concrete_type, "found constraint"); if let Some(prev) = &mut self.found { - if concrete_type.ty != prev.ty && !(concrete_type, prev.ty).references_error() { - let guar = prev.report_mismatch(&concrete_type, self.def_id, self.tcx).emit(); + if concrete_type.ty != prev.ty { + let (Ok(guar) | Err(guar)) = prev + .build_mismatch_error(&concrete_type, self.def_id, self.tcx) + .map(|d| d.emit()); prev.ty = Ty::new_error(self.tcx, guar); } } else { @@ -361,11 +363,13 @@ pub(super) fn find_opaque_ty_constraints_for_rpit<'tcx>( hidden_type.remap_generic_params_to_declaration_params(opaque_type_key, tcx, true), ); if let Some(prev) = &mut hir_opaque_ty { - if concrete_type.ty != prev.ty && !(concrete_type, prev.ty).references_error() { - prev.report_mismatch(&concrete_type, def_id, tcx).stash( - tcx.def_span(opaque_type_key.def_id), - StashKey::OpaqueHiddenTypeMismatch, - ); + if concrete_type.ty != prev.ty { + if let Ok(d) = prev.build_mismatch_error(&concrete_type, def_id, tcx) { + d.stash( + tcx.def_span(opaque_type_key.def_id), + StashKey::OpaqueHiddenTypeMismatch, + ); + } } } else { hir_opaque_ty = Some(concrete_type); @@ -436,9 +440,12 @@ impl RpitConstraintChecker<'_> { debug!(?concrete_type, "found constraint"); - if concrete_type.ty != self.found.ty && !(concrete_type, self.found).references_error() - { - self.found.report_mismatch(&concrete_type, self.def_id, self.tcx).emit(); + if concrete_type.ty != self.found.ty { + if let Ok(d) = + self.found.build_mismatch_error(&concrete_type, self.def_id, self.tcx) + { + d.emit(); + } } } } diff --git a/compiler/rustc_hir_typeck/src/_match.rs b/compiler/rustc_hir_typeck/src/_match.rs index cb131f1d1669..e852ee0f049b 100644 --- a/compiler/rustc_hir_typeck/src/_match.rs +++ b/compiler/rustc_hir_typeck/src/_match.rs @@ -401,12 +401,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { { // check that the `if` expr without `else` is the fn body's expr if expr.span == sp { - return self.get_fn_decl(hir_id).and_then(|(_, fn_decl, _)| { + return self.get_fn_decl(hir_id).map(|(_, fn_decl, _)| { let (ty, span) = match fn_decl.output { hir::FnRetTy::DefaultReturn(span) => ("()".to_string(), span), hir::FnRetTy::Return(ty) => (ty_to_string(ty), ty.span), }; - Some((span, format!("expected `{ty}` because of this return type"))) + (span, format!("expected `{ty}` because of this return type")) }); } } diff --git a/compiler/rustc_hir_typeck/src/expr.rs b/compiler/rustc_hir_typeck/src/expr.rs index 89cc46dc5ab8..81440b0562e2 100644 --- a/compiler/rustc_hir_typeck/src/expr.rs +++ b/compiler/rustc_hir_typeck/src/expr.rs @@ -77,8 +77,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // coercions from ! to `expected`. if ty.is_never() { if let Some(_) = self.typeck_results.borrow().adjustments().get(expr.hir_id) { - self.dcx() - .span_bug(expr.span, "expression with never type wound up being adjusted"); + let reported = self.dcx().span_delayed_bug( + expr.span, + "expression with never type wound up being adjusted", + ); + return Ty::new_error(self.tcx(), reported); } let adj_ty = self.next_ty_var(TypeVariableOrigin { diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs index 986af2f5c9e6..7d448820cebe 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs @@ -846,7 +846,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let item_name = item_segment.ident; let result = self .resolve_fully_qualified_call(span, item_name, ty.normalized, qself.span, hir_id) - .and_then(|r| { + .map(|r| { // lint bare trait if the method is found in the trait if span.edition().at_least_rust_2021() && let Some(diag) = @@ -854,7 +854,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { { diag.emit(); } - Ok(r) + r }) .or_else(|error| { let guar = self @@ -1522,10 +1522,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { if self.next_trait_solver() && let ty::Alias(..) = ty.kind() { - match self + // We need to use a separate variable here as otherwise the temporary for + // `self.fulfillment_cx.borrow_mut()` is alive in the `Err` branch, resulting + // in a reentrant borrow, causing an ICE. + let result = self .at(&self.misc(sp), self.param_env) - .structurally_normalize(ty, &mut **self.fulfillment_cx.borrow_mut()) - { + .structurally_normalize(ty, &mut **self.fulfillment_cx.borrow_mut()); + match result { Ok(normalized_ty) => normalized_ty, Err(errors) => { let guar = self.err_ctxt().report_fulfillment_errors(errors); diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs index 2d9ec9f6bab8..75e4dd5a61c1 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs @@ -1,7 +1,11 @@ use crate::coercion::CoerceMany; use crate::errors::SuggestPtrNullMut; use crate::fn_ctxt::arg_matrix::{ArgMatrix, Compatibility, Error, ExpectedIdx, ProvidedIdx}; +use crate::fn_ctxt::infer::FnCall; use crate::gather_locals::Declaration; +use crate::method::probe::IsSuggestion; +use crate::method::probe::Mode::MethodCall; +use crate::method::probe::ProbeScope::TraitsInScope; use crate::method::MethodCallee; use crate::TupleArgumentsFlag::*; use crate::{errors, Expectation::*}; @@ -451,7 +455,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { call_expr: &'tcx hir::Expr<'tcx>, ) -> ErrorGuaranteed { // Next, let's construct the error - let (error_span, full_call_span, call_name, is_method) = match &call_expr.kind { + let (error_span, call_ident, full_call_span, call_name, is_method) = match &call_expr.kind { hir::ExprKind::Call( hir::Expr { hir_id, span, kind: hir::ExprKind::Path(qpath), .. }, _, @@ -463,12 +467,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { CtorOf::Struct => "struct", CtorOf::Variant => "enum variant", }; - (call_span, *span, name, false) + (call_span, None, *span, name, false) } else { - (call_span, *span, "function", false) + (call_span, None, *span, "function", false) } } - hir::ExprKind::Call(hir::Expr { span, .. }, _) => (call_span, *span, "function", false), + hir::ExprKind::Call(hir::Expr { span, .. }, _) => { + (call_span, None, *span, "function", false) + } hir::ExprKind::MethodCall(path_segment, _, _, span) => { let ident_span = path_segment.ident.span; let ident_span = if let Some(args) = path_segment.args { @@ -476,7 +482,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } else { ident_span }; - (*span, ident_span, "method", true) + (*span, Some(path_segment.ident), ident_span, "method", true) } k => span_bug!(call_span, "checking argument types on a non-call: `{:?}`", k), }; @@ -530,6 +536,103 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let callee_ty = callee_expr .and_then(|callee_expr| self.typeck_results.borrow().expr_ty_adjusted_opt(callee_expr)); + // Obtain another method on `Self` that have similar name. + let similar_assoc = |call_name: Ident| -> Option<(ty::AssocItem, ty::FnSig<'_>)> { + if let Some(callee_ty) = callee_ty + && let Ok(Some(assoc)) = self.probe_op( + call_name.span, + MethodCall, + Some(call_name), + None, + IsSuggestion(true), + callee_ty.peel_refs(), + callee_expr.unwrap().hir_id, + TraitsInScope, + |mut ctxt| ctxt.probe_for_similar_candidate(), + ) + && let ty::AssocKind::Fn = assoc.kind + && assoc.fn_has_self_parameter + { + let args = self.infcx.fresh_args_for_item(call_name.span, assoc.def_id); + let fn_sig = tcx.fn_sig(assoc.def_id).instantiate(tcx, args); + + self.instantiate_binder_with_fresh_vars(call_name.span, FnCall, fn_sig); + } + None + }; + + let suggest_confusable = |err: &mut DiagnosticBuilder<'_>| { + let Some(call_name) = call_ident else { + return; + }; + let Some(callee_ty) = callee_ty else { + return; + }; + let input_types: Vec> = provided_arg_tys.iter().map(|(ty, _)| *ty).collect(); + // Check for other methods in the following order + // - methods marked as `rustc_confusables` with the provided arguments + // - methods with the same argument type/count and short levenshtein distance + // - methods marked as `rustc_confusables` (done) + // - methods with short levenshtein distance + + // Look for commonly confusable method names considering arguments. + if let Some(_name) = self.confusable_method_name( + err, + callee_ty.peel_refs(), + call_name, + Some(input_types.clone()), + ) { + return; + } + // Look for method names with short levenshtein distance, considering arguments. + if let Some((assoc, fn_sig)) = similar_assoc(call_name) + && fn_sig.inputs()[1..] + .iter() + .zip(input_types.iter()) + .all(|(expected, found)| self.can_coerce(*expected, *found)) + && fn_sig.inputs()[1..].len() == input_types.len() + { + err.span_suggestion_verbose( + call_name.span, + format!("you might have meant to use `{}`", assoc.name), + assoc.name, + Applicability::MaybeIncorrect, + ); + return; + } + // Look for commonly confusable method names disregarding arguments. + if let Some(_name) = + self.confusable_method_name(err, callee_ty.peel_refs(), call_name, None) + { + return; + } + // Look for similarly named methods with levenshtein distance with the right + // number of arguments. + if let Some((assoc, fn_sig)) = similar_assoc(call_name) + && fn_sig.inputs()[1..].len() == input_types.len() + { + err.span_note( + tcx.def_span(assoc.def_id), + format!( + "there's is a method with similar name `{}`, but the arguments don't match", + assoc.name, + ), + ); + return; + } + // Fallthrough: look for similarly named methods with levenshtein distance. + if let Some((assoc, _)) = similar_assoc(call_name) { + err.span_note( + tcx.def_span(assoc.def_id), + format!( + "there's is a method with similar name `{}`, but their argument count \ + doesn't match", + assoc.name, + ), + ); + return; + } + }; // A "softer" version of the `demand_compatible`, which checks types without persisting them, // and treats error types differently // This will allow us to "probe" for other argument orders that would likely have been correct @@ -694,6 +797,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { Some(mismatch_idx), is_method, ); + suggest_confusable(&mut err); return err.emit(); } } @@ -718,7 +822,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { if cfg!(debug_assertions) { span_bug!(error_span, "expected errors from argument matrix"); } else { - return tcx.dcx().emit_err(errors::ArgMismatchIndeterminate { span: error_span }); + let mut err = + tcx.dcx().create_err(errors::ArgMismatchIndeterminate { span: error_span }); + suggest_confusable(&mut err); + return err.emit(); } } @@ -733,7 +840,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let trace = mk_trace(provided_span, formal_and_expected_inputs[*expected_idx], provided_ty); if !matches!(trace.cause.as_failure_code(*e), FailureCode::Error0308) { - reported = Some(self.err_ctxt().report_and_explain_type_error(trace, *e).emit()); + let mut err = self.err_ctxt().report_and_explain_type_error(trace, *e); + suggest_confusable(&mut err); + reported = Some(err.emit()); return false; } true @@ -802,6 +911,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { Some(expected_idx.as_usize()), is_method, ); + suggest_confusable(&mut err); return err.emit(); } @@ -829,6 +939,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { .with_code(err_code.to_owned()) }; + suggest_confusable(&mut err); // As we encounter issues, keep track of what we want to provide for the suggestion let mut labels = vec![]; // If there is a single error, we give a specific suggestion; otherwise, we change to diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs index ad4546c09b54..685b1af931e3 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs @@ -11,6 +11,7 @@ use rustc_hir as hir; use rustc_hir::def_id::{DefId, LocalDefId}; use rustc_hir_analysis::astconv::AstConv; use rustc_infer::infer; +use rustc_infer::infer::error_reporting::sub_relations::SubRelations; use rustc_infer::infer::error_reporting::TypeErrCtxt; use rustc_infer::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind}; use rustc_middle::infer::unify_key::{ConstVariableOrigin, ConstVariableOriginKind}; @@ -155,8 +156,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { /// /// [`InferCtxt::err_ctxt`]: infer::InferCtxt::err_ctxt pub fn err_ctxt(&'a self) -> TypeErrCtxt<'a, 'tcx> { + let mut sub_relations = SubRelations::default(); + sub_relations.add_constraints( + self, + self.fulfillment_cx.borrow_mut().pending_obligations().iter().map(|o| o.predicate), + ); TypeErrCtxt { infcx: &self.infcx, + sub_relations: RefCell::new(sub_relations), typeck_results: Some(self.typeck_results.borrow()), fallback_has_occurred: self.fallback_has_occurred.get(), normalize_fn_sig: Box::new(|fn_sig| { diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs index e57717c25d93..f09af9999571 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs @@ -1061,20 +1061,15 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { return; } - let scope = self - .tcx - .hir() - .parent_iter(id) - .filter(|(_, node)| { - matches!( - node, - Node::Expr(Expr { kind: ExprKind::Closure(..), .. }) - | Node::Item(_) - | Node::TraitItem(_) - | Node::ImplItem(_) - ) - }) - .next(); + let scope = self.tcx.hir().parent_iter(id).find(|(_, node)| { + matches!( + node, + Node::Expr(Expr { kind: ExprKind::Closure(..), .. }) + | Node::Item(_) + | Node::TraitItem(_) + | Node::ImplItem(_) + ) + }); let in_closure = matches!(scope, Some((_, Node::Expr(Expr { kind: ExprKind::Closure(..), .. })))); diff --git a/compiler/rustc_hir_typeck/src/mem_categorization.rs b/compiler/rustc_hir_typeck/src/mem_categorization.rs index c300ec7444b2..1a860aa40679 100644 --- a/compiler/rustc_hir_typeck/src/mem_categorization.rs +++ b/compiler/rustc_hir_typeck/src/mem_categorization.rs @@ -582,7 +582,8 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> { match ty.kind() { ty::Tuple(args) => Ok(args.len()), _ => { - self.tcx().dcx().span_bug(span, "tuple pattern not applied to a tuple"); + self.tcx().dcx().span_delayed_bug(span, "tuple pattern not applied to a tuple"); + Err(()) } } } diff --git a/compiler/rustc_hir_typeck/src/method/probe.rs b/compiler/rustc_hir_typeck/src/method/probe.rs index a58e194e20ae..7117a59c4098 100644 --- a/compiler/rustc_hir_typeck/src/method/probe.rs +++ b/compiler/rustc_hir_typeck/src/method/probe.rs @@ -54,7 +54,7 @@ pub use self::PickKind::*; #[derive(Clone, Copy, Debug)] pub struct IsSuggestion(pub bool); -struct ProbeContext<'a, 'tcx> { +pub(crate) struct ProbeContext<'a, 'tcx> { fcx: &'a FnCtxt<'a, 'tcx>, span: Span, mode: Mode, @@ -355,7 +355,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { .unwrap() } - fn probe_op( + pub(crate) fn probe_op( &'a self, span: Span, mode: Mode, @@ -1750,7 +1750,9 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> { /// Similarly to `probe_for_return_type`, this method attempts to find the best matching /// candidate method where the method name may have been misspelled. Similarly to other /// edit distance based suggestions, we provide at most one such suggestion. - fn probe_for_similar_candidate(&mut self) -> Result, MethodError<'tcx>> { + pub(crate) fn probe_for_similar_candidate( + &mut self, + ) -> Result, MethodError<'tcx>> { debug!("probing for method names similar to {:?}", self.method_name); self.probe(|_| { @@ -1766,6 +1768,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> { ); pcx.allow_similar_names = true; pcx.assemble_inherent_candidates(); + pcx.assemble_extension_candidates_for_all_traits(); let method_names = pcx.candidate_method_names(|_| true); pcx.allow_similar_names = false; @@ -1775,6 +1778,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> { pcx.reset(); pcx.method_name = Some(method_name); pcx.assemble_inherent_candidates(); + pcx.assemble_extension_candidates_for_all_traits(); pcx.pick_core().and_then(|pick| pick.ok()).map(|pick| pick.item) }) .collect(); @@ -1942,7 +1946,21 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> { let hir_id = self.fcx.tcx.local_def_id_to_hir_id(local_def_id); let attrs = self.fcx.tcx.hir().attrs(hir_id); for attr in attrs { - let sym::doc = attr.name_or_empty() else { + if sym::doc == attr.name_or_empty() { + } else if sym::rustc_confusables == attr.name_or_empty() { + let Some(confusables) = attr.meta_item_list() else { + continue; + }; + // #[rustc_confusables("foo", "bar"))] + for n in confusables { + if let Some(lit) = n.lit() + && name.as_str() == lit.symbol.as_str() + { + return true; + } + } + continue; + } else { continue; }; let Some(values) = attr.meta_item_list() else { diff --git a/compiler/rustc_hir_typeck/src/method/suggest.rs b/compiler/rustc_hir_typeck/src/method/suggest.rs index cc111af5d8f0..f0586328835c 100644 --- a/compiler/rustc_hir_typeck/src/method/suggest.rs +++ b/compiler/rustc_hir_typeck/src/method/suggest.rs @@ -23,6 +23,7 @@ use rustc_hir::PatKind::Binding; use rustc_hir::PathSegment; use rustc_hir::{ExprKind, Node, QPath}; use rustc_infer::infer::{ + self, type_variable::{TypeVariableOrigin, TypeVariableOriginKind}, RegionVariableOrigin, }; @@ -274,7 +275,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { .span_if_local(def_id) .unwrap_or_else(|| self.tcx.def_span(def_id)); err.span_label(sp, format!("private {kind} defined here")); - self.suggest_valid_traits(&mut err, out_of_scope_traits, true); + self.suggest_valid_traits(&mut err, item_name, out_of_scope_traits, true); err.emit(); } @@ -369,9 +370,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { }; if let Some(file) = file { err.note(format!("the full type name has been written to '{}'", file.display())); - err.note(format!( - "consider using `--verbose` to print the full type name to the console" - )); + err.note("consider using `--verbose` to print the full type name to the console"); } err @@ -496,9 +495,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { if let Some(file) = ty_file { err.note(format!("the full type name has been written to '{}'", file.display(),)); - err.note(format!( - "consider using `--verbose` to print the full type name to the console" - )); + err.note("consider using `--verbose` to print the full type name to the console"); } if rcvr_ty.references_error() { err.downgrade_to_delayed_bug(); @@ -1209,32 +1206,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { err.note(format!( "the {item_kind} was found for\n{type_candidates}{additional_types}" )); - } else { - 'outer: for inherent_impl_did in - self.tcx.inherent_impls(adt.did()).into_iter().flatten() - { - for inherent_method in - self.tcx.associated_items(inherent_impl_did).in_definition_order() - { - if let Some(attr) = self - .tcx - .get_attr(inherent_method.def_id, sym::rustc_confusables) - && let Some(candidates) = parse_confusables(attr) - && candidates.contains(&item_name.name) - { - err.span_suggestion_verbose( - item_name.span, - format!( - "you might have meant to use `{}`", - inherent_method.name - ), - inherent_method.name, - Applicability::MaybeIncorrect, - ); - break 'outer; - } - } - } } } } else { @@ -1260,6 +1231,24 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { label_span_not_found(&mut err); } + let confusable_suggested = self.confusable_method_name( + &mut err, + rcvr_ty, + item_name, + args.map(|args| { + args.iter() + .map(|expr| { + self.node_ty_opt(expr.hir_id).unwrap_or_else(|| { + self.next_ty_var(TypeVariableOrigin { + kind: TypeVariableOriginKind::MiscVariable, + span: expr.span, + }) + }) + }) + .collect() + }), + ); + // Don't suggest (for example) `expr.field.clone()` if `expr.clone()` // can't be called due to `typeof(expr): Clone` not holding. if unsatisfied_predicates.is_empty() { @@ -1361,31 +1350,17 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } else if let Some(similar_candidate) = similar_candidate { // Don't emit a suggestion if we found an actual method // that had unsatisfied trait bounds - if unsatisfied_predicates.is_empty() { - let def_kind = similar_candidate.kind.as_def_kind(); - // Methods are defined within the context of a struct and their first parameter is always self, - // which represents the instance of the struct the method is being called on - // Associated functions don’t take self as a parameter and - // they are not methods because they don’t have an instance of the struct to work with. - if def_kind == DefKind::AssocFn && similar_candidate.fn_has_self_parameter { - err.span_suggestion( - span, - "there is a method with a similar name", - similar_candidate.name, - Applicability::MaybeIncorrect, - ); - } else { - err.span_suggestion( - span, - format!( - "there is {} {} with a similar name", - self.tcx.def_kind_descr_article(def_kind, similar_candidate.def_id), - self.tcx.def_kind_descr(def_kind, similar_candidate.def_id) - ), - similar_candidate.name, - Applicability::MaybeIncorrect, - ); - } + if unsatisfied_predicates.is_empty() + // ...or if we already suggested that name because of `rustc_confusable` annotation. + && Some(similar_candidate.name) != confusable_suggested + { + self.find_likely_intended_associated_item( + &mut err, + similar_candidate, + span, + args, + mode, + ); } } // If an appropriate error source is not found, check method chain for possible candiates @@ -1437,6 +1412,146 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { Some(err) } + fn find_likely_intended_associated_item( + &self, + err: &mut DiagnosticBuilder<'_>, + similar_candidate: ty::AssocItem, + span: Span, + args: Option<&'tcx [hir::Expr<'tcx>]>, + mode: Mode, + ) { + let tcx = self.tcx; + let def_kind = similar_candidate.kind.as_def_kind(); + let an = self.tcx.def_kind_descr_article(def_kind, similar_candidate.def_id); + let msg = format!( + "there is {an} {} `{}` with a similar name", + self.tcx.def_kind_descr(def_kind, similar_candidate.def_id), + similar_candidate.name, + ); + // Methods are defined within the context of a struct and their first parameter + // is always `self`, which represents the instance of the struct the method is + // being called on Associated functions don’t take self as a parameter and they are + // not methods because they don’t have an instance of the struct to work with. + if def_kind == DefKind::AssocFn { + let ty_args = self.infcx.fresh_args_for_item(span, similar_candidate.def_id); + let fn_sig = tcx.fn_sig(similar_candidate.def_id).instantiate(tcx, ty_args); + let fn_sig = self.instantiate_binder_with_fresh_vars(span, infer::FnCall, fn_sig); + if similar_candidate.fn_has_self_parameter { + if let Some(args) = args + && fn_sig.inputs()[1..].len() == args.len() + { + // We found a method with the same number of arguments as the method + // call expression the user wrote. + err.span_suggestion_verbose( + span, + msg, + similar_candidate.name, + Applicability::MaybeIncorrect, + ); + } else { + // We found a method but either the expression is not a method call or + // the argument count didn't match. + err.span_help( + tcx.def_span(similar_candidate.def_id), + format!( + "{msg}{}", + if let None = args { "" } else { ", but with different arguments" }, + ), + ); + } + } else if let Some(args) = args + && fn_sig.inputs().len() == args.len() + { + // We have fn call expression and the argument count match the associated + // function we found. + err.span_suggestion_verbose( + span, + msg, + similar_candidate.name, + Applicability::MaybeIncorrect, + ); + } else { + err.span_help(tcx.def_span(similar_candidate.def_id), msg); + } + } else if let Mode::Path = mode + && args.unwrap_or(&[]).is_empty() + { + // We have an associated item syntax and we found something that isn't an fn. + err.span_suggestion_verbose( + span, + msg, + similar_candidate.name, + Applicability::MaybeIncorrect, + ); + } else { + // The expression is a function or method call, but the item we found is an + // associated const or type. + err.span_help(tcx.def_span(similar_candidate.def_id), msg); + } + } + + pub(crate) fn confusable_method_name( + &self, + err: &mut DiagnosticBuilder<'_>, + rcvr_ty: Ty<'tcx>, + item_name: Ident, + call_args: Option>>, + ) -> Option { + if let ty::Adt(adt, adt_args) = rcvr_ty.kind() { + for inherent_impl_did in self.tcx.inherent_impls(adt.did()).into_iter().flatten() { + for inherent_method in + self.tcx.associated_items(inherent_impl_did).in_definition_order() + { + if let Some(attr) = + self.tcx.get_attr(inherent_method.def_id, sym::rustc_confusables) + && let Some(candidates) = parse_confusables(attr) + && candidates.contains(&item_name.name) + && let ty::AssocKind::Fn = inherent_method.kind + { + let args = + ty::GenericArgs::identity_for_item(self.tcx, inherent_method.def_id) + .rebase_onto( + self.tcx, + inherent_method.container_id(self.tcx), + adt_args, + ); + let fn_sig = + self.tcx.fn_sig(inherent_method.def_id).instantiate(self.tcx, args); + let fn_sig = self.instantiate_binder_with_fresh_vars( + item_name.span, + infer::FnCall, + fn_sig, + ); + if let Some(ref args) = call_args + && fn_sig.inputs()[1..] + .iter() + .zip(args.into_iter()) + .all(|(expected, found)| self.can_coerce(*expected, *found)) + && fn_sig.inputs()[1..].len() == args.len() + { + err.span_suggestion_verbose( + item_name.span, + format!("you might have meant to use `{}`", inherent_method.name), + inherent_method.name, + Applicability::MaybeIncorrect, + ); + return Some(inherent_method.name); + } else if let None = call_args { + err.span_note( + self.tcx.def_span(inherent_method.def_id), + format!( + "you might have meant to use method `{}`", + inherent_method.name, + ), + ); + return Some(inherent_method.name); + } + } + } + } + } + None + } fn note_candidates_on_method_error( &self, rcvr_ty: Ty<'tcx>, @@ -2768,6 +2883,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { fn suggest_valid_traits( &self, err: &mut DiagnosticBuilder<'_>, + item_name: Ident, valid_out_of_scope_traits: Vec, explain: bool, ) -> bool { @@ -2786,9 +2902,16 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { err.help("items from traits can only be used if the trait is in scope"); } let msg = format!( - "the following {traits_are} implemented but not in scope; \ - perhaps add a `use` for {one_of_them}:", - traits_are = if candidates.len() == 1 { "trait is" } else { "traits are" }, + "{this_trait_is} implemented but not in scope; perhaps you want to import \ + {one_of_them}", + this_trait_is = if candidates.len() == 1 { + format!( + "trait `{}` which provides `{item_name}` is", + self.tcx.item_name(candidates[0]), + ) + } else { + format!("the following traits which provide `{item_name}` are") + }, one_of_them = if candidates.len() == 1 { "it" } else { "one of them" }, ); @@ -2996,7 +3119,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } } } - if self.suggest_valid_traits(err, valid_out_of_scope_traits, true) { + if self.suggest_valid_traits(err, item_name, valid_out_of_scope_traits, true) { return; } @@ -3282,7 +3405,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { [] => {} [trait_info] if trait_info.def_id.is_local() => { if impls_trait(trait_info.def_id) { - self.suggest_valid_traits(err, vec![trait_info.def_id], false); + self.suggest_valid_traits(err, item_name, vec![trait_info.def_id], false); } else { err.subdiagnostic( self.dcx(), @@ -3309,7 +3432,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { )); for (i, trait_info) in trait_infos.iter().enumerate() { if impls_trait(trait_info.def_id) { - self.suggest_valid_traits(err, vec![trait_info.def_id], false); + self.suggest_valid_traits( + err, + item_name, + vec![trait_info.def_id], + false, + ); } msg.push_str(&format!( "\ncandidate #{}: `{}`", diff --git a/compiler/rustc_hir_typeck/src/pat.rs b/compiler/rustc_hir_typeck/src/pat.rs index b15c9ef90187..c28c1c776030 100644 --- a/compiler/rustc_hir_typeck/src/pat.rs +++ b/compiler/rustc_hir_typeck/src/pat.rs @@ -2035,7 +2035,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { slice: Option<&'tcx Pat<'tcx>>, span: Span, ) -> Option> { - if !slice.is_none() { + if slice.is_some() { return None; } diff --git a/compiler/rustc_hir_typeck/src/writeback.rs b/compiler/rustc_hir_typeck/src/writeback.rs index b83a0f893f5f..ed102a7fac0b 100644 --- a/compiler/rustc_hir_typeck/src/writeback.rs +++ b/compiler/rustc_hir_typeck/src/writeback.rs @@ -589,12 +589,16 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> { && last_opaque_ty.ty != hidden_type.ty { assert!(!self.fcx.next_trait_solver()); - hidden_type - .report_mismatch(&last_opaque_ty, opaque_type_key.def_id, self.tcx()) - .stash( + if let Ok(d) = hidden_type.build_mismatch_error( + &last_opaque_ty, + opaque_type_key.def_id, + self.tcx(), + ) { + d.stash( self.tcx().def_span(opaque_type_key.def_id), StashKey::OpaqueHiddenTypeMismatch, ); + } } } } diff --git a/compiler/rustc_infer/src/infer/canonical/canonicalizer.rs b/compiler/rustc_infer/src/infer/canonical/canonicalizer.rs index 99882a42abc3..9f70fee993df 100644 --- a/compiler/rustc_infer/src/infer/canonical/canonicalizer.rs +++ b/compiler/rustc_infer/src/infer/canonical/canonicalizer.rs @@ -175,8 +175,12 @@ impl CanonicalizeMode for CanonicalizeQueryResponse { ), ty::ReVar(vid) => { - let universe = - infcx.inner.borrow_mut().unwrap_region_constraints().var_universe(vid); + let universe = infcx + .inner + .borrow_mut() + .unwrap_region_constraints() + .probe_value(vid) + .unwrap_err(); canonicalizer.canonical_var_for_region( CanonicalVarInfo { kind: CanonicalVarKind::Region(universe) }, r, diff --git a/compiler/rustc_infer/src/infer/error_reporting/mod.rs b/compiler/rustc_infer/src/infer/error_reporting/mod.rs index 505d56cf4917..7715f2ef43a1 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/mod.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/mod.rs @@ -88,6 +88,7 @@ mod note_and_explain; mod suggest; pub(crate) mod need_type_info; +pub mod sub_relations; pub use need_type_info::TypeAnnotationNeeded; pub mod nice_region_error; @@ -123,6 +124,8 @@ fn escape_literal(s: &str) -> String { /// methods which should not be used during the happy path. pub struct TypeErrCtxt<'a, 'tcx> { pub infcx: &'a InferCtxt<'tcx>, + pub sub_relations: std::cell::RefCell, + pub typeck_results: Option>>, pub fallback_has_occurred: bool, @@ -1935,7 +1938,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { "the full type name has been written to '{}'", path.display(), )); - diag.note(format!("consider using `--verbose` to print the full type name to the console")); + diag.note("consider using `--verbose` to print the full type name to the console"); } } } @@ -2434,6 +2437,14 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { let suggestion = if has_lifetimes { format!(" + {lt_name}") } else { format!(": {lt_name}") }; suggs.push((sp, suggestion)) + } else if let GenericKind::Alias(ref p) = bound_kind + && let ty::Projection = p.kind(self.tcx) + && let DefKind::AssocTy = self.tcx.def_kind(p.def_id) + && let Some(ty::ImplTraitInTraitData::Trait { .. }) = + self.tcx.opt_rpitit_info(p.def_id) + { + // The lifetime found in the `impl` is longer than the one on the RPITIT. + // Do not suggest `::{opaque}: 'static`. } else if let Some(generics) = self.tcx.hir().get_generics(suggestion_scope) { let pred = format!("{bound_kind}: {lt_name}"); let suggestion = format!("{} {}", generics.add_where_or_trailing_comma(), pred); diff --git a/compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs b/compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs index af722b206262..896d17478504 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs @@ -502,7 +502,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { parent_name, }); - let args = if self.infcx.tcx.get_diagnostic_item(sym::iterator_collect_fn) + let args = if self.tcx.get_diagnostic_item(sym::iterator_collect_fn) == Some(generics_def_id) { "Vec<_>".to_string() @@ -710,7 +710,7 @@ struct InsertableGenericArgs<'tcx> { /// While doing so, the currently best spot is stored in `infer_source`. /// For details on how we rank spots, see [Self::source_cost] struct FindInferSourceVisitor<'a, 'tcx> { - infcx: &'a InferCtxt<'tcx>, + tecx: &'a TypeErrCtxt<'a, 'tcx>, typeck_results: &'a TypeckResults<'tcx>, target: GenericArg<'tcx>, @@ -722,12 +722,12 @@ struct FindInferSourceVisitor<'a, 'tcx> { impl<'a, 'tcx> FindInferSourceVisitor<'a, 'tcx> { fn new( - infcx: &'a InferCtxt<'tcx>, + tecx: &'a TypeErrCtxt<'a, 'tcx>, typeck_results: &'a TypeckResults<'tcx>, target: GenericArg<'tcx>, ) -> Self { FindInferSourceVisitor { - infcx, + tecx, typeck_results, target, @@ -778,7 +778,7 @@ impl<'a, 'tcx> FindInferSourceVisitor<'a, 'tcx> { } // The sources are listed in order of preference here. - let tcx = self.infcx.tcx; + let tcx = self.tecx.tcx; let ctx = CostCtxt { tcx }; match source.kind { InferSourceKind::LetBinding { ty, .. } => ctx.ty_cost(ty), @@ -829,12 +829,12 @@ impl<'a, 'tcx> FindInferSourceVisitor<'a, 'tcx> { fn node_args_opt(&self, hir_id: HirId) -> Option> { let args = self.typeck_results.node_args_opt(hir_id); - self.infcx.resolve_vars_if_possible(args) + self.tecx.resolve_vars_if_possible(args) } fn opt_node_type(&self, hir_id: HirId) -> Option> { let ty = self.typeck_results.node_type_opt(hir_id); - self.infcx.resolve_vars_if_possible(ty) + self.tecx.resolve_vars_if_possible(ty) } // Check whether this generic argument is the inference variable we @@ -849,7 +849,7 @@ impl<'a, 'tcx> FindInferSourceVisitor<'a, 'tcx> { use ty::{Infer, TyVar}; match (inner_ty.kind(), target_ty.kind()) { (&Infer(TyVar(a_vid)), &Infer(TyVar(b_vid))) => { - self.infcx.inner.borrow_mut().type_variables().sub_unified(a_vid, b_vid) + self.tecx.sub_relations.borrow_mut().unified(self.tecx, a_vid, b_vid) } _ => false, } @@ -857,12 +857,9 @@ impl<'a, 'tcx> FindInferSourceVisitor<'a, 'tcx> { (GenericArgKind::Const(inner_ct), GenericArgKind::Const(target_ct)) => { use ty::InferConst::*; match (inner_ct.kind(), target_ct.kind()) { - (ty::ConstKind::Infer(Var(a_vid)), ty::ConstKind::Infer(Var(b_vid))) => self - .infcx - .inner - .borrow_mut() - .const_unification_table() - .unioned(a_vid, b_vid), + (ty::ConstKind::Infer(Var(a_vid)), ty::ConstKind::Infer(Var(b_vid))) => { + self.tecx.inner.borrow_mut().const_unification_table().unioned(a_vid, b_vid) + } _ => false, } } @@ -917,7 +914,7 @@ impl<'a, 'tcx> FindInferSourceVisitor<'a, 'tcx> { &self, expr: &'tcx hir::Expr<'tcx>, ) -> Box> + 'a> { - let tcx = self.infcx.tcx; + let tcx = self.tecx.tcx; match expr.kind { hir::ExprKind::Path(ref path) => { if let Some(args) = self.node_args_opt(expr.hir_id) { @@ -980,7 +977,7 @@ impl<'a, 'tcx> FindInferSourceVisitor<'a, 'tcx> { path: &'tcx hir::Path<'tcx>, args: GenericArgsRef<'tcx>, ) -> impl Iterator> + 'a { - let tcx = self.infcx.tcx; + let tcx = self.tecx.tcx; let have_turbofish = path.segments.iter().any(|segment| { segment.args.is_some_and(|args| args.args.iter().any(|arg| arg.is_ty_or_const())) }); @@ -1034,7 +1031,7 @@ impl<'a, 'tcx> FindInferSourceVisitor<'a, 'tcx> { args: GenericArgsRef<'tcx>, qpath: &'tcx hir::QPath<'tcx>, ) -> Box> + 'a> { - let tcx = self.infcx.tcx; + let tcx = self.tecx.tcx; match qpath { hir::QPath::Resolved(_self_ty, path) => { Box::new(self.resolved_path_inferred_arg_iter(path, args)) @@ -1107,7 +1104,7 @@ impl<'a, 'tcx> Visitor<'tcx> for FindInferSourceVisitor<'a, 'tcx> { type NestedFilter = nested_filter::OnlyBodies; fn nested_visit_map(&mut self) -> Self::Map { - self.infcx.tcx.hir() + self.tecx.tcx.hir() } fn visit_local(&mut self, local: &'tcx Local<'tcx>) { @@ -1163,7 +1160,7 @@ impl<'a, 'tcx> Visitor<'tcx> for FindInferSourceVisitor<'a, 'tcx> { #[instrument(level = "debug", skip(self))] fn visit_expr(&mut self, expr: &'tcx Expr<'tcx>) { - let tcx = self.infcx.tcx; + let tcx = self.tecx.tcx; match expr.kind { // When encountering `func(arg)` first look into `arg` and then `func`, // as `arg` is "more specific". @@ -1194,7 +1191,7 @@ impl<'a, 'tcx> Visitor<'tcx> for FindInferSourceVisitor<'a, 'tcx> { if generics.parent.is_none() && generics.has_self { argument_index += 1; } - let args = self.infcx.resolve_vars_if_possible(args); + let args = self.tecx.resolve_vars_if_possible(args); let generic_args = &generics.own_args_no_defaults(tcx, args)[generics.own_counts().lifetimes..]; let span = match expr.kind { @@ -1224,7 +1221,7 @@ impl<'a, 'tcx> Visitor<'tcx> for FindInferSourceVisitor<'a, 'tcx> { { let output = args.as_closure().sig().output().skip_binder(); if self.generic_arg_contains_target(output.into()) { - let body = self.infcx.tcx.hir().body(body); + let body = self.tecx.tcx.hir().body(body); let should_wrap_expr = if matches!(body.value.kind, ExprKind::Block(..)) { None } else { @@ -1252,12 +1249,12 @@ impl<'a, 'tcx> Visitor<'tcx> for FindInferSourceVisitor<'a, 'tcx> { && let Some(args) = self.node_args_opt(expr.hir_id) && args.iter().any(|arg| self.generic_arg_contains_target(arg)) && let Some(def_id) = self.typeck_results.type_dependent_def_id(expr.hir_id) - && self.infcx.tcx.trait_of_item(def_id).is_some() + && self.tecx.tcx.trait_of_item(def_id).is_some() && !has_impl_trait(def_id) { let successor = method_args.get(0).map_or_else(|| (")", span.hi()), |arg| (", ", arg.span.lo())); - let args = self.infcx.resolve_vars_if_possible(args); + let args = self.tecx.resolve_vars_if_possible(args); self.update_infer_source(InferSource { span: path.ident.span, kind: InferSourceKind::FullyQualifiedMethodCall { diff --git a/compiler/rustc_infer/src/infer/error_reporting/sub_relations.rs b/compiler/rustc_infer/src/infer/error_reporting/sub_relations.rs new file mode 100644 index 000000000000..ef26a8ff7b86 --- /dev/null +++ b/compiler/rustc_infer/src/infer/error_reporting/sub_relations.rs @@ -0,0 +1,81 @@ +use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::undo_log::NoUndo; +use rustc_data_structures::unify as ut; +use rustc_middle::ty; + +use crate::infer::InferCtxt; + +#[derive(Debug, Copy, Clone, PartialEq)] +struct SubId(u32); +impl ut::UnifyKey for SubId { + type Value = (); + #[inline] + fn index(&self) -> u32 { + self.0 + } + #[inline] + fn from_index(i: u32) -> SubId { + SubId(i) + } + fn tag() -> &'static str { + "SubId" + } +} + +/// When reporting ambiguity errors, we sometimes want to +/// treat all inference vars which are subtypes of each +/// others as if they are equal. For this case we compute +/// the transitive closure of our subtype obligations here. +/// +/// E.g. when encountering ambiguity errors, we want to suggest +/// specifying some method argument or to add a type annotation +/// to a local variable. Because subtyping cannot change the +/// shape of a type, it's fine if the cause of the ambiguity error +/// is only related to the suggested variable via subtyping. +/// +/// Even for something like `let x = returns_arg(); x.method();` the +/// type of `x` is only a supertype of the argument of `returns_arg`. We +/// still want to suggest specifying the type of the argument. +#[derive(Default)] +pub struct SubRelations { + map: FxHashMap, + table: ut::UnificationTableStorage, +} + +impl SubRelations { + fn get_id<'tcx>(&mut self, infcx: &InferCtxt<'tcx>, vid: ty::TyVid) -> SubId { + let root_vid = infcx.root_var(vid); + *self.map.entry(root_vid).or_insert_with(|| self.table.with_log(&mut NoUndo).new_key(())) + } + + pub fn add_constraints<'tcx>( + &mut self, + infcx: &InferCtxt<'tcx>, + obls: impl IntoIterator>, + ) { + for p in obls { + let (a, b) = match p.kind().skip_binder() { + ty::PredicateKind::Subtype(ty::SubtypePredicate { a_is_expected: _, a, b }) => { + (a, b) + } + ty::PredicateKind::Coerce(ty::CoercePredicate { a, b }) => (a, b), + _ => continue, + }; + + match (a.kind(), b.kind()) { + (&ty::Infer(ty::TyVar(a_vid)), &ty::Infer(ty::TyVar(b_vid))) => { + let a = self.get_id(infcx, a_vid); + let b = self.get_id(infcx, b_vid); + self.table.with_log(&mut NoUndo).unify_var_var(a, b).unwrap(); + } + _ => continue, + } + } + } + + pub fn unified<'tcx>(&mut self, infcx: &InferCtxt<'tcx>, a: ty::TyVid, b: ty::TyVid) -> bool { + let a = self.get_id(infcx, a); + let b = self.get_id(infcx, b); + self.table.with_log(&mut NoUndo).unioned(a, b) + } +} diff --git a/compiler/rustc_infer/src/infer/freshen.rs b/compiler/rustc_infer/src/infer/freshen.rs index 2d5fa1b5c700..ef9c407acef5 100644 --- a/compiler/rustc_infer/src/infer/freshen.rs +++ b/compiler/rustc_infer/src/infer/freshen.rs @@ -56,49 +56,46 @@ impl<'a, 'tcx> TypeFreshener<'a, 'tcx> { } } - fn freshen_ty(&mut self, opt_ty: Option>, key: ty::InferTy, mk_fresh: F) -> Ty<'tcx> + fn freshen_ty(&mut self, input: Result, ty::InferTy>, mk_fresh: F) -> Ty<'tcx> where F: FnOnce(u32) -> Ty<'tcx>, { - if let Some(ty) = opt_ty { - return ty.fold_with(self); - } - - match self.ty_freshen_map.entry(key) { - Entry::Occupied(entry) => *entry.get(), - Entry::Vacant(entry) => { - let index = self.ty_freshen_count; - self.ty_freshen_count += 1; - let t = mk_fresh(index); - entry.insert(t); - t - } + match input { + Ok(ty) => ty.fold_with(self), + Err(key) => match self.ty_freshen_map.entry(key) { + Entry::Occupied(entry) => *entry.get(), + Entry::Vacant(entry) => { + let index = self.ty_freshen_count; + self.ty_freshen_count += 1; + let t = mk_fresh(index); + entry.insert(t); + t + } + }, } } fn freshen_const( &mut self, - opt_ct: Option>, - key: ty::InferConst, + input: Result, ty::InferConst>, freshener: F, ty: Ty<'tcx>, ) -> ty::Const<'tcx> where F: FnOnce(u32) -> ty::InferConst, { - if let Some(ct) = opt_ct { - return ct.fold_with(self); - } - - match self.const_freshen_map.entry(key) { - Entry::Occupied(entry) => *entry.get(), - Entry::Vacant(entry) => { - let index = self.const_freshen_count; - self.const_freshen_count += 1; - let ct = ty::Const::new_infer(self.infcx.tcx, freshener(index), ty); - entry.insert(ct); - ct - } + match input { + Ok(ct) => ct.fold_with(self), + Err(key) => match self.const_freshen_map.entry(key) { + Entry::Occupied(entry) => *entry.get(), + Entry::Vacant(entry) => { + let index = self.const_freshen_count; + self.const_freshen_count += 1; + let ct = ty::Const::new_infer(self.infcx.tcx, freshener(index), ty); + entry.insert(ct); + ct + } + }, } } } @@ -146,19 +143,22 @@ impl<'a, 'tcx> TypeFolder> for TypeFreshener<'a, 'tcx> { fn fold_const(&mut self, ct: ty::Const<'tcx>) -> ty::Const<'tcx> { match ct.kind() { ty::ConstKind::Infer(ty::InferConst::Var(v)) => { - let opt_ct = - self.infcx.inner.borrow_mut().const_unification_table().probe_value(v).known(); - self.freshen_const(opt_ct, ty::InferConst::Var(v), ty::InferConst::Fresh, ct.ty()) + let mut inner = self.infcx.inner.borrow_mut(); + let input = + inner.const_unification_table().probe_value(v).known().ok_or_else(|| { + ty::InferConst::Var(inner.const_unification_table().find(v).vid) + }); + drop(inner); + self.freshen_const(input, ty::InferConst::Fresh, ct.ty()) } ty::ConstKind::Infer(ty::InferConst::EffectVar(v)) => { - let opt_ct = - self.infcx.inner.borrow_mut().effect_unification_table().probe_value(v).known(); - self.freshen_const( - opt_ct, - ty::InferConst::EffectVar(v), - ty::InferConst::Fresh, - ct.ty(), - ) + let mut inner = self.infcx.inner.borrow_mut(); + let input = + inner.effect_unification_table().probe_value(v).known().ok_or_else(|| { + ty::InferConst::EffectVar(inner.effect_unification_table().find(v).vid) + }); + drop(inner); + self.freshen_const(input, ty::InferConst::Fresh, ct.ty()) } ty::ConstKind::Infer(ty::InferConst::Fresh(i)) => { if i >= self.const_freshen_count { @@ -191,35 +191,37 @@ impl<'a, 'tcx> TypeFreshener<'a, 'tcx> { fn fold_infer_ty(&mut self, v: ty::InferTy) -> Option> { match v { ty::TyVar(v) => { - let opt_ty = self.infcx.inner.borrow_mut().type_variables().probe(v).known(); - Some(self.freshen_ty(opt_ty, ty::TyVar(v), |n| Ty::new_fresh(self.infcx.tcx, n))) + let mut inner = self.infcx.inner.borrow_mut(); + let input = inner + .type_variables() + .probe(v) + .known() + .ok_or_else(|| ty::TyVar(inner.type_variables().root_var(v))); + drop(inner); + Some(self.freshen_ty(input, |n| Ty::new_fresh(self.infcx.tcx, n))) } - ty::IntVar(v) => Some( - self.freshen_ty( - self.infcx - .inner - .borrow_mut() - .int_unification_table() - .probe_value(v) - .map(|v| v.to_type(self.infcx.tcx)), - ty::IntVar(v), - |n| Ty::new_fresh_int(self.infcx.tcx, n), - ), - ), + ty::IntVar(v) => { + let mut inner = self.infcx.inner.borrow_mut(); + let input = inner + .int_unification_table() + .probe_value(v) + .map(|v| v.to_type(self.infcx.tcx)) + .ok_or_else(|| ty::IntVar(inner.int_unification_table().find(v))); + drop(inner); + Some(self.freshen_ty(input, |n| Ty::new_fresh_int(self.infcx.tcx, n))) + } - ty::FloatVar(v) => Some( - self.freshen_ty( - self.infcx - .inner - .borrow_mut() - .float_unification_table() - .probe_value(v) - .map(|v| v.to_type(self.infcx.tcx)), - ty::FloatVar(v), - |n| Ty::new_fresh_float(self.infcx.tcx, n), - ), - ), + ty::FloatVar(v) => { + let mut inner = self.infcx.inner.borrow_mut(); + let input = inner + .float_unification_table() + .probe_value(v) + .map(|v| v.to_type(self.infcx.tcx)) + .ok_or_else(|| ty::FloatVar(inner.float_unification_table().find(v))); + drop(inner); + Some(self.freshen_ty(input, |n| Ty::new_fresh_float(self.infcx.tcx, n))) + } ty::FreshTy(ct) | ty::FreshIntTy(ct) | ty::FreshFloatTy(ct) => { if ct >= self.ty_freshen_count { diff --git a/compiler/rustc_infer/src/infer/mod.rs b/compiler/rustc_infer/src/infer/mod.rs index 8fc71671b271..c30f42c1656e 100644 --- a/compiler/rustc_infer/src/infer/mod.rs +++ b/compiler/rustc_infer/src/infer/mod.rs @@ -374,7 +374,10 @@ impl<'tcx> ty::InferCtxtLike for InferCtxt<'tcx> { } fn universe_of_lt(&self, lt: ty::RegionVid) -> Option { - Some(self.universe_of_region_vid(lt)) + match self.inner.borrow_mut().unwrap_region_constraints().probe_value(lt) { + Err(universe) => Some(universe), + Ok(_) => None, + } } fn root_ty_var(&self, vid: TyVid) -> TyVid { @@ -762,6 +765,7 @@ impl<'tcx> InferCtxt<'tcx> { pub fn err_ctxt(&self) -> TypeErrCtxt<'_, 'tcx> { TypeErrCtxt { infcx: self, + sub_relations: Default::default(), typeck_results: None, fallback_has_occurred: false, normalize_fn_sig: Box::new(|fn_sig| fn_sig), @@ -1029,7 +1033,6 @@ impl<'tcx> InferCtxt<'tcx> { let r_b = self.shallow_resolve(predicate.skip_binder().b); match (r_a.kind(), r_b.kind()) { (&ty::Infer(ty::TyVar(a_vid)), &ty::Infer(ty::TyVar(b_vid))) => { - self.inner.borrow_mut().type_variables().sub(a_vid, b_vid); return Err((a_vid, b_vid)); } _ => {} @@ -1155,11 +1158,6 @@ impl<'tcx> InferCtxt<'tcx> { self.inner.borrow_mut().unwrap_region_constraints().universe(r) } - /// Return the universe that the region variable `r` was created in. - pub fn universe_of_region_vid(&self, vid: ty::RegionVid) -> ty::UniverseIndex { - self.inner.borrow_mut().unwrap_region_constraints().var_universe(vid) - } - /// Number of region variables created so far. pub fn num_region_vars(&self) -> usize { self.inner.borrow_mut().unwrap_region_constraints().num_region_vars() diff --git a/compiler/rustc_infer/src/infer/region_constraints/leak_check.rs b/compiler/rustc_infer/src/infer/region_constraints/leak_check.rs index b2bcbbf2e53b..9e2f3a10b6a6 100644 --- a/compiler/rustc_infer/src/infer/region_constraints/leak_check.rs +++ b/compiler/rustc_infer/src/infer/region_constraints/leak_check.rs @@ -90,11 +90,11 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> { } } -struct LeakCheck<'me, 'tcx> { +struct LeakCheck<'a, 'b, 'tcx> { tcx: TyCtxt<'tcx>, outer_universe: ty::UniverseIndex, - mini_graph: &'me MiniGraph<'tcx>, - rcc: &'me RegionConstraintCollector<'me, 'tcx>, + mini_graph: &'a MiniGraph<'tcx>, + rcc: &'a mut RegionConstraintCollector<'b, 'tcx>, // Initially, for each SCC S, stores a placeholder `P` such that `S = P` // must hold. @@ -117,13 +117,13 @@ struct LeakCheck<'me, 'tcx> { scc_universes: IndexVec>, } -impl<'me, 'tcx> LeakCheck<'me, 'tcx> { +impl<'a, 'b, 'tcx> LeakCheck<'a, 'b, 'tcx> { fn new( tcx: TyCtxt<'tcx>, outer_universe: ty::UniverseIndex, max_universe: ty::UniverseIndex, - mini_graph: &'me MiniGraph<'tcx>, - rcc: &'me RegionConstraintCollector<'me, 'tcx>, + mini_graph: &'a MiniGraph<'tcx>, + rcc: &'a mut RegionConstraintCollector<'b, 'tcx>, ) -> Self { let dummy_scc_universe = SccUniverse { universe: max_universe, region: None }; Self { diff --git a/compiler/rustc_infer/src/infer/region_constraints/mod.rs b/compiler/rustc_infer/src/infer/region_constraints/mod.rs index 71adf5260972..ee97dd368075 100644 --- a/compiler/rustc_infer/src/infer/region_constraints/mod.rs +++ b/compiler/rustc_infer/src/infer/region_constraints/mod.rs @@ -8,12 +8,11 @@ use super::{ }; use rustc_data_structures::fx::FxHashMap; -use rustc_data_structures::intern::Interned; use rustc_data_structures::sync::Lrc; use rustc_data_structures::undo_log::UndoLogs; use rustc_data_structures::unify as ut; use rustc_index::IndexVec; -use rustc_middle::infer::unify_key::{RegionVidKey, UnifiedRegion}; +use rustc_middle::infer::unify_key::{RegionVariableValue, RegionVidKey}; use rustc_middle::ty::ReStatic; use rustc_middle::ty::{self, Ty, TyCtxt}; use rustc_middle::ty::{ReBound, ReVar}; @@ -292,6 +291,18 @@ type CombineMap<'tcx> = FxHashMap, RegionVid>; #[derive(Debug, Clone, Copy)] pub struct RegionVariableInfo { pub origin: RegionVariableOrigin, + // FIXME: This is only necessary for `fn take_and_reset_data` and + // `lexical_region_resolve`. We should rework `lexical_region_resolve` + // in the near/medium future anyways and could move the unverse info + // for `fn take_and_reset_data` into a separate table which is + // only populated when needed. + // + // For both of these cases it is fine that this can diverge from the + // actual universe of the variable, which is directly stored in the + // unification table for unknown region variables. At some point we could + // stop emitting bidirectional outlives constraints if equate succeeds. + // This would be currently unsound as it would cause us to drop the universe + // changes in `lexical_region_resolve`. pub universe: ty::UniverseIndex, } @@ -395,7 +406,11 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> { // `RegionConstraintData` contains the relationship here. if *any_unifications { *any_unifications = false; - self.unification_table_mut().reset_unifications(|_| UnifiedRegion::new(None)); + // Manually inlined `self.unification_table_mut()` as `self` is used in the closure. + ut::UnificationTable::with_log(&mut self.storage.unification_table, &mut self.undo_log) + .reset_unifications(|key| RegionVariableValue::Unknown { + universe: self.storage.var_infos[key.vid].universe, + }); } data @@ -422,18 +437,13 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> { ) -> RegionVid { let vid = self.var_infos.push(RegionVariableInfo { origin, universe }); - let u_vid = self.unification_table_mut().new_key(UnifiedRegion::new(None)); + let u_vid = self.unification_table_mut().new_key(RegionVariableValue::Unknown { universe }); assert_eq!(vid, u_vid.vid); self.undo_log.push(AddVar(vid)); debug!("created new region variable {:?} in {:?} with origin {:?}", vid, universe, origin); vid } - /// Returns the universe for the given variable. - pub(super) fn var_universe(&self, vid: RegionVid) -> ty::UniverseIndex { - self.var_infos[vid].universe - } - /// Returns the origin for the given variable. pub(super) fn var_origin(&self, vid: RegionVid) -> RegionVariableOrigin { self.var_infos[vid].origin @@ -467,26 +477,41 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> { pub(super) fn make_eqregion( &mut self, origin: SubregionOrigin<'tcx>, - sub: Region<'tcx>, - sup: Region<'tcx>, + a: Region<'tcx>, + b: Region<'tcx>, ) { - if sub != sup { + if a != b { // Eventually, it would be nice to add direct support for // equating regions. - self.make_subregion(origin.clone(), sub, sup); - self.make_subregion(origin, sup, sub); + self.make_subregion(origin.clone(), a, b); + self.make_subregion(origin, b, a); - match (sub, sup) { - (Region(Interned(ReVar(sub), _)), Region(Interned(ReVar(sup), _))) => { - debug!("make_eqregion: unifying {:?} with {:?}", sub, sup); - self.unification_table_mut().union(*sub, *sup); - self.any_unifications = true; + match (a.kind(), b.kind()) { + (ty::ReVar(a), ty::ReVar(b)) => { + debug!("make_eqregion: unifying {:?} with {:?}", a, b); + if self.unification_table_mut().unify_var_var(a, b).is_ok() { + self.any_unifications = true; + } } - (Region(Interned(ReVar(vid), _)), value) - | (value, Region(Interned(ReVar(vid), _))) => { - debug!("make_eqregion: unifying {:?} with {:?}", vid, value); - self.unification_table_mut().union_value(*vid, UnifiedRegion::new(Some(value))); - self.any_unifications = true; + (ty::ReVar(vid), _) => { + debug!("make_eqregion: unifying {:?} with {:?}", vid, b); + if self + .unification_table_mut() + .unify_var_value(vid, RegionVariableValue::Known { value: b }) + .is_ok() + { + self.any_unifications = true; + }; + } + (_, ty::ReVar(vid)) => { + debug!("make_eqregion: unifying {:?} with {:?}", a, vid); + if self + .unification_table_mut() + .unify_var_value(vid, RegionVariableValue::Known { value: a }) + .is_ok() + { + self.any_unifications = true; + }; } (_, _) => {} } @@ -603,18 +628,21 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> { tcx: TyCtxt<'tcx>, vid: ty::RegionVid, ) -> ty::Region<'tcx> { - let mut ut = self.unification_table_mut(); // FIXME(rust-lang/ena#42): unnecessary mut + let mut ut = self.unification_table_mut(); let root_vid = ut.find(vid).vid; - let resolved = ut - .probe_value(root_vid) - .get_value_ignoring_universes() - .unwrap_or_else(|| ty::Region::new_var(tcx, root_vid)); + match ut.probe_value(root_vid) { + RegionVariableValue::Known { value } => value, + RegionVariableValue::Unknown { .. } => ty::Region::new_var(tcx, root_vid), + } + } - // Don't resolve a variable to a region that it cannot name. - if self.var_universe(vid).can_name(self.universe(resolved)) { - resolved - } else { - ty::Region::new_var(tcx, vid) + pub fn probe_value( + &mut self, + vid: ty::RegionVid, + ) -> Result, ty::UniverseIndex> { + match self.unification_table_mut().probe_value(vid) { + RegionVariableValue::Known { value } => Ok(value), + RegionVariableValue::Unknown { universe } => Err(universe), } } @@ -654,7 +682,7 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> { new_r } - pub fn universe(&self, region: Region<'tcx>) -> ty::UniverseIndex { + pub fn universe(&mut self, region: Region<'tcx>) -> ty::UniverseIndex { match *region { ty::ReStatic | ty::ReErased @@ -662,7 +690,10 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> { | ty::ReEarlyParam(..) | ty::ReError(_) => ty::UniverseIndex::ROOT, ty::RePlaceholder(placeholder) => placeholder.universe, - ty::ReVar(vid) => self.var_universe(vid), + ty::ReVar(vid) => match self.probe_value(vid) { + Ok(value) => self.universe(value), + Err(universe) => universe, + }, ty::ReBound(..) => bug!("universe(): encountered bound region {:?}", region), } } diff --git a/compiler/rustc_infer/src/infer/relate/generalize.rs b/compiler/rustc_infer/src/infer/relate/generalize.rs index 90f10a0eba9e..2e1ea19078cd 100644 --- a/compiler/rustc_infer/src/infer/relate/generalize.rs +++ b/compiler/rustc_infer/src/infer/relate/generalize.rs @@ -26,13 +26,13 @@ impl<'tcx> InferCtxt<'tcx> { /// This is *not* expected to be used anywhere except for an implementation of /// `TypeRelation`. Do not use this, and instead please use `At::eq`, for all /// other usecases (i.e. setting the value of a type var). - #[instrument(level = "debug", skip(self, relation, target_is_expected))] + #[instrument(level = "debug", skip(self, relation))] pub fn instantiate_ty_var>( &self, relation: &mut R, target_is_expected: bool, target_vid: ty::TyVid, - ambient_variance: ty::Variance, + instantiation_variance: ty::Variance, source_ty: Ty<'tcx>, ) -> RelateResult<'tcx, ()> { debug_assert!(self.inner.borrow_mut().type_variables().probe(target_vid).is_unknown()); @@ -46,7 +46,7 @@ impl<'tcx> InferCtxt<'tcx> { // // We then relate `generalized_ty <: source_ty`,adding constraints like `'x: '?2` and `?1 <: ?3`. let Generalization { value_may_be_infer: generalized_ty, has_unconstrained_ty_var } = - self.generalize(relation.span(), target_vid, ambient_variance, source_ty)?; + self.generalize(relation.span(), target_vid, instantiation_variance, source_ty)?; // Constrain `b_vid` to the generalized type `generalized_ty`. if let &ty::Infer(ty::TyVar(generalized_vid)) = generalized_ty.kind() { @@ -73,7 +73,7 @@ impl<'tcx> InferCtxt<'tcx> { // the alias can be normalized to something which does not // mention `?0`. if self.next_trait_solver() { - let (lhs, rhs, direction) = match ambient_variance { + let (lhs, rhs, direction) = match instantiation_variance { ty::Variance::Invariant => { (generalized_ty.into(), source_ty.into(), AliasRelationDirection::Equate) } @@ -106,22 +106,28 @@ impl<'tcx> InferCtxt<'tcx> { } } } else { - // HACK: make sure that we `a_is_expected` continues to be - // correct when relating the generalized type with the source. + // NOTE: The `instantiation_variance` is not the same variance as + // used by the relation. When instantiating `b`, `target_is_expected` + // is flipped and the `instantion_variance` is also flipped. To + // constrain the `generalized_ty` while using the original relation, + // we therefore only have to flip the arguments. + // + // ```ignore (not code) + // ?a rel B + // instantiate_ty_var(?a, B) # expected and variance not flipped + // B' rel B + // ``` + // or + // ```ignore (not code) + // A rel ?b + // instantiate_ty_var(?b, A) # expected and variance flipped + // A rel A' + // ``` if target_is_expected == relation.a_is_expected() { - relation.relate_with_variance( - ambient_variance, - ty::VarianceDiagInfo::default(), - generalized_ty, - source_ty, - )?; + relation.relate(generalized_ty, source_ty)?; } else { - relation.relate_with_variance( - ambient_variance.xform(ty::Contravariant), - ty::VarianceDiagInfo::default(), - source_ty, - generalized_ty, - )?; + debug!("flip relation"); + relation.relate(source_ty, generalized_ty)?; } } @@ -217,10 +223,9 @@ impl<'tcx> InferCtxt<'tcx> { ) -> RelateResult<'tcx, Generalization> { assert!(!source_term.has_escaping_bound_vars()); let (for_universe, root_vid) = match target_vid.into() { - ty::TermVid::Ty(ty_vid) => ( - self.probe_ty_var(ty_vid).unwrap_err(), - ty::TermVid::Ty(self.inner.borrow_mut().type_variables().sub_root_var(ty_vid)), - ), + ty::TermVid::Ty(ty_vid) => { + (self.probe_ty_var(ty_vid).unwrap_err(), ty::TermVid::Ty(self.root_var(ty_vid))) + } ty::TermVid::Const(ct_vid) => ( self.probe_const_var(ct_vid).unwrap_err(), ty::TermVid::Const( @@ -424,9 +429,7 @@ impl<'tcx> TypeRelation<'tcx> for Generalizer<'_, 'tcx> { ty::Infer(ty::TyVar(vid)) => { let mut inner = self.infcx.inner.borrow_mut(); let vid = inner.type_variables().root_var(vid); - let sub_vid = inner.type_variables().sub_root_var(vid); - - if ty::TermVid::Ty(sub_vid) == self.root_vid { + if ty::TermVid::Ty(vid) == self.root_vid { // If sub-roots are equal, then `root_vid` and // `vid` are related via subtyping. Err(self.cyclic_term_error()) @@ -461,11 +464,6 @@ impl<'tcx> TypeRelation<'tcx> for Generalizer<'_, 'tcx> { let new_var_id = inner.type_variables().new_var(self.for_universe, origin); let u = Ty::new_var(self.tcx(), new_var_id); - - // Record that we replaced `vid` with `new_var_id` as part of a generalization - // operation. This is needed to detect cyclic types. To see why, see the - // docs in the `type_variables` module. - inner.type_variables().sub(vid, new_var_id); debug!("replacing original vid={:?} with new={:?}", vid, u); Ok(u) } diff --git a/compiler/rustc_infer/src/infer/type_variable.rs b/compiler/rustc_infer/src/infer/type_variable.rs index 8b81eac87390..3630b0f439ff 100644 --- a/compiler/rustc_infer/src/infer/type_variable.rs +++ b/compiler/rustc_infer/src/infer/type_variable.rs @@ -1,3 +1,4 @@ +use rustc_data_structures::undo_log::Rollback; use rustc_hir::def_id::DefId; use rustc_index::IndexVec; use rustc_middle::ty::{self, Ty, TyVid}; @@ -12,35 +13,9 @@ use std::cmp; use std::marker::PhantomData; use std::ops::Range; -use rustc_data_structures::undo_log::Rollback; - -/// Represents a single undo-able action that affects a type inference variable. -#[derive(Clone)] -pub(crate) enum UndoLog<'tcx> { - EqRelation(sv::UndoLog>>), - SubRelation(sv::UndoLog>), -} - -/// Convert from a specific kind of undo to the more general UndoLog -impl<'tcx> From>>> for UndoLog<'tcx> { - fn from(l: sv::UndoLog>>) -> Self { - UndoLog::EqRelation(l) - } -} - -/// Convert from a specific kind of undo to the more general UndoLog -impl<'tcx> From>> for UndoLog<'tcx> { - fn from(l: sv::UndoLog>) -> Self { - UndoLog::SubRelation(l) - } -} - -impl<'tcx> Rollback> for TypeVariableStorage<'tcx> { - fn reverse(&mut self, undo: UndoLog<'tcx>) { - match undo { - UndoLog::EqRelation(undo) => self.eq_relations.reverse(undo), - UndoLog::SubRelation(undo) => self.sub_relations.reverse(undo), - } +impl<'tcx> Rollback>>> for TypeVariableStorage<'tcx> { + fn reverse(&mut self, undo: sv::UndoLog>>) { + self.eq_relations.reverse(undo) } } @@ -52,41 +27,6 @@ pub struct TypeVariableStorage<'tcx> { /// constraint `?X == ?Y`. This table also stores, for each key, /// the known value. eq_relations: ut::UnificationTableStorage>, - - /// Two variables are unified in `sub_relations` when we have a - /// constraint `?X <: ?Y` *or* a constraint `?Y <: ?X`. This second - /// table exists only to help with the occurs check. In particular, - /// we want to report constraints like these as an occurs check - /// violation: - /// ``` text - /// ?1 <: ?3 - /// Box <: ?1 - /// ``` - /// Without this second table, what would happen in a case like - /// this is that we would instantiate `?1` with a generalized - /// type like `Box`. We would then relate `Box <: Box` - /// and infer that `?3 <: ?6`. Next, since `?1` was instantiated, - /// we would process `?1 <: ?3`, generalize `?1 = Box` to `Box`, - /// and instantiate `?3` with `Box`. Finally, we would relate - /// `?6 <: ?9`. But now that we instantiated `?3`, we can process - /// `?3 <: ?6`, which gives us `Box <: ?6`... and the cycle - /// continues. (This is `occurs-check-2.rs`.) - /// - /// What prevents this cycle is that when we generalize - /// `Box` to `Box`, we also sub-unify `?3` and `?6` - /// (in the generalizer). When we then process `Box <: ?3`, - /// the occurs check then fails because `?6` and `?3` are sub-unified, - /// and hence generalization fails. - /// - /// This is reasonable because, in Rust, subtypes have the same - /// "skeleton" and hence there is no possible type such that - /// (e.g.) `Box <: ?3` for any `?3`. - /// - /// In practice, we sometimes sub-unify variables in other spots, such - /// as when processing subtype predicates. This is not necessary but is - /// done to aid diagnostics, as it allows us to be more effective when - /// we guide the user towards where they should insert type hints. - sub_relations: ut::UnificationTableStorage, } pub struct TypeVariableTable<'a, 'tcx> { @@ -158,7 +98,6 @@ impl<'tcx> TypeVariableStorage<'tcx> { TypeVariableStorage { values: Default::default(), eq_relations: ut::UnificationTableStorage::new(), - sub_relations: ut::UnificationTableStorage::new(), } } @@ -197,16 +136,6 @@ impl<'tcx> TypeVariableTable<'_, 'tcx> { debug_assert!(self.probe(a).is_unknown()); debug_assert!(self.probe(b).is_unknown()); self.eq_relations().union(a, b); - self.sub_relations().union(a, b); - } - - /// Records that `a <: b`, depending on `dir`. - /// - /// Precondition: neither `a` nor `b` are known. - pub fn sub(&mut self, a: ty::TyVid, b: ty::TyVid) { - debug_assert!(self.probe(a).is_unknown()); - debug_assert!(self.probe(b).is_unknown()); - self.sub_relations().union(a, b); } /// Instantiates `vid` with the type `ty`. @@ -240,10 +169,6 @@ impl<'tcx> TypeVariableTable<'_, 'tcx> { origin: TypeVariableOrigin, ) -> ty::TyVid { let eq_key = self.eq_relations().new_key(TypeVariableValue::Unknown { universe }); - - let sub_key = self.sub_relations().new_key(()); - debug_assert_eq!(eq_key.vid, sub_key); - let index = self.storage.values.push(TypeVariableData { origin }); debug_assert_eq!(eq_key.vid, index); @@ -266,24 +191,6 @@ impl<'tcx> TypeVariableTable<'_, 'tcx> { self.eq_relations().find(vid).vid } - /// Returns the "root" variable of `vid` in the `sub_relations` - /// equivalence table. All type variables that have been are - /// related via equality or subtyping will yield the same root - /// variable (per the union-find algorithm), so `sub_root_var(a) - /// == sub_root_var(b)` implies that: - /// ```text - /// exists X. (a <: X || X <: a) && (b <: X || X <: b) - /// ``` - pub fn sub_root_var(&mut self, vid: ty::TyVid) -> ty::TyVid { - self.sub_relations().find(vid) - } - - /// Returns `true` if `a` and `b` have same "sub-root" (i.e., exists some - /// type X such that `forall i in {a, b}. (i <: X || X <: i)`. - pub fn sub_unified(&mut self, a: ty::TyVid, b: ty::TyVid) -> bool { - self.sub_root_var(a) == self.sub_root_var(b) - } - /// Retrieves the type to which `vid` has been instantiated, if /// any. pub fn probe(&mut self, vid: ty::TyVid) -> TypeVariableValue<'tcx> { @@ -314,11 +221,6 @@ impl<'tcx> TypeVariableTable<'_, 'tcx> { self.storage.eq_relations.with_log(self.undo_log) } - #[inline] - fn sub_relations(&mut self) -> super::UnificationTable<'_, 'tcx, ty::TyVid> { - self.storage.sub_relations.with_log(self.undo_log) - } - /// Returns a range of the type variables created during the snapshot. pub fn vars_since_snapshot( &mut self, diff --git a/compiler/rustc_infer/src/infer/undo_log.rs b/compiler/rustc_infer/src/infer/undo_log.rs index be02452d89fb..829b0a73a0df 100644 --- a/compiler/rustc_infer/src/infer/undo_log.rs +++ b/compiler/rustc_infer/src/infer/undo_log.rs @@ -20,7 +20,7 @@ pub struct Snapshot<'tcx> { #[derive(Clone)] pub(crate) enum UndoLog<'tcx> { OpaqueTypes(OpaqueTypeKey<'tcx>, Option>), - TypeVariables(type_variable::UndoLog<'tcx>), + TypeVariables(sv::UndoLog>>), ConstUnificationTable(sv::UndoLog>>), IntUnificationTable(sv::UndoLog>), FloatUnificationTable(sv::UndoLog>), @@ -46,17 +46,13 @@ macro_rules! impl_from { // Upcast from a single kind of "undoable action" to the general enum impl_from! { RegionConstraintCollector(region_constraints::UndoLog<'tcx>), - TypeVariables(type_variable::UndoLog<'tcx>), TypeVariables(sv::UndoLog>>), - TypeVariables(sv::UndoLog>), - IntUnificationTable(sv::UndoLog>), - FloatUnificationTable(sv::UndoLog>), - EffectUnificationTable(sv::UndoLog>>), ConstUnificationTable(sv::UndoLog>>), + EffectUnificationTable(sv::UndoLog>>), RegionUnificationTable(sv::UndoLog>>), ProjectionCache(traits::UndoLog<'tcx>), diff --git a/compiler/rustc_lint/messages.ftl b/compiler/rustc_lint/messages.ftl index 1548646c04a2..496ffeddbffb 100644 --- a/compiler/rustc_lint/messages.ftl +++ b/compiler/rustc_lint/messages.ftl @@ -429,6 +429,7 @@ lint_non_upper_case_global = {$sort} `{$name}` should have an upper case name lint_noop_method_call = call to `.{$method}()` on a reference in this situation does nothing .suggestion = remove this redundant call .note = the type `{$orig_ty}` does not implement `{$trait_}`, so calling `{$method}` on `&{$orig_ty}` copies the reference, which does not do anything and can be removed + .derive_suggestion = if you meant to clone `{$orig_ty}`, implement `Clone` for it lint_only_cast_u8_to_char = only `u8` can be cast into `char` .suggestion = use a `char` literal instead diff --git a/compiler/rustc_lint/src/lints.rs b/compiler/rustc_lint/src/lints.rs index f067c365170a..d73b9015ce1d 100644 --- a/compiler/rustc_lint/src/lints.rs +++ b/compiler/rustc_lint/src/lints.rs @@ -1314,6 +1314,12 @@ pub struct NoopMethodCallDiag<'a> { pub trait_: Symbol, #[suggestion(code = "", applicability = "machine-applicable")] pub label: Span, + #[suggestion( + lint_derive_suggestion, + code = "#[derive(Clone)]\n", + applicability = "maybe-incorrect" + )] + pub suggest_derive: Option, } #[derive(LintDiagnostic)] diff --git a/compiler/rustc_lint/src/noop_method_call.rs b/compiler/rustc_lint/src/noop_method_call.rs index 26c5e4fb4837..970d411fb065 100644 --- a/compiler/rustc_lint/src/noop_method_call.rs +++ b/compiler/rustc_lint/src/noop_method_call.rs @@ -121,10 +121,20 @@ impl<'tcx> LateLintPass<'tcx> for NoopMethodCall { let orig_ty = expr_ty.peel_refs(); if receiver_ty == expr_ty { + let suggest_derive = match orig_ty.kind() { + ty::Adt(def, _) => Some(cx.tcx.def_span(def.did()).shrink_to_lo()), + _ => None, + }; cx.emit_span_lint( NOOP_METHOD_CALL, span, - NoopMethodCallDiag { method: call.ident.name, orig_ty, trait_, label: span }, + NoopMethodCallDiag { + method: call.ident.name, + orig_ty, + trait_, + label: span, + suggest_derive, + }, ); } else { match name { diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp index 7326f2e8e2a2..af2353fbb19c 100644 --- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp @@ -450,6 +450,20 @@ extern "C" void LLVMRustSetAlgebraicMath(LLVMValueRef V) { } } +// Enable the reassoc fast-math flag, allowing transformations that pretend +// floating-point addition and multiplication are associative. +// +// Note that this does NOT enable any flags which can cause a floating-point operation on +// well-defined inputs to return poison, and therefore this function can be used to build +// safe Rust intrinsics (such as fadd_algebraic). +// +// https://llvm.org/docs/LangRef.html#fast-math-flags +extern "C" void LLVMRustSetAllowReassoc(LLVMValueRef V) { + if (auto I = dyn_cast(unwrap(V))) { + I->setHasAllowReassoc(true); + } +} + extern "C" LLVMValueRef LLVMRustBuildAtomicLoad(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Source, const char *Name, LLVMAtomicOrdering Order) { diff --git a/compiler/rustc_middle/src/infer/unify_key.rs b/compiler/rustc_middle/src/infer/unify_key.rs index 63c0ebd5f6b7..84b428297dbb 100644 --- a/compiler/rustc_middle/src/infer/unify_key.rs +++ b/compiler/rustc_middle/src/infer/unify_key.rs @@ -1,4 +1,4 @@ -use crate::ty::{self, Region, Ty, TyCtxt}; +use crate::ty::{self, Ty, TyCtxt}; use rustc_data_structures::unify::{NoError, UnifyKey, UnifyValue}; use rustc_span::def_id::DefId; use rustc_span::symbol::Symbol; @@ -10,26 +10,16 @@ pub trait ToType { fn to_type<'tcx>(&self, tcx: TyCtxt<'tcx>) -> Ty<'tcx>; } -#[derive(PartialEq, Copy, Clone, Debug)] -pub struct UnifiedRegion<'tcx> { - value: Option>, -} - -impl<'tcx> UnifiedRegion<'tcx> { - pub fn new(value: Option>) -> Self { - Self { value } - } - - /// The caller is responsible for checking universe compatibility before using this value. - pub fn get_value_ignoring_universes(self) -> Option> { - self.value - } +#[derive(Copy, Clone, Debug)] +pub enum RegionVariableValue<'tcx> { + Known { value: ty::Region<'tcx> }, + Unknown { universe: ty::UniverseIndex }, } #[derive(PartialEq, Copy, Clone, Debug)] pub struct RegionVidKey<'tcx> { pub vid: ty::RegionVid, - pub phantom: PhantomData>, + pub phantom: PhantomData>, } impl<'tcx> From for RegionVidKey<'tcx> { @@ -39,7 +29,7 @@ impl<'tcx> From for RegionVidKey<'tcx> { } impl<'tcx> UnifyKey for RegionVidKey<'tcx> { - type Value = UnifiedRegion<'tcx>; + type Value = RegionVariableValue<'tcx>; #[inline] fn index(&self) -> u32 { self.vid.as_u32() @@ -53,36 +43,47 @@ impl<'tcx> UnifyKey for RegionVidKey<'tcx> { } } -impl<'tcx> UnifyValue for UnifiedRegion<'tcx> { - type Error = NoError; +pub struct RegionUnificationError; +impl<'tcx> UnifyValue for RegionVariableValue<'tcx> { + type Error = RegionUnificationError; - fn unify_values(value1: &Self, value2: &Self) -> Result { - // We pick the value of the least universe because it is compatible with more variables. - // This is *not* necessary for completeness. - #[cold] - fn min_universe<'tcx>(r1: Region<'tcx>, r2: Region<'tcx>) -> Region<'tcx> { - cmp::min_by_key(r1, r2, |r| match r.kind() { - ty::ReStatic - | ty::ReErased - | ty::ReLateParam(..) - | ty::ReEarlyParam(..) - | ty::ReError(_) => ty::UniverseIndex::ROOT, - ty::RePlaceholder(placeholder) => placeholder.universe, - ty::ReVar(..) | ty::ReBound(..) => bug!("not a universal region"), - }) + fn unify_values(value1: &Self, value2: &Self) -> Result { + match (*value1, *value2) { + (RegionVariableValue::Known { .. }, RegionVariableValue::Known { .. }) => { + Err(RegionUnificationError) + } + + (RegionVariableValue::Known { value }, RegionVariableValue::Unknown { universe }) + | (RegionVariableValue::Unknown { universe }, RegionVariableValue::Known { value }) => { + let universe_of_value = match value.kind() { + ty::ReStatic + | ty::ReErased + | ty::ReLateParam(..) + | ty::ReEarlyParam(..) + | ty::ReError(_) => ty::UniverseIndex::ROOT, + ty::RePlaceholder(placeholder) => placeholder.universe, + ty::ReVar(..) | ty::ReBound(..) => bug!("not a universal region"), + }; + + if universe.can_name(universe_of_value) { + Ok(RegionVariableValue::Known { value }) + } else { + Err(RegionUnificationError) + } + } + + ( + RegionVariableValue::Unknown { universe: a }, + RegionVariableValue::Unknown { universe: b }, + ) => { + // If we unify two unconstrained regions then whatever + // value they wind up taking (which must be the same value) must + // be nameable by both universes. Therefore, the resulting + // universe is the minimum of the two universes, because that is + // the one which contains the fewest names in scope. + Ok(RegionVariableValue::Unknown { universe: a.min(b) }) + } } - - Ok(match (value1.value, value2.value) { - // Here we can just pick one value, because the full constraints graph - // will be handled later. Ideally, we might want a `MultipleValues` - // variant or something. For now though, this is fine. - (Some(val1), Some(val2)) => Self { value: Some(min_universe(val1, val2)) }, - - (Some(_), _) => *value1, - (_, Some(_)) => *value2, - - (None, None) => *value1, - }) } } diff --git a/compiler/rustc_middle/src/lib.rs b/compiler/rustc_middle/src/lib.rs index 9c0846e9fb19..c3e4a03ad167 100644 --- a/compiler/rustc_middle/src/lib.rs +++ b/compiler/rustc_middle/src/lib.rs @@ -24,6 +24,8 @@ #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![doc(rust_logo)] +#![cfg_attr(bootstrap, feature(exhaustive_patterns))] +#![cfg_attr(not(bootstrap), feature(min_exhaustive_patterns))] #![feature(rustdoc_internals)] #![feature(allocator_api)] #![feature(array_windows)] @@ -32,7 +34,6 @@ #![feature(core_intrinsics)] #![feature(const_type_name)] #![feature(discriminant_kind)] -#![feature(exhaustive_patterns)] #![feature(coroutines)] #![feature(generic_nonzero)] #![feature(if_let_guard)] diff --git a/compiler/rustc_middle/src/query/on_disk_cache.rs b/compiler/rustc_middle/src/query/on_disk_cache.rs index f4dfbe059ebc..9c7c46f2ad24 100644 --- a/compiler/rustc_middle/src/query/on_disk_cache.rs +++ b/compiler/rustc_middle/src/query/on_disk_cache.rs @@ -233,7 +233,7 @@ impl<'sess> OnDiskCache<'sess> { for (index, file) in files.iter().enumerate() { let index = SourceFileIndex(index as u32); - let file_ptr: *const SourceFile = &**file as *const _; + let file_ptr: *const SourceFile = std::ptr::addr_of!(**file); file_to_file_index.insert(file_ptr, index); let source_file_id = EncodedSourceFileId::new(tcx, file); file_index_to_stable_id.insert(index, source_file_id); @@ -835,7 +835,7 @@ pub struct CacheEncoder<'a, 'tcx> { impl<'a, 'tcx> CacheEncoder<'a, 'tcx> { #[inline] fn source_file_index(&mut self, source_file: Lrc) -> SourceFileIndex { - self.file_to_file_index[&(&*source_file as *const SourceFile)] + self.file_to_file_index[&std::ptr::addr_of!(*source_file)] } /// Encode something with additional information that allows to do some diff --git a/compiler/rustc_middle/src/traits/select.rs b/compiler/rustc_middle/src/traits/select.rs index e3050007c7b3..8e9751f45294 100644 --- a/compiler/rustc_middle/src/traits/select.rs +++ b/compiler/rustc_middle/src/traits/select.rs @@ -139,7 +139,7 @@ pub enum SelectionCandidate<'tcx> { /// generated for an `async ||` expression. AsyncClosureCandidate, - /// Implementation of the the `AsyncFnKindHelper` helper trait, which + /// Implementation of the `AsyncFnKindHelper` helper trait, which /// is used internally to delay computation for async closures until after /// upvar analysis is performed in HIR typeck. AsyncFnKindHelperCandidate, diff --git a/compiler/rustc_middle/src/ty/list.rs b/compiler/rustc_middle/src/ty/list.rs index 4f9c9d85763a..336c2dce1141 100644 --- a/compiler/rustc_middle/src/ty/list.rs +++ b/compiler/rustc_middle/src/ty/list.rs @@ -61,7 +61,7 @@ impl List { // length) that is 64-byte aligned, thus featuring the necessary // trailing padding for elements with up to 64-byte alignment. static EMPTY_SLICE: InOrder = InOrder(0, MaxAlign); - unsafe { &*(&EMPTY_SLICE as *const _ as *const List) } + unsafe { &*(std::ptr::addr_of!(EMPTY_SLICE) as *const List) } } pub fn len(&self) -> usize { diff --git a/compiler/rustc_middle/src/ty/mod.rs b/compiler/rustc_middle/src/ty/mod.rs index eea3624898c8..30409e990e13 100644 --- a/compiler/rustc_middle/src/ty/mod.rs +++ b/compiler/rustc_middle/src/ty/mod.rs @@ -840,12 +840,12 @@ pub struct OpaqueHiddenType<'tcx> { } impl<'tcx> OpaqueHiddenType<'tcx> { - pub fn report_mismatch( + pub fn build_mismatch_error( &self, other: &Self, opaque_def_id: LocalDefId, tcx: TyCtxt<'tcx>, - ) -> DiagnosticBuilder<'tcx> { + ) -> Result, ErrorGuaranteed> { if let Some(diag) = tcx .sess .dcx() @@ -853,18 +853,19 @@ impl<'tcx> OpaqueHiddenType<'tcx> { { diag.cancel(); } + (self.ty, other.ty).error_reported()?; // Found different concrete types for the opaque type. let sub_diag = if self.span == other.span { TypeMismatchReason::ConflictType { span: self.span } } else { TypeMismatchReason::PreviousUse { span: self.span } }; - tcx.dcx().create_err(OpaqueHiddenTypeMismatch { + Ok(tcx.dcx().create_err(OpaqueHiddenTypeMismatch { self_ty: self.ty, other_ty: other.ty, other_span: other.span, sub: sub_diag, - }) + })) } #[instrument(level = "debug", skip(tcx), ret)] @@ -1471,7 +1472,7 @@ impl<'tcx> TyCtxt<'tcx> { .filter(move |item| item.kind == AssocKind::Fn && item.defaultness(self).has_value()) } - pub fn repr_options_of_def(self, did: DefId) -> ReprOptions { + pub fn repr_options_of_def(self, did: LocalDefId) -> ReprOptions { let mut flags = ReprFlags::empty(); let mut size = None; let mut max_align: Option = None; @@ -1479,7 +1480,8 @@ impl<'tcx> TyCtxt<'tcx> { // Generate a deterministically-derived seed from the item's path hash // to allow for cross-crate compilation to actually work - let mut field_shuffle_seed = self.def_path_hash(did).0.to_smaller_hash().as_u64(); + let mut field_shuffle_seed = + self.def_path_hash(did.to_def_id()).0.to_smaller_hash().as_u64(); // If the user defined a custom seed for layout randomization, xor the item's // path hash with the user defined seed, this will allowing determinism while diff --git a/compiler/rustc_middle/src/ty/print/mod.rs b/compiler/rustc_middle/src/ty/print/mod.rs index 19f8ba124f14..520fc1dd7aa4 100644 --- a/compiler/rustc_middle/src/ty/print/mod.rs +++ b/compiler/rustc_middle/src/ty/print/mod.rs @@ -139,7 +139,7 @@ pub trait Printer<'tcx>: Sized { _, hir::CoroutineSource::Closure, )) = self.tcx().coroutine_kind(def_id) - && args.len() >= parent_args.len() + 1 + && args.len() > parent_args.len() { return self.path_generic_args( |cx| cx.print_def_path(def_id, parent_args), diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs index 92ec1a83beeb..1910841f2684 100644 --- a/compiler/rustc_middle/src/ty/print/pretty.rs +++ b/compiler/rustc_middle/src/ty/print/pretty.rs @@ -2929,7 +2929,7 @@ define_print_and_forward_display! { ty::ExistentialTraitRef<'tcx> { // Use a type that can't appear in defaults of type parameters. - let dummy_self = Ty::new_fresh(cx.tcx(),0); + let dummy_self = Ty::new_fresh(cx.tcx(), 0); let trait_ref = self.with_self_ty(cx.tcx(), dummy_self); p!(print(trait_ref.print_only_trait_path())) } diff --git a/compiler/rustc_mir_build/src/build/matches/mod.rs b/compiler/rustc_mir_build/src/build/matches/mod.rs index 88a5eae281b3..641a278c1d3d 100644 --- a/compiler/rustc_mir_build/src/build/matches/mod.rs +++ b/compiler/rustc_mir_build/src/build/matches/mod.rs @@ -16,7 +16,7 @@ use rustc_data_structures::{ }; use rustc_index::bit_set::BitSet; use rustc_middle::middle::region; -use rustc_middle::mir::*; +use rustc_middle::mir::{self, *}; use rustc_middle::thir::{self, *}; use rustc_middle::ty::{self, CanonicalUserTypeAnnotation, Ty}; use rustc_span::symbol::Symbol; @@ -1052,18 +1052,31 @@ struct Ascription<'tcx> { variance: ty::Variance, } +#[derive(Debug, Clone)] +enum TestCase<'pat, 'tcx> { + Irrefutable { binding: Option>, ascription: Option> }, + Variant { adt_def: ty::AdtDef<'tcx>, variant_index: VariantIdx }, + Constant { value: mir::Const<'tcx> }, + Range(&'pat PatRange<'tcx>), + Slice { len: usize, variable_length: bool }, + Or, +} + #[derive(Debug, Clone)] pub(crate) struct MatchPair<'pat, 'tcx> { - // This place... + /// This place... place: PlaceBuilder<'tcx>, - // ... must match this pattern. - // Invariant: after creation and simplification in `Candidate::new()`, all match pairs must be - // simplified, i.e. require a test. - pattern: &'pat Pat<'tcx>, + /// ... must pass this test... + // Invariant: after creation and simplification in `Candidate::new()`, this must not be + // `Irrefutable`. + test_case: TestCase<'pat, 'tcx>, - /// Precomputed sub-match pairs of `pattern`. + /// ... and these subpairs must match. subpairs: Vec, + + /// The pattern this was created from. + pattern: &'pat Pat<'tcx>, } /// See [`Test`] for more. @@ -1137,39 +1150,61 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { /// the value, we will set and generate a branch to the appropriate /// pre-binding block. /// - /// If we find that *NONE* of the candidates apply, we branch to the - /// `otherwise_block`, setting it to `Some` if required. In principle, this - /// means that the input list was not exhaustive, though at present we - /// sometimes are not smart enough to recognize all exhaustive inputs. + /// If we find that *NONE* of the candidates apply, we branch to `otherwise_block`. /// /// It might be surprising that the input can be non-exhaustive. /// Indeed, initially, it is not, because all matches are /// exhaustive in Rust. But during processing we sometimes divide /// up the list of candidates and recurse with a non-exhaustive - /// list. This is important to keep the size of the generated code - /// under control. See [`Builder::test_candidates`] for more details. + /// list. This is how our lowering approach (called "backtracking + /// automaton" in the literature) works. + /// See [`Builder::test_candidates`] for more details. /// /// If `fake_borrows` is `Some`, then places which need fake borrows /// will be added to it. /// - /// For an example of a case where we set `otherwise_block`, even for an - /// exhaustive match, consider: - /// + /// For an example of how we use `otherwise_block`, consider: /// ``` - /// # fn foo(x: (bool, bool)) { - /// match x { - /// (true, true) => (), - /// (_, false) => (), - /// (false, true) => (), + /// # fn foo((x, y): (bool, bool)) -> u32 { + /// match (x, y) { + /// (true, true) => 1, + /// (_, false) => 2, + /// (false, true) => 3, /// } /// # } /// ``` + /// For this match, we generate something like: + /// ``` + /// # fn foo((x, y): (bool, bool)) -> u32 { + /// if x { + /// if y { + /// return 1 + /// } else { + /// // continue + /// } + /// } else { + /// // continue + /// } + /// if y { + /// if x { + /// // This is actually unreachable because the `(true, true)` case was handled above. + /// // continue + /// } else { + /// return 3 + /// } + /// } else { + /// return 2 + /// } + /// // this is the final `otherwise_block`, which is unreachable because the match was exhaustive. + /// unreachable!() + /// # } + /// ``` /// - /// For this match, we check if `x.0` matches `true` (for the first - /// arm). If it doesn't match, we check `x.1`. If `x.1` is `true` we check - /// if `x.0` matches `false` (for the third arm). In the (impossible at - /// runtime) case when `x.0` is now `true`, we branch to - /// `otherwise_block`. + /// Every `continue` is an instance of branching to some `otherwise_block` somewhere deep within + /// the algorithm. For more details on why we lower like this, see [`Builder::test_candidates`]. + /// + /// Note how we test `x` twice. This is the tradeoff of backtracking automata: we prefer smaller + /// code size at the expense of non-optimal code paths. #[instrument(skip(self, fake_borrows), level = "debug")] fn match_candidates<'pat>( &mut self, @@ -1544,18 +1579,12 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { } } - /// This is the most subtle part of the matching algorithm. At - /// this point, the input candidates have been fully simplified, - /// and so we know that all remaining match-pairs require some - /// sort of test. To decide what test to perform, we take the highest - /// priority candidate (the first one in the list, as of January 2021) - /// and extract the first match-pair from the list. From this we decide - /// what kind of test is needed using [`Builder::test`], defined in the - /// [`test` module](mod@test). + /// Pick a test to run. Which test doesn't matter as long as it is guaranteed to fully match at + /// least one match pair. We currently simply pick the test corresponding to the first match + /// pair of the first candidate in the list. /// - /// *Note:* taking the first match pair is somewhat arbitrary, and - /// we might do better here by choosing more carefully what to - /// test. + /// *Note:* taking the first match pair is somewhat arbitrary, and we might do better here by + /// choosing more carefully what to test. /// /// For example, consider the following possible match-pairs: /// @@ -1567,121 +1596,19 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { /// [`Switch`]: TestKind::Switch /// [`SwitchInt`]: TestKind::SwitchInt /// [`Range`]: TestKind::Range - /// - /// Once we know what sort of test we are going to perform, this - /// test may also help us winnow down our candidates. So we walk over - /// the candidates (from high to low priority) and check. This - /// gives us, for each outcome of the test, a transformed list of - /// candidates. For example, if we are testing `x.0`'s variant, - /// and we have a candidate `(x.0 @ Some(v), x.1 @ 22)`, - /// then we would have a resulting candidate of `((x.0 as Some).0 @ v, x.1 @ 22)`. - /// Note that the first match-pair is now simpler (and, in fact, irrefutable). - /// - /// But there may also be candidates that the test just doesn't - /// apply to. The classical example involves wildcards: - /// - /// ``` - /// # let (x, y, z) = (true, true, true); - /// match (x, y, z) { - /// (true , _ , true ) => true, // (0) - /// (_ , true , _ ) => true, // (1) - /// (false, false, _ ) => false, // (2) - /// (true , _ , false) => false, // (3) - /// } - /// # ; - /// ``` - /// - /// In that case, after we test on `x`, there are 2 overlapping candidate - /// sets: - /// - /// - If the outcome is that `x` is true, candidates 0, 1, and 3 - /// - If the outcome is that `x` is false, candidates 1 and 2 - /// - /// Here, the traditional "decision tree" method would generate 2 - /// separate code-paths for the 2 separate cases. - /// - /// In some cases, this duplication can create an exponential amount of - /// code. This is most easily seen by noticing that this method terminates - /// with precisely the reachable arms being reachable - but that problem - /// is trivially NP-complete: - /// - /// ```ignore (illustrative) - /// match (var0, var1, var2, var3, ...) { - /// (true , _ , _ , false, true, ...) => false, - /// (_ , true, true , false, _ , ...) => false, - /// (false, _ , false, false, _ , ...) => false, - /// ... - /// _ => true - /// } - /// ``` - /// - /// Here the last arm is reachable only if there is an assignment to - /// the variables that does not match any of the literals. Therefore, - /// compilation would take an exponential amount of time in some cases. - /// - /// That kind of exponential worst-case might not occur in practice, but - /// our simplistic treatment of constants and guards would make it occur - /// in very common situations - for example [#29740]: - /// - /// ```ignore (illustrative) - /// match x { - /// "foo" if foo_guard => ..., - /// "bar" if bar_guard => ..., - /// "baz" if baz_guard => ..., - /// ... - /// } - /// ``` - /// - /// [#29740]: https://github.com/rust-lang/rust/issues/29740 - /// - /// Here we first test the match-pair `x @ "foo"`, which is an [`Eq` test]. - /// - /// [`Eq` test]: TestKind::Eq - /// - /// It might seem that we would end up with 2 disjoint candidate - /// sets, consisting of the first candidate or the other two, but our - /// algorithm doesn't reason about `"foo"` being distinct from the other - /// constants; it considers the latter arms to potentially match after - /// both outcomes, which obviously leads to an exponential number - /// of tests. - /// - /// To avoid these kinds of problems, our algorithm tries to ensure - /// the amount of generated tests is linear. When we do a k-way test, - /// we return an additional "unmatched" set alongside the obvious `k` - /// sets. When we encounter a candidate that would be present in more - /// than one of the sets, we put it and all candidates below it into the - /// "unmatched" set. This ensures these `k+1` sets are disjoint. - /// - /// After we perform our test, we branch into the appropriate candidate - /// set and recurse with `match_candidates`. These sub-matches are - /// obviously non-exhaustive - as we discarded our otherwise set - so - /// we set their continuation to do `match_candidates` on the - /// "unmatched" set (which is again non-exhaustive). - /// - /// If you apply this to the above test, you basically wind up - /// with an if-else-if chain, testing each candidate in turn, - /// which is precisely what we want. - /// - /// In addition to avoiding exponential-time blowups, this algorithm - /// also has the nice property that each guard and arm is only generated - /// once. - fn test_candidates<'pat, 'b, 'c>( + fn pick_test( &mut self, - span: Span, - scrutinee_span: Span, - mut candidates: &'b mut [&'c mut Candidate<'pat, 'tcx>], - start_block: BasicBlock, - otherwise_block: BasicBlock, + candidates: &mut [&mut Candidate<'_, 'tcx>], fake_borrows: &mut Option>>, - ) { - // extract the match-pair from the highest priority candidate + ) -> (PlaceBuilder<'tcx>, Test<'tcx>) { + // Extract the match-pair from the highest priority candidate let match_pair = &candidates.first().unwrap().match_pairs[0]; let mut test = self.test(match_pair); let match_place = match_pair.place.clone(); - // most of the time, the test to perform is simply a function - // of the main candidate; but for a test like SwitchInt, we - // may want to add cases based on the candidates that are + debug!(?test, ?match_pair); + // Most of the time, the test to perform is simply a function of the main candidate; but for + // a test like SwitchInt, we may want to add cases based on the candidates that are // available match test.kind { TestKind::SwitchInt { switch_ty: _, ref mut options } => { @@ -1708,20 +1635,58 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { fb.insert(resolved_place); } - // perform the test, branching to one of N blocks. For each of - // those N possible outcomes, create a (initially empty) - // vector of candidates. Those are the candidates that still - // apply if the test has that particular outcome. - debug!("test_candidates: test={:?} match_pair={:?}", test, match_pair); + (match_place, test) + } + + /// Given a test, we sort the input candidates into several buckets. If a candidate only matches + /// in one of the branches of `test`, we move it there. If it could match in more than one of + /// the branches of `test`, we stop sorting candidates. + /// + /// This returns a pair of + /// - the candidates that weren't sorted; + /// - for each possible outcome of the test, the candidates that match in that outcome. + /// + /// Moreover, we transform the branched candidates to reflect the fact that we know which + /// outcome of `test` occurred. + /// + /// For example: + /// ``` + /// # let (x, y, z) = (true, true, true); + /// match (x, y, z) { + /// (true , _ , true ) => true, // (0) + /// (false, false, _ ) => false, // (1) + /// (_ , true , _ ) => true, // (2) + /// (true , _ , false) => false, // (3) + /// } + /// # ; + /// ``` + /// + /// Assume we are testing on `x`. There are 2 overlapping candidate sets: + /// - If the outcome is that `x` is true, candidates 0, 2, and 3 + /// - If the outcome is that `x` is false, candidates 1 and 2 + /// + /// Following our algorithm, candidate 0 is sorted into outcome `x == true`, candidate 1 goes + /// into outcome `x == false`, and candidate 2 and 3 remain unsorted. + /// + /// The sorted candidates are transformed: + /// - candidate 0 becomes `[z @ true]` since we know that `x` was `true`; + /// - candidate 1 becomes `[y @ false]` since we know that `x` was `false`. + fn sort_candidates<'b, 'c, 'pat>( + &mut self, + match_place: &PlaceBuilder<'tcx>, + test: &Test<'tcx>, + mut candidates: &'b mut [&'c mut Candidate<'pat, 'tcx>], + ) -> (&'b mut [&'c mut Candidate<'pat, 'tcx>], Vec>>) { + // For each of the N possible outcomes, create a (initially empty) vector of candidates. + // Those are the candidates that apply if the test has that particular outcome. let mut target_candidates: Vec>> = vec![]; target_candidates.resize_with(test.targets(), Default::default); let total_candidate_count = candidates.len(); - // Sort the candidates into the appropriate vector in - // `target_candidates`. Note that at some point we may - // encounter a candidate where the test is not relevant; at - // that point, we stop sorting. + // Sort the candidates into the appropriate vector in `target_candidates`. Note that at some + // point we may encounter a candidate where the test is not relevant; at that point, we stop + // sorting. while let Some(candidate) = candidates.first_mut() { let Some(idx) = self.sort_candidate(&match_place, &test, candidate) else { break; @@ -1730,7 +1695,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { target_candidates[idx].push(candidate); candidates = rest; } - // at least the first candidate ought to be tested + + // At least the first candidate ought to be tested assert!( total_candidate_count > candidates.len(), "{total_candidate_count}, {candidates:#?}" @@ -1738,16 +1704,130 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { debug!("tested_candidates: {}", total_candidate_count - candidates.len()); debug!("untested_candidates: {}", candidates.len()); + (candidates, target_candidates) + } + + /// This is the most subtle part of the match lowering algorithm. At this point, the input + /// candidates have been fully simplified, so all remaining match-pairs require some sort of + /// test. + /// + /// Once we pick what sort of test we are going to perform, this test will help us winnow down + /// our candidates. So we walk over the candidates (from high to low priority) and check. We + /// compute, for each outcome of the test, a transformed list of candidates. If a candidate + /// matches in a single branch of our test, we add it to the corresponding outcome. We also + /// transform it to record the fact that we know which outcome occurred. + /// + /// For example, if we are testing `x.0`'s variant, and we have a candidate `(x.0 @ Some(v), x.1 + /// @ 22)`, then we would have a resulting candidate of `((x.0 as Some).0 @ v, x.1 @ 22)` in the + /// branch corresponding to `Some`. To ensure we make progress, we always pick a test that + /// results in simplifying the first candidate. + /// + /// But there may also be candidates that the test doesn't + /// apply to. The classical example is wildcards: + /// + /// ``` + /// # let (x, y, z) = (true, true, true); + /// match (x, y, z) { + /// (true , _ , true ) => true, // (0) + /// (false, false, _ ) => false, // (1) + /// (_ , true , _ ) => true, // (2) + /// (true , _ , false) => false, // (3) + /// } + /// # ; + /// ``` + /// + /// Here, the traditional "decision tree" method would generate 2 separate code-paths for the 2 + /// possible values of `x`. This would however duplicate some candidates, which would need to be + /// lowered several times. + /// + /// In some cases, this duplication can create an exponential amount of + /// code. This is most easily seen by noticing that this method terminates + /// with precisely the reachable arms being reachable - but that problem + /// is trivially NP-complete: + /// + /// ```ignore (illustrative) + /// match (var0, var1, var2, var3, ...) { + /// (true , _ , _ , false, true, ...) => false, + /// (_ , true, true , false, _ , ...) => false, + /// (false, _ , false, false, _ , ...) => false, + /// ... + /// _ => true + /// } + /// ``` + /// + /// Here the last arm is reachable only if there is an assignment to + /// the variables that does not match any of the literals. Therefore, + /// compilation would take an exponential amount of time in some cases. + /// + /// In rustc, we opt instead for the "backtracking automaton" approach. This guarantees we never + /// duplicate a candidate (except in the presence of or-patterns). In fact this guarantee is + /// ensured by the fact that we carry around `&mut Candidate`s which can't be duplicated. + /// + /// To make this work, whenever we decide to perform a test, if we encounter a candidate that + /// could match in more than one branch of the test, we stop. We generate code for the test and + /// for the candidates in its branches; the remaining candidates will be tested if the + /// candidates in the branches fail to match. + /// + /// For example, if we test on `x` in the following: + /// ``` + /// # fn foo((x, y, z): (bool, bool, bool)) -> u32 { + /// match (x, y, z) { + /// (true , _ , true ) => 0, + /// (false, false, _ ) => 1, + /// (_ , true , _ ) => 2, + /// (true , _ , false) => 3, + /// } + /// # } + /// ``` + /// this function generates code that looks more of less like: + /// ``` + /// # fn foo((x, y, z): (bool, bool, bool)) -> u32 { + /// if x { + /// match (y, z) { + /// (_, true) => return 0, + /// _ => {} // continue matching + /// } + /// } else { + /// match (y, z) { + /// (false, _) => return 1, + /// _ => {} // continue matching + /// } + /// } + /// // the block here is `remainder_start` + /// match (x, y, z) { + /// (_ , true , _ ) => 2, + /// (true , _ , false) => 3, + /// _ => unreachable!(), + /// } + /// # } + /// ``` + fn test_candidates<'pat, 'b, 'c>( + &mut self, + span: Span, + scrutinee_span: Span, + candidates: &'b mut [&'c mut Candidate<'pat, 'tcx>], + start_block: BasicBlock, + otherwise_block: BasicBlock, + fake_borrows: &mut Option>>, + ) { + // Extract the match-pair from the highest priority candidate and build a test from it. + let (match_place, test) = self.pick_test(candidates, fake_borrows); + + // For each of the N possible test outcomes, build the vector of candidates that applies if + // the test has that particular outcome. + let (remaining_candidates, target_candidates) = + self.sort_candidates(&match_place, &test, candidates); + // The block that we should branch to if none of the // `target_candidates` match. - let remainder_start = if !candidates.is_empty() { + let remainder_start = if !remaining_candidates.is_empty() { let remainder_start = self.cfg.start_new_block(); self.match_candidates( span, scrutinee_span, remainder_start, otherwise_block, - candidates, + remaining_candidates, fake_borrows, ); remainder_start diff --git a/compiler/rustc_mir_build/src/build/matches/simplify.rs b/compiler/rustc_mir_build/src/build/matches/simplify.rs index 83922dce327d..53a5056cc3f0 100644 --- a/compiler/rustc_mir_build/src/build/matches/simplify.rs +++ b/compiler/rustc_mir_build/src/build/matches/simplify.rs @@ -13,11 +13,9 @@ //! testing a value against a constant. use crate::build::expr::as_place::PlaceBuilder; -use crate::build::matches::{Ascription, Binding, Candidate, MatchPair}; +use crate::build::matches::{Ascription, Binding, Candidate, MatchPair, TestCase}; use crate::build::Builder; -use rustc_infer::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind}; -use rustc_middle::thir::{self, *}; -use rustc_middle::ty; +use rustc_middle::thir::{Pat, PatKind}; use std::mem; @@ -62,13 +60,24 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { let mut simplified_match_pairs = Vec::new(); // Repeatedly simplify match pairs until we're left with only unsimplifiable ones. loop { - for match_pair in mem::take(match_pairs) { - if let Err(match_pair) = self.simplify_match_pair( - match_pair, - candidate_bindings, - candidate_ascriptions, - match_pairs, - ) { + for mut match_pair in mem::take(match_pairs) { + if let TestCase::Irrefutable { binding, ascription } = match_pair.test_case { + if let Some(binding) = binding { + candidate_bindings.push(binding); + } + if let Some(ascription) = ascription { + candidate_ascriptions.push(ascription); + } + // Simplifiable pattern; we replace it with its subpairs and simplify further. + match_pairs.append(&mut match_pair.subpairs); + } else { + // Unsimplifiable pattern; we recursively simplify its subpairs and don't + // process it further. + self.simplify_match_pairs( + &mut match_pair.subpairs, + candidate_bindings, + candidate_ascriptions, + ); simplified_match_pairs.push(match_pair); } } @@ -117,133 +126,4 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { }) .collect() } - - /// Tries to simplify `match_pair`, returning `Ok(())` if successful. If successful, new match - /// pairs and bindings will have been pushed into the respective `Vec`s. If no simplification is - /// possible, `Err` is returned. - fn simplify_match_pair<'pat>( - &mut self, - mut match_pair: MatchPair<'pat, 'tcx>, - bindings: &mut Vec>, - ascriptions: &mut Vec>, - match_pairs: &mut Vec>, - ) -> Result<(), MatchPair<'pat, 'tcx>> { - match match_pair.pattern.kind { - PatKind::Leaf { .. } - | PatKind::Deref { .. } - | PatKind::Array { .. } - | PatKind::Never - | PatKind::Wild - | PatKind::Error(_) => {} - - PatKind::AscribeUserType { - ascription: thir::Ascription { ref annotation, variance }, - .. - } => { - // Apply the type ascription to the value at `match_pair.place` - if let Some(source) = match_pair.place.try_to_place(self) { - ascriptions.push(Ascription { - annotation: annotation.clone(), - source, - variance, - }); - } - } - - PatKind::Binding { - name: _, - mutability: _, - mode, - var, - ty: _, - subpattern: _, - is_primary: _, - } => { - if let Some(source) = match_pair.place.try_to_place(self) { - bindings.push(Binding { - span: match_pair.pattern.span, - source, - var_id: var, - binding_mode: mode, - }); - } - } - - PatKind::InlineConstant { subpattern: ref pattern, def } => { - // Apply a type ascription for the inline constant to the value at `match_pair.place` - if let Some(source) = match_pair.place.try_to_place(self) { - let span = match_pair.pattern.span; - let parent_id = self.tcx.typeck_root_def_id(self.def_id.to_def_id()); - let args = ty::InlineConstArgs::new( - self.tcx, - ty::InlineConstArgsParts { - parent_args: ty::GenericArgs::identity_for_item(self.tcx, parent_id), - ty: self.infcx.next_ty_var(TypeVariableOrigin { - kind: TypeVariableOriginKind::MiscVariable, - span, - }), - }, - ) - .args; - let user_ty = - self.infcx.canonicalize_user_type_annotation(ty::UserType::TypeOf( - def.to_def_id(), - ty::UserArgs { args, user_self_ty: None }, - )); - let annotation = ty::CanonicalUserTypeAnnotation { - inferred_ty: pattern.ty, - span, - user_ty: Box::new(user_ty), - }; - ascriptions.push(Ascription { - annotation, - source, - variance: ty::Contravariant, - }); - } - } - - PatKind::Constant { .. } => { - // FIXME normalize patterns when possible - return Err(match_pair); - } - - PatKind::Range(ref range) => { - if range.is_full_range(self.tcx) != Some(true) { - return Err(match_pair); - } - } - - PatKind::Slice { ref prefix, ref slice, ref suffix } => { - if !(prefix.is_empty() && slice.is_some() && suffix.is_empty()) { - self.simplify_match_pairs(&mut match_pair.subpairs, bindings, ascriptions); - return Err(match_pair); - } - } - - PatKind::Variant { adt_def, args, variant_index, subpatterns: _ } => { - let irrefutable = adt_def.variants().iter_enumerated().all(|(i, v)| { - i == variant_index || { - (self.tcx.features().exhaustive_patterns - || self.tcx.features().min_exhaustive_patterns) - && !v - .inhabited_predicate(self.tcx, adt_def) - .instantiate(self.tcx, args) - .apply_ignore_module(self.tcx, self.param_env) - } - }) && (adt_def.did().is_local() - || !adt_def.is_variant_list_non_exhaustive()); - if !irrefutable { - self.simplify_match_pairs(&mut match_pair.subpairs, bindings, ascriptions); - return Err(match_pair); - } - } - - PatKind::Or { .. } => return Err(match_pair), - } - - // Simplifiable pattern; we replace it with its subpairs. - match_pairs.append(&mut match_pair.subpairs); - Ok(()) - } } diff --git a/compiler/rustc_mir_build/src/build/matches/test.rs b/compiler/rustc_mir_build/src/build/matches/test.rs index ae9ebe7170ba..1c97de58863b 100644 --- a/compiler/rustc_mir_build/src/build/matches/test.rs +++ b/compiler/rustc_mir_build/src/build/matches/test.rs @@ -6,7 +6,7 @@ // the candidates based on the result. use crate::build::expr::as_place::PlaceBuilder; -use crate::build::matches::{Candidate, MatchPair, Test, TestKind}; +use crate::build::matches::{Candidate, MatchPair, Test, TestCase, TestKind}; use crate::build::Builder; use rustc_data_structures::fx::FxIndexMap; use rustc_hir::{LangItem, RangeEnd}; @@ -29,58 +29,45 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { /// /// It is a bug to call this with a not-fully-simplified pattern. pub(super) fn test<'pat>(&mut self, match_pair: &MatchPair<'pat, 'tcx>) -> Test<'tcx> { - match match_pair.pattern.kind { - PatKind::Variant { adt_def, args: _, variant_index: _, subpatterns: _ } => Test { - span: match_pair.pattern.span, - kind: TestKind::Switch { - adt_def, - variants: BitSet::new_empty(adt_def.variants().len()), - }, - }, + let kind = match match_pair.test_case { + TestCase::Variant { adt_def, variant_index: _ } => { + TestKind::Switch { adt_def, variants: BitSet::new_empty(adt_def.variants().len()) } + } - PatKind::Constant { .. } if is_switch_ty(match_pair.pattern.ty) => { + TestCase::Constant { .. } if is_switch_ty(match_pair.pattern.ty) => { // For integers, we use a `SwitchInt` match, which allows // us to handle more cases. - Test { - span: match_pair.pattern.span, - kind: TestKind::SwitchInt { - switch_ty: match_pair.pattern.ty, + TestKind::SwitchInt { + switch_ty: match_pair.pattern.ty, - // these maps are empty to start; cases are - // added below in add_cases_to_switch - options: Default::default(), - }, + // these maps are empty to start; cases are + // added below in add_cases_to_switch + options: Default::default(), } } - PatKind::Constant { value } => Test { - span: match_pair.pattern.span, - kind: TestKind::Eq { value, ty: match_pair.pattern.ty }, - }, + TestCase::Constant { value } => TestKind::Eq { value, ty: match_pair.pattern.ty }, - PatKind::Range(ref range) => { + TestCase::Range(range) => { assert_eq!(range.ty, match_pair.pattern.ty); - Test { span: match_pair.pattern.span, kind: TestKind::Range(range.clone()) } + TestKind::Range(Box::new(range.clone())) } - PatKind::Slice { ref prefix, ref slice, ref suffix } => { - let len = prefix.len() + suffix.len(); - let op = if slice.is_some() { BinOp::Ge } else { BinOp::Eq }; - Test { span: match_pair.pattern.span, kind: TestKind::Len { len: len as u64, op } } + TestCase::Slice { len, variable_length } => { + let op = if variable_length { BinOp::Ge } else { BinOp::Eq }; + TestKind::Len { len: len as u64, op } } - PatKind::Or { .. } => bug!("or-patterns should have already been handled"), + TestCase::Or { .. } => bug!("or-patterns should have already been handled"), - PatKind::AscribeUserType { .. } - | PatKind::InlineConstant { .. } - | PatKind::Array { .. } - | PatKind::Wild - | PatKind::Binding { .. } - | PatKind::Never - | PatKind::Leaf { .. } - | PatKind::Deref { .. } - | PatKind::Error(_) => self.error_simplifiable(match_pair), - } + TestCase::Irrefutable { .. } => span_bug!( + match_pair.pattern.span, + "simplifiable pattern found: {:?}", + match_pair.pattern + ), + }; + + Test { span: match_pair.pattern.span, kind } } pub(super) fn add_cases_to_switch<'pat>( @@ -94,32 +81,20 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { return false; }; - match match_pair.pattern.kind { - PatKind::Constant { value } => { + match match_pair.test_case { + TestCase::Constant { value } => { options.entry(value).or_insert_with(|| value.eval_bits(self.tcx, self.param_env)); true } - PatKind::Variant { .. } => { + TestCase::Variant { .. } => { panic!("you should have called add_variants_to_switch instead!"); } - PatKind::Range(ref range) => { + TestCase::Range(ref range) => { // Check that none of the switch values are in the range. self.values_not_contained_in_range(&*range, options).unwrap_or(false) } - PatKind::Slice { .. } - | PatKind::Array { .. } - | PatKind::Wild - | PatKind::Never - | PatKind::Or { .. } - | PatKind::Binding { .. } - | PatKind::AscribeUserType { .. } - | PatKind::InlineConstant { .. } - | PatKind::Leaf { .. } - | PatKind::Deref { .. } - | PatKind::Error(_) => { - // don't know how to add these patterns to a switch - false - } + // don't know how to add these patterns to a switch + _ => false, } } @@ -134,17 +109,15 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { return false; }; - match match_pair.pattern.kind { - PatKind::Variant { adt_def: _, variant_index, .. } => { + match match_pair.test_case { + TestCase::Variant { variant_index, .. } => { // We have a pattern testing for variant `variant_index` // set the corresponding index to true variants.insert(variant_index); true } - _ => { - // don't know how to add these patterns to a switch - false - } + // don't know how to add these patterns to a switch + _ => false, } } @@ -591,12 +564,12 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { candidate.match_pairs.iter().enumerate().find(|&(_, mp)| mp.place == *test_place)?; let fully_matched; - let ret = match (&test.kind, &match_pair.pattern.kind) { + let ret = match (&test.kind, &match_pair.test_case) { // If we are performing a variant switch, then this // informs variant patterns, but nothing else. ( &TestKind::Switch { adt_def: tested_adt_def, .. }, - &PatKind::Variant { adt_def, variant_index, .. }, + &TestCase::Variant { adt_def, variant_index }, ) => { assert_eq!(adt_def, tested_adt_def); fully_matched = true; @@ -612,14 +585,14 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { // // FIXME(#29623) we could use PatKind::Range to rule // things out here, in some cases. - (TestKind::SwitchInt { switch_ty: _, options }, PatKind::Constant { value }) + (TestKind::SwitchInt { switch_ty: _, options }, TestCase::Constant { value }) if is_switch_ty(match_pair.pattern.ty) => { fully_matched = true; let index = options.get_index_of(value).unwrap(); Some(index) } - (TestKind::SwitchInt { switch_ty: _, options }, PatKind::Range(range)) => { + (TestKind::SwitchInt { switch_ty: _, options }, TestCase::Range(range)) => { fully_matched = false; let not_contained = self.values_not_contained_in_range(&*range, options).unwrap_or(false); @@ -637,11 +610,10 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { ( &TestKind::Len { len: test_len, op: BinOp::Eq }, - PatKind::Slice { prefix, slice, suffix }, + &TestCase::Slice { len, variable_length }, ) => { - let pat_len = (prefix.len() + suffix.len()) as u64; - match (test_len.cmp(&pat_len), slice) { - (Ordering::Equal, &None) => { + match (test_len.cmp(&(len as u64)), variable_length) { + (Ordering::Equal, false) => { // on true, min_len = len = $actual_length, // on false, len != $actual_length fully_matched = true; @@ -654,13 +626,13 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { fully_matched = false; Some(1) } - (Ordering::Equal | Ordering::Greater, &Some(_)) => { + (Ordering::Equal | Ordering::Greater, true) => { // This can match both if $actual_len = test_len >= pat_len, // and if $actual_len > test_len. We can't advance. fully_matched = false; None } - (Ordering::Greater, &None) => { + (Ordering::Greater, false) => { // test_len != pat_len, so if $actual_len = test_len, then // $actual_len != pat_len. fully_matched = false; @@ -670,31 +642,30 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { } ( &TestKind::Len { len: test_len, op: BinOp::Ge }, - PatKind::Slice { prefix, slice, suffix }, + &TestCase::Slice { len, variable_length }, ) => { // the test is `$actual_len >= test_len` - let pat_len = (prefix.len() + suffix.len()) as u64; - match (test_len.cmp(&pat_len), slice) { - (Ordering::Equal, &Some(_)) => { + match (test_len.cmp(&(len as u64)), variable_length) { + (Ordering::Equal, true) => { // $actual_len >= test_len = pat_len, // so we can match. fully_matched = true; Some(0) } - (Ordering::Less, _) | (Ordering::Equal, &None) => { + (Ordering::Less, _) | (Ordering::Equal, false) => { // test_len <= pat_len. If $actual_len < test_len, // then it is also < pat_len, so the test passing is // necessary (but insufficient). fully_matched = false; Some(0) } - (Ordering::Greater, &None) => { + (Ordering::Greater, false) => { // test_len > pat_len. If $actual_len >= test_len > pat_len, // then we know we won't have a match. fully_matched = false; Some(1) } - (Ordering::Greater, &Some(_)) => { + (Ordering::Greater, true) => { // test_len < pat_len, and is therefore less // strict. This can still go both ways. fully_matched = false; @@ -703,8 +674,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { } } - (TestKind::Range(test), PatKind::Range(pat)) => { - if test == pat { + (TestKind::Range(test), &TestCase::Range(pat)) => { + if test.as_ref() == pat { fully_matched = true; Some(0) } else { @@ -714,7 +685,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { if !test.overlaps(pat, self.tcx, self.param_env)? { Some(1) } else { None } } } - (TestKind::Range(range), &PatKind::Constant { value }) => { + (TestKind::Range(range), &TestCase::Constant { value }) => { fully_matched = false; if !range.contains(value, self.tcx, self.param_env)? { // `value` is not contained in the testing range, @@ -737,7 +708,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { // However, at this point we can still encounter or-patterns that were extracted // from previous calls to `sort_candidate`, so we need to manually address that // case to avoid panicking in `self.test()`. - if let PatKind::Or { .. } = &match_pair.pattern.kind { + if let TestCase::Or { .. } = &match_pair.test_case { return None; } @@ -760,18 +731,12 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { let match_pair = candidate.match_pairs.remove(match_pair_index); candidate.match_pairs.extend(match_pair.subpairs); // Move or-patterns to the end. - candidate - .match_pairs - .sort_by_key(|pair| matches!(pair.pattern.kind, PatKind::Or { .. })); + candidate.match_pairs.sort_by_key(|pair| matches!(pair.test_case, TestCase::Or { .. })); } ret } - fn error_simplifiable<'pat>(&mut self, match_pair: &MatchPair<'pat, 'tcx>) -> ! { - span_bug!(match_pair.pattern.span, "simplifiable pattern found: {:?}", match_pair.pattern) - } - fn values_not_contained_in_range( &self, range: &PatRange<'tcx>, diff --git a/compiler/rustc_mir_build/src/build/matches/util.rs b/compiler/rustc_mir_build/src/build/matches/util.rs index e42d764147ca..3f7e7a348ed6 100644 --- a/compiler/rustc_mir_build/src/build/matches/util.rs +++ b/compiler/rustc_mir_build/src/build/matches/util.rs @@ -1,9 +1,9 @@ -use crate::build::expr::as_place::PlaceBase; -use crate::build::expr::as_place::PlaceBuilder; -use crate::build::matches::MatchPair; +use crate::build::expr::as_place::{PlaceBase, PlaceBuilder}; +use crate::build::matches::{MatchPair, TestCase}; use crate::build::Builder; +use rustc_infer::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind}; use rustc_middle::mir::*; -use rustc_middle::thir::*; +use rustc_middle::thir::{self, *}; use rustc_middle::ty; use rustc_middle::ty::TypeVisitableExt; @@ -117,50 +117,144 @@ impl<'pat, 'tcx> MatchPair<'pat, 'tcx> { place = place.project(ProjectionElem::OpaqueCast(pattern.ty)); } + let default_irrefutable = || TestCase::Irrefutable { binding: None, ascription: None }; let mut subpairs = Vec::new(); - match pattern.kind { - PatKind::Constant { .. } - | PatKind::Range(_) - | PatKind::Or { .. } - | PatKind::Never - | PatKind::Wild - | PatKind::Error(_) => {} + let test_case = match pattern.kind { + PatKind::Never | PatKind::Wild | PatKind::Error(_) => default_irrefutable(), + PatKind::Or { .. } => TestCase::Or, - PatKind::AscribeUserType { ref subpattern, .. } => { - subpairs.push(MatchPair::new(place.clone(), subpattern, cx)); + PatKind::Range(ref range) => { + if range.is_full_range(cx.tcx) == Some(true) { + default_irrefutable() + } else { + TestCase::Range(range) + } } - PatKind::Binding { ref subpattern, .. } => { + PatKind::Constant { value } => TestCase::Constant { value }, + + PatKind::AscribeUserType { + ascription: thir::Ascription { ref annotation, variance }, + ref subpattern, + .. + } => { + // Apply the type ascription to the value at `match_pair.place` + let ascription = place.try_to_place(cx).map(|source| super::Ascription { + annotation: annotation.clone(), + source, + variance, + }); + + subpairs.push(MatchPair::new(place.clone(), subpattern, cx)); + TestCase::Irrefutable { ascription, binding: None } + } + + PatKind::Binding { + name: _, + mutability: _, + mode, + var, + ty: _, + ref subpattern, + is_primary: _, + } => { + let binding = place.try_to_place(cx).map(|source| super::Binding { + span: pattern.span, + source, + var_id: var, + binding_mode: mode, + }); + if let Some(subpattern) = subpattern.as_ref() { // this is the `x @ P` case; have to keep matching against `P` now subpairs.push(MatchPair::new(place.clone(), subpattern, cx)); } + TestCase::Irrefutable { ascription: None, binding } } - PatKind::InlineConstant { subpattern: ref pattern, .. } => { + PatKind::InlineConstant { subpattern: ref pattern, def, .. } => { + // Apply a type ascription for the inline constant to the value at `match_pair.place` + let ascription = place.try_to_place(cx).map(|source| { + let span = pattern.span; + let parent_id = cx.tcx.typeck_root_def_id(cx.def_id.to_def_id()); + let args = ty::InlineConstArgs::new( + cx.tcx, + ty::InlineConstArgsParts { + parent_args: ty::GenericArgs::identity_for_item(cx.tcx, parent_id), + ty: cx.infcx.next_ty_var(TypeVariableOrigin { + kind: TypeVariableOriginKind::MiscVariable, + span, + }), + }, + ) + .args; + let user_ty = cx.infcx.canonicalize_user_type_annotation(ty::UserType::TypeOf( + def.to_def_id(), + ty::UserArgs { args, user_self_ty: None }, + )); + let annotation = ty::CanonicalUserTypeAnnotation { + inferred_ty: pattern.ty, + span, + user_ty: Box::new(user_ty), + }; + super::Ascription { annotation, source, variance: ty::Contravariant } + }); + subpairs.push(MatchPair::new(place.clone(), pattern, cx)); + TestCase::Irrefutable { ascription, binding: None } } - PatKind::Slice { ref prefix, ref slice, ref suffix } - | PatKind::Array { ref prefix, ref slice, ref suffix } => { + PatKind::Array { ref prefix, ref slice, ref suffix } => { cx.prefix_slice_suffix(&mut subpairs, &place, prefix, slice, suffix); + default_irrefutable() + } + PatKind::Slice { ref prefix, ref slice, ref suffix } => { + cx.prefix_slice_suffix(&mut subpairs, &place, prefix, slice, suffix); + + if prefix.is_empty() && slice.is_some() && suffix.is_empty() { + default_irrefutable() + } else { + TestCase::Slice { + len: prefix.len() + suffix.len(), + variable_length: slice.is_some(), + } + } } - PatKind::Variant { adt_def, variant_index, ref subpatterns, .. } => { + PatKind::Variant { adt_def, variant_index, args, ref subpatterns } => { let downcast_place = place.clone().downcast(adt_def, variant_index); // `(x as Variant)` subpairs = cx.field_match_pairs(downcast_place, subpatterns); + + let irrefutable = adt_def.variants().iter_enumerated().all(|(i, v)| { + i == variant_index || { + (cx.tcx.features().exhaustive_patterns + || cx.tcx.features().min_exhaustive_patterns) + && !v + .inhabited_predicate(cx.tcx, adt_def) + .instantiate(cx.tcx, args) + .apply_ignore_module(cx.tcx, cx.param_env) + } + }) && (adt_def.did().is_local() + || !adt_def.is_variant_list_non_exhaustive()); + if irrefutable { + default_irrefutable() + } else { + TestCase::Variant { adt_def, variant_index } + } } PatKind::Leaf { ref subpatterns } => { subpairs = cx.field_match_pairs(place.clone(), subpatterns); + default_irrefutable() } PatKind::Deref { ref subpattern } => { let place_builder = place.clone().deref(); subpairs.push(MatchPair::new(place_builder, subpattern, cx)); + default_irrefutable() } - } + }; - MatchPair { place, pattern, subpairs } + MatchPair { place, test_case, subpairs, pattern } } } diff --git a/compiler/rustc_mir_build/src/errors.rs b/compiler/rustc_mir_build/src/errors.rs index 2a42dae289b1..48b93ce0ac5c 100644 --- a/compiler/rustc_mir_build/src/errors.rs +++ b/compiler/rustc_mir_build/src/errors.rs @@ -461,8 +461,10 @@ pub(crate) struct NonExhaustivePatternsTypeNotEmpty<'p, 'tcx, 'm> { pub ty: Ty<'tcx>, } -impl<'a> IntoDiagnostic<'a> for NonExhaustivePatternsTypeNotEmpty<'_, '_, '_> { - fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> DiagnosticBuilder<'_> { +impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> + for NonExhaustivePatternsTypeNotEmpty<'_, '_, '_> +{ + fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> DiagnosticBuilder<'_, G> { let mut diag = DiagnosticBuilder::new( dcx, level, diff --git a/compiler/rustc_mir_build/src/thir/pattern/mod.rs b/compiler/rustc_mir_build/src/thir/pattern/mod.rs index 0329e1d3096d..0b03cb52373a 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/mod.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/mod.rs @@ -223,19 +223,14 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> { // If we are handling a range with associated constants (e.g. // `Foo::<'a>::A..=Foo::B`), we need to put the ascriptions for the associated // constants somewhere. Have them on the range pattern. - for ascr in [lo_ascr, hi_ascr] { - if let Some(ascription) = ascr { - kind = PatKind::AscribeUserType { - ascription, - subpattern: Box::new(Pat { span, ty, kind }), - }; - } + for ascription in [lo_ascr, hi_ascr].into_iter().flatten() { + kind = PatKind::AscribeUserType { + ascription, + subpattern: Box::new(Pat { span, ty, kind }), + }; } - for inline_const in [lo_inline, hi_inline] { - if let Some(def) = inline_const { - kind = - PatKind::InlineConstant { def, subpattern: Box::new(Pat { span, ty, kind }) }; - } + for def in [lo_inline, hi_inline].into_iter().flatten() { + kind = PatKind::InlineConstant { def, subpattern: Box::new(Pat { span, ty, kind }) }; } Ok(kind) } diff --git a/compiler/rustc_mir_transform/src/coverage/graph.rs b/compiler/rustc_mir_transform/src/coverage/graph.rs index c6badbe78a49..c97192435ce4 100644 --- a/compiler/rustc_mir_transform/src/coverage/graph.rs +++ b/compiler/rustc_mir_transform/src/coverage/graph.rs @@ -52,19 +52,18 @@ impl CoverageGraph { } } - let mut basic_coverage_blocks = - Self { bcbs, bb_to_bcb, successors, predecessors, dominators: None }; - let dominators = dominators::dominators(&basic_coverage_blocks); - basic_coverage_blocks.dominators = Some(dominators); + let mut this = Self { bcbs, bb_to_bcb, successors, predecessors, dominators: None }; + + this.dominators = Some(dominators::dominators(&this)); // The coverage graph's entry-point node (bcb0) always starts with bb0, // which never has predecessors. Any other blocks merged into bcb0 can't // have multiple (coverage-relevant) predecessors, so bcb0 always has // zero in-edges. - assert!(basic_coverage_blocks[START_BCB].leader_bb() == mir::START_BLOCK); - assert!(basic_coverage_blocks.predecessors[START_BCB].is_empty()); + assert!(this[START_BCB].leader_bb() == mir::START_BLOCK); + assert!(this.predecessors[START_BCB].is_empty()); - basic_coverage_blocks + this } fn compute_basic_coverage_blocks( diff --git a/compiler/rustc_mir_transform/src/coverage/spans.rs b/compiler/rustc_mir_transform/src/coverage/spans.rs index 98fb1d8e1c94..4260a6f0c6f7 100644 --- a/compiler/rustc_mir_transform/src/coverage/spans.rs +++ b/compiler/rustc_mir_transform/src/coverage/spans.rs @@ -90,23 +90,23 @@ pub(super) fn generate_coverage_spans( struct CurrCovspan { span: Span, bcb: BasicCoverageBlock, - is_closure: bool, + is_hole: bool, } impl CurrCovspan { - fn new(span: Span, bcb: BasicCoverageBlock, is_closure: bool) -> Self { - Self { span, bcb, is_closure } + fn new(span: Span, bcb: BasicCoverageBlock, is_hole: bool) -> Self { + Self { span, bcb, is_hole } } fn into_prev(self) -> PrevCovspan { - let Self { span, bcb, is_closure } = self; - PrevCovspan { span, bcb, merged_spans: vec![span], is_closure } + let Self { span, bcb, is_hole } = self; + PrevCovspan { span, bcb, merged_spans: vec![span], is_hole } } fn into_refined(self) -> RefinedCovspan { - // This is only called in cases where `curr` is a closure span that has + // This is only called in cases where `curr` is a hole span that has // been carved out of `prev`. - debug_assert!(self.is_closure); + debug_assert!(self.is_hole); self.into_prev().into_refined() } } @@ -118,12 +118,12 @@ struct PrevCovspan { /// List of all the original spans from MIR that have been merged into this /// span. Mainly used to precisely skip over gaps when truncating a span. merged_spans: Vec, - is_closure: bool, + is_hole: bool, } impl PrevCovspan { fn is_mergeable(&self, other: &CurrCovspan) -> bool { - self.bcb == other.bcb && !self.is_closure && !other.is_closure + self.bcb == other.bcb && !self.is_hole && !other.is_hole } fn merge_from(&mut self, other: &CurrCovspan) { @@ -142,8 +142,8 @@ impl PrevCovspan { } fn refined_copy(&self) -> RefinedCovspan { - let &Self { span, bcb, merged_spans: _, is_closure } = self; - RefinedCovspan { span, bcb, is_closure } + let &Self { span, bcb, merged_spans: _, is_hole } = self; + RefinedCovspan { span, bcb, is_hole } } fn into_refined(self) -> RefinedCovspan { @@ -156,12 +156,12 @@ impl PrevCovspan { struct RefinedCovspan { span: Span, bcb: BasicCoverageBlock, - is_closure: bool, + is_hole: bool, } impl RefinedCovspan { fn is_mergeable(&self, other: &Self) -> bool { - self.bcb == other.bcb && !self.is_closure && !other.is_closure + self.bcb == other.bcb && !self.is_hole && !other.is_hole } fn merge_from(&mut self, other: &Self) { @@ -176,16 +176,16 @@ impl RefinedCovspan { /// * Remove duplicate source code coverage regions /// * Merge spans that represent continuous (both in source code and control flow), non-branching /// execution -/// * Carve out (leave uncovered) any span that will be counted by another MIR (notably, closures) +/// * Carve out (leave uncovered) any "hole" spans that need to be left blank +/// (e.g. closures that will be counted by their own MIR body) struct SpansRefiner { /// The initial set of coverage spans, sorted by `Span` (`lo` and `hi`) and by relative /// dominance between the `BasicCoverageBlock`s of equal `Span`s. sorted_spans_iter: std::vec::IntoIter, - /// The current coverage span to compare to its `prev`, to possibly merge, discard, force the - /// discard of the `prev` (and or `pending_dups`), or keep both (with `prev` moved to - /// `pending_dups`). If `curr` is not discarded or merged, it becomes `prev` for the next - /// iteration. + /// The current coverage span to compare to its `prev`, to possibly merge, discard, + /// or cause `prev` to be modified or discarded. + /// If `curr` is not discarded or merged, it becomes `prev` for the next iteration. some_curr: Option, /// The coverage span from a prior iteration; typically assigned from that iteration's `curr`. @@ -229,7 +229,7 @@ impl SpansRefiner { let curr = self.curr(); if prev.is_mergeable(curr) { - debug!(" same bcb (and neither is a closure), merge with prev={prev:?}"); + debug!(?prev, "curr will be merged into prev"); let curr = self.take_curr(); self.prev_mut().merge_from(&curr); } else if prev.span.hi() <= curr.span.lo() { @@ -238,15 +238,13 @@ impl SpansRefiner { ); let prev = self.take_prev().into_refined(); self.refined_spans.push(prev); - } else if prev.is_closure { + } else if prev.is_hole { // drop any equal or overlapping span (`curr`) and keep `prev` to test again in the // next iter - debug!( - " curr overlaps a closure (prev). Drop curr and keep prev for next iter. prev={prev:?}", - ); + debug!(?prev, "prev (a hole) overlaps curr, so discarding curr"); self.take_curr(); // Discards curr. - } else if curr.is_closure { - self.carve_out_span_for_closure(); + } else if curr.is_hole { + self.carve_out_span_for_hole(); } else { self.cutoff_prev_at_overlapping_curr(); } @@ -270,10 +268,9 @@ impl SpansRefiner { } }); - // Remove spans derived from closures, originally added to ensure the coverage - // regions for the current function leave room for the closure's own coverage regions - // (injected separately, from the closure's own MIR). - self.refined_spans.retain(|covspan| !covspan.is_closure); + // Discard hole spans, since their purpose was to carve out chunks from + // other spans, but we don't want the holes themselves in the final mappings. + self.refined_spans.retain(|covspan| !covspan.is_hole); self.refined_spans } @@ -316,48 +313,43 @@ impl SpansRefiner { { // Skip curr because prev has already advanced beyond the end of curr. // This can only happen if a prior iteration updated `prev` to skip past - // a region of code, such as skipping past a closure. - debug!( - " prev.span starts after curr.span, so curr will be dropped (skipping past \ - closure?); prev={prev:?}", - ); + // a region of code, such as skipping past a hole. + debug!(?prev, "prev.span starts after curr.span, so curr will be dropped"); } else { - self.some_curr = Some(CurrCovspan::new(curr.span, curr.bcb, curr.is_closure)); + self.some_curr = Some(CurrCovspan::new(curr.span, curr.bcb, curr.is_hole)); return true; } } false } - /// If `prev`s span extends left of the closure (`curr`), carve out the closure's span from - /// `prev`'s span. (The closure's coverage counters will be injected when processing the - /// closure's own MIR.) Add the portion of the span to the left of the closure; and if the span - /// extends to the right of the closure, update `prev` to that portion of the span. For any - /// `pending_dups`, repeat the same process. - fn carve_out_span_for_closure(&mut self) { + /// If `prev`s span extends left of the hole (`curr`), carve out the hole's span from + /// `prev`'s span. Add the portion of the span to the left of the hole; and if the span + /// extends to the right of the hole, update `prev` to that portion of the span. + fn carve_out_span_for_hole(&mut self) { let prev = self.prev(); let curr = self.curr(); let left_cutoff = curr.span.lo(); let right_cutoff = curr.span.hi(); - let has_pre_closure_span = prev.span.lo() < right_cutoff; - let has_post_closure_span = prev.span.hi() > right_cutoff; + let has_pre_hole_span = prev.span.lo() < right_cutoff; + let has_post_hole_span = prev.span.hi() > right_cutoff; - if has_pre_closure_span { - let mut pre_closure = self.prev().refined_copy(); - pre_closure.span = pre_closure.span.with_hi(left_cutoff); - debug!(" prev overlaps a closure. Adding span for pre_closure={:?}", pre_closure); - self.refined_spans.push(pre_closure); + if has_pre_hole_span { + let mut pre_hole = prev.refined_copy(); + pre_hole.span = pre_hole.span.with_hi(left_cutoff); + debug!(?pre_hole, "prev overlaps a hole; adding pre-hole span"); + self.refined_spans.push(pre_hole); } - if has_post_closure_span { - // Mutate `prev.span` to start after the closure (and discard curr). + if has_post_hole_span { + // Mutate `prev.span` to start after the hole (and discard curr). self.prev_mut().span = self.prev().span.with_lo(right_cutoff); - debug!(" Mutated prev.span to start after the closure. prev={:?}", self.prev()); + debug!(prev=?self.prev(), "mutated prev to start after the hole"); // Prevent this curr from becoming prev. - let closure_covspan = self.take_curr().into_refined(); - self.refined_spans.push(closure_covspan); // since self.prev() was already updated + let hole_covspan = self.take_curr().into_refined(); + self.refined_spans.push(hole_covspan); // since self.prev() was already updated } } diff --git a/compiler/rustc_mir_transform/src/coverage/spans/from_mir.rs b/compiler/rustc_mir_transform/src/coverage/spans/from_mir.rs index b91ab811918a..099a354f45dd 100644 --- a/compiler/rustc_mir_transform/src/coverage/spans/from_mir.rs +++ b/compiler/rustc_mir_transform/src/coverage/spans/from_mir.rs @@ -52,14 +52,14 @@ pub(super) fn mir_to_initial_sorted_coverage_spans( // - Span A extends further left, or // - Both have the same start and span A extends further right .then_with(|| Ord::cmp(&a.span.hi(), &b.span.hi()).reverse()) - // If two spans have the same lo & hi, put closure spans first, - // as they take precedence over non-closure spans. - .then_with(|| Ord::cmp(&a.is_closure, &b.is_closure).reverse()) + // If two spans have the same lo & hi, put hole spans first, + // as they take precedence over non-hole spans. + .then_with(|| Ord::cmp(&a.is_hole, &b.is_hole).reverse()) // After deduplication, we want to keep only the most-dominated BCB. .then_with(|| basic_coverage_blocks.cmp_in_dominator_order(a.bcb, b.bcb).reverse()) }); - // Among covspans with the same span, keep only one. Closure spans take + // Among covspans with the same span, keep only one. Hole spans take // precedence, otherwise keep the one with the most-dominated BCB. // (Ideally we should try to preserve _all_ non-dominating BCBs, but that // requires a lot more complexity in the span refiner, for little benefit.) @@ -78,8 +78,8 @@ pub(super) fn mir_to_initial_sorted_coverage_spans( fn remove_unwanted_macro_spans(initial_spans: &mut Vec) { let mut seen_macro_spans = FxHashSet::default(); initial_spans.retain(|covspan| { - // Ignore (retain) closure spans and non-macro-expansion spans. - if covspan.is_closure || covspan.visible_macro.is_none() { + // Ignore (retain) hole spans and non-macro-expansion spans. + if covspan.is_hole || covspan.visible_macro.is_none() { return true; } @@ -96,7 +96,7 @@ fn split_visible_macro_spans(initial_spans: &mut Vec) { let mut extra_spans = vec![]; initial_spans.retain(|covspan| { - if covspan.is_closure { + if covspan.is_hole { return true; } @@ -112,7 +112,7 @@ fn split_visible_macro_spans(initial_spans: &mut Vec) { return true; } - assert!(!covspan.is_closure); + assert!(!covspan.is_hole); extra_spans.push(SpanFromMir::new(before, covspan.visible_macro, covspan.bcb, false)); extra_spans.push(SpanFromMir::new(after, covspan.visible_macro, covspan.bcb, false)); false // Discard the original covspan that we just split. @@ -148,6 +148,8 @@ fn bcb_to_initial_coverage_spans<'a, 'tcx>( let expn_span = filtered_statement_span(statement)?; let (span, visible_macro) = unexpand(expn_span)?; + // A statement that looks like the assignment of a closure expression + // is treated as a "hole" span, to be carved out of other spans. Some(SpanFromMir::new(span, visible_macro, bcb, is_closure_like(statement))) }); @@ -336,7 +338,10 @@ pub(super) struct SpanFromMir { pub(super) span: Span, visible_macro: Option, pub(super) bcb: BasicCoverageBlock, - pub(super) is_closure: bool, + /// If true, this covspan represents a "hole" that should be carved out + /// from other spans, e.g. because it represents a closure expression that + /// will be instrumented separately as its own function. + pub(super) is_hole: bool, } impl SpanFromMir { @@ -348,8 +353,8 @@ impl SpanFromMir { span: Span, visible_macro: Option, bcb: BasicCoverageBlock, - is_closure: bool, + is_hole: bool, ) -> Self { - Self { span, visible_macro, bcb, is_closure } + Self { span, visible_macro, bcb, is_hole } } } diff --git a/compiler/rustc_mir_transform/src/cross_crate_inline.rs b/compiler/rustc_mir_transform/src/cross_crate_inline.rs index 5f01b841867e..483fd753e707 100644 --- a/compiler/rustc_mir_transform/src/cross_crate_inline.rs +++ b/compiler/rustc_mir_transform/src/cross_crate_inline.rs @@ -9,6 +9,7 @@ use rustc_middle::query::Providers; use rustc_middle::ty::TyCtxt; use rustc_session::config::InliningThreshold; use rustc_session::config::OptLevel; +use rustc_span::sym; pub fn provide(providers: &mut Providers) { providers.cross_crate_inlinable = cross_crate_inlinable; @@ -34,6 +35,14 @@ fn cross_crate_inlinable(tcx: TyCtxt<'_>, def_id: LocalDefId) -> bool { return true; } + if tcx.has_attr(def_id, sym::rustc_intrinsic) { + // Intrinsic fallback bodies are always cross-crate inlineable. + // To ensure that the MIR inliner doesn't cluelessly try to inline fallback + // bodies even when the backend would implement something better, we stop + // the MIR inliner from ever inlining an intrinsic. + return true; + } + // Obey source annotations first; this is important because it means we can use // #[inline(never)] to force code generation. match codegen_fn_attrs.inline { diff --git a/compiler/rustc_mir_transform/src/inline.rs b/compiler/rustc_mir_transform/src/inline.rs index 956d855ab81a..36546a03cdfc 100644 --- a/compiler/rustc_mir_transform/src/inline.rs +++ b/compiler/rustc_mir_transform/src/inline.rs @@ -13,6 +13,7 @@ use rustc_middle::ty::TypeVisitableExt; use rustc_middle::ty::{self, Instance, InstanceDef, ParamEnv, Ty, TyCtxt}; use rustc_session::config::OptLevel; use rustc_span::source_map::Spanned; +use rustc_span::sym; use rustc_target::abi::FieldIdx; use rustc_target::spec::abi::Abi; @@ -170,6 +171,13 @@ impl<'tcx> Inliner<'tcx> { let cross_crate_inlinable = self.tcx.cross_crate_inlinable(callsite.callee.def_id()); self.check_codegen_attributes(callsite, callee_attrs, cross_crate_inlinable)?; + // Intrinsic fallback bodies are automatically made cross-crate inlineable, + // but at this stage we don't know whether codegen knows the intrinsic, + // so just conservatively don't inline it. + if self.tcx.has_attr(callsite.callee.def_id(), sym::rustc_intrinsic) { + return Err("Callee is an intrinsic, do not inline fallback bodies"); + } + let terminator = caller_body[callsite.block].terminator.as_ref().unwrap(); let TerminatorKind::Call { args, destination, .. } = &terminator.kind else { bug!() }; let destination_ty = destination.ty(&caller_body.local_decls, self.tcx).ty; @@ -413,6 +421,10 @@ impl<'tcx> Inliner<'tcx> { callee_attrs: &CodegenFnAttrs, cross_crate_inlinable: bool, ) -> Result<(), &'static str> { + if self.tcx.has_attr(callsite.callee.def_id(), sym::rustc_no_mir_inline) { + return Err("#[rustc_no_mir_inline]"); + } + if let InlineAttr::Never = callee_attrs.inline { return Err("never inline hint"); } diff --git a/compiler/rustc_mir_transform/src/promote_consts.rs b/compiler/rustc_mir_transform/src/promote_consts.rs index 577b8f2080fc..2e11da4d585e 100644 --- a/compiler/rustc_mir_transform/src/promote_consts.rs +++ b/compiler/rustc_mir_transform/src/promote_consts.rs @@ -482,17 +482,40 @@ impl<'tcx> Validator<'_, 'tcx> { match op { BinOp::Div | BinOp::Rem => { if lhs_ty.is_integral() { + let sz = lhs_ty.primitive_size(self.tcx); // Integer division: the RHS must be a non-zero const. - let const_val = match rhs { + let rhs_val = match rhs { Operand::Constant(c) => { - c.const_.try_eval_bits(self.tcx, self.param_env) + c.const_.try_eval_scalar_int(self.tcx, self.param_env) } _ => None, }; - match const_val { + match rhs_val.map(|x| x.try_to_uint(sz).unwrap()) { + // for the zero test, int vs uint does not matter Some(x) if x != 0 => {} // okay _ => return Err(Unpromotable), // value not known or 0 -- not okay } + // Furthermore, for signed divison, we also have to exclude `int::MIN / -1`. + if lhs_ty.is_signed() { + match rhs_val.map(|x| x.try_to_int(sz).unwrap()) { + Some(-1) | None => { + // The RHS is -1 or unknown, so we have to be careful. + // But is the LHS int::MIN? + let lhs_val = match lhs { + Operand::Constant(c) => c + .const_ + .try_eval_scalar_int(self.tcx, self.param_env), + _ => None, + }; + let lhs_min = sz.signed_int_min(); + match lhs_val.map(|x| x.try_to_int(sz).unwrap()) { + Some(x) if x != lhs_min => {} // okay + _ => return Err(Unpromotable), // value not known or int::MIN -- not okay + } + } + _ => {} + } + } } } // The remaining operations can never fail. diff --git a/compiler/rustc_parse/src/errors.rs b/compiler/rustc_parse/src/errors.rs index 2d4447a42c2c..2c76e55a46d6 100644 --- a/compiler/rustc_parse/src/errors.rs +++ b/compiler/rustc_parse/src/errors.rs @@ -1073,9 +1073,9 @@ pub(crate) struct ExpectedIdentifier { pub help_cannot_start_number: Option, } -impl<'a> IntoDiagnostic<'a> for ExpectedIdentifier { +impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for ExpectedIdentifier { #[track_caller] - fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> DiagnosticBuilder<'a> { + fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> DiagnosticBuilder<'a, G> { let token_descr = TokenDescription::from_token(&self.token); let mut diag = DiagnosticBuilder::new( @@ -1133,9 +1133,9 @@ pub(crate) struct ExpectedSemi { pub sugg: ExpectedSemiSugg, } -impl<'a> IntoDiagnostic<'a> for ExpectedSemi { +impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for ExpectedSemi { #[track_caller] - fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> DiagnosticBuilder<'a> { + fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> DiagnosticBuilder<'a, G> { let token_descr = TokenDescription::from_token(&self.token); let mut diag = DiagnosticBuilder::new( diff --git a/compiler/rustc_parse/src/validate_attr.rs b/compiler/rustc_parse/src/validate_attr.rs index b0982029657b..5d46581f646c 100644 --- a/compiler/rustc_parse/src/validate_attr.rs +++ b/compiler/rustc_parse/src/validate_attr.rs @@ -88,7 +88,7 @@ pub fn parse_meta<'a>(sess: &'a ParseSess, attr: &Attribute) -> PResult<'a, Meta // results in `ast::ExprKind::Err`. In that case we delay // the error because an earlier error will have already // been reported. - let msg = format!("attribute value must be a literal"); + let msg = "attribute value must be a literal"; let mut err = sess.dcx.struct_span_err(expr.span, msg); if let ast::ExprKind::Err = expr.kind { err.downgrade_to_delayed_bug(); diff --git a/compiler/rustc_pattern_analysis/src/constructor.rs b/compiler/rustc_pattern_analysis/src/constructor.rs index 24824682b74c..483986969d16 100644 --- a/compiler/rustc_pattern_analysis/src/constructor.rs +++ b/compiler/rustc_pattern_analysis/src/constructor.rs @@ -694,18 +694,14 @@ impl Clone for Constructor { fn clone(&self) -> Self { match self { Constructor::Struct => Constructor::Struct, - Constructor::Variant(idx) => Constructor::Variant(idx.clone()), + Constructor::Variant(idx) => Constructor::Variant(*idx), Constructor::Ref => Constructor::Ref, - Constructor::Slice(slice) => Constructor::Slice(slice.clone()), + Constructor::Slice(slice) => Constructor::Slice(*slice), Constructor::UnionField => Constructor::UnionField, - Constructor::Bool(b) => Constructor::Bool(b.clone()), - Constructor::IntRange(range) => Constructor::IntRange(range.clone()), - Constructor::F32Range(lo, hi, end) => { - Constructor::F32Range(lo.clone(), hi.clone(), end.clone()) - } - Constructor::F64Range(lo, hi, end) => { - Constructor::F64Range(lo.clone(), hi.clone(), end.clone()) - } + Constructor::Bool(b) => Constructor::Bool(*b), + Constructor::IntRange(range) => Constructor::IntRange(*range), + Constructor::F32Range(lo, hi, end) => Constructor::F32Range(lo.clone(), *hi, *end), + Constructor::F64Range(lo, hi, end) => Constructor::F64Range(lo.clone(), *hi, *end), Constructor::Str(value) => Constructor::Str(value.clone()), Constructor::Opaque(inner) => Constructor::Opaque(inner.clone()), Constructor::Or => Constructor::Or, diff --git a/compiler/rustc_privacy/src/lib.rs b/compiler/rustc_privacy/src/lib.rs index 9d8a9f5fce3e..1c6bd8871282 100644 --- a/compiler/rustc_privacy/src/lib.rs +++ b/compiler/rustc_privacy/src/lib.rs @@ -988,7 +988,10 @@ impl<'tcx> Visitor<'tcx> for NamePrivacyVisitor<'tcx> { fn visit_expr(&mut self, expr: &'tcx hir::Expr<'tcx>) { if let hir::ExprKind::Struct(qpath, fields, ref base) = expr.kind { let res = self.typeck_results().qpath_res(qpath, expr.hir_id); - let adt = self.typeck_results().expr_ty(expr).ty_adt_def().unwrap(); + let Some(adt) = self.typeck_results().expr_ty(expr).ty_adt_def() else { + self.tcx.dcx().span_delayed_bug(expr.span, "no adt_def for expression"); + return; + }; let variant = adt.variant_of_res(res); if let Some(base) = *base { // If the expression uses FRU we need to make sure all the unmentioned fields diff --git a/compiler/rustc_query_system/src/dep_graph/serialized.rs b/compiler/rustc_query_system/src/dep_graph/serialized.rs index f6f6aa07cb3f..3272a0ed1673 100644 --- a/compiler/rustc_query_system/src/dep_graph/serialized.rs +++ b/compiler/rustc_query_system/src/dep_graph/serialized.rs @@ -145,7 +145,7 @@ impl SerializedDepGraph { /// A packed representation of an edge's start index and byte width. /// -/// This is packed by stealing 2 bits from the start index, which means we only accomodate edge +/// This is packed by stealing 2 bits from the start index, which means we only accommodate edge /// data arrays up to a quarter of our address space. Which seems fine. #[derive(Debug, Clone, Copy)] struct EdgeHeader { diff --git a/compiler/rustc_resolve/src/late/diagnostics.rs b/compiler/rustc_resolve/src/late/diagnostics.rs index 335bf0949d62..51723fc81a01 100644 --- a/compiler/rustc_resolve/src/late/diagnostics.rs +++ b/compiler/rustc_resolve/src/late/diagnostics.rs @@ -1582,7 +1582,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { None => ("/* fields */".to_string(), Applicability::HasPlaceholders), }; let pad = match field_ids { - Some(field_ids) if field_ids.is_empty() => "", + Some([]) => "", _ => " ", }; err.span_suggestion( diff --git a/compiler/rustc_session/src/errors.rs b/compiler/rustc_session/src/errors.rs index de7e04ba00f8..73373e9ba587 100644 --- a/compiler/rustc_session/src/errors.rs +++ b/compiler/rustc_session/src/errors.rs @@ -3,8 +3,8 @@ use std::num::NonZero; use rustc_ast::token; use rustc_ast::util::literal::LitError; use rustc_errors::{ - codes::*, DiagCtxt, DiagnosticBuilder, DiagnosticMessage, ErrorGuaranteed, IntoDiagnostic, - Level, MultiSpan, + codes::*, DiagCtxt, DiagnosticBuilder, DiagnosticMessage, EmissionGuarantee, ErrorGuaranteed, + IntoDiagnostic, Level, MultiSpan, }; use rustc_macros::Diagnostic; use rustc_span::{Span, Symbol}; @@ -17,9 +17,9 @@ pub struct FeatureGateError { pub explain: DiagnosticMessage, } -impl<'a> IntoDiagnostic<'a> for FeatureGateError { +impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for FeatureGateError { #[track_caller] - fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> DiagnosticBuilder<'a> { + fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> DiagnosticBuilder<'a, G> { DiagnosticBuilder::new(dcx, level, self.explain).with_span(self.span).with_code(E0658) } } diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index 02c7a0c6371f..b6c194868989 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -1264,7 +1264,7 @@ fn validate_commandline_args_with_session_available(sess: &Session) { // LLVM CFI using rustc LTO requires a single codegen unit. if sess.is_sanitizer_cfi_enabled() && sess.lto() == config::Lto::Fat - && !(sess.codegen_units().as_usize() == 1) + && (sess.codegen_units().as_usize() != 1) { sess.dcx().emit_err(errors::SanitizerCfiRequiresSingleCodegenUnit); } diff --git a/compiler/rustc_smir/src/rustc_smir/context.rs b/compiler/rustc_smir/src/rustc_smir/context.rs index b95186b0a1c5..540bc4835486 100644 --- a/compiler/rustc_smir/src/rustc_smir/context.rs +++ b/compiler/rustc_smir/src/rustc_smir/context.rs @@ -208,11 +208,10 @@ impl<'tcx> Context for TablesWrapper<'tcx> { let crates: Vec = [LOCAL_CRATE] .iter() .chain(tables.tcx.crates(()).iter()) - .map(|crate_num| { + .filter_map(|crate_num| { let crate_name = tables.tcx.crate_name(*crate_num).to_string(); (name == crate_name).then(|| smir_crate(tables.tcx, *crate_num)) }) - .flatten() .collect(); crates } diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 181ab0d4d56c..609ab054da21 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -1441,6 +1441,7 @@ symbols! { rustc_mir, rustc_must_implement_one_of, rustc_never_returns_null_ptr, + rustc_no_mir_inline, rustc_nonnull_optimization_guaranteed, rustc_nounwind, rustc_object_lifetime_default, @@ -1553,9 +1554,7 @@ symbols! { simd_reduce_and, simd_reduce_any, simd_reduce_max, - simd_reduce_max_nanless, simd_reduce_min, - simd_reduce_min_nanless, simd_reduce_mul_ordered, simd_reduce_mul_unordered, simd_reduce_or, diff --git a/compiler/rustc_target/src/lib.rs b/compiler/rustc_target/src/lib.rs index 04c5e60aa6ba..8019d2b80cde 100644 --- a/compiler/rustc_target/src/lib.rs +++ b/compiler/rustc_target/src/lib.rs @@ -9,9 +9,10 @@ #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![doc(rust_logo)] +#![cfg_attr(bootstrap, feature(exhaustive_patterns))] +#![cfg_attr(not(bootstrap), feature(min_exhaustive_patterns))] #![feature(rustdoc_internals)] #![feature(assert_matches)] -#![feature(exhaustive_patterns)] #![feature(iter_intersperse)] #![feature(let_chains)] #![cfg_attr(bootstrap, feature(min_specialization))] diff --git a/compiler/rustc_target/src/spec/base/apple/tests.rs b/compiler/rustc_target/src/spec/base/apple/tests.rs index f13058ebc82a..097039d6c738 100644 --- a/compiler/rustc_target/src/spec/base/apple/tests.rs +++ b/compiler/rustc_target/src/spec/base/apple/tests.rs @@ -14,7 +14,7 @@ fn simulator_targets_set_abi() { aarch64_apple_watchos_sim::target(), ]; - for target in all_sim_targets { + for target in &all_sim_targets { assert_eq!(target.abi, "sim") } } diff --git a/compiler/rustc_trait_selection/src/solve/assembly/mod.rs b/compiler/rustc_trait_selection/src/solve/assembly/mod.rs index 00c22e9e2c32..8e66b1d580f9 100644 --- a/compiler/rustc_trait_selection/src/solve/assembly/mod.rs +++ b/compiler/rustc_trait_selection/src/solve/assembly/mod.rs @@ -5,7 +5,6 @@ use crate::solve::GoalSource; use crate::traits::coherence; use rustc_hir::def_id::DefId; use rustc_infer::traits::query::NoSolution; -use rustc_infer::traits::Reveal; use rustc_middle::traits::solve::inspect::ProbeKind; use rustc_middle::traits::solve::{ CandidateSource, CanonicalResponse, Certainty, Goal, MaybeCause, QueryResult, @@ -70,20 +69,6 @@ pub(super) trait GoalKind<'tcx>: }) } - /// Consider a bound originating from the item bounds of an alias. For this we - /// require that the well-formed requirements of the self type of the goal - /// are "satisfied from the param-env". - /// See [`EvalCtxt::validate_alias_bound_self_from_param_env`]. - fn consider_alias_bound_candidate( - ecx: &mut EvalCtxt<'_, 'tcx>, - goal: Goal<'tcx, Self>, - assumption: ty::Clause<'tcx>, - ) -> QueryResult<'tcx> { - Self::probe_and_match_goal_against_assumption(ecx, goal, assumption, |ecx| { - ecx.validate_alias_bound_self_from_param_env(goal) - }) - } - /// Consider a clause specifically for a `dyn Trait` self type. This requires /// additionally checking all of the supertraits and object bounds to hold, /// since they're not implied by the well-formedness of the object type. @@ -636,7 +621,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> { for assumption in self.tcx().item_bounds(alias_ty.def_id).instantiate(self.tcx(), alias_ty.args) { - match G::consider_alias_bound_candidate(self, goal, assumption) { + match G::consider_implied_clause(self, goal, assumption, []) { Ok(result) => { candidates.push(Candidate { source: CandidateSource::AliasBound, result }); } @@ -657,105 +642,6 @@ impl<'tcx> EvalCtxt<'_, 'tcx> { } } - /// Check that we are allowed to use an alias bound originating from the self - /// type of this goal. This means something different depending on the self type's - /// alias kind. - /// - /// * Projection: Given a goal with a self type such as `::Assoc`, - /// we require that the bound `Ty: Trait` can be proven using either a nested alias - /// bound candidate, or a param-env candidate. - /// - /// * Opaque: The param-env must be in `Reveal::UserFacing` mode. Otherwise, - /// the goal should be proven by using the hidden type instead. - #[instrument(level = "debug", skip(self), ret)] - pub(super) fn validate_alias_bound_self_from_param_env>( - &mut self, - goal: Goal<'tcx, G>, - ) -> QueryResult<'tcx> { - match *goal.predicate.self_ty().kind() { - ty::Alias(ty::Projection, projection_ty) => { - let mut param_env_candidates = vec![]; - let self_trait_ref = projection_ty.trait_ref(self.tcx()); - - if self_trait_ref.self_ty().is_ty_var() { - return self - .evaluate_added_goals_and_make_canonical_response(Certainty::AMBIGUOUS); - } - - let trait_goal: Goal<'_, ty::TraitPredicate<'tcx>> = goal.with( - self.tcx(), - ty::TraitPredicate { - trait_ref: self_trait_ref, - polarity: ty::ImplPolarity::Positive, - }, - ); - - self.assemble_param_env_candidates(trait_goal, &mut param_env_candidates); - // FIXME: We probably need some sort of recursion depth check here. - // Can't come up with an example yet, though, and the worst case - // we can have is a compiler stack overflow... - self.assemble_alias_bound_candidates(trait_goal, &mut param_env_candidates); - - // FIXME: We must also consider alias-bound candidates for a peculiar - // class of built-in candidates that I'll call "defaulted" built-ins. - // - // For example, we always know that `T: Pointee` is implemented, but - // we do not always know what `::Metadata` actually is, - // similar to if we had a user-defined impl with a `default type ...`. - // For these traits, since we're not able to always normalize their - // associated types to a concrete type, we must consider their alias bounds - // instead, so we can prove bounds such as `::Metadata: Copy`. - self.assemble_alias_bound_candidates_for_builtin_impl_default_items( - trait_goal, - &mut param_env_candidates, - ); - - self.merge_candidates(param_env_candidates) - } - ty::Alias(ty::Opaque, _opaque_ty) => match goal.param_env.reveal() { - Reveal::UserFacing => { - self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes) - } - Reveal::All => return Err(NoSolution), - }, - _ => bug!("only expected to be called on alias tys"), - } - } - - /// Assemble a subset of builtin impl candidates for a class of candidates called - /// "defaulted" built-in traits. - /// - /// For example, we always know that `T: Pointee` is implemented, but we do not - /// always know what `::Metadata` actually is! See the comment in - /// [`EvalCtxt::validate_alias_bound_self_from_param_env`] for more detail. - #[instrument(level = "debug", skip_all)] - fn assemble_alias_bound_candidates_for_builtin_impl_default_items>( - &mut self, - goal: Goal<'tcx, G>, - candidates: &mut Vec>, - ) { - let lang_items = self.tcx().lang_items(); - let trait_def_id = goal.predicate.trait_def_id(self.tcx()); - - // You probably shouldn't add anything to this list unless you - // know what you're doing. - let result = if lang_items.pointee_trait() == Some(trait_def_id) { - G::consider_builtin_pointee_candidate(self, goal) - } else if lang_items.discriminant_kind_trait() == Some(trait_def_id) { - G::consider_builtin_discriminant_kind_candidate(self, goal) - } else { - Err(NoSolution) - }; - - match result { - Ok(result) => candidates.push(Candidate { - source: CandidateSource::BuiltinImpl(BuiltinImplSource::Misc), - result, - }), - Err(NoSolution) => (), - } - } - #[instrument(level = "debug", skip_all)] fn assemble_object_bound_candidates>( &mut self, diff --git a/compiler/rustc_trait_selection/src/solve/normalize.rs b/compiler/rustc_trait_selection/src/solve/normalize.rs index 91312c9fdd68..b1c03e82cab9 100644 --- a/compiler/rustc_trait_selection/src/solve/normalize.rs +++ b/compiler/rustc_trait_selection/src/solve/normalize.rs @@ -1,4 +1,4 @@ -use crate::traits::error_reporting::TypeErrCtxtExt; +use crate::traits::error_reporting::{OverflowCause, TypeErrCtxtExt}; use crate::traits::query::evaluate_obligation::InferCtxtExt; use crate::traits::{BoundVarReplacer, PlaceholderReplacer}; use rustc_data_structures::stack::ensure_sufficient_stack; @@ -60,8 +60,12 @@ impl<'tcx> NormalizationFolder<'_, 'tcx> { let tcx = infcx.tcx; let recursion_limit = tcx.recursion_limit(); if !recursion_limit.value_within_limit(self.depth) { + let ty::Alias(_, data) = *alias_ty.kind() else { + unreachable!(); + }; + self.at.infcx.err_ctxt().report_overflow_error( - &alias_ty, + OverflowCause::DeeplyNormalize(data), self.at.cause.span, true, |_| {}, @@ -109,7 +113,7 @@ impl<'tcx> NormalizationFolder<'_, 'tcx> { let recursion_limit = tcx.recursion_limit(); if !recursion_limit.value_within_limit(self.depth) { self.at.infcx.err_ctxt().report_overflow_error( - &ty::Const::new_unevaluated(tcx, uv, ty), + OverflowCause::DeeplyNormalize(ty::AliasTy::new(tcx, uv.def, uv.args)), self.at.cause.span, true, |_| {}, diff --git a/compiler/rustc_trait_selection/src/traits/coherence.rs b/compiler/rustc_trait_selection/src/traits/coherence.rs index 3619d02438da..ac0685994eab 100644 --- a/compiler/rustc_trait_selection/src/traits/coherence.rs +++ b/compiler/rustc_trait_selection/src/traits/coherence.rs @@ -320,22 +320,25 @@ fn impl_intersection_has_impossible_obligation<'a, 'cx, 'tcx>( let mut errors = fulfill_cx.select_where_possible(infcx); errors.pop().map(|err| err.obligation) } else { - obligations.iter().cloned().find(|obligation| { - // We use `evaluate_root_obligation` to correctly track intercrate - // ambiguity clauses. We cannot use this in the new solver. - let evaluation_result = selcx.evaluate_root_obligation(obligation); + obligations + .iter() + .find(|obligation| { + // We use `evaluate_root_obligation` to correctly track intercrate + // ambiguity clauses. We cannot use this in the new solver. + let evaluation_result = selcx.evaluate_root_obligation(obligation); - match evaluation_result { - Ok(result) => !result.may_apply(), - // If overflow occurs, we need to conservatively treat the goal as possibly holding, - // since there can be instantiations of this goal that don't overflow and result in - // success. This isn't much of a problem in the old solver, since we treat overflow - // fatally (this still can be encountered: ), - // but in the new solver, this is very important for correctness, since overflow - // *must* be treated as ambiguity for completeness. - Err(_overflow) => false, - } - }) + match evaluation_result { + Ok(result) => !result.may_apply(), + // If overflow occurs, we need to conservatively treat the goal as possibly holding, + // since there can be instantiations of this goal that don't overflow and result in + // success. This isn't much of a problem in the old solver, since we treat overflow + // fatally (this still can be encountered: ), + // but in the new solver, this is very important for correctness, since overflow + // *must* be treated as ambiguity for completeness. + Err(_overflow) => false, + } + }) + .cloned() } } diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs index 8ae31392b40e..85f6da0d6cc8 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs @@ -1283,9 +1283,9 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { "the full type name has been written to '{}'", file.display() )); - err.note(format!( - "consider using `--verbose` to print full type name to the console" - )); + err.note( + "consider using `--verbose` to print full type name to the console", + ); } if imm_ref_self_ty_satisfies_pred && mut_ref_self_ty_satisfies_pred { @@ -2869,9 +2869,9 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { "the full name for the type has been written to '{}'", file.display(), )); - err.note(format!( - "consider using `--verbose` to print the full type name to the console" - )); + err.note( + "consider using `--verbose` to print the full type name to the console", + ); } } ObligationCauseCode::RepeatElementCopy { @@ -3339,9 +3339,9 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { "the full type name has been written to '{}'", file.display(), )); - err.note(format!( - "consider using `--verbose` to print the full type name to the console" - )); + err.note( + "consider using `--verbose` to print the full type name to the console", + ); } let mut parent_predicate = parent_trait_pred; let mut data = &data.derived; @@ -3395,9 +3395,9 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { "the full type name has been written to '{}'", file.display(), )); - err.note(format!( - "consider using `--verbose` to print the full type name to the console" - )); + err.note( + "consider using `--verbose` to print the full type name to the console", + ); } } // #74711: avoid a stack overflow diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs index 7186b96b40d0..2b74b15ec9fa 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs @@ -57,12 +57,21 @@ use super::{ pub use rustc_infer::traits::error_reporting::*; +pub enum OverflowCause<'tcx> { + DeeplyNormalize(ty::AliasTy<'tcx>), + TraitSolver(ty::Predicate<'tcx>), +} + #[extension(pub trait TypeErrCtxtExt<'tcx>)] impl<'tcx> TypeErrCtxt<'_, 'tcx> { fn report_fulfillment_errors( &self, mut errors: Vec>, ) -> ErrorGuaranteed { + self.sub_relations + .borrow_mut() + .add_constraints(self, errors.iter().map(|e| e.obligation.predicate)); + #[derive(Debug)] struct ErrorDescriptor<'tcx> { predicate: ty::Predicate<'tcx>, @@ -180,49 +189,78 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { /// whose result could not be truly determined and thus we can't say /// if the program type checks or not -- and they are unusual /// occurrences in any case. - fn report_overflow_error( + fn report_overflow_error( &self, - predicate: &T, + cause: OverflowCause<'tcx>, span: Span, suggest_increasing_limit: bool, mutate: impl FnOnce(&mut DiagnosticBuilder<'_>), - ) -> ! - where - T: fmt::Display + TypeFoldable> + Print<'tcx, FmtPrinter<'tcx, 'tcx>>, - { - let mut err = self.build_overflow_error(predicate, span, suggest_increasing_limit); + ) -> ! { + let mut err = self.build_overflow_error(cause, span, suggest_increasing_limit); mutate(&mut err); err.emit(); FatalError.raise(); } - fn build_overflow_error( + fn build_overflow_error( &self, - predicate: &T, + cause: OverflowCause<'tcx>, span: Span, suggest_increasing_limit: bool, - ) -> DiagnosticBuilder<'tcx> - where - T: fmt::Display + TypeFoldable> + Print<'tcx, FmtPrinter<'tcx, 'tcx>>, - { - let predicate = self.resolve_vars_if_possible(predicate.clone()); - let mut pred_str = predicate.to_string(); - - if pred_str.len() > 50 { - // We don't need to save the type to a file, we will be talking about this type already - // in a separate note when we explain the obligation, so it will be available that way. - let mut cx: FmtPrinter<'_, '_> = - FmtPrinter::new_with_limit(self.tcx, Namespace::TypeNS, rustc_session::Limit(6)); - predicate.print(&mut cx).unwrap(); - pred_str = cx.into_buffer(); + ) -> DiagnosticBuilder<'tcx> { + fn with_short_path<'tcx, T>(tcx: TyCtxt<'tcx>, value: T) -> String + where + T: fmt::Display + Print<'tcx, FmtPrinter<'tcx, 'tcx>>, + { + let s = value.to_string(); + if s.len() > 50 { + // We don't need to save the type to a file, we will be talking about this type already + // in a separate note when we explain the obligation, so it will be available that way. + let mut cx: FmtPrinter<'_, '_> = + FmtPrinter::new_with_limit(tcx, Namespace::TypeNS, rustc_session::Limit(6)); + value.print(&mut cx).unwrap(); + cx.into_buffer() + } else { + s + } } - let mut err = struct_span_code_err!( - self.dcx(), - span, - E0275, - "overflow evaluating the requirement `{}`", - pred_str, - ); + + let mut err = match cause { + OverflowCause::DeeplyNormalize(alias_ty) => { + let alias_ty = self.resolve_vars_if_possible(alias_ty); + let kind = alias_ty.opt_kind(self.tcx).map_or("alias", |k| k.descr()); + let alias_str = with_short_path(self.tcx, alias_ty); + struct_span_code_err!( + self.dcx(), + span, + E0275, + "overflow normalizing the {kind} `{alias_str}`", + ) + } + OverflowCause::TraitSolver(predicate) => { + let predicate = self.resolve_vars_if_possible(predicate); + match predicate.kind().skip_binder() { + ty::PredicateKind::Subtype(ty::SubtypePredicate { a, b, a_is_expected: _ }) + | ty::PredicateKind::Coerce(ty::CoercePredicate { a, b }) => { + struct_span_code_err!( + self.dcx(), + span, + E0275, + "overflow assigning `{a}` to `{b}`", + ) + } + _ => { + let pred_str = with_short_path(self.tcx, predicate); + struct_span_code_err!( + self.dcx(), + span, + E0275, + "overflow evaluating the requirement `{pred_str}`", + ) + } + } + } + }; if suggest_increasing_limit { self.suggest_new_overflow_limit(&mut err); @@ -248,7 +286,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { let predicate = obligation.predicate.clone().to_predicate(self.tcx); let predicate = self.resolve_vars_if_possible(predicate); self.report_overflow_error( - &predicate, + OverflowCause::TraitSolver(predicate), obligation.cause.span, suggest_increasing_limit, |err| { @@ -299,7 +337,11 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { fn report_overflow_no_abort(&self, obligation: PredicateObligation<'tcx>) -> ErrorGuaranteed { let obligation = self.resolve_vars_if_possible(obligation); - let mut err = self.build_overflow_error(&obligation.predicate, obligation.cause.span, true); + let mut err = self.build_overflow_error( + OverflowCause::TraitSolver(obligation.predicate), + obligation.cause.span, + true, + ); self.note_obligation_cause(&mut err, &obligation); self.point_at_returns_when_relevant(&mut err, &obligation); err.emit() diff --git a/compiler/rustc_trait_selection/src/traits/fulfill.rs b/compiler/rustc_trait_selection/src/traits/fulfill.rs index fd981130af87..b91698af942e 100644 --- a/compiler/rustc_trait_selection/src/traits/fulfill.rs +++ b/compiler/rustc_trait_selection/src/traits/fulfill.rs @@ -450,12 +450,7 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> { .recursion_limit() .value_within_limit(obligation.recursion_depth) => { - self.selcx.infcx.err_ctxt().report_overflow_error( - &obligation.predicate, - obligation.cause.span, - false, - |_| {}, - ); + self.selcx.infcx.err_ctxt().report_overflow_obligation(&obligation, false); } ty::PredicateKind::Clause(ty::ClauseKind::WellFormed(arg)) => { diff --git a/compiler/rustc_trait_selection/src/traits/mod.rs b/compiler/rustc_trait_selection/src/traits/mod.rs index cac537967479..9eec60ea06c2 100644 --- a/compiler/rustc_trait_selection/src/traits/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/mod.rs @@ -172,9 +172,7 @@ fn do_normalize_predicates<'tcx>( // the normalized predicates. let errors = infcx.resolve_regions(&outlives_env); if !errors.is_empty() { - // @lcnr: Let's still ICE here for now. I want a test case - // for that. - tcx.dcx().span_bug( + tcx.dcx().span_delayed_bug( span, format!("failed region resolution while normalizing {elaborated_env:?}: {errors:?}"), ); diff --git a/compiler/rustc_trait_selection/src/traits/normalize.rs b/compiler/rustc_trait_selection/src/traits/normalize.rs index 429e5a5d7a41..15bfffef3ced 100644 --- a/compiler/rustc_trait_selection/src/traits/normalize.rs +++ b/compiler/rustc_trait_selection/src/traits/normalize.rs @@ -1,4 +1,8 @@ //! Deeply normalize types using the old trait solver. +use super::error_reporting::OverflowCause; +use super::error_reporting::TypeErrCtxtExt; +use super::SelectionContext; +use super::{project, with_replaced_escaping_bound_vars, BoundVarReplacer, PlaceholderReplacer}; use rustc_data_structures::stack::ensure_sufficient_stack; use rustc_infer::infer::at::At; use rustc_infer::infer::InferOk; @@ -8,10 +12,6 @@ use rustc_middle::traits::{ObligationCause, ObligationCauseCode, Reveal}; use rustc_middle::ty::{self, Ty, TyCtxt, TypeFolder}; use rustc_middle::ty::{TypeFoldable, TypeSuperFoldable, TypeVisitable, TypeVisitableExt}; -use super::error_reporting::TypeErrCtxtExt; -use super::SelectionContext; -use super::{project, with_replaced_escaping_bound_vars, BoundVarReplacer, PlaceholderReplacer}; - #[extension(pub trait NormalizeExt<'tcx>)] impl<'tcx> At<'_, 'tcx> { /// Normalize a value using the `AssocTypeNormalizer`. @@ -173,7 +173,7 @@ impl<'a, 'b, 'tcx> TypeFolder> for AssocTypeNormalizer<'a, 'b, 'tcx } let (kind, data) = match *ty.kind() { - ty::Alias(kind, alias_ty) => (kind, alias_ty), + ty::Alias(kind, data) => (kind, data), _ => return ty.super_fold_with(self), }; @@ -210,7 +210,7 @@ impl<'a, 'b, 'tcx> TypeFolder> for AssocTypeNormalizer<'a, 'b, 'tcx let recursion_limit = self.interner().recursion_limit(); if !recursion_limit.value_within_limit(self.depth) { self.selcx.infcx.err_ctxt().report_overflow_error( - &ty, + OverflowCause::DeeplyNormalize(data), self.cause.span, true, |_| {}, @@ -306,7 +306,7 @@ impl<'a, 'b, 'tcx> TypeFolder> for AssocTypeNormalizer<'a, 'b, 'tcx let recursion_limit = self.interner().recursion_limit(); if !recursion_limit.value_within_limit(self.depth) { self.selcx.infcx.err_ctxt().report_overflow_error( - &ty, + OverflowCause::DeeplyNormalize(data), self.cause.span, false, |diag| { diff --git a/compiler/rustc_trait_selection/src/traits/project.rs b/compiler/rustc_trait_selection/src/traits/project.rs index f8de19043e1b..68c03e3c73e7 100644 --- a/compiler/rustc_trait_selection/src/traits/project.rs +++ b/compiler/rustc_trait_selection/src/traits/project.rs @@ -1031,12 +1031,9 @@ fn assemble_candidates_from_impls<'cx, 'tcx>( { candidate_set.mark_ambiguous(); true - } else if obligation.predicate.args.type_at(0).to_opt_closure_kind().is_some() - && obligation.predicate.args.type_at(1).to_opt_closure_kind().is_some() - { - true } else { - false + obligation.predicate.args.type_at(0).to_opt_closure_kind().is_some() + && obligation.predicate.args.type_at(1).to_opt_closure_kind().is_some() } } else if lang_items.discriminant_kind_trait() == Some(trait_ref.def_id) { match self_ty.kind() { diff --git a/compiler/rustc_trait_selection/src/traits/query/normalize.rs b/compiler/rustc_trait_selection/src/traits/query/normalize.rs index 70fd0b7e50b7..e5f8e3368609 100644 --- a/compiler/rustc_trait_selection/src/traits/query/normalize.rs +++ b/compiler/rustc_trait_selection/src/traits/query/normalize.rs @@ -5,6 +5,7 @@ use crate::infer::at::At; use crate::infer::canonical::OriginalQueryValues; use crate::infer::{InferCtxt, InferOk}; +use crate::traits::error_reporting::OverflowCause; use crate::traits::error_reporting::TypeErrCtxtExt; use crate::traits::normalize::needs_normalization; use crate::traits::{BoundVarReplacer, PlaceholderReplacer}; @@ -228,7 +229,11 @@ impl<'cx, 'tcx> FallibleTypeFolder> for QueryNormalizer<'cx, 'tcx> let guar = self .infcx .err_ctxt() - .build_overflow_error(&ty, self.cause.span, true) + .build_overflow_error( + OverflowCause::DeeplyNormalize(data), + self.cause.span, + true, + ) .delay_as_bug(); return Ok(Ty::new_error(self.interner(), guar)); } diff --git a/compiler/rustc_trait_selection/src/traits/query/type_op/mod.rs b/compiler/rustc_trait_selection/src/traits/query/type_op/mod.rs index 12ee778ee05c..faf218131b8b 100644 --- a/compiler/rustc_trait_selection/src/traits/query/type_op/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/query/type_op/mod.rs @@ -98,6 +98,7 @@ pub trait QueryTypeOp<'tcx>: fmt::Debug + Copy + TypeFoldable> + 't query_key: ParamEnvAnd<'tcx, Self>, infcx: &InferCtxt<'tcx>, output_query_region_constraints: &mut QueryRegionConstraints<'tcx>, + span: Span, ) -> Result< ( Self::QueryResponse, @@ -118,7 +119,7 @@ pub trait QueryTypeOp<'tcx>: fmt::Debug + Copy + TypeFoldable> + 't let InferOk { value, obligations } = infcx .instantiate_nll_query_response_and_region_obligations( - &ObligationCause::dummy(), + &ObligationCause::dummy_with_span(span), old_param_env, &canonical_var_values, canonical_result, @@ -160,7 +161,7 @@ where let mut region_constraints = QueryRegionConstraints::default(); let (output, error_info, mut obligations, _) = - Q::fully_perform_into(self, infcx, &mut region_constraints).map_err(|_| { + Q::fully_perform_into(self, infcx, &mut region_constraints, span).map_err(|_| { infcx.dcx().span_delayed_bug(span, format!("error performing {self:?}")) })?; @@ -178,6 +179,7 @@ where obligation.param_env.and(ProvePredicate::new(obligation.predicate)), infcx, &mut region_constraints, + span, ) { Ok(((), _, new, certainty)) => { obligations.extend(new); diff --git a/compiler/rustc_trait_selection/src/traits/select/mod.rs b/compiler/rustc_trait_selection/src/traits/select/mod.rs index 1146f869fc16..a4499d438c1b 100644 --- a/compiler/rustc_trait_selection/src/traits/select/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/select/mod.rs @@ -40,7 +40,6 @@ use rustc_middle::dep_graph::DepNodeIndex; use rustc_middle::mir::interpret::ErrorHandled; use rustc_middle::ty::_match::MatchAgainstFreshVars; use rustc_middle::ty::abstract_const::NotConstEvaluatable; -use rustc_middle::ty::fold::BottomUpFolder; use rustc_middle::ty::relate::TypeRelation; use rustc_middle::ty::GenericArgsRef; use rustc_middle::ty::{self, EarlyBinder, PolyProjectionPredicate, ToPolyTraitRef, ToPredicate}; @@ -2435,28 +2434,8 @@ impl<'tcx> SelectionContext<'_, 'tcx> { match self.match_impl(impl_def_id, impl_trait_header, obligation) { Ok(args) => args, Err(()) => { - // FIXME: A rematch may fail when a candidate cache hit occurs - // on the freshened form of the trait predicate, but the match - // fails for some reason that is not captured in the freshened - // cache key. For example, equating an impl trait ref against - // the placeholder trait ref may fail due the Generalizer relation - // raising a CyclicalTy error due to a sub_root_var relation - // for a variable being generalized... - let guar = self.infcx.dcx().span_delayed_bug( - obligation.cause.span, - format!( - "Impl {impl_def_id:?} was matchable against {obligation:?} but now is not" - ), - ); - let value = self.infcx.fresh_args_for_item(obligation.cause.span, impl_def_id); - let err = Ty::new_error(self.tcx(), guar); - let value = value.fold_with(&mut BottomUpFolder { - tcx: self.tcx(), - ty_op: |_| err, - lt_op: |l| l, - ct_op: |c| c, - }); - Normalized { value, obligations: vec![] } + let predicate = self.infcx.resolve_vars_if_possible(obligation.predicate); + bug!("impl {impl_def_id:?} was matchable against {predicate:?} but now is not") } } } diff --git a/compiler/rustc_type_ir/src/ty_kind.rs b/compiler/rustc_type_ir/src/ty_kind.rs index d389933fd2df..9f715a01d44f 100644 --- a/compiler/rustc_type_ir/src/ty_kind.rs +++ b/compiler/rustc_type_ir/src/ty_kind.rs @@ -105,6 +105,17 @@ pub enum AliasKind { Weak, } +impl AliasKind { + pub fn descr(self) -> &'static str { + match self { + AliasKind::Projection => "associated type", + AliasKind::Inherent => "inherent associated type", + AliasKind::Opaque => "opaque type", + AliasKind::Weak => "type alias", + } + } +} + /// Defines the kinds of types used by the type system. /// /// Types written by the user start out as `hir::TyKind` and get diff --git a/compiler/stable_mir/src/compiler_interface.rs b/compiler/stable_mir/src/compiler_interface.rs index 6272f793f40c..0f7d8d7e083b 100644 --- a/compiler/stable_mir/src/compiler_interface.rs +++ b/compiler/stable_mir/src/compiler_interface.rs @@ -208,7 +208,7 @@ where if TLV.is_set() { Err(Error::from("StableMIR already running")) } else { - let ptr: *const () = &context as *const &_ as _; + let ptr: *const () = std::ptr::addr_of!(context) as _; TLV.set(&Cell::new(ptr), || Ok(f())) } } diff --git a/library/alloc/src/boxed/thin.rs b/library/alloc/src/boxed/thin.rs index 3b29c144a89f..0421a12b3a95 100644 --- a/library/alloc/src/boxed/thin.rs +++ b/library/alloc/src/boxed/thin.rs @@ -176,7 +176,7 @@ impl ThinBox { fn with_header(&self) -> &WithHeader<::Metadata> { // SAFETY: both types are transparent to `NonNull` - unsafe { &*((&self.ptr) as *const WithOpaqueHeader as *const WithHeader<_>) } + unsafe { &*(core::ptr::addr_of!(self.ptr) as *const WithHeader<_>) } } } diff --git a/library/alloc/src/collections/binary_heap/mod.rs b/library/alloc/src/collections/binary_heap/mod.rs index c89a38062802..83b2678f7f52 100644 --- a/library/alloc/src/collections/binary_heap/mod.rs +++ b/library/alloc/src/collections/binary_heap/mod.rs @@ -607,6 +607,7 @@ impl BinaryHeap { /// occurs when capacity is exhausted and needs a resize. The resize cost /// has been amortized in the previous figures. #[stable(feature = "rust1", since = "1.0.0")] + #[rustc_confusables("append", "put")] pub fn push(&mut self, item: T) { let old_len = self.len(); self.data.push(item); @@ -1264,6 +1265,7 @@ impl BinaryHeap { /// ``` #[must_use] #[stable(feature = "rust1", since = "1.0.0")] + #[rustc_confusables("length", "size")] pub fn len(&self) -> usize { self.data.len() } diff --git a/library/alloc/src/collections/btree/map.rs b/library/alloc/src/collections/btree/map.rs index addcc71a2d45..271ea88fff65 100644 --- a/library/alloc/src/collections/btree/map.rs +++ b/library/alloc/src/collections/btree/map.rs @@ -979,6 +979,7 @@ impl BTreeMap { /// assert_eq!(map[&37], "c"); /// ``` #[stable(feature = "rust1", since = "1.0.0")] + #[rustc_confusables("push", "put", "set")] pub fn insert(&mut self, key: K, value: V) -> Option where K: Ord, @@ -1041,6 +1042,7 @@ impl BTreeMap { /// assert_eq!(map.remove(&1), None); /// ``` #[stable(feature = "rust1", since = "1.0.0")] + #[rustc_confusables("delete", "take")] pub fn remove(&mut self, key: &Q) -> Option where K: Borrow + Ord, @@ -2495,6 +2497,7 @@ impl BTreeMap { issue = "71835", implied_by = "const_btree_new" )] + #[rustc_confusables("length", "size")] pub const fn len(&self) -> usize { self.length } @@ -2913,7 +2916,7 @@ impl<'a, K, V> Cursor<'a, K, V> { } } - /// Returns a reference to the the key and value of the next element without + /// Returns a reference to the key and value of the next element without /// moving the cursor. /// /// If the cursor is at the end of the map then `None` is returned @@ -2922,7 +2925,7 @@ impl<'a, K, V> Cursor<'a, K, V> { self.clone().next() } - /// Returns a reference to the the key and value of the previous element + /// Returns a reference to the key and value of the previous element /// without moving the cursor. /// /// If the cursor is at the start of the map then `None` is returned. @@ -2955,7 +2958,7 @@ impl<'a, K, V, A> CursorMut<'a, K, V, A> { Some((&*k, v)) } - /// Returns a reference to the the key and value of the next element without + /// Returns a reference to the key and value of the next element without /// moving the cursor. /// /// If the cursor is at the end of the map then `None` is returned @@ -2965,7 +2968,7 @@ impl<'a, K, V, A> CursorMut<'a, K, V, A> { Some((&*k, v)) } - /// Returns a reference to the the key and value of the previous element + /// Returns a reference to the key and value of the previous element /// without moving the cursor. /// /// If the cursor is at the start of the map then `None` is returned. @@ -3053,7 +3056,7 @@ impl<'a, K, V, A> CursorMutKey<'a, K, V, A> { } } - /// Returns a reference to the the key and value of the next element without + /// Returns a reference to the key and value of the next element without /// moving the cursor. /// /// If the cursor is at the end of the map then `None` is returned @@ -3065,7 +3068,7 @@ impl<'a, K, V, A> CursorMutKey<'a, K, V, A> { Some(kv) } - /// Returns a reference to the the key and value of the previous element + /// Returns a reference to the key and value of the previous element /// without moving the cursor. /// /// If the cursor is at the start of the map then `None` is returned. diff --git a/library/alloc/src/collections/btree/map/entry.rs b/library/alloc/src/collections/btree/map/entry.rs index e9366eec9cec..0a894258f469 100644 --- a/library/alloc/src/collections/btree/map/entry.rs +++ b/library/alloc/src/collections/btree/map/entry.rs @@ -347,6 +347,7 @@ impl<'a, K: Ord, V, A: Allocator + Clone> VacantEntry<'a, K, V, A> { /// assert_eq!(map["poneyland"], 37); /// ``` #[stable(feature = "rust1", since = "1.0.0")] + #[rustc_confusables("push", "put")] pub fn insert(mut self, value: V) -> &'a mut V { let out_ptr = match self.handle { None => { @@ -524,6 +525,7 @@ impl<'a, K: Ord, V, A: Allocator + Clone> OccupiedEntry<'a, K, V, A> { /// assert_eq!(map["poneyland"], 15); /// ``` #[stable(feature = "rust1", since = "1.0.0")] + #[rustc_confusables("push", "put")] pub fn insert(&mut self, value: V) -> V { mem::replace(self.get_mut(), value) } @@ -546,6 +548,7 @@ impl<'a, K: Ord, V, A: Allocator + Clone> OccupiedEntry<'a, K, V, A> { /// // println!("{}", map["poneyland"]); /// ``` #[stable(feature = "rust1", since = "1.0.0")] + #[rustc_confusables("delete", "take")] pub fn remove(self) -> V { self.remove_kv().1 } diff --git a/library/alloc/src/collections/btree/set.rs b/library/alloc/src/collections/btree/set.rs index 0e03551286e8..ed91ae1a66e3 100644 --- a/library/alloc/src/collections/btree/set.rs +++ b/library/alloc/src/collections/btree/set.rs @@ -790,6 +790,7 @@ impl BTreeSet { /// ``` #[must_use] #[stable(feature = "map_first_last", since = "1.66.0")] + #[rustc_confusables("front")] pub fn first(&self) -> Option<&T> where T: Ord, @@ -816,6 +817,7 @@ impl BTreeSet { /// ``` #[must_use] #[stable(feature = "map_first_last", since = "1.66.0")] + #[rustc_confusables("back")] pub fn last(&self) -> Option<&T> where T: Ord, @@ -896,6 +898,7 @@ impl BTreeSet { /// assert_eq!(set.len(), 1); /// ``` #[stable(feature = "rust1", since = "1.0.0")] + #[rustc_confusables("push", "put")] pub fn insert(&mut self, value: T) -> bool where T: Ord, @@ -919,6 +922,7 @@ impl BTreeSet { /// assert_eq!(set.get(&[][..]).unwrap().capacity(), 10); /// ``` #[stable(feature = "set_recovery", since = "1.9.0")] + #[rustc_confusables("swap")] pub fn replace(&mut self, value: T) -> Option where T: Ord, @@ -1152,6 +1156,7 @@ impl BTreeSet { issue = "71835", implied_by = "const_btree_new" )] + #[rustc_confusables("length", "size")] pub const fn len(&self) -> usize { self.map.len() } diff --git a/library/alloc/src/collections/linked_list.rs b/library/alloc/src/collections/linked_list.rs index 9e109feb3d3e..6dfb82ac807a 100644 --- a/library/alloc/src/collections/linked_list.rs +++ b/library/alloc/src/collections/linked_list.rs @@ -656,6 +656,7 @@ impl LinkedList { #[inline] #[must_use] #[stable(feature = "rust1", since = "1.0.0")] + #[rustc_confusables("length", "size")] pub fn len(&self) -> usize { self.len } @@ -740,6 +741,7 @@ impl LinkedList { #[inline] #[must_use] #[stable(feature = "rust1", since = "1.0.0")] + #[rustc_confusables("first")] pub fn front(&self) -> Option<&T> { unsafe { self.head.as_ref().map(|node| &node.as_ref().element) } } @@ -890,6 +892,7 @@ impl LinkedList { /// assert_eq!(3, *d.back().unwrap()); /// ``` #[stable(feature = "rust1", since = "1.0.0")] + #[rustc_confusables("push", "append")] pub fn push_back(&mut self, elt: T) { let node = Box::new_in(Node::new(elt), &self.alloc); let node_ptr = NonNull::from(Box::leak(node)); @@ -1004,6 +1007,7 @@ impl LinkedList { /// assert_eq!(d.remove(0), 1); /// ``` #[unstable(feature = "linked_list_remove", issue = "69210")] + #[rustc_confusables("delete", "take")] pub fn remove(&mut self, at: usize) -> T { let len = self.len(); assert!(at < len, "Cannot remove at an index outside of the list bounds"); @@ -1478,6 +1482,7 @@ impl<'a, T, A: Allocator> Cursor<'a, T, A> { /// or None if the list is empty. #[must_use] #[unstable(feature = "linked_list_cursors", issue = "58533")] + #[rustc_confusables("first")] pub fn front(&self) -> Option<&'a T> { self.list.front() } @@ -1486,6 +1491,7 @@ impl<'a, T, A: Allocator> Cursor<'a, T, A> { /// or None if the list is empty. #[must_use] #[unstable(feature = "linked_list_cursors", issue = "58533")] + #[rustc_confusables("last")] pub fn back(&self) -> Option<&'a T> { self.list.back() } @@ -1788,6 +1794,7 @@ impl<'a, T, A: Allocator> CursorMut<'a, T, A> { /// /// This operation should compute in *O*(1) time. #[unstable(feature = "linked_list_cursors", issue = "58533")] + #[rustc_confusables("push", "append")] pub fn push_back(&mut self, elt: T) { // Safety: We know that `push_back` does not change the position in // memory of other nodes. This ensures that `self.current` remains @@ -1834,6 +1841,7 @@ impl<'a, T, A: Allocator> CursorMut<'a, T, A> { /// /// This operation should compute in *O*(1) time. #[unstable(feature = "linked_list_cursors", issue = "58533")] + #[rustc_confusables("pop")] pub fn pop_back(&mut self) -> Option { if self.list.is_empty() { None @@ -1854,6 +1862,7 @@ impl<'a, T, A: Allocator> CursorMut<'a, T, A> { /// or None if the list is empty. #[must_use] #[unstable(feature = "linked_list_cursors", issue = "58533")] + #[rustc_confusables("first")] pub fn front(&self) -> Option<&T> { self.list.front() } @@ -1870,6 +1879,7 @@ impl<'a, T, A: Allocator> CursorMut<'a, T, A> { /// or None if the list is empty. #[must_use] #[unstable(feature = "linked_list_cursors", issue = "58533")] + #[rustc_confusables("last")] pub fn back(&self) -> Option<&T> { self.list.back() } diff --git a/library/alloc/src/collections/vec_deque/mod.rs b/library/alloc/src/collections/vec_deque/mod.rs index bcba6525fda1..c35bab5ef665 100644 --- a/library/alloc/src/collections/vec_deque/mod.rs +++ b/library/alloc/src/collections/vec_deque/mod.rs @@ -1209,6 +1209,7 @@ impl VecDeque { /// assert_eq!(deque.len(), 1); /// ``` #[stable(feature = "rust1", since = "1.0.0")] + #[rustc_confusables("length", "size")] pub fn len(&self) -> usize { self.len } @@ -1491,6 +1492,7 @@ impl VecDeque { /// assert_eq!(d.front(), Some(&1)); /// ``` #[stable(feature = "rust1", since = "1.0.0")] + #[rustc_confusables("first")] pub fn front(&self) -> Option<&T> { self.get(0) } @@ -1535,6 +1537,7 @@ impl VecDeque { /// assert_eq!(d.back(), Some(&2)); /// ``` #[stable(feature = "rust1", since = "1.0.0")] + #[rustc_confusables("last")] pub fn back(&self) -> Option<&T> { self.get(self.len.wrapping_sub(1)) } @@ -1654,6 +1657,7 @@ impl VecDeque { /// assert_eq!(3, *buf.back().unwrap()); /// ``` #[stable(feature = "rust1", since = "1.0.0")] + #[rustc_confusables("push", "put", "append")] pub fn push_back(&mut self, value: T) { if self.is_full() { self.grow(); @@ -1813,6 +1817,7 @@ impl VecDeque { /// assert_eq!(buf, [1, 3]); /// ``` #[stable(feature = "rust1", since = "1.0.0")] + #[rustc_confusables("delete", "take")] pub fn remove(&mut self, index: usize) -> Option { if self.len <= index { return None; diff --git a/library/alloc/src/ffi/c_str.rs b/library/alloc/src/ffi/c_str.rs index 9419b0cfb24f..61ec04a4849d 100644 --- a/library/alloc/src/ffi/c_str.rs +++ b/library/alloc/src/ffi/c_str.rs @@ -11,7 +11,7 @@ use core::borrow::Borrow; use core::ffi::{c_char, CStr}; use core::fmt; use core::mem; -use core::num::NonZeroU8; +use core::num::NonZero; use core::ops; use core::ptr; use core::slice; @@ -795,22 +795,22 @@ impl From> for CString { } #[stable(feature = "cstring_from_vec_of_nonzerou8", since = "1.43.0")] -impl From> for CString { - /// Converts a [Vec]<[NonZeroU8]> into a [`CString`] without +impl From>> for CString { + /// Converts a [Vec]<[NonZero]<[u8]>> into a [`CString`] without /// copying nor checking for inner nul bytes. #[inline] - fn from(v: Vec) -> CString { + fn from(v: Vec>) -> CString { unsafe { - // Transmute `Vec` to `Vec`. + // Transmute `Vec>` to `Vec`. let v: Vec = { // SAFETY: - // - transmuting between `NonZeroU8` and `u8` is sound; - // - `alloc::Layout == alloc::Layout`. - let (ptr, len, cap): (*mut NonZeroU8, _, _) = Vec::into_raw_parts(v); + // - transmuting between `NonZero` and `u8` is sound; + // - `alloc::Layout> == alloc::Layout`. + let (ptr, len, cap): (*mut NonZero, _, _) = Vec::into_raw_parts(v); Vec::from_raw_parts(ptr.cast::(), len, cap) }; // SAFETY: `v` cannot contain nul bytes, given the type-level - // invariant of `NonZeroU8`. + // invariant of `NonZero`. Self::_from_vec_unchecked(v) } } diff --git a/library/alloc/src/lib.rs b/library/alloc/src/lib.rs index b84273848ee9..45e93feb6c5b 100644 --- a/library/alloc/src/lib.rs +++ b/library/alloc/src/lib.rs @@ -92,6 +92,7 @@ #![warn(multiple_supertrait_upcastable)] #![allow(internal_features)] #![allow(rustdoc::redundant_explicit_links)] +#![deny(ffi_unwind_calls)] // // Library features: // tidy-alphabetical-start diff --git a/library/alloc/src/rc.rs b/library/alloc/src/rc.rs index c3d0019be397..084157b97ab4 100644 --- a/library/alloc/src/rc.rs +++ b/library/alloc/src/rc.rs @@ -1969,7 +1969,7 @@ impl Rc { // Copy value as bytes ptr::copy_nonoverlapping( - &*src as *const T as *const u8, + core::ptr::addr_of!(*src) as *const u8, ptr::addr_of_mut!((*ptr).value) as *mut u8, value_size, ); @@ -2440,7 +2440,7 @@ impl fmt::Debug for Rc { #[stable(feature = "rust1", since = "1.0.0")] impl fmt::Pointer for Rc { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - fmt::Pointer::fmt(&(&**self as *const T), f) + fmt::Pointer::fmt(&core::ptr::addr_of!(**self), f) } } diff --git a/library/alloc/src/string.rs b/library/alloc/src/string.rs index 4d6968157ded..6dadbc8e3642 100644 --- a/library/alloc/src/string.rs +++ b/library/alloc/src/string.rs @@ -1049,6 +1049,7 @@ impl String { #[cfg(not(no_global_oom_handling))] #[inline] #[stable(feature = "rust1", since = "1.0.0")] + #[rustc_confusables("append", "push")] pub fn push_str(&mut self, string: &str) { self.vec.extend_from_slice(string.as_bytes()) } @@ -1445,6 +1446,7 @@ impl String { /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] + #[rustc_confusables("delete", "take")] pub fn remove(&mut self, idx: usize) -> char { let ch = match self[idx..].chars().next() { Some(ch) => ch, @@ -1639,6 +1641,7 @@ impl String { #[cfg(not(no_global_oom_handling))] #[inline] #[stable(feature = "rust1", since = "1.0.0")] + #[rustc_confusables("set")] pub fn insert(&mut self, idx: usize, ch: char) { assert!(self.is_char_boundary(idx)); let mut bits = [0; 4]; @@ -1738,6 +1741,7 @@ impl String { #[inline] #[must_use] #[stable(feature = "rust1", since = "1.0.0")] + #[rustc_confusables("length", "size")] pub fn len(&self) -> usize { self.vec.len() } diff --git a/library/alloc/src/sync.rs b/library/alloc/src/sync.rs index 524aa35e0452..00f47f5c6e0e 100644 --- a/library/alloc/src/sync.rs +++ b/library/alloc/src/sync.rs @@ -1914,7 +1914,7 @@ impl Arc { // Copy value as bytes ptr::copy_nonoverlapping( - &*src as *const T as *const u8, + core::ptr::addr_of!(*src) as *const u8, ptr::addr_of_mut!((*ptr).data) as *mut u8, value_size, ); @@ -3265,7 +3265,7 @@ impl fmt::Debug for Arc { #[stable(feature = "rust1", since = "1.0.0")] impl fmt::Pointer for Arc { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - fmt::Pointer::fmt(&(&**self as *const T), f) + fmt::Pointer::fmt(&core::ptr::addr_of!(**self), f) } } diff --git a/library/alloc/src/vec/is_zero.rs b/library/alloc/src/vec/is_zero.rs index cb9adf05c25b..bcc5bf4d65bb 100644 --- a/library/alloc/src/vec/is_zero.rs +++ b/library/alloc/src/vec/is_zero.rs @@ -1,4 +1,4 @@ -use core::num::{Saturating, Wrapping}; +use core::num::{NonZero, Saturating, Wrapping}; use crate::boxed::Box; @@ -69,7 +69,7 @@ unsafe impl IsZero for [T; N] { } // This is recursive macro. -macro_rules! impl_for_tuples { +macro_rules! impl_is_zero_tuples { // Stopper () => { // No use for implementing for empty tuple because it is ZST. @@ -88,11 +88,11 @@ macro_rules! impl_for_tuples { } } - impl_for_tuples!($($rest),*); + impl_is_zero_tuples!($($rest),*); } } -impl_for_tuples!(A, B, C, D, E, F, G, H); +impl_is_zero_tuples!(A, B, C, D, E, F, G, H); // `Option<&T>` and `Option>` are guaranteed to represent `None` as null. // For fat pointers, the bytes that would be the pointer metadata in the `Some` @@ -115,16 +115,15 @@ unsafe impl IsZero for Option> { } } -// `Option` and similar have a representation guarantee that +// `Option>` and similar have a representation guarantee that // they're the same size as the corresponding `u32` type, as well as a guarantee -// that transmuting between `NonZeroU32` and `Option` works. +// that transmuting between `NonZero` and `Option>` works. // While the documentation officially makes it UB to transmute from `None`, // we're the standard library so we can make extra inferences, and we know that // the only niche available to represent `None` is the one that's all zeros. - -macro_rules! impl_is_zero_option_of_nonzero { - ($($t:ident,)+) => {$( - unsafe impl IsZero for Option { +macro_rules! impl_is_zero_option_of_nonzero_int { + ($($t:ty),+ $(,)?) => {$( + unsafe impl IsZero for Option> { #[inline] fn is_zero(&self) -> bool { self.is_none() @@ -133,23 +132,10 @@ macro_rules! impl_is_zero_option_of_nonzero { )+}; } -impl_is_zero_option_of_nonzero!( - NonZeroU8, - NonZeroU16, - NonZeroU32, - NonZeroU64, - NonZeroU128, - NonZeroI8, - NonZeroI16, - NonZeroI32, - NonZeroI64, - NonZeroI128, - NonZeroUsize, - NonZeroIsize, -); +impl_is_zero_option_of_nonzero_int!(u8, u16, u32, u64, u128, usize, i8, i16, i32, i64, i128, isize); -macro_rules! impl_is_zero_option_of_num { - ($($t:ty,)+) => {$( +macro_rules! impl_is_zero_option_of_int { + ($($t:ty),+ $(,)?) => {$( unsafe impl IsZero for Option<$t> { #[inline] fn is_zero(&self) -> bool { @@ -163,7 +149,7 @@ macro_rules! impl_is_zero_option_of_num { )+}; } -impl_is_zero_option_of_num!(u8, u16, u32, u64, u128, i8, i16, i32, i64, i128, usize, isize,); +impl_is_zero_option_of_int!(u8, u16, u32, u64, u128, i8, i16, i32, i64, i128, usize, isize); unsafe impl IsZero for Wrapping { #[inline] @@ -179,8 +165,8 @@ unsafe impl IsZero for Saturating { } } -macro_rules! impl_for_optional_bool { - ($($t:ty,)+) => {$( +macro_rules! impl_is_zero_option_of_bool { + ($($t:ty),+ $(,)?) => {$( unsafe impl IsZero for $t { #[inline] fn is_zero(&self) -> bool { @@ -194,9 +180,10 @@ macro_rules! impl_for_optional_bool { } )+}; } -impl_for_optional_bool! { + +impl_is_zero_option_of_bool! { Option, Option>, Option>>, - // Could go further, but not worth the metadata overhead + // Could go further, but not worth the metadata overhead. } diff --git a/library/alloc/src/vec/mod.rs b/library/alloc/src/vec/mod.rs index 08e3cdedc666..b59699219eb8 100644 --- a/library/alloc/src/vec/mod.rs +++ b/library/alloc/src/vec/mod.rs @@ -1554,6 +1554,7 @@ impl Vec { /// ``` #[stable(feature = "rust1", since = "1.0.0")] #[track_caller] + #[rustc_confusables("delete", "take")] pub fn remove(&mut self, index: usize) -> T { #[cold] #[cfg_attr(not(feature = "panic_immediate_abort"), inline(never))] @@ -1915,6 +1916,7 @@ impl Vec { #[cfg(not(no_global_oom_handling))] #[inline] #[stable(feature = "rust1", since = "1.0.0")] + #[rustc_confusables("push_back", "put", "append")] pub fn push(&mut self, value: T) { // This will panic or abort if we would allocate > isize::MAX bytes // or if the length increment would overflow for zero-sized types. @@ -2141,6 +2143,7 @@ impl Vec { /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] + #[rustc_confusables("length", "size")] pub fn len(&self) -> usize { self.len } diff --git a/library/core/src/array/mod.rs b/library/core/src/array/mod.rs index 743f07644e35..42663ff2b53f 100644 --- a/library/core/src/array/mod.rs +++ b/library/core/src/array/mod.rs @@ -511,7 +511,7 @@ impl [T; N] { /// # Examples /// /// ``` - /// #![feature(array_try_map)] + /// #![feature(array_try_map, generic_nonzero)] /// let a = ["1", "2", "3"]; /// let b = a.try_map(|v| v.parse::()).unwrap().map(|v| v + 1); /// assert_eq!(b, [2, 3, 4]); @@ -520,12 +520,12 @@ impl [T; N] { /// let b = a.try_map(|v| v.parse::()); /// assert!(b.is_err()); /// - /// use std::num::NonZeroU32; + /// use std::num::NonZero; /// let z = [1, 2, 0, 3, 4]; - /// assert_eq!(z.try_map(NonZeroU32::new), None); + /// assert_eq!(z.try_map(NonZero::new), None); /// let a = [1, 2, 3]; - /// let b = a.try_map(NonZeroU32::new); - /// let c = b.map(|x| x.map(NonZeroU32::get)); + /// let b = a.try_map(NonZero::new); + /// let c = b.map(|x| x.map(NonZero::get)); /// assert_eq!(c, Some(a)); /// ``` #[unstable(feature = "array_try_map", issue = "79711")] diff --git a/library/core/src/cell.rs b/library/core/src/cell.rs index c77fa371cc74..19b05448c878 100644 --- a/library/core/src/cell.rs +++ b/library/core/src/cell.rs @@ -471,6 +471,7 @@ impl Cell { /// ``` #[inline] #[stable(feature = "move_cell", since = "1.17.0")] + #[rustc_confusables("swap")] pub fn replace(&self, val: T) -> T { // SAFETY: This can cause data races if called from a separate thread, // but `Cell` is `!Sync` so this won't happen. @@ -862,6 +863,7 @@ impl RefCell { #[inline] #[stable(feature = "refcell_replace", since = "1.24.0")] #[track_caller] + #[rustc_confusables("swap")] pub fn replace(&self, t: T) -> T { mem::replace(&mut *self.borrow_mut(), t) } diff --git a/library/core/src/cmp/bytewise.rs b/library/core/src/cmp/bytewise.rs index b19eef8e2558..a06a5227fe28 100644 --- a/library/core/src/cmp/bytewise.rs +++ b/library/core/src/cmp/bytewise.rs @@ -1,5 +1,4 @@ -use crate::num::{NonZeroI128, NonZeroI16, NonZeroI32, NonZeroI64, NonZeroI8, NonZeroIsize}; -use crate::num::{NonZeroU128, NonZeroU16, NonZeroU32, NonZeroU64, NonZeroU8, NonZeroUsize}; +use crate::num::NonZero; /// Types where `==` & `!=` are equivalent to comparing their underlying bytes. /// @@ -36,18 +35,18 @@ is_bytewise_comparable!(bool, char, super::Ordering); // SAFETY: Similarly, the `NonZero` type has a niche, but no undef and no pointers, // and they compare like their underlying numeric type. is_bytewise_comparable!( - NonZeroU8, - NonZeroU16, - NonZeroU32, - NonZeroU64, - NonZeroU128, - NonZeroUsize, - NonZeroI8, - NonZeroI16, - NonZeroI32, - NonZeroI64, - NonZeroI128, - NonZeroIsize, + NonZero, + NonZero, + NonZero, + NonZero, + NonZero, + NonZero, + NonZero, + NonZero, + NonZero, + NonZero, + NonZero, + NonZero, ); // SAFETY: The `NonZero` type has the "null" optimization guaranteed, and thus @@ -55,18 +54,18 @@ is_bytewise_comparable!( // The way `PartialOrd` is defined for `Option` means that this wouldn't work // for `<` or `>` on the signed types, but since we only do `==` it's fine. is_bytewise_comparable!( - Option, - Option, - Option, - Option, - Option, - Option, - Option, - Option, - Option, - Option, - Option, - Option, + Option>, + Option>, + Option>, + Option>, + Option>, + Option>, + Option>, + Option>, + Option>, + Option>, + Option>, + Option>, ); macro_rules! is_bytewise_comparable_array_length { diff --git a/library/core/src/ffi/c_str.rs b/library/core/src/ffi/c_str.rs index 248943cf0226..20186a2de0fd 100644 --- a/library/core/src/ffi/c_str.rs +++ b/library/core/src/ffi/c_str.rs @@ -4,6 +4,7 @@ use crate::ffi::c_char; use crate::fmt; use crate::intrinsics; use crate::ops; +use crate::ptr::addr_of; use crate::slice; use crate::slice::memchr; use crate::str; @@ -603,7 +604,7 @@ impl CStr { pub const fn to_bytes_with_nul(&self) -> &[u8] { // SAFETY: Transmuting a slice of `c_char`s to a slice of `u8`s // is safe on all supported targets. - unsafe { &*(&self.inner as *const [c_char] as *const [u8]) } + unsafe { &*(addr_of!(self.inner) as *const [u8]) } } /// Yields a &[str] slice if the `CStr` contains valid UTF-8. diff --git a/library/core/src/intrinsics.rs b/library/core/src/intrinsics.rs index bec0948c5ed3..f9d89795a998 100644 --- a/library/core/src/intrinsics.rs +++ b/library/core/src/intrinsics.rs @@ -953,6 +953,7 @@ extern "rust-intrinsic" { #[rustc_nounwind] #[unstable(feature = "core_intrinsics", issue = "none")] #[cfg_attr(not(bootstrap), rustc_intrinsic)] +#[cfg_attr(bootstrap, inline)] pub const unsafe fn assume(b: bool) { if !b { // SAFETY: the caller must guarantee the argument is never `false` @@ -975,6 +976,7 @@ pub const unsafe fn assume(b: bool) { #[unstable(feature = "core_intrinsics", issue = "none")] #[cfg_attr(not(bootstrap), rustc_intrinsic)] #[rustc_nounwind] +#[cfg_attr(bootstrap, inline)] pub const fn likely(b: bool) -> bool { b } @@ -994,6 +996,7 @@ pub const fn likely(b: bool) -> bool { #[unstable(feature = "core_intrinsics", issue = "none")] #[cfg_attr(not(bootstrap), rustc_intrinsic)] #[rustc_nounwind] +#[cfg_attr(bootstrap, inline)] pub const fn unlikely(b: bool) -> bool { b } @@ -2596,6 +2599,7 @@ extern "rust-intrinsic" { #[rustc_nounwind] #[unstable(feature = "core_intrinsics", issue = "none")] #[cfg_attr(not(bootstrap), rustc_intrinsic)] +#[cfg_attr(bootstrap, inline)] pub const fn is_val_statically_known(_arg: T) -> bool { false } @@ -2633,6 +2637,7 @@ pub(crate) const fn debug_assertions() -> bool { #[unstable(feature = "core_intrinsics", issue = "none")] #[rustc_nounwind] #[cfg_attr(not(bootstrap), rustc_intrinsic)] +#[cfg_attr(bootstrap, inline)] pub const unsafe fn const_allocate(_size: usize, _align: usize) -> *mut u8 { // const eval overrides this function, but runtime code should always just return null pointers. crate::ptr::null_mut() @@ -2652,6 +2657,7 @@ pub const unsafe fn const_allocate(_size: usize, _align: usize) -> *mut u8 { #[unstable(feature = "core_intrinsics", issue = "none")] #[rustc_nounwind] #[cfg_attr(not(bootstrap), rustc_intrinsic)] +#[cfg_attr(bootstrap, inline)] pub const unsafe fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize) {} // Some functions are defined here because they accidentally got made @@ -2700,13 +2706,25 @@ pub const unsafe fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize) macro_rules! assert_unsafe_precondition { ($message:expr, ($($name:ident:$ty:ty = $arg:expr),*$(,)?) => $e:expr $(,)?) => { { + // #[cfg(bootstrap)] (this comment) // When the standard library is compiled with debug assertions, we want the check to inline for better performance. // This is important when working on the compiler, which is compiled with debug assertions locally. // When not compiled with debug assertions (so the precompiled std) we outline the check to minimize the compile // time impact when debug assertions are disabled. - // It is not clear whether that is the best solution, see #120848. - #[cfg_attr(debug_assertions, inline(always))] - #[cfg_attr(not(debug_assertions), inline(never))] + // The proper solution to this is the `#[rustc_no_mir_inline]` below, but we still want decent performance for cfg(bootstrap). + #[cfg_attr(all(debug_assertions, bootstrap), inline(always))] + #[cfg_attr(all(not(debug_assertions), bootstrap), inline(never))] + + // This check is inlineable, but not by the MIR inliner. + // The reason for this is that the MIR inliner is in an exceptionally bad position + // to think about whether or not to inline this. In MIR, this call is gated behind `debug_assertions`, + // which will codegen to `false` in release builds. Inlining the check would be wasted work in that case and + // would be bad for compile times. + // + // LLVM on the other hand sees the constant branch, so if it's `false`, it can immediately delete it without + // inlining the check. If it's `true`, it can inline it and get significantly better performance. + #[cfg_attr(not(bootstrap), rustc_no_mir_inline)] + #[cfg_attr(not(bootstrap), inline)] #[rustc_nounwind] fn precondition_check($($name:$ty),*) { if !$e { diff --git a/library/core/src/intrinsics/simd.rs b/library/core/src/intrinsics/simd.rs index 588891ffa4d5..d8a1ad778d75 100644 --- a/library/core/src/intrinsics/simd.rs +++ b/library/core/src/intrinsics/simd.rs @@ -3,6 +3,24 @@ //! In this module, a "vector" is any `repr(simd)` type. extern "platform-intrinsic" { + /// Insert an element into a vector, returning the updated vector. + /// + /// `T` must be a vector with element type `U`. + /// + /// # Safety + /// + /// `idx` must be in-bounds of the vector. + pub fn simd_insert(x: T, idx: u32, val: U) -> T; + + /// Extract an element from a vector. + /// + /// `T` must be a vector with element type `U`. + /// + /// # Safety + /// + /// `idx` must be in-bounds of the vector. + pub fn simd_extract(x: T, idx: u32) -> U; + /// Add two simd vectors elementwise. /// /// `T` must be a vector of integer or floating point primitive types. @@ -317,6 +335,14 @@ extern "platform-intrinsic" { /// Starting with the value `y`, add the elements of `x` and accumulate. pub fn simd_reduce_add_ordered(x: T, y: U) -> U; + /// Add elements within a vector in arbitrary order. May also be re-associated with + /// unordered additions on the inputs/outputs. + /// + /// `T` must be a vector of integer or floating-point primitive types. + /// + /// `U` must be the element type of `T`. + pub fn simd_reduce_add_unordered(x: T) -> U; + /// Multiply elements within a vector from left to right. /// /// `T` must be a vector of integer or floating-point primitive types. @@ -326,6 +352,14 @@ extern "platform-intrinsic" { /// Starting with the value `y`, multiply the elements of `x` and accumulate. pub fn simd_reduce_mul_ordered(x: T, y: U) -> U; + /// Add elements within a vector in arbitrary order. May also be re-associated with + /// unordered additions on the inputs/outputs. + /// + /// `T` must be a vector of integer or floating-point primitive types. + /// + /// `U` must be the element type of `T`. + pub fn simd_reduce_mul_unordered(x: T) -> U; + /// Check if all mask values are true. /// /// `T` must be a vector of integer primitive types. @@ -518,4 +552,39 @@ extern "platform-intrinsic" { /// /// `T` must be a vector of floats. pub fn simd_fma(x: T, y: T, z: T) -> T; + + // Computes the sine of each element. + /// + /// `T` must be a vector of floats. + pub fn simd_fsin(a: T) -> T; + + // Computes the cosine of each element. + /// + /// `T` must be a vector of floats. + pub fn simd_fcos(a: T) -> T; + + // Computes the exponential function of each element. + /// + /// `T` must be a vector of floats. + pub fn simd_fexp(a: T) -> T; + + // Computes 2 raised to the power of each element. + /// + /// `T` must be a vector of floats. + pub fn simd_fexp2(a: T) -> T; + + // Computes the base 10 logarithm of each element. + /// + /// `T` must be a vector of floats. + pub fn simd_flog10(a: T) -> T; + + // Computes the base 2 logarithm of each element. + /// + /// `T` must be a vector of floats. + pub fn simd_flog2(a: T) -> T; + + // Computes the natural logarithm of each element. + /// + /// `T` must be a vector of floats. + pub fn simd_flog(a: T) -> T; } diff --git a/library/core/src/iter/adapters/filter_map.rs b/library/core/src/iter/adapters/filter_map.rs index 64bd5b3e2b66..1a5f9e626545 100644 --- a/library/core/src/iter/adapters/filter_map.rs +++ b/library/core/src/iter/adapters/filter_map.rs @@ -2,6 +2,7 @@ use crate::iter::{adapters::SourceIter, FusedIterator, InPlaceIterable, TrustedF use crate::mem::{ManuallyDrop, MaybeUninit}; use crate::num::NonZero; use crate::ops::{ControlFlow, Try}; +use crate::ptr::addr_of; use crate::{array, fmt}; /// An iterator that uses `f` to both filter and map elements from `iter`. @@ -98,9 +99,8 @@ where // SAFETY: Loop conditions ensure the index is in bounds. unsafe { - let opt_payload_at: *const MaybeUninit = (&val as *const Option) - .byte_add(core::mem::offset_of!(Option, Some.0)) - .cast(); + let opt_payload_at: *const MaybeUninit = + addr_of!(val).byte_add(core::mem::offset_of!(Option, Some.0)).cast(); let dst = guard.array.as_mut_ptr().add(idx); crate::ptr::copy_nonoverlapping(opt_payload_at, dst, 1); crate::mem::forget(val); diff --git a/library/core/src/iter/traits/double_ended.rs b/library/core/src/iter/traits/double_ended.rs index 48aae73d928a..35092ec51cdd 100644 --- a/library/core/src/iter/traits/double_ended.rs +++ b/library/core/src/iter/traits/double_ended.rs @@ -100,7 +100,7 @@ pub trait DoubleEndedIterator: Iterator { /// to `n` times until [`None`] is encountered. /// /// `advance_back_by(n)` will return `Ok(())` if the iterator successfully advances by - /// `n` elements, or a `Err(NonZeroUsize)` with value `k` if [`None`] is encountered, where `k` + /// `n` elements, or a `Err(NonZero)` with value `k` if [`None`] is encountered, where `k` /// is remaining number of steps that could not be advanced because the iterator ran out. /// If `self` is empty and `n` is non-zero, then this returns `Err(n)`. /// Otherwise, `k` is always less than `n`. @@ -118,8 +118,8 @@ pub trait DoubleEndedIterator: Iterator { /// Basic usage: /// /// ``` - /// #![feature(iter_advance_by)] - /// use std::num::NonZeroUsize; + /// #![feature(generic_nonzero, iter_advance_by)] + /// use std::num::NonZero; /// /// let a = [3, 4, 5, 6]; /// let mut iter = a.iter(); @@ -127,7 +127,7 @@ pub trait DoubleEndedIterator: Iterator { /// assert_eq!(iter.advance_back_by(2), Ok(())); /// assert_eq!(iter.next_back(), Some(&4)); /// assert_eq!(iter.advance_back_by(0), Ok(())); - /// assert_eq!(iter.advance_back_by(100), Err(NonZeroUsize::new(99).unwrap())); // only `&3` was skipped + /// assert_eq!(iter.advance_back_by(100), Err(NonZero::new(99).unwrap())); // only `&3` was skipped /// ``` /// /// [`Ok(())`]: Ok diff --git a/library/core/src/iter/traits/iterator.rs b/library/core/src/iter/traits/iterator.rs index 522e75a5683b..3267cea38b74 100644 --- a/library/core/src/iter/traits/iterator.rs +++ b/library/core/src/iter/traits/iterator.rs @@ -304,7 +304,7 @@ pub trait Iterator { /// times until [`None`] is encountered. /// /// `advance_by(n)` will return `Ok(())` if the iterator successfully advances by - /// `n` elements, or a `Err(NonZeroUsize)` with value `k` if [`None`] is encountered, + /// `n` elements, or a `Err(NonZero)` with value `k` if [`None`] is encountered, /// where `k` is remaining number of steps that could not be advanced because the iterator ran out. /// If `self` is empty and `n` is non-zero, then this returns `Err(n)`. /// Otherwise, `k` is always less than `n`. @@ -319,8 +319,8 @@ pub trait Iterator { /// # Examples /// /// ``` - /// #![feature(iter_advance_by)] - /// use std::num::NonZeroUsize; + /// #![feature(generic_nonzero, iter_advance_by)] + /// use std::num::NonZero; /// /// let a = [1, 2, 3, 4]; /// let mut iter = a.iter(); @@ -328,7 +328,7 @@ pub trait Iterator { /// assert_eq!(iter.advance_by(2), Ok(())); /// assert_eq!(iter.next(), Some(&3)); /// assert_eq!(iter.advance_by(0), Ok(())); - /// assert_eq!(iter.advance_by(100), Err(NonZeroUsize::new(99).unwrap())); // only `&4` was skipped + /// assert_eq!(iter.advance_by(100), Err(NonZero::new(99).unwrap())); // only `&4` was skipped /// ``` #[inline] #[unstable(feature = "iter_advance_by", reason = "recently added", issue = "77404")] @@ -2967,17 +2967,18 @@ pub trait Iterator { /// assert!(result.is_err()); /// ``` /// - /// This also supports other types which implement `Try`, not just `Result`. - /// ``` - /// #![feature(try_find)] + /// This also supports other types which implement [`Try`], not just [`Result`]. /// - /// use std::num::NonZeroU32; - /// let a = [3, 5, 7, 4, 9, 0, 11]; - /// let result = a.iter().try_find(|&&x| NonZeroU32::new(x).map(|y| y.is_power_of_two())); + /// ``` + /// #![feature(generic_nonzero, try_find)] + /// use std::num::NonZero; + /// + /// let a = [3, 5, 7, 4, 9, 0, 11u32]; + /// let result = a.iter().try_find(|&&x| NonZero::new(x).map(|y| y.is_power_of_two())); /// assert_eq!(result, Some(Some(&4))); - /// let result = a.iter().take(3).try_find(|&&x| NonZeroU32::new(x).map(|y| y.is_power_of_two())); + /// let result = a.iter().take(3).try_find(|&&x| NonZero::new(x).map(|y| y.is_power_of_two())); /// assert_eq!(result, Some(None)); - /// let result = a.iter().rev().try_find(|&&x| NonZeroU32::new(x).map(|y| y.is_power_of_two())); + /// let result = a.iter().rev().try_find(|&&x| NonZero::new(x).map(|y| y.is_power_of_two())); /// assert_eq!(result, None); /// ``` #[inline] diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index 456d88122af6..49cead680e33 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -106,6 +106,7 @@ #![allow(incomplete_features)] #![warn(multiple_supertrait_upcastable)] #![allow(internal_features)] +#![deny(ffi_unwind_calls)] // Do not check link redundancy on bootstraping phase #![allow(rustdoc::redundant_explicit_links)] // diff --git a/library/core/src/num/nonzero.rs b/library/core/src/num/nonzero.rs index 8943e2f0e2ab..295b88361cfb 100644 --- a/library/core/src/num/nonzero.rs +++ b/library/core/src/num/nonzero.rs @@ -23,7 +23,7 @@ mod private { /// A marker trait for primitive types which can be zero. /// -/// This is an implementation detail for [`NonZero`](NonZero) which may disappear or be replaced at any time. +/// This is an implementation detail for [NonZero]\ which may disappear or be replaced at any time. #[unstable( feature = "nonzero_internals", reason = "implementation detail which may disappear or be replaced at any time", @@ -507,18 +507,16 @@ macro_rules! nonzero_integer { /// Basic usage: /// /// ``` - /// #![feature(non_zero_count_ones)] + /// #![feature(generic_nonzero, non_zero_count_ones)] /// # fn main() { test().unwrap(); } /// # fn test() -> Option<()> { /// # use std::num::*; /// # - /// let one = NonZeroU32::new(1)?; - /// let three = NonZeroU32::new(3)?; - #[doc = concat!("let a = ", stringify!($Ty), "::new(0b100_0000)?;")] - #[doc = concat!("let b = ", stringify!($Ty), "::new(0b100_0011)?;")] + #[doc = concat!("let a = NonZero::<", stringify!($Int), ">::new(0b100_0000)?;")] + #[doc = concat!("let b = NonZero::<", stringify!($Int), ">::new(0b100_0011)?;")] /// - /// assert_eq!(a.count_ones(), one); - /// assert_eq!(b.count_ones(), three); + /// assert_eq!(a.count_ones(), NonZero::new(1)?); + /// assert_eq!(b.count_ones(), NonZero::new(3)?); /// # Some(()) /// # } /// ``` @@ -530,7 +528,7 @@ macro_rules! nonzero_integer { #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline(always)] - pub const fn count_ones(self) -> NonZeroU32 { + pub const fn count_ones(self) -> NonZero { // SAFETY: // `self` is non-zero, which means it has at least one bit set, which means // that the result of `count_ones` is non-zero. diff --git a/library/core/src/option.rs b/library/core/src/option.rs index 0e5eb03239ce..5027e326a9d7 100644 --- a/library/core/src/option.rs +++ b/library/core/src/option.rs @@ -558,6 +558,7 @@ use crate::panicking::{panic, panic_str}; use crate::pin::Pin; use crate::{ cmp, convert, hint, mem, + num::NonZero, ops::{self, ControlFlow, Deref, DerefMut}, slice, }; @@ -1403,6 +1404,7 @@ impl Option { #[doc(alias = "flatmap")] #[inline] #[stable(feature = "rust1", since = "1.0.0")] + #[rustc_confusables("flat_map", "flatmap")] pub fn and_then(self, f: F) -> Option where F: FnOnce(T) -> Option, @@ -2193,18 +2195,18 @@ macro_rules! non_zero_option { } non_zero_option! { - #[stable(feature = "nonzero", since = "1.28.0")] crate::num::NonZeroU8; - #[stable(feature = "nonzero", since = "1.28.0")] crate::num::NonZeroU16; - #[stable(feature = "nonzero", since = "1.28.0")] crate::num::NonZeroU32; - #[stable(feature = "nonzero", since = "1.28.0")] crate::num::NonZeroU64; - #[stable(feature = "nonzero", since = "1.28.0")] crate::num::NonZeroU128; - #[stable(feature = "nonzero", since = "1.28.0")] crate::num::NonZeroUsize; - #[stable(feature = "signed_nonzero", since = "1.34.0")] crate::num::NonZeroI8; - #[stable(feature = "signed_nonzero", since = "1.34.0")] crate::num::NonZeroI16; - #[stable(feature = "signed_nonzero", since = "1.34.0")] crate::num::NonZeroI32; - #[stable(feature = "signed_nonzero", since = "1.34.0")] crate::num::NonZeroI64; - #[stable(feature = "signed_nonzero", since = "1.34.0")] crate::num::NonZeroI128; - #[stable(feature = "signed_nonzero", since = "1.34.0")] crate::num::NonZeroIsize; + #[stable(feature = "nonzero", since = "1.28.0")] NonZero; + #[stable(feature = "nonzero", since = "1.28.0")] NonZero; + #[stable(feature = "nonzero", since = "1.28.0")] NonZero; + #[stable(feature = "nonzero", since = "1.28.0")] NonZero; + #[stable(feature = "nonzero", since = "1.28.0")] NonZero; + #[stable(feature = "nonzero", since = "1.28.0")] NonZero; + #[stable(feature = "signed_nonzero", since = "1.34.0")] NonZero; + #[stable(feature = "signed_nonzero", since = "1.34.0")] NonZero; + #[stable(feature = "signed_nonzero", since = "1.34.0")] NonZero; + #[stable(feature = "signed_nonzero", since = "1.34.0")] NonZero; + #[stable(feature = "signed_nonzero", since = "1.34.0")] NonZero; + #[stable(feature = "signed_nonzero", since = "1.34.0")] NonZero; } #[stable(feature = "nonnull", since = "1.25.0")] diff --git a/library/core/src/primitive_docs.rs b/library/core/src/primitive_docs.rs index eb3f93a6e965..15da4171bda2 100644 --- a/library/core/src/primitive_docs.rs +++ b/library/core/src/primitive_docs.rs @@ -1577,8 +1577,7 @@ mod prim_ref {} /// - Any two types with size 0 and alignment 1 are ABI-compatible. /// - A `repr(transparent)` type `T` is ABI-compatible with its unique non-trivial field, i.e., the /// unique field that doesn't have size 0 and alignment 1 (if there is such a field). -/// - `i32` is ABI-compatible with `NonZeroI32`, and similar for all other integer types with their -/// matching `NonZero*` type. +/// - `i32` is ABI-compatible with `NonZero`, and similar for all other integer types. /// - If `T` is guaranteed to be subject to the [null pointer /// optimization](option/index.html#representation), then `T` and `Option` are ABI-compatible. /// @@ -1613,9 +1612,9 @@ mod prim_ref {} /// type in the function pointer to the type at the function declaration, and the return value is /// [`transmute`d][mem::transmute] from the type in the declaration to the type in the /// pointer. All the usual caveats and concerns around transmutation apply; for instance, if the -/// function expects a `NonZeroI32` and the function pointer uses the ABI-compatible type -/// `Option`, and the value used for the argument is `None`, then this call is Undefined -/// Behavior since transmuting `None::` to `NonZeroI32` violates the non-zero +/// function expects a `NonZero` and the function pointer uses the ABI-compatible type +/// `Option>`, and the value used for the argument is `None`, then this call is Undefined +/// Behavior since transmuting `None::>` to `NonZero` violates the non-zero /// requirement. /// /// #### Requirements concerning target features diff --git a/library/core/src/ptr/alignment.rs b/library/core/src/ptr/alignment.rs index 6dfecb5a826a..bd58c167c2e0 100644 --- a/library/core/src/ptr/alignment.rs +++ b/library/core/src/ptr/alignment.rs @@ -1,5 +1,5 @@ use crate::convert::{TryFrom, TryInto}; -use crate::num::{NonZero, NonZeroUsize}; +use crate::num::NonZero; use crate::{cmp, fmt, hash, mem, num}; /// A type storing a `usize` which is a power of two, and thus @@ -87,7 +87,7 @@ impl Alignment { unsafe { mem::transmute::(align) } } - /// Returns the alignment as a [`usize`] + /// Returns the alignment as a [`usize`]. #[unstable(feature = "ptr_alignment_type", issue = "102070")] #[rustc_const_unstable(feature = "ptr_alignment_type", issue = "102070")] #[inline] @@ -95,11 +95,11 @@ impl Alignment { self.0 as usize } - /// Returns the alignment as a [`NonZeroUsize`] + /// Returns the alignment as a [NonZero]<[usize]>. #[unstable(feature = "ptr_alignment_type", issue = "102070")] #[rustc_const_unstable(feature = "ptr_alignment_type", issue = "102070")] #[inline] - pub const fn as_nonzero(self) -> NonZeroUsize { + pub const fn as_nonzero(self) -> NonZero { // SAFETY: All the discriminants are non-zero. unsafe { NonZero::new_unchecked(self.as_usize()) } } @@ -164,11 +164,11 @@ impl fmt::Debug for Alignment { } #[unstable(feature = "ptr_alignment_type", issue = "102070")] -impl TryFrom for Alignment { +impl TryFrom> for Alignment { type Error = num::TryFromIntError; #[inline] - fn try_from(align: NonZeroUsize) -> Result { + fn try_from(align: NonZero) -> Result { align.get().try_into() } } @@ -184,9 +184,9 @@ impl TryFrom for Alignment { } #[unstable(feature = "ptr_alignment_type", issue = "102070")] -impl From for NonZeroUsize { +impl From for NonZero { #[inline] - fn from(align: Alignment) -> NonZeroUsize { + fn from(align: Alignment) -> NonZero { align.as_nonzero() } } diff --git a/library/core/src/ptr/metadata.rs b/library/core/src/ptr/metadata.rs index c7b0fe5694a7..fe19f66a31ac 100644 --- a/library/core/src/ptr/metadata.rs +++ b/library/core/src/ptr/metadata.rs @@ -163,7 +163,7 @@ impl Clone for PtrComponents { /// It is a pointer to a vtable (virtual call table) /// that represents all the necessary information /// to manipulate the concrete type stored inside a trait object. -/// The vtable notably it contains: +/// The vtable notably contains: /// /// * type size /// * type alignment diff --git a/library/core/src/ptr/mod.rs b/library/core/src/ptr/mod.rs index 90b3341f0ad4..fc5b08c9801a 100644 --- a/library/core/src/ptr/mod.rs +++ b/library/core/src/ptr/mod.rs @@ -1553,7 +1553,7 @@ pub const unsafe fn write_unaligned(dst: *mut T, src: T) { // `dst` cannot overlap `src` because the caller has mutable access // to `dst` while `src` is owned by this function. unsafe { - copy_nonoverlapping(&src as *const T as *const u8, dst as *mut u8, mem::size_of::()); + copy_nonoverlapping(addr_of!(src) as *const u8, dst as *mut u8, mem::size_of::()); // We are calling the intrinsic directly to avoid function calls in the generated code. intrinsics::forget(src); } diff --git a/library/core/src/ptr/non_null.rs b/library/core/src/ptr/non_null.rs index 098ec2338556..acb8c552a633 100644 --- a/library/core/src/ptr/non_null.rs +++ b/library/core/src/ptr/non_null.rs @@ -5,7 +5,7 @@ use crate::intrinsics; use crate::intrinsics::assert_unsafe_precondition; use crate::marker::Unsize; use crate::mem::{MaybeUninit, SizedTypeProperties}; -use crate::num::{NonZero, NonZeroUsize}; +use crate::num::NonZero; use crate::ops::{CoerceUnsized, DispatchFromDyn}; use crate::ptr; use crate::ptr::Unique; @@ -291,7 +291,7 @@ impl NonNull { #[must_use] #[inline] #[unstable(feature = "strict_provenance", issue = "95228")] - pub fn addr(self) -> NonZeroUsize { + pub fn addr(self) -> NonZero { // SAFETY: The pointer is guaranteed by the type to be non-null, // meaning that the address will be non-zero. unsafe { NonZero::new_unchecked(self.pointer.addr()) } @@ -306,7 +306,7 @@ impl NonNull { #[must_use] #[inline] #[unstable(feature = "strict_provenance", issue = "95228")] - pub fn with_addr(self, addr: NonZeroUsize) -> Self { + pub fn with_addr(self, addr: NonZero) -> Self { // SAFETY: The result of `ptr::from::with_addr` is non-null because `addr` is guaranteed to be non-zero. unsafe { NonNull::new_unchecked(self.pointer.with_addr(addr.get()) as *mut _) } } @@ -320,7 +320,7 @@ impl NonNull { #[must_use] #[inline] #[unstable(feature = "strict_provenance", issue = "95228")] - pub fn map_addr(self, f: impl FnOnce(NonZeroUsize) -> NonZeroUsize) -> Self { + pub fn map_addr(self, f: impl FnOnce(NonZero) -> NonZero) -> Self { self.with_addr(f(self.addr())) } diff --git a/library/core/src/result.rs b/library/core/src/result.rs index 80f7fe75e823..6879ac03f70b 100644 --- a/library/core/src/result.rs +++ b/library/core/src/result.rs @@ -1315,6 +1315,7 @@ impl Result { /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] + #[rustc_confusables("flat_map", "flatmap")] pub fn and_then Result>(self, op: F) -> Result { match self { Ok(t) => op(t), diff --git a/library/core/src/slice/mod.rs b/library/core/src/slice/mod.rs index 031666fb012e..1ad81fcfcfee 100644 --- a/library/core/src/slice/mod.rs +++ b/library/core/src/slice/mod.rs @@ -146,6 +146,9 @@ impl [T] { /// ``` /// let a = [1, 2, 3]; /// assert!(!a.is_empty()); + /// + /// let b: &[i32] = &[]; + /// assert!(b.is_empty()); /// ``` #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_stable(feature = "const_slice_is_empty", since = "1.39.0")] @@ -185,6 +188,9 @@ impl [T] { /// *first = 5; /// } /// assert_eq!(x, &[5, 1, 2]); + /// + /// let y: &mut [i32] = &mut []; + /// assert_eq!(None, y.first_mut()); /// ``` #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_slice_first_last", issue = "83570")] @@ -297,7 +303,7 @@ impl [T] { if let [.., last] = self { Some(last) } else { None } } - /// Returns a mutable reference to the last item in the slice. + /// Returns a mutable reference to the last item in the slice, or `None` if it is empty. /// /// # Examples /// @@ -308,6 +314,9 @@ impl [T] { /// *last = 10; /// } /// assert_eq!(x, &[0, 1, 10]); + /// + /// let y: &mut [i32] = &mut []; + /// assert_eq!(None, y.last_mut()); /// ``` #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_slice_first_last", issue = "83570")] diff --git a/library/core/src/str/iter.rs b/library/core/src/str/iter.rs index 00b4405faaef..19627f28e64f 100644 --- a/library/core/src/str/iter.rs +++ b/library/core/src/str/iter.rs @@ -5,10 +5,10 @@ use crate::fmt::{self, Write}; use crate::iter::{Chain, FlatMap, Flatten}; use crate::iter::{Copied, Filter, FusedIterator, Map, TrustedLen}; use crate::iter::{TrustedRandomAccess, TrustedRandomAccessNoCoerce}; +use crate::num::NonZero; use crate::ops::Try; use crate::option; use crate::slice::{self, Split as SliceSplit}; -use core::num::{NonZero, NonZeroUsize}; use super::from_utf8_unchecked; use super::pattern::Pattern; @@ -51,7 +51,7 @@ impl<'a> Iterator for Chars<'a> { } #[inline] - fn advance_by(&mut self, mut remainder: usize) -> Result<(), NonZeroUsize> { + fn advance_by(&mut self, mut remainder: usize) -> Result<(), NonZero> { const CHUNK_SIZE: usize = 32; if remainder >= CHUNK_SIZE { diff --git a/library/panic_unwind/src/seh.rs b/library/panic_unwind/src/seh.rs index c4f4d2fbec91..e63749c77cef 100644 --- a/library/panic_unwind/src/seh.rs +++ b/library/panic_unwind/src/seh.rs @@ -49,7 +49,7 @@ use alloc::boxed::Box; use core::any::Any; use core::mem::{self, ManuallyDrop}; -use core::ptr; +use core::ptr::{addr_of, addr_of_mut}; use libc::{c_int, c_uint, c_void}; // NOTE(nbdd0121): The `canary` field is part of stable ABI. @@ -135,7 +135,7 @@ mod imp { macro_rules! ptr { (0) => (0); ($e:expr) => { - (($e as usize) - (&imp::__ImageBase as *const _ as usize)) as u32 + (($e as usize) - (addr_of!(imp::__ImageBase) as usize)) as u32 } } } @@ -220,7 +220,7 @@ extern "C" { // This is fine since the MSVC runtime uses string comparison on the type name // to match TypeDescriptors rather than pointer equality. static mut TYPE_DESCRIPTOR: _TypeDescriptor = _TypeDescriptor { - pVFTable: unsafe { &TYPE_INFO_VTABLE } as *const _ as *const _, + pVFTable: unsafe { addr_of!(TYPE_INFO_VTABLE) } as *const _, spare: core::ptr::null_mut(), name: TYPE_NAME, }; @@ -261,9 +261,6 @@ cfg_if::cfg_if! { } } -// FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_refs` lint -#[cfg_attr(bootstrap, allow(static_mut_ref))] -#[cfg_attr(not(bootstrap), allow(static_mut_refs))] pub unsafe fn panic(data: Box) -> u32 { use core::intrinsics::atomic_store_seqcst; @@ -274,8 +271,9 @@ pub unsafe fn panic(data: Box) -> u32 { // The ManuallyDrop is needed here since we don't want Exception to be // dropped when unwinding. Instead it will be dropped by exception_cleanup // which is invoked by the C++ runtime. - let mut exception = ManuallyDrop::new(Exception { canary: &TYPE_DESCRIPTOR, data: Some(data) }); - let throw_ptr = &mut exception as *mut _ as *mut _; + let mut exception = + ManuallyDrop::new(Exception { canary: addr_of!(TYPE_DESCRIPTOR), data: Some(data) }); + let throw_ptr = addr_of_mut!(exception) as *mut _; // This... may seems surprising, and justifiably so. On 32-bit MSVC the // pointers between these structure are just that, pointers. On 64-bit MSVC, @@ -298,23 +296,23 @@ pub unsafe fn panic(data: Box) -> u32 { // In any case, we basically need to do something like this until we can // express more operations in statics (and we may never be able to). atomic_store_seqcst( - &mut THROW_INFO.pmfnUnwind as *mut _ as *mut u32, + addr_of_mut!(THROW_INFO.pmfnUnwind) as *mut u32, ptr!(exception_cleanup) as u32, ); atomic_store_seqcst( - &mut THROW_INFO.pCatchableTypeArray as *mut _ as *mut u32, - ptr!(&CATCHABLE_TYPE_ARRAY as *const _) as u32, + addr_of_mut!(THROW_INFO.pCatchableTypeArray) as *mut u32, + ptr!(addr_of!(CATCHABLE_TYPE_ARRAY)) as u32, ); atomic_store_seqcst( - &mut CATCHABLE_TYPE_ARRAY.arrayOfCatchableTypes[0] as *mut _ as *mut u32, - ptr!(&CATCHABLE_TYPE as *const _) as u32, + addr_of_mut!(CATCHABLE_TYPE_ARRAY.arrayOfCatchableTypes[0]) as *mut u32, + ptr!(addr_of!(CATCHABLE_TYPE)) as u32, ); atomic_store_seqcst( - &mut CATCHABLE_TYPE.pType as *mut _ as *mut u32, - ptr!(&TYPE_DESCRIPTOR as *const _) as u32, + addr_of_mut!(CATCHABLE_TYPE.pType) as *mut u32, + ptr!(addr_of!(TYPE_DESCRIPTOR)) as u32, ); atomic_store_seqcst( - &mut CATCHABLE_TYPE.copyFunction as *mut _ as *mut u32, + addr_of_mut!(CATCHABLE_TYPE.copyFunction) as *mut u32, ptr!(exception_copy) as u32, ); @@ -322,12 +320,9 @@ pub unsafe fn panic(data: Box) -> u32 { fn _CxxThrowException(pExceptionObject: *mut c_void, pThrowInfo: *mut u8) -> !; } - _CxxThrowException(throw_ptr, &mut THROW_INFO as *mut _ as *mut _); + _CxxThrowException(throw_ptr, addr_of_mut!(THROW_INFO) as *mut _); } -// FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_refs` lint -#[cfg_attr(bootstrap, allow(static_mut_ref))] -#[cfg_attr(not(bootstrap), allow(static_mut_refs))] pub unsafe fn cleanup(payload: *mut u8) -> Box { // A null payload here means that we got here from the catch (...) of // __rust_try. This happens when a non-Rust foreign exception is caught. @@ -335,8 +330,8 @@ pub unsafe fn cleanup(payload: *mut u8) -> Box { super::__rust_foreign_exception(); } let exception = payload as *mut Exception; - let canary = ptr::addr_of!((*exception).canary).read(); - if !ptr::eq(canary, &TYPE_DESCRIPTOR) { + let canary = addr_of!((*exception).canary).read(); + if !core::ptr::eq(canary, addr_of!(TYPE_DESCRIPTOR)) { // A foreign Rust exception. super::__rust_foreign_exception(); } diff --git a/library/proc_macro/src/bridge/scoped_cell.rs b/library/proc_macro/src/bridge/scoped_cell.rs index 53eae1ebdb0f..a8b341439084 100644 --- a/library/proc_macro/src/bridge/scoped_cell.rs +++ b/library/proc_macro/src/bridge/scoped_cell.rs @@ -25,6 +25,7 @@ impl ScopedCell { /// running `f`, which gets the old value, mutably. /// The old value will be restored after `f` exits, even /// by panic, including modifications made to it by `f`. + #[rustc_confusables("swap")] pub fn replace<'a, R>( &self, replacement: >::Out, diff --git a/library/proc_macro/src/bridge/symbol.rs b/library/proc_macro/src/bridge/symbol.rs index 712f6b454582..02225d20b26e 100644 --- a/library/proc_macro/src/bridge/symbol.rs +++ b/library/proc_macro/src/bridge/symbol.rs @@ -136,7 +136,7 @@ thread_local! { arena: arena::Arena::new(), names: fxhash::FxHashMap::default(), strings: Vec::new(), - // Start with a base of 1 to make sure that `NonZeroU32` works. + // Start with a base of 1 to make sure that `NonZero` works. sym_base: NonZero::new(1).unwrap(), }); } diff --git a/library/proc_macro/src/lib.rs b/library/proc_macro/src/lib.rs index d05458a6944a..610966625b53 100644 --- a/library/proc_macro/src/lib.rs +++ b/library/proc_macro/src/lib.rs @@ -36,6 +36,7 @@ #![feature(strict_provenance)] #![recursion_limit = "256"] #![allow(internal_features)] +#![deny(ffi_unwind_calls)] #[unstable(feature = "proc_macro_internals", issue = "27812")] #[doc(hidden)] diff --git a/library/std/src/collections/hash/map.rs b/library/std/src/collections/hash/map.rs index 0d4c1fa05cc8..627befb63a1b 100644 --- a/library/std/src/collections/hash/map.rs +++ b/library/std/src/collections/hash/map.rs @@ -1101,6 +1101,7 @@ where /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] + #[rustc_confusables("push", "append")] pub fn insert(&mut self, k: K, v: V) -> Option { self.base.insert(k, v) } @@ -1155,6 +1156,7 @@ where /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] + #[rustc_confusables("delete", "take")] pub fn remove(&mut self, k: &Q) -> Option where K: Borrow, diff --git a/library/std/src/collections/hash/set.rs b/library/std/src/collections/hash/set.rs index dcb2fa0f771b..371201ff44cb 100644 --- a/library/std/src/collections/hash/set.rs +++ b/library/std/src/collections/hash/set.rs @@ -885,6 +885,7 @@ where /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] + #[rustc_confusables("push", "append")] pub fn insert(&mut self, value: T) -> bool { self.base.insert(value) } @@ -906,6 +907,7 @@ where /// ``` #[inline] #[stable(feature = "set_recovery", since = "1.9.0")] + #[rustc_confusables("swap")] pub fn replace(&mut self, value: T) -> Option { self.base.replace(value) } @@ -930,6 +932,7 @@ where /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] + #[rustc_confusables("delete", "take")] pub fn remove(&mut self, value: &Q) -> bool where T: Borrow, diff --git a/library/std/src/ffi/os_str.rs b/library/std/src/ffi/os_str.rs index 28747ad8f340..bbcbbc528433 100644 --- a/library/std/src/ffi/os_str.rs +++ b/library/std/src/ffi/os_str.rs @@ -255,6 +255,7 @@ impl OsString { /// ``` #[stable(feature = "rust1", since = "1.0.0")] #[inline] + #[rustc_confusables("append", "put")] pub fn push>(&mut self, s: T) { self.inner.push_slice(&s.as_ref().inner) } diff --git a/library/std/src/io/error/repr_bitpacked.rs b/library/std/src/io/error/repr_bitpacked.rs index c053e047b1a6..6f8d5e377756 100644 --- a/library/std/src/io/error/repr_bitpacked.rs +++ b/library/std/src/io/error/repr_bitpacked.rs @@ -73,7 +73,7 @@ //! union Repr { //! // holds integer (Simple/Os) variants, and //! // provides access to the tag bits. -//! bits: NonZeroU64, +//! bits: NonZero, //! // Tag is 0, so this is stored untagged. //! msg: &'static SimpleMessage, //! // Tagged (offset) `Box` pointer. @@ -93,7 +93,7 @@ //! `io::Result<()>` and `io::Result` larger, which defeats part of //! the motivation of this bitpacking. //! -//! Storing everything in a `NonZeroUsize` (or some other integer) would be a +//! Storing everything in a `NonZero` (or some other integer) would be a //! bit more traditional for pointer tagging, but it would lose provenance //! information, couldn't be constructed from a `const fn`, and would probably //! run into other issues as well. diff --git a/library/std/src/os/unix/net/addr.rs b/library/std/src/os/unix/net/addr.rs index 6c99e8c36203..9757653e02c0 100644 --- a/library/std/src/os/unix/net/addr.rs +++ b/library/std/src/os/unix/net/addr.rs @@ -21,7 +21,7 @@ mod libc { fn sun_path_offset(addr: &libc::sockaddr_un) -> usize { // Work with an actual instance of the type since using a null pointer is UB let base = (addr as *const libc::sockaddr_un).addr(); - let path = (&addr.sun_path as *const libc::c_char).addr(); + let path = core::ptr::addr_of!(addr.sun_path).addr(); path - base } @@ -98,7 +98,7 @@ impl SocketAddr { unsafe { let mut addr: libc::sockaddr_un = mem::zeroed(); let mut len = mem::size_of::() as libc::socklen_t; - cvt(f(&mut addr as *mut _ as *mut _, &mut len))?; + cvt(f(core::ptr::addr_of_mut!(addr) as *mut _, &mut len))?; SocketAddr::from_parts(addr, len) } } diff --git a/library/std/src/os/unix/net/ancillary.rs b/library/std/src/os/unix/net/ancillary.rs index 218536689fdb..1d279d6adbc2 100644 --- a/library/std/src/os/unix/net/ancillary.rs +++ b/library/std/src/os/unix/net/ancillary.rs @@ -37,7 +37,7 @@ pub(super) fn recv_vectored_with_ancillary_from( unsafe { let mut msg_name: libc::sockaddr_un = zeroed(); let mut msg: libc::msghdr = zeroed(); - msg.msg_name = &mut msg_name as *mut _ as *mut _; + msg.msg_name = core::ptr::addr_of_mut!(msg_name) as *mut _; msg.msg_namelen = size_of::() as libc::socklen_t; msg.msg_iov = bufs.as_mut_ptr().cast(); msg.msg_iovlen = bufs.len() as _; @@ -70,7 +70,7 @@ pub(super) fn send_vectored_with_ancillary_to( if let Some(path) = path { sockaddr_un(path)? } else { (zeroed(), 0) }; let mut msg: libc::msghdr = zeroed(); - msg.msg_name = &mut msg_name as *mut _ as *mut _; + msg.msg_name = core::ptr::addr_of_mut!(msg_name) as *mut _; msg.msg_namelen = msg_namelen; msg.msg_iov = bufs.as_ptr() as *mut _; msg.msg_iovlen = bufs.len() as _; diff --git a/library/std/src/os/unix/net/datagram.rs b/library/std/src/os/unix/net/datagram.rs index 3b7b610fdf96..0b4d955294ca 100644 --- a/library/std/src/os/unix/net/datagram.rs +++ b/library/std/src/os/unix/net/datagram.rs @@ -91,7 +91,7 @@ impl UnixDatagram { let socket = UnixDatagram::unbound()?; let (addr, len) = sockaddr_un(path.as_ref())?; - cvt(libc::bind(socket.as_raw_fd(), &addr as *const _ as *const _, len as _))?; + cvt(libc::bind(socket.as_raw_fd(), core::ptr::addr_of!(addr) as *const _, len as _))?; Ok(socket) } @@ -124,7 +124,7 @@ impl UnixDatagram { let socket = UnixDatagram::unbound()?; cvt(libc::bind( socket.as_raw_fd(), - &socket_addr.addr as *const _ as *const _, + core::ptr::addr_of!(socket_addr.addr) as *const _, socket_addr.len as _, ))?; Ok(socket) @@ -206,7 +206,7 @@ impl UnixDatagram { unsafe { let (addr, len) = sockaddr_un(path.as_ref())?; - cvt(libc::connect(self.as_raw_fd(), &addr as *const _ as *const _, len))?; + cvt(libc::connect(self.as_raw_fd(), core::ptr::addr_of!(addr) as *const _, len))?; } Ok(()) } @@ -238,7 +238,7 @@ impl UnixDatagram { unsafe { cvt(libc::connect( self.as_raw_fd(), - &socket_addr.addr as *const _ as *const _, + core::ptr::addr_of!(socket_addr.addr) as *const _, socket_addr.len, ))?; } @@ -505,7 +505,7 @@ impl UnixDatagram { buf.as_ptr() as *const _, buf.len(), MSG_NOSIGNAL, - &addr as *const _ as *const _, + core::ptr::addr_of!(addr) as *const _, len, ))?; Ok(count as usize) @@ -540,7 +540,7 @@ impl UnixDatagram { buf.as_ptr() as *const _, buf.len(), MSG_NOSIGNAL, - &socket_addr.addr as *const _ as *const _, + core::ptr::addr_of!(socket_addr.addr) as *const _, socket_addr.len, ))?; Ok(count as usize) diff --git a/library/std/src/os/unix/net/listener.rs b/library/std/src/os/unix/net/listener.rs index d64a43bc20ba..31286a906ea9 100644 --- a/library/std/src/os/unix/net/listener.rs +++ b/library/std/src/os/unix/net/listener.rs @@ -99,7 +99,11 @@ impl UnixListener { )))] const backlog: libc::c_int = libc::SOMAXCONN; - cvt(libc::bind(inner.as_inner().as_raw_fd(), &addr as *const _ as *const _, len as _))?; + cvt(libc::bind( + inner.as_inner().as_raw_fd(), + core::ptr::addr_of!(addr) as *const _, + len as _, + ))?; cvt(libc::listen(inner.as_inner().as_raw_fd(), backlog))?; Ok(UnixListener(inner)) @@ -139,7 +143,7 @@ impl UnixListener { const backlog: libc::c_int = 128; cvt(libc::bind( inner.as_raw_fd(), - &socket_addr.addr as *const _ as *const _, + core::ptr::addr_of!(socket_addr.addr) as *const _, socket_addr.len as _, ))?; cvt(libc::listen(inner.as_raw_fd(), backlog))?; @@ -174,7 +178,7 @@ impl UnixListener { pub fn accept(&self) -> io::Result<(UnixStream, SocketAddr)> { let mut storage: libc::sockaddr_un = unsafe { mem::zeroed() }; let mut len = mem::size_of_val(&storage) as libc::socklen_t; - let sock = self.0.accept(&mut storage as *mut _ as *mut _, &mut len)?; + let sock = self.0.accept(core::ptr::addr_of_mut!(storage) as *mut _, &mut len)?; let addr = SocketAddr::from_parts(storage, len)?; Ok((UnixStream(sock), addr)) } diff --git a/library/std/src/os/unix/net/stream.rs b/library/std/src/os/unix/net/stream.rs index e117f616cafd..b1cd504e2193 100644 --- a/library/std/src/os/unix/net/stream.rs +++ b/library/std/src/os/unix/net/stream.rs @@ -96,7 +96,7 @@ impl UnixStream { let inner = Socket::new_raw(libc::AF_UNIX, libc::SOCK_STREAM)?; let (addr, len) = sockaddr_un(path.as_ref())?; - cvt(libc::connect(inner.as_raw_fd(), &addr as *const _ as *const _, len))?; + cvt(libc::connect(inner.as_raw_fd(), core::ptr::addr_of!(addr) as *const _, len))?; Ok(UnixStream(inner)) } } @@ -130,7 +130,7 @@ impl UnixStream { let inner = Socket::new_raw(libc::AF_UNIX, libc::SOCK_STREAM)?; cvt(libc::connect( inner.as_raw_fd(), - &socket_addr.addr as *const _ as *const _, + core::ptr::addr_of!(socket_addr.addr) as *const _, socket_addr.len, ))?; Ok(UnixStream(inner)) diff --git a/library/std/src/os/unix/ucred.rs b/library/std/src/os/unix/ucred.rs index 6a0cc2d2c48f..6efa74182cc0 100644 --- a/library/std/src/os/unix/ucred.rs +++ b/library/std/src/os/unix/ucred.rs @@ -62,7 +62,7 @@ pub mod impl_linux { socket.as_raw_fd(), SOL_SOCKET, SO_PEERCRED, - &mut ucred as *mut ucred as *mut c_void, + core::ptr::addr_of_mut!(ucred) as *mut c_void, &mut ucred_size, ); @@ -122,7 +122,7 @@ pub mod impl_mac { socket.as_raw_fd(), SOL_LOCAL, LOCAL_PEERPID, - &mut pid as *mut pid_t as *mut c_void, + core::ptr::addr_of_mut!(pid) as *mut c_void, &mut pid_size, ); diff --git a/library/std/src/panicking.rs b/library/std/src/panicking.rs index c8306c1b597a..ef701d3867a1 100644 --- a/library/std/src/panicking.rs +++ b/library/std/src/panicking.rs @@ -337,9 +337,6 @@ pub mod panic_count { #[doc(hidden)] #[cfg(not(feature = "panic_immediate_abort"))] #[unstable(feature = "update_panic_count", issue = "none")] -// FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_refs` lint -#[cfg_attr(bootstrap, allow(static_mut_ref))] -#[cfg_attr(not(bootstrap), allow(static_mut_refs))] pub mod panic_count { use crate::cell::Cell; use crate::sync::atomic::{AtomicUsize, Ordering}; @@ -505,7 +502,7 @@ pub unsafe fn r#try R>(f: F) -> Result> // method of calling a catch panic whilst juggling ownership. let mut data = Data { f: ManuallyDrop::new(f) }; - let data_ptr = &mut data as *mut _ as *mut u8; + let data_ptr = core::ptr::addr_of_mut!(data) as *mut u8; // SAFETY: // // Access to the union's fields: this is `std` and we know that the `r#try` diff --git a/library/std/src/path.rs b/library/std/src/path.rs index 60562f64c90d..89fbd5c4c645 100644 --- a/library/std/src/path.rs +++ b/library/std/src/path.rs @@ -1270,6 +1270,7 @@ impl PathBuf { /// assert_eq!(path, PathBuf::from("/etc")); /// ``` #[stable(feature = "rust1", since = "1.0.0")] + #[rustc_confusables("append", "put")] pub fn push>(&mut self, path: P) { self._push(path.as_ref()) } diff --git a/library/std/src/process.rs b/library/std/src/process.rs index 669affa266a4..b84d5f11954d 100644 --- a/library/std/src/process.rs +++ b/library/std/src/process.rs @@ -111,7 +111,7 @@ use crate::ffi::OsStr; use crate::fmt; use crate::fs; use crate::io::{self, BorrowedCursor, IoSlice, IoSliceMut}; -use crate::num::NonZeroI32; +use crate::num::NonZero; use crate::path::Path; use crate::str; use crate::sys::pipe::{read2, AnonPipe}; @@ -1775,9 +1775,9 @@ impl ExitStatusError { self.code_nonzero().map(Into::into) } - /// Reports the exit code, if applicable, from an `ExitStatusError`, as a `NonZero` + /// Reports the exit code, if applicable, from an `ExitStatusError`, as a [`NonZero`]. /// - /// This is exactly like [`code()`](Self::code), except that it returns a `NonZeroI32`. + /// This is exactly like [`code()`](Self::code), except that it returns a [NonZero]<[i32]>. /// /// Plain `code`, returning a plain integer, is provided because it is often more convenient. /// The returned value from `code()` is indeed also nonzero; use `code_nonzero()` when you want @@ -1786,17 +1786,17 @@ impl ExitStatusError { /// # Examples /// /// ``` - /// #![feature(exit_status_error)] + /// #![feature(exit_status_error, generic_nonzero)] /// # if cfg!(unix) { - /// use std::num::NonZeroI32; + /// use std::num::NonZero; /// use std::process::Command; /// /// let bad = Command::new("false").status().unwrap().exit_ok().unwrap_err(); - /// assert_eq!(bad.code_nonzero().unwrap(), NonZeroI32::try_from(1).unwrap()); + /// assert_eq!(bad.code_nonzero().unwrap(), NonZero::new(1).unwrap()); /// # } // cfg!(unix) /// ``` #[must_use] - pub fn code_nonzero(&self) -> Option { + pub fn code_nonzero(&self) -> Option> { self.0.code() } diff --git a/library/std/src/sync/barrier.rs b/library/std/src/sync/barrier.rs index ed3c55120847..764fa284794e 100644 --- a/library/std/src/sync/barrier.rs +++ b/library/std/src/sync/barrier.rs @@ -81,8 +81,10 @@ impl Barrier { /// let barrier = Barrier::new(10); /// ``` #[stable(feature = "rust1", since = "1.0.0")] + #[rustc_const_stable(feature = "const_barrier", since = "CURRENT_RUSTC_VERSION")] #[must_use] - pub fn new(n: usize) -> Barrier { + #[inline] + pub const fn new(n: usize) -> Barrier { Barrier { lock: Mutex::new(BarrierState { count: 0, generation_id: 0 }), cvar: Condvar::new(), diff --git a/library/std/src/sync/mod.rs b/library/std/src/sync/mod.rs index f6a7c0a9f754..ca62179e95b6 100644 --- a/library/std/src/sync/mod.rs +++ b/library/std/src/sync/mod.rs @@ -165,6 +165,8 @@ pub use core::sync::Exclusive; pub use self::barrier::{Barrier, BarrierWaitResult}; #[stable(feature = "rust1", since = "1.0.0")] pub use self::condvar::{Condvar, WaitTimeoutResult}; +#[unstable(feature = "mapped_lock_guards", issue = "117108")] +pub use self::mutex::MappedMutexGuard; #[stable(feature = "rust1", since = "1.0.0")] pub use self::mutex::{Mutex, MutexGuard}; #[stable(feature = "rust1", since = "1.0.0")] @@ -172,6 +174,8 @@ pub use self::mutex::{Mutex, MutexGuard}; pub use self::once::{Once, OnceState, ONCE_INIT}; #[stable(feature = "rust1", since = "1.0.0")] pub use self::poison::{LockResult, PoisonError, TryLockError, TryLockResult}; +#[unstable(feature = "mapped_lock_guards", issue = "117108")] +pub use self::rwlock::{MappedRwLockReadGuard, MappedRwLockWriteGuard}; #[stable(feature = "rust1", since = "1.0.0")] pub use self::rwlock::{RwLock, RwLockReadGuard, RwLockWriteGuard}; diff --git a/library/std/src/sync/mpmc/zero.rs b/library/std/src/sync/mpmc/zero.rs index 33f768dcbe90..1b82713edc74 100644 --- a/library/std/src/sync/mpmc/zero.rs +++ b/library/std/src/sync/mpmc/zero.rs @@ -182,7 +182,11 @@ impl Channel { // Prepare for blocking until a receiver wakes us up. let oper = Operation::hook(token); let mut packet = Packet::::message_on_stack(msg); - inner.senders.register_with_packet(oper, &mut packet as *mut Packet as *mut (), cx); + inner.senders.register_with_packet( + oper, + core::ptr::addr_of_mut!(packet) as *mut (), + cx, + ); inner.receivers.notify(); drop(inner); @@ -251,7 +255,7 @@ impl Channel { let mut packet = Packet::::empty_on_stack(); inner.receivers.register_with_packet( oper, - &mut packet as *mut Packet as *mut (), + core::ptr::addr_of_mut!(packet) as *mut (), cx, ); inner.senders.notify(); diff --git a/library/std/src/sync/mutex.rs b/library/std/src/sync/mutex.rs index 920143b7ac7b..fa91f9d907af 100644 --- a/library/std/src/sync/mutex.rs +++ b/library/std/src/sync/mutex.rs @@ -3,7 +3,10 @@ mod tests; use crate::cell::UnsafeCell; use crate::fmt; +use crate::marker::PhantomData; +use crate::mem::ManuallyDrop; use crate::ops::{Deref, DerefMut}; +use crate::ptr::NonNull; use crate::sync::{poison, LockResult, TryLockError, TryLockResult}; use crate::sys::locks as sys; @@ -213,6 +216,47 @@ impl !Send for MutexGuard<'_, T> {} #[stable(feature = "mutexguard", since = "1.19.0")] unsafe impl Sync for MutexGuard<'_, T> {} +/// An RAII mutex guard returned by `MutexGuard::map`, which can point to a +/// subfield of the protected data. When this structure is dropped (falls out +/// of scope), the lock will be unlocked. +/// +/// The main difference between `MappedMutexGuard` and [`MutexGuard`] is that the +/// former cannot be used with [`Condvar`], since that +/// could introduce soundness issues if the locked object is modified by another +/// thread while the `Mutex` is unlocked. +/// +/// The data protected by the mutex can be accessed through this guard via its +/// [`Deref`] and [`DerefMut`] implementations. +/// +/// This structure is created by the [`map`] and [`try_map`] methods on +/// [`MutexGuard`]. +/// +/// [`map`]: MutexGuard::map +/// [`try_map`]: MutexGuard::try_map +/// [`Condvar`]: crate::sync::Condvar +#[must_use = "if unused the Mutex will immediately unlock"] +#[must_not_suspend = "holding a MappedMutexGuard across suspend \ + points can cause deadlocks, delays, \ + and cause Futures to not implement `Send`"] +#[unstable(feature = "mapped_lock_guards", issue = "117108")] +#[clippy::has_significant_drop] +pub struct MappedMutexGuard<'a, T: ?Sized + 'a> { + // NB: we use a pointer instead of `&'a mut T` to avoid `noalias` violations, because a + // `MappedMutexGuard` argument doesn't hold uniqueness for its whole scope, only until it drops. + // `NonNull` is covariant over `T`, so we add a `PhantomData<&'a mut T>` field + // below for the correct variance over `T` (invariance). + data: NonNull, + inner: &'a sys::Mutex, + poison_flag: &'a poison::Flag, + poison: poison::Guard, + _variance: PhantomData<&'a mut T>, +} + +#[unstable(feature = "mapped_lock_guards", issue = "117108")] +impl !Send for MappedMutexGuard<'_, T> {} +#[unstable(feature = "mapped_lock_guards", issue = "117108")] +unsafe impl Sync for MappedMutexGuard<'_, T> {} + impl Mutex { /// Creates a new mutex in an unlocked state ready for use. /// @@ -550,3 +594,178 @@ pub fn guard_lock<'a, T: ?Sized>(guard: &MutexGuard<'a, T>) -> &'a sys::Mutex { pub fn guard_poison<'a, T: ?Sized>(guard: &MutexGuard<'a, T>) -> &'a poison::Flag { &guard.lock.poison } + +impl<'a, T: ?Sized> MutexGuard<'a, T> { + /// Makes a [`MappedMutexGuard`] for a component of the borrowed data, e.g. + /// an enum variant. + /// + /// The `Mutex` is already locked, so this cannot fail. + /// + /// This is an associated function that needs to be used as + /// `MutexGuard::map(...)`. A method would interfere with methods of the + /// same name on the contents of the `MutexGuard` used through `Deref`. + #[unstable(feature = "mapped_lock_guards", issue = "117108")] + pub fn map(orig: Self, f: F) -> MappedMutexGuard<'a, U> + where + F: FnOnce(&mut T) -> &mut U, + U: ?Sized, + { + // SAFETY: the conditions of `MutexGuard::new` were satisfied when the original guard + // was created, and have been upheld throughout `map` and/or `try_map`. + // The signature of the closure guarantees that it will not "leak" the lifetime of the reference + // passed to it. If the closure panics, the guard will be dropped. + let data = NonNull::from(f(unsafe { &mut *orig.lock.data.get() })); + let orig = ManuallyDrop::new(orig); + MappedMutexGuard { + data, + inner: &orig.lock.inner, + poison_flag: &orig.lock.poison, + poison: orig.poison.clone(), + _variance: PhantomData, + } + } + + /// Makes a [`MappedMutexGuard`] for a component of the borrowed data. The + /// original guard is returned as an `Err(...)` if the closure returns + /// `None`. + /// + /// The `Mutex` is already locked, so this cannot fail. + /// + /// This is an associated function that needs to be used as + /// `MutexGuard::try_map(...)`. A method would interfere with methods of the + /// same name on the contents of the `MutexGuard` used through `Deref`. + #[doc(alias = "filter_map")] + #[unstable(feature = "mapped_lock_guards", issue = "117108")] + pub fn try_map(orig: Self, f: F) -> Result, Self> + where + F: FnOnce(&mut T) -> Option<&mut U>, + U: ?Sized, + { + // SAFETY: the conditions of `MutexGuard::new` were satisfied when the original guard + // was created, and have been upheld throughout `map` and/or `try_map`. + // The signature of the closure guarantees that it will not "leak" the lifetime of the reference + // passed to it. If the closure panics, the guard will be dropped. + match f(unsafe { &mut *orig.lock.data.get() }) { + Some(data) => { + let data = NonNull::from(data); + let orig = ManuallyDrop::new(orig); + Ok(MappedMutexGuard { + data, + inner: &orig.lock.inner, + poison_flag: &orig.lock.poison, + poison: orig.poison.clone(), + _variance: PhantomData, + }) + } + None => Err(orig), + } + } +} + +#[unstable(feature = "mapped_lock_guards", issue = "117108")] +impl Deref for MappedMutexGuard<'_, T> { + type Target = T; + + fn deref(&self) -> &T { + unsafe { self.data.as_ref() } + } +} + +#[unstable(feature = "mapped_lock_guards", issue = "117108")] +impl DerefMut for MappedMutexGuard<'_, T> { + fn deref_mut(&mut self) -> &mut T { + unsafe { self.data.as_mut() } + } +} + +#[unstable(feature = "mapped_lock_guards", issue = "117108")] +impl Drop for MappedMutexGuard<'_, T> { + #[inline] + fn drop(&mut self) { + unsafe { + self.poison_flag.done(&self.poison); + self.inner.unlock(); + } + } +} + +#[unstable(feature = "mapped_lock_guards", issue = "117108")] +impl fmt::Debug for MappedMutexGuard<'_, T> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + fmt::Debug::fmt(&**self, f) + } +} + +#[unstable(feature = "mapped_lock_guards", issue = "117108")] +impl fmt::Display for MappedMutexGuard<'_, T> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + (**self).fmt(f) + } +} + +impl<'a, T: ?Sized> MappedMutexGuard<'a, T> { + /// Makes a [`MappedMutexGuard`] for a component of the borrowed data, e.g. + /// an enum variant. + /// + /// The `Mutex` is already locked, so this cannot fail. + /// + /// This is an associated function that needs to be used as + /// `MappedMutexGuard::map(...)`. A method would interfere with methods of the + /// same name on the contents of the `MutexGuard` used through `Deref`. + #[unstable(feature = "mapped_lock_guards", issue = "117108")] + pub fn map(mut orig: Self, f: F) -> MappedMutexGuard<'a, U> + where + F: FnOnce(&mut T) -> &mut U, + U: ?Sized, + { + // SAFETY: the conditions of `MutexGuard::new` were satisfied when the original guard + // was created, and have been upheld throughout `map` and/or `try_map`. + // The signature of the closure guarantees that it will not "leak" the lifetime of the reference + // passed to it. If the closure panics, the guard will be dropped. + let data = NonNull::from(f(unsafe { orig.data.as_mut() })); + let orig = ManuallyDrop::new(orig); + MappedMutexGuard { + data, + inner: orig.inner, + poison_flag: orig.poison_flag, + poison: orig.poison.clone(), + _variance: PhantomData, + } + } + + /// Makes a [`MappedMutexGuard`] for a component of the borrowed data. The + /// original guard is returned as an `Err(...)` if the closure returns + /// `None`. + /// + /// The `Mutex` is already locked, so this cannot fail. + /// + /// This is an associated function that needs to be used as + /// `MappedMutexGuard::try_map(...)`. A method would interfere with methods of the + /// same name on the contents of the `MutexGuard` used through `Deref`. + #[doc(alias = "filter_map")] + #[unstable(feature = "mapped_lock_guards", issue = "117108")] + pub fn try_map(mut orig: Self, f: F) -> Result, Self> + where + F: FnOnce(&mut T) -> Option<&mut U>, + U: ?Sized, + { + // SAFETY: the conditions of `MutexGuard::new` were satisfied when the original guard + // was created, and have been upheld throughout `map` and/or `try_map`. + // The signature of the closure guarantees that it will not "leak" the lifetime of the reference + // passed to it. If the closure panics, the guard will be dropped. + match f(unsafe { orig.data.as_mut() }) { + Some(data) => { + let data = NonNull::from(data); + let orig = ManuallyDrop::new(orig); + Ok(MappedMutexGuard { + data, + inner: orig.inner, + poison_flag: orig.poison_flag, + poison: orig.poison.clone(), + _variance: PhantomData, + }) + } + None => Err(orig), + } + } +} diff --git a/library/std/src/sync/mutex/tests.rs b/library/std/src/sync/mutex/tests.rs index 1786a3c09ffb..19ec096c5933 100644 --- a/library/std/src/sync/mutex/tests.rs +++ b/library/std/src/sync/mutex/tests.rs @@ -1,6 +1,6 @@ use crate::sync::atomic::{AtomicUsize, Ordering}; use crate::sync::mpsc::channel; -use crate::sync::{Arc, Condvar, Mutex}; +use crate::sync::{Arc, Condvar, MappedMutexGuard, Mutex, MutexGuard, TryLockError}; use crate::thread; struct Packet(Arc<(Mutex, Condvar)>); @@ -188,6 +188,21 @@ fn test_mutex_arc_poison() { assert!(arc.is_poisoned()); } +#[test] +fn test_mutex_arc_poison_mapped() { + let arc = Arc::new(Mutex::new(1)); + assert!(!arc.is_poisoned()); + let arc2 = arc.clone(); + let _ = thread::spawn(move || { + let lock = arc2.lock().unwrap(); + let lock = MutexGuard::map(lock, |val| val); + assert_eq!(*lock, 2); // deliberate assertion failure to poison the mutex + }) + .join(); + assert!(arc.lock().is_err()); + assert!(arc.is_poisoned()); +} + #[test] fn test_mutex_arc_nested() { // Tests nested mutexes and access @@ -236,3 +251,77 @@ fn test_mutex_unsized() { let comp: &[i32] = &[4, 2, 5]; assert_eq!(&*mutex.lock().unwrap(), comp); } + +#[test] +fn test_mapping_mapped_guard() { + let arr = [0; 4]; + let mut lock = Mutex::new(arr); + let guard = lock.lock().unwrap(); + let guard = MutexGuard::map(guard, |arr| &mut arr[..2]); + let mut guard = MappedMutexGuard::map(guard, |slice| &mut slice[1..]); + assert_eq!(guard.len(), 1); + guard[0] = 42; + drop(guard); + assert_eq!(*lock.get_mut().unwrap(), [0, 42, 0, 0]); +} + +#[test] +fn panic_while_mapping_unlocked_poison() { + let lock = Mutex::new(()); + + let _ = crate::panic::catch_unwind(|| { + let guard = lock.lock().unwrap(); + let _guard = MutexGuard::map::<(), _>(guard, |_| panic!()); + }); + + match lock.try_lock() { + Ok(_) => panic!("panicking in a MutexGuard::map closure should poison the Mutex"), + Err(TryLockError::WouldBlock) => { + panic!("panicking in a MutexGuard::map closure should unlock the mutex") + } + Err(TryLockError::Poisoned(_)) => {} + } + + let _ = crate::panic::catch_unwind(|| { + let guard = lock.lock().unwrap(); + let _guard = MutexGuard::try_map::<(), _>(guard, |_| panic!()); + }); + + match lock.try_lock() { + Ok(_) => panic!("panicking in a MutexGuard::try_map closure should poison the Mutex"), + Err(TryLockError::WouldBlock) => { + panic!("panicking in a MutexGuard::try_map closure should unlock the mutex") + } + Err(TryLockError::Poisoned(_)) => {} + } + + let _ = crate::panic::catch_unwind(|| { + let guard = lock.lock().unwrap(); + let guard = MutexGuard::map::<(), _>(guard, |val| val); + let _guard = MappedMutexGuard::map::<(), _>(guard, |_| panic!()); + }); + + match lock.try_lock() { + Ok(_) => panic!("panicking in a MappedMutexGuard::map closure should poison the Mutex"), + Err(TryLockError::WouldBlock) => { + panic!("panicking in a MappedMutexGuard::map closure should unlock the mutex") + } + Err(TryLockError::Poisoned(_)) => {} + } + + let _ = crate::panic::catch_unwind(|| { + let guard = lock.lock().unwrap(); + let guard = MutexGuard::map::<(), _>(guard, |val| val); + let _guard = MappedMutexGuard::try_map::<(), _>(guard, |_| panic!()); + }); + + match lock.try_lock() { + Ok(_) => panic!("panicking in a MappedMutexGuard::try_map closure should poison the Mutex"), + Err(TryLockError::WouldBlock) => { + panic!("panicking in a MappedMutexGuard::try_map closure should unlock the mutex") + } + Err(TryLockError::Poisoned(_)) => {} + } + + drop(lock); +} diff --git a/library/std/src/sync/poison.rs b/library/std/src/sync/poison.rs index 1e978bec4b44..3c51389fa349 100644 --- a/library/std/src/sync/poison.rs +++ b/library/std/src/sync/poison.rs @@ -78,6 +78,7 @@ impl Flag { } } +#[derive(Clone)] pub struct Guard { #[cfg(panic = "unwind")] panicking: bool, diff --git a/library/std/src/sync/rwlock.rs b/library/std/src/sync/rwlock.rs index c5d846b85aa1..0b3d25c32980 100644 --- a/library/std/src/sync/rwlock.rs +++ b/library/std/src/sync/rwlock.rs @@ -3,6 +3,8 @@ mod tests; use crate::cell::UnsafeCell; use crate::fmt; +use crate::marker::PhantomData; +use crate::mem::ManuallyDrop; use crate::ops::{Deref, DerefMut}; use crate::ptr::NonNull; use crate::sync::{poison, LockResult, TryLockError, TryLockResult}; @@ -105,7 +107,7 @@ unsafe impl Sync for RwLock {} #[cfg_attr(not(test), rustc_diagnostic_item = "RwLockReadGuard")] pub struct RwLockReadGuard<'a, T: ?Sized + 'a> { // NB: we use a pointer instead of `&'a T` to avoid `noalias` violations, because a - // `Ref` argument doesn't hold immutability for its whole scope, only until it drops. + // `RwLockReadGuard` argument doesn't hold immutability for its whole scope, only until it drops. // `NonNull` is also covariant over `T`, just like we would have with `&T`. `NonNull` // is preferable over `const* T` to allow for niche optimization. data: NonNull, @@ -144,6 +146,67 @@ impl !Send for RwLockWriteGuard<'_, T> {} #[stable(feature = "rwlock_guard_sync", since = "1.23.0")] unsafe impl Sync for RwLockWriteGuard<'_, T> {} +/// RAII structure used to release the shared read access of a lock when +/// dropped, which can point to a subfield of the protected data. +/// +/// This structure is created by the [`map`] and [`try_map`] methods +/// on [`RwLockReadGuard`]. +/// +/// [`map`]: RwLockReadGuard::map +/// [`try_map`]: RwLockReadGuard::try_map +#[must_use = "if unused the RwLock will immediately unlock"] +#[must_not_suspend = "holding a MappedRwLockReadGuard across suspend \ + points can cause deadlocks, delays, \ + and cause Futures to not implement `Send`"] +#[unstable(feature = "mapped_lock_guards", issue = "117108")] +#[clippy::has_significant_drop] +pub struct MappedRwLockReadGuard<'a, T: ?Sized + 'a> { + // NB: we use a pointer instead of `&'a T` to avoid `noalias` violations, because a + // `MappedRwLockReadGuard` argument doesn't hold immutability for its whole scope, only until it drops. + // `NonNull` is also covariant over `T`, just like we would have with `&T`. `NonNull` + // is preferable over `const* T` to allow for niche optimization. + data: NonNull, + inner_lock: &'a sys::RwLock, +} + +#[unstable(feature = "mapped_lock_guards", issue = "117108")] +impl !Send for MappedRwLockReadGuard<'_, T> {} + +#[unstable(feature = "mapped_lock_guards", issue = "117108")] +unsafe impl Sync for MappedRwLockReadGuard<'_, T> {} + +/// RAII structure used to release the exclusive write access of a lock when +/// dropped, which can point to a subfield of the protected data. +/// +/// This structure is created by the [`map`] and [`try_map`] methods +/// on [`RwLockWriteGuard`]. +/// +/// [`map`]: RwLockWriteGuard::map +/// [`try_map`]: RwLockWriteGuard::try_map +#[must_use = "if unused the RwLock will immediately unlock"] +#[must_not_suspend = "holding a MappedRwLockWriteGuard across suspend \ + points can cause deadlocks, delays, \ + and cause Future's to not implement `Send`"] +#[unstable(feature = "mapped_lock_guards", issue = "117108")] +#[clippy::has_significant_drop] +pub struct MappedRwLockWriteGuard<'a, T: ?Sized + 'a> { + // NB: we use a pointer instead of `&'a mut T` to avoid `noalias` violations, because a + // `MappedRwLockWriteGuard` argument doesn't hold uniqueness for its whole scope, only until it drops. + // `NonNull` is covariant over `T`, so we add a `PhantomData<&'a mut T>` field + // below for the correct variance over `T` (invariance). + data: NonNull, + inner_lock: &'a sys::RwLock, + poison_flag: &'a poison::Flag, + poison: poison::Guard, + _variance: PhantomData<&'a mut T>, +} + +#[unstable(feature = "mapped_lock_guards", issue = "117108")] +impl !Send for MappedRwLockWriteGuard<'_, T> {} + +#[unstable(feature = "mapped_lock_guards", issue = "117108")] +unsafe impl Sync for MappedRwLockWriteGuard<'_, T> {} + impl RwLock { /// Creates a new instance of an `RwLock` which is unlocked. /// @@ -557,12 +620,40 @@ impl fmt::Display for RwLockWriteGuard<'_, T> { } } +#[unstable(feature = "mapped_lock_guards", issue = "117108")] +impl fmt::Debug for MappedRwLockReadGuard<'_, T> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + (**self).fmt(f) + } +} + +#[unstable(feature = "mapped_lock_guards", issue = "117108")] +impl fmt::Display for MappedRwLockReadGuard<'_, T> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + (**self).fmt(f) + } +} + +#[unstable(feature = "mapped_lock_guards", issue = "117108")] +impl fmt::Debug for MappedRwLockWriteGuard<'_, T> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + (**self).fmt(f) + } +} + +#[unstable(feature = "mapped_lock_guards", issue = "117108")] +impl fmt::Display for MappedRwLockWriteGuard<'_, T> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + (**self).fmt(f) + } +} + #[stable(feature = "rust1", since = "1.0.0")] impl Deref for RwLockReadGuard<'_, T> { type Target = T; fn deref(&self) -> &T { - // SAFETY: the conditions of `RwLockGuard::new` were satisfied when created. + // SAFETY: the conditions of `RwLockReadGuard::new` were satisfied when created. unsafe { self.data.as_ref() } } } @@ -585,6 +676,37 @@ impl DerefMut for RwLockWriteGuard<'_, T> { } } +#[unstable(feature = "mapped_lock_guards", issue = "117108")] +impl Deref for MappedRwLockReadGuard<'_, T> { + type Target = T; + + fn deref(&self) -> &T { + // SAFETY: the conditions of `RwLockReadGuard::new` were satisfied when the original guard + // was created, and have been upheld throughout `map` and/or `try_map`. + unsafe { self.data.as_ref() } + } +} + +#[unstable(feature = "mapped_lock_guards", issue = "117108")] +impl Deref for MappedRwLockWriteGuard<'_, T> { + type Target = T; + + fn deref(&self) -> &T { + // SAFETY: the conditions of `RwLockWriteGuard::new` were satisfied when the original guard + // was created, and have been upheld throughout `map` and/or `try_map`. + unsafe { self.data.as_ref() } + } +} + +#[unstable(feature = "mapped_lock_guards", issue = "117108")] +impl DerefMut for MappedRwLockWriteGuard<'_, T> { + fn deref_mut(&mut self) -> &mut T { + // SAFETY: the conditions of `RwLockWriteGuard::new` were satisfied when the original guard + // was created, and have been upheld throughout `map` and/or `try_map`. + unsafe { self.data.as_mut() } + } +} + #[stable(feature = "rust1", since = "1.0.0")] impl Drop for RwLockReadGuard<'_, T> { fn drop(&mut self) { @@ -605,3 +727,310 @@ impl Drop for RwLockWriteGuard<'_, T> { } } } + +#[unstable(feature = "mapped_lock_guards", issue = "117108")] +impl Drop for MappedRwLockReadGuard<'_, T> { + fn drop(&mut self) { + // SAFETY: the conditions of `RwLockReadGuard::new` were satisfied when the original guard + // was created, and have been upheld throughout `map` and/or `try_map`. + unsafe { + self.inner_lock.read_unlock(); + } + } +} + +#[unstable(feature = "mapped_lock_guards", issue = "117108")] +impl Drop for MappedRwLockWriteGuard<'_, T> { + fn drop(&mut self) { + self.poison_flag.done(&self.poison); + // SAFETY: the conditions of `RwLockWriteGuard::new` were satisfied when the original guard + // was created, and have been upheld throughout `map` and/or `try_map`. + unsafe { + self.inner_lock.write_unlock(); + } + } +} + +impl<'a, T: ?Sized> RwLockReadGuard<'a, T> { + /// Makes a [`MappedRwLockReadGuard`] for a component of the borrowed data, e.g. + /// an enum variant. + /// + /// The `RwLock` is already locked for reading, so this cannot fail. + /// + /// This is an associated function that needs to be used as + /// `RwLockReadGuard::map(...)`. A method would interfere with methods of + /// the same name on the contents of the `RwLockReadGuard` used through + /// `Deref`. + /// + /// # Panics + /// + /// If the closure panics, the guard will be dropped (unlocked) and the RwLock will not be poisoned. + #[unstable(feature = "mapped_lock_guards", issue = "117108")] + pub fn map(orig: Self, f: F) -> MappedRwLockReadGuard<'a, U> + where + F: FnOnce(&T) -> &U, + U: ?Sized, + { + // SAFETY: the conditions of `RwLockReadGuard::new` were satisfied when the original guard + // was created, and have been upheld throughout `map` and/or `try_map`. + // The signature of the closure guarantees that it will not "leak" the lifetime of the reference + // passed to it. If the closure panics, the guard will be dropped. + let data = NonNull::from(f(unsafe { orig.data.as_ref() })); + let orig = ManuallyDrop::new(orig); + MappedRwLockReadGuard { data, inner_lock: &orig.inner_lock } + } + + /// Makes a [`MappedRwLockReadGuard`] for a component of the borrowed data. The + /// original guard is returned as an `Err(...)` if the closure returns + /// `None`. + /// + /// The `RwLock` is already locked for reading, so this cannot fail. + /// + /// This is an associated function that needs to be used as + /// `RwLockReadGuard::try_map(...)`. A method would interfere with methods + /// of the same name on the contents of the `RwLockReadGuard` used through + /// `Deref`. + /// + /// # Panics + /// + /// If the closure panics, the guard will be dropped (unlocked) and the RwLock will not be poisoned. + #[doc(alias = "filter_map")] + #[unstable(feature = "mapped_lock_guards", issue = "117108")] + pub fn try_map(orig: Self, f: F) -> Result, Self> + where + F: FnOnce(&T) -> Option<&U>, + U: ?Sized, + { + // SAFETY: the conditions of `RwLockReadGuard::new` were satisfied when the original guard + // was created, and have been upheld throughout `map` and/or `try_map`. + // The signature of the closure guarantees that it will not "leak" the lifetime of the reference + // passed to it. If the closure panics, the guard will be dropped. + match f(unsafe { orig.data.as_ref() }) { + Some(data) => { + let data = NonNull::from(data); + let orig = ManuallyDrop::new(orig); + Ok(MappedRwLockReadGuard { data, inner_lock: &orig.inner_lock }) + } + None => Err(orig), + } + } +} + +impl<'a, T: ?Sized> MappedRwLockReadGuard<'a, T> { + /// Makes a [`MappedRwLockReadGuard`] for a component of the borrowed data, + /// e.g. an enum variant. + /// + /// The `RwLock` is already locked for reading, so this cannot fail. + /// + /// This is an associated function that needs to be used as + /// `MappedRwLockReadGuard::map(...)`. A method would interfere with + /// methods of the same name on the contents of the `MappedRwLockReadGuard` + /// used through `Deref`. + /// + /// # Panics + /// + /// If the closure panics, the guard will be dropped (unlocked) and the RwLock will not be poisoned. + #[unstable(feature = "mapped_lock_guards", issue = "117108")] + pub fn map(orig: Self, f: F) -> MappedRwLockReadGuard<'a, U> + where + F: FnOnce(&T) -> &U, + U: ?Sized, + { + // SAFETY: the conditions of `RwLockReadGuard::new` were satisfied when the original guard + // was created, and have been upheld throughout `map` and/or `try_map`. + // The signature of the closure guarantees that it will not "leak" the lifetime of the reference + // passed to it. If the closure panics, the guard will be dropped. + let data = NonNull::from(f(unsafe { orig.data.as_ref() })); + let orig = ManuallyDrop::new(orig); + MappedRwLockReadGuard { data, inner_lock: &orig.inner_lock } + } + + /// Makes a [`MappedRwLockReadGuard`] for a component of the borrowed data. + /// The original guard is returned as an `Err(...)` if the closure returns + /// `None`. + /// + /// The `RwLock` is already locked for reading, so this cannot fail. + /// + /// This is an associated function that needs to be used as + /// `MappedRwLockReadGuard::try_map(...)`. A method would interfere with + /// methods of the same name on the contents of the `MappedRwLockReadGuard` + /// used through `Deref`. + /// + /// # Panics + /// + /// If the closure panics, the guard will be dropped (unlocked) and the RwLock will not be poisoned. + #[doc(alias = "filter_map")] + #[unstable(feature = "mapped_lock_guards", issue = "117108")] + pub fn try_map(orig: Self, f: F) -> Result, Self> + where + F: FnOnce(&T) -> Option<&U>, + U: ?Sized, + { + // SAFETY: the conditions of `RwLockReadGuard::new` were satisfied when the original guard + // was created, and have been upheld throughout `map` and/or `try_map`. + // The signature of the closure guarantees that it will not "leak" the lifetime of the reference + // passed to it. If the closure panics, the guard will be dropped. + match f(unsafe { orig.data.as_ref() }) { + Some(data) => { + let data = NonNull::from(data); + let orig = ManuallyDrop::new(orig); + Ok(MappedRwLockReadGuard { data, inner_lock: &orig.inner_lock }) + } + None => Err(orig), + } + } +} + +impl<'a, T: ?Sized> RwLockWriteGuard<'a, T> { + /// Makes a [`MappedRwLockWriteGuard`] for a component of the borrowed data, e.g. + /// an enum variant. + /// + /// The `RwLock` is already locked for writing, so this cannot fail. + /// + /// This is an associated function that needs to be used as + /// `RwLockWriteGuard::map(...)`. A method would interfere with methods of + /// the same name on the contents of the `RwLockWriteGuard` used through + /// `Deref`. + /// + /// # Panics + /// + /// If the closure panics, the guard will be dropped (unlocked) and the RwLock will be poisoned. + #[unstable(feature = "mapped_lock_guards", issue = "117108")] + pub fn map(orig: Self, f: F) -> MappedRwLockWriteGuard<'a, U> + where + F: FnOnce(&mut T) -> &mut U, + U: ?Sized, + { + // SAFETY: the conditions of `RwLockWriteGuard::new` were satisfied when the original guard + // was created, and have been upheld throughout `map` and/or `try_map`. + // The signature of the closure guarantees that it will not "leak" the lifetime of the reference + // passed to it. If the closure panics, the guard will be dropped. + let data = NonNull::from(f(unsafe { &mut *orig.lock.data.get() })); + let orig = ManuallyDrop::new(orig); + MappedRwLockWriteGuard { + data, + inner_lock: &orig.lock.inner, + poison_flag: &orig.lock.poison, + poison: orig.poison.clone(), + _variance: PhantomData, + } + } + + /// Makes a [`MappedRwLockWriteGuard`] for a component of the borrowed data. The + /// original guard is returned as an `Err(...)` if the closure returns + /// `None`. + /// + /// The `RwLock` is already locked for writing, so this cannot fail. + /// + /// This is an associated function that needs to be used as + /// `RwLockWriteGuard::try_map(...)`. A method would interfere with methods + /// of the same name on the contents of the `RwLockWriteGuard` used through + /// `Deref`. + /// + /// # Panics + /// + /// If the closure panics, the guard will be dropped (unlocked) and the RwLock will be poisoned. + #[doc(alias = "filter_map")] + #[unstable(feature = "mapped_lock_guards", issue = "117108")] + pub fn try_map(orig: Self, f: F) -> Result, Self> + where + F: FnOnce(&mut T) -> Option<&mut U>, + U: ?Sized, + { + // SAFETY: the conditions of `RwLockWriteGuard::new` were satisfied when the original guard + // was created, and have been upheld throughout `map` and/or `try_map`. + // The signature of the closure guarantees that it will not "leak" the lifetime of the reference + // passed to it. If the closure panics, the guard will be dropped. + match f(unsafe { &mut *orig.lock.data.get() }) { + Some(data) => { + let data = NonNull::from(data); + let orig = ManuallyDrop::new(orig); + Ok(MappedRwLockWriteGuard { + data, + inner_lock: &orig.lock.inner, + poison_flag: &orig.lock.poison, + poison: orig.poison.clone(), + _variance: PhantomData, + }) + } + None => Err(orig), + } + } +} + +impl<'a, T: ?Sized> MappedRwLockWriteGuard<'a, T> { + /// Makes a [`MappedRwLockWriteGuard`] for a component of the borrowed data, + /// e.g. an enum variant. + /// + /// The `RwLock` is already locked for writing, so this cannot fail. + /// + /// This is an associated function that needs to be used as + /// `MappedRwLockWriteGuard::map(...)`. A method would interfere with + /// methods of the same name on the contents of the `MappedRwLockWriteGuard` + /// used through `Deref`. + /// + /// # Panics + /// + /// If the closure panics, the guard will be dropped (unlocked) and the RwLock will be poisoned. + #[unstable(feature = "mapped_lock_guards", issue = "117108")] + pub fn map(mut orig: Self, f: F) -> MappedRwLockWriteGuard<'a, U> + where + F: FnOnce(&mut T) -> &mut U, + U: ?Sized, + { + // SAFETY: the conditions of `RwLockWriteGuard::new` were satisfied when the original guard + // was created, and have been upheld throughout `map` and/or `try_map`. + // The signature of the closure guarantees that it will not "leak" the lifetime of the reference + // passed to it. If the closure panics, the guard will be dropped. + let data = NonNull::from(f(unsafe { orig.data.as_mut() })); + let orig = ManuallyDrop::new(orig); + MappedRwLockWriteGuard { + data, + inner_lock: orig.inner_lock, + poison_flag: orig.poison_flag, + poison: orig.poison.clone(), + _variance: PhantomData, + } + } + + /// Makes a [`MappedRwLockWriteGuard`] for a component of the borrowed data. + /// The original guard is returned as an `Err(...)` if the closure returns + /// `None`. + /// + /// The `RwLock` is already locked for writing, so this cannot fail. + /// + /// This is an associated function that needs to be used as + /// `MappedRwLockWriteGuard::try_map(...)`. A method would interfere with + /// methods of the same name on the contents of the `MappedRwLockWriteGuard` + /// used through `Deref`. + /// + /// # Panics + /// + /// If the closure panics, the guard will be dropped (unlocked) and the RwLock will be poisoned. + #[doc(alias = "filter_map")] + #[unstable(feature = "mapped_lock_guards", issue = "117108")] + pub fn try_map(mut orig: Self, f: F) -> Result, Self> + where + F: FnOnce(&mut T) -> Option<&mut U>, + U: ?Sized, + { + // SAFETY: the conditions of `RwLockWriteGuard::new` were satisfied when the original guard + // was created, and have been upheld throughout `map` and/or `try_map`. + // The signature of the closure guarantees that it will not "leak" the lifetime of the reference + // passed to it. If the closure panics, the guard will be dropped. + match f(unsafe { orig.data.as_mut() }) { + Some(data) => { + let data = NonNull::from(data); + let orig = ManuallyDrop::new(orig); + Ok(MappedRwLockWriteGuard { + data, + inner_lock: orig.inner_lock, + poison_flag: orig.poison_flag, + poison: orig.poison.clone(), + _variance: PhantomData, + }) + } + None => Err(orig), + } + } +} diff --git a/library/std/src/sync/rwlock/tests.rs b/library/std/src/sync/rwlock/tests.rs index 1a9d3d3f12f3..9cc5e7a3a60f 100644 --- a/library/std/src/sync/rwlock/tests.rs +++ b/library/std/src/sync/rwlock/tests.rs @@ -1,6 +1,9 @@ use crate::sync::atomic::{AtomicUsize, Ordering}; use crate::sync::mpsc::channel; -use crate::sync::{Arc, RwLock, RwLockReadGuard, TryLockError}; +use crate::sync::{ + Arc, MappedRwLockReadGuard, MappedRwLockWriteGuard, RwLock, RwLockReadGuard, RwLockWriteGuard, + TryLockError, +}; use crate::thread; use rand::Rng; @@ -55,6 +58,19 @@ fn test_rw_arc_poison_wr() { assert!(arc.read().is_err()); } +#[test] +fn test_rw_arc_poison_mapped_w_r() { + let arc = Arc::new(RwLock::new(1)); + let arc2 = arc.clone(); + let _: Result<(), _> = thread::spawn(move || { + let lock = arc2.write().unwrap(); + let _lock = RwLockWriteGuard::map(lock, |val| val); + panic!(); + }) + .join(); + assert!(arc.read().is_err()); +} + #[test] fn test_rw_arc_poison_ww() { let arc = Arc::new(RwLock::new(1)); @@ -69,6 +85,20 @@ fn test_rw_arc_poison_ww() { assert!(arc.is_poisoned()); } +#[test] +fn test_rw_arc_poison_mapped_w_w() { + let arc = Arc::new(RwLock::new(1)); + let arc2 = arc.clone(); + let _: Result<(), _> = thread::spawn(move || { + let lock = arc2.write().unwrap(); + let _lock = RwLockWriteGuard::map(lock, |val| val); + panic!(); + }) + .join(); + assert!(arc.write().is_err()); + assert!(arc.is_poisoned()); +} + #[test] fn test_rw_arc_no_poison_rr() { let arc = Arc::new(RwLock::new(1)); @@ -81,6 +111,21 @@ fn test_rw_arc_no_poison_rr() { let lock = arc.read().unwrap(); assert_eq!(*lock, 1); } + +#[test] +fn test_rw_arc_no_poison_mapped_r_r() { + let arc = Arc::new(RwLock::new(1)); + let arc2 = arc.clone(); + let _: Result<(), _> = thread::spawn(move || { + let lock = arc2.read().unwrap(); + let _lock = RwLockReadGuard::map(lock, |val| val); + panic!(); + }) + .join(); + let lock = arc.read().unwrap(); + assert_eq!(*lock, 1); +} + #[test] fn test_rw_arc_no_poison_rw() { let arc = Arc::new(RwLock::new(1)); @@ -94,6 +139,20 @@ fn test_rw_arc_no_poison_rw() { assert_eq!(*lock, 1); } +#[test] +fn test_rw_arc_no_poison_mapped_r_w() { + let arc = Arc::new(RwLock::new(1)); + let arc2 = arc.clone(); + let _: Result<(), _> = thread::spawn(move || { + let lock = arc2.read().unwrap(); + let _lock = RwLockReadGuard::map(lock, |val| val); + panic!(); + }) + .join(); + let lock = arc.write().unwrap(); + assert_eq!(*lock, 1); +} + #[test] fn test_rw_arc() { let arc = Arc::new(RwLock::new(0)); @@ -179,6 +238,16 @@ fn test_rwlock_try_write() { } drop(read_guard); + let mapped_read_guard = RwLockReadGuard::map(lock.read().unwrap(), |_| &()); + + let write_result = lock.try_write(); + match write_result { + Err(TryLockError::WouldBlock) => (), + Ok(_) => assert!(false, "try_write should not succeed while mapped_read_guard is in scope"), + Err(_) => assert!(false, "unexpected error"), + } + + drop(mapped_read_guard); } #[test] @@ -257,3 +326,173 @@ fn test_read_guard_covariance() { } drop(lock); } + +#[test] +fn test_mapped_read_guard_covariance() { + fn do_stuff<'a>(_: MappedRwLockReadGuard<'_, &'a i32>, _: &'a i32) {} + let j: i32 = 5; + let lock = RwLock::new((&j, &j)); + { + let i = 6; + let guard = lock.read().unwrap(); + let guard = RwLockReadGuard::map(guard, |(val, _val)| val); + do_stuff(guard, &i); + } + drop(lock); +} + +#[test] +fn test_mapping_mapped_guard() { + let arr = [0; 4]; + let mut lock = RwLock::new(arr); + let guard = lock.write().unwrap(); + let guard = RwLockWriteGuard::map(guard, |arr| &mut arr[..2]); + let mut guard = MappedRwLockWriteGuard::map(guard, |slice| &mut slice[1..]); + assert_eq!(guard.len(), 1); + guard[0] = 42; + drop(guard); + assert_eq!(*lock.get_mut().unwrap(), [0, 42, 0, 0]); + + let guard = lock.read().unwrap(); + let guard = RwLockReadGuard::map(guard, |arr| &arr[..2]); + let guard = MappedRwLockReadGuard::map(guard, |slice| &slice[1..]); + assert_eq!(*guard, [42]); + drop(guard); + assert_eq!(*lock.get_mut().unwrap(), [0, 42, 0, 0]); +} + +#[test] +fn panic_while_mapping_read_unlocked_no_poison() { + let lock = RwLock::new(()); + + let _ = crate::panic::catch_unwind(|| { + let guard = lock.read().unwrap(); + let _guard = RwLockReadGuard::map::<(), _>(guard, |_| panic!()); + }); + + match lock.try_write() { + Ok(_) => {} + Err(TryLockError::WouldBlock) => { + panic!("panicking in a RwLockReadGuard::map closure should release the read lock") + } + Err(TryLockError::Poisoned(_)) => { + panic!("panicking in a RwLockReadGuard::map closure should not poison the RwLock") + } + } + + let _ = crate::panic::catch_unwind(|| { + let guard = lock.read().unwrap(); + let _guard = RwLockReadGuard::try_map::<(), _>(guard, |_| panic!()); + }); + + match lock.try_write() { + Ok(_) => {} + Err(TryLockError::WouldBlock) => { + panic!("panicking in a RwLockReadGuard::try_map closure should release the read lock") + } + Err(TryLockError::Poisoned(_)) => { + panic!("panicking in a RwLockReadGuard::try_map closure should not poison the RwLock") + } + } + + let _ = crate::panic::catch_unwind(|| { + let guard = lock.read().unwrap(); + let guard = RwLockReadGuard::map::<(), _>(guard, |val| val); + let _guard = MappedRwLockReadGuard::map::<(), _>(guard, |_| panic!()); + }); + + match lock.try_write() { + Ok(_) => {} + Err(TryLockError::WouldBlock) => { + panic!("panicking in a MappedRwLockReadGuard::map closure should release the read lock") + } + Err(TryLockError::Poisoned(_)) => { + panic!("panicking in a MappedRwLockReadGuard::map closure should not poison the RwLock") + } + } + + let _ = crate::panic::catch_unwind(|| { + let guard = lock.read().unwrap(); + let guard = RwLockReadGuard::map::<(), _>(guard, |val| val); + let _guard = MappedRwLockReadGuard::try_map::<(), _>(guard, |_| panic!()); + }); + + match lock.try_write() { + Ok(_) => {} + Err(TryLockError::WouldBlock) => panic!( + "panicking in a MappedRwLockReadGuard::try_map closure should release the read lock" + ), + Err(TryLockError::Poisoned(_)) => panic!( + "panicking in a MappedRwLockReadGuard::try_map closure should not poison the RwLock" + ), + } + + drop(lock); +} + +#[test] +fn panic_while_mapping_write_unlocked_poison() { + let lock = RwLock::new(()); + + let _ = crate::panic::catch_unwind(|| { + let guard = lock.write().unwrap(); + let _guard = RwLockWriteGuard::map::<(), _>(guard, |_| panic!()); + }); + + match lock.try_write() { + Ok(_) => panic!("panicking in a RwLockWriteGuard::map closure should poison the RwLock"), + Err(TryLockError::WouldBlock) => { + panic!("panicking in a RwLockWriteGuard::map closure should release the write lock") + } + Err(TryLockError::Poisoned(_)) => {} + } + + let _ = crate::panic::catch_unwind(|| { + let guard = lock.write().unwrap(); + let _guard = RwLockWriteGuard::try_map::<(), _>(guard, |_| panic!()); + }); + + match lock.try_write() { + Ok(_) => { + panic!("panicking in a RwLockWriteGuard::try_map closure should poison the RwLock") + } + Err(TryLockError::WouldBlock) => { + panic!("panicking in a RwLockWriteGuard::try_map closure should release the write lock") + } + Err(TryLockError::Poisoned(_)) => {} + } + + let _ = crate::panic::catch_unwind(|| { + let guard = lock.write().unwrap(); + let guard = RwLockWriteGuard::map::<(), _>(guard, |val| val); + let _guard = MappedRwLockWriteGuard::map::<(), _>(guard, |_| panic!()); + }); + + match lock.try_write() { + Ok(_) => { + panic!("panicking in a MappedRwLockWriteGuard::map closure should poison the RwLock") + } + Err(TryLockError::WouldBlock) => panic!( + "panicking in a MappedRwLockWriteGuard::map closure should release the write lock" + ), + Err(TryLockError::Poisoned(_)) => {} + } + + let _ = crate::panic::catch_unwind(|| { + let guard = lock.write().unwrap(); + let guard = RwLockWriteGuard::map::<(), _>(guard, |val| val); + let _guard = MappedRwLockWriteGuard::try_map::<(), _>(guard, |_| panic!()); + }); + + match lock.try_write() { + Ok(_) => panic!( + "panicking in a MappedRwLockWriteGuard::try_map closure should poison the RwLock" + ), + Err(TryLockError::WouldBlock) => panic!( + "panicking in a MappedRwLockWriteGuard::try_map closure should release the write lock" + ), + Err(TryLockError::Poisoned(_)) => {} + } + + drop(lock); +} diff --git a/library/std/src/sys/pal/hermit/net.rs b/library/std/src/sys/pal/hermit/net.rs index 871a2ccdfa49..1c53796f5d49 100644 --- a/library/std/src/sys/pal/hermit/net.rs +++ b/library/std/src/sys/pal/hermit/net.rs @@ -207,7 +207,7 @@ impl Socket { buf.as_mut_ptr(), buf.len(), flags, - &mut storage as *mut _ as *mut _, + core::ptr::addr_of_mut!(storage) as *mut _, &mut addrlen, ) })?; @@ -323,7 +323,7 @@ impl Socket { netc::ioctl( self.as_raw_fd(), netc::FIONBIO, - &mut nonblocking as *mut _ as *mut core::ffi::c_void, + core::ptr::addr_of_mut!(nonblocking) as *mut core::ffi::c_void, ) }) .map(drop) diff --git a/library/std/src/sys/pal/hermit/time.rs b/library/std/src/sys/pal/hermit/time.rs index b0e9634d2299..f289dafd8bc5 100644 --- a/library/std/src/sys/pal/hermit/time.rs +++ b/library/std/src/sys/pal/hermit/time.rs @@ -100,7 +100,7 @@ pub struct Instant(Timespec); impl Instant { pub fn now() -> Instant { let mut time: Timespec = Timespec::zero(); - let _ = unsafe { abi::clock_gettime(CLOCK_MONOTONIC, &mut time.t as *mut timespec) }; + let _ = unsafe { abi::clock_gettime(CLOCK_MONOTONIC, core::ptr::addr_of_mut!(time.t)) }; Instant(time) } @@ -197,7 +197,7 @@ pub const UNIX_EPOCH: SystemTime = SystemTime(Timespec::zero()); impl SystemTime { pub fn now() -> SystemTime { let mut time: Timespec = Timespec::zero(); - let _ = unsafe { abi::clock_gettime(CLOCK_REALTIME, &mut time.t as *mut timespec) }; + let _ = unsafe { abi::clock_gettime(CLOCK_REALTIME, core::ptr::addr_of_mut!(time.t)) }; SystemTime(time) } diff --git a/library/std/src/sys/pal/sgx/abi/tls/mod.rs b/library/std/src/sys/pal/sgx/abi/tls/mod.rs index 6762a43b483a..8a9ea4ac00df 100644 --- a/library/std/src/sys/pal/sgx/abi/tls/mod.rs +++ b/library/std/src/sys/pal/sgx/abi/tls/mod.rs @@ -95,7 +95,7 @@ impl Tls { #[allow(unused)] pub unsafe fn activate_persistent(self: Box) { // FIXME: Needs safety information. See entry.S for `set_tls_ptr` definition. - unsafe { set_tls_ptr((&*self) as *const Tls as _) }; + unsafe { set_tls_ptr(core::ptr::addr_of!(*self) as _) }; mem::forget(self); } diff --git a/library/std/src/sys/pal/uefi/stdio.rs b/library/std/src/sys/pal/uefi/stdio.rs index a533d8a05750..703e8ba8e571 100644 --- a/library/std/src/sys/pal/uefi/stdio.rs +++ b/library/std/src/sys/pal/uefi/stdio.rs @@ -4,51 +4,100 @@ use crate::mem::MaybeUninit; use crate::os::uefi; use crate::ptr::NonNull; -const MAX_BUFFER_SIZE: usize = 8192; +pub struct Stdin { + surrogate: Option, + incomplete_utf8: IncompleteUtf8, +} + +struct IncompleteUtf8 { + bytes: [u8; 4], + len: u8, +} + +impl IncompleteUtf8 { + pub const fn new() -> IncompleteUtf8 { + IncompleteUtf8 { bytes: [0; 4], len: 0 } + } + + // Implemented for use in Stdin::read. + fn read(&mut self, buf: &mut [u8]) -> usize { + // Write to buffer until the buffer is full or we run out of bytes. + let to_write = crate::cmp::min(buf.len(), self.len as usize); + buf[..to_write].copy_from_slice(&self.bytes[..to_write]); + + // Rotate the remaining bytes if not enough remaining space in buffer. + if usize::from(self.len) > buf.len() { + self.bytes.copy_within(to_write.., 0); + self.len -= to_write as u8; + } else { + self.len = 0; + } + + to_write + } +} -pub struct Stdin; pub struct Stdout; pub struct Stderr; impl Stdin { pub const fn new() -> Stdin { - Stdin + Stdin { surrogate: None, incomplete_utf8: IncompleteUtf8::new() } } } impl io::Read for Stdin { fn read(&mut self, buf: &mut [u8]) -> io::Result { - let st: NonNull = uefi::env::system_table().cast(); - let stdin = unsafe { (*st.as_ptr()).con_in }; + // If there are bytes in the incomplete utf-8, start with those. + // (No-op if there is nothing in the buffer.) + let mut bytes_copied = self.incomplete_utf8.read(buf); - // Try reading any pending data - let inp = match read_key_stroke(stdin) { - Ok(x) => x, - Err(e) if e == r_efi::efi::Status::NOT_READY => { - // Wait for keypress for new data - wait_stdin(stdin)?; - read_key_stroke(stdin).map_err(|x| io::Error::from_raw_os_error(x.as_usize()))? - } - Err(e) => { - return Err(io::Error::from_raw_os_error(e.as_usize())); - } + let stdin: *mut r_efi::protocols::simple_text_input::Protocol = unsafe { + let st: NonNull = uefi::env::system_table().cast(); + (*st.as_ptr()).con_in }; - // Check if the key is printiable character - if inp.scan_code != 0x00 { - return Err(io::const_io_error!(io::ErrorKind::Interrupted, "Special Key Press")); + if bytes_copied == buf.len() { + return Ok(bytes_copied); } - // SAFETY: Iterator will have only 1 character since we are reading only 1 Key - // SAFETY: This character will always be UCS-2 and thus no surrogates. - let ch: char = char::decode_utf16([inp.unicode_char]).next().unwrap().unwrap(); - if ch.len_utf8() > buf.len() { - return Ok(0); + let ch = simple_text_input_read(stdin)?; + // Only 1 character should be returned. + let mut ch: Vec> = + if let Some(x) = self.surrogate.take() { + char::decode_utf16([x, ch]).collect() + } else { + char::decode_utf16([ch]).collect() + }; + + if ch.len() > 1 { + return Err(io::Error::new(io::ErrorKind::InvalidData, "invalid utf-16 sequence")); } - ch.encode_utf8(buf); + match ch.pop().unwrap() { + Err(e) => { + self.surrogate = Some(e.unpaired_surrogate()); + } + Ok(x) => { + // This will always be > 0 + let buf_free_count = buf.len() - bytes_copied; + assert!(buf_free_count > 0); - Ok(ch.len_utf8()) + if buf_free_count >= x.len_utf8() { + // There is enough space in the buffer for the character. + bytes_copied += x.encode_utf8(&mut buf[bytes_copied..]).len(); + } else { + // There is not enough space in the buffer for the character. + // Store the character in the incomplete buffer. + self.incomplete_utf8.len = + x.encode_utf8(&mut self.incomplete_utf8.bytes).len() as u8; + // write partial character to buffer. + bytes_copied += self.incomplete_utf8.read(buf); + } + } + } + + Ok(bytes_copied) } } @@ -90,11 +139,11 @@ impl io::Write for Stderr { } } -// UCS-2 character should occupy 3 bytes at most in UTF-8 -pub const STDIN_BUF_SIZE: usize = 3; +// UTF-16 character should occupy 4 bytes at most in UTF-8 +pub const STDIN_BUF_SIZE: usize = 4; pub fn is_ebadf(_err: &io::Error) -> bool { - true + false } pub fn panic_output() -> Option { @@ -105,19 +154,15 @@ fn write( protocol: *mut r_efi::protocols::simple_text_output::Protocol, buf: &[u8], ) -> io::Result { - let mut utf16 = [0; MAX_BUFFER_SIZE / 2]; - // Get valid UTF-8 buffer let utf8 = match crate::str::from_utf8(buf) { Ok(x) => x, Err(e) => unsafe { crate::str::from_utf8_unchecked(&buf[..e.valid_up_to()]) }, }; - // Clip UTF-8 buffer to max UTF-16 buffer we support - let utf8 = &utf8[..utf8.floor_char_boundary(utf16.len() - 1)]; - for (i, ch) in utf8.encode_utf16().enumerate() { - utf16[i] = ch; - } + let mut utf16: Vec = utf8.encode_utf16().collect(); + // NULL terminate the string + utf16.push(0); unsafe { simple_text_output(protocol, &mut utf16) }?; @@ -132,6 +177,18 @@ unsafe fn simple_text_output( if res.is_error() { Err(io::Error::from_raw_os_error(res.as_usize())) } else { Ok(()) } } +fn simple_text_input_read( + stdin: *mut r_efi::protocols::simple_text_input::Protocol, +) -> io::Result { + loop { + match read_key_stroke(stdin) { + Ok(x) => return Ok(x.unicode_char), + Err(e) if e == r_efi::efi::Status::NOT_READY => wait_stdin(stdin)?, + Err(e) => return Err(io::Error::from_raw_os_error(e.as_usize())), + } + } +} + fn wait_stdin(stdin: *mut r_efi::protocols::simple_text_input::Protocol) -> io::Result<()> { let boot_services: NonNull = uefi::env::boot_services().unwrap().cast(); diff --git a/library/std/src/sys/pal/unix/fs.rs b/library/std/src/sys/pal/unix/fs.rs index c75323ef7757..086cdfe6e943 100644 --- a/library/std/src/sys/pal/unix/fs.rs +++ b/library/std/src/sys/pal/unix/fs.rs @@ -1344,7 +1344,7 @@ impl File { } cvt(unsafe { libc::fsetattrlist( self.as_raw_fd(), - (&attrlist as *const libc::attrlist).cast::().cast_mut(), + core::ptr::addr_of!(attrlist).cast::().cast_mut(), buf.as_ptr().cast::().cast_mut(), num_times * mem::size_of::(), 0 @@ -1744,7 +1744,7 @@ fn open_from(from: &Path) -> io::Result<(crate::fs::File, crate::fs::Metadata)> #[cfg(target_os = "espidf")] fn open_to_and_set_permissions( to: &Path, - reader_metadata: crate::fs::Metadata, + _reader_metadata: crate::fs::Metadata, ) -> io::Result<(crate::fs::File, crate::fs::Metadata)> { use crate::fs::OpenOptions; let writer = OpenOptions::new().open(to)?; @@ -1918,7 +1918,7 @@ pub fn copy(from: &Path, to: &Path) -> io::Result { copyfile_state_get( state.0, COPYFILE_STATE_COPIED, - &mut bytes_copied as *mut libc::off_t as *mut libc::c_void, + core::ptr::addr_of_mut!(bytes_copied) as *mut libc::c_void, ) })?; Ok(bytes_copied as u64) diff --git a/library/std/src/sys/pal/unix/mod.rs b/library/std/src/sys/pal/unix/mod.rs index 04b8c5ca9160..23287258f2f8 100644 --- a/library/std/src/sys/pal/unix/mod.rs +++ b/library/std/src/sys/pal/unix/mod.rs @@ -38,7 +38,7 @@ pub mod thread_parking; pub mod time; #[cfg(target_os = "espidf")] -pub fn init(argc: isize, argv: *const *const u8, _sigpipe: u8) {} +pub fn init(_argc: isize, _argv: *const *const u8, _sigpipe: u8) {} #[cfg(not(target_os = "espidf"))] // SAFETY: must be called only once during runtime initialization. diff --git a/library/std/src/sys/pal/unix/net.rs b/library/std/src/sys/pal/unix/net.rs index 1b6a6bb2c5c7..f4ae7d21781a 100644 --- a/library/std/src/sys/pal/unix/net.rs +++ b/library/std/src/sys/pal/unix/net.rs @@ -316,7 +316,7 @@ impl Socket { buf.as_mut_ptr() as *mut c_void, buf.len(), flags, - &mut storage as *mut _ as *mut _, + core::ptr::addr_of_mut!(storage) as *mut _, &mut addrlen, ) })?; diff --git a/library/std/src/sys/pal/unix/process/process_fuchsia.rs b/library/std/src/sys/pal/unix/process/process_fuchsia.rs index b6a74fb48318..23c2be6adf9e 100644 --- a/library/std/src/sys/pal/unix/process/process_fuchsia.rs +++ b/library/std/src/sys/pal/unix/process/process_fuchsia.rs @@ -182,7 +182,7 @@ impl Process { zx_cvt(zx_object_get_info( self.handle.raw(), ZX_INFO_PROCESS, - &mut proc_info as *mut _ as *mut libc::c_void, + core::ptr::addr_of_mut!(proc_info) as *mut libc::c_void, mem::size_of::(), &mut actual, &mut avail, @@ -219,7 +219,7 @@ impl Process { zx_cvt(zx_object_get_info( self.handle.raw(), ZX_INFO_PROCESS, - &mut proc_info as *mut _ as *mut libc::c_void, + core::ptr::addr_of_mut!(proc_info) as *mut libc::c_void, mem::size_of::(), &mut actual, &mut avail, diff --git a/library/std/src/sys/pal/unix/process/process_unix.rs b/library/std/src/sys/pal/unix/process/process_unix.rs index d5a77085725c..97cbd1929d32 100644 --- a/library/std/src/sys/pal/unix/process/process_unix.rs +++ b/library/std/src/sys/pal/unix/process/process_unix.rs @@ -694,15 +694,15 @@ impl Command { let mut iov = [IoSlice::new(b"")]; let mut msg: libc::msghdr = mem::zeroed(); - msg.msg_iov = &mut iov as *mut _ as *mut _; + msg.msg_iov = core::ptr::addr_of_mut!(iov) as *mut _; msg.msg_iovlen = 1; // only attach cmsg if we successfully acquired the pidfd if pidfd >= 0 { msg.msg_controllen = mem::size_of_val(&cmsg.buf) as _; - msg.msg_control = &mut cmsg.buf as *mut _ as *mut _; + msg.msg_control = core::ptr::addr_of_mut!(cmsg.buf) as *mut _; - let hdr = CMSG_FIRSTHDR(&mut msg as *mut _ as *mut _); + let hdr = CMSG_FIRSTHDR(core::ptr::addr_of_mut!(msg) as *mut _); (*hdr).cmsg_level = SOL_SOCKET; (*hdr).cmsg_type = SCM_RIGHTS; (*hdr).cmsg_len = CMSG_LEN(SCM_MSG_LEN as _) as _; @@ -744,17 +744,17 @@ impl Command { let mut msg: libc::msghdr = mem::zeroed(); - msg.msg_iov = &mut iov as *mut _ as *mut _; + msg.msg_iov = core::ptr::addr_of_mut!(iov) as *mut _; msg.msg_iovlen = 1; msg.msg_controllen = mem::size_of::() as _; - msg.msg_control = &mut cmsg as *mut _ as *mut _; + msg.msg_control = core::ptr::addr_of_mut!(cmsg) as *mut _; match cvt_r(|| libc::recvmsg(sock.as_raw(), &mut msg, libc::MSG_CMSG_CLOEXEC)) { Err(_) => return -1, Ok(_) => {} } - let hdr = CMSG_FIRSTHDR(&mut msg as *mut _ as *mut _); + let hdr = CMSG_FIRSTHDR(core::ptr::addr_of_mut!(msg) as *mut _); if hdr.is_null() || (*hdr).cmsg_level != SOL_SOCKET || (*hdr).cmsg_type != SCM_RIGHTS diff --git a/library/std/src/sys/pal/unix/thread.rs b/library/std/src/sys/pal/unix/thread.rs index 97976407bb40..864de31c6ebf 100644 --- a/library/std/src/sys/pal/unix/thread.rs +++ b/library/std/src/sys/pal/unix/thread.rs @@ -239,7 +239,7 @@ impl Thread { tv_nsec: nsecs, }; secs -= ts.tv_sec as u64; - let ts_ptr = &mut ts as *mut _; + let ts_ptr = core::ptr::addr_of_mut!(ts); if libc::nanosleep(ts_ptr, ts_ptr) == -1 { assert_eq!(os::errno(), libc::EINTR); secs += ts.tv_sec as u64; @@ -418,8 +418,8 @@ pub fn available_parallelism() -> io::Result> { libc::sysctl( mib.as_mut_ptr(), 2, - &mut cpus as *mut _ as *mut _, - &mut cpus_size as *mut _ as *mut _, + core::ptr::addr_of_mut!(cpus) as *mut _, + core::ptr::addr_of_mut!(cpus_size) as *mut _, ptr::null_mut(), 0, ) @@ -864,7 +864,7 @@ pub mod guard { .unwrap(); match sysctlbyname.get() { Some(fcn) => { - if fcn(oid.as_ptr(), &mut guard as *mut _ as *mut _, &mut size as *mut _ as *mut _, crate::ptr::null_mut(), 0) == 0 { + if fcn(oid.as_ptr(), core::ptr::addr_of_mut!(guard) as *mut _, core::ptr::addr_of_mut!(size) as *mut _, crate::ptr::null_mut(), 0) == 0 { return guard; } return 1; diff --git a/library/std/src/sys/pal/unix/thread_local_dtor.rs b/library/std/src/sys/pal/unix/thread_local_dtor.rs index 8857f96501c1..79b152cece94 100644 --- a/library/std/src/sys/pal/unix/thread_local_dtor.rs +++ b/library/std/src/sys/pal/unix/thread_local_dtor.rs @@ -58,7 +58,7 @@ pub unsafe fn register_dtor(t: *mut u8, dtor: unsafe extern "C" fn(*mut u8)) { unsafe extern "C" fn(*mut libc::c_void), >(dtor), t.cast(), - &__dso_handle as *const _ as *mut _, + core::ptr::addr_of!(__dso_handle) as *mut _, ); } return; diff --git a/library/std/src/sys/pal/unix/time.rs b/library/std/src/sys/pal/unix/time.rs index f62eb828ee5d..251a37d54dd8 100644 --- a/library/std/src/sys/pal/unix/time.rs +++ b/library/std/src/sys/pal/unix/time.rs @@ -10,7 +10,7 @@ pub const TIMESPEC_MAX: libc::timespec = // This additional constant is only used when calling // `libc::pthread_cond_timedwait`. #[cfg(target_os = "nto")] -pub(super) const TIMESPEC_MAX_CAPPED: libc::timespec = libc::timespec { +pub(in crate::sys) const TIMESPEC_MAX_CAPPED: libc::timespec = libc::timespec { tv_sec: (u64::MAX / NSEC_PER_SEC) as i64, tv_nsec: (u64::MAX % NSEC_PER_SEC) as i64, }; @@ -204,7 +204,7 @@ impl Timespec { // On QNX Neutrino, the maximum timespec for e.g. pthread_cond_timedwait // is 2^64 nanoseconds #[cfg(target_os = "nto")] - pub(super) fn to_timespec_capped(&self) -> Option { + pub(in crate::sys) fn to_timespec_capped(&self) -> Option { // Check if timeout in nanoseconds would fit into an u64 if (self.tv_nsec.0 as u64) .checked_add((self.tv_sec as u64).checked_mul(NSEC_PER_SEC)?) diff --git a/library/std/src/sys/pal/wasi/mod.rs b/library/std/src/sys/pal/wasi/mod.rs index 084b8e0e2163..e6cbd51e768a 100644 --- a/library/std/src/sys/pal/wasi/mod.rs +++ b/library/std/src/sys/pal/wasi/mod.rs @@ -166,7 +166,7 @@ pub fn abort_internal() -> ! { pub fn hashmap_random_keys() -> (u64, u64) { let mut ret = (0u64, 0u64); unsafe { - let base = &mut ret as *mut (u64, u64) as *mut u8; + let base = core::ptr::addr_of_mut!(ret) as *mut u8; let len = mem::size_of_val(&ret); wasi::random_get(base, len).expect("random_get failure"); } diff --git a/library/std/src/sys/pal/windows/fs.rs b/library/std/src/sys/pal/windows/fs.rs index b82a83ae7a3e..3a9e7b4660b3 100644 --- a/library/std/src/sys/pal/windows/fs.rs +++ b/library/std/src/sys/pal/windows/fs.rs @@ -394,7 +394,7 @@ impl File { cvt(c::GetFileInformationByHandleEx( self.handle.as_raw_handle(), c::FileBasicInfo, - &mut info as *mut _ as *mut c_void, + core::ptr::addr_of_mut!(info) as *mut c_void, size as c::DWORD, ))?; let mut attr = FileAttr { @@ -422,7 +422,7 @@ impl File { cvt(c::GetFileInformationByHandleEx( self.handle.as_raw_handle(), c::FileStandardInfo, - &mut info as *mut _ as *mut c_void, + core::ptr::addr_of_mut!(info) as *mut c_void, size as c::DWORD, ))?; attr.file_size = info.AllocationSize as u64; @@ -638,7 +638,7 @@ impl File { cvt(c::GetFileInformationByHandleEx( self.handle.as_raw_handle(), c::FileBasicInfo, - &mut info as *mut _ as *mut c_void, + core::ptr::addr_of_mut!(info) as *mut c_void, size as c::DWORD, ))?; Ok(info) @@ -1438,7 +1438,7 @@ pub fn copy(from: &Path, to: &Path) -> io::Result { pfrom.as_ptr(), pto.as_ptr(), Some(callback), - &mut size as *mut _ as *mut _, + core::ptr::addr_of_mut!(size) as *mut _, ptr::null_mut(), 0, ) diff --git a/library/std/src/sys/pal/windows/io.rs b/library/std/src/sys/pal/windows/io.rs index b73d9f3ff4c4..77b8f3c410eb 100644 --- a/library/std/src/sys/pal/windows/io.rs +++ b/library/std/src/sys/pal/windows/io.rs @@ -122,7 +122,7 @@ unsafe fn msys_tty_on(handle: c::HANDLE) -> bool { let res = c::GetFileInformationByHandleEx( handle, c::FileNameInfo, - &mut name_info as *mut _ as *mut c_void, + core::ptr::addr_of_mut!(name_info) as *mut c_void, size_of::() as u32, ); if res == 0 { diff --git a/library/std/src/sys/pal/windows/net.rs b/library/std/src/sys/pal/windows/net.rs index e37fbe9ef83e..1e6169ea8ece 100644 --- a/library/std/src/sys/pal/windows/net.rs +++ b/library/std/src/sys/pal/windows/net.rs @@ -310,7 +310,7 @@ impl Socket { buf.as_mut_ptr() as *mut _, length, flags, - &mut storage as *mut _ as *mut _, + core::ptr::addr_of_mut!(storage) as *mut _, &mut addrlen, ) }; diff --git a/library/std/src/sys/pal/windows/pipe.rs b/library/std/src/sys/pal/windows/pipe.rs index fd10df82d8b4..013f588676ae 100644 --- a/library/std/src/sys/pal/windows/pipe.rs +++ b/library/std/src/sys/pal/windows/pipe.rs @@ -375,7 +375,7 @@ impl AnonPipe { let mut overlapped: c::OVERLAPPED = crate::mem::zeroed(); // `hEvent` is unused by `ReadFileEx` and `WriteFileEx`. // Therefore the documentation suggests using it to smuggle a pointer to the callback. - overlapped.hEvent = &mut async_result as *mut _ as *mut _; + overlapped.hEvent = core::ptr::addr_of_mut!(async_result) as *mut _; // Asynchronous read of the pipe. // If successful, `callback` will be called once it completes. diff --git a/library/std/src/sys/pal/windows/process.rs b/library/std/src/sys/pal/windows/process.rs index 6a94d3771403..e4ab2ca7da1c 100644 --- a/library/std/src/sys/pal/windows/process.rs +++ b/library/std/src/sys/pal/windows/process.rs @@ -350,10 +350,10 @@ impl Command { StartupInfo: si, lpAttributeList: proc_thread_attribute_list.0.as_mut_ptr() as _, }; - si_ptr = &mut si_ex as *mut _ as _; + si_ptr = core::ptr::addr_of_mut!(si_ex) as _; } else { si.cb = mem::size_of::() as c::DWORD; - si_ptr = &mut si as *mut _ as _; + si_ptr = core::ptr::addr_of_mut!(si) as _; } unsafe { @@ -935,7 +935,7 @@ fn make_proc_thread_attribute_list( // It's theoretically possible for the attribute count to exceed a u32 value. // Therefore, we ensure that we don't add more attributes than the buffer was initialized for. for (&attribute, value) in attributes.iter().take(attribute_count as usize) { - let value_ptr = &*value.data as *const (dyn Send + Sync) as _; + let value_ptr = core::ptr::addr_of!(*value.data) as _; cvt(unsafe { c::UpdateProcThreadAttribute( proc_thread_attribute_list.0.as_mut_ptr() as _, diff --git a/library/std/src/sys/pal/windows/rand.rs b/library/std/src/sys/pal/windows/rand.rs index 5d8fd13785a0..bd1ae6b06076 100644 --- a/library/std/src/sys/pal/windows/rand.rs +++ b/library/std/src/sys/pal/windows/rand.rs @@ -7,7 +7,7 @@ pub fn hashmap_random_keys() -> (u64, u64) { let ret = unsafe { c::BCryptGenRandom( ptr::null_mut(), - &mut v as *mut _ as *mut u8, + core::ptr::addr_of_mut!(v) as *mut u8, mem::size_of_val(&v) as c::ULONG, c::BCRYPT_USE_SYSTEM_PREFERRED_RNG, ) @@ -28,7 +28,7 @@ fn fallback_rng() -> (u64, u64) { let mut v = (0, 0); let ret = unsafe { - c::RtlGenRandom(&mut v as *mut _ as *mut c_void, mem::size_of_val(&v) as c::ULONG) + c::RtlGenRandom(core::ptr::addr_of_mut!(v) as *mut c_void, mem::size_of_val(&v) as c::ULONG) }; if ret != 0 { v } else { panic!("fallback RNG broken: {}", io::Error::last_os_error()) } diff --git a/library/std/src/sys/pal/windows/thread_parking.rs b/library/std/src/sys/pal/windows/thread_parking.rs index 343b530b15ef..ea485d71f5ad 100644 --- a/library/std/src/sys/pal/windows/thread_parking.rs +++ b/library/std/src/sys/pal/windows/thread_parking.rs @@ -215,7 +215,7 @@ impl Parker { } fn ptr(&self) -> c::LPVOID { - &self.state as *const _ as c::LPVOID + core::ptr::addr_of!(self.state) as c::LPVOID } } diff --git a/library/std/src/sys_common/net.rs b/library/std/src/sys_common/net.rs index de7d31baaaf8..581c46af0eac 100644 --- a/library/std/src/sys_common/net.rs +++ b/library/std/src/sys_common/net.rs @@ -70,7 +70,7 @@ pub fn setsockopt( sock.as_raw(), level, option_name, - &option_value as *const T as *const _, + core::ptr::addr_of!(option_value) as *const _, mem::size_of::() as c::socklen_t, ))?; Ok(()) @@ -85,7 +85,7 @@ pub fn getsockopt(sock: &Socket, level: c_int, option_name: c_int) -> i sock.as_raw(), level, option_name, - &mut option_value as *mut T as *mut _, + core::ptr::addr_of_mut!(option_value) as *mut _, &mut option_len, ))?; Ok(option_value) @@ -99,7 +99,7 @@ where unsafe { let mut storage: c::sockaddr_storage = mem::zeroed(); let mut len = mem::size_of_val(&storage) as c::socklen_t; - cvt(f(&mut storage as *mut _ as *mut _, &mut len))?; + cvt(f(core::ptr::addr_of_mut!(storage) as *mut _, &mut len))?; sockaddr_to_addr(&storage, len as usize) } } @@ -444,7 +444,7 @@ impl TcpListener { pub fn accept(&self) -> io::Result<(TcpStream, SocketAddr)> { let mut storage: c::sockaddr_storage = unsafe { mem::zeroed() }; let mut len = mem::size_of_val(&storage) as c::socklen_t; - let sock = self.inner.accept(&mut storage as *mut _ as *mut _, &mut len)?; + let sock = self.inner.accept(core::ptr::addr_of_mut!(storage) as *mut _, &mut len)?; let addr = sockaddr_to_addr(&storage, len as usize)?; Ok((TcpStream { inner: sock }, addr)) } diff --git a/library/std/src/sys_common/once/queue.rs b/library/std/src/sys_common/once/queue.rs index 3cc1df113e3f..730cdb768bd2 100644 --- a/library/std/src/sys_common/once/queue.rs +++ b/library/std/src/sys_common/once/queue.rs @@ -212,7 +212,7 @@ fn wait(state_and_queue: &AtomicPtr, mut current_state: *mut Masked) { signaled: AtomicBool::new(false), next: current_state.with_addr(current_state.addr() & !STATE_MASK) as *const Waiter, }; - let me = &node as *const Waiter as *const Masked as *mut Masked; + let me = core::ptr::addr_of!(node) as *const Masked as *mut Masked; // Try to slide in the node at the head of the linked list, making sure // that another thread didn't just replace the head of the linked list. diff --git a/library/std/src/thread/local.rs b/library/std/src/thread/local.rs index d1213e2f1668..fbb882e640b6 100644 --- a/library/std/src/thread/local.rs +++ b/library/std/src/thread/local.rs @@ -180,8 +180,6 @@ impl fmt::Debug for LocalKey { #[stable(feature = "rust1", since = "1.0.0")] #[cfg_attr(not(test), rustc_diagnostic_item = "thread_local_macro")] #[allow_internal_unstable(thread_local_internals)] -// FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_refs` lint -#[cfg_attr(not(bootstrap), allow(static_mut_refs))] macro_rules! thread_local { // empty (base case for the recursion) () => {}; @@ -435,6 +433,7 @@ impl LocalKey> { /// assert_eq!(X.replace(3), 2); /// ``` #[stable(feature = "local_key_cell_methods", since = "1.73.0")] + #[rustc_confusables("swap")] pub fn replace(&'static self, value: T) -> T { self.with(|cell| cell.replace(value)) } @@ -606,6 +605,7 @@ impl LocalKey> { /// X.with_borrow(|v| assert_eq!(*v, vec![1, 2, 3])); /// ``` #[stable(feature = "local_key_cell_methods", since = "1.73.0")] + #[rustc_confusables("swap")] pub fn replace(&'static self, value: T) -> T { self.with(|cell| cell.replace(value)) } diff --git a/library/std/src/thread/mod.rs b/library/std/src/thread/mod.rs index 4f0f010984ab..76af7fec9264 100644 --- a/library/std/src/thread/mod.rs +++ b/library/std/src/thread/mod.rs @@ -165,7 +165,7 @@ use crate::fmt; use crate::io; use crate::marker::PhantomData; use crate::mem::{self, forget}; -use crate::num::{NonZero, NonZeroU64, NonZeroUsize}; +use crate::num::NonZero; use crate::panic; use crate::panicking; use crate::pin::Pin; @@ -1222,7 +1222,7 @@ impl ThreadId { /// change across Rust versions. #[must_use] #[unstable(feature = "thread_id_value", issue = "67939")] - pub fn as_u64(&self) -> NonZeroU64 { + pub fn as_u64(&self) -> NonZero { self.0 } } @@ -1784,6 +1784,6 @@ fn _assert_sync_and_send() { #[doc(alias = "hardware_concurrency")] // Alias for C++ `std::thread::hardware_concurrency`. #[doc(alias = "num_cpus")] // Alias for a popular ecosystem crate which provides similar functionality. #[stable(feature = "available_parallelism", since = "1.59.0")] -pub fn available_parallelism() -> io::Result { +pub fn available_parallelism() -> io::Result> { imp::available_parallelism() } diff --git a/library/std/src/thread/scoped.rs b/library/std/src/thread/scoped.rs index ada69aa8269f..7b11e7c17b18 100644 --- a/library/std/src/thread/scoped.rs +++ b/library/std/src/thread/scoped.rs @@ -311,7 +311,7 @@ impl<'scope, T> ScopedJoinHandle<'scope, T> { /// Checks if the associated thread has finished running its main function. /// /// `is_finished` supports implementing a non-blocking join operation, by checking - /// `is_finished`, and calling `join` if it returns `false`. This function does not block. To + /// `is_finished`, and calling `join` if it returns `true`. This function does not block. To /// block while waiting on the thread to finish, use [`join`][Self::join]. /// /// This might return `true` for a brief moment after the thread's main diff --git a/library/stdarch b/library/stdarch index d5fab978fe1c..56087ea170d8 160000 --- a/library/stdarch +++ b/library/stdarch @@ -1 +1 @@ -Subproject commit d5fab978fe1c2f0043db0451e9f4857eeba17437 +Subproject commit 56087ea170d878a7a57b3a5725e0c00f5f5cad70 diff --git a/library/test/src/helpers/concurrency.rs b/library/test/src/helpers/concurrency.rs index eb211157371b..b395adcf885c 100644 --- a/library/test/src/helpers/concurrency.rs +++ b/library/test/src/helpers/concurrency.rs @@ -1,10 +1,10 @@ //! Helper module which helps to determine amount of threads to be used //! during tests execution. -use std::{env, num::NonZeroUsize, thread}; +use std::{env, num::NonZero, thread}; pub fn get_concurrency() -> usize { if let Ok(value) = env::var("RUST_TEST_THREADS") { - match value.parse::().ok() { + match value.parse::>().ok() { Some(n) => n.get(), _ => panic!("RUST_TEST_THREADS is `{value}`, should be a positive integer."), } diff --git a/library/test/src/lib.rs b/library/test/src/lib.rs index da110f992486..728c73d8c502 100644 --- a/library/test/src/lib.rs +++ b/library/test/src/lib.rs @@ -17,6 +17,7 @@ #![unstable(feature = "test", issue = "50297")] #![doc(test(attr(deny(warnings))))] #![doc(rust_logo)] +#![feature(generic_nonzero)] #![feature(rustdoc_internals)] #![feature(internal_output_capture)] #![feature(staged_api)] diff --git a/library/unwind/src/libunwind.rs b/library/unwind/src/libunwind.rs index 1b5f6f9dde36..527c408c89ed 100644 --- a/library/unwind/src/libunwind.rs +++ b/library/unwind/src/libunwind.rs @@ -219,14 +219,14 @@ if #[cfg(any(target_os = "ios", target_os = "tvos", target_os = "watchos", targe pub unsafe fn _Unwind_GetGR(ctx: *mut _Unwind_Context, reg_index: c_int) -> _Unwind_Word { let mut val: _Unwind_Word = core::ptr::null(); _Unwind_VRS_Get(ctx, _UVRSC_CORE, reg_index as _Unwind_Word, _UVRSD_UINT32, - &mut val as *mut _ as *mut c_void); + core::ptr::addr_of_mut!(val) as *mut c_void); val } pub unsafe fn _Unwind_SetGR(ctx: *mut _Unwind_Context, reg_index: c_int, value: _Unwind_Word) { let mut value = value; _Unwind_VRS_Set(ctx, _UVRSC_CORE, reg_index as _Unwind_Word, _UVRSD_UINT32, - &mut value as *mut _ as *mut c_void); + core::ptr::addr_of_mut!(value) as *mut c_void); } pub unsafe fn _Unwind_GetIP(ctx: *mut _Unwind_Context) diff --git a/src/bootstrap/defaults/config.compiler.toml b/src/bootstrap/defaults/config.compiler.toml index 178c6e9056c6..e276f1262118 100644 --- a/src/bootstrap/defaults/config.compiler.toml +++ b/src/bootstrap/defaults/config.compiler.toml @@ -19,9 +19,9 @@ lto = "off" frame-pointers = true [llvm] -# This enables debug-assertions in LLVM, -# catching logic errors in codegen much earlier in the process. -assertions = true +# Having this set to true disrupts compiler development workflows for people who use `llvm.download-ci-llvm = true` +# because we don't provide ci-llvm on the `rustc-alt-builds` server. Therefore, it is kept off by default. +assertions = false # Enable warnings during the LLVM compilation (when LLVM is changed, causing a compilation) enable-warnings = true # Will download LLVM from CI if available on your platform. diff --git a/src/bootstrap/src/core/builder.rs b/src/bootstrap/src/core/builder.rs index 97819403ab7f..0ec5e16de1da 100644 --- a/src/bootstrap/src/core/builder.rs +++ b/src/bootstrap/src/core/builder.rs @@ -288,16 +288,61 @@ impl PathSet { } } -const PATH_REMAP: &[(&str, &str)] = &[("rust-analyzer-proc-macro-srv", "proc-macro-srv-cli")]; +const PATH_REMAP: &[(&str, &[&str])] = &[ + // config.toml uses `rust-analyzer-proc-macro-srv`, but the + // actual path is `proc-macro-srv-cli` + ("rust-analyzer-proc-macro-srv", &["proc-macro-srv-cli"]), + // Make `x test tests` function the same as `x t tests/*` + ( + "tests", + &[ + "tests/assembly", + "tests/codegen", + "tests/codegen-units", + "tests/coverage", + "tests/coverage-run-rustdoc", + "tests/debuginfo", + "tests/incremental", + "tests/mir-opt", + "tests/pretty", + "tests/run-make", + "tests/run-make-fulldeps", + "tests/run-pass-valgrind", + "tests/rustdoc", + "tests/rustdoc-gui", + "tests/rustdoc-js", + "tests/rustdoc-js-std", + "tests/rustdoc-json", + "tests/rustdoc-ui", + "tests/ui", + "tests/ui-fulldeps", + ], + ), +]; -fn remap_paths(paths: &mut [&Path]) { - for path in paths.iter_mut() { +fn remap_paths(paths: &mut Vec<&Path>) { + let mut remove = vec![]; + let mut add = vec![]; + for (i, path) in paths + .iter() + .enumerate() + .filter_map(|(i, path)| if let Some(s) = path.to_str() { Some((i, s)) } else { None }) + { for &(search, replace) in PATH_REMAP { - if path.to_str() == Some(search) { - *path = Path::new(replace) + // Remove leading and trailing slashes so `tests/` and `tests` are equivalent + if path.trim_matches(std::path::is_separator) == search { + remove.push(i); + add.extend(replace.into_iter().map(Path::new)); + break; } } } + remove.sort(); + remove.dedup(); + for idx in remove.into_iter().rev() { + paths.remove(idx); + } + paths.append(&mut add); } impl StepDescription { diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs index 927d46c67a9f..834025c81887 100644 --- a/src/bootstrap/src/core/config/config.rs +++ b/src/bootstrap/src/core/config/config.rs @@ -22,6 +22,7 @@ use crate::utils::cache::{Interned, INTERNER}; use crate::utils::channel::{self, GitInfo}; use crate::utils::helpers::{exe, output, t}; use build_helper::exit; +use build_helper::util::fail; use semver::Version; use serde::{Deserialize, Deserializer}; use serde_derive::Deserialize; @@ -1418,7 +1419,7 @@ impl Config { config.initial_rustc = if let Some(rustc) = rustc { if !flags.skip_stage0_validation { - config.check_build_rustc_version(&rustc); + config.check_stage0_version(&rustc, "rustc"); } PathBuf::from(rustc) } else { @@ -1426,11 +1427,15 @@ impl Config { config.out.join(config.build.triple).join("stage0/bin/rustc") }; - config.initial_cargo = cargo - .map(|cargo| { - t!(PathBuf::from(cargo).canonicalize(), "`initial_cargo` not found on disk") - }) - .unwrap_or_else(|| config.out.join(config.build.triple).join("stage0/bin/cargo")); + config.initial_cargo = if let Some(cargo) = cargo { + if !flags.skip_stage0_validation { + config.check_stage0_version(&cargo, "cargo"); + } + PathBuf::from(cargo) + } else { + config.download_beta_toolchain(); + config.out.join(config.build.triple).join("stage0/bin/cargo") + }; // NOTE: it's important this comes *after* we set `initial_rustc` just above. if config.dry_run() { @@ -2286,39 +2291,37 @@ impl Config { } } - pub fn check_build_rustc_version(&self, rustc_path: &str) { + // check rustc/cargo version is same or lower with 1 apart from the building one + pub fn check_stage0_version(&self, program_path: &str, component_name: &'static str) { if self.dry_run() { return; } - // check rustc version is same or lower with 1 apart from the building one - let mut cmd = Command::new(rustc_path); - cmd.arg("--version"); - let rustc_output = output(&mut cmd) - .lines() - .next() - .unwrap() - .split(' ') - .nth(1) - .unwrap() - .split('-') - .next() - .unwrap() - .to_owned(); - let rustc_version = Version::parse(rustc_output.trim()).unwrap(); + let stage0_output = output(Command::new(program_path).arg("--version")); + let mut stage0_output = stage0_output.lines().next().unwrap().split(' '); + + let stage0_name = stage0_output.next().unwrap(); + if stage0_name != component_name { + fail(&format!( + "Expected to find {component_name} at {program_path} but it claims to be {stage0_name}" + )); + } + + let stage0_version = + Version::parse(stage0_output.next().unwrap().split('-').next().unwrap().trim()) + .unwrap(); let source_version = Version::parse(fs::read_to_string(self.src.join("src/version")).unwrap().trim()) .unwrap(); - if !(source_version == rustc_version - || (source_version.major == rustc_version.major - && (source_version.minor == rustc_version.minor - || source_version.minor == rustc_version.minor + 1))) + if !(source_version == stage0_version + || (source_version.major == stage0_version.major + && (source_version.minor == stage0_version.minor + || source_version.minor == stage0_version.minor + 1))) { let prev_version = format!("{}.{}.x", source_version.major, source_version.minor - 1); - eprintln!( - "Unexpected rustc version: {rustc_version}, we should use {prev_version}/{source_version} to build source with {source_version}" - ); - exit!(1); + fail(&format!( + "Unexpected {component_name} version: {stage0_version}, we should use {prev_version}/{source_version} to build source with {source_version}" + )); } } @@ -2396,7 +2399,7 @@ impl Config { .last_modified_commit(&["src/llvm-project"], "download-ci-llvm", true) .is_none() { - // there are some untracked changes in the the given paths. + // there are some untracked changes in the given paths. false } else { llvm::is_ci_llvm_available(self, asserts) diff --git a/src/doc/rustc/src/platform-support/nto-qnx.md b/src/doc/rustc/src/platform-support/nto-qnx.md index 2a741fa3d024..56070c2ec34e 100644 --- a/src/doc/rustc/src/platform-support/nto-qnx.md +++ b/src/doc/rustc/src/platform-support/nto-qnx.md @@ -13,6 +13,8 @@ and [Blackberry QNX][BlackBerry]. - Florian Bartels, `Florian.Bartels@elektrobit.com`, https://github.com/flba-eb - Tristan Roach, `TRoach@blackberry.com`, https://github.com/gh-tr +- Jonathan Pallant `Jonathan.Pallant@ferrous-systems.com`, https://github.com/jonathanpallant +- Jorge Aparicio `Jorge.Aparicio@ferrous-systems.com`, https://github.com/japaric ## Requirements diff --git a/src/doc/rustdoc/src/write-documentation/linking-to-items-by-name.md b/src/doc/rustdoc/src/write-documentation/linking-to-items-by-name.md index f7a749744e0f..56c14b1638a6 100644 --- a/src/doc/rustdoc/src/write-documentation/linking-to-items-by-name.md +++ b/src/doc/rustdoc/src/write-documentation/linking-to-items-by-name.md @@ -167,5 +167,5 @@ render differently in this case: [f]: g ``` -`1.` and `2.` will will be displayed as is in the rendered documentation (ie, `[a]` and `[b][c]`) +`1.` and `2.` will be displayed as is in the rendered documentation (ie, `[a]` and `[b][c]`) whereas `3.` and `4.` will be replaced by a link targetting `e` for `[d](e)` and `g` for `[f]`. diff --git a/src/doc/unstable-book/src/language-features/intrinsics.md b/src/doc/unstable-book/src/language-features/intrinsics.md index 9d07ae6fc67e..1a8c1c0b36af 100644 --- a/src/doc/unstable-book/src/language-features/intrinsics.md +++ b/src/doc/unstable-book/src/language-features/intrinsics.md @@ -14,6 +14,8 @@ the intrinsic directly when you can. Many intrinsics can be written in pure rust, albeit inefficiently or without supporting some features that only exist on some backends. Backends can simply not implement those intrinsics without causing any code miscompilations or failures to compile. +All intrinsic fallback bodies are automatically made cross-crate inlineable (like `#[inline]`) +by the codegen backend, but not the MIR inliner. ```rust #![feature(rustc_attrs, effects)] diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index bb68c84f529a..973036a40982 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -879,11 +879,16 @@ fn primitive_link_fragment( match m.primitive_locations.get(&prim) { Some(&def_id) if def_id.is_local() => { let len = cx.current.len(); - let len = if len == 0 { 0 } else { len - 1 }; + let path = if len == 0 { + let cname_sym = ExternalCrate { crate_num: def_id.krate }.name(cx.tcx()); + format!("{cname_sym}/") + } else { + "../".repeat(len - 1) + }; write!( f, "", - "../".repeat(len), + path, prim.as_sym() )?; needs_termination = true; diff --git a/src/librustdoc/passes/lint/check_code_block_syntax.rs b/src/librustdoc/passes/lint/check_code_block_syntax.rs index 6649894f9c25..f3537873dc2e 100644 --- a/src/librustdoc/passes/lint/check_code_block_syntax.rs +++ b/src/librustdoc/passes/lint/check_code_block_syntax.rs @@ -159,7 +159,7 @@ impl Emitter for BufferEmitter { fn emit_diagnostic(&mut self, diag: Diagnostic) { let mut buffer = self.buffer.borrow_mut(); - let fluent_args = to_fluent_args(diag.args()); + let fluent_args = to_fluent_args(diag.args.iter()); let translated_main_message = self .translate_message(&diag.messages[0].0, &fluent_args) .unwrap_or_else(|e| panic!("{e}")); diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index 44e5d8dea7dc..c76cba824a37 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -673,14 +673,17 @@ pub fn line_directive<'line>( /// names. This is **not** an exhaustive list of all possible directives. Instead, this is a /// best-effort approximation for diagnostics. const DIAGNOSTICS_DIRECTIVE_NAMES: &[&str] = &[ + "assembly-output", "aux-build", "aux-crate", + "build-aux-docs", "build-fail", "build-pass", "check-fail", "check-pass", "check-run-results", "check-stdout", + "check-test-line-numbers-match", "compile-flags", "dont-check-compiler-stderr", "dont-check-compiler-stdout", @@ -691,12 +694,16 @@ const DIAGNOSTICS_DIRECTIVE_NAMES: &[&str] = &[ "failure-status", "forbid-output", "force-host", + "ignore-16bit", "ignore-32bit", "ignore-64bit", "ignore-aarch64", "ignore-aarch64-unknown-linux-gnu", "ignore-android", "ignore-arm", + "ignore-avr", + "ignore-beta", + "ignore-cdb", "ignore-compare-mode-next-solver", "ignore-compare-mode-polonius", "ignore-cross-compile", @@ -705,13 +712,21 @@ const DIAGNOSTICS_DIRECTIVE_NAMES: &[&str] = &[ "ignore-endian-big", "ignore-freebsd", "ignore-fuchsia", + "ignore-gdb", + "ignore-gdb-version", "ignore-gnu", "ignore-haiku", "ignore-horizon", "ignore-i686-pc-windows-msvc", "ignore-ios", + "ignore-linux", + "ignore-lldb", "ignore-llvm-version", + "ignore-loongarch64", "ignore-macos", + "ignore-mode-coverage-map", + "ignore-mode-coverage-run", + "ignore-msp430", "ignore-msvc", "ignore-musl", "ignore-netbsd", @@ -720,8 +735,13 @@ const DIAGNOSTICS_DIRECTIVE_NAMES: &[&str] = &[ "ignore-nvptx64", "ignore-openbsd", "ignore-pass", + "ignore-remote", + "ignore-riscv64", + "ignore-s390x", "ignore-sgx", "ignore-spirv", + "ignore-stable", + "ignore-stage1", "ignore-test", "ignore-thumbv8m.base-none-eabi", "ignore-thumbv8m.main-none-eabi", @@ -731,9 +751,15 @@ const DIAGNOSTICS_DIRECTIVE_NAMES: &[&str] = &[ "ignore-wasm32", "ignore-wasm32-bare", "ignore-windows", + "ignore-windows-gnu", "ignore-x86", + "ignore-x86_64-apple-darwin", "incremental", "known-bug", + "llvm-cov-flags", + "min-cdb-version", + "min-gdb-version", + "min-lldb-version", "min-llvm-version", "needs-asm-support", "needs-dlltool", @@ -742,11 +768,15 @@ const DIAGNOSTICS_DIRECTIVE_NAMES: &[&str] = &[ "needs-profiler-support", "needs-relocation-model-pic", "needs-run-enabled", + "needs-rust-lldb", "needs-sanitizer-address", "needs-sanitizer-cfi", "needs-sanitizer-hwaddress", "needs-sanitizer-leak", "needs-sanitizer-memory", + "needs-sanitizer-memtag", + "needs-sanitizer-safestack", + "needs-sanitizer-shadow-call-stack", "needs-sanitizer-support", "needs-sanitizer-thread", "needs-unwind", @@ -756,23 +786,42 @@ const DIAGNOSTICS_DIRECTIVE_NAMES: &[&str] = &[ "normalize-stderr-64bit", "normalize-stderr-test", "normalize-stdout-test", + "only-16bit", "only-32bit", "only-64bit", "only-aarch64", + "only-arm", + "only-avr", + "only-bpf", + "only-cdb", "only-gnu", "only-i686-pc-windows-msvc", "only-linux", + "only-loongarch64", + "only-loongarch64-unknown-linux-gnu", "only-macos", + "only-mips", + "only-mips64", + "only-msp430", "only-msvc", "only-nightly", + "only-nvptx64", + "only-riscv64", + "only-sparc", + "only-sparc64", + "only-thumb", "only-wasm32", + "only-wasm32-bare", "only-windows", "only-x86", "only-x86_64", + "only-x86_64-fortanix-unknown-sgx", "only-x86_64-pc-windows-msvc", "only-x86_64-unknown-linux-gnu", "pp-exact", + "pretty-compare-only", "pretty-expanded", + "pretty-mode", "regex-error-pattern", "remap-src-base", "revisions", @@ -783,7 +832,10 @@ const DIAGNOSTICS_DIRECTIVE_NAMES: &[&str] = &[ "rustc-env", "rustfix-only-machine-applicable", "should-fail", + "should-ice", "stderr-per-bitwidth", + "unit-test", + "unset-exec-env", "unset-rustc-env", ]; @@ -817,7 +869,7 @@ struct HeaderLine<'ln> { fn iter_header( mode: Mode, - suite: &str, + _suite: &str, poisoned: &mut bool, testfile: &Path, rdr: impl Read, @@ -848,11 +900,7 @@ fn iter_header( } } - let comment = if testfile.extension().is_some_and(|e| e == "rs") { - if mode == Mode::Ui && suite == "ui" { "//@" } else { "//" } - } else { - "#" - }; + let comment = if testfile.extension().is_some_and(|e| e == "rs") { "//@" } else { "#" }; let mut rdr = BufReader::with_capacity(1024, rdr); let mut ln = String::new(); @@ -879,7 +927,7 @@ fn iter_header( // First try to accept `ui_test` style comments } else if let Some((header_revision, directive)) = line_directive(comment, ln) { it(HeaderLine { line_number, original_line, header_revision, directive }); - } else if mode == Mode::Ui && suite == "ui" && !REVISION_MAGIC_COMMENT_RE.is_match(ln) { + } else if !REVISION_MAGIC_COMMENT_RE.is_match(ln) { let Some((_, rest)) = line_directive("//", ln) else { continue; }; @@ -899,7 +947,7 @@ fn iter_header( // directive. We emit an error here to warn the user. *poisoned = true; eprintln!( - "error: detected legacy-style directives in ui test: {}:{}, please use `ui_test`-style directives `//@` instead:{:#?}", + "error: detected legacy-style directives in compiletest test: {}:{}, please use `ui_test`-style directives `//@` instead:{:#?}", testfile.display(), line_number, line_directive("//", ln), @@ -912,7 +960,7 @@ fn iter_header( // directive. We emit an error here to warn the user. *poisoned = true; eprintln!( - "error: detected legacy-style directives in ui test: {}:{}, please use `ui_test`-style directives `//@` instead:{:#?}", + "error: detected legacy-style directives in compiletest test: {}:{}, please use `ui_test`-style directives `//@` instead:{:#?}", testfile.display(), line_number, line_directive("//", ln), @@ -1213,11 +1261,8 @@ pub fn make_test_description( if let Some((_, post)) = original_line.trim_start().split_once("//") { let post = post.trim_start(); - if post.starts_with("ignore-tidy") - && config.mode == Mode::Ui - && config.suite == "ui" - { - // not handled by compiletest under the ui test mode and ui test suite. + if post.starts_with("ignore-tidy") { + // Not handled by compiletest. } else { decision!(cfg::handle_ignore(config, ln)); } diff --git a/src/tools/compiletest/src/header/tests.rs b/src/tools/compiletest/src/header/tests.rs index f76fb406cea2..a01f71a68763 100644 --- a/src/tools/compiletest/src/header/tests.rs +++ b/src/tools/compiletest/src/header/tests.rs @@ -578,12 +578,7 @@ fn ignore_mode() { assert_eq!(config.mode, Mode::from_str(mode).unwrap()); assert_ne!(config.mode, Mode::from_str(other).unwrap()); - if mode == "ui" { - assert!(check_ignore(&config, &format!("//@ ignore-mode-{mode}"))); - assert!(!check_ignore(&config, &format!("//@ ignore-mode-{other}"))); - } else { - assert!(check_ignore(&config, &format!("// ignore-mode-{mode}"))); - assert!(!check_ignore(&config, &format!("// ignore-mode-{other}"))); - } + assert!(check_ignore(&config, &format!("//@ ignore-mode-{mode}"))); + assert!(!check_ignore(&config, &format!("//@ ignore-mode-{other}"))); } } diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index f3e2a940f36c..61211a7d6753 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -2503,8 +2503,11 @@ impl<'test> TestCx<'test> { // overridden by `compile-flags`. rustc.arg("-Copt-level=2"); } - RunPassValgrind | Pretty | DebugInfo | Codegen | Rustdoc | RustdocJson | RunMake - | CodegenUnits | JsDocTest | Assembly => { + Assembly | Codegen => { + rustc.arg("-Cdebug-assertions=no"); + } + RunPassValgrind | Pretty | DebugInfo | Rustdoc | RustdocJson | RunMake + | CodegenUnits | JsDocTest => { // do not use JSON output } } @@ -3938,15 +3941,10 @@ impl<'test> TestCx<'test> { self.props.compare_output_lines_by_subset, ); } else if !expected_fixed.is_empty() { - if self.config.suite == "ui" { - panic!( - "the `//@ run-rustfix` directive wasn't found but a `*.fixed` file was found" - ); - } else { - panic!( - "the `// run-rustfix` directive wasn't found but a `*.fixed` file was found" - ); - } + panic!( + "the `//@ run-rustfix` directive wasn't found but a `*.fixed` \ + file was found" + ); } if errors > 0 { diff --git a/src/tools/miri/src/shims/intrinsics/simd.rs b/src/tools/miri/src/shims/intrinsics/simd.rs index ea2d104694af..ca8773cac14b 100644 --- a/src/tools/miri/src/shims/intrinsics/simd.rs +++ b/src/tools/miri/src/shims/intrinsics/simd.rs @@ -563,9 +563,8 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { let right_idx = src_index.checked_sub(left_len).unwrap(); this.read_immediate(&this.project_index(&right, right_idx)?)? } else { - span_bug!( - this.cur_span(), - "simd_shuffle index {src_index} is out of bounds for 2 vectors of size {left_len}", + throw_ub_format!( + "`simd_shuffle_generic` index {src_index} is out-of-bounds for 2 vectors with length {dest_len}" ); }; this.write_immediate(*val, &dest)?; @@ -604,9 +603,8 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { let right_idx = src_index.checked_sub(left_len).unwrap(); this.read_immediate(&this.project_index(&right, right_idx)?)? } else { - span_bug!( - this.cur_span(), - "simd_shuffle index {src_index} is out of bounds for 2 vectors of size {left_len}", + throw_ub_format!( + "`simd_shuffle` index {src_index} is out-of-bounds for 2 vectors with length {dest_len}" ); }; this.write_immediate(*val, &dest)?; diff --git a/src/tools/miri/tests/fail/intrinsics/simd-extract.rs b/src/tools/miri/tests/fail/intrinsics/simd-extract.rs new file mode 100644 index 000000000000..02b9d30df5e9 --- /dev/null +++ b/src/tools/miri/tests/fail/intrinsics/simd-extract.rs @@ -0,0 +1,8 @@ +#![feature(portable_simd, core_intrinsics)] +use std::simd::*; + +fn main() { + let v = i32x4::splat(0); + let _x: i32 = unsafe { std::intrinsics::simd::simd_extract(v, 4) }; + //~^ERROR: index 4 is out-of-bounds +} diff --git a/src/tools/miri/tests/fail/intrinsics/simd-extract.stderr b/src/tools/miri/tests/fail/intrinsics/simd-extract.stderr new file mode 100644 index 000000000000..dc6b22de4925 --- /dev/null +++ b/src/tools/miri/tests/fail/intrinsics/simd-extract.stderr @@ -0,0 +1,15 @@ +error: Undefined Behavior: `simd_extract` index 4 is out-of-bounds of vector with length 4 + --> $DIR/simd-extract.rs:LL:CC + | +LL | let _x: i32 = unsafe { std::intrinsics::simd::simd_extract(v, 4) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `simd_extract` index 4 is out-of-bounds of vector with length 4 + | + = 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 + = note: BACKTRACE: + = note: inside `main` at $DIR/simd-extract.rs:LL:CC + +note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace + +error: aborting due to 1 previous error + diff --git a/src/tools/miri/tests/fail/tls/tls_static_dealloc.rs b/src/tools/miri/tests/fail/tls/tls_static_dealloc.rs index d47a05d8475c..c72cc8114dac 100644 --- a/src/tools/miri/tests/fail/tls/tls_static_dealloc.rs +++ b/src/tools/miri/tests/fail/tls/tls_static_dealloc.rs @@ -1,8 +1,8 @@ //! Ensure that thread-local statics get deallocated when the thread dies. #![feature(thread_local)] -// FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_refs` lint -#![allow(static_mut_refs)] + +use std::ptr::addr_of; #[thread_local] static mut TLS: u8 = 0; @@ -12,7 +12,7 @@ unsafe impl Send for SendRaw {} fn main() { unsafe { - let dangling_ptr = std::thread::spawn(|| SendRaw(&TLS as *const u8)).join().unwrap(); + let dangling_ptr = std::thread::spawn(|| SendRaw(addr_of!(TLS))).join().unwrap(); let _val = *dangling_ptr.0; //~ ERROR: has been freed } } diff --git a/src/tools/miri/tests/pass/static_mut.rs b/src/tools/miri/tests/pass/static_mut.rs index 6b0c0297726f..1b416cc4e9b0 100644 --- a/src/tools/miri/tests/pass/static_mut.rs +++ b/src/tools/miri/tests/pass/static_mut.rs @@ -1,8 +1,8 @@ +use std::ptr::addr_of; + static mut FOO: i32 = 42; -// FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_refs` lint -#[allow(static_mut_refs)] -static BAR: Foo = Foo(unsafe { &FOO as *const _ }); +static BAR: Foo = Foo(unsafe { addr_of!(FOO) }); #[allow(dead_code)] struct Foo(*const i32); diff --git a/src/tools/miri/tests/pass/tls/tls_static.rs b/src/tools/miri/tests/pass/tls/tls_static.rs index fea5bb1db5e6..8d0e5089d404 100644 --- a/src/tools/miri/tests/pass/tls/tls_static.rs +++ b/src/tools/miri/tests/pass/tls/tls_static.rs @@ -8,9 +8,8 @@ //! test, we also check that thread-locals act as per-thread statics. #![feature(thread_local)] -// FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_refs` lint -#![allow(static_mut_refs)] +use std::ptr::addr_of_mut; use std::thread; #[thread_local] @@ -23,8 +22,8 @@ static mut C: u8 = 0; #[thread_local] static READ_ONLY: u8 = 42; -unsafe fn get_a_ref() -> *mut u8 { - &mut A +unsafe fn get_a_ptr() -> *mut u8 { + addr_of_mut!(A) } struct Sender(*mut u8); @@ -35,12 +34,12 @@ fn main() { let _val = READ_ONLY; let ptr = unsafe { - let x = get_a_ref(); + let x = get_a_ptr(); *x = 5; assert_eq!(A, 5); B = 15; C = 25; - Sender(&mut A) + Sender(addr_of_mut!(A)) }; thread::spawn(move || unsafe { @@ -51,18 +50,18 @@ fn main() { assert_eq!(C, 25); B = 14; C = 24; - let y = get_a_ref(); + let y = get_a_ptr(); assert_eq!(*y, 0); *y = 4; assert_eq!(*ptr.0, 5); assert_eq!(A, 4); - assert_eq!(*get_a_ref(), 4); + assert_eq!(*get_a_ptr(), 4); }) .join() .unwrap(); unsafe { - assert_eq!(*get_a_ref(), 5); + assert_eq!(*get_a_ptr(), 5); assert_eq!(A, 5); assert_eq!(B, 15); assert_eq!(C, 24); diff --git a/src/tools/opt-dist/Cargo.toml b/src/tools/opt-dist/Cargo.toml index eb6f889a6f30..4cb6acb394cc 100644 --- a/src/tools/opt-dist/Cargo.toml +++ b/src/tools/opt-dist/Cargo.toml @@ -5,12 +5,12 @@ edition = "2021" [dependencies] build_helper = { path = "../build_helper" } -env_logger = "0.10" +env_logger = "0.11" log = "0.4" anyhow = { version = "1", features = ["backtrace"] } humantime = "2" humansize = "2" -sysinfo = { version = "0.29", default-features = false } +sysinfo = { version = "0.30", default-features = false } fs_extra = "1" camino = "1" reqwest = { version = "0.11", features = ["blocking"] } @@ -23,4 +23,4 @@ glob = "0.3" tempfile = "3.5" derive_builder = "0.20" clap = { version = "4", features = ["derive"] } -tabled = { version = "0.13", default-features = false, features = ["std"] } +tabled = { version = "0.15", default-features = false, features = ["std"] } diff --git a/src/tools/opt-dist/src/utils/artifact_size.rs b/src/tools/opt-dist/src/utils/artifact_size.rs index 4dc8952b60a4..eb1f6bcf21df 100644 --- a/src/tools/opt-dist/src/utils/artifact_size.rs +++ b/src/tools/opt-dist/src/utils/artifact_size.rs @@ -2,7 +2,7 @@ use std::io::Write; use tabled::builder::Builder; use tabled::settings::object::Columns; -use tabled::settings::style::{BorderChar, Offset}; +use tabled::settings::style::{LineChar, Offset}; use tabled::settings::{Modify, Style}; use crate::environment::Environment; @@ -40,11 +40,11 @@ pub fn print_binary_sizes(env: &Environment) -> anyhow::Result<()> { // Write to GitHub summary if let Ok(summary_path) = std::env::var("GITHUB_STEP_SUMMARY") { let mut builder = Builder::default(); + builder.push_record(vec!["Artifact", "Size"]); for (name, size_formatted) in items { builder.push_record(vec![name, size_formatted]); } - builder.set_header(vec!["Artifact", "Size"]); let mut table = builder.build(); let mut file = std::fs::File::options().append(true).create(true).open(summary_path)?; @@ -52,7 +52,7 @@ pub fn print_binary_sizes(env: &Environment) -> anyhow::Result<()> { file, "# Artifact size\n{}\n", table.with(Style::markdown()).with( - Modify::new(Columns::single(1)).with(BorderChar::horizontal(':', Offset::End(0))), + Modify::new(Columns::single(1)).with(LineChar::horizontal(':', Offset::End(0))), ) )?; } diff --git a/src/tools/opt-dist/src/utils/mod.rs b/src/tools/opt-dist/src/utils/mod.rs index ca1292dd5b86..22b0483c071a 100644 --- a/src/tools/opt-dist/src/utils/mod.rs +++ b/src/tools/opt-dist/src/utils/mod.rs @@ -1,4 +1,4 @@ -use sysinfo::{DiskExt, RefreshKind, System, SystemExt}; +use sysinfo::Disks; use crate::environment::Environment; use crate::timer::Timer; @@ -15,9 +15,9 @@ pub fn format_env_variables() -> String { } pub fn print_free_disk_space() -> anyhow::Result<()> { - let sys = System::new_with_specifics(RefreshKind::default().with_disks_list().with_disks()); - let available_space: u64 = sys.disks().iter().map(|d| d.available_space()).sum(); - let total_space: u64 = sys.disks().iter().map(|d| d.total_space()).sum(); + let disks = Disks::new_with_refreshed_list(); + let available_space: u64 = disks.list().iter().map(|d| d.available_space()).sum(); + let total_space: u64 = disks.list().iter().map(|d| d.total_space()).sum(); let used_space = total_space - available_space; log::info!( diff --git a/src/tools/rustbook/Cargo.toml b/src/tools/rustbook/Cargo.toml index a380a20b1ac0..2ef9004c476e 100644 --- a/src/tools/rustbook/Cargo.toml +++ b/src/tools/rustbook/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" [dependencies] clap = "4.0.32" -env_logger = "0.10" +env_logger = "0.11" [dependencies.mdbook] version = "0.4.37" diff --git a/src/tools/rustfmt/src/parse/parser.rs b/src/tools/rustfmt/src/parse/parser.rs index 31226cf8c307..cca14353b5c1 100644 --- a/src/tools/rustfmt/src/parse/parser.rs +++ b/src/tools/rustfmt/src/parse/parser.rs @@ -163,13 +163,21 @@ impl<'a> Parser<'a> { fn parse_crate_mod(&mut self) -> Result { let mut parser = AssertUnwindSafe(&mut self.parser); - match catch_unwind(move || parser.parse_crate_mod()) { - Ok(Ok(k)) => Ok(k), - Ok(Err(db)) => { + // rustfmt doesn't use `run_compiler` like other tools, so it must emit + // any stashed diagnostics itself, otherwise the `DiagCtxt` will assert + // when dropped. The final result here combines the parsing result and + // the `emit_stashed_diagnostics` result. + let parse_res = catch_unwind(move || parser.parse_crate_mod()); + let stashed_res = self.parser.dcx().emit_stashed_diagnostics(); + let err = Err(ParserError::ParsePanicError); + match (parse_res, stashed_res) { + (Ok(Ok(k)), None) => Ok(k), + (Ok(Ok(_)), Some(_guar)) => err, + (Ok(Err(db)), _) => { db.emit(); - Err(ParserError::ParseError) + err } - Err(_) => Err(ParserError::ParsePanicError), + (Err(_), _) => err, } } } diff --git a/src/tools/rustfmt/src/test/parser.rs b/src/tools/rustfmt/src/test/parser.rs index ae4a4f94d928..da2a2ba62e00 100644 --- a/src/tools/rustfmt/src/test/parser.rs +++ b/src/tools/rustfmt/src/test/parser.rs @@ -55,3 +55,10 @@ fn crate_parsing_errors_on_unclosed_delims() { let filename = "tests/parser/unclosed-delims/issue_4466.rs"; assert_parser_error(filename); } + +#[test] +fn crate_parsing_stashed_diag() { + // See also https://github.com/rust-lang/rust/issues/121450 + let filename = "tests/parser/stashed-diag.rs"; + assert_parser_error(filename); +} diff --git a/src/tools/rustfmt/tests/parser/stashed-diag.rs b/src/tools/rustfmt/tests/parser/stashed-diag.rs new file mode 100644 index 000000000000..3b0b543e6101 --- /dev/null +++ b/src/tools/rustfmt/tests/parser/stashed-diag.rs @@ -0,0 +1,3 @@ +#![u={static N;}] + +fn main() {} diff --git a/src/tools/tidy/src/issues.txt b/src/tools/tidy/src/issues.txt index 81437473b2d2..51af8898470b 100644 --- a/src/tools/tidy/src/issues.txt +++ b/src/tools/tidy/src/issues.txt @@ -3225,7 +3225,6 @@ "ui/nll/user-annotations/issue-55748-pat-types-constrain-bindings.rs", "ui/nll/user-annotations/issue-57731-ascibed-coupled-types.rs", "ui/numbers-arithmetic/issue-105626.rs", -"ui/numbers-arithmetic/issue-8460-const.rs", "ui/numbers-arithmetic/issue-8460.rs", "ui/object-safety/issue-102762.rs", "ui/object-safety/issue-102933.rs", diff --git a/src/tools/tidy/src/target_policy.rs b/src/tools/tidy/src/target_policy.rs index ca6590d1502a..382488e57211 100644 --- a/src/tools/tidy/src/target_policy.rs +++ b/src/tools/tidy/src/target_policy.rs @@ -7,7 +7,7 @@ use std::{collections::HashSet, path::Path}; const TARGET_DEFINITIONS_PATH: &str = "compiler/rustc_target/src/spec/targets/"; const ASSEMBLY_TEST_PATH: &str = "tests/assembly/targets/"; -const REVISION_LINE_START: &str = "// revisions: "; +const REVISION_LINE_START: &str = "//@ revisions: "; const EXCEPTIONS: &[&str] = &[ // FIXME: disabled since it fails on CI saying the csky component is missing "csky_unknown_linux_gnuabiv2", diff --git a/src/tools/tidy/src/target_specific_tests.rs b/src/tools/tidy/src/target_specific_tests.rs index de022be28948..c6136a18bd8c 100644 --- a/src/tools/tidy/src/target_specific_tests.rs +++ b/src/tools/tidy/src/target_specific_tests.rs @@ -6,7 +6,7 @@ use std::path::Path; use crate::walk::filter_not_rust; -const COMMENT: &str = "//"; +const COMMENT: &str = "//@"; const LLVM_COMPONENTS_HEADER: &str = "needs-llvm-components:"; const COMPILE_FLAGS_HEADER: &str = "compile-flags:"; diff --git a/tests/assembly/aarch64-naked-fn-no-bti-prolog.rs b/tests/assembly/aarch64-naked-fn-no-bti-prolog.rs index 79b0bb2d7eea..8ee6f6792e94 100644 --- a/tests/assembly/aarch64-naked-fn-no-bti-prolog.rs +++ b/tests/assembly/aarch64-naked-fn-no-bti-prolog.rs @@ -1,7 +1,7 @@ -// compile-flags: -C no-prepopulate-passes -Zbranch-protection=bti -// assembly-output: emit-asm -// needs-asm-support -// only-aarch64 +//@ compile-flags: -C no-prepopulate-passes -Zbranch-protection=bti +//@ assembly-output: emit-asm +//@ needs-asm-support +//@ only-aarch64 #![crate_type = "lib"] #![feature(naked_functions)] diff --git a/tests/assembly/aarch64-pointer-auth.rs b/tests/assembly/aarch64-pointer-auth.rs index da14cd026780..1e53878a2ccb 100644 --- a/tests/assembly/aarch64-pointer-auth.rs +++ b/tests/assembly/aarch64-pointer-auth.rs @@ -1,9 +1,9 @@ // Test that PAC instructions are emitted when branch-protection is specified. -// assembly-output: emit-asm -// compile-flags: --target aarch64-unknown-linux-gnu -// compile-flags: -Z branch-protection=pac-ret,leaf -// needs-llvm-components: aarch64 +//@ assembly-output: emit-asm +//@ compile-flags: --target aarch64-unknown-linux-gnu +//@ compile-flags: -Z branch-protection=pac-ret,leaf +//@ needs-llvm-components: aarch64 #![feature(no_core, lang_items)] #![no_std] diff --git a/tests/assembly/align_offset.rs b/tests/assembly/align_offset.rs index 116edf62bbed..dbf599a741fd 100644 --- a/tests/assembly/align_offset.rs +++ b/tests/assembly/align_offset.rs @@ -1,6 +1,6 @@ -// assembly-output: emit-asm -// compile-flags: -Copt-level=1 -// only-x86_64 +//@ assembly-output: emit-asm +//@ compile-flags: -Copt-level=1 +//@ only-x86_64 #![crate_type="rlib"] // CHECK-LABEL: align_offset_byte_ptr diff --git a/tests/assembly/asm/aarch64-el2vmsa.rs b/tests/assembly/asm/aarch64-el2vmsa.rs index 1908ffb8ff3f..c217f008c070 100644 --- a/tests/assembly/asm/aarch64-el2vmsa.rs +++ b/tests/assembly/asm/aarch64-el2vmsa.rs @@ -1,6 +1,6 @@ -// assembly-output: emit-asm -// compile-flags: --target aarch64-unknown-linux-gnu -// needs-llvm-components: aarch64 +//@ assembly-output: emit-asm +//@ compile-flags: --target aarch64-unknown-linux-gnu +//@ needs-llvm-components: aarch64 #![feature(no_core, lang_items, rustc_attrs)] #![crate_type = "rlib"] diff --git a/tests/assembly/asm/aarch64-modifiers.rs b/tests/assembly/asm/aarch64-modifiers.rs index 5196aa9fa175..ffba06ae47bb 100644 --- a/tests/assembly/asm/aarch64-modifiers.rs +++ b/tests/assembly/asm/aarch64-modifiers.rs @@ -1,7 +1,7 @@ -// assembly-output: emit-asm -// compile-flags: -O -// compile-flags: --target aarch64-unknown-linux-gnu -// needs-llvm-components: aarch64 +//@ assembly-output: emit-asm +//@ compile-flags: -O +//@ compile-flags: --target aarch64-unknown-linux-gnu +//@ needs-llvm-components: aarch64 #![feature(no_core, lang_items, rustc_attrs)] #![crate_type = "rlib"] diff --git a/tests/assembly/asm/aarch64-outline-atomics.rs b/tests/assembly/asm/aarch64-outline-atomics.rs index c2ec4e911b9d..bcf0964b722a 100644 --- a/tests/assembly/asm/aarch64-outline-atomics.rs +++ b/tests/assembly/asm/aarch64-outline-atomics.rs @@ -1,9 +1,9 @@ -// assembly-output: emit-asm -// compile-flags: -O -// compile-flags: --target aarch64-unknown-linux-gnu -// needs-llvm-components: aarch64 -// only-aarch64 -// only-linux +//@ assembly-output: emit-asm +//@ compile-flags: -O +//@ compile-flags: --target aarch64-unknown-linux-gnu +//@ needs-llvm-components: aarch64 +//@ only-aarch64 +//@ only-linux #![crate_type = "rlib"] diff --git a/tests/assembly/asm/aarch64-types.rs b/tests/assembly/asm/aarch64-types.rs index 66c39a48c6e1..1b2bd4b3d81f 100644 --- a/tests/assembly/asm/aarch64-types.rs +++ b/tests/assembly/asm/aarch64-types.rs @@ -1,6 +1,6 @@ -// assembly-output: emit-asm -// compile-flags: --target aarch64-unknown-linux-gnu -// needs-llvm-components: aarch64 +//@ assembly-output: emit-asm +//@ compile-flags: --target aarch64-unknown-linux-gnu +//@ needs-llvm-components: aarch64 #![feature(no_core, lang_items, rustc_attrs, repr_simd)] #![crate_type = "rlib"] diff --git a/tests/assembly/asm/arm-modifiers.rs b/tests/assembly/asm/arm-modifiers.rs index 88ffeaecfecb..fa2e75eb35b0 100644 --- a/tests/assembly/asm/arm-modifiers.rs +++ b/tests/assembly/asm/arm-modifiers.rs @@ -1,8 +1,8 @@ -// assembly-output: emit-asm -// compile-flags: -O -// compile-flags: --target armv7-unknown-linux-gnueabihf -// compile-flags: -C target-feature=+neon -// needs-llvm-components: arm +//@ assembly-output: emit-asm +//@ compile-flags: -O +//@ compile-flags: --target armv7-unknown-linux-gnueabihf +//@ compile-flags: -C target-feature=+neon +//@ needs-llvm-components: arm #![feature(no_core, lang_items, rustc_attrs, repr_simd)] #![crate_type = "rlib"] diff --git a/tests/assembly/asm/arm-types.rs b/tests/assembly/asm/arm-types.rs index 9520f9327797..280b6d4a2280 100644 --- a/tests/assembly/asm/arm-types.rs +++ b/tests/assembly/asm/arm-types.rs @@ -1,8 +1,8 @@ -// assembly-output: emit-asm -// compile-flags: --target armv7-unknown-linux-gnueabihf -// compile-flags: -C target-feature=+neon -// compile-flags: -C opt-level=0 -// needs-llvm-components: arm +//@ assembly-output: emit-asm +//@ compile-flags: --target armv7-unknown-linux-gnueabihf +//@ compile-flags: -C target-feature=+neon +//@ compile-flags: -C opt-level=0 +//@ needs-llvm-components: arm #![feature(no_core, lang_items, rustc_attrs, repr_simd)] #![crate_type = "rlib"] diff --git a/tests/assembly/asm/avr-modifiers.rs b/tests/assembly/asm/avr-modifiers.rs index ffdc8f2e351d..e94375f95969 100644 --- a/tests/assembly/asm/avr-modifiers.rs +++ b/tests/assembly/asm/avr-modifiers.rs @@ -1,6 +1,6 @@ -// assembly-output: emit-asm -// compile-flags: --target avr-unknown-gnu-atmega328 -// needs-llvm-components: avr +//@ assembly-output: emit-asm +//@ compile-flags: --target avr-unknown-gnu-atmega328 +//@ needs-llvm-components: avr #![feature(no_core, lang_items, rustc_attrs, asm_experimental_arch)] #![crate_type = "rlib"] diff --git a/tests/assembly/asm/avr-types.rs b/tests/assembly/asm/avr-types.rs index b2d11a8826f6..88b16895e8dc 100644 --- a/tests/assembly/asm/avr-types.rs +++ b/tests/assembly/asm/avr-types.rs @@ -1,6 +1,6 @@ -// assembly-output: emit-asm -// compile-flags: --target avr-unknown-gnu-atmega328 -// needs-llvm-components: avr +//@ assembly-output: emit-asm +//@ compile-flags: --target avr-unknown-gnu-atmega328 +//@ needs-llvm-components: avr #![feature(no_core, lang_items, rustc_attrs, asm_experimental_arch)] #![crate_type = "rlib"] diff --git a/tests/assembly/asm/bpf-types.rs b/tests/assembly/asm/bpf-types.rs index e177b8d0dbe5..0a9ec7dd52ba 100644 --- a/tests/assembly/asm/bpf-types.rs +++ b/tests/assembly/asm/bpf-types.rs @@ -1,6 +1,6 @@ -// assembly-output: emit-asm -// compile-flags: --target bpfel-unknown-none -C target_feature=+alu32 -// needs-llvm-components: bpf +//@ assembly-output: emit-asm +//@ compile-flags: --target bpfel-unknown-none -C target_feature=+alu32 +//@ needs-llvm-components: bpf #![feature(no_core, lang_items, rustc_attrs, repr_simd, asm_experimental_arch)] #![crate_type = "rlib"] diff --git a/tests/assembly/asm/global_asm.rs b/tests/assembly/asm/global_asm.rs index 36f017cf9d60..8f824563e8ae 100644 --- a/tests/assembly/asm/global_asm.rs +++ b/tests/assembly/asm/global_asm.rs @@ -1,8 +1,8 @@ -// only-x86_64 -// only-linux -// assembly-output: emit-asm -// compile-flags: -C llvm-args=--x86-asm-syntax=intel -// compile-flags: -C symbol-mangling-version=v0 +//@ only-x86_64 +//@ only-linux +//@ assembly-output: emit-asm +//@ compile-flags: -C llvm-args=--x86-asm-syntax=intel +//@ compile-flags: -C symbol-mangling-version=v0 #![feature(asm_const)] #![crate_type = "rlib"] diff --git a/tests/assembly/asm/hexagon-types.rs b/tests/assembly/asm/hexagon-types.rs index af16faedbc4a..269c7582a1ce 100644 --- a/tests/assembly/asm/hexagon-types.rs +++ b/tests/assembly/asm/hexagon-types.rs @@ -1,6 +1,6 @@ -// assembly-output: emit-asm -// compile-flags: --target hexagon-unknown-linux-musl -// needs-llvm-components: hexagon +//@ assembly-output: emit-asm +//@ compile-flags: --target hexagon-unknown-linux-musl +//@ needs-llvm-components: hexagon #![feature(no_core, lang_items, rustc_attrs, repr_simd, asm_experimental_arch)] #![crate_type = "rlib"] diff --git a/tests/assembly/asm/inline-asm-avx.rs b/tests/assembly/asm/inline-asm-avx.rs index c2875f3e0a44..7e52a798dedb 100644 --- a/tests/assembly/asm/inline-asm-avx.rs +++ b/tests/assembly/asm/inline-asm-avx.rs @@ -1,7 +1,7 @@ -// assembly-output: emit-asm -// compile-flags: --crate-type=lib -// only-x86_64 -// ignore-sgx +//@ assembly-output: emit-asm +//@ compile-flags: --crate-type=lib +//@ only-x86_64 +//@ ignore-sgx #![feature(portable_simd)] diff --git a/tests/assembly/asm/loongarch-type.rs b/tests/assembly/asm/loongarch-type.rs index 4aeecf92d865..e4c46cfcf81b 100644 --- a/tests/assembly/asm/loongarch-type.rs +++ b/tests/assembly/asm/loongarch-type.rs @@ -1,6 +1,6 @@ -// assembly-output: emit-asm -// compile-flags: --target loongarch64-unknown-linux-gnu -// needs-llvm-components: loongarch +//@ assembly-output: emit-asm +//@ compile-flags: --target loongarch64-unknown-linux-gnu +//@ needs-llvm-components: loongarch #![feature(no_core, lang_items, rustc_attrs, asm_experimental_arch)] #![crate_type = "rlib"] diff --git a/tests/assembly/asm/m68k-types.rs b/tests/assembly/asm/m68k-types.rs index 0322e615a197..b3e86b709c3d 100644 --- a/tests/assembly/asm/m68k-types.rs +++ b/tests/assembly/asm/m68k-types.rs @@ -1,6 +1,6 @@ -// assembly-output: emit-asm -// compile-flags: --target m68k-unknown-linux-gnu -// needs-llvm-components: m68k +//@ assembly-output: emit-asm +//@ compile-flags: --target m68k-unknown-linux-gnu +//@ needs-llvm-components: m68k #![feature(no_core, lang_items, rustc_attrs, asm_experimental_arch)] #![crate_type = "rlib"] diff --git a/tests/assembly/asm/mips-types.rs b/tests/assembly/asm/mips-types.rs index 27469b22980a..bd62f4a5236c 100644 --- a/tests/assembly/asm/mips-types.rs +++ b/tests/assembly/asm/mips-types.rs @@ -1,9 +1,9 @@ -// revisions: mips32 mips64 -// assembly-output: emit-asm -//[mips32] compile-flags: --target mips-unknown-linux-gnu -//[mips32] needs-llvm-components: mips -//[mips64] compile-flags: --target mips64-unknown-linux-gnuabi64 -//[mips64] needs-llvm-components: mips +//@ revisions: mips32 mips64 +//@ assembly-output: emit-asm +//@[mips32] compile-flags: --target mips-unknown-linux-gnu +//@[mips32] needs-llvm-components: mips +//@[mips64] compile-flags: --target mips64-unknown-linux-gnuabi64 +//@[mips64] needs-llvm-components: mips #![feature(no_core, lang_items, rustc_attrs, repr_simd, asm_experimental_arch)] #![crate_type = "rlib"] diff --git a/tests/assembly/asm/msp430-types.rs b/tests/assembly/asm/msp430-types.rs index 2c73b3b098de..4f51d4020a66 100644 --- a/tests/assembly/asm/msp430-types.rs +++ b/tests/assembly/asm/msp430-types.rs @@ -1,6 +1,6 @@ -// assembly-output: emit-asm -// compile-flags: --target msp430-none-elf -// needs-llvm-components: msp430 +//@ assembly-output: emit-asm +//@ compile-flags: --target msp430-none-elf +//@ needs-llvm-components: msp430 #![feature(no_core, lang_items, rustc_attrs, asm_experimental_arch, asm_const)] #![crate_type = "rlib"] diff --git a/tests/assembly/asm/nvptx-types.rs b/tests/assembly/asm/nvptx-types.rs index c319946b5f5c..0dd3162b4c02 100644 --- a/tests/assembly/asm/nvptx-types.rs +++ b/tests/assembly/asm/nvptx-types.rs @@ -1,7 +1,7 @@ -// assembly-output: emit-asm -// compile-flags: --target nvptx64-nvidia-cuda -// compile-flags: --crate-type cdylib -// needs-llvm-components: nvptx +//@ assembly-output: emit-asm +//@ compile-flags: --target nvptx64-nvidia-cuda +//@ compile-flags: --crate-type cdylib +//@ needs-llvm-components: nvptx #![feature(no_core, lang_items, rustc_attrs, asm_experimental_arch)] #![no_core] diff --git a/tests/assembly/asm/powerpc-types.rs b/tests/assembly/asm/powerpc-types.rs index e27b00520683..bc8af08ad113 100644 --- a/tests/assembly/asm/powerpc-types.rs +++ b/tests/assembly/asm/powerpc-types.rs @@ -1,9 +1,9 @@ -// revisions: powerpc powerpc64 -// assembly-output: emit-asm -//[powerpc] compile-flags: --target powerpc-unknown-linux-gnu -//[powerpc] needs-llvm-components: powerpc -//[powerpc64] compile-flags: --target powerpc64-unknown-linux-gnu -//[powerpc64] needs-llvm-components: powerpc +//@ revisions: powerpc powerpc64 +//@ assembly-output: emit-asm +//@[powerpc] compile-flags: --target powerpc-unknown-linux-gnu +//@[powerpc] needs-llvm-components: powerpc +//@[powerpc64] compile-flags: --target powerpc64-unknown-linux-gnu +//@[powerpc64] needs-llvm-components: powerpc #![feature(no_core, lang_items, rustc_attrs, repr_simd, asm_experimental_arch)] #![crate_type = "rlib"] diff --git a/tests/assembly/asm/riscv-types.rs b/tests/assembly/asm/riscv-types.rs index f18ba294d0cf..0d1f8305d375 100644 --- a/tests/assembly/asm/riscv-types.rs +++ b/tests/assembly/asm/riscv-types.rs @@ -1,10 +1,10 @@ -// revisions: riscv64 riscv32 -// assembly-output: emit-asm -//[riscv64] compile-flags: --target riscv64imac-unknown-none-elf -//[riscv64] needs-llvm-components: riscv -//[riscv32] compile-flags: --target riscv32imac-unknown-none-elf -//[riscv32] needs-llvm-components: riscv -// compile-flags: -C target-feature=+d +//@ revisions: riscv64 riscv32 +//@ assembly-output: emit-asm +//@[riscv64] compile-flags: --target riscv64imac-unknown-none-elf +//@[riscv64] needs-llvm-components: riscv +//@[riscv32] compile-flags: --target riscv32imac-unknown-none-elf +//@[riscv32] needs-llvm-components: riscv +//@ compile-flags: -C target-feature=+d #![feature(no_core, lang_items, rustc_attrs)] #![crate_type = "rlib"] diff --git a/tests/assembly/asm/s390x-types.rs b/tests/assembly/asm/s390x-types.rs index c39a82c3b1c4..661907360bd2 100644 --- a/tests/assembly/asm/s390x-types.rs +++ b/tests/assembly/asm/s390x-types.rs @@ -1,7 +1,7 @@ -// revisions: s390x -// assembly-output: emit-asm -//[s390x] compile-flags: --target s390x-unknown-linux-gnu -//[s390x] needs-llvm-components: systemz +//@ revisions: s390x +//@ assembly-output: emit-asm +//@[s390x] compile-flags: --target s390x-unknown-linux-gnu +//@[s390x] needs-llvm-components: systemz #![feature(no_core, lang_items, rustc_attrs, repr_simd, asm_experimental_arch)] #![crate_type = "rlib"] diff --git a/tests/assembly/asm/wasm-types.rs b/tests/assembly/asm/wasm-types.rs index 3b1ac1b455ad..fe5ce836bc6e 100644 --- a/tests/assembly/asm/wasm-types.rs +++ b/tests/assembly/asm/wasm-types.rs @@ -1,7 +1,7 @@ -// assembly-output: emit-asm -// compile-flags: --target wasm32-unknown-unknown -// compile-flags: --crate-type cdylib -// needs-llvm-components: webassembly +//@ assembly-output: emit-asm +//@ compile-flags: --target wasm32-unknown-unknown +//@ compile-flags: --crate-type cdylib +//@ needs-llvm-components: webassembly #![feature(no_core, lang_items, rustc_attrs, asm_experimental_arch)] #![no_core] diff --git a/tests/assembly/asm/x86-modifiers.rs b/tests/assembly/asm/x86-modifiers.rs index 574fdf12cd04..1a92585298d9 100644 --- a/tests/assembly/asm/x86-modifiers.rs +++ b/tests/assembly/asm/x86-modifiers.rs @@ -1,12 +1,12 @@ -// revisions: x86_64 i686 -// assembly-output: emit-asm -// compile-flags: -O -//[x86_64] compile-flags: --target x86_64-unknown-linux-gnu -//[x86_64] needs-llvm-components: x86 -//[i686] compile-flags: --target i686-unknown-linux-gnu -//[i686] needs-llvm-components: x86 -// compile-flags: -C llvm-args=--x86-asm-syntax=intel -// compile-flags: -C target-feature=+avx512bw +//@ revisions: x86_64 i686 +//@ assembly-output: emit-asm +//@ compile-flags: -O +//@[x86_64] compile-flags: --target x86_64-unknown-linux-gnu +//@[x86_64] needs-llvm-components: x86 +//@[i686] compile-flags: --target i686-unknown-linux-gnu +//@[i686] needs-llvm-components: x86 +//@ compile-flags: -C llvm-args=--x86-asm-syntax=intel +//@ compile-flags: -C target-feature=+avx512bw #![feature(no_core, lang_items, rustc_attrs)] #![crate_type = "rlib"] diff --git a/tests/assembly/asm/x86-types.rs b/tests/assembly/asm/x86-types.rs index 81be79cbaac1..2b4ebb05349b 100644 --- a/tests/assembly/asm/x86-types.rs +++ b/tests/assembly/asm/x86-types.rs @@ -1,11 +1,11 @@ -// revisions: x86_64 i686 -// assembly-output: emit-asm -//[x86_64] compile-flags: --target x86_64-unknown-linux-gnu -//[x86_64] needs-llvm-components: x86 -//[i686] compile-flags: --target i686-unknown-linux-gnu -//[i686] needs-llvm-components: x86 -// compile-flags: -C llvm-args=--x86-asm-syntax=intel -// compile-flags: -C target-feature=+avx512bw +//@ revisions: x86_64 i686 +//@ assembly-output: emit-asm +//@[x86_64] compile-flags: --target x86_64-unknown-linux-gnu +//@[x86_64] needs-llvm-components: x86 +//@[i686] compile-flags: --target i686-unknown-linux-gnu +//@[i686] needs-llvm-components: x86 +//@ compile-flags: -C llvm-args=--x86-asm-syntax=intel +//@ compile-flags: -C target-feature=+avx512bw #![feature(no_core, lang_items, rustc_attrs, repr_simd)] #![crate_type = "rlib"] diff --git a/tests/assembly/closure-inherit-target-feature.rs b/tests/assembly/closure-inherit-target-feature.rs index 7acda76e25f0..cafe9e7ca6fa 100644 --- a/tests/assembly/closure-inherit-target-feature.rs +++ b/tests/assembly/closure-inherit-target-feature.rs @@ -1,8 +1,8 @@ -// only-x86_64 -// ignore-sgx Tests incompatible with LVI mitigations -// assembly-output: emit-asm +//@ only-x86_64 +//@ ignore-sgx Tests incompatible with LVI mitigations +//@ assembly-output: emit-asm // make sure the feature is not enabled at compile-time -// compile-flags: -C opt-level=3 -C target-feature=-sse4.1 -C llvm-args=-x86-asm-syntax=intel +//@ compile-flags: -C opt-level=3 -C target-feature=-sse4.1 -C llvm-args=-x86-asm-syntax=intel #![feature(target_feature_11)] #![crate_type = "rlib"] diff --git a/tests/assembly/dwarf4.rs b/tests/assembly/dwarf4.rs index 6e1584458b6c..22be8e5603f2 100644 --- a/tests/assembly/dwarf4.rs +++ b/tests/assembly/dwarf4.rs @@ -1,7 +1,7 @@ // Makes sure that `-Z dwarf-version=4` causes `rustc` to emit DWARF version 4. -// assembly-output: emit-asm -// compile-flags: -g --target x86_64-unknown-linux-gnu -Z dwarf-version=4 -Copt-level=0 -// needs-llvm-components: x86 +//@ assembly-output: emit-asm +//@ compile-flags: -g --target x86_64-unknown-linux-gnu -Z dwarf-version=4 -Copt-level=0 +//@ needs-llvm-components: x86 #![feature(no_core, lang_items)] #![crate_type = "rlib"] diff --git a/tests/assembly/dwarf5.rs b/tests/assembly/dwarf5.rs index 46d4e84b41bf..35f2716e9fa9 100644 --- a/tests/assembly/dwarf5.rs +++ b/tests/assembly/dwarf5.rs @@ -1,7 +1,7 @@ // Makes sure that `-Z dwarf-version=5` causes `rustc` to emit DWARF version 5. -// assembly-output: emit-asm -// compile-flags: -g --target x86_64-unknown-linux-gnu -Z dwarf-version=5 -Copt-level=0 -// needs-llvm-components: x86 +//@ assembly-output: emit-asm +//@ compile-flags: -g --target x86_64-unknown-linux-gnu -Z dwarf-version=5 -Copt-level=0 +//@ needs-llvm-components: x86 #![feature(no_core, lang_items)] #![crate_type = "rlib"] diff --git a/tests/assembly/is_aligned.rs b/tests/assembly/is_aligned.rs index c4a7823ce1ad..9d637793f874 100644 --- a/tests/assembly/is_aligned.rs +++ b/tests/assembly/is_aligned.rs @@ -1,9 +1,9 @@ -// assembly-output: emit-asm -// only-x86_64 -// ignore-sgx -// revisions: opt-speed opt-size -// [opt-speed] compile-flags: -Copt-level=2 -Cdebug-assertions=no -// [opt-size] compile-flags: -Copt-level=s -Cdebug-assertions=no +//@ assembly-output: emit-asm +//@ only-x86_64 +//@ ignore-sgx +//@ revisions: opt-speed opt-size +//@ [opt-speed] compile-flags: -Copt-level=2 -Cdebug-assertions=no +//@ [opt-size] compile-flags: -Copt-level=s -Cdebug-assertions=no #![crate_type="rlib"] #![feature(core_intrinsics)] diff --git a/tests/assembly/libs/issue-115339-zip-arrays.rs b/tests/assembly/libs/issue-115339-zip-arrays.rs index 26b7b9770bc8..956459b2c773 100644 --- a/tests/assembly/libs/issue-115339-zip-arrays.rs +++ b/tests/assembly/libs/issue-115339-zip-arrays.rs @@ -1,8 +1,8 @@ -// assembly-output: emit-asm +//@ assembly-output: emit-asm // # zen3 previously exhibited odd vectorization -// compile-flags: --crate-type=lib -Ctarget-cpu=znver3 -O -// only-x86_64 -// ignore-sgx +//@ compile-flags: --crate-type=lib -Ctarget-cpu=znver3 -O +//@ only-x86_64 +//@ ignore-sgx use std::iter; diff --git a/tests/assembly/niche-prefer-zero.rs b/tests/assembly/niche-prefer-zero.rs index 0ab37a618daa..4e260ebc09bc 100644 --- a/tests/assembly/niche-prefer-zero.rs +++ b/tests/assembly/niche-prefer-zero.rs @@ -1,8 +1,8 @@ // Check that niche selection prefers zero and that jumps are optimized away. // See https://github.com/rust-lang/rust/pull/87794 -// assembly-output: emit-asm -// only-x86 -// compile-flags: -Copt-level=3 +//@ assembly-output: emit-asm +//@ only-x86 +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/assembly/nvptx-arch-default.rs b/tests/assembly/nvptx-arch-default.rs index 8a71a6370f11..bac09574f17c 100644 --- a/tests/assembly/nvptx-arch-default.rs +++ b/tests/assembly/nvptx-arch-default.rs @@ -1,11 +1,11 @@ -// assembly-output: ptx-linker -// compile-flags: --crate-type cdylib -// only-nvptx64 -// ignore-nvptx64 +//@ assembly-output: ptx-linker +//@ compile-flags: --crate-type cdylib +//@ only-nvptx64 +//@ ignore-nvptx64 #![no_std] -// aux-build: breakpoint-panic-handler.rs +//@ aux-build: breakpoint-panic-handler.rs extern crate breakpoint_panic_handler; // Verify default target arch with ptx-linker. diff --git a/tests/assembly/nvptx-arch-emit-asm.rs b/tests/assembly/nvptx-arch-emit-asm.rs index b252b450fa77..d24035cc8314 100644 --- a/tests/assembly/nvptx-arch-emit-asm.rs +++ b/tests/assembly/nvptx-arch-emit-asm.rs @@ -1,7 +1,7 @@ -// assembly-output: emit-asm -// compile-flags: --crate-type rlib -// only-nvptx64 -// ignore-nvptx64 +//@ assembly-output: emit-asm +//@ compile-flags: --crate-type rlib +//@ only-nvptx64 +//@ ignore-nvptx64 #![no_std] diff --git a/tests/assembly/nvptx-arch-link-arg.rs b/tests/assembly/nvptx-arch-link-arg.rs index 025a9ad49877..3432e6161bf1 100644 --- a/tests/assembly/nvptx-arch-link-arg.rs +++ b/tests/assembly/nvptx-arch-link-arg.rs @@ -1,11 +1,11 @@ -// assembly-output: ptx-linker -// compile-flags: --crate-type cdylib -C link-arg=--arch=sm_60 -// only-nvptx64 -// ignore-nvptx64 +//@ assembly-output: ptx-linker +//@ compile-flags: --crate-type cdylib -C link-arg=--arch=sm_60 +//@ only-nvptx64 +//@ ignore-nvptx64 #![no_std] -// aux-build: breakpoint-panic-handler.rs +//@ aux-build: breakpoint-panic-handler.rs extern crate breakpoint_panic_handler; // Verify target arch override via `link-arg`. diff --git a/tests/assembly/nvptx-arch-target-cpu.rs b/tests/assembly/nvptx-arch-target-cpu.rs index 824ee9cd8973..212af20f4dea 100644 --- a/tests/assembly/nvptx-arch-target-cpu.rs +++ b/tests/assembly/nvptx-arch-target-cpu.rs @@ -1,11 +1,11 @@ -// assembly-output: ptx-linker -// compile-flags: --crate-type cdylib -C target-cpu=sm_50 -// only-nvptx64 -// ignore-nvptx64 +//@ assembly-output: ptx-linker +//@ compile-flags: --crate-type cdylib -C target-cpu=sm_50 +//@ only-nvptx64 +//@ ignore-nvptx64 #![no_std] -// aux-build: breakpoint-panic-handler.rs +//@ aux-build: breakpoint-panic-handler.rs extern crate breakpoint_panic_handler; // Verify target arch override via `target-cpu`. diff --git a/tests/assembly/nvptx-atomics.rs b/tests/assembly/nvptx-atomics.rs index f96398064492..52b8c86d8a9c 100644 --- a/tests/assembly/nvptx-atomics.rs +++ b/tests/assembly/nvptx-atomics.rs @@ -1,14 +1,14 @@ -// assembly-output: ptx-linker -// compile-flags: --crate-type cdylib -// only-nvptx64 -// ignore-nvptx64 +//@ assembly-output: ptx-linker +//@ compile-flags: --crate-type cdylib +//@ only-nvptx64 +//@ ignore-nvptx64 #![feature(abi_ptx, core_intrinsics)] #![no_std] use core::intrinsics::*; -// aux-build: breakpoint-panic-handler.rs +//@ aux-build: breakpoint-panic-handler.rs extern crate breakpoint_panic_handler; // Currently, LLVM NVPTX backend can only emit atomic instructions with diff --git a/tests/assembly/nvptx-internalizing.rs b/tests/assembly/nvptx-internalizing.rs index 0004fcea7a20..0acfd5c24431 100644 --- a/tests/assembly/nvptx-internalizing.rs +++ b/tests/assembly/nvptx-internalizing.rs @@ -1,15 +1,15 @@ -// assembly-output: ptx-linker -// compile-flags: --crate-type cdylib -// only-nvptx64 -// ignore-nvptx64 +//@ assembly-output: ptx-linker +//@ compile-flags: --crate-type cdylib +//@ only-nvptx64 +//@ ignore-nvptx64 #![feature(abi_ptx)] #![no_std] -// aux-build: breakpoint-panic-handler.rs +//@ aux-build: breakpoint-panic-handler.rs extern crate breakpoint_panic_handler; -// aux-build: non-inline-dependency.rs +//@ aux-build: non-inline-dependency.rs extern crate non_inline_dependency as dep; // Verify that no extra function declarations are present. diff --git a/tests/assembly/nvptx-kernel-abi/nvptx-kernel-args-abi-v7.rs b/tests/assembly/nvptx-kernel-abi/nvptx-kernel-args-abi-v7.rs index 5bf44f949fdf..a42d5dd3569d 100644 --- a/tests/assembly/nvptx-kernel-abi/nvptx-kernel-args-abi-v7.rs +++ b/tests/assembly/nvptx-kernel-abi/nvptx-kernel-args-abi-v7.rs @@ -1,7 +1,7 @@ -// assembly-output: ptx-linker -// compile-flags: --crate-type cdylib -C target-cpu=sm_86 -// only-nvptx64 -// ignore-nvptx64 +//@ assembly-output: ptx-linker +//@ compile-flags: --crate-type cdylib -C target-cpu=sm_86 +//@ only-nvptx64 +//@ ignore-nvptx64 // The following ABI tests are made with nvcc 11.6 does. // diff --git a/tests/assembly/nvptx-linking-binary.rs b/tests/assembly/nvptx-linking-binary.rs index 64b9c2f17aa7..3b50b472ab10 100644 --- a/tests/assembly/nvptx-linking-binary.rs +++ b/tests/assembly/nvptx-linking-binary.rs @@ -1,16 +1,16 @@ -// assembly-output: ptx-linker -// compile-flags: --crate-type bin -// only-nvptx64 -// ignore-nvptx64 +//@ assembly-output: ptx-linker +//@ compile-flags: --crate-type bin +//@ only-nvptx64 +//@ ignore-nvptx64 #![feature(abi_ptx)] #![no_main] #![no_std] -// aux-build: breakpoint-panic-handler.rs +//@ aux-build: breakpoint-panic-handler.rs extern crate breakpoint_panic_handler; -// aux-build: non-inline-dependency.rs +//@ aux-build: non-inline-dependency.rs extern crate non_inline_dependency as dep; // Make sure declarations are there. diff --git a/tests/assembly/nvptx-linking-cdylib.rs b/tests/assembly/nvptx-linking-cdylib.rs index bdbc30ea97fe..9742e26fb31a 100644 --- a/tests/assembly/nvptx-linking-cdylib.rs +++ b/tests/assembly/nvptx-linking-cdylib.rs @@ -1,15 +1,15 @@ -// assembly-output: ptx-linker -// compile-flags: --crate-type cdylib -// only-nvptx64 -// ignore-nvptx64 +//@ assembly-output: ptx-linker +//@ compile-flags: --crate-type cdylib +//@ only-nvptx64 +//@ ignore-nvptx64 #![feature(abi_ptx)] #![no_std] -// aux-build: breakpoint-panic-handler.rs +//@ aux-build: breakpoint-panic-handler.rs extern crate breakpoint_panic_handler; -// aux-build: non-inline-dependency.rs +//@ aux-build: non-inline-dependency.rs extern crate non_inline_dependency as dep; // Make sure declarations are there. diff --git a/tests/assembly/nvptx-safe-naming.rs b/tests/assembly/nvptx-safe-naming.rs index 80bb04fc0f2f..59fd527be3c7 100644 --- a/tests/assembly/nvptx-safe-naming.rs +++ b/tests/assembly/nvptx-safe-naming.rs @@ -1,12 +1,12 @@ -// assembly-output: ptx-linker -// compile-flags: --crate-type cdylib -// only-nvptx64 -// ignore-nvptx64 +//@ assembly-output: ptx-linker +//@ compile-flags: --crate-type cdylib +//@ only-nvptx64 +//@ ignore-nvptx64 #![feature(abi_ptx)] #![no_std] -// aux-build: breakpoint-panic-handler.rs +//@ aux-build: breakpoint-panic-handler.rs extern crate breakpoint_panic_handler; // Verify function name doesn't contain unacceaptable characters. diff --git a/tests/assembly/option-nonzero-eq.rs b/tests/assembly/option-nonzero-eq.rs index f5d88de76ddf..b04cf63fd783 100644 --- a/tests/assembly/option-nonzero-eq.rs +++ b/tests/assembly/option-nonzero-eq.rs @@ -1,11 +1,10 @@ -// revisions: WIN LIN -// [WIN] only-windows -// [LIN] only-linux -// assembly-output: emit-asm -// compile-flags: --crate-type=lib -O -C llvm-args=-x86-asm-syntax=intel -// only-x86_64 -// ignore-sgx -// ignore-debug +//@ revisions: WIN LIN +//@ [WIN] only-windows +//@ [LIN] only-linux +//@ assembly-output: emit-asm +//@ compile-flags: --crate-type=lib -O -C llvm-args=-x86-asm-syntax=intel +//@ only-x86_64 +//@ ignore-sgx use std::cmp::Ordering; diff --git a/tests/assembly/panic-no-unwind-no-uwtable.rs b/tests/assembly/panic-no-unwind-no-uwtable.rs index 499d4e698671..24626280155a 100644 --- a/tests/assembly/panic-no-unwind-no-uwtable.rs +++ b/tests/assembly/panic-no-unwind-no-uwtable.rs @@ -1,6 +1,6 @@ -// assembly-output: emit-asm -// only-x86_64-unknown-linux-gnu -// compile-flags: -C panic=unwind -C force-unwind-tables=n -O +//@ assembly-output: emit-asm +//@ only-x86_64-unknown-linux-gnu +//@ compile-flags: -C panic=unwind -C force-unwind-tables=n -O #![crate_type = "lib"] diff --git a/tests/assembly/panic-unwind-no-uwtable.rs b/tests/assembly/panic-unwind-no-uwtable.rs index 8eed72b2fca6..181656a89872 100644 --- a/tests/assembly/panic-unwind-no-uwtable.rs +++ b/tests/assembly/panic-unwind-no-uwtable.rs @@ -1,6 +1,6 @@ -// assembly-output: emit-asm -// only-x86_64-unknown-linux-gnu -// compile-flags: -C panic=unwind -C force-unwind-tables=n +//@ assembly-output: emit-asm +//@ only-x86_64-unknown-linux-gnu +//@ compile-flags: -C panic=unwind -C force-unwind-tables=n #![crate_type = "lib"] diff --git a/tests/assembly/pic-relocation-model.rs b/tests/assembly/pic-relocation-model.rs index 72471ffcdb0c..453fd6a70476 100644 --- a/tests/assembly/pic-relocation-model.rs +++ b/tests/assembly/pic-relocation-model.rs @@ -1,7 +1,7 @@ -// revisions: x64 -// assembly-output: emit-asm -// [x64] compile-flags: --target x86_64-unknown-linux-gnu -Crelocation-model=pic -// [x64] needs-llvm-components: x86 +//@ revisions: x64 +//@ assembly-output: emit-asm +//@ [x64] compile-flags: --target x86_64-unknown-linux-gnu -Crelocation-model=pic +//@ [x64] needs-llvm-components: x86 #![feature(no_core, lang_items)] diff --git a/tests/assembly/pie-relocation-model.rs b/tests/assembly/pie-relocation-model.rs index e40797e038d4..6ff6b7708bbf 100644 --- a/tests/assembly/pie-relocation-model.rs +++ b/tests/assembly/pie-relocation-model.rs @@ -1,7 +1,7 @@ -// revisions: x64 -// assembly-output: emit-asm -// [x64] compile-flags: --target x86_64-unknown-linux-gnu -Crelocation-model=pie -// [x64] needs-llvm-components: x86 +//@ revisions: x64 +//@ assembly-output: emit-asm +//@ [x64] compile-flags: --target x86_64-unknown-linux-gnu -Crelocation-model=pie +//@ [x64] needs-llvm-components: x86 #![feature(no_core, lang_items)] diff --git a/tests/assembly/slice-is_ascii.rs b/tests/assembly/slice-is_ascii.rs index 124121164674..3a050347d898 100644 --- a/tests/assembly/slice-is_ascii.rs +++ b/tests/assembly/slice-is_ascii.rs @@ -1,11 +1,10 @@ -// revisions: WIN LIN -// [WIN] only-windows -// [LIN] only-linux -// assembly-output: emit-asm -// compile-flags: --crate-type=lib -O -C llvm-args=-x86-asm-syntax=intel -// only-x86_64 -// ignore-sgx -// ignore-debug +//@ revisions: WIN LIN +//@ [WIN] only-windows +//@ [LIN] only-linux +//@ assembly-output: emit-asm +//@ compile-flags: --crate-type=lib -O -C llvm-args=-x86-asm-syntax=intel +//@ only-x86_64 +//@ ignore-sgx #![feature(str_internals)] diff --git a/tests/assembly/sparc-struct-abi.rs b/tests/assembly/sparc-struct-abi.rs index 6309dd420ffa..3a254f179641 100644 --- a/tests/assembly/sparc-struct-abi.rs +++ b/tests/assembly/sparc-struct-abi.rs @@ -2,9 +2,9 @@ // - float structure members are passes in floating point registers // (#86163) -// assembly-output: emit-asm -// needs-llvm-components: sparc -// compile-flags: --target=sparcv9-sun-solaris -Copt-level=3 +//@ assembly-output: emit-asm +//@ needs-llvm-components: sparc +//@ compile-flags: --target=sparcv9-sun-solaris -Copt-level=3 #![crate_type = "lib"] #![feature(no_core, lang_items)] #![no_core] diff --git a/tests/assembly/stack-probes.rs b/tests/assembly/stack-probes.rs index 6466df3ff7d6..ddabd4b1632a 100644 --- a/tests/assembly/stack-probes.rs +++ b/tests/assembly/stack-probes.rs @@ -1,12 +1,12 @@ -// revisions: x86_64 i686 aarch64 -// assembly-output: emit-asm -//[x86_64] compile-flags: --target x86_64-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel -//[x86_64] needs-llvm-components: x86 -//[i686] compile-flags: --target i686-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel -//[i686] needs-llvm-components: x86 -//[aarch64] compile-flags: --target aarch64-unknown-linux-gnu -//[aarch64] needs-llvm-components: aarch64 -//[aarch64] min-llvm-version: 18 +//@ revisions: x86_64 i686 aarch64 +//@ assembly-output: emit-asm +//@[x86_64] compile-flags: --target x86_64-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel +//@[x86_64] needs-llvm-components: x86 +//@[i686] compile-flags: --target i686-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel +//@[i686] needs-llvm-components: x86 +//@[aarch64] compile-flags: --target aarch64-unknown-linux-gnu +//@[aarch64] needs-llvm-components: aarch64 +//@[aarch64] min-llvm-version: 18 #![feature(no_core, lang_items)] #![crate_type = "lib"] diff --git a/tests/assembly/stack-protector/stack-protector-heuristics-effect-windows-32bit.rs b/tests/assembly/stack-protector/stack-protector-heuristics-effect-windows-32bit.rs index fca2c85d5a62..12339cb4415c 100644 --- a/tests/assembly/stack-protector/stack-protector-heuristics-effect-windows-32bit.rs +++ b/tests/assembly/stack-protector/stack-protector-heuristics-effect-windows-32bit.rs @@ -1,13 +1,13 @@ -// revisions: all strong basic none missing -// assembly-output: emit-asm -// only-windows -// only-msvc -// ignore-64bit 64-bit table based SEH has slightly different behaviors than classic SEH -// [all] compile-flags: -Z stack-protector=all -// [strong] compile-flags: -Z stack-protector=strong -// [basic] compile-flags: -Z stack-protector=basic -// [none] compile-flags: -Z stack-protector=none -// compile-flags: -C opt-level=2 -Z merge-functions=disabled +//@ revisions: all strong basic none missing +//@ assembly-output: emit-asm +//@ only-windows +//@ only-msvc +//@ ignore-64bit 64-bit table based SEH has slightly different behaviors than classic SEH +//@ [all] compile-flags: -Z stack-protector=all +//@ [strong] compile-flags: -Z stack-protector=strong +//@ [basic] compile-flags: -Z stack-protector=basic +//@ [none] compile-flags: -Z stack-protector=none +//@ compile-flags: -C opt-level=2 -Z merge-functions=disabled #![crate_type = "lib"] diff --git a/tests/assembly/stack-protector/stack-protector-heuristics-effect-windows-64bit.rs b/tests/assembly/stack-protector/stack-protector-heuristics-effect-windows-64bit.rs index d9abf554a92d..46c775112519 100644 --- a/tests/assembly/stack-protector/stack-protector-heuristics-effect-windows-64bit.rs +++ b/tests/assembly/stack-protector/stack-protector-heuristics-effect-windows-64bit.rs @@ -1,13 +1,13 @@ -// revisions: all strong basic none missing -// assembly-output: emit-asm -// only-windows -// only-msvc -// ignore-32bit 64-bit table based SEH has slightly different behaviors than classic SEH -// [all] compile-flags: -Z stack-protector=all -// [strong] compile-flags: -Z stack-protector=strong -// [basic] compile-flags: -Z stack-protector=basic -// [none] compile-flags: -Z stack-protector=none -// compile-flags: -C opt-level=2 -Z merge-functions=disabled +//@ revisions: all strong basic none missing +//@ assembly-output: emit-asm +//@ only-windows +//@ only-msvc +//@ ignore-32bit 64-bit table based SEH has slightly different behaviors than classic SEH +//@ [all] compile-flags: -Z stack-protector=all +//@ [strong] compile-flags: -Z stack-protector=strong +//@ [basic] compile-flags: -Z stack-protector=basic +//@ [none] compile-flags: -Z stack-protector=none +//@ compile-flags: -C opt-level=2 -Z merge-functions=disabled #![crate_type = "lib"] diff --git a/tests/assembly/stack-protector/stack-protector-heuristics-effect.rs b/tests/assembly/stack-protector/stack-protector-heuristics-effect.rs index ca566b6e46ae..e63adc88ff50 100644 --- a/tests/assembly/stack-protector/stack-protector-heuristics-effect.rs +++ b/tests/assembly/stack-protector/stack-protector-heuristics-effect.rs @@ -1,15 +1,15 @@ -// revisions: all strong basic none missing -// assembly-output: emit-asm -// ignore-macos slightly different policy on stack protection of arrays -// ignore-msvc stack check code uses different function names -// ignore-nvptx64 stack protector is not supported -// ignore-wasm32-bare -// [all] compile-flags: -Z stack-protector=all -// [strong] compile-flags: -Z stack-protector=strong -// [basic] compile-flags: -Z stack-protector=basic -// [none] compile-flags: -Z stack-protector=none -// compile-flags: -C opt-level=2 -Z merge-functions=disabled -// min-llvm-version: 17.0.2 +//@ revisions: all strong basic none missing +//@ assembly-output: emit-asm +//@ ignore-macos slightly different policy on stack protection of arrays +//@ ignore-msvc stack check code uses different function names +//@ ignore-nvptx64 stack protector is not supported +//@ ignore-wasm32-bare +//@ [all] compile-flags: -Z stack-protector=all +//@ [strong] compile-flags: -Z stack-protector=strong +//@ [basic] compile-flags: -Z stack-protector=basic +//@ [none] compile-flags: -Z stack-protector=none +//@ compile-flags: -C opt-level=2 -Z merge-functions=disabled +//@ min-llvm-version: 17.0.2 #![crate_type = "lib"] diff --git a/tests/assembly/stack-protector/stack-protector-target-support.rs b/tests/assembly/stack-protector/stack-protector-target-support.rs index 6d87fd1912b0..5fa93b3617ed 100644 --- a/tests/assembly/stack-protector/stack-protector-target-support.rs +++ b/tests/assembly/stack-protector/stack-protector-target-support.rs @@ -1,182 +1,182 @@ // Test that stack smash protection code is emitted for all tier1 and tier2 // targets, with the exception of nvptx64-nvidia-cuda // -// revisions: r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15 r16 r17 r18 r19 r20 r21 r22 r23 -// revisions: r24 r25 r26 r27 r28 r29 r30 r31 r32 r33 r35 r36 r37 r38 r39 r40 r41 r42 r43 r44 -// revisions: r45 r46 r47 r48 r49 r50 r51 r52 r53 r54 r55 r56 r57 r58 r59 r60 r61 r62 r63 r64 r65 -// revisions: r66 r67 r68 r69 r70 r71 r72 r73 r74 r75 r76 r77 r78 r79 r80 r81 r82 r83 r84 -// assembly-output: emit-asm -// [r1] compile-flags: --target aarch64-unknown-linux-gnu -// [r1] needs-llvm-components: aarch64 -// [r2] compile-flags: --target i686-pc-windows-gnu -// [r2] needs-llvm-components: x86 -// [r3] compile-flags: --target i686-pc-windows-msvc -// [r3] needs-llvm-components: x86 -// [r4] compile-flags: --target i686-unknown-linux-gnu -// [r4] needs-llvm-components: x86 -// [r5] compile-flags: --target x86_64-apple-darwin -// [r5] needs-llvm-components: x86 -// [r6] compile-flags: --target x86_64-pc-windows-gnu -// [r6] needs-llvm-components: x86 -// [r7] compile-flags: --target x86_64-pc-windows-msvc -// [r7] needs-llvm-components: x86 -// [r8] compile-flags: --target x86_64-unknown-linux-gnu -// [r8] needs-llvm-components: x86 -// [r9] compile-flags: --target aarch64-apple-darwin -// [r9] needs-llvm-components: aarch64 -// [r10] compile-flags: --target aarch64-apple-ios -// [r10] needs-llvm-components: aarch64 -// [r11] compile-flags: --target aarch64-unknown-fuchsia -// [r11] needs-llvm-components: aarch64 -// [r12] compile-flags: --target aarch64-linux-android -// [r12] needs-llvm-components: aarch64 -// [r13] compile-flags: --target aarch64-pc-windows-msvc -// [r13] needs-llvm-components: aarch64 -// [r14] compile-flags: --target aarch64-unknown-linux-musl -// [r14] needs-llvm-components: aarch64 -// [r15] compile-flags: --target aarch64-unknown-none -// [r15] needs-llvm-components: aarch64 -// [r16] compile-flags: --target aarch64-unknown-none-softfloat -// [r16] needs-llvm-components: aarch64 -// [r17] compile-flags: --target arm-linux-androideabi -// [r17] needs-llvm-components: arm -// [r18] compile-flags: --target arm-unknown-linux-gnueabi -// [r18] needs-llvm-components: arm -// [r19] compile-flags: --target arm-unknown-linux-gnueabihf -// [r19] needs-llvm-components: arm -// [r20] compile-flags: --target arm-unknown-linux-musleabi -// [r20] needs-llvm-components: arm -// [r21] compile-flags: --target arm-unknown-linux-musleabihf -// [r21] needs-llvm-components: arm -// [r22] compile-flags: --target armebv7r-none-eabi -// [r22] needs-llvm-components: arm -// [r23] compile-flags: --target armebv7r-none-eabihf -// [r23] needs-llvm-components: arm -// [r24] compile-flags: --target armv5te-unknown-linux-gnueabi -// [r24] needs-llvm-components: arm -// [r25] compile-flags: --target armv5te-unknown-linux-musleabi -// [r25] needs-llvm-components: arm -// [r26] compile-flags: --target armv7-linux-androideabi -// [r26] needs-llvm-components: arm -// [r27] compile-flags: --target armv7a-none-eabi -// [r27] needs-llvm-components: arm -// [r28] compile-flags: --target armv7r-none-eabi -// [r28] needs-llvm-components: arm -// [r29] compile-flags: --target armv7r-none-eabihf -// [r29] needs-llvm-components: arm -// [r30] compile-flags: --target armv7-unknown-linux-gnueabi -// [r30] needs-llvm-components: arm -// [r31] compile-flags: --target armv7-unknown-linux-gnueabihf -// [r31] needs-llvm-components: arm -// [r32] compile-flags: --target armv7-unknown-linux-musleabi -// [r32] needs-llvm-components: arm -// [r33] compile-flags: --target armv7-unknown-linux-musleabihf -// [r33] needs-llvm-components: arm +//@ revisions: r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15 r16 r17 r18 r19 r20 r21 r22 r23 +//@ revisions: r24 r25 r26 r27 r28 r29 r30 r31 r32 r33 r35 r36 r37 r38 r39 r40 r41 r42 r43 r44 +//@ revisions: r45 r46 r47 r48 r49 r50 r51 r52 r53 r54 r55 r56 r57 r58 r59 r60 r61 r62 r63 r64 r65 +//@ revisions: r66 r67 r68 r69 r70 r71 r72 r73 r74 r75 r76 r77 r78 r79 r80 r81 r82 r83 r84 r85 +//@ assembly-output: emit-asm +//@ [r1] compile-flags: --target aarch64-unknown-linux-gnu +//@ [r1] needs-llvm-components: aarch64 +//@ [r2] compile-flags: --target i686-pc-windows-gnu +//@ [r2] needs-llvm-components: x86 +//@ [r3] compile-flags: --target i686-pc-windows-msvc +//@ [r3] needs-llvm-components: x86 +//@ [r4] compile-flags: --target i686-unknown-linux-gnu +//@ [r4] needs-llvm-components: x86 +//@ [r5] compile-flags: --target x86_64-apple-darwin +//@ [r5] needs-llvm-components: x86 +//@ [r6] compile-flags: --target x86_64-pc-windows-gnu +//@ [r6] needs-llvm-components: x86 +//@ [r7] compile-flags: --target x86_64-pc-windows-msvc +//@ [r7] needs-llvm-components: x86 +//@ [r8] compile-flags: --target x86_64-unknown-linux-gnu +//@ [r8] needs-llvm-components: x86 +//@ [r9] compile-flags: --target aarch64-apple-darwin +//@ [r9] needs-llvm-components: aarch64 +//@ [r10] compile-flags: --target aarch64-apple-ios +//@ [r10] needs-llvm-components: aarch64 +//@ [r11] compile-flags: --target aarch64-unknown-fuchsia +//@ [r11] needs-llvm-components: aarch64 +//@ [r12] compile-flags: --target aarch64-linux-android +//@ [r12] needs-llvm-components: aarch64 +//@ [r13] compile-flags: --target aarch64-pc-windows-msvc +//@ [r13] needs-llvm-components: aarch64 +//@ [r14] compile-flags: --target aarch64-unknown-linux-musl +//@ [r14] needs-llvm-components: aarch64 +//@ [r15] compile-flags: --target aarch64-unknown-none +//@ [r15] needs-llvm-components: aarch64 +//@ [r16] compile-flags: --target aarch64-unknown-none-softfloat +//@ [r16] needs-llvm-components: aarch64 +//@ [r17] compile-flags: --target arm-linux-androideabi +//@ [r17] needs-llvm-components: arm +//@ [r18] compile-flags: --target arm-unknown-linux-gnueabi +//@ [r18] needs-llvm-components: arm +//@ [r19] compile-flags: --target arm-unknown-linux-gnueabihf +//@ [r19] needs-llvm-components: arm +//@ [r20] compile-flags: --target arm-unknown-linux-musleabi +//@ [r20] needs-llvm-components: arm +//@ [r21] compile-flags: --target arm-unknown-linux-musleabihf +//@ [r21] needs-llvm-components: arm +//@ [r22] compile-flags: --target armebv7r-none-eabi +//@ [r22] needs-llvm-components: arm +//@ [r23] compile-flags: --target armebv7r-none-eabihf +//@ [r23] needs-llvm-components: arm +//@ [r24] compile-flags: --target armv5te-unknown-linux-gnueabi +//@ [r24] needs-llvm-components: arm +//@ [r25] compile-flags: --target armv5te-unknown-linux-musleabi +//@ [r25] needs-llvm-components: arm +//@ [r26] compile-flags: --target armv7-linux-androideabi +//@ [r26] needs-llvm-components: arm +//@ [r27] compile-flags: --target armv7a-none-eabi +//@ [r27] needs-llvm-components: arm +//@ [r28] compile-flags: --target armv7r-none-eabi +//@ [r28] needs-llvm-components: arm +//@ [r29] compile-flags: --target armv7r-none-eabihf +//@ [r29] needs-llvm-components: arm +//@ [r30] compile-flags: --target armv7-unknown-linux-gnueabi +//@ [r30] needs-llvm-components: arm +//@ [r31] compile-flags: --target armv7-unknown-linux-gnueabihf +//@ [r31] needs-llvm-components: arm +//@ [r32] compile-flags: --target armv7-unknown-linux-musleabi +//@ [r32] needs-llvm-components: arm +//@ [r33] compile-flags: --target armv7-unknown-linux-musleabihf +//@ [r33] needs-llvm-components: arm -// [r35] compile-flags: --target i586-pc-windows-msvc -// [r35] needs-llvm-components: x86 -// [r36] compile-flags: --target i586-unknown-linux-gnu -// [r36] needs-llvm-components: x86 -// [r37] compile-flags: --target i586-unknown-linux-musl -// [r37] needs-llvm-components: x86 -// [r38] compile-flags: --target i686-linux-android -// [r38] needs-llvm-components: x86 -// [r39] compile-flags: --target i686-unknown-freebsd -// [r39] needs-llvm-components: x86 -// [r40] compile-flags: --target i686-unknown-linux-musl -// [r40] needs-llvm-components: x86 -// [r41] compile-flags: --target mips-unknown-linux-gnu -// [r41] needs-llvm-components: mips -// [r42] compile-flags: --target mips-unknown-linux-musl -// [r42] needs-llvm-components: mips -// [r43] compile-flags: --target mips64-unknown-linux-gnuabi64 -// [r43] needs-llvm-components: mips -// [r44] compile-flags: --target mips64-unknown-linux-muslabi64 -// [r44] needs-llvm-components: mips -// [r45] compile-flags: --target mips64el-unknown-linux-gnuabi64 -// [r45] needs-llvm-components: mips -// [r46] compile-flags: --target mips64el-unknown-linux-muslabi64 -// [r46] needs-llvm-components: mips -// [r47] compile-flags: --target mipsel-unknown-linux-gnu -// [r47] needs-llvm-components: mips -// [r48] compile-flags: --target mipsel-unknown-linux-musl -// [r48] needs-llvm-components: mips -// [r49] compile-flags: --target nvptx64-nvidia-cuda -// [r49] needs-llvm-components: nvptx -// [r50] compile-flags: --target powerpc-unknown-linux-gnu -// [r50] needs-llvm-components: powerpc -// [r51] compile-flags: --target powerpc64-unknown-linux-gnu -// [r51] needs-llvm-components: powerpc -// [r52] compile-flags: --target powerpc64le-unknown-linux-gnu -// [r52] needs-llvm-components: powerpc -// [r53] compile-flags: --target riscv32i-unknown-none-elf -// [r53] needs-llvm-components: riscv -// [r54] compile-flags: --target riscv32imac-unknown-none-elf -// [r54] needs-llvm-components: riscv -// [r55] compile-flags:--target riscv32imc-unknown-none-elf -// [r55] needs-llvm-components: riscv -// [r56] compile-flags:--target riscv64gc-unknown-linux-gnu -// [r56] needs-llvm-components: riscv -// [r57] compile-flags:--target riscv64gc-unknown-none-elf -// [r57] needs-llvm-components: riscv -// [r58] compile-flags:--target riscv64imac-unknown-none-elf -// [r58] needs-llvm-components: riscv -// [r59] compile-flags:--target s390x-unknown-linux-gnu -// [r59] needs-llvm-components: systemz -// [r60] compile-flags:--target sparc64-unknown-linux-gnu -// [r60] needs-llvm-components: sparc -// [r61] compile-flags:--target sparcv9-sun-solaris -// [r61] needs-llvm-components: sparc -// [r62] compile-flags:--target thumbv6m-none-eabi -// [r62] needs-llvm-components: arm -// [r63] compile-flags:--target thumbv7em-none-eabi -// [r63] needs-llvm-components: arm -// [r64] compile-flags:--target thumbv7em-none-eabihf -// [r64] needs-llvm-components: arm -// [r65] compile-flags:--target thumbv7m-none-eabi -// [r65] needs-llvm-components: arm -// [r66] compile-flags:--target thumbv7neon-linux-androideabi -// [r66] needs-llvm-components: arm -// [r67] compile-flags:--target thumbv7neon-unknown-linux-gnueabihf -// [r67] needs-llvm-components: arm -// [r68] compile-flags:--target thumbv8m.base-none-eabi -// [r68] needs-llvm-components: arm -// [r69] compile-flags:--target thumbv8m.main-none-eabi -// [r69] needs-llvm-components: arm -// [r70] compile-flags:--target thumbv8m.main-none-eabihf -// [r70] needs-llvm-components: arm -// [r71] compile-flags:--target wasm32-unknown-emscripten -// [r71] needs-llvm-components: webassembly -// [r72] compile-flags:--target wasm32-unknown-unknown -// [r72] needs-llvm-components: webassembly -// [r73] compile-flags:--target wasm32-wasi -// [r73] needs-llvm-components: webassembly -// [r74] compile-flags:--target wasm32-wasi-preview1-threads -// [r74] needs-llvm-components: webassembly -// [r75] compile-flags:--target x86_64-apple-ios -// [r75] needs-llvm-components: x86 -// [r76] compile-flags:--target x86_64-fortanix-unknown-sgx -// [r76] needs-llvm-components: x86 -// [r77] compile-flags:--target x86_64-unknown-fuchsia -// [r77] needs-llvm-components: x86 -// [r78] compile-flags:--target x86_64-linux-android -// [r78] needs-llvm-components: x86 -// [r79] compile-flags:--target x86_64-pc-solaris -// [r79] needs-llvm-components: x86 -// [r80] compile-flags:--target x86_64-unknown-freebsd -// [r80] needs-llvm-components: x86 -// [r81] compile-flags:--target x86_64-unknown-illumos -// [r81] needs-llvm-components: x86 -// [r82] compile-flags:--target x86_64-unknown-linux-gnux32 -// [r82] needs-llvm-components: x86 -// [r83] compile-flags:--target x86_64-unknown-linux-musl -// [r83] needs-llvm-components: x86 -// [r84] compile-flags:--target x86_64-unknown-netbsd -// [r84] needs-llvm-components: x86 -// [r85] compile-flags: --target x86_64-unknown-redox -// [r85] needs-llvm-components: x86 -// compile-flags: -Z stack-protector=all -// compile-flags: -C opt-level=2 +//@ [r35] compile-flags: --target i586-pc-windows-msvc +//@ [r35] needs-llvm-components: x86 +//@ [r36] compile-flags: --target i586-unknown-linux-gnu +//@ [r36] needs-llvm-components: x86 +//@ [r37] compile-flags: --target i586-unknown-linux-musl +//@ [r37] needs-llvm-components: x86 +//@ [r38] compile-flags: --target i686-linux-android +//@ [r38] needs-llvm-components: x86 +//@ [r39] compile-flags: --target i686-unknown-freebsd +//@ [r39] needs-llvm-components: x86 +//@ [r40] compile-flags: --target i686-unknown-linux-musl +//@ [r40] needs-llvm-components: x86 +//@ [r41] compile-flags: --target mips-unknown-linux-gnu +//@ [r41] needs-llvm-components: mips +//@ [r42] compile-flags: --target mips-unknown-linux-musl +//@ [r42] needs-llvm-components: mips +//@ [r43] compile-flags: --target mips64-unknown-linux-gnuabi64 +//@ [r43] needs-llvm-components: mips +//@ [r44] compile-flags: --target mips64-unknown-linux-muslabi64 +//@ [r44] needs-llvm-components: mips +//@ [r45] compile-flags: --target mips64el-unknown-linux-gnuabi64 +//@ [r45] needs-llvm-components: mips +//@ [r46] compile-flags: --target mips64el-unknown-linux-muslabi64 +//@ [r46] needs-llvm-components: mips +//@ [r47] compile-flags: --target mipsel-unknown-linux-gnu +//@ [r47] needs-llvm-components: mips +//@ [r48] compile-flags: --target mipsel-unknown-linux-musl +//@ [r48] needs-llvm-components: mips +//@ [r49] compile-flags: --target nvptx64-nvidia-cuda +//@ [r49] needs-llvm-components: nvptx +//@ [r50] compile-flags: --target powerpc-unknown-linux-gnu +//@ [r50] needs-llvm-components: powerpc +//@ [r51] compile-flags: --target powerpc64-unknown-linux-gnu +//@ [r51] needs-llvm-components: powerpc +//@ [r52] compile-flags: --target powerpc64le-unknown-linux-gnu +//@ [r52] needs-llvm-components: powerpc +//@ [r53] compile-flags: --target riscv32i-unknown-none-elf +//@ [r53] needs-llvm-components: riscv +//@ [r54] compile-flags: --target riscv32imac-unknown-none-elf +//@ [r54] needs-llvm-components: riscv +//@ [r55] compile-flags:--target riscv32imc-unknown-none-elf +//@ [r55] needs-llvm-components: riscv +//@ [r56] compile-flags:--target riscv64gc-unknown-linux-gnu +//@ [r56] needs-llvm-components: riscv +//@ [r57] compile-flags:--target riscv64gc-unknown-none-elf +//@ [r57] needs-llvm-components: riscv +//@ [r58] compile-flags:--target riscv64imac-unknown-none-elf +//@ [r58] needs-llvm-components: riscv +//@ [r59] compile-flags:--target s390x-unknown-linux-gnu +//@ [r59] needs-llvm-components: systemz +//@ [r60] compile-flags:--target sparc64-unknown-linux-gnu +//@ [r60] needs-llvm-components: sparc +//@ [r61] compile-flags:--target sparcv9-sun-solaris +//@ [r61] needs-llvm-components: sparc +//@ [r62] compile-flags:--target thumbv6m-none-eabi +//@ [r62] needs-llvm-components: arm +//@ [r63] compile-flags:--target thumbv7em-none-eabi +//@ [r63] needs-llvm-components: arm +//@ [r64] compile-flags:--target thumbv7em-none-eabihf +//@ [r64] needs-llvm-components: arm +//@ [r65] compile-flags:--target thumbv7m-none-eabi +//@ [r65] needs-llvm-components: arm +//@ [r66] compile-flags:--target thumbv7neon-linux-androideabi +//@ [r66] needs-llvm-components: arm +//@ [r67] compile-flags:--target thumbv7neon-unknown-linux-gnueabihf +//@ [r67] needs-llvm-components: arm +//@ [r68] compile-flags:--target thumbv8m.base-none-eabi +//@ [r68] needs-llvm-components: arm +//@ [r69] compile-flags:--target thumbv8m.main-none-eabi +//@ [r69] needs-llvm-components: arm +//@ [r70] compile-flags:--target thumbv8m.main-none-eabihf +//@ [r70] needs-llvm-components: arm +//@ [r71] compile-flags:--target wasm32-unknown-emscripten +//@ [r71] needs-llvm-components: webassembly +//@ [r72] compile-flags:--target wasm32-unknown-unknown +//@ [r72] needs-llvm-components: webassembly +//@ [r73] compile-flags:--target wasm32-wasi +//@ [r73] needs-llvm-components: webassembly +//@ [r74] compile-flags:--target wasm32-wasi-preview1-threads +//@ [r74] needs-llvm-components: webassembly +//@ [r75] compile-flags:--target x86_64-apple-ios +//@ [r75] needs-llvm-components: x86 +//@ [r76] compile-flags:--target x86_64-fortanix-unknown-sgx +//@ [r76] needs-llvm-components: x86 +//@ [r77] compile-flags:--target x86_64-unknown-fuchsia +//@ [r77] needs-llvm-components: x86 +//@ [r78] compile-flags:--target x86_64-linux-android +//@ [r78] needs-llvm-components: x86 +//@ [r79] compile-flags:--target x86_64-pc-solaris +//@ [r79] needs-llvm-components: x86 +//@ [r80] compile-flags:--target x86_64-unknown-freebsd +//@ [r80] needs-llvm-components: x86 +//@ [r81] compile-flags:--target x86_64-unknown-illumos +//@ [r81] needs-llvm-components: x86 +//@ [r82] compile-flags:--target x86_64-unknown-linux-gnux32 +//@ [r82] needs-llvm-components: x86 +//@ [r83] compile-flags:--target x86_64-unknown-linux-musl +//@ [r83] needs-llvm-components: x86 +//@ [r84] compile-flags:--target x86_64-unknown-netbsd +//@ [r84] needs-llvm-components: x86 +//@ [r85] compile-flags: --target x86_64-unknown-redox +//@ [r85] needs-llvm-components: x86 +//@ compile-flags: -Z stack-protector=all +//@ compile-flags: -C opt-level=2 #![crate_type = "lib"] @@ -283,4 +283,5 @@ pub fn foo() { // r82: __stack_chk_fail // r83: __stack_chk_fail // r84: __stack_chk_fail + // r85: __stack_chk_fail } diff --git a/tests/assembly/static-relocation-model.rs b/tests/assembly/static-relocation-model.rs index 41aa9a46103e..50527b853451 100644 --- a/tests/assembly/static-relocation-model.rs +++ b/tests/assembly/static-relocation-model.rs @@ -1,12 +1,11 @@ -// revisions: x64 A64 ppc64le -// assembly-output: emit-asm -// [x64] compile-flags: --target x86_64-unknown-linux-gnu -Crelocation-model=static -// [x64] needs-llvm-components: x86 -// [A64] compile-flags: --target aarch64-unknown-linux-gnu -Crelocation-model=static -// [A64] needs-llvm-components: aarch64 -// [ppc64le] compile-flags: --target powerpc64le-unknown-linux-gnu -Crelocation-model=static -// [ppc64le] needs-llvm-components: powerpc -// ignore-debug: alignment checks insert panics that we don't have a lang item for +//@ revisions: x64 A64 ppc64le +//@ assembly-output: emit-asm +//@ [x64] compile-flags: --target x86_64-unknown-linux-gnu -Crelocation-model=static +//@ [x64] needs-llvm-components: x86 +//@ [A64] compile-flags: --target aarch64-unknown-linux-gnu -Crelocation-model=static +//@ [A64] needs-llvm-components: aarch64 +//@ [ppc64le] compile-flags: --target powerpc64le-unknown-linux-gnu -Crelocation-model=static +//@ [ppc64le] needs-llvm-components: powerpc #![feature(no_core, lang_items)] #![no_core] diff --git a/tests/assembly/strict_provenance.rs b/tests/assembly/strict_provenance.rs index ef8566a93e28..1a7976709629 100644 --- a/tests/assembly/strict_provenance.rs +++ b/tests/assembly/strict_provenance.rs @@ -1,7 +1,7 @@ -// assembly-output: emit-asm -// compile-flags: -Copt-level=1 -// only-x86_64 -// ignore-sgx +//@ assembly-output: emit-asm +//@ compile-flags: -Copt-level=1 +//@ only-x86_64 +//@ ignore-sgx #![crate_type = "rlib"] // CHECK-LABEL: old_style diff --git a/tests/assembly/target-feature-multiple.rs b/tests/assembly/target-feature-multiple.rs index 5c5d93863d71..83c385686476 100644 --- a/tests/assembly/target-feature-multiple.rs +++ b/tests/assembly/target-feature-multiple.rs @@ -1,9 +1,9 @@ -// assembly-output: emit-asm -// needs-llvm-components: x86 -// revisions: TWOFLAGS SINGLEFLAG -// compile-flags: --target=x86_64-unknown-linux-gnu -// [TWOFLAGS] compile-flags: -C target-feature=+rdrnd -C target-feature=+rdseed -// [SINGLEFLAG] compile-flags: -C target-feature=+rdrnd,+rdseed +//@ assembly-output: emit-asm +//@ needs-llvm-components: x86 +//@ revisions: TWOFLAGS SINGLEFLAG +//@ compile-flags: --target=x86_64-unknown-linux-gnu +//@ [TWOFLAGS] compile-flags: -C target-feature=+rdrnd -C target-feature=+rdseed +//@ [SINGLEFLAG] compile-flags: -C target-feature=+rdrnd,+rdseed // Target features set via flags aren't necessarily reflected in the IR, so the only way to test // them is to build code that requires the features to be enabled to work. diff --git a/tests/assembly/targets/targets-elf.rs b/tests/assembly/targets/targets-elf.rs index 6105ea430ddd..0d8f1bc60252 100644 --- a/tests/assembly/targets/targets-elf.rs +++ b/tests/assembly/targets/targets-elf.rs @@ -1,182 +1,182 @@ -// assembly-output: emit-asm +//@ assembly-output: emit-asm // ignore-tidy-linelength -// revisions: aarch64_be_unknown_linux_gnu -// [aarch64_be_unknown_linux_gnu] compile-flags: --target aarch64_be-unknown-linux-gnu -// [aarch64_be_unknown_linux_gnu] needs-llvm-components: aarch64 -// revisions: aarch64_be_unknown_linux_gnu_ilp32 -// [aarch64_be_unknown_linux_gnu_ilp32] compile-flags: --target aarch64_be-unknown-linux-gnu_ilp32 -// [aarch64_be_unknown_linux_gnu_ilp32] needs-llvm-components: aarch64 -// revisions: aarch64_be_unknown_netbsd -// [aarch64_be_unknown_netbsd] compile-flags: --target aarch64_be-unknown-netbsd -// [aarch64_be_unknown_netbsd] needs-llvm-components: aarch64 -// revisions: aarch64_fuchsia -// [aarch64_fuchsia] compile-flags: --target aarch64-fuchsia -// [aarch64_fuchsia] needs-llvm-components: aarch64 -// revisions: aarch64_kmc_solid_asp3 -// [aarch64_kmc_solid_asp3] compile-flags: --target aarch64-kmc-solid_asp3 -// [aarch64_kmc_solid_asp3] needs-llvm-components: aarch64 -// revisions: aarch64_linux_android -// [aarch64_linux_android] compile-flags: --target aarch64-linux-android -// [aarch64_linux_android] needs-llvm-components: aarch64 -// revisions: aarch64_nintendo_switch_freestanding -// [aarch64_nintendo_switch_freestanding] compile-flags: --target aarch64-nintendo-switch-freestanding -// [aarch64_nintendo_switch_freestanding] needs-llvm-components: aarch64 -// revisions: aarch64_unknown_freebsd -// [aarch64_unknown_freebsd] compile-flags: --target aarch64-unknown-freebsd -// [aarch64_unknown_freebsd] needs-llvm-components: aarch64 -// revisions: aarch64_unknown_fuchsia -// [aarch64_unknown_fuchsia] compile-flags: --target aarch64-unknown-fuchsia -// [aarch64_unknown_fuchsia] needs-llvm-components: aarch64 -// revisions: aarch64_unknown_hermit -// [aarch64_unknown_hermit] compile-flags: --target aarch64-unknown-hermit -// [aarch64_unknown_hermit] needs-llvm-components: aarch64 -// revisions: aarch64_unknown_illumos -// [aarch64_unknown_illumos] compile-flags: --target aarch64-unknown-illumos -// [aarch64_unknown_illumos] needs-llvm-components: aarch64 -// revisions: aarch64_unknown_linux_gnu -// [aarch64_unknown_linux_gnu] compile-flags: --target aarch64-unknown-linux-gnu -// [aarch64_unknown_linux_gnu] needs-llvm-components: aarch64 -// revisions: aarch64_unknown_linux_gnu_ilp32 -// [aarch64_unknown_linux_gnu_ilp32] compile-flags: --target aarch64-unknown-linux-gnu_ilp32 -// [aarch64_unknown_linux_gnu_ilp32] needs-llvm-components: aarch64 -// revisions: aarch64_unknown_linux_musl -// [aarch64_unknown_linux_musl] compile-flags: --target aarch64-unknown-linux-musl -// [aarch64_unknown_linux_musl] needs-llvm-components: aarch64 -// revisions: aarch64_unknown_linux_ohos -// [aarch64_unknown_linux_ohos] compile-flags: --target aarch64-unknown-linux-ohos -// [aarch64_unknown_linux_ohos] needs-llvm-components: aarch64 -// revisions: aarch64_unknown_netbsd -// [aarch64_unknown_netbsd] compile-flags: --target aarch64-unknown-netbsd -// [aarch64_unknown_netbsd] needs-llvm-components: aarch64 -// revisions: aarch64_unknown_none -// [aarch64_unknown_none] compile-flags: --target aarch64-unknown-none -// [aarch64_unknown_none] needs-llvm-components: aarch64 -// revisions: aarch64_unknown_none_softfloat -// [aarch64_unknown_none_softfloat] compile-flags: --target aarch64-unknown-none-softfloat -// [aarch64_unknown_none_softfloat] needs-llvm-components: aarch64 -// revisions: aarch64_unknown_nto_qnx_710 -// [aarch64_unknown_nto_qnx_710] compile-flags: --target aarch64-unknown-nto-qnx710 -// [aarch64_unknown_nto_qnx_710] needs-llvm-components: aarch64 -// revisions: aarch64_unknown_openbsd -// [aarch64_unknown_openbsd] compile-flags: --target aarch64-unknown-openbsd -// [aarch64_unknown_openbsd] needs-llvm-components: aarch64 -// revisions: aarch64_unknown_redox -// [aarch64_unknown_redox] compile-flags: --target aarch64-unknown-redox -// [aarch64_unknown_redox] needs-llvm-components: aarch64 -// revisions: aarch64_unknown_teeos -// [aarch64_unknown_teeos] compile-flags: --target aarch64-unknown-teeos -// [aarch64_unknown_teeos] needs-llvm-components: aarch64 -// revisions: aarch64_wrs_vxworks -// [aarch64_wrs_vxworks] compile-flags: --target aarch64-wrs-vxworks -// [aarch64_wrs_vxworks] needs-llvm-components: aarch64 -// revisions: arm_linux_androideabi -// [arm_linux_androideabi] compile-flags: --target arm-linux-androideabi -// [arm_linux_androideabi] needs-llvm-components: arm -// revisions: arm_unknown_linux_gnueabi -// [arm_unknown_linux_gnueabi] compile-flags: --target arm-unknown-linux-gnueabi -// [arm_unknown_linux_gnueabi] needs-llvm-components: arm -// revisions: arm_unknown_linux_gnueabihf -// [arm_unknown_linux_gnueabihf] compile-flags: --target arm-unknown-linux-gnueabihf -// [arm_unknown_linux_gnueabihf] needs-llvm-components: arm -// revisions: arm_unknown_linux_musleabi -// [arm_unknown_linux_musleabi] compile-flags: --target arm-unknown-linux-musleabi -// [arm_unknown_linux_musleabi] needs-llvm-components: arm -// revisions: arm_unknown_linux_musleabihf -// [arm_unknown_linux_musleabihf] compile-flags: --target arm-unknown-linux-musleabihf -// [arm_unknown_linux_musleabihf] needs-llvm-components: arm -// revisions: armeb_unknown_linux_gnueabi -// [armeb_unknown_linux_gnueabi] compile-flags: --target armeb-unknown-linux-gnueabi -// [armeb_unknown_linux_gnueabi] needs-llvm-components: arm -// revisions: armebv7r_none_eabi -// [armebv7r_none_eabi] compile-flags: --target armebv7r-none-eabi -// [armebv7r_none_eabi] needs-llvm-components: arm -// revisions: armebv7r_none_eabihf -// [armebv7r_none_eabihf] compile-flags: --target armebv7r-none-eabihf -// [armebv7r_none_eabihf] needs-llvm-components: arm -// revisions: armv4t_none_eabi -// [armv4t_none_eabi] compile-flags: --target armv4t-none-eabi -// [armv4t_none_eabi] needs-llvm-components: arm -// revisions: armv4t_unknown_linux_gnueabi -// [armv4t_unknown_linux_gnueabi] compile-flags: --target armv4t-unknown-linux-gnueabi -// [armv4t_unknown_linux_gnueabi] needs-llvm-components: arm -// revisions: armv5te_none_eabi -// [armv5te_none_eabi] compile-flags: --target armv5te-none-eabi -// [armv5te_none_eabi] needs-llvm-components: arm -// revisions: armv5te_unknown_linux_gnueabi -// [armv5te_unknown_linux_gnueabi] compile-flags: --target armv5te-unknown-linux-gnueabi -// [armv5te_unknown_linux_gnueabi] needs-llvm-components: arm -// revisions: armv5te_unknown_linux_musleabi -// [armv5te_unknown_linux_musleabi] compile-flags: --target armv5te-unknown-linux-musleabi -// [armv5te_unknown_linux_musleabi] needs-llvm-components: arm -// revisions: armv5te_unknown_linux_uclibceabi -// [armv5te_unknown_linux_uclibceabi] compile-flags: --target armv5te-unknown-linux-uclibceabi -// [armv5te_unknown_linux_uclibceabi] needs-llvm-components: arm -// revisions: armv6_unknown_freebsd -// [armv6_unknown_freebsd] compile-flags: --target armv6-unknown-freebsd -// [armv6_unknown_freebsd] needs-llvm-components: arm -// revisions: armv6_unknown_netbsd_eabihf -// [armv6_unknown_netbsd_eabihf] compile-flags: --target armv6-unknown-netbsd-eabihf -// [armv6_unknown_netbsd_eabihf] needs-llvm-components: arm -// revisions: armv6k_nintendo_3ds -// [armv6k_nintendo_3ds] compile-flags: --target armv6k-nintendo-3ds -// [armv6k_nintendo_3ds] needs-llvm-components: arm -// revisions: armv7_linux_androideabi -// [armv7_linux_androideabi] compile-flags: --target armv7-linux-androideabi -// [armv7_linux_androideabi] needs-llvm-components: arm -// revisions: armv7_sony_vita_newlibeabihf -// [armv7_sony_vita_newlibeabihf] compile-flags: --target armv7-sony-vita-newlibeabihf -// [armv7_sony_vita_newlibeabihf] needs-llvm-components: arm -// revisions: armv7_unknown_freebsd -// [armv7_unknown_freebsd] compile-flags: --target armv7-unknown-freebsd -// [armv7_unknown_freebsd] needs-llvm-components: arm -// revisions: armv7_unknown_linux_gnueabi -// [armv7_unknown_linux_gnueabi] compile-flags: --target armv7-unknown-linux-gnueabi -// [armv7_unknown_linux_gnueabi] needs-llvm-components: arm -// revisions: armv7_unknown_linux_gnueabihf -// [armv7_unknown_linux_gnueabihf] compile-flags: --target armv7-unknown-linux-gnueabihf -// [armv7_unknown_linux_gnueabihf] needs-llvm-components: arm -// revisions: armv7_unknown_linux_musleabi -// [armv7_unknown_linux_musleabi] compile-flags: --target armv7-unknown-linux-musleabi -// [armv7_unknown_linux_musleabi] needs-llvm-components: arm -// revisions: armv7_unknown_linux_musleabihf -// [armv7_unknown_linux_musleabihf] compile-flags: --target armv7-unknown-linux-musleabihf -// [armv7_unknown_linux_musleabihf] needs-llvm-components: arm -// revisions: armv7_unknown_linux_ohos -// [armv7_unknown_linux_ohos] compile-flags: --target armv7-unknown-linux-ohos -// [armv7_unknown_linux_ohos] needs-llvm-components: arm -// revisions: armv7_unknown_linux_uclibceabi -// [armv7_unknown_linux_uclibceabi] compile-flags: --target armv7-unknown-linux-uclibceabi -// [armv7_unknown_linux_uclibceabi] needs-llvm-components: arm -// revisions: armv7_unknown_linux_uclibceabihf -// [armv7_unknown_linux_uclibceabihf] compile-flags: --target armv7-unknown-linux-uclibceabihf -// [armv7_unknown_linux_uclibceabihf] needs-llvm-components: arm -// revisions: armv7_unknown_netbsd_eabihf -// [armv7_unknown_netbsd_eabihf] compile-flags: --target armv7-unknown-netbsd-eabihf -// [armv7_unknown_netbsd_eabihf] needs-llvm-components: arm -// revisions: armv7_wrs_vxworks_eabihf -// [armv7_wrs_vxworks_eabihf] compile-flags: --target armv7-wrs-vxworks-eabihf -// [armv7_wrs_vxworks_eabihf] needs-llvm-components: arm -// revisions: armv7a_kmc_solid_asp3_eabi -// [armv7a_kmc_solid_asp3_eabi] compile-flags: --target armv7a-kmc-solid_asp3-eabi -// [armv7a_kmc_solid_asp3_eabi] needs-llvm-components: arm -// revisions: armv7a_kmc_solid_asp3_eabihf -// [armv7a_kmc_solid_asp3_eabihf] compile-flags: --target armv7a-kmc-solid_asp3-eabihf -// [armv7a_kmc_solid_asp3_eabihf] needs-llvm-components: arm -// revisions: armv7a_none_eabi -// [armv7a_none_eabi] compile-flags: --target armv7a-none-eabi -// [armv7a_none_eabi] needs-llvm-components: arm -// revisions: armv7a_none_eabihf -// [armv7a_none_eabihf] compile-flags: --target armv7a-none-eabihf -// [armv7a_none_eabihf] needs-llvm-components: arm -// revisions: armv7r_none_eabi -// [armv7r_none_eabi] compile-flags: --target armv7r-none-eabi -// [armv7r_none_eabi] needs-llvm-components: arm -// revisions: armv7r_none_eabihf -// [armv7r_none_eabihf] compile-flags: --target armv7r-none-eabihf -// [armv7r_none_eabihf] needs-llvm-components: arm -// revisions: armv8r_none_eabihf -// [armv8r_none_eabihf] compile-flags: --target armv8r-none-eabihf -// [armv8r_none_eabihf] needs-llvm-components: arm +//@ revisions: aarch64_be_unknown_linux_gnu +//@ [aarch64_be_unknown_linux_gnu] compile-flags: --target aarch64_be-unknown-linux-gnu +//@ [aarch64_be_unknown_linux_gnu] needs-llvm-components: aarch64 +//@ revisions: aarch64_be_unknown_linux_gnu_ilp32 +//@ [aarch64_be_unknown_linux_gnu_ilp32] compile-flags: --target aarch64_be-unknown-linux-gnu_ilp32 +//@ [aarch64_be_unknown_linux_gnu_ilp32] needs-llvm-components: aarch64 +//@ revisions: aarch64_be_unknown_netbsd +//@ [aarch64_be_unknown_netbsd] compile-flags: --target aarch64_be-unknown-netbsd +//@ [aarch64_be_unknown_netbsd] needs-llvm-components: aarch64 +//@ revisions: aarch64_fuchsia +//@ [aarch64_fuchsia] compile-flags: --target aarch64-fuchsia +//@ [aarch64_fuchsia] needs-llvm-components: aarch64 +//@ revisions: aarch64_kmc_solid_asp3 +//@ [aarch64_kmc_solid_asp3] compile-flags: --target aarch64-kmc-solid_asp3 +//@ [aarch64_kmc_solid_asp3] needs-llvm-components: aarch64 +//@ revisions: aarch64_linux_android +//@ [aarch64_linux_android] compile-flags: --target aarch64-linux-android +//@ [aarch64_linux_android] needs-llvm-components: aarch64 +//@ revisions: aarch64_nintendo_switch_freestanding +//@ [aarch64_nintendo_switch_freestanding] compile-flags: --target aarch64-nintendo-switch-freestanding +//@ [aarch64_nintendo_switch_freestanding] needs-llvm-components: aarch64 +//@ revisions: aarch64_unknown_freebsd +//@ [aarch64_unknown_freebsd] compile-flags: --target aarch64-unknown-freebsd +//@ [aarch64_unknown_freebsd] needs-llvm-components: aarch64 +//@ revisions: aarch64_unknown_fuchsia +//@ [aarch64_unknown_fuchsia] compile-flags: --target aarch64-unknown-fuchsia +//@ [aarch64_unknown_fuchsia] needs-llvm-components: aarch64 +//@ revisions: aarch64_unknown_hermit +//@ [aarch64_unknown_hermit] compile-flags: --target aarch64-unknown-hermit +//@ [aarch64_unknown_hermit] needs-llvm-components: aarch64 +//@ revisions: aarch64_unknown_illumos +//@ [aarch64_unknown_illumos] compile-flags: --target aarch64-unknown-illumos +//@ [aarch64_unknown_illumos] needs-llvm-components: aarch64 +//@ revisions: aarch64_unknown_linux_gnu +//@ [aarch64_unknown_linux_gnu] compile-flags: --target aarch64-unknown-linux-gnu +//@ [aarch64_unknown_linux_gnu] needs-llvm-components: aarch64 +//@ revisions: aarch64_unknown_linux_gnu_ilp32 +//@ [aarch64_unknown_linux_gnu_ilp32] compile-flags: --target aarch64-unknown-linux-gnu_ilp32 +//@ [aarch64_unknown_linux_gnu_ilp32] needs-llvm-components: aarch64 +//@ revisions: aarch64_unknown_linux_musl +//@ [aarch64_unknown_linux_musl] compile-flags: --target aarch64-unknown-linux-musl +//@ [aarch64_unknown_linux_musl] needs-llvm-components: aarch64 +//@ revisions: aarch64_unknown_linux_ohos +//@ [aarch64_unknown_linux_ohos] compile-flags: --target aarch64-unknown-linux-ohos +//@ [aarch64_unknown_linux_ohos] needs-llvm-components: aarch64 +//@ revisions: aarch64_unknown_netbsd +//@ [aarch64_unknown_netbsd] compile-flags: --target aarch64-unknown-netbsd +//@ [aarch64_unknown_netbsd] needs-llvm-components: aarch64 +//@ revisions: aarch64_unknown_none +//@ [aarch64_unknown_none] compile-flags: --target aarch64-unknown-none +//@ [aarch64_unknown_none] needs-llvm-components: aarch64 +//@ revisions: aarch64_unknown_none_softfloat +//@ [aarch64_unknown_none_softfloat] compile-flags: --target aarch64-unknown-none-softfloat +//@ [aarch64_unknown_none_softfloat] needs-llvm-components: aarch64 +//@ revisions: aarch64_unknown_nto_qnx_710 +//@ [aarch64_unknown_nto_qnx_710] compile-flags: --target aarch64-unknown-nto-qnx710 +//@ [aarch64_unknown_nto_qnx_710] needs-llvm-components: aarch64 +//@ revisions: aarch64_unknown_openbsd +//@ [aarch64_unknown_openbsd] compile-flags: --target aarch64-unknown-openbsd +//@ [aarch64_unknown_openbsd] needs-llvm-components: aarch64 +//@ revisions: aarch64_unknown_redox +//@ [aarch64_unknown_redox] compile-flags: --target aarch64-unknown-redox +//@ [aarch64_unknown_redox] needs-llvm-components: aarch64 +//@ revisions: aarch64_unknown_teeos +//@ [aarch64_unknown_teeos] compile-flags: --target aarch64-unknown-teeos +//@ [aarch64_unknown_teeos] needs-llvm-components: aarch64 +//@ revisions: aarch64_wrs_vxworks +//@ [aarch64_wrs_vxworks] compile-flags: --target aarch64-wrs-vxworks +//@ [aarch64_wrs_vxworks] needs-llvm-components: aarch64 +//@ revisions: arm_linux_androideabi +//@ [arm_linux_androideabi] compile-flags: --target arm-linux-androideabi +//@ [arm_linux_androideabi] needs-llvm-components: arm +//@ revisions: arm_unknown_linux_gnueabi +//@ [arm_unknown_linux_gnueabi] compile-flags: --target arm-unknown-linux-gnueabi +//@ [arm_unknown_linux_gnueabi] needs-llvm-components: arm +//@ revisions: arm_unknown_linux_gnueabihf +//@ [arm_unknown_linux_gnueabihf] compile-flags: --target arm-unknown-linux-gnueabihf +//@ [arm_unknown_linux_gnueabihf] needs-llvm-components: arm +//@ revisions: arm_unknown_linux_musleabi +//@ [arm_unknown_linux_musleabi] compile-flags: --target arm-unknown-linux-musleabi +//@ [arm_unknown_linux_musleabi] needs-llvm-components: arm +//@ revisions: arm_unknown_linux_musleabihf +//@ [arm_unknown_linux_musleabihf] compile-flags: --target arm-unknown-linux-musleabihf +//@ [arm_unknown_linux_musleabihf] needs-llvm-components: arm +//@ revisions: armeb_unknown_linux_gnueabi +//@ [armeb_unknown_linux_gnueabi] compile-flags: --target armeb-unknown-linux-gnueabi +//@ [armeb_unknown_linux_gnueabi] needs-llvm-components: arm +//@ revisions: armebv7r_none_eabi +//@ [armebv7r_none_eabi] compile-flags: --target armebv7r-none-eabi +//@ [armebv7r_none_eabi] needs-llvm-components: arm +//@ revisions: armebv7r_none_eabihf +//@ [armebv7r_none_eabihf] compile-flags: --target armebv7r-none-eabihf +//@ [armebv7r_none_eabihf] needs-llvm-components: arm +//@ revisions: armv4t_none_eabi +//@ [armv4t_none_eabi] compile-flags: --target armv4t-none-eabi +//@ [armv4t_none_eabi] needs-llvm-components: arm +//@ revisions: armv4t_unknown_linux_gnueabi +//@ [armv4t_unknown_linux_gnueabi] compile-flags: --target armv4t-unknown-linux-gnueabi +//@ [armv4t_unknown_linux_gnueabi] needs-llvm-components: arm +//@ revisions: armv5te_none_eabi +//@ [armv5te_none_eabi] compile-flags: --target armv5te-none-eabi +//@ [armv5te_none_eabi] needs-llvm-components: arm +//@ revisions: armv5te_unknown_linux_gnueabi +//@ [armv5te_unknown_linux_gnueabi] compile-flags: --target armv5te-unknown-linux-gnueabi +//@ [armv5te_unknown_linux_gnueabi] needs-llvm-components: arm +//@ revisions: armv5te_unknown_linux_musleabi +//@ [armv5te_unknown_linux_musleabi] compile-flags: --target armv5te-unknown-linux-musleabi +//@ [armv5te_unknown_linux_musleabi] needs-llvm-components: arm +//@ revisions: armv5te_unknown_linux_uclibceabi +//@ [armv5te_unknown_linux_uclibceabi] compile-flags: --target armv5te-unknown-linux-uclibceabi +//@ [armv5te_unknown_linux_uclibceabi] needs-llvm-components: arm +//@ revisions: armv6_unknown_freebsd +//@ [armv6_unknown_freebsd] compile-flags: --target armv6-unknown-freebsd +//@ [armv6_unknown_freebsd] needs-llvm-components: arm +//@ revisions: armv6_unknown_netbsd_eabihf +//@ [armv6_unknown_netbsd_eabihf] compile-flags: --target armv6-unknown-netbsd-eabihf +//@ [armv6_unknown_netbsd_eabihf] needs-llvm-components: arm +//@ revisions: armv6k_nintendo_3ds +//@ [armv6k_nintendo_3ds] compile-flags: --target armv6k-nintendo-3ds +//@ [armv6k_nintendo_3ds] needs-llvm-components: arm +//@ revisions: armv7_linux_androideabi +//@ [armv7_linux_androideabi] compile-flags: --target armv7-linux-androideabi +//@ [armv7_linux_androideabi] needs-llvm-components: arm +//@ revisions: armv7_sony_vita_newlibeabihf +//@ [armv7_sony_vita_newlibeabihf] compile-flags: --target armv7-sony-vita-newlibeabihf +//@ [armv7_sony_vita_newlibeabihf] needs-llvm-components: arm +//@ revisions: armv7_unknown_freebsd +//@ [armv7_unknown_freebsd] compile-flags: --target armv7-unknown-freebsd +//@ [armv7_unknown_freebsd] needs-llvm-components: arm +//@ revisions: armv7_unknown_linux_gnueabi +//@ [armv7_unknown_linux_gnueabi] compile-flags: --target armv7-unknown-linux-gnueabi +//@ [armv7_unknown_linux_gnueabi] needs-llvm-components: arm +//@ revisions: armv7_unknown_linux_gnueabihf +//@ [armv7_unknown_linux_gnueabihf] compile-flags: --target armv7-unknown-linux-gnueabihf +//@ [armv7_unknown_linux_gnueabihf] needs-llvm-components: arm +//@ revisions: armv7_unknown_linux_musleabi +//@ [armv7_unknown_linux_musleabi] compile-flags: --target armv7-unknown-linux-musleabi +//@ [armv7_unknown_linux_musleabi] needs-llvm-components: arm +//@ revisions: armv7_unknown_linux_musleabihf +//@ [armv7_unknown_linux_musleabihf] compile-flags: --target armv7-unknown-linux-musleabihf +//@ [armv7_unknown_linux_musleabihf] needs-llvm-components: arm +//@ revisions: armv7_unknown_linux_ohos +//@ [armv7_unknown_linux_ohos] compile-flags: --target armv7-unknown-linux-ohos +//@ [armv7_unknown_linux_ohos] needs-llvm-components: arm +//@ revisions: armv7_unknown_linux_uclibceabi +//@ [armv7_unknown_linux_uclibceabi] compile-flags: --target armv7-unknown-linux-uclibceabi +//@ [armv7_unknown_linux_uclibceabi] needs-llvm-components: arm +//@ revisions: armv7_unknown_linux_uclibceabihf +//@ [armv7_unknown_linux_uclibceabihf] compile-flags: --target armv7-unknown-linux-uclibceabihf +//@ [armv7_unknown_linux_uclibceabihf] needs-llvm-components: arm +//@ revisions: armv7_unknown_netbsd_eabihf +//@ [armv7_unknown_netbsd_eabihf] compile-flags: --target armv7-unknown-netbsd-eabihf +//@ [armv7_unknown_netbsd_eabihf] needs-llvm-components: arm +//@ revisions: armv7_wrs_vxworks_eabihf +//@ [armv7_wrs_vxworks_eabihf] compile-flags: --target armv7-wrs-vxworks-eabihf +//@ [armv7_wrs_vxworks_eabihf] needs-llvm-components: arm +//@ revisions: armv7a_kmc_solid_asp3_eabi +//@ [armv7a_kmc_solid_asp3_eabi] compile-flags: --target armv7a-kmc-solid_asp3-eabi +//@ [armv7a_kmc_solid_asp3_eabi] needs-llvm-components: arm +//@ revisions: armv7a_kmc_solid_asp3_eabihf +//@ [armv7a_kmc_solid_asp3_eabihf] compile-flags: --target armv7a-kmc-solid_asp3-eabihf +//@ [armv7a_kmc_solid_asp3_eabihf] needs-llvm-components: arm +//@ revisions: armv7a_none_eabi +//@ [armv7a_none_eabi] compile-flags: --target armv7a-none-eabi +//@ [armv7a_none_eabi] needs-llvm-components: arm +//@ revisions: armv7a_none_eabihf +//@ [armv7a_none_eabihf] compile-flags: --target armv7a-none-eabihf +//@ [armv7a_none_eabihf] needs-llvm-components: arm +//@ revisions: armv7r_none_eabi +//@ [armv7r_none_eabi] compile-flags: --target armv7r-none-eabi +//@ [armv7r_none_eabi] needs-llvm-components: arm +//@ revisions: armv7r_none_eabihf +//@ [armv7r_none_eabihf] compile-flags: --target armv7r-none-eabihf +//@ [armv7r_none_eabihf] needs-llvm-components: arm +//@ revisions: armv8r_none_eabihf +//@ [armv8r_none_eabihf] compile-flags: --target armv8r-none-eabihf +//@ [armv8r_none_eabihf] needs-llvm-components: arm // FIXME: disabled since it fails on CI saying the csky component is missing /* revisions: csky_unknown_linux_gnuabiv2 @@ -186,378 +186,378 @@ [csky_unknown_linux_gnuabiv2hf] compile-flags: --target csky-unknown-linux-gnuabiv2hf [csky_unknown_linux_gnuabiv2hf] needs-llvm-components: csky */ -// revisions: hexagon_unknown_linux_musl -// [hexagon_unknown_linux_musl] compile-flags: --target hexagon-unknown-linux-musl -// [hexagon_unknown_linux_musl] needs-llvm-components: hexagon -// revisions: hexagon_unknown_none_elf -// [hexagon_unknown_none_elf] compile-flags: --target hexagon-unknown-none-elf -// [hexagon_unknown_none_elf] needs-llvm-components: hexagon -// revisions: i586_pc_nto_qnx700 -// [i586_pc_nto_qnx700] compile-flags: --target i586-pc-nto-qnx700 -// [i586_pc_nto_qnx700] needs-llvm-components: x86 -// revisions: i586_unknown_linux_gnu -// [i586_unknown_linux_gnu] compile-flags: --target i586-unknown-linux-gnu -// [i586_unknown_linux_gnu] needs-llvm-components: x86 -// revisions: i586_unknown_linux_musl -// [i586_unknown_linux_musl] compile-flags: --target i586-unknown-linux-musl -// [i586_unknown_linux_musl] needs-llvm-components: x86 -// revisions: i586_unknown_netbsd -// [i586_unknown_netbsd] compile-flags: --target i586-unknown-netbsd -// [i586_unknown_netbsd] needs-llvm-components: x86 -// revisions: i686_linux_android -// [i686_linux_android] compile-flags: --target i686-linux-android -// [i686_linux_android] needs-llvm-components: x86 -// revisions: i686_unknown_freebsd -// [i686_unknown_freebsd] compile-flags: --target i686-unknown-freebsd -// [i686_unknown_freebsd] needs-llvm-components: x86 -// revisions: i686_unknown_haiku -// [i686_unknown_haiku] compile-flags: --target i686-unknown-haiku -// [i686_unknown_haiku] needs-llvm-components: x86 -// revisions: i686_unknown_hurd_gnu -// [i686_unknown_hurd_gnu] compile-flags: --target i686-unknown-hurd-gnu -// [i686_unknown_hurd_gnu] needs-llvm-components: x86 -// revisions: i686_unknown_linux_gnu -// [i686_unknown_linux_gnu] compile-flags: --target i686-unknown-linux-gnu -// [i686_unknown_linux_gnu] needs-llvm-components: x86 -// revisions: i686_unknown_linux_musl -// [i686_unknown_linux_musl] compile-flags: --target i686-unknown-linux-musl -// [i686_unknown_linux_musl] needs-llvm-components: x86 -// revisions: i686_unknown_netbsd -// [i686_unknown_netbsd] compile-flags: --target i686-unknown-netbsd -// [i686_unknown_netbsd] needs-llvm-components: x86 -// revisions: i686_unknown_openbsd -// [i686_unknown_openbsd] compile-flags: --target i686-unknown-openbsd -// [i686_unknown_openbsd] needs-llvm-components: x86 -// revisions: i686_wrs_vxworks -// [i686_wrs_vxworks] compile-flags: --target i686-wrs-vxworks -// [i686_wrs_vxworks] needs-llvm-components: x86 -// revisions: loongarch64_unknown_linux_gnu -// [loongarch64_unknown_linux_gnu] compile-flags: --target loongarch64-unknown-linux-gnu -// [loongarch64_unknown_linux_gnu] needs-llvm-components: loongarch -// revisions: loongarch64_unknown_none -// [loongarch64_unknown_none] compile-flags: --target loongarch64-unknown-none -// [loongarch64_unknown_none] needs-llvm-components: loongarch -// revisions: loongarch64_unknown_none_softfloat -// [loongarch64_unknown_none_softfloat] compile-flags: --target loongarch64-unknown-none-softfloat -// [loongarch64_unknown_none_softfloat] needs-llvm-components: loongarch -// revisions: m68k_unknown_linux_gnu -// [m68k_unknown_linux_gnu] compile-flags: --target m68k-unknown-linux-gnu -// [m68k_unknown_linux_gnu] needs-llvm-components: m68k -// revisions: mips64_openwrt_linux_musl -// [mips64_openwrt_linux_musl] compile-flags: --target mips64-openwrt-linux-musl -// [mips64_openwrt_linux_musl] needs-llvm-components: mips -// revisions: mips64_unknown_linux_gnuabi64 -// [mips64_unknown_linux_gnuabi64] compile-flags: --target mips64-unknown-linux-gnuabi64 -// [mips64_unknown_linux_gnuabi64] needs-llvm-components: mips -// revisions: mips64_unknown_linux_muslabi64 -// [mips64_unknown_linux_muslabi64] compile-flags: --target mips64-unknown-linux-muslabi64 -// [mips64_unknown_linux_muslabi64] needs-llvm-components: mips -// revisions: mips64el_unknown_linux_gnuabi64 -// [mips64el_unknown_linux_gnuabi64] compile-flags: --target mips64el-unknown-linux-gnuabi64 -// [mips64el_unknown_linux_gnuabi64] needs-llvm-components: mips -// revisions: mips64el_unknown_linux_muslabi64 -// [mips64el_unknown_linux_muslabi64] compile-flags: --target mips64el-unknown-linux-muslabi64 -// [mips64el_unknown_linux_muslabi64] needs-llvm-components: mips -// revisions: mips_unknown_linux_gnu -// [mips_unknown_linux_gnu] compile-flags: --target mips-unknown-linux-gnu -// [mips_unknown_linux_gnu] needs-llvm-components: mips -// revisions: mips_unknown_linux_musl -// [mips_unknown_linux_musl] compile-flags: --target mips-unknown-linux-musl -// [mips_unknown_linux_musl] needs-llvm-components: mips -// revisions: mips_unknown_linux_uclibc -// [mips_unknown_linux_uclibc] compile-flags: --target mips-unknown-linux-uclibc -// [mips_unknown_linux_uclibc] needs-llvm-components: mips -// revisions: mipsel_sony_psp -// [mipsel_sony_psp] compile-flags: --target mipsel-sony-psp -// [mipsel_sony_psp] needs-llvm-components: mips -// revisions: mipsel_sony_psx -// [mipsel_sony_psx] compile-flags: --target mipsel-sony-psx -// [mipsel_sony_psx] needs-llvm-components: mips -// revisions: mipsel_unknown_linux_gnu -// [mipsel_unknown_linux_gnu] compile-flags: --target mipsel-unknown-linux-gnu -// [mipsel_unknown_linux_gnu] needs-llvm-components: mips -// revisions: mipsel_unknown_linux_musl -// [mipsel_unknown_linux_musl] compile-flags: --target mipsel-unknown-linux-musl -// [mipsel_unknown_linux_musl] needs-llvm-components: mips -// revisions: mipsel_unknown_linux_uclibc -// [mipsel_unknown_linux_uclibc] compile-flags: --target mipsel-unknown-linux-uclibc -// [mipsel_unknown_linux_uclibc] needs-llvm-components: mips -// revisions: mipsel_unknown_netbsd -// [mipsel_unknown_netbsd] compile-flags: --target mipsel-unknown-netbsd -// [mipsel_unknown_netbsd] needs-llvm-components: mips -// revisions: mipsel_unknown_none -// [mipsel_unknown_none] compile-flags: --target mipsel-unknown-none -// [mipsel_unknown_none] needs-llvm-components: mips -// revisions: mipsisa32r6_unknown_linux_gnu -// [mipsisa32r6_unknown_linux_gnu] compile-flags: --target mipsisa32r6-unknown-linux-gnu -// [mipsisa32r6_unknown_linux_gnu] needs-llvm-components: mips -// revisions: mipsisa32r6el_unknown_linux_gnu -// [mipsisa32r6el_unknown_linux_gnu] compile-flags: --target mipsisa32r6el-unknown-linux-gnu -// [mipsisa32r6el_unknown_linux_gnu] needs-llvm-components: mips -// revisions: mipsisa64r6_unknown_linux_gnuabi64 -// [mipsisa64r6_unknown_linux_gnuabi64] compile-flags: --target mipsisa64r6-unknown-linux-gnuabi64 -// [mipsisa64r6_unknown_linux_gnuabi64] needs-llvm-components: mips -// revisions: mipsisa64r6el_unknown_linux_gnuabi64 -// [mipsisa64r6el_unknown_linux_gnuabi64] compile-flags: --target mipsisa64r6el-unknown-linux-gnuabi64 -// [mipsisa64r6el_unknown_linux_gnuabi64] needs-llvm-components: mips -// revisions: msp430_none_elf -// [msp430_none_elf] compile-flags: --target msp430-none-elf -// [msp430_none_elf] needs-llvm-components: msp430 -// revisions: powerpc64_unknown_freebsd -// [powerpc64_unknown_freebsd] compile-flags: --target powerpc64-unknown-freebsd -// [powerpc64_unknown_freebsd] needs-llvm-components: powerpc -// revisions: powerpc64_unknown_linux_gnu -// [powerpc64_unknown_linux_gnu] compile-flags: --target powerpc64-unknown-linux-gnu -// [powerpc64_unknown_linux_gnu] needs-llvm-components: powerpc -// revisions: powerpc64_unknown_linux_musl -// [powerpc64_unknown_linux_musl] compile-flags: --target powerpc64-unknown-linux-musl -// [powerpc64_unknown_linux_musl] needs-llvm-components: powerpc -// revisions: powerpc64_unknown_openbsd -// [powerpc64_unknown_openbsd] compile-flags: --target powerpc64-unknown-openbsd -// [powerpc64_unknown_openbsd] needs-llvm-components: powerpc -// revisions: powerpc64_wrs_vxworks -// [powerpc64_wrs_vxworks] compile-flags: --target powerpc64-wrs-vxworks -// [powerpc64_wrs_vxworks] needs-llvm-components: powerpc -// revisions: powerpc64le_unknown_freebsd -// [powerpc64le_unknown_freebsd] compile-flags: --target powerpc64le-unknown-freebsd -// [powerpc64le_unknown_freebsd] needs-llvm-components: powerpc -// revisions: powerpc64le_unknown_linux_gnu -// [powerpc64le_unknown_linux_gnu] compile-flags: --target powerpc64le-unknown-linux-gnu -// [powerpc64le_unknown_linux_gnu] needs-llvm-components: powerpc -// revisions: powerpc64le_unknown_linux_musl -// [powerpc64le_unknown_linux_musl] compile-flags: --target powerpc64le-unknown-linux-musl -// [powerpc64le_unknown_linux_musl] needs-llvm-components: powerpc -// revisions: powerpc_unknown_freebsd -// [powerpc_unknown_freebsd] compile-flags: --target powerpc-unknown-freebsd -// [powerpc_unknown_freebsd] needs-llvm-components: powerpc -// revisions: powerpc_unknown_linux_gnu -// [powerpc_unknown_linux_gnu] compile-flags: --target powerpc-unknown-linux-gnu -// [powerpc_unknown_linux_gnu] needs-llvm-components: powerpc -// revisions: powerpc_unknown_linux_gnuspe -// [powerpc_unknown_linux_gnuspe] compile-flags: --target powerpc-unknown-linux-gnuspe -// [powerpc_unknown_linux_gnuspe] needs-llvm-components: powerpc -// revisions: powerpc_unknown_linux_musl -// [powerpc_unknown_linux_musl] compile-flags: --target powerpc-unknown-linux-musl -// [powerpc_unknown_linux_musl] needs-llvm-components: powerpc -// revisions: powerpc_unknown_netbsd -// [powerpc_unknown_netbsd] compile-flags: --target powerpc-unknown-netbsd -// [powerpc_unknown_netbsd] needs-llvm-components: powerpc -// revisions: powerpc_unknown_openbsd -// [powerpc_unknown_openbsd] compile-flags: --target powerpc-unknown-openbsd -// [powerpc_unknown_openbsd] needs-llvm-components: powerpc -// revisions: powerpc_wrs_vxworks -// [powerpc_wrs_vxworks] compile-flags: --target powerpc-wrs-vxworks -// [powerpc_wrs_vxworks] needs-llvm-components: powerpc -// revisions: powerpc_wrs_vxworks_spe -// [powerpc_wrs_vxworks_spe] compile-flags: --target powerpc-wrs-vxworks-spe -// [powerpc_wrs_vxworks_spe] needs-llvm-components: powerpc -// revisions: riscv32gc_unknown_linux_gnu -// [riscv32gc_unknown_linux_gnu] compile-flags: --target riscv32gc-unknown-linux-gnu -// [riscv32gc_unknown_linux_gnu] needs-llvm-components: riscv -// revisions: riscv32gc_unknown_linux_musl -// [riscv32gc_unknown_linux_musl] compile-flags: --target riscv32gc-unknown-linux-musl -// [riscv32gc_unknown_linux_musl] needs-llvm-components: riscv -// revisions: riscv32i_unknown_none_elf -// [riscv32i_unknown_none_elf] compile-flags: --target riscv32i-unknown-none-elf -// [riscv32i_unknown_none_elf] needs-llvm-components: riscv -// revisions: riscv32im_risc0_zkvm_elf -// [riscv32im_risc0_zkvm_elf] compile-flags: --target riscv32im-risc0-zkvm-elf -// [riscv32im_risc0_zkvm_elf] needs-llvm-components: riscv -// revisions: riscv32im_unknown_none_elf -// [riscv32im_unknown_none_elf] compile-flags: --target riscv32im-unknown-none-elf -// [riscv32im_unknown_none_elf] needs-llvm-components: riscv -// revisions: riscv32imac_esp_espidf -// [riscv32imac_esp_espidf] compile-flags: --target riscv32imac-esp-espidf -// [riscv32imac_esp_espidf] needs-llvm-components: riscv -// revisions: riscv32imac_unknown_none_elf -// [riscv32imac_unknown_none_elf] compile-flags: --target riscv32imac-unknown-none-elf -// [riscv32imac_unknown_none_elf] needs-llvm-components: riscv -// revisions: riscv32imac_unknown_xous_elf -// [riscv32imac_unknown_xous_elf] compile-flags: --target riscv32imac-unknown-xous-elf -// [riscv32imac_unknown_xous_elf] needs-llvm-components: riscv -// revisions: riscv32imafc_unknown_none_elf -// [riscv32imafc_unknown_none_elf] compile-flags: --target riscv32imafc-unknown-none-elf -// [riscv32imafc_unknown_none_elf] needs-llvm-components: riscv -// revisions: riscv32imafc_esp_espidf -// [riscv32imafc_esp_espidf] compile-flags: --target riscv32imafc-esp-espidf -// [riscv32imafc_esp_espidf] needs-llvm-components: riscv -// revisions: riscv32imc_esp_espidf -// [riscv32imc_esp_espidf] compile-flags: --target riscv32imc-esp-espidf -// [riscv32imc_esp_espidf] needs-llvm-components: riscv -// revisions: riscv32imc_unknown_none_elf -// [riscv32imc_unknown_none_elf] compile-flags: --target riscv32imc-unknown-none-elf -// [riscv32imc_unknown_none_elf] needs-llvm-components: riscv -// revisions: riscv64_linux_android -// [riscv64_linux_android] compile-flags: --target riscv64-linux-android -// [riscv64_linux_android] needs-llvm-components: riscv -// revisions: riscv64gc_unknown_freebsd -// [riscv64gc_unknown_freebsd] compile-flags: --target riscv64gc-unknown-freebsd -// [riscv64gc_unknown_freebsd] needs-llvm-components: riscv -// revisions: riscv64gc_unknown_fuchsia -// [riscv64gc_unknown_fuchsia] compile-flags: --target riscv64gc-unknown-fuchsia -// [riscv64gc_unknown_fuchsia] needs-llvm-components: riscv -// revisions: riscv64gc_unknown_hermit -// [riscv64gc_unknown_hermit] compile-flags: --target riscv64gc-unknown-hermit -// [riscv64gc_unknown_hermit] needs-llvm-components: riscv -// revisions: riscv64gc_unknown_linux_gnu -// [riscv64gc_unknown_linux_gnu] compile-flags: --target riscv64gc-unknown-linux-gnu -// [riscv64gc_unknown_linux_gnu] needs-llvm-components: riscv -// revisions: riscv64gc_unknown_linux_musl -// [riscv64gc_unknown_linux_musl] compile-flags: --target riscv64gc-unknown-linux-musl -// [riscv64gc_unknown_linux_musl] needs-llvm-components: riscv -// revisions: riscv64gc_unknown_netbsd -// [riscv64gc_unknown_netbsd] compile-flags: --target riscv64gc-unknown-netbsd -// [riscv64gc_unknown_netbsd] needs-llvm-components: riscv -// revisions: riscv64gc_unknown_none_elf -// [riscv64gc_unknown_none_elf] compile-flags: --target riscv64gc-unknown-none-elf -// [riscv64gc_unknown_none_elf] needs-llvm-components: riscv -// revisions: riscv64gc_unknown_openbsd -// [riscv64gc_unknown_openbsd] compile-flags: --target riscv64gc-unknown-openbsd -// [riscv64gc_unknown_openbsd] needs-llvm-components: riscv -// revisions: riscv64imac_unknown_none_elf -// [riscv64imac_unknown_none_elf] compile-flags: --target riscv64imac-unknown-none-elf -// [riscv64imac_unknown_none_elf] needs-llvm-components: riscv -// revisions: s390x_unknown_linux_gnu -// [s390x_unknown_linux_gnu] compile-flags: --target s390x-unknown-linux-gnu -// [s390x_unknown_linux_gnu] needs-llvm-components: systemz -// revisions: s390x_unknown_linux_musl -// [s390x_unknown_linux_musl] compile-flags: --target s390x-unknown-linux-musl -// [s390x_unknown_linux_musl] needs-llvm-components: systemz -// revisions: sparc64_unknown_linux_gnu -// [sparc64_unknown_linux_gnu] compile-flags: --target sparc64-unknown-linux-gnu -// [sparc64_unknown_linux_gnu] needs-llvm-components: sparc -// revisions: sparc64_unknown_netbsd -// [sparc64_unknown_netbsd] compile-flags: --target sparc64-unknown-netbsd -// [sparc64_unknown_netbsd] needs-llvm-components: sparc -// revisions: sparc64_unknown_openbsd -// [sparc64_unknown_openbsd] compile-flags: --target sparc64-unknown-openbsd -// [sparc64_unknown_openbsd] needs-llvm-components: sparc -// revisions: sparc_unknown_linux_gnu -// [sparc_unknown_linux_gnu] compile-flags: --target sparc-unknown-linux-gnu -// [sparc_unknown_linux_gnu] needs-llvm-components: sparc -// revisions: sparc_unknown_none_elf -// [sparc_unknown_none_elf] compile-flags: --target sparc-unknown-none-elf -// [sparc_unknown_none_elf] needs-llvm-components: sparc -// revisions: sparcv9_sun_solaris -// [sparcv9_sun_solaris] compile-flags: --target sparcv9-sun-solaris -// [sparcv9_sun_solaris] needs-llvm-components: sparc -// revisions: thumbv4t_none_eabi -// [thumbv4t_none_eabi] compile-flags: --target thumbv4t-none-eabi -// [thumbv4t_none_eabi] needs-llvm-components: arm -// revisions: thumbv5te_none_eabi -// [thumbv5te_none_eabi] compile-flags: --target thumbv5te-none-eabi -// [thumbv5te_none_eabi] needs-llvm-components: arm -// revisions: thumbv6m_none_eabi -// [thumbv6m_none_eabi] compile-flags: --target thumbv6m-none-eabi -// [thumbv6m_none_eabi] needs-llvm-components: arm -// revisions: thumbv7em_none_eabi -// [thumbv7em_none_eabi] compile-flags: --target thumbv7em-none-eabi -// [thumbv7em_none_eabi] needs-llvm-components: arm -// revisions: thumbv7em_none_eabihf -// [thumbv7em_none_eabihf] compile-flags: --target thumbv7em-none-eabihf -// [thumbv7em_none_eabihf] needs-llvm-components: arm -// revisions: thumbv7m_none_eabi -// [thumbv7m_none_eabi] compile-flags: --target thumbv7m-none-eabi -// [thumbv7m_none_eabi] needs-llvm-components: arm -// revisions: thumbv7neon_linux_androideabi -// [thumbv7neon_linux_androideabi] compile-flags: --target thumbv7neon-linux-androideabi -// [thumbv7neon_linux_androideabi] needs-llvm-components: arm -// revisions: thumbv7neon_unknown_linux_gnueabihf -// [thumbv7neon_unknown_linux_gnueabihf] compile-flags: --target thumbv7neon-unknown-linux-gnueabihf -// [thumbv7neon_unknown_linux_gnueabihf] needs-llvm-components: arm -// revisions: thumbv7neon_unknown_linux_musleabihf -// [thumbv7neon_unknown_linux_musleabihf] compile-flags: --target thumbv7neon-unknown-linux-musleabihf -// [thumbv7neon_unknown_linux_musleabihf] needs-llvm-components: arm -// revisions: thumbv8m_base_none_eabi -// [thumbv8m_base_none_eabi] compile-flags: --target thumbv8m.base-none-eabi -// [thumbv8m_base_none_eabi] needs-llvm-components: arm -// revisions: thumbv8m_main_none_eabi -// [thumbv8m_main_none_eabi] compile-flags: --target thumbv8m.main-none-eabi -// [thumbv8m_main_none_eabi] needs-llvm-components: arm -// revisions: thumbv8m_main_none_eabihf -// [thumbv8m_main_none_eabihf] compile-flags: --target thumbv8m.main-none-eabihf -// [thumbv8m_main_none_eabihf] needs-llvm-components: arm -// revisions: wasm32_unknown_emscripten -// [wasm32_unknown_emscripten] compile-flags: --target wasm32-unknown-emscripten -// [wasm32_unknown_emscripten] needs-llvm-components: webassembly -// revisions: wasm32_unknown_unknown -// [wasm32_unknown_unknown] compile-flags: --target wasm32-unknown-unknown -// [wasm32_unknown_unknown] needs-llvm-components: webassembly -// revisions: wasm32_wasi -// [wasm32_wasi] compile-flags: --target wasm32-wasi -// [wasm32_wasi] needs-llvm-components: webassembly -// revisions: wasm32_wasi_preview1_threads -// [wasm32_wasi_preview1_threads] compile-flags: --target wasm32-wasi-preview1-threads -// [wasm32_wasi_preview1_threads] needs-llvm-components: webassembly -// revisions: wasm64_unknown_unknown -// [wasm64_unknown_unknown] compile-flags: --target wasm64-unknown-unknown -// [wasm64_unknown_unknown] needs-llvm-components: webassembly -// revisions: x86_64_fortanix_unknown_sgx -// [x86_64_fortanix_unknown_sgx] compile-flags: --target x86_64-fortanix-unknown-sgx -// [x86_64_fortanix_unknown_sgx] needs-llvm-components: x86 -// revisions: x86_64_fuchsia -// [x86_64_fuchsia] compile-flags: --target x86_64-fuchsia -// [x86_64_fuchsia] needs-llvm-components: x86 -// revisions: x86_64_linux_android -// [x86_64_linux_android] compile-flags: --target x86_64-linux-android -// [x86_64_linux_android] needs-llvm-components: x86 -// revisions: x86_64_pc_nto_qnx710 -// [x86_64_pc_nto_qnx710] compile-flags: --target x86_64-pc-nto-qnx710 -// [x86_64_pc_nto_qnx710] needs-llvm-components: x86 -// revisions: x86_64_pc_solaris -// [x86_64_pc_solaris] compile-flags: --target x86_64-pc-solaris -// [x86_64_pc_solaris] needs-llvm-components: x86 -// revisions: x86_64_unikraft_linux_musl -// [x86_64_unikraft_linux_musl] compile-flags: --target x86_64-unikraft-linux-musl -// [x86_64_unikraft_linux_musl] needs-llvm-components: x86 -// revisions: x86_64_unknown_dragonfly -// [x86_64_unknown_dragonfly] compile-flags: --target x86_64-unknown-dragonfly -// [x86_64_unknown_dragonfly] needs-llvm-components: x86 -// revisions: x86_64_unknown_freebsd -// [x86_64_unknown_freebsd] compile-flags: --target x86_64-unknown-freebsd -// [x86_64_unknown_freebsd] needs-llvm-components: x86 -// revisions: x86_64_unknown_fuchsia -// [x86_64_unknown_fuchsia] compile-flags: --target x86_64-unknown-fuchsia -// [x86_64_unknown_fuchsia] needs-llvm-components: x86 -// revisions: x86_64_unknown_haiku -// [x86_64_unknown_haiku] compile-flags: --target x86_64-unknown-haiku -// [x86_64_unknown_haiku] needs-llvm-components: x86 -// revisions: x86_64_unknown_hermit -// [x86_64_unknown_hermit] compile-flags: --target x86_64-unknown-hermit -// [x86_64_unknown_hermit] needs-llvm-components: x86 -// revisions: x86_64_unknown_illumos -// [x86_64_unknown_illumos] compile-flags: --target x86_64-unknown-illumos -// [x86_64_unknown_illumos] needs-llvm-components: x86 -// revisions: x86_64_unknown_l4re_uclibc -// [x86_64_unknown_l4re_uclibc] compile-flags: --target x86_64-unknown-l4re-uclibc -// [x86_64_unknown_l4re_uclibc] needs-llvm-components: x86 -// revisions: x86_64_unknown_linux_gnu -// [x86_64_unknown_linux_gnu] compile-flags: --target x86_64-unknown-linux-gnu -// [x86_64_unknown_linux_gnu] needs-llvm-components: x86 -// revisions: x86_64_unknown_linux_gnux32 -// [x86_64_unknown_linux_gnux32] compile-flags: --target x86_64-unknown-linux-gnux32 -// [x86_64_unknown_linux_gnux32] needs-llvm-components: x86 -// revisions: x86_64_unknown_linux_musl -// [x86_64_unknown_linux_musl] compile-flags: --target x86_64-unknown-linux-musl -// [x86_64_unknown_linux_musl] needs-llvm-components: x86 -// revisions: x86_64_unknown_linux_ohos -// [x86_64_unknown_linux_ohos] compile-flags: --target x86_64-unknown-linux-ohos -// [x86_64_unknown_linux_ohos] needs-llvm-components: x86 -// revisions: x86_64_unknown_netbsd -// [x86_64_unknown_netbsd] compile-flags: --target x86_64-unknown-netbsd -// [x86_64_unknown_netbsd] needs-llvm-components: x86 -// revisions: x86_64_unknown_none -// [x86_64_unknown_none] compile-flags: --target x86_64-unknown-none -// [x86_64_unknown_none] needs-llvm-components: x86 -// revisions: x86_64_unknown_openbsd -// [x86_64_unknown_openbsd] compile-flags: --target x86_64-unknown-openbsd -// [x86_64_unknown_openbsd] needs-llvm-components: x86 -// revisions: x86_64_unknown_redox -// [x86_64_unknown_redox] compile-flags: --target x86_64-unknown-redox -// [x86_64_unknown_redox] needs-llvm-components: x86 -// revisions: x86_64_wrs_vxworks -// [x86_64_wrs_vxworks] compile-flags: --target x86_64-wrs-vxworks -// [x86_64_wrs_vxworks] needs-llvm-components: x86 +//@ revisions: hexagon_unknown_linux_musl +//@ [hexagon_unknown_linux_musl] compile-flags: --target hexagon-unknown-linux-musl +//@ [hexagon_unknown_linux_musl] needs-llvm-components: hexagon +//@ revisions: hexagon_unknown_none_elf +//@ [hexagon_unknown_none_elf] compile-flags: --target hexagon-unknown-none-elf +//@ [hexagon_unknown_none_elf] needs-llvm-components: hexagon +//@ revisions: i586_pc_nto_qnx700 +//@ [i586_pc_nto_qnx700] compile-flags: --target i586-pc-nto-qnx700 +//@ [i586_pc_nto_qnx700] needs-llvm-components: x86 +//@ revisions: i586_unknown_linux_gnu +//@ [i586_unknown_linux_gnu] compile-flags: --target i586-unknown-linux-gnu +//@ [i586_unknown_linux_gnu] needs-llvm-components: x86 +//@ revisions: i586_unknown_linux_musl +//@ [i586_unknown_linux_musl] compile-flags: --target i586-unknown-linux-musl +//@ [i586_unknown_linux_musl] needs-llvm-components: x86 +//@ revisions: i586_unknown_netbsd +//@ [i586_unknown_netbsd] compile-flags: --target i586-unknown-netbsd +//@ [i586_unknown_netbsd] needs-llvm-components: x86 +//@ revisions: i686_linux_android +//@ [i686_linux_android] compile-flags: --target i686-linux-android +//@ [i686_linux_android] needs-llvm-components: x86 +//@ revisions: i686_unknown_freebsd +//@ [i686_unknown_freebsd] compile-flags: --target i686-unknown-freebsd +//@ [i686_unknown_freebsd] needs-llvm-components: x86 +//@ revisions: i686_unknown_haiku +//@ [i686_unknown_haiku] compile-flags: --target i686-unknown-haiku +//@ [i686_unknown_haiku] needs-llvm-components: x86 +//@ revisions: i686_unknown_hurd_gnu +//@ [i686_unknown_hurd_gnu] compile-flags: --target i686-unknown-hurd-gnu +//@ [i686_unknown_hurd_gnu] needs-llvm-components: x86 +//@ revisions: i686_unknown_linux_gnu +//@ [i686_unknown_linux_gnu] compile-flags: --target i686-unknown-linux-gnu +//@ [i686_unknown_linux_gnu] needs-llvm-components: x86 +//@ revisions: i686_unknown_linux_musl +//@ [i686_unknown_linux_musl] compile-flags: --target i686-unknown-linux-musl +//@ [i686_unknown_linux_musl] needs-llvm-components: x86 +//@ revisions: i686_unknown_netbsd +//@ [i686_unknown_netbsd] compile-flags: --target i686-unknown-netbsd +//@ [i686_unknown_netbsd] needs-llvm-components: x86 +//@ revisions: i686_unknown_openbsd +//@ [i686_unknown_openbsd] compile-flags: --target i686-unknown-openbsd +//@ [i686_unknown_openbsd] needs-llvm-components: x86 +//@ revisions: i686_wrs_vxworks +//@ [i686_wrs_vxworks] compile-flags: --target i686-wrs-vxworks +//@ [i686_wrs_vxworks] needs-llvm-components: x86 +//@ revisions: loongarch64_unknown_linux_gnu +//@ [loongarch64_unknown_linux_gnu] compile-flags: --target loongarch64-unknown-linux-gnu +//@ [loongarch64_unknown_linux_gnu] needs-llvm-components: loongarch +//@ revisions: loongarch64_unknown_none +//@ [loongarch64_unknown_none] compile-flags: --target loongarch64-unknown-none +//@ [loongarch64_unknown_none] needs-llvm-components: loongarch +//@ revisions: loongarch64_unknown_none_softfloat +//@ [loongarch64_unknown_none_softfloat] compile-flags: --target loongarch64-unknown-none-softfloat +//@ [loongarch64_unknown_none_softfloat] needs-llvm-components: loongarch +//@ revisions: m68k_unknown_linux_gnu +//@ [m68k_unknown_linux_gnu] compile-flags: --target m68k-unknown-linux-gnu +//@ [m68k_unknown_linux_gnu] needs-llvm-components: m68k +//@ revisions: mips64_openwrt_linux_musl +//@ [mips64_openwrt_linux_musl] compile-flags: --target mips64-openwrt-linux-musl +//@ [mips64_openwrt_linux_musl] needs-llvm-components: mips +//@ revisions: mips64_unknown_linux_gnuabi64 +//@ [mips64_unknown_linux_gnuabi64] compile-flags: --target mips64-unknown-linux-gnuabi64 +//@ [mips64_unknown_linux_gnuabi64] needs-llvm-components: mips +//@ revisions: mips64_unknown_linux_muslabi64 +//@ [mips64_unknown_linux_muslabi64] compile-flags: --target mips64-unknown-linux-muslabi64 +//@ [mips64_unknown_linux_muslabi64] needs-llvm-components: mips +//@ revisions: mips64el_unknown_linux_gnuabi64 +//@ [mips64el_unknown_linux_gnuabi64] compile-flags: --target mips64el-unknown-linux-gnuabi64 +//@ [mips64el_unknown_linux_gnuabi64] needs-llvm-components: mips +//@ revisions: mips64el_unknown_linux_muslabi64 +//@ [mips64el_unknown_linux_muslabi64] compile-flags: --target mips64el-unknown-linux-muslabi64 +//@ [mips64el_unknown_linux_muslabi64] needs-llvm-components: mips +//@ revisions: mips_unknown_linux_gnu +//@ [mips_unknown_linux_gnu] compile-flags: --target mips-unknown-linux-gnu +//@ [mips_unknown_linux_gnu] needs-llvm-components: mips +//@ revisions: mips_unknown_linux_musl +//@ [mips_unknown_linux_musl] compile-flags: --target mips-unknown-linux-musl +//@ [mips_unknown_linux_musl] needs-llvm-components: mips +//@ revisions: mips_unknown_linux_uclibc +//@ [mips_unknown_linux_uclibc] compile-flags: --target mips-unknown-linux-uclibc +//@ [mips_unknown_linux_uclibc] needs-llvm-components: mips +//@ revisions: mipsel_sony_psp +//@ [mipsel_sony_psp] compile-flags: --target mipsel-sony-psp +//@ [mipsel_sony_psp] needs-llvm-components: mips +//@ revisions: mipsel_sony_psx +//@ [mipsel_sony_psx] compile-flags: --target mipsel-sony-psx +//@ [mipsel_sony_psx] needs-llvm-components: mips +//@ revisions: mipsel_unknown_linux_gnu +//@ [mipsel_unknown_linux_gnu] compile-flags: --target mipsel-unknown-linux-gnu +//@ [mipsel_unknown_linux_gnu] needs-llvm-components: mips +//@ revisions: mipsel_unknown_linux_musl +//@ [mipsel_unknown_linux_musl] compile-flags: --target mipsel-unknown-linux-musl +//@ [mipsel_unknown_linux_musl] needs-llvm-components: mips +//@ revisions: mipsel_unknown_linux_uclibc +//@ [mipsel_unknown_linux_uclibc] compile-flags: --target mipsel-unknown-linux-uclibc +//@ [mipsel_unknown_linux_uclibc] needs-llvm-components: mips +//@ revisions: mipsel_unknown_netbsd +//@ [mipsel_unknown_netbsd] compile-flags: --target mipsel-unknown-netbsd +//@ [mipsel_unknown_netbsd] needs-llvm-components: mips +//@ revisions: mipsel_unknown_none +//@ [mipsel_unknown_none] compile-flags: --target mipsel-unknown-none +//@ [mipsel_unknown_none] needs-llvm-components: mips +//@ revisions: mipsisa32r6_unknown_linux_gnu +//@ [mipsisa32r6_unknown_linux_gnu] compile-flags: --target mipsisa32r6-unknown-linux-gnu +//@ [mipsisa32r6_unknown_linux_gnu] needs-llvm-components: mips +//@ revisions: mipsisa32r6el_unknown_linux_gnu +//@ [mipsisa32r6el_unknown_linux_gnu] compile-flags: --target mipsisa32r6el-unknown-linux-gnu +//@ [mipsisa32r6el_unknown_linux_gnu] needs-llvm-components: mips +//@ revisions: mipsisa64r6_unknown_linux_gnuabi64 +//@ [mipsisa64r6_unknown_linux_gnuabi64] compile-flags: --target mipsisa64r6-unknown-linux-gnuabi64 +//@ [mipsisa64r6_unknown_linux_gnuabi64] needs-llvm-components: mips +//@ revisions: mipsisa64r6el_unknown_linux_gnuabi64 +//@ [mipsisa64r6el_unknown_linux_gnuabi64] compile-flags: --target mipsisa64r6el-unknown-linux-gnuabi64 +//@ [mipsisa64r6el_unknown_linux_gnuabi64] needs-llvm-components: mips +//@ revisions: msp430_none_elf +//@ [msp430_none_elf] compile-flags: --target msp430-none-elf +//@ [msp430_none_elf] needs-llvm-components: msp430 +//@ revisions: powerpc64_unknown_freebsd +//@ [powerpc64_unknown_freebsd] compile-flags: --target powerpc64-unknown-freebsd +//@ [powerpc64_unknown_freebsd] needs-llvm-components: powerpc +//@ revisions: powerpc64_unknown_linux_gnu +//@ [powerpc64_unknown_linux_gnu] compile-flags: --target powerpc64-unknown-linux-gnu +//@ [powerpc64_unknown_linux_gnu] needs-llvm-components: powerpc +//@ revisions: powerpc64_unknown_linux_musl +//@ [powerpc64_unknown_linux_musl] compile-flags: --target powerpc64-unknown-linux-musl +//@ [powerpc64_unknown_linux_musl] needs-llvm-components: powerpc +//@ revisions: powerpc64_unknown_openbsd +//@ [powerpc64_unknown_openbsd] compile-flags: --target powerpc64-unknown-openbsd +//@ [powerpc64_unknown_openbsd] needs-llvm-components: powerpc +//@ revisions: powerpc64_wrs_vxworks +//@ [powerpc64_wrs_vxworks] compile-flags: --target powerpc64-wrs-vxworks +//@ [powerpc64_wrs_vxworks] needs-llvm-components: powerpc +//@ revisions: powerpc64le_unknown_freebsd +//@ [powerpc64le_unknown_freebsd] compile-flags: --target powerpc64le-unknown-freebsd +//@ [powerpc64le_unknown_freebsd] needs-llvm-components: powerpc +//@ revisions: powerpc64le_unknown_linux_gnu +//@ [powerpc64le_unknown_linux_gnu] compile-flags: --target powerpc64le-unknown-linux-gnu +//@ [powerpc64le_unknown_linux_gnu] needs-llvm-components: powerpc +//@ revisions: powerpc64le_unknown_linux_musl +//@ [powerpc64le_unknown_linux_musl] compile-flags: --target powerpc64le-unknown-linux-musl +//@ [powerpc64le_unknown_linux_musl] needs-llvm-components: powerpc +//@ revisions: powerpc_unknown_freebsd +//@ [powerpc_unknown_freebsd] compile-flags: --target powerpc-unknown-freebsd +//@ [powerpc_unknown_freebsd] needs-llvm-components: powerpc +//@ revisions: powerpc_unknown_linux_gnu +//@ [powerpc_unknown_linux_gnu] compile-flags: --target powerpc-unknown-linux-gnu +//@ [powerpc_unknown_linux_gnu] needs-llvm-components: powerpc +//@ revisions: powerpc_unknown_linux_gnuspe +//@ [powerpc_unknown_linux_gnuspe] compile-flags: --target powerpc-unknown-linux-gnuspe +//@ [powerpc_unknown_linux_gnuspe] needs-llvm-components: powerpc +//@ revisions: powerpc_unknown_linux_musl +//@ [powerpc_unknown_linux_musl] compile-flags: --target powerpc-unknown-linux-musl +//@ [powerpc_unknown_linux_musl] needs-llvm-components: powerpc +//@ revisions: powerpc_unknown_netbsd +//@ [powerpc_unknown_netbsd] compile-flags: --target powerpc-unknown-netbsd +//@ [powerpc_unknown_netbsd] needs-llvm-components: powerpc +//@ revisions: powerpc_unknown_openbsd +//@ [powerpc_unknown_openbsd] compile-flags: --target powerpc-unknown-openbsd +//@ [powerpc_unknown_openbsd] needs-llvm-components: powerpc +//@ revisions: powerpc_wrs_vxworks +//@ [powerpc_wrs_vxworks] compile-flags: --target powerpc-wrs-vxworks +//@ [powerpc_wrs_vxworks] needs-llvm-components: powerpc +//@ revisions: powerpc_wrs_vxworks_spe +//@ [powerpc_wrs_vxworks_spe] compile-flags: --target powerpc-wrs-vxworks-spe +//@ [powerpc_wrs_vxworks_spe] needs-llvm-components: powerpc +//@ revisions: riscv32gc_unknown_linux_gnu +//@ [riscv32gc_unknown_linux_gnu] compile-flags: --target riscv32gc-unknown-linux-gnu +//@ [riscv32gc_unknown_linux_gnu] needs-llvm-components: riscv +//@ revisions: riscv32gc_unknown_linux_musl +//@ [riscv32gc_unknown_linux_musl] compile-flags: --target riscv32gc-unknown-linux-musl +//@ [riscv32gc_unknown_linux_musl] needs-llvm-components: riscv +//@ revisions: riscv32i_unknown_none_elf +//@ [riscv32i_unknown_none_elf] compile-flags: --target riscv32i-unknown-none-elf +//@ [riscv32i_unknown_none_elf] needs-llvm-components: riscv +//@ revisions: riscv32im_risc0_zkvm_elf +//@ [riscv32im_risc0_zkvm_elf] compile-flags: --target riscv32im-risc0-zkvm-elf +//@ [riscv32im_risc0_zkvm_elf] needs-llvm-components: riscv +//@ revisions: riscv32im_unknown_none_elf +//@ [riscv32im_unknown_none_elf] compile-flags: --target riscv32im-unknown-none-elf +//@ [riscv32im_unknown_none_elf] needs-llvm-components: riscv +//@ revisions: riscv32imac_esp_espidf +//@ [riscv32imac_esp_espidf] compile-flags: --target riscv32imac-esp-espidf +//@ [riscv32imac_esp_espidf] needs-llvm-components: riscv +//@ revisions: riscv32imac_unknown_none_elf +//@ [riscv32imac_unknown_none_elf] compile-flags: --target riscv32imac-unknown-none-elf +//@ [riscv32imac_unknown_none_elf] needs-llvm-components: riscv +//@ revisions: riscv32imac_unknown_xous_elf +//@ [riscv32imac_unknown_xous_elf] compile-flags: --target riscv32imac-unknown-xous-elf +//@ [riscv32imac_unknown_xous_elf] needs-llvm-components: riscv +//@ revisions: riscv32imafc_unknown_none_elf +//@ [riscv32imafc_unknown_none_elf] compile-flags: --target riscv32imafc-unknown-none-elf +//@ [riscv32imafc_unknown_none_elf] needs-llvm-components: riscv +//@ revisions: riscv32imafc_esp_espidf +//@ [riscv32imafc_esp_espidf] compile-flags: --target riscv32imafc-esp-espidf +//@ [riscv32imafc_esp_espidf] needs-llvm-components: riscv +//@ revisions: riscv32imc_esp_espidf +//@ [riscv32imc_esp_espidf] compile-flags: --target riscv32imc-esp-espidf +//@ [riscv32imc_esp_espidf] needs-llvm-components: riscv +//@ revisions: riscv32imc_unknown_none_elf +//@ [riscv32imc_unknown_none_elf] compile-flags: --target riscv32imc-unknown-none-elf +//@ [riscv32imc_unknown_none_elf] needs-llvm-components: riscv +//@ revisions: riscv64_linux_android +//@ [riscv64_linux_android] compile-flags: --target riscv64-linux-android +//@ [riscv64_linux_android] needs-llvm-components: riscv +//@ revisions: riscv64gc_unknown_freebsd +//@ [riscv64gc_unknown_freebsd] compile-flags: --target riscv64gc-unknown-freebsd +//@ [riscv64gc_unknown_freebsd] needs-llvm-components: riscv +//@ revisions: riscv64gc_unknown_fuchsia +//@ [riscv64gc_unknown_fuchsia] compile-flags: --target riscv64gc-unknown-fuchsia +//@ [riscv64gc_unknown_fuchsia] needs-llvm-components: riscv +//@ revisions: riscv64gc_unknown_hermit +//@ [riscv64gc_unknown_hermit] compile-flags: --target riscv64gc-unknown-hermit +//@ [riscv64gc_unknown_hermit] needs-llvm-components: riscv +//@ revisions: riscv64gc_unknown_linux_gnu +//@ [riscv64gc_unknown_linux_gnu] compile-flags: --target riscv64gc-unknown-linux-gnu +//@ [riscv64gc_unknown_linux_gnu] needs-llvm-components: riscv +//@ revisions: riscv64gc_unknown_linux_musl +//@ [riscv64gc_unknown_linux_musl] compile-flags: --target riscv64gc-unknown-linux-musl +//@ [riscv64gc_unknown_linux_musl] needs-llvm-components: riscv +//@ revisions: riscv64gc_unknown_netbsd +//@ [riscv64gc_unknown_netbsd] compile-flags: --target riscv64gc-unknown-netbsd +//@ [riscv64gc_unknown_netbsd] needs-llvm-components: riscv +//@ revisions: riscv64gc_unknown_none_elf +//@ [riscv64gc_unknown_none_elf] compile-flags: --target riscv64gc-unknown-none-elf +//@ [riscv64gc_unknown_none_elf] needs-llvm-components: riscv +//@ revisions: riscv64gc_unknown_openbsd +//@ [riscv64gc_unknown_openbsd] compile-flags: --target riscv64gc-unknown-openbsd +//@ [riscv64gc_unknown_openbsd] needs-llvm-components: riscv +//@ revisions: riscv64imac_unknown_none_elf +//@ [riscv64imac_unknown_none_elf] compile-flags: --target riscv64imac-unknown-none-elf +//@ [riscv64imac_unknown_none_elf] needs-llvm-components: riscv +//@ revisions: s390x_unknown_linux_gnu +//@ [s390x_unknown_linux_gnu] compile-flags: --target s390x-unknown-linux-gnu +//@ [s390x_unknown_linux_gnu] needs-llvm-components: systemz +//@ revisions: s390x_unknown_linux_musl +//@ [s390x_unknown_linux_musl] compile-flags: --target s390x-unknown-linux-musl +//@ [s390x_unknown_linux_musl] needs-llvm-components: systemz +//@ revisions: sparc64_unknown_linux_gnu +//@ [sparc64_unknown_linux_gnu] compile-flags: --target sparc64-unknown-linux-gnu +//@ [sparc64_unknown_linux_gnu] needs-llvm-components: sparc +//@ revisions: sparc64_unknown_netbsd +//@ [sparc64_unknown_netbsd] compile-flags: --target sparc64-unknown-netbsd +//@ [sparc64_unknown_netbsd] needs-llvm-components: sparc +//@ revisions: sparc64_unknown_openbsd +//@ [sparc64_unknown_openbsd] compile-flags: --target sparc64-unknown-openbsd +//@ [sparc64_unknown_openbsd] needs-llvm-components: sparc +//@ revisions: sparc_unknown_linux_gnu +//@ [sparc_unknown_linux_gnu] compile-flags: --target sparc-unknown-linux-gnu +//@ [sparc_unknown_linux_gnu] needs-llvm-components: sparc +//@ revisions: sparc_unknown_none_elf +//@ [sparc_unknown_none_elf] compile-flags: --target sparc-unknown-none-elf +//@ [sparc_unknown_none_elf] needs-llvm-components: sparc +//@ revisions: sparcv9_sun_solaris +//@ [sparcv9_sun_solaris] compile-flags: --target sparcv9-sun-solaris +//@ [sparcv9_sun_solaris] needs-llvm-components: sparc +//@ revisions: thumbv4t_none_eabi +//@ [thumbv4t_none_eabi] compile-flags: --target thumbv4t-none-eabi +//@ [thumbv4t_none_eabi] needs-llvm-components: arm +//@ revisions: thumbv5te_none_eabi +//@ [thumbv5te_none_eabi] compile-flags: --target thumbv5te-none-eabi +//@ [thumbv5te_none_eabi] needs-llvm-components: arm +//@ revisions: thumbv6m_none_eabi +//@ [thumbv6m_none_eabi] compile-flags: --target thumbv6m-none-eabi +//@ [thumbv6m_none_eabi] needs-llvm-components: arm +//@ revisions: thumbv7em_none_eabi +//@ [thumbv7em_none_eabi] compile-flags: --target thumbv7em-none-eabi +//@ [thumbv7em_none_eabi] needs-llvm-components: arm +//@ revisions: thumbv7em_none_eabihf +//@ [thumbv7em_none_eabihf] compile-flags: --target thumbv7em-none-eabihf +//@ [thumbv7em_none_eabihf] needs-llvm-components: arm +//@ revisions: thumbv7m_none_eabi +//@ [thumbv7m_none_eabi] compile-flags: --target thumbv7m-none-eabi +//@ [thumbv7m_none_eabi] needs-llvm-components: arm +//@ revisions: thumbv7neon_linux_androideabi +//@ [thumbv7neon_linux_androideabi] compile-flags: --target thumbv7neon-linux-androideabi +//@ [thumbv7neon_linux_androideabi] needs-llvm-components: arm +//@ revisions: thumbv7neon_unknown_linux_gnueabihf +//@ [thumbv7neon_unknown_linux_gnueabihf] compile-flags: --target thumbv7neon-unknown-linux-gnueabihf +//@ [thumbv7neon_unknown_linux_gnueabihf] needs-llvm-components: arm +//@ revisions: thumbv7neon_unknown_linux_musleabihf +//@ [thumbv7neon_unknown_linux_musleabihf] compile-flags: --target thumbv7neon-unknown-linux-musleabihf +//@ [thumbv7neon_unknown_linux_musleabihf] needs-llvm-components: arm +//@ revisions: thumbv8m_base_none_eabi +//@ [thumbv8m_base_none_eabi] compile-flags: --target thumbv8m.base-none-eabi +//@ [thumbv8m_base_none_eabi] needs-llvm-components: arm +//@ revisions: thumbv8m_main_none_eabi +//@ [thumbv8m_main_none_eabi] compile-flags: --target thumbv8m.main-none-eabi +//@ [thumbv8m_main_none_eabi] needs-llvm-components: arm +//@ revisions: thumbv8m_main_none_eabihf +//@ [thumbv8m_main_none_eabihf] compile-flags: --target thumbv8m.main-none-eabihf +//@ [thumbv8m_main_none_eabihf] needs-llvm-components: arm +//@ revisions: wasm32_unknown_emscripten +//@ [wasm32_unknown_emscripten] compile-flags: --target wasm32-unknown-emscripten +//@ [wasm32_unknown_emscripten] needs-llvm-components: webassembly +//@ revisions: wasm32_unknown_unknown +//@ [wasm32_unknown_unknown] compile-flags: --target wasm32-unknown-unknown +//@ [wasm32_unknown_unknown] needs-llvm-components: webassembly +//@ revisions: wasm32_wasi +//@ [wasm32_wasi] compile-flags: --target wasm32-wasi +//@ [wasm32_wasi] needs-llvm-components: webassembly +//@ revisions: wasm32_wasi_preview1_threads +//@ [wasm32_wasi_preview1_threads] compile-flags: --target wasm32-wasi-preview1-threads +//@ [wasm32_wasi_preview1_threads] needs-llvm-components: webassembly +//@ revisions: wasm64_unknown_unknown +//@ [wasm64_unknown_unknown] compile-flags: --target wasm64-unknown-unknown +//@ [wasm64_unknown_unknown] needs-llvm-components: webassembly +//@ revisions: x86_64_fortanix_unknown_sgx +//@ [x86_64_fortanix_unknown_sgx] compile-flags: --target x86_64-fortanix-unknown-sgx +//@ [x86_64_fortanix_unknown_sgx] needs-llvm-components: x86 +//@ revisions: x86_64_fuchsia +//@ [x86_64_fuchsia] compile-flags: --target x86_64-fuchsia +//@ [x86_64_fuchsia] needs-llvm-components: x86 +//@ revisions: x86_64_linux_android +//@ [x86_64_linux_android] compile-flags: --target x86_64-linux-android +//@ [x86_64_linux_android] needs-llvm-components: x86 +//@ revisions: x86_64_pc_nto_qnx710 +//@ [x86_64_pc_nto_qnx710] compile-flags: --target x86_64-pc-nto-qnx710 +//@ [x86_64_pc_nto_qnx710] needs-llvm-components: x86 +//@ revisions: x86_64_pc_solaris +//@ [x86_64_pc_solaris] compile-flags: --target x86_64-pc-solaris +//@ [x86_64_pc_solaris] needs-llvm-components: x86 +//@ revisions: x86_64_unikraft_linux_musl +//@ [x86_64_unikraft_linux_musl] compile-flags: --target x86_64-unikraft-linux-musl +//@ [x86_64_unikraft_linux_musl] needs-llvm-components: x86 +//@ revisions: x86_64_unknown_dragonfly +//@ [x86_64_unknown_dragonfly] compile-flags: --target x86_64-unknown-dragonfly +//@ [x86_64_unknown_dragonfly] needs-llvm-components: x86 +//@ revisions: x86_64_unknown_freebsd +//@ [x86_64_unknown_freebsd] compile-flags: --target x86_64-unknown-freebsd +//@ [x86_64_unknown_freebsd] needs-llvm-components: x86 +//@ revisions: x86_64_unknown_fuchsia +//@ [x86_64_unknown_fuchsia] compile-flags: --target x86_64-unknown-fuchsia +//@ [x86_64_unknown_fuchsia] needs-llvm-components: x86 +//@ revisions: x86_64_unknown_haiku +//@ [x86_64_unknown_haiku] compile-flags: --target x86_64-unknown-haiku +//@ [x86_64_unknown_haiku] needs-llvm-components: x86 +//@ revisions: x86_64_unknown_hermit +//@ [x86_64_unknown_hermit] compile-flags: --target x86_64-unknown-hermit +//@ [x86_64_unknown_hermit] needs-llvm-components: x86 +//@ revisions: x86_64_unknown_illumos +//@ [x86_64_unknown_illumos] compile-flags: --target x86_64-unknown-illumos +//@ [x86_64_unknown_illumos] needs-llvm-components: x86 +//@ revisions: x86_64_unknown_l4re_uclibc +//@ [x86_64_unknown_l4re_uclibc] compile-flags: --target x86_64-unknown-l4re-uclibc +//@ [x86_64_unknown_l4re_uclibc] needs-llvm-components: x86 +//@ revisions: x86_64_unknown_linux_gnu +//@ [x86_64_unknown_linux_gnu] compile-flags: --target x86_64-unknown-linux-gnu +//@ [x86_64_unknown_linux_gnu] needs-llvm-components: x86 +//@ revisions: x86_64_unknown_linux_gnux32 +//@ [x86_64_unknown_linux_gnux32] compile-flags: --target x86_64-unknown-linux-gnux32 +//@ [x86_64_unknown_linux_gnux32] needs-llvm-components: x86 +//@ revisions: x86_64_unknown_linux_musl +//@ [x86_64_unknown_linux_musl] compile-flags: --target x86_64-unknown-linux-musl +//@ [x86_64_unknown_linux_musl] needs-llvm-components: x86 +//@ revisions: x86_64_unknown_linux_ohos +//@ [x86_64_unknown_linux_ohos] compile-flags: --target x86_64-unknown-linux-ohos +//@ [x86_64_unknown_linux_ohos] needs-llvm-components: x86 +//@ revisions: x86_64_unknown_netbsd +//@ [x86_64_unknown_netbsd] compile-flags: --target x86_64-unknown-netbsd +//@ [x86_64_unknown_netbsd] needs-llvm-components: x86 +//@ revisions: x86_64_unknown_none +//@ [x86_64_unknown_none] compile-flags: --target x86_64-unknown-none +//@ [x86_64_unknown_none] needs-llvm-components: x86 +//@ revisions: x86_64_unknown_openbsd +//@ [x86_64_unknown_openbsd] compile-flags: --target x86_64-unknown-openbsd +//@ [x86_64_unknown_openbsd] needs-llvm-components: x86 +//@ revisions: x86_64_unknown_redox +//@ [x86_64_unknown_redox] compile-flags: --target x86_64-unknown-redox +//@ [x86_64_unknown_redox] needs-llvm-components: x86 +//@ revisions: x86_64_wrs_vxworks +//@ [x86_64_wrs_vxworks] compile-flags: --target x86_64-wrs-vxworks +//@ [x86_64_wrs_vxworks] needs-llvm-components: x86 // Sanity-check that each target can produce assembly code. diff --git a/tests/assembly/targets/targets-macho.rs b/tests/assembly/targets/targets-macho.rs index ead9ccfc8e74..bbdafb76e5a9 100644 --- a/tests/assembly/targets/targets-macho.rs +++ b/tests/assembly/targets/targets-macho.rs @@ -1,68 +1,68 @@ -// assembly-output: emit-asm +//@ assembly-output: emit-asm // ignore-tidy-linelength -// revisions: aarch64_apple_darwin -// [aarch64_apple_darwin] compile-flags: --target aarch64-apple-darwin -// [aarch64_apple_darwin] needs-llvm-components: aarch64 -// revisions: aarch64_apple_ios -// [aarch64_apple_ios] compile-flags: --target aarch64-apple-ios -// [aarch64_apple_ios] needs-llvm-components: aarch64 -// revisions: aarch64_apple_ios_macabi -// [aarch64_apple_ios_macabi] compile-flags: --target aarch64-apple-ios-macabi -// [aarch64_apple_ios_macabi] needs-llvm-components: aarch64 -// revisions: aarch64_apple_ios_sim -// [aarch64_apple_ios_sim] compile-flags: --target aarch64-apple-ios-sim -// [aarch64_apple_ios_sim] needs-llvm-components: aarch64 -// revisions: aarch64_apple_tvos -// [aarch64_apple_tvos] compile-flags: --target aarch64-apple-tvos -// [aarch64_apple_tvos] needs-llvm-components: aarch64 -// revisions: aarch64_apple_tvos_sim -// [aarch64_apple_tvos_sim] compile-flags: --target aarch64-apple-tvos-sim -// [aarch64_apple_tvos_sim] needs-llvm-components: aarch64 -// revisions: aarch64_apple_watchos -// [aarch64_apple_watchos] compile-flags: --target aarch64-apple-watchos -// [aarch64_apple_watchos] needs-llvm-components: aarch64 -// revisions: aarch64_apple_watchos_sim -// [aarch64_apple_watchos_sim] compile-flags: --target aarch64-apple-watchos-sim -// [aarch64_apple_watchos_sim] needs-llvm-components: aarch64 -// revisions: arm64_32_apple_watchos -// [arm64_32_apple_watchos] compile-flags: --target arm64_32-apple-watchos -// [arm64_32_apple_watchos] needs-llvm-components: aarch64 -// revisions: arm64e_apple_darwin -// [arm64e_apple_darwin] compile-flags: --target arm64e-apple-darwin -// [arm64e_apple_darwin] needs-llvm-components: aarch64 -// revisions: arm64e_apple_ios -// [arm64e_apple_ios] compile-flags: --target arm64e-apple-ios -// [arm64e_apple_ios] needs-llvm-components: aarch64 -// revisions: armv7k_apple_watchos -// [armv7k_apple_watchos] compile-flags: --target armv7k-apple-watchos -// [armv7k_apple_watchos] needs-llvm-components: arm -// revisions: armv7s_apple_ios -// [armv7s_apple_ios] compile-flags: --target armv7s-apple-ios -// [armv7s_apple_ios] needs-llvm-components: arm -// revisions: i386_apple_ios -// [i386_apple_ios] compile-flags: --target i386-apple-ios -// [i386_apple_ios] needs-llvm-components: x86 -// revisions: i686_apple_darwin -// [i686_apple_darwin] compile-flags: --target i686-apple-darwin -// [i686_apple_darwin] needs-llvm-components: x86 -// revisions: x86_64_apple_darwin -// [x86_64_apple_darwin] compile-flags: --target x86_64-apple-darwin -// [x86_64_apple_darwin] needs-llvm-components: x86 -// revisions: x86_64_apple_ios -// [x86_64_apple_ios] compile-flags: --target x86_64-apple-ios -// [x86_64_apple_ios] needs-llvm-components: x86 -// revisions: x86_64_apple_ios_macabi -// [x86_64_apple_ios_macabi] compile-flags: --target x86_64-apple-ios-macabi -// [x86_64_apple_ios_macabi] needs-llvm-components: x86 -// revisions: x86_64_apple_tvos -// [x86_64_apple_tvos] compile-flags: --target x86_64-apple-tvos -// [x86_64_apple_tvos] needs-llvm-components: x86 -// revisions: x86_64_apple_watchos_sim -// [x86_64_apple_watchos_sim] compile-flags: --target x86_64-apple-watchos-sim -// [x86_64_apple_watchos_sim] needs-llvm-components: x86 -// revisions: x86_64h_apple_darwin -// [x86_64h_apple_darwin] compile-flags: --target x86_64h-apple-darwin -// [x86_64h_apple_darwin] needs-llvm-components: x86 +//@ revisions: aarch64_apple_darwin +//@ [aarch64_apple_darwin] compile-flags: --target aarch64-apple-darwin +//@ [aarch64_apple_darwin] needs-llvm-components: aarch64 +//@ revisions: aarch64_apple_ios +//@ [aarch64_apple_ios] compile-flags: --target aarch64-apple-ios +//@ [aarch64_apple_ios] needs-llvm-components: aarch64 +//@ revisions: aarch64_apple_ios_macabi +//@ [aarch64_apple_ios_macabi] compile-flags: --target aarch64-apple-ios-macabi +//@ [aarch64_apple_ios_macabi] needs-llvm-components: aarch64 +//@ revisions: aarch64_apple_ios_sim +//@ [aarch64_apple_ios_sim] compile-flags: --target aarch64-apple-ios-sim +//@ [aarch64_apple_ios_sim] needs-llvm-components: aarch64 +//@ revisions: aarch64_apple_tvos +//@ [aarch64_apple_tvos] compile-flags: --target aarch64-apple-tvos +//@ [aarch64_apple_tvos] needs-llvm-components: aarch64 +//@ revisions: aarch64_apple_tvos_sim +//@ [aarch64_apple_tvos_sim] compile-flags: --target aarch64-apple-tvos-sim +//@ [aarch64_apple_tvos_sim] needs-llvm-components: aarch64 +//@ revisions: aarch64_apple_watchos +//@ [aarch64_apple_watchos] compile-flags: --target aarch64-apple-watchos +//@ [aarch64_apple_watchos] needs-llvm-components: aarch64 +//@ revisions: aarch64_apple_watchos_sim +//@ [aarch64_apple_watchos_sim] compile-flags: --target aarch64-apple-watchos-sim +//@ [aarch64_apple_watchos_sim] needs-llvm-components: aarch64 +//@ revisions: arm64_32_apple_watchos +//@ [arm64_32_apple_watchos] compile-flags: --target arm64_32-apple-watchos +//@ [arm64_32_apple_watchos] needs-llvm-components: aarch64 +//@ revisions: arm64e_apple_darwin +//@ [arm64e_apple_darwin] compile-flags: --target arm64e-apple-darwin +//@ [arm64e_apple_darwin] needs-llvm-components: aarch64 +//@ revisions: arm64e_apple_ios +//@ [arm64e_apple_ios] compile-flags: --target arm64e-apple-ios +//@ [arm64e_apple_ios] needs-llvm-components: aarch64 +//@ revisions: armv7k_apple_watchos +//@ [armv7k_apple_watchos] compile-flags: --target armv7k-apple-watchos +//@ [armv7k_apple_watchos] needs-llvm-components: arm +//@ revisions: armv7s_apple_ios +//@ [armv7s_apple_ios] compile-flags: --target armv7s-apple-ios +//@ [armv7s_apple_ios] needs-llvm-components: arm +//@ revisions: i386_apple_ios +//@ [i386_apple_ios] compile-flags: --target i386-apple-ios +//@ [i386_apple_ios] needs-llvm-components: x86 +//@ revisions: i686_apple_darwin +//@ [i686_apple_darwin] compile-flags: --target i686-apple-darwin +//@ [i686_apple_darwin] needs-llvm-components: x86 +//@ revisions: x86_64_apple_darwin +//@ [x86_64_apple_darwin] compile-flags: --target x86_64-apple-darwin +//@ [x86_64_apple_darwin] needs-llvm-components: x86 +//@ revisions: x86_64_apple_ios +//@ [x86_64_apple_ios] compile-flags: --target x86_64-apple-ios +//@ [x86_64_apple_ios] needs-llvm-components: x86 +//@ revisions: x86_64_apple_ios_macabi +//@ [x86_64_apple_ios_macabi] compile-flags: --target x86_64-apple-ios-macabi +//@ [x86_64_apple_ios_macabi] needs-llvm-components: x86 +//@ revisions: x86_64_apple_tvos +//@ [x86_64_apple_tvos] compile-flags: --target x86_64-apple-tvos +//@ [x86_64_apple_tvos] needs-llvm-components: x86 +//@ revisions: x86_64_apple_watchos_sim +//@ [x86_64_apple_watchos_sim] compile-flags: --target x86_64-apple-watchos-sim +//@ [x86_64_apple_watchos_sim] needs-llvm-components: x86 +//@ revisions: x86_64h_apple_darwin +//@ [x86_64h_apple_darwin] compile-flags: --target x86_64h-apple-darwin +//@ [x86_64h_apple_darwin] needs-llvm-components: x86 // Sanity-check that each target can produce assembly code. diff --git a/tests/assembly/targets/targets-nvptx.rs b/tests/assembly/targets/targets-nvptx.rs index 063342304000..9048191affa1 100644 --- a/tests/assembly/targets/targets-nvptx.rs +++ b/tests/assembly/targets/targets-nvptx.rs @@ -1,8 +1,8 @@ -// assembly-output: emit-asm +//@ assembly-output: emit-asm // ignore-tidy-linelength -// revisions: nvptx64_nvidia_cuda -// [nvptx64_nvidia_cuda] compile-flags: --target nvptx64-nvidia-cuda -// [nvptx64_nvidia_cuda] needs-llvm-components: nvptx +//@ revisions: nvptx64_nvidia_cuda +//@ [nvptx64_nvidia_cuda] compile-flags: --target nvptx64-nvidia-cuda +//@ [nvptx64_nvidia_cuda] needs-llvm-components: nvptx // Sanity-check that each target can produce assembly code. diff --git a/tests/assembly/targets/targets-pe.rs b/tests/assembly/targets/targets-pe.rs index 7398d7ef7900..63b07ee4d1a9 100644 --- a/tests/assembly/targets/targets-pe.rs +++ b/tests/assembly/targets/targets-pe.rs @@ -1,80 +1,80 @@ -// assembly-output: emit-asm +//@ assembly-output: emit-asm // ignore-tidy-linelength -// revisions: aarch64_pc_windows_msvc -// [aarch64_pc_windows_msvc] compile-flags: --target aarch64-pc-windows-msvc -// [aarch64_pc_windows_msvc] needs-llvm-components: aarch64 -// revisions: aarch64_pc_windows_gnullvm -// [aarch64_pc_windows_gnullvm] compile-flags: --target aarch64-pc-windows-gnullvm -// [aarch64_pc_windows_gnullvm] needs-llvm-components: aarch64 -// revisions: aarch64_unknown_uefi -// [aarch64_unknown_uefi] compile-flags: --target aarch64-unknown-uefi -// [aarch64_unknown_uefi] needs-llvm-components: aarch64 -// revisions: aarch64_uwp_windows_msvc -// [aarch64_uwp_windows_msvc] compile-flags: --target aarch64-uwp-windows-msvc -// [aarch64_uwp_windows_msvc] needs-llvm-components: aarch64 -// revisions: avr_unknown_gnu_atmega328 -// [avr_unknown_gnu_atmega328] compile-flags: --target avr-unknown-gnu-atmega328 -// [avr_unknown_gnu_atmega328] needs-llvm-components: avr -// revisions: bpfeb_unknown_none -// [bpfeb_unknown_none] compile-flags: --target bpfeb-unknown-none -// [bpfeb_unknown_none] needs-llvm-components: bpf -// revisions: bpfel_unknown_none -// [bpfel_unknown_none] compile-flags: --target bpfel-unknown-none -// [bpfel_unknown_none] needs-llvm-components: bpf -// revisions: i586_pc_windows_msvc -// [i586_pc_windows_msvc] compile-flags: --target i586-pc-windows-msvc -// [i586_pc_windows_msvc] needs-llvm-components: x86 -// revisions: i686_pc_windows_gnu -// [i686_pc_windows_gnu] compile-flags: --target i686-pc-windows-gnu -// [i686_pc_windows_gnu] needs-llvm-components: x86 -// revisions: i686_pc_windows_msvc -// [i686_pc_windows_msvc] compile-flags: --target i686-pc-windows-msvc -// [i686_pc_windows_msvc] needs-llvm-components: x86 -// revisions: i686_pc_windows_gnullvm -// [i686_pc_windows_gnullvm] compile-flags: --target i686-pc-windows-gnullvm -// [i686_pc_windows_gnullvm] needs-llvm-components: x86 -// revisions: i686_uwp_windows_gnu -// [i686_uwp_windows_gnu] compile-flags: --target i686-uwp-windows-gnu -// [i686_uwp_windows_gnu] needs-llvm-components: x86 -// revisions: i686_unknown_uefi -// [i686_unknown_uefi] compile-flags: --target i686-unknown-uefi -// [i686_unknown_uefi] needs-llvm-components: x86 -// revisions: i686_uwp_windows_msvc -// [i686_uwp_windows_msvc] compile-flags: --target i686-uwp-windows-msvc -// [i686_uwp_windows_msvc] needs-llvm-components: x86 -// revisions: i686_win7_windows_msvc -// [i686_win7_windows_msvc] compile-flags: --target i686-win7-windows-msvc -// [i686_win7_windows_msvc] needs-llvm-components: x86 -// revisions: powerpc64_ibm_aix -// [powerpc64_ibm_aix] compile-flags: --target powerpc64-ibm-aix -// [powerpc64_ibm_aix] needs-llvm-components: powerpc -// revisions: thumbv7a_uwp_windows_msvc -// [thumbv7a_uwp_windows_msvc] compile-flags: --target thumbv7a-uwp-windows-msvc -// [thumbv7a_uwp_windows_msvc] needs-llvm-components: arm -// revisions: thumbv7a_pc_windows_msvc -// [thumbv7a_pc_windows_msvc] compile-flags: --target thumbv7a-pc-windows-msvc -// [thumbv7a_pc_windows_msvc] needs-llvm-components: arm -// revisions: x86_64_pc_windows_gnu -// [x86_64_pc_windows_gnu] compile-flags: --target x86_64-pc-windows-gnu -// [x86_64_pc_windows_gnu] needs-llvm-components: x86 -// revisions: x86_64_pc_windows_gnullvm -// [x86_64_pc_windows_gnullvm] compile-flags: --target x86_64-pc-windows-gnullvm -// [x86_64_pc_windows_gnullvm] needs-llvm-components: x86 -// revisions: x86_64_pc_windows_msvc -// [x86_64_pc_windows_msvc] compile-flags: --target x86_64-pc-windows-msvc -// [x86_64_pc_windows_msvc] needs-llvm-components: x86 -// revisions: x86_64_unknown_uefi -// [x86_64_unknown_uefi] compile-flags: --target x86_64-unknown-uefi -// [x86_64_unknown_uefi] needs-llvm-components: x86 -// revisions: x86_64_uwp_windows_gnu -// [x86_64_uwp_windows_gnu] compile-flags: --target x86_64-uwp-windows-gnu -// [x86_64_uwp_windows_gnu] needs-llvm-components: x86 -// revisions: x86_64_uwp_windows_msvc -// [x86_64_uwp_windows_msvc] compile-flags: --target x86_64-uwp-windows-msvc -// [x86_64_uwp_windows_msvc] needs-llvm-components: x86 -// revisions: x86_64_win7_windows_msvc -// [x86_64_win7_windows_msvc] compile-flags: --target x86_64-win7-windows-msvc -// [x86_64_win7_windows_msvc] needs-llvm-components: x86 +//@ revisions: aarch64_pc_windows_msvc +//@ [aarch64_pc_windows_msvc] compile-flags: --target aarch64-pc-windows-msvc +//@ [aarch64_pc_windows_msvc] needs-llvm-components: aarch64 +//@ revisions: aarch64_pc_windows_gnullvm +//@ [aarch64_pc_windows_gnullvm] compile-flags: --target aarch64-pc-windows-gnullvm +//@ [aarch64_pc_windows_gnullvm] needs-llvm-components: aarch64 +//@ revisions: aarch64_unknown_uefi +//@ [aarch64_unknown_uefi] compile-flags: --target aarch64-unknown-uefi +//@ [aarch64_unknown_uefi] needs-llvm-components: aarch64 +//@ revisions: aarch64_uwp_windows_msvc +//@ [aarch64_uwp_windows_msvc] compile-flags: --target aarch64-uwp-windows-msvc +//@ [aarch64_uwp_windows_msvc] needs-llvm-components: aarch64 +//@ revisions: avr_unknown_gnu_atmega328 +//@ [avr_unknown_gnu_atmega328] compile-flags: --target avr-unknown-gnu-atmega328 +//@ [avr_unknown_gnu_atmega328] needs-llvm-components: avr +//@ revisions: bpfeb_unknown_none +//@ [bpfeb_unknown_none] compile-flags: --target bpfeb-unknown-none +//@ [bpfeb_unknown_none] needs-llvm-components: bpf +//@ revisions: bpfel_unknown_none +//@ [bpfel_unknown_none] compile-flags: --target bpfel-unknown-none +//@ [bpfel_unknown_none] needs-llvm-components: bpf +//@ revisions: i586_pc_windows_msvc +//@ [i586_pc_windows_msvc] compile-flags: --target i586-pc-windows-msvc +//@ [i586_pc_windows_msvc] needs-llvm-components: x86 +//@ revisions: i686_pc_windows_gnu +//@ [i686_pc_windows_gnu] compile-flags: --target i686-pc-windows-gnu +//@ [i686_pc_windows_gnu] needs-llvm-components: x86 +//@ revisions: i686_pc_windows_msvc +//@ [i686_pc_windows_msvc] compile-flags: --target i686-pc-windows-msvc +//@ [i686_pc_windows_msvc] needs-llvm-components: x86 +//@ revisions: i686_pc_windows_gnullvm +//@ [i686_pc_windows_gnullvm] compile-flags: --target i686-pc-windows-gnullvm +//@ [i686_pc_windows_gnullvm] needs-llvm-components: x86 +//@ revisions: i686_uwp_windows_gnu +//@ [i686_uwp_windows_gnu] compile-flags: --target i686-uwp-windows-gnu +//@ [i686_uwp_windows_gnu] needs-llvm-components: x86 +//@ revisions: i686_unknown_uefi +//@ [i686_unknown_uefi] compile-flags: --target i686-unknown-uefi +//@ [i686_unknown_uefi] needs-llvm-components: x86 +//@ revisions: i686_uwp_windows_msvc +//@ [i686_uwp_windows_msvc] compile-flags: --target i686-uwp-windows-msvc +//@ [i686_uwp_windows_msvc] needs-llvm-components: x86 +//@ revisions: i686_win7_windows_msvc +//@ [i686_win7_windows_msvc] compile-flags: --target i686-win7-windows-msvc +//@ [i686_win7_windows_msvc] needs-llvm-components: x86 +//@ revisions: powerpc64_ibm_aix +//@ [powerpc64_ibm_aix] compile-flags: --target powerpc64-ibm-aix +//@ [powerpc64_ibm_aix] needs-llvm-components: powerpc +//@ revisions: thumbv7a_uwp_windows_msvc +//@ [thumbv7a_uwp_windows_msvc] compile-flags: --target thumbv7a-uwp-windows-msvc +//@ [thumbv7a_uwp_windows_msvc] needs-llvm-components: arm +//@ revisions: thumbv7a_pc_windows_msvc +//@ [thumbv7a_pc_windows_msvc] compile-flags: --target thumbv7a-pc-windows-msvc +//@ [thumbv7a_pc_windows_msvc] needs-llvm-components: arm +//@ revisions: x86_64_pc_windows_gnu +//@ [x86_64_pc_windows_gnu] compile-flags: --target x86_64-pc-windows-gnu +//@ [x86_64_pc_windows_gnu] needs-llvm-components: x86 +//@ revisions: x86_64_pc_windows_gnullvm +//@ [x86_64_pc_windows_gnullvm] compile-flags: --target x86_64-pc-windows-gnullvm +//@ [x86_64_pc_windows_gnullvm] needs-llvm-components: x86 +//@ revisions: x86_64_pc_windows_msvc +//@ [x86_64_pc_windows_msvc] compile-flags: --target x86_64-pc-windows-msvc +//@ [x86_64_pc_windows_msvc] needs-llvm-components: x86 +//@ revisions: x86_64_unknown_uefi +//@ [x86_64_unknown_uefi] compile-flags: --target x86_64-unknown-uefi +//@ [x86_64_unknown_uefi] needs-llvm-components: x86 +//@ revisions: x86_64_uwp_windows_gnu +//@ [x86_64_uwp_windows_gnu] compile-flags: --target x86_64-uwp-windows-gnu +//@ [x86_64_uwp_windows_gnu] needs-llvm-components: x86 +//@ revisions: x86_64_uwp_windows_msvc +//@ [x86_64_uwp_windows_msvc] compile-flags: --target x86_64-uwp-windows-msvc +//@ [x86_64_uwp_windows_msvc] needs-llvm-components: x86 +//@ revisions: x86_64_win7_windows_msvc +//@ [x86_64_win7_windows_msvc] compile-flags: --target x86_64-win7-windows-msvc +//@ [x86_64_win7_windows_msvc] needs-llvm-components: x86 // Sanity-check that each target can produce assembly code. diff --git a/tests/assembly/thin-lto.rs b/tests/assembly/thin-lto.rs index deb8fd21d14f..182115662bfd 100644 --- a/tests/assembly/thin-lto.rs +++ b/tests/assembly/thin-lto.rs @@ -1,6 +1,6 @@ -// compile-flags: -O -C lto=thin -C prefer-dynamic=no -// only-x86_64-unknown-linux-gnu -// assembly-output: emit-asm +//@ compile-flags: -O -C lto=thin -C prefer-dynamic=no +//@ only-x86_64-unknown-linux-gnu +//@ assembly-output: emit-asm // CHECK: main diff --git a/tests/assembly/wasm_exceptions.rs b/tests/assembly/wasm_exceptions.rs index b7d20881b624..2ca62a786880 100644 --- a/tests/assembly/wasm_exceptions.rs +++ b/tests/assembly/wasm_exceptions.rs @@ -1,8 +1,8 @@ -// only-wasm32-bare -// assembly-output: emit-asm -// compile-flags: -C target-feature=+exception-handling -// compile-flags: -C panic=unwind -// compile-flags: -C llvm-args=-wasm-enable-eh +//@ only-wasm32-bare +//@ assembly-output: emit-asm +//@ compile-flags: -C target-feature=+exception-handling +//@ compile-flags: -C panic=unwind +//@ compile-flags: -C llvm-args=-wasm-enable-eh #![crate_type = "lib"] #![feature(core_intrinsics)] diff --git a/tests/assembly/x86_64-array-pair-load-store-merge.rs b/tests/assembly/x86_64-array-pair-load-store-merge.rs index 55e317e91bf0..9cf54ae14a16 100644 --- a/tests/assembly/x86_64-array-pair-load-store-merge.rs +++ b/tests/assembly/x86_64-array-pair-load-store-merge.rs @@ -1,8 +1,8 @@ -// assembly-output: emit-asm -// compile-flags: --crate-type=lib -O -C llvm-args=-x86-asm-syntax=intel -// only-x86_64 -// ignore-sgx -// ignore-macos (manipulates rsp too) +//@ assembly-output: emit-asm +//@ compile-flags: --crate-type=lib -O -C llvm-args=-x86-asm-syntax=intel +//@ only-x86_64 +//@ ignore-sgx +//@ ignore-macos (manipulates rsp too) // Depending on various codegen choices, this might end up copying // a `<2 x i8>`, an `i16`, or two `i8`s. diff --git a/tests/assembly/x86_64-floating-point-clamp.rs b/tests/assembly/x86_64-floating-point-clamp.rs index 0bc6baad4791..4a72a7f44fa0 100644 --- a/tests/assembly/x86_64-floating-point-clamp.rs +++ b/tests/assembly/x86_64-floating-point-clamp.rs @@ -1,10 +1,10 @@ // Floating-point clamp is designed to be implementable as max+min, // so check to make sure that's what it's actually emitting. -// assembly-output: emit-asm -// compile-flags: --crate-type=lib -O -C llvm-args=-x86-asm-syntax=intel -// only-x86_64 -// ignore-sgx +//@ assembly-output: emit-asm +//@ compile-flags: --crate-type=lib -O -C llvm-args=-x86-asm-syntax=intel +//@ only-x86_64 +//@ ignore-sgx // CHECK-LABEL: clamp_demo: #[no_mangle] diff --git a/tests/assembly/x86_64-fortanix-unknown-sgx-lvi-generic-load.rs b/tests/assembly/x86_64-fortanix-unknown-sgx-lvi-generic-load.rs index 7eb3c6948ac5..7215e354d0dc 100644 --- a/tests/assembly/x86_64-fortanix-unknown-sgx-lvi-generic-load.rs +++ b/tests/assembly/x86_64-fortanix-unknown-sgx-lvi-generic-load.rs @@ -1,8 +1,8 @@ // Test LVI load hardening on SGX enclave code -// assembly-output: emit-asm -// compile-flags: --crate-type staticlib -// only-x86_64-fortanix-unknown-sgx +//@ assembly-output: emit-asm +//@ compile-flags: --crate-type staticlib +//@ only-x86_64-fortanix-unknown-sgx #[no_mangle] pub extern fn plus_one(r: &mut u64) { diff --git a/tests/assembly/x86_64-fortanix-unknown-sgx-lvi-generic-ret.rs b/tests/assembly/x86_64-fortanix-unknown-sgx-lvi-generic-ret.rs index a21ef6b75894..5ae9dd11859e 100644 --- a/tests/assembly/x86_64-fortanix-unknown-sgx-lvi-generic-ret.rs +++ b/tests/assembly/x86_64-fortanix-unknown-sgx-lvi-generic-ret.rs @@ -1,8 +1,8 @@ // Test LVI ret hardening on generic rust code -// assembly-output: emit-asm -// compile-flags: --crate-type staticlib -// only-x86_64-fortanix-unknown-sgx +//@ assembly-output: emit-asm +//@ compile-flags: --crate-type staticlib +//@ only-x86_64-fortanix-unknown-sgx #[no_mangle] pub extern fn myret() {} diff --git a/tests/assembly/x86_64-fortanix-unknown-sgx-lvi-inline-assembly.rs b/tests/assembly/x86_64-fortanix-unknown-sgx-lvi-inline-assembly.rs index 4745ebc4fcd4..a729df8e1660 100644 --- a/tests/assembly/x86_64-fortanix-unknown-sgx-lvi-inline-assembly.rs +++ b/tests/assembly/x86_64-fortanix-unknown-sgx-lvi-inline-assembly.rs @@ -1,8 +1,8 @@ // Test LVI load hardening on SGX inline assembly code -// assembly-output: emit-asm -// compile-flags: --crate-type staticlib -// only-x86_64-fortanix-unknown-sgx +//@ assembly-output: emit-asm +//@ compile-flags: --crate-type staticlib +//@ only-x86_64-fortanix-unknown-sgx use std::arch::asm; diff --git a/tests/assembly/x86_64-function-return.rs b/tests/assembly/x86_64-function-return.rs index 0fcaca2d4910..64eb05062cbc 100644 --- a/tests/assembly/x86_64-function-return.rs +++ b/tests/assembly/x86_64-function-return.rs @@ -1,16 +1,16 @@ // Test that the function return is (not) converted into a jump to the thunk // when the `-Zfunction-return={keep,thunk-extern}` flag is (not) set. -// revisions: unset keep thunk-extern keep-thunk-extern thunk-extern-keep -// assembly-output: emit-asm -// compile-flags: -O -// [keep] compile-flags: -Zfunction-return=keep -// [thunk-extern] compile-flags: -Zfunction-return=thunk-extern -// [keep-thunk-extern] compile-flags: -Zfunction-return=keep -Zfunction-return=thunk-extern -// [thunk-extern-keep] compile-flags: -Zfunction-return=thunk-extern -Zfunction-return=keep -// only-x86_64 -// ignore-x86_64-apple-darwin Symbol is called `___x86_return_thunk` (Darwin's extra underscore) -// ignore-sgx Tests incompatible with LVI mitigations +//@ revisions: unset keep thunk-extern keep-thunk-extern thunk-extern-keep +//@ assembly-output: emit-asm +//@ compile-flags: -O +//@ [keep] compile-flags: -Zfunction-return=keep +//@ [thunk-extern] compile-flags: -Zfunction-return=thunk-extern +//@ [keep-thunk-extern] compile-flags: -Zfunction-return=keep -Zfunction-return=thunk-extern +//@ [thunk-extern-keep] compile-flags: -Zfunction-return=thunk-extern -Zfunction-return=keep +//@ only-x86_64 +//@ ignore-x86_64-apple-darwin Symbol is called `___x86_return_thunk` (Darwin's extra underscore) +//@ ignore-sgx Tests incompatible with LVI mitigations #![crate_type = "lib"] diff --git a/tests/assembly/x86_64-naked-fn-no-cet-prolog.rs b/tests/assembly/x86_64-naked-fn-no-cet-prolog.rs index bedcded731d9..a56838741821 100644 --- a/tests/assembly/x86_64-naked-fn-no-cet-prolog.rs +++ b/tests/assembly/x86_64-naked-fn-no-cet-prolog.rs @@ -1,7 +1,7 @@ -// compile-flags: -C no-prepopulate-passes -Zcf-protection=full -// assembly-output: emit-asm -// needs-asm-support -// only-x86_64 +//@ compile-flags: -C no-prepopulate-passes -Zcf-protection=full +//@ assembly-output: emit-asm +//@ needs-asm-support +//@ only-x86_64 #![crate_type = "lib"] #![feature(naked_functions)] diff --git a/tests/assembly/x86_64-no-jump-tables.rs b/tests/assembly/x86_64-no-jump-tables.rs index edf4adaad41a..9b7812262326 100644 --- a/tests/assembly/x86_64-no-jump-tables.rs +++ b/tests/assembly/x86_64-no-jump-tables.rs @@ -1,12 +1,12 @@ // Test that jump tables are (not) emitted when the `-Zno-jump-tables` // flag is (not) set. -// revisions: unset set -// assembly-output: emit-asm -// compile-flags: -O -// [set] compile-flags: -Zno-jump-tables -// only-x86_64 -// ignore-sgx +//@ revisions: unset set +//@ assembly-output: emit-asm +//@ compile-flags: -O +//@ [set] compile-flags: -Zno-jump-tables +//@ only-x86_64 +//@ ignore-sgx #![crate_type = "lib"] diff --git a/tests/assembly/x86_64-sse_crc.rs b/tests/assembly/x86_64-sse_crc.rs index cdbf057b80bd..bde58955a214 100644 --- a/tests/assembly/x86_64-sse_crc.rs +++ b/tests/assembly/x86_64-sse_crc.rs @@ -1,6 +1,6 @@ -// only-x86_64 -// assembly-output: emit-asm -// compile-flags: --crate-type staticlib -Ctarget-feature=+sse4.2 +//@ only-x86_64 +//@ assembly-output: emit-asm +//@ compile-flags: --crate-type staticlib -Ctarget-feature=+sse4.2 // CHECK-LABEL: banana // CHECK: crc32 diff --git a/tests/codegen-units/item-collection/asm-sym.rs b/tests/codegen-units/item-collection/asm-sym.rs index 4b05b771a9b2..948c98d5a3c8 100644 --- a/tests/codegen-units/item-collection/asm-sym.rs +++ b/tests/codegen-units/item-collection/asm-sym.rs @@ -1,5 +1,5 @@ -// needs-asm-support -// compile-flags: -Ccodegen-units=1 -Zprint-mono-items=lazy --crate-type=lib +//@ needs-asm-support +//@ compile-flags: -Ccodegen-units=1 -Zprint-mono-items=lazy --crate-type=lib #[inline(always)] pub unsafe fn f() { diff --git a/tests/codegen-units/item-collection/auxiliary/cgu_export_trait_method.rs b/tests/codegen-units/item-collection/auxiliary/cgu_export_trait_method.rs index e94dded55cff..5566bb4e4b28 100644 --- a/tests/codegen-units/item-collection/auxiliary/cgu_export_trait_method.rs +++ b/tests/codegen-units/item-collection/auxiliary/cgu_export_trait_method.rs @@ -1,4 +1,4 @@ -// compile-flags: -Copt-level=0 +//@ compile-flags: -Copt-level=0 #![crate_type = "lib"] diff --git a/tests/codegen-units/item-collection/cross-crate-closures.rs b/tests/codegen-units/item-collection/cross-crate-closures.rs index 6af344fab151..4ec7f17d5847 100644 --- a/tests/codegen-units/item-collection/cross-crate-closures.rs +++ b/tests/codegen-units/item-collection/cross-crate-closures.rs @@ -1,14 +1,14 @@ // In the current version of the collector that still has to support // legacy-codegen, closures do not generate their own MonoItems, so we are // ignoring this test until MIR codegen has taken over completely -// ignore-test +//@ ignore-test -// compile-flags:-Zprint-mono-items=eager +//@ compile-flags:-Zprint-mono-items=eager #![deny(dead_code)] #![feature(start)] -// aux-build:cgu_extern_closures.rs +//@ aux-build:cgu_extern_closures.rs extern crate cgu_extern_closures; //~ MONO_ITEM fn cross_crate_closures::start[0] diff --git a/tests/codegen-units/item-collection/cross-crate-generic-functions.rs b/tests/codegen-units/item-collection/cross-crate-generic-functions.rs index 7289ceee95b1..d36f7067b327 100644 --- a/tests/codegen-units/item-collection/cross-crate-generic-functions.rs +++ b/tests/codegen-units/item-collection/cross-crate-generic-functions.rs @@ -1,9 +1,9 @@ -// compile-flags:-Zprint-mono-items=eager +//@ compile-flags:-Zprint-mono-items=eager #![deny(dead_code)] #![feature(start)] -// aux-build:cgu_generic_function.rs +//@ aux-build:cgu_generic_function.rs extern crate cgu_generic_function; //~ MONO_ITEM fn start diff --git a/tests/codegen-units/item-collection/cross-crate-trait-method.rs b/tests/codegen-units/item-collection/cross-crate-trait-method.rs index 778b3820f18e..84977328e490 100644 --- a/tests/codegen-units/item-collection/cross-crate-trait-method.rs +++ b/tests/codegen-units/item-collection/cross-crate-trait-method.rs @@ -1,9 +1,9 @@ -// compile-flags:-Zprint-mono-items=eager -Zinline-mir=no -Copt-level=0 +//@ compile-flags:-Zprint-mono-items=eager -Zinline-mir=no -Copt-level=0 #![deny(dead_code)] #![feature(start)] -// aux-build:cgu_export_trait_method.rs +//@ aux-build:cgu_export_trait_method.rs extern crate cgu_export_trait_method; use cgu_export_trait_method::Trait; diff --git a/tests/codegen-units/item-collection/drop_in_place_intrinsic.rs b/tests/codegen-units/item-collection/drop_in_place_intrinsic.rs index a3f1fb5e7a25..66dcda260660 100644 --- a/tests/codegen-units/item-collection/drop_in_place_intrinsic.rs +++ b/tests/codegen-units/item-collection/drop_in_place_intrinsic.rs @@ -1,6 +1,6 @@ // -// compile-flags:-Zprint-mono-items=eager -// compile-flags:-Zinline-in-all-cgus +//@ compile-flags:-Zprint-mono-items=eager +//@ compile-flags:-Zinline-in-all-cgus #![feature(start)] diff --git a/tests/codegen-units/item-collection/function-as-argument.rs b/tests/codegen-units/item-collection/function-as-argument.rs index d951cbfacec6..4e6fd99d29ed 100644 --- a/tests/codegen-units/item-collection/function-as-argument.rs +++ b/tests/codegen-units/item-collection/function-as-argument.rs @@ -1,4 +1,4 @@ -// compile-flags:-Zprint-mono-items=eager -Zinline-mir=no +//@ compile-flags:-Zprint-mono-items=eager -Zinline-mir=no #![deny(dead_code)] #![feature(start)] diff --git a/tests/codegen-units/item-collection/generic-drop-glue.rs b/tests/codegen-units/item-collection/generic-drop-glue.rs index ca477d066109..99250dc7dc67 100644 --- a/tests/codegen-units/item-collection/generic-drop-glue.rs +++ b/tests/codegen-units/item-collection/generic-drop-glue.rs @@ -1,6 +1,6 @@ // -// compile-flags:-Zprint-mono-items=eager -// compile-flags:-Zinline-in-all-cgus +//@ compile-flags:-Zprint-mono-items=eager +//@ compile-flags:-Zinline-in-all-cgus #![deny(dead_code)] #![feature(start)] diff --git a/tests/codegen-units/item-collection/generic-functions.rs b/tests/codegen-units/item-collection/generic-functions.rs index f790cd0dadd7..2d7c70c9c4c7 100644 --- a/tests/codegen-units/item-collection/generic-functions.rs +++ b/tests/codegen-units/item-collection/generic-functions.rs @@ -1,4 +1,4 @@ -// compile-flags:-Zprint-mono-items=eager -Zinline-mir=no +//@ compile-flags:-Zprint-mono-items=eager -Zinline-mir=no #![deny(dead_code)] #![feature(start)] diff --git a/tests/codegen-units/item-collection/generic-impl.rs b/tests/codegen-units/item-collection/generic-impl.rs index e19eec36b31e..6e60907c1857 100644 --- a/tests/codegen-units/item-collection/generic-impl.rs +++ b/tests/codegen-units/item-collection/generic-impl.rs @@ -1,4 +1,4 @@ -// compile-flags:-Zprint-mono-items=eager -Zinline-mir=no +//@ compile-flags:-Zprint-mono-items=eager -Zinline-mir=no #![deny(dead_code)] #![feature(start)] diff --git a/tests/codegen-units/item-collection/impl-in-non-instantiated-generic.rs b/tests/codegen-units/item-collection/impl-in-non-instantiated-generic.rs index c01398eb2341..0b7f30187b58 100644 --- a/tests/codegen-units/item-collection/impl-in-non-instantiated-generic.rs +++ b/tests/codegen-units/item-collection/impl-in-non-instantiated-generic.rs @@ -1,4 +1,4 @@ -// compile-flags:-Zprint-mono-items=eager +//@ compile-flags:-Zprint-mono-items=eager #![deny(dead_code)] #![feature(start)] diff --git a/tests/codegen-units/item-collection/implicit-panic-call.rs b/tests/codegen-units/item-collection/implicit-panic-call.rs index abec7ad50aed..2e0d742307a8 100644 --- a/tests/codegen-units/item-collection/implicit-panic-call.rs +++ b/tests/codegen-units/item-collection/implicit-panic-call.rs @@ -1,4 +1,4 @@ -// compile-flags:-Zprint-mono-items=lazy +//@ compile-flags:-Zprint-mono-items=lazy // rust-lang/rust#90405 // Ensure implicit panic calls are collected diff --git a/tests/codegen-units/item-collection/instantiation-through-vtable.rs b/tests/codegen-units/item-collection/instantiation-through-vtable.rs index 41edab7f8793..08e8c03a7328 100644 --- a/tests/codegen-units/item-collection/instantiation-through-vtable.rs +++ b/tests/codegen-units/item-collection/instantiation-through-vtable.rs @@ -1,5 +1,5 @@ // -// compile-flags:-Zprint-mono-items=eager -Zinline-in-all-cgus -Zmir-opt-level=0 +//@ compile-flags:-Zprint-mono-items=eager -Zinline-in-all-cgus -Zmir-opt-level=0 #![deny(dead_code)] #![feature(start)] diff --git a/tests/codegen-units/item-collection/items-within-generic-items.rs b/tests/codegen-units/item-collection/items-within-generic-items.rs index bb1a3be36c5c..7798d2b46d22 100644 --- a/tests/codegen-units/item-collection/items-within-generic-items.rs +++ b/tests/codegen-units/item-collection/items-within-generic-items.rs @@ -1,4 +1,4 @@ -// compile-flags:-Zprint-mono-items=eager -Copt-level=0 +//@ compile-flags:-Zprint-mono-items=eager -Copt-level=0 #![deny(dead_code)] #![feature(start)] diff --git a/tests/codegen-units/item-collection/non-generic-closures.rs b/tests/codegen-units/item-collection/non-generic-closures.rs index 379fbcf2613e..105348e9d09e 100644 --- a/tests/codegen-units/item-collection/non-generic-closures.rs +++ b/tests/codegen-units/item-collection/non-generic-closures.rs @@ -1,10 +1,10 @@ // In the current version of the collector that still has to support // legacy-codegen, closures do not generate their own MonoItems, so we are // ignoring this test until MIR codegen has taken over completely -// ignore-test +//@ ignore-test // -// compile-flags:-Zprint-mono-items=eager +//@ compile-flags:-Zprint-mono-items=eager #![deny(dead_code)] #![feature(start)] diff --git a/tests/codegen-units/item-collection/non-generic-drop-glue.rs b/tests/codegen-units/item-collection/non-generic-drop-glue.rs index 06f76f7db366..d74b17463bf1 100644 --- a/tests/codegen-units/item-collection/non-generic-drop-glue.rs +++ b/tests/codegen-units/item-collection/non-generic-drop-glue.rs @@ -1,6 +1,6 @@ // -// compile-flags:-Zprint-mono-items=eager -// compile-flags:-Zinline-in-all-cgus +//@ compile-flags:-Zprint-mono-items=eager +//@ compile-flags:-Zinline-in-all-cgus #![deny(dead_code)] #![feature(start)] diff --git a/tests/codegen-units/item-collection/non-generic-functions.rs b/tests/codegen-units/item-collection/non-generic-functions.rs index 092e64562c52..49a999a0d7c8 100644 --- a/tests/codegen-units/item-collection/non-generic-functions.rs +++ b/tests/codegen-units/item-collection/non-generic-functions.rs @@ -1,4 +1,4 @@ -// compile-flags:-Zprint-mono-items=eager +//@ compile-flags:-Zprint-mono-items=eager #![deny(dead_code)] #![feature(start)] diff --git a/tests/codegen-units/item-collection/overloaded-operators.rs b/tests/codegen-units/item-collection/overloaded-operators.rs index 2be7eba1d84a..23141c27de6e 100644 --- a/tests/codegen-units/item-collection/overloaded-operators.rs +++ b/tests/codegen-units/item-collection/overloaded-operators.rs @@ -1,4 +1,4 @@ -// compile-flags:-Zprint-mono-items=eager +//@ compile-flags:-Zprint-mono-items=eager #![deny(dead_code)] #![crate_type="lib"] diff --git a/tests/codegen-units/item-collection/static-init.rs b/tests/codegen-units/item-collection/static-init.rs index 287ec8f24ebc..b357f5cd66b2 100644 --- a/tests/codegen-units/item-collection/static-init.rs +++ b/tests/codegen-units/item-collection/static-init.rs @@ -1,4 +1,4 @@ -// compile-flags:-Zprint-mono-items=eager -Zpolymorphize=on +//@ compile-flags:-Zprint-mono-items=eager -Zpolymorphize=on #![feature(start)] diff --git a/tests/codegen-units/item-collection/statics-and-consts.rs b/tests/codegen-units/item-collection/statics-and-consts.rs index 49a8d3dff639..1e3782f0c6e6 100644 --- a/tests/codegen-units/item-collection/statics-and-consts.rs +++ b/tests/codegen-units/item-collection/statics-and-consts.rs @@ -1,4 +1,4 @@ -// compile-flags:-Zprint-mono-items=eager +//@ compile-flags:-Zprint-mono-items=eager #![deny(dead_code)] #![feature(start)] diff --git a/tests/codegen-units/item-collection/trait-implementations.rs b/tests/codegen-units/item-collection/trait-implementations.rs index ad0ed7da28e6..b364cc5b3336 100644 --- a/tests/codegen-units/item-collection/trait-implementations.rs +++ b/tests/codegen-units/item-collection/trait-implementations.rs @@ -1,4 +1,4 @@ -// compile-flags:-Zprint-mono-items=eager -Zinline-mir=no +//@ compile-flags:-Zprint-mono-items=eager -Zinline-mir=no #![deny(dead_code)] #![feature(start)] diff --git a/tests/codegen-units/item-collection/trait-method-as-argument.rs b/tests/codegen-units/item-collection/trait-method-as-argument.rs index 164ef794ca7e..c25e3ea45ecc 100644 --- a/tests/codegen-units/item-collection/trait-method-as-argument.rs +++ b/tests/codegen-units/item-collection/trait-method-as-argument.rs @@ -1,4 +1,4 @@ -// compile-flags:-Zprint-mono-items=eager -Zinline-mir=no +//@ compile-flags:-Zprint-mono-items=eager -Zinline-mir=no #![deny(dead_code)] #![feature(start)] diff --git a/tests/codegen-units/item-collection/trait-method-default-impl.rs b/tests/codegen-units/item-collection/trait-method-default-impl.rs index c8a4552b11ac..89fec350f09c 100644 --- a/tests/codegen-units/item-collection/trait-method-default-impl.rs +++ b/tests/codegen-units/item-collection/trait-method-default-impl.rs @@ -1,4 +1,4 @@ -// compile-flags:-Zprint-mono-items=eager -Zpolymorphize=on -Zinline-mir=no +//@ compile-flags:-Zprint-mono-items=eager -Zpolymorphize=on -Zinline-mir=no #![deny(dead_code)] #![feature(start)] diff --git a/tests/codegen-units/item-collection/transitive-drop-glue.rs b/tests/codegen-units/item-collection/transitive-drop-glue.rs index 5f20637b40fa..7c879dee1a19 100644 --- a/tests/codegen-units/item-collection/transitive-drop-glue.rs +++ b/tests/codegen-units/item-collection/transitive-drop-glue.rs @@ -1,6 +1,6 @@ // -// compile-flags:-Zprint-mono-items=eager -// compile-flags:-Zinline-in-all-cgus +//@ compile-flags:-Zprint-mono-items=eager +//@ compile-flags:-Zinline-in-all-cgus #![deny(dead_code)] #![feature(start)] diff --git a/tests/codegen-units/item-collection/tuple-drop-glue.rs b/tests/codegen-units/item-collection/tuple-drop-glue.rs index ae3b2e081ffa..9d8b0cdd3844 100644 --- a/tests/codegen-units/item-collection/tuple-drop-glue.rs +++ b/tests/codegen-units/item-collection/tuple-drop-glue.rs @@ -1,6 +1,6 @@ // -// compile-flags:-Zprint-mono-items=eager -// compile-flags:-Zinline-in-all-cgus +//@ compile-flags:-Zprint-mono-items=eager +//@ compile-flags:-Zinline-in-all-cgus #![deny(dead_code)] #![feature(start)] diff --git a/tests/codegen-units/item-collection/unreferenced-const-fn.rs b/tests/codegen-units/item-collection/unreferenced-const-fn.rs index 5f59d801504e..8b37570a1be5 100644 --- a/tests/codegen-units/item-collection/unreferenced-const-fn.rs +++ b/tests/codegen-units/item-collection/unreferenced-const-fn.rs @@ -1,4 +1,4 @@ -// compile-flags:-Zprint-mono-items=lazy +//@ compile-flags:-Zprint-mono-items=lazy #![deny(dead_code)] #![crate_type = "rlib"] diff --git a/tests/codegen-units/item-collection/unreferenced-inline-function.rs b/tests/codegen-units/item-collection/unreferenced-inline-function.rs index 4d095e4d6c7e..f725cce90d61 100644 --- a/tests/codegen-units/item-collection/unreferenced-inline-function.rs +++ b/tests/codegen-units/item-collection/unreferenced-inline-function.rs @@ -1,4 +1,4 @@ -// compile-flags:-Zprint-mono-items=lazy +//@ compile-flags:-Zprint-mono-items=lazy // N.B., we do not expect *any* monomorphization to be generated here. diff --git a/tests/codegen-units/item-collection/unsizing.rs b/tests/codegen-units/item-collection/unsizing.rs index f578b00f2766..1e2d7f174845 100644 --- a/tests/codegen-units/item-collection/unsizing.rs +++ b/tests/codegen-units/item-collection/unsizing.rs @@ -1,6 +1,6 @@ -// compile-flags:-Zprint-mono-items=eager -// compile-flags:-Zinline-in-all-cgus -// compile-flags:-Zmir-opt-level=0 +//@ compile-flags:-Zprint-mono-items=eager +//@ compile-flags:-Zinline-in-all-cgus +//@ compile-flags:-Zmir-opt-level=0 #![deny(dead_code)] #![feature(coerce_unsized)] diff --git a/tests/codegen-units/item-collection/unused-traits-and-generics.rs b/tests/codegen-units/item-collection/unused-traits-and-generics.rs index 561dc1a5c076..27cdae2c0962 100644 --- a/tests/codegen-units/item-collection/unused-traits-and-generics.rs +++ b/tests/codegen-units/item-collection/unused-traits-and-generics.rs @@ -1,4 +1,4 @@ -// compile-flags:-Zprint-mono-items=eager +//@ compile-flags:-Zprint-mono-items=eager #![crate_type="lib"] #![deny(dead_code)] diff --git a/tests/codegen-units/partitioning/auxiliary/shared_generics_aux.rs b/tests/codegen-units/partitioning/auxiliary/shared_generics_aux.rs index ffbd0dc54844..158932d165df 100644 --- a/tests/codegen-units/partitioning/auxiliary/shared_generics_aux.rs +++ b/tests/codegen-units/partitioning/auxiliary/shared_generics_aux.rs @@ -1,7 +1,7 @@ // NOTE: We always compile this test with -Copt-level=0 because higher opt-levels // prevent drop-glue from participating in share-generics. -// compile-flags:-Zshare-generics=yes -Copt-level=0 -// no-prefer-dynamic +//@ compile-flags:-Zshare-generics=yes -Copt-level=0 +//@ no-prefer-dynamic #![crate_type="rlib"] diff --git a/tests/codegen-units/partitioning/extern-drop-glue.rs b/tests/codegen-units/partitioning/extern-drop-glue.rs index c73d2a10a967..84eb802f264b 100644 --- a/tests/codegen-units/partitioning/extern-drop-glue.rs +++ b/tests/codegen-units/partitioning/extern-drop-glue.rs @@ -1,16 +1,16 @@ // // We specify incremental here because we want to test the partitioning for -// incremental compilation +//@ incremental compilation // We specify opt-level=0 because `drop_in_place` is `Internal` when optimizing -// incremental -// compile-flags:-Zprint-mono-items=lazy -// compile-flags:-Zinline-in-all-cgus -Copt-level=0 +//@ incremental +//@ compile-flags:-Zprint-mono-items=lazy +//@ compile-flags:-Zinline-in-all-cgus -Copt-level=0 #![allow(dead_code)] #![crate_type = "rlib"] -// aux-build:cgu_extern_drop_glue.rs +//@ aux-build:cgu_extern_drop_glue.rs extern crate cgu_extern_drop_glue; //~ MONO_ITEM fn std::ptr::drop_in_place:: - shim(Some(cgu_extern_drop_glue::Struct)) @@ extern_drop_glue-fallback.cgu[External] diff --git a/tests/codegen-units/partitioning/extern-generic.rs b/tests/codegen-units/partitioning/extern-generic.rs index 638ec079a0bc..abd3918094d7 100644 --- a/tests/codegen-units/partitioning/extern-generic.rs +++ b/tests/codegen-units/partitioning/extern-generic.rs @@ -1,13 +1,13 @@ // // We specify incremental here because we want to test the partitioning for -// incremental compilation -// incremental -// compile-flags:-Zprint-mono-items=eager -Zshare-generics=y +//@ incremental compilation +//@ incremental +//@ compile-flags:-Zprint-mono-items=eager -Zshare-generics=y #![allow(dead_code)] #![crate_type="lib"] -// aux-build:cgu_generic_function.rs +//@ aux-build:cgu_generic_function.rs extern crate cgu_generic_function; //~ MONO_ITEM fn user @@ extern_generic[Internal] diff --git a/tests/codegen-units/partitioning/incremental-merging.rs b/tests/codegen-units/partitioning/incremental-merging.rs index 118b7bdf4da8..b44090c866a0 100644 --- a/tests/codegen-units/partitioning/incremental-merging.rs +++ b/tests/codegen-units/partitioning/incremental-merging.rs @@ -1,8 +1,8 @@ // We specify incremental here because we want to test the partitioning for -// incremental compilation -// incremental -// compile-flags:-Zprint-mono-items=lazy -// compile-flags:-Ccodegen-units=3 +//@ incremental compilation +//@ incremental +//@ compile-flags:-Zprint-mono-items=lazy +//@ compile-flags:-Ccodegen-units=3 #![crate_type = "rlib"] diff --git a/tests/codegen-units/partitioning/inlining-from-extern-crate.rs b/tests/codegen-units/partitioning/inlining-from-extern-crate.rs index 1cc21632e481..74734d3cf38a 100644 --- a/tests/codegen-units/partitioning/inlining-from-extern-crate.rs +++ b/tests/codegen-units/partitioning/inlining-from-extern-crate.rs @@ -1,13 +1,13 @@ // // We specify incremental here because we want to test the partitioning for -// incremental compilation -// incremental -// compile-flags:-Zprint-mono-items=lazy -// compile-flags:-Zinline-in-all-cgus +//@ incremental compilation +//@ incremental +//@ compile-flags:-Zprint-mono-items=lazy +//@ compile-flags:-Zinline-in-all-cgus #![crate_type="lib"] -// aux-build:cgu_explicit_inlining.rs +//@ aux-build:cgu_explicit_inlining.rs extern crate cgu_explicit_inlining; // This test makes sure that items inlined from external crates are privately diff --git a/tests/codegen-units/partitioning/local-drop-glue.rs b/tests/codegen-units/partitioning/local-drop-glue.rs index 2fd853a44b8f..0974187ade0d 100644 --- a/tests/codegen-units/partitioning/local-drop-glue.rs +++ b/tests/codegen-units/partitioning/local-drop-glue.rs @@ -1,10 +1,10 @@ // // We specify incremental here because we want to test the partitioning for -// incremental compilation +//@ incremental compilation // We specify opt-level=0 because `drop_in_place` is `Internal` when optimizing -// incremental -// compile-flags:-Zprint-mono-items=lazy -// compile-flags:-Zinline-in-all-cgus -Copt-level=0 +//@ incremental +//@ compile-flags:-Zprint-mono-items=lazy +//@ compile-flags:-Zinline-in-all-cgus -Copt-level=0 #![allow(dead_code)] #![crate_type = "rlib"] diff --git a/tests/codegen-units/partitioning/local-generic.rs b/tests/codegen-units/partitioning/local-generic.rs index 38aec7291df3..2cfdc27ccb14 100644 --- a/tests/codegen-units/partitioning/local-generic.rs +++ b/tests/codegen-units/partitioning/local-generic.rs @@ -1,7 +1,7 @@ // We specify incremental here because we want to test the partitioning for -// incremental compilation -// incremental -// compile-flags:-Zprint-mono-items=eager +//@ incremental compilation +//@ incremental +//@ compile-flags:-Zprint-mono-items=eager #![allow(dead_code)] #![crate_type="lib"] diff --git a/tests/codegen-units/partitioning/local-inlining-but-not-all.rs b/tests/codegen-units/partitioning/local-inlining-but-not-all.rs index 318f0c28a598..49a2ce7c5d9d 100644 --- a/tests/codegen-units/partitioning/local-inlining-but-not-all.rs +++ b/tests/codegen-units/partitioning/local-inlining-but-not-all.rs @@ -1,9 +1,9 @@ // // We specify incremental here because we want to test the partitioning for -// incremental compilation -// incremental -// compile-flags:-Zprint-mono-items=lazy -// compile-flags:-Zinline-in-all-cgus=no +//@ incremental compilation +//@ incremental +//@ compile-flags:-Zprint-mono-items=lazy +//@ compile-flags:-Zinline-in-all-cgus=no #![allow(dead_code)] #![crate_type="lib"] diff --git a/tests/codegen-units/partitioning/local-inlining.rs b/tests/codegen-units/partitioning/local-inlining.rs index 841a428e9dd2..726cf2b87d26 100644 --- a/tests/codegen-units/partitioning/local-inlining.rs +++ b/tests/codegen-units/partitioning/local-inlining.rs @@ -1,9 +1,9 @@ // // We specify incremental here because we want to test the partitioning for -// incremental compilation -// incremental -// compile-flags:-Zprint-mono-items=lazy -// compile-flags:-Zinline-in-all-cgus +//@ incremental compilation +//@ incremental +//@ compile-flags:-Zprint-mono-items=lazy +//@ compile-flags:-Zinline-in-all-cgus #![allow(dead_code)] #![crate_type="lib"] diff --git a/tests/codegen-units/partitioning/local-transitive-inlining.rs b/tests/codegen-units/partitioning/local-transitive-inlining.rs index 03c37954d151..355eb6cf3954 100644 --- a/tests/codegen-units/partitioning/local-transitive-inlining.rs +++ b/tests/codegen-units/partitioning/local-transitive-inlining.rs @@ -1,9 +1,9 @@ // // We specify incremental here because we want to test the partitioning for -// incremental compilation -// incremental -// compile-flags:-Zprint-mono-items=lazy -// compile-flags:-Zinline-in-all-cgus +//@ incremental compilation +//@ incremental +//@ compile-flags:-Zprint-mono-items=lazy +//@ compile-flags:-Zinline-in-all-cgus #![allow(dead_code)] #![crate_type="rlib"] diff --git a/tests/codegen-units/partitioning/methods-are-with-self-type.rs b/tests/codegen-units/partitioning/methods-are-with-self-type.rs index 8220dc12ee0c..2e54725ff285 100644 --- a/tests/codegen-units/partitioning/methods-are-with-self-type.rs +++ b/tests/codegen-units/partitioning/methods-are-with-self-type.rs @@ -1,13 +1,13 @@ // Currently, all generic functions are instantiated in each codegen unit that // uses them, even those not marked with #[inline], so this test does not make // much sense at the moment. -// ignore-test +//@ ignore-test // // We specify incremental here because we want to test the partitioning for -// incremental compilation -// incremental -// compile-flags:-Zprint-mono-items=lazy +//@ incremental compilation +//@ incremental +//@ compile-flags:-Zprint-mono-items=lazy #![allow(dead_code)] #![feature(start)] diff --git a/tests/codegen-units/partitioning/regular-modules.rs b/tests/codegen-units/partitioning/regular-modules.rs index ce7fe9c3a4ff..0eb0848e4544 100644 --- a/tests/codegen-units/partitioning/regular-modules.rs +++ b/tests/codegen-units/partitioning/regular-modules.rs @@ -1,7 +1,7 @@ // We specify incremental here because we want to test the partitioning for -// incremental compilation -// incremental -// compile-flags:-Zprint-mono-items=eager +//@ incremental compilation +//@ incremental +//@ compile-flags:-Zprint-mono-items=eager #![allow(dead_code)] #![crate_type="lib"] diff --git a/tests/codegen-units/partitioning/shared-generics.rs b/tests/codegen-units/partitioning/shared-generics.rs index ebe96bfb746a..25ea7fab7355 100644 --- a/tests/codegen-units/partitioning/shared-generics.rs +++ b/tests/codegen-units/partitioning/shared-generics.rs @@ -1,13 +1,13 @@ // -// no-prefer-dynamic +//@ no-prefer-dynamic // NOTE: We always compile this test with -Copt-level=0 because higher opt-levels // prevent drop-glue from participating in share-generics. -// incremental -// compile-flags:-Zprint-mono-items=eager -Zshare-generics=yes -Copt-level=0 +//@ incremental +//@ compile-flags:-Zprint-mono-items=eager -Zshare-generics=yes -Copt-level=0 #![crate_type="rlib"] -// aux-build:shared_generics_aux.rs +//@ aux-build:shared_generics_aux.rs extern crate shared_generics_aux; //~ MONO_ITEM fn foo diff --git a/tests/codegen-units/partitioning/statics.rs b/tests/codegen-units/partitioning/statics.rs index b11d6696dc00..9503a91b0ab4 100644 --- a/tests/codegen-units/partitioning/statics.rs +++ b/tests/codegen-units/partitioning/statics.rs @@ -1,7 +1,7 @@ // We specify incremental here because we want to test the partitioning for -// incremental compilation -// incremental -// compile-flags:-Zprint-mono-items=lazy +//@ incremental compilation +//@ incremental +//@ compile-flags:-Zprint-mono-items=lazy #![crate_type="rlib"] diff --git a/tests/codegen-units/partitioning/vtable-through-const.rs b/tests/codegen-units/partitioning/vtable-through-const.rs index cedcca804b36..111b4fa1b9ac 100644 --- a/tests/codegen-units/partitioning/vtable-through-const.rs +++ b/tests/codegen-units/partitioning/vtable-through-const.rs @@ -1,10 +1,10 @@ // // We specify incremental here because we want to test the partitioning for -// incremental compilation -// incremental -// compile-flags:-Zprint-mono-items=lazy -// compile-flags:-Zinline-in-all-cgus +//@ incremental compilation +//@ incremental +//@ compile-flags:-Zprint-mono-items=lazy +//@ compile-flags:-Zinline-in-all-cgus // This test case makes sure, that references made through constants are // recorded properly in the InliningMap. diff --git a/tests/codegen-units/polymorphization/auxiliary/poly-dep.rs b/tests/codegen-units/polymorphization/auxiliary/poly-dep.rs index fdbfa1b096d4..d6cbd282ec1d 100644 --- a/tests/codegen-units/polymorphization/auxiliary/poly-dep.rs +++ b/tests/codegen-units/polymorphization/auxiliary/poly-dep.rs @@ -1,4 +1,4 @@ -// compile-flags: -Zpolymorphize=on +//@ compile-flags: -Zpolymorphize=on #[inline(never)] pub fn foo() {} diff --git a/tests/codegen-units/polymorphization/poly-foreign.rs b/tests/codegen-units/polymorphization/poly-foreign.rs index 9da082daf114..05dbac46d368 100644 --- a/tests/codegen-units/polymorphization/poly-foreign.rs +++ b/tests/codegen-units/polymorphization/poly-foreign.rs @@ -1,5 +1,5 @@ -// aux-build:poly-dep.rs -// compile-flags: --crate-type=lib -Zprint-mono-items=eager -Zpolymorphize=on +//@ aux-build:poly-dep.rs +//@ compile-flags: --crate-type=lib -Zprint-mono-items=eager -Zpolymorphize=on extern crate poly_dep; diff --git a/tests/codegen-units/polymorphization/unused_type_parameters.rs b/tests/codegen-units/polymorphization/unused_type_parameters.rs index c2e06d067dc6..cf5f7c320985 100644 --- a/tests/codegen-units/polymorphization/unused_type_parameters.rs +++ b/tests/codegen-units/polymorphization/unused_type_parameters.rs @@ -1,4 +1,4 @@ -// compile-flags:-Zpolymorphize=on -Zprint-mono-items=lazy -Copt-level=1 +//@ compile-flags:-Zpolymorphize=on -Zprint-mono-items=lazy -Copt-level=1 #![crate_type = "rlib"] diff --git a/tests/codegen/aarch64-struct-align-128.rs b/tests/codegen/aarch64-struct-align-128.rs index bf34717786d4..0a30a2527da6 100644 --- a/tests/codegen/aarch64-struct-align-128.rs +++ b/tests/codegen/aarch64-struct-align-128.rs @@ -1,12 +1,12 @@ // Test that structs aligned to 128 bits are passed with the correct ABI on aarch64. -// revisions:linux darwin windows -//[linux] compile-flags: --target aarch64-unknown-linux-gnu -//[darwin] compile-flags: --target aarch64-apple-darwin -//[windows] compile-flags: --target aarch64-pc-windows-msvc -//[linux] needs-llvm-components: aarch64 -//[darwin] needs-llvm-components: aarch64 -//[windows] needs-llvm-components: aarch64 +//@ revisions:linux darwin windows +//@[linux] compile-flags: --target aarch64-unknown-linux-gnu +//@[darwin] compile-flags: --target aarch64-apple-darwin +//@[windows] compile-flags: --target aarch64-pc-windows-msvc +//@[linux] needs-llvm-components: aarch64 +//@[darwin] needs-llvm-components: aarch64 +//@[windows] needs-llvm-components: aarch64 #![feature(no_core, lang_items)] #![crate_type = "lib"] diff --git a/tests/codegen/abi-efiapi.rs b/tests/codegen/abi-efiapi.rs index 9502ebf59af7..fa73f649ed87 100644 --- a/tests/codegen/abi-efiapi.rs +++ b/tests/codegen/abi-efiapi.rs @@ -1,17 +1,17 @@ // Checks if the correct annotation for the efiapi ABI is passed to llvm. -// revisions:x86_64 i686 aarch64 arm riscv -//[x86_64] compile-flags: --target x86_64-unknown-uefi -//[x86_64] needs-llvm-components: aarch64 arm riscv -//[i686] compile-flags: --target i686-unknown-linux-musl -//[i686] needs-llvm-components: aarch64 arm riscv -//[aarch64] compile-flags: --target aarch64-unknown-none -//[aarch64] needs-llvm-components: aarch64 arm riscv -//[arm] compile-flags: --target armv7r-none-eabi -//[arm] needs-llvm-components: aarch64 arm riscv -//[riscv] compile-flags: --target riscv64gc-unknown-none-elf -//[riscv] needs-llvm-components: aarch64 arm riscv -// compile-flags: -C no-prepopulate-passes +//@ revisions:x86_64 i686 aarch64 arm riscv +//@[x86_64] compile-flags: --target x86_64-unknown-uefi +//@[x86_64] needs-llvm-components: aarch64 arm riscv +//@[i686] compile-flags: --target i686-unknown-linux-musl +//@[i686] needs-llvm-components: aarch64 arm riscv +//@[aarch64] compile-flags: --target aarch64-unknown-none +//@[aarch64] needs-llvm-components: aarch64 arm riscv +//@[arm] compile-flags: --target armv7r-none-eabi +//@[arm] needs-llvm-components: aarch64 arm riscv +//@[riscv] compile-flags: --target riscv64gc-unknown-none-elf +//@[riscv] needs-llvm-components: aarch64 arm riscv +//@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] #![feature(no_core, lang_items)] diff --git a/tests/codegen/abi-main-signature-16bit-c-int.rs b/tests/codegen/abi-main-signature-16bit-c-int.rs index ce4d35dea0c8..9832088ab338 100644 --- a/tests/codegen/abi-main-signature-16bit-c-int.rs +++ b/tests/codegen/abi-main-signature-16bit-c-int.rs @@ -2,9 +2,9 @@ // entry point. It must match C's `int main(int, char **)`. // This test is for targets with 16bit c_int only. -// revisions: avr msp -//[avr] only-avr -//[msp] only-msp430 +//@ revisions: avr msp +//@[avr] only-avr +//@[msp] only-msp430 fn main() { diff --git a/tests/codegen/abi-main-signature-32bit-c-int.rs b/tests/codegen/abi-main-signature-32bit-c-int.rs index 771ca66daf8e..52db3d893e1f 100644 --- a/tests/codegen/abi-main-signature-32bit-c-int.rs +++ b/tests/codegen/abi-main-signature-32bit-c-int.rs @@ -2,8 +2,8 @@ // entry point. It must match C's `int main(int, char **)`. // This test is for targets with 32bit c_int only. -// ignore-msp430 -// ignore-avr +//@ ignore-msp430 +//@ ignore-avr fn main() { } diff --git a/tests/codegen/abi-repr-ext.rs b/tests/codegen/abi-repr-ext.rs index 23ade3c7216d..2e100a372355 100644 --- a/tests/codegen/abi-repr-ext.rs +++ b/tests/codegen/abi-repr-ext.rs @@ -1,21 +1,21 @@ -// compile-flags: -O +//@ compile-flags: -O -// revisions:x86_64 i686 aarch64-apple aarch64-windows aarch64-linux arm riscv +//@ revisions:x86_64 i686 aarch64-apple aarch64-windows aarch64-linux arm riscv -//[x86_64] compile-flags: --target x86_64-unknown-uefi -//[x86_64] needs-llvm-components: x86 -//[i686] compile-flags: --target i686-unknown-linux-musl -//[i686] needs-llvm-components: x86 -//[aarch64-windows] compile-flags: --target aarch64-pc-windows-msvc -//[aarch64-windows] needs-llvm-components: aarch64 -//[aarch64-linux] compile-flags: --target aarch64-unknown-linux-gnu -//[aarch64-linux] needs-llvm-components: aarch64 -//[aarch64-apple] compile-flags: --target aarch64-apple-darwin -//[aarch64-apple] needs-llvm-components: aarch64 -//[arm] compile-flags: --target armv7r-none-eabi -//[arm] needs-llvm-components: arm -//[riscv] compile-flags: --target riscv64gc-unknown-none-elf -//[riscv] needs-llvm-components: riscv +//@[x86_64] compile-flags: --target x86_64-unknown-uefi +//@[x86_64] needs-llvm-components: x86 +//@[i686] compile-flags: --target i686-unknown-linux-musl +//@[i686] needs-llvm-components: x86 +//@[aarch64-windows] compile-flags: --target aarch64-pc-windows-msvc +//@[aarch64-windows] needs-llvm-components: aarch64 +//@[aarch64-linux] compile-flags: --target aarch64-unknown-linux-gnu +//@[aarch64-linux] needs-llvm-components: aarch64 +//@[aarch64-apple] compile-flags: --target aarch64-apple-darwin +//@[aarch64-apple] needs-llvm-components: aarch64 +//@[arm] compile-flags: --target armv7r-none-eabi +//@[arm] needs-llvm-components: arm +//@[riscv] compile-flags: --target riscv64gc-unknown-none-elf +//@[riscv] needs-llvm-components: riscv // See bottom of file for a corresponding C source file that is meant to yield // equivalent declarations. diff --git a/tests/codegen/abi-sysv64.rs b/tests/codegen/abi-sysv64.rs index 3c2d4e719d42..ec555ee5f1d9 100644 --- a/tests/codegen/abi-sysv64.rs +++ b/tests/codegen/abi-sysv64.rs @@ -2,8 +2,8 @@ // llvm. Also checks that the abi-sysv64 feature gate allows usage // of the sysv64 abi. // -// needs-llvm-components: x86 -// compile-flags: -C no-prepopulate-passes --target=x86_64-unknown-linux-gnu -Copt-level=0 +//@ needs-llvm-components: x86 +//@ compile-flags: -C no-prepopulate-passes --target=x86_64-unknown-linux-gnu -Copt-level=0 #![crate_type = "lib"] #![no_core] diff --git a/tests/codegen/abi-x86-interrupt.rs b/tests/codegen/abi-x86-interrupt.rs index 928ad5a9bbd6..b8f3ebb99dd5 100644 --- a/tests/codegen/abi-x86-interrupt.rs +++ b/tests/codegen/abi-x86-interrupt.rs @@ -2,8 +2,8 @@ // llvm. Also checks that the abi_x86_interrupt feature gate allows usage // of the x86-interrupt abi. -// needs-llvm-components: x86 -// compile-flags: -C no-prepopulate-passes --target=x86_64-unknown-linux-gnu -Copt-level=0 +//@ needs-llvm-components: x86 +//@ compile-flags: -C no-prepopulate-passes --target=x86_64-unknown-linux-gnu -Copt-level=0 #![crate_type = "lib"] #![no_core] diff --git a/tests/codegen/abi-x86_64_sysv.rs b/tests/codegen/abi-x86_64_sysv.rs index 84e06023e9c3..659c1d93e208 100644 --- a/tests/codegen/abi-x86_64_sysv.rs +++ b/tests/codegen/abi-x86_64_sysv.rs @@ -1,6 +1,6 @@ -// only-x86_64 +//@ only-x86_64 -// compile-flags: -C no-prepopulate-passes +//@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/tests/codegen/addr-of-mutate.rs b/tests/codegen/addr-of-mutate.rs index 97af6181524e..f10f01274b1f 100644 --- a/tests/codegen/addr-of-mutate.rs +++ b/tests/codegen/addr-of-mutate.rs @@ -1,4 +1,4 @@ -// compile-flags: -C opt-level=3 -C no-prepopulate-passes +//@ compile-flags: -C opt-level=3 -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/tests/codegen/adjustments.rs b/tests/codegen/adjustments.rs index 0739c79ba8d6..549a9737eb15 100644 --- a/tests/codegen/adjustments.rs +++ b/tests/codegen/adjustments.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes -Copt-level=0 +//@ compile-flags: -C no-prepopulate-passes -Copt-level=0 #![crate_type = "lib"] diff --git a/tests/codegen/align-byval-vector.rs b/tests/codegen/align-byval-vector.rs index 3c8be659671b..6596792ec88a 100644 --- a/tests/codegen/align-byval-vector.rs +++ b/tests/codegen/align-byval-vector.rs @@ -1,9 +1,9 @@ -// revisions:x86-linux x86-darwin +//@ revisions:x86-linux x86-darwin -//[x86-linux] compile-flags: --target i686-unknown-linux-gnu -//[x86-linux] needs-llvm-components: x86 -//[x86-darwin] compile-flags: --target i686-apple-darwin -//[x86-darwin] needs-llvm-components: x86 +//@[x86-linux] compile-flags: --target i686-unknown-linux-gnu +//@[x86-linux] needs-llvm-components: x86 +//@[x86-darwin] compile-flags: --target i686-apple-darwin +//@[x86-darwin] needs-llvm-components: x86 // Tests that aggregates containing vector types get their alignment increased to 16 on Darwin. diff --git a/tests/codegen/align-byval.rs b/tests/codegen/align-byval.rs index c6e3a8ef5f05..1016c7903eb2 100644 --- a/tests/codegen/align-byval.rs +++ b/tests/codegen/align-byval.rs @@ -1,18 +1,18 @@ // ignore-tidy-linelength -// revisions:m68k wasm x86_64-linux x86_64-windows i686-linux i686-windows +//@ revisions:m68k wasm x86_64-linux x86_64-windows i686-linux i686-windows -//[m68k] compile-flags: --target m68k-unknown-linux-gnu -//[m68k] needs-llvm-components: m68k -//[wasm] compile-flags: --target wasm32-unknown-emscripten -//[wasm] needs-llvm-components: webassembly -//[x86_64-linux] compile-flags: --target x86_64-unknown-linux-gnu -//[x86_64-linux] needs-llvm-components: x86 -//[x86_64-windows] compile-flags: --target x86_64-pc-windows-msvc -//[x86_64-windows] needs-llvm-components: x86 -//[i686-linux] compile-flags: --target i686-unknown-linux-gnu -//[i686-linux] needs-llvm-components: x86 -//[i686-windows] compile-flags: --target i686-pc-windows-msvc -//[i686-windows] needs-llvm-components: x86 +//@[m68k] compile-flags: --target m68k-unknown-linux-gnu +//@[m68k] needs-llvm-components: m68k +//@[wasm] compile-flags: --target wasm32-unknown-emscripten +//@[wasm] needs-llvm-components: webassembly +//@[x86_64-linux] compile-flags: --target x86_64-unknown-linux-gnu +//@[x86_64-linux] needs-llvm-components: x86 +//@[x86_64-windows] compile-flags: --target x86_64-pc-windows-msvc +//@[x86_64-windows] needs-llvm-components: x86 +//@[i686-linux] compile-flags: --target i686-unknown-linux-gnu +//@[i686-linux] needs-llvm-components: x86 +//@[i686-windows] compile-flags: --target i686-pc-windows-msvc +//@[i686-windows] needs-llvm-components: x86 // Tests that `byval` alignment is properly specified (#80127). // The only targets that use `byval` are m68k, wasm, x86-64, and x86. diff --git a/tests/codegen/align-enum.rs b/tests/codegen/align-enum.rs index 5901f0113c3a..17bf2cf72568 100644 --- a/tests/codegen/align-enum.rs +++ b/tests/codegen/align-enum.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes -Z mir-opt-level=0 +//@ compile-flags: -C no-prepopulate-passes -Z mir-opt-level=0 // #![crate_type = "lib"] diff --git a/tests/codegen/align-fn.rs b/tests/codegen/align-fn.rs index f3cf614e185c..97f23cc04230 100644 --- a/tests/codegen/align-fn.rs +++ b/tests/codegen/align-fn.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes -Z mir-opt-level=0 +//@ compile-flags: -C no-prepopulate-passes -Z mir-opt-level=0 #![crate_type = "lib"] #![feature(fn_align)] diff --git a/tests/codegen/align-offset.rs b/tests/codegen/align-offset.rs index d4d8b18d35b7..15b11f413cb5 100644 --- a/tests/codegen/align-offset.rs +++ b/tests/codegen/align-offset.rs @@ -1,5 +1,4 @@ -// compile-flags: -O -// ignore-debug (debug assertions in `slice::from_raw_parts` block optimizations) +//@ compile-flags: -O #![crate_type = "lib"] diff --git a/tests/codegen/align-struct.rs b/tests/codegen/align-struct.rs index d483a2ba1516..34475a3852b7 100644 --- a/tests/codegen/align-struct.rs +++ b/tests/codegen/align-struct.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes -Z mir-opt-level=0 +//@ compile-flags: -C no-prepopulate-passes -Z mir-opt-level=0 // #![crate_type = "lib"] diff --git a/tests/codegen/alloc-optimisation.rs b/tests/codegen/alloc-optimisation.rs index 900eb687a45b..6f320e68fdb3 100644 --- a/tests/codegen/alloc-optimisation.rs +++ b/tests/codegen/alloc-optimisation.rs @@ -1,4 +1,4 @@ -// compile-flags: -O +//@ compile-flags: -O #![crate_type = "lib"] #[no_mangle] diff --git a/tests/codegen/array-clone.rs b/tests/codegen/array-clone.rs index 0d42963bcd2c..2873f3cadca8 100644 --- a/tests/codegen/array-clone.rs +++ b/tests/codegen/array-clone.rs @@ -1,4 +1,4 @@ -// compile-flags: -O +//@ compile-flags: -O #![crate_type = "lib"] diff --git a/tests/codegen/array-codegen.rs b/tests/codegen/array-codegen.rs index bf5ae74679bb..bb4bd5444dbf 100644 --- a/tests/codegen/array-codegen.rs +++ b/tests/codegen/array-codegen.rs @@ -1,4 +1,4 @@ -// compile-flags: -O -C no-prepopulate-passes +//@ compile-flags: -O -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/tests/codegen/array-equality.rs b/tests/codegen/array-equality.rs index 1941452ea615..943542288863 100644 --- a/tests/codegen/array-equality.rs +++ b/tests/codegen/array-equality.rs @@ -1,5 +1,5 @@ -// compile-flags: -O -Z merge-functions=disabled -// only-x86_64 +//@ compile-flags: -O -Z merge-functions=disabled +//@ only-x86_64 #![crate_type = "lib"] diff --git a/tests/codegen/array-map.rs b/tests/codegen/array-map.rs index 9846cc7f5c83..743a15989f78 100644 --- a/tests/codegen/array-map.rs +++ b/tests/codegen/array-map.rs @@ -1,6 +1,5 @@ -// compile-flags: -C opt-level=3 -C target-cpu=x86-64-v3 -// only-x86_64 -// ignore-debug (the extra assertions get in the way) +//@ compile-flags: -C opt-level=3 -C target-cpu=x86-64-v3 +//@ only-x86_64 #![crate_type = "lib"] diff --git a/tests/codegen/array-optimized.rs b/tests/codegen/array-optimized.rs index 27448fdcfade..4cf16f1fb302 100644 --- a/tests/codegen/array-optimized.rs +++ b/tests/codegen/array-optimized.rs @@ -1,4 +1,4 @@ -// compile-flags: -O +//@ compile-flags: -O #![crate_type = "lib"] diff --git a/tests/codegen/ascii-char.rs b/tests/codegen/ascii-char.rs index 711ffe7e1a58..fab9f8632fca 100644 --- a/tests/codegen/ascii-char.rs +++ b/tests/codegen/ascii-char.rs @@ -1,5 +1,4 @@ -// compile-flags: -C opt-level=1 -// ignore-debug (the extra assertions get in the way) +//@ compile-flags: -C opt-level=1 #![crate_type = "lib"] #![feature(ascii_char)] diff --git a/tests/codegen/asm-clobber_abi.rs b/tests/codegen/asm-clobber_abi.rs index f70caea2fb9e..cc563474bf8c 100644 --- a/tests/codegen/asm-clobber_abi.rs +++ b/tests/codegen/asm-clobber_abi.rs @@ -1,5 +1,5 @@ -// compile-flags: -O -// only-x86_64 +//@ compile-flags: -O +//@ only-x86_64 #![crate_type = "rlib"] diff --git a/tests/codegen/asm-clobbers.rs b/tests/codegen/asm-clobbers.rs index 2ef10a2837d2..4094db741346 100644 --- a/tests/codegen/asm-clobbers.rs +++ b/tests/codegen/asm-clobbers.rs @@ -1,5 +1,5 @@ -// compile-flags: -O -// only-x86_64 +//@ compile-flags: -O +//@ only-x86_64 #![crate_type = "rlib"] diff --git a/tests/codegen/asm-may_unwind.rs b/tests/codegen/asm-may_unwind.rs index c97933035d10..be66b3975ff8 100644 --- a/tests/codegen/asm-may_unwind.rs +++ b/tests/codegen/asm-may_unwind.rs @@ -1,5 +1,5 @@ -// compile-flags: -O -// only-x86_64 +//@ compile-flags: -O +//@ only-x86_64 #![crate_type = "rlib"] #![feature(asm_unwind)] diff --git a/tests/codegen/asm-maybe-uninit.rs b/tests/codegen/asm-maybe-uninit.rs index d7e4a9489546..f9bf280b3846 100644 --- a/tests/codegen/asm-maybe-uninit.rs +++ b/tests/codegen/asm-maybe-uninit.rs @@ -1,5 +1,5 @@ -// compile-flags: -O -// only-x86_64 +//@ compile-flags: -O +//@ only-x86_64 #![crate_type = "rlib"] #![allow(asm_sub_register)] diff --git a/tests/codegen/asm-multiple-options.rs b/tests/codegen/asm-multiple-options.rs index 1ae37d627d67..1ee295e32c9e 100644 --- a/tests/codegen/asm-multiple-options.rs +++ b/tests/codegen/asm-multiple-options.rs @@ -1,5 +1,5 @@ -// compile-flags: -O -// only-x86_64 +//@ compile-flags: -O +//@ only-x86_64 #![crate_type = "rlib"] diff --git a/tests/codegen/asm-options.rs b/tests/codegen/asm-options.rs index 963b60cfe35b..96a72c2f5ae9 100644 --- a/tests/codegen/asm-options.rs +++ b/tests/codegen/asm-options.rs @@ -1,5 +1,5 @@ -// compile-flags: -O -// only-x86_64 +//@ compile-flags: -O +//@ only-x86_64 #![crate_type = "rlib"] diff --git a/tests/codegen/asm-powerpc-clobbers.rs b/tests/codegen/asm-powerpc-clobbers.rs index 10b20ba6beb0..0be1b66bd99e 100644 --- a/tests/codegen/asm-powerpc-clobbers.rs +++ b/tests/codegen/asm-powerpc-clobbers.rs @@ -1,10 +1,10 @@ -// revisions: powerpc powerpc64 powerpc64le -//[powerpc] compile-flags: --target powerpc-unknown-linux-gnu -//[powerpc] needs-llvm-components: powerpc -//[powerpc64] compile-flags: --target powerpc64-unknown-linux-gnu -//[powerpc64] needs-llvm-components: powerpc -//[powerpc64le] compile-flags: --target powerpc64le-unknown-linux-gnu -//[powerpc64le] needs-llvm-components: powerpc +//@ revisions: powerpc powerpc64 powerpc64le +//@[powerpc] compile-flags: --target powerpc-unknown-linux-gnu +//@[powerpc] needs-llvm-components: powerpc +//@[powerpc64] compile-flags: --target powerpc64-unknown-linux-gnu +//@[powerpc64] needs-llvm-components: powerpc +//@[powerpc64le] compile-flags: --target powerpc64le-unknown-linux-gnu +//@[powerpc64le] needs-llvm-components: powerpc #![crate_type = "rlib"] #![feature(no_core, rustc_attrs, lang_items, asm_experimental_arch)] diff --git a/tests/codegen/asm-sanitize-llvm.rs b/tests/codegen/asm-sanitize-llvm.rs index 41bed98038ec..8638ed2236ac 100644 --- a/tests/codegen/asm-sanitize-llvm.rs +++ b/tests/codegen/asm-sanitize-llvm.rs @@ -1,6 +1,6 @@ // FIXME(nagisa): remove the flags below once all targets support `asm!`. -// compile-flags: --target x86_64-unknown-linux-gnu -Copt-level=0 -// needs-llvm-components: x86 +//@ compile-flags: --target x86_64-unknown-linux-gnu -Copt-level=0 +//@ needs-llvm-components: x86 // Verify we sanitize the special tokens for the LLVM inline-assembly, ensuring people won't // inadvertently rely on the LLVM-specific syntax and features. diff --git a/tests/codegen/asm-target-clobbers.rs b/tests/codegen/asm-target-clobbers.rs index ac30e18ec523..119372491ffe 100644 --- a/tests/codegen/asm-target-clobbers.rs +++ b/tests/codegen/asm-target-clobbers.rs @@ -1,6 +1,6 @@ -// only-x86_64 -// revisions: base avx512 -// [avx512]compile-flags: -C target-feature=+avx512f +//@ only-x86_64 +//@ revisions: base avx512 +//@ [avx512]compile-flags: -C target-feature=+avx512f #![crate_type = "rlib"] diff --git a/tests/codegen/async-closure-debug.rs b/tests/codegen/async-closure-debug.rs index 6718d2b66272..9cb1e623295b 100644 --- a/tests/codegen/async-closure-debug.rs +++ b/tests/codegen/async-closure-debug.rs @@ -1,7 +1,7 @@ // Just make sure that async closures don't ICE. // -// compile-flags: -C debuginfo=2 --edition=2018 -// ignore-msvc +//@ compile-flags: -C debuginfo=2 --edition=2018 +//@ ignore-msvc // CHECK-DAG: [[GEN_FN:!.*]] = !DINamespace(name: "async_closure_test" // CHECK-DAG: [[CLOSURE:!.*]] = !DICompositeType(tag: DW_TAG_structure_type, name: "{closure_env#0}", scope: [[GEN_FN]] diff --git a/tests/codegen/async-fn-debug-awaitee-field.rs b/tests/codegen/async-fn-debug-awaitee-field.rs index 03cc46cdcde5..d1a7d738e9e1 100644 --- a/tests/codegen/async-fn-debug-awaitee-field.rs +++ b/tests/codegen/async-fn-debug-awaitee-field.rs @@ -3,7 +3,7 @@ // extensions rely on the field having this name. // ignore-tidy-linelength -// compile-flags: -C debuginfo=2 --edition=2018 -Copt-level=0 +//@ compile-flags: -C debuginfo=2 --edition=2018 -Copt-level=0 #![crate_type = "lib"] diff --git a/tests/codegen/async-fn-debug-msvc.rs b/tests/codegen/async-fn-debug-msvc.rs index 707a0d277407..7c695042b425 100644 --- a/tests/codegen/async-fn-debug-msvc.rs +++ b/tests/codegen/async-fn-debug-msvc.rs @@ -4,8 +4,8 @@ // - Other fields are not marked artificial // // -// compile-flags: -C debuginfo=2 --edition=2018 -// only-msvc +//@ compile-flags: -C debuginfo=2 --edition=2018 +//@ only-msvc async fn foo() {} async fn async_fn_test() { diff --git a/tests/codegen/async-fn-debug.rs b/tests/codegen/async-fn-debug.rs index 9f6058a71b34..7be4ad456657 100644 --- a/tests/codegen/async-fn-debug.rs +++ b/tests/codegen/async-fn-debug.rs @@ -4,8 +4,8 @@ // - Other fields are not marked artificial // // -// compile-flags: -C debuginfo=2 --edition=2018 -// ignore-msvc +//@ compile-flags: -C debuginfo=2 --edition=2018 +//@ ignore-msvc async fn foo() {} async fn async_fn_test() { diff --git a/tests/codegen/atomic-operations.rs b/tests/codegen/atomic-operations.rs index 20980c48960b..b13502735422 100644 --- a/tests/codegen/atomic-operations.rs +++ b/tests/codegen/atomic-operations.rs @@ -1,5 +1,5 @@ // Code generation of atomic operations. -// compile-flags: -O +//@ compile-flags: -O #![crate_type = "lib"] use std::sync::atomic::{AtomicI32, Ordering::*}; diff --git a/tests/codegen/autovectorize-f32x4.rs b/tests/codegen/autovectorize-f32x4.rs index 54392be707f5..90c9f3691045 100644 --- a/tests/codegen/autovectorize-f32x4.rs +++ b/tests/codegen/autovectorize-f32x4.rs @@ -1,5 +1,5 @@ -// compile-flags: -C opt-level=3 -Z merge-functions=disabled -// only-x86_64 +//@ compile-flags: -C opt-level=3 -Z merge-functions=disabled +//@ only-x86_64 #![crate_type = "lib"] // CHECK-LABEL: @auto_vectorize_direct diff --git a/tests/codegen/avr/avr-func-addrspace.rs b/tests/codegen/avr/avr-func-addrspace.rs index dc36a9fac8c2..fb53abecfdb2 100644 --- a/tests/codegen/avr/avr-func-addrspace.rs +++ b/tests/codegen/avr/avr-func-addrspace.rs @@ -1,5 +1,5 @@ -// compile-flags: -O --target=avr-unknown-gnu-atmega328 --crate-type=rlib -// needs-llvm-components: avr +//@ compile-flags: -O --target=avr-unknown-gnu-atmega328 --crate-type=rlib +//@ needs-llvm-components: avr // This test validates that function pointers can be stored in global variables // and called upon. It ensures that Rust emits function pointers in the correct diff --git a/tests/codegen/binary-search-index-no-bound-check.rs b/tests/codegen/binary-search-index-no-bound-check.rs index 595969a89793..96f6bb54b3fe 100644 --- a/tests/codegen/binary-search-index-no-bound-check.rs +++ b/tests/codegen/binary-search-index-no-bound-check.rs @@ -1,5 +1,4 @@ -// compile-flags: -O -// ignore-debug: the debug assertions get in the way +//@ compile-flags: -O #![crate_type = "lib"] // Make sure no bounds checks are emitted when slicing or indexing diff --git a/tests/codegen/bool-cmp.rs b/tests/codegen/bool-cmp.rs index 5090f7c378c3..29ee3e0627bc 100644 --- a/tests/codegen/bool-cmp.rs +++ b/tests/codegen/bool-cmp.rs @@ -1,7 +1,7 @@ // This is a test for optimal Ord trait implementation for bool. // See for more info. -// compile-flags: -C opt-level=3 +//@ compile-flags: -C opt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/box-uninit-bytes.rs b/tests/codegen/box-uninit-bytes.rs index 732da0a17949..63a6c7b84156 100644 --- a/tests/codegen/box-uninit-bytes.rs +++ b/tests/codegen/box-uninit-bytes.rs @@ -1,4 +1,4 @@ -// compile-flags: -O +//@ compile-flags: -O #![crate_type = "lib"] use std::mem::MaybeUninit; diff --git a/tests/codegen/bpf-alu32.rs b/tests/codegen/bpf-alu32.rs index c68bffd03e28..5955bf3317f0 100644 --- a/tests/codegen/bpf-alu32.rs +++ b/tests/codegen/bpf-alu32.rs @@ -1,4 +1,4 @@ -// only-bpf +//@ only-bpf #![crate_type = "lib"] #![feature(bpf_target_feature)] #![no_std] diff --git a/tests/codegen/branch-protection.rs b/tests/codegen/branch-protection.rs index 994c71b26198..0961b1b9f522 100644 --- a/tests/codegen/branch-protection.rs +++ b/tests/codegen/branch-protection.rs @@ -1,12 +1,12 @@ // Test that the correct module flags are emitted with different branch protection flags. -// revisions: BTI PACRET LEAF BKEY NONE -// needs-llvm-components: aarch64 -// [BTI] compile-flags: -Z branch-protection=bti -// [PACRET] compile-flags: -Z branch-protection=pac-ret -// [LEAF] compile-flags: -Z branch-protection=pac-ret,leaf -// [BKEY] compile-flags: -Z branch-protection=pac-ret,b-key -// compile-flags: --target aarch64-unknown-linux-gnu +//@ revisions: BTI PACRET LEAF BKEY NONE +//@ needs-llvm-components: aarch64 +//@ [BTI] compile-flags: -Z branch-protection=bti +//@ [PACRET] compile-flags: -Z branch-protection=pac-ret +//@ [LEAF] compile-flags: -Z branch-protection=pac-ret,leaf +//@ [BKEY] compile-flags: -Z branch-protection=pac-ret,b-key +//@ compile-flags: --target aarch64-unknown-linux-gnu #![crate_type = "lib"] #![feature(no_core, lang_items)] diff --git a/tests/codegen/call-llvm-intrinsics.rs b/tests/codegen/call-llvm-intrinsics.rs index 11f2917717c7..dc7e0249cb6a 100644 --- a/tests/codegen/call-llvm-intrinsics.rs +++ b/tests/codegen/call-llvm-intrinsics.rs @@ -1,7 +1,7 @@ -// compile-flags: -C no-prepopulate-passes -Copt-level=0 +//@ compile-flags: -C no-prepopulate-passes -Copt-level=0 -// ignore-riscv64 -// ignore-loongarch64 +//@ ignore-riscv64 +//@ ignore-loongarch64 #![feature(link_llvm_intrinsics)] #![crate_type = "lib"] diff --git a/tests/codegen/call-metadata.rs b/tests/codegen/call-metadata.rs index 07cc0c963717..b2168990ff83 100644 --- a/tests/codegen/call-metadata.rs +++ b/tests/codegen/call-metadata.rs @@ -1,7 +1,7 @@ // Checks that range metadata gets emitted on calls to functions returning a // scalar value. -// compile-flags: -O -C no-prepopulate-passes +//@ compile-flags: -O -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/tests/codegen/catch-unwind.rs b/tests/codegen/catch-unwind.rs index 6b63b83ef459..4e1f9a88e957 100644 --- a/tests/codegen/catch-unwind.rs +++ b/tests/codegen/catch-unwind.rs @@ -1,4 +1,4 @@ -// compile-flags: -O +//@ compile-flags: -O // On x86 the closure is inlined in foo() producing something like // define i32 @foo() [...] { @@ -7,11 +7,11 @@ // } // On riscv the closure is another function, placed before fn foo so CHECK can't // find it -// ignore-riscv64 FIXME +//@ ignore-riscv64 FIXME // On s390x the closure is also in another function -// ignore-s390x FIXME +//@ ignore-s390x FIXME // On loongarch64 the closure is also in another function -// ignore-loongarch64 FIXME +//@ ignore-loongarch64 FIXME #![crate_type = "lib"] #![feature(c_unwind)] diff --git a/tests/codegen/cdylib-external-inline-fns.rs b/tests/codegen/cdylib-external-inline-fns.rs index 9118afd43d88..2e472ea68e87 100644 --- a/tests/codegen/cdylib-external-inline-fns.rs +++ b/tests/codegen/cdylib-external-inline-fns.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes +//@ compile-flags: -C no-prepopulate-passes #![crate_type = "cdylib"] diff --git a/tests/codegen/cf-protection.rs b/tests/codegen/cf-protection.rs index ccbc863f5717..5120bbf114d9 100644 --- a/tests/codegen/cf-protection.rs +++ b/tests/codegen/cf-protection.rs @@ -1,13 +1,13 @@ // Test that the correct module flags are emitted with different control-flow protection flags. -// revisions: undefined none branch return full -// needs-llvm-components: x86 -// [undefined] compile-flags: -// [none] compile-flags: -Z cf-protection=none -// [branch] compile-flags: -Z cf-protection=branch -// [return] compile-flags: -Z cf-protection=return -// [full] compile-flags: -Z cf-protection=full -// compile-flags: --target x86_64-unknown-linux-gnu +//@ revisions: undefined none branch return full +//@ needs-llvm-components: x86 +//@ [undefined] compile-flags: +//@ [none] compile-flags: -Z cf-protection=none +//@ [branch] compile-flags: -Z cf-protection=branch +//@ [return] compile-flags: -Z cf-protection=return +//@ [full] compile-flags: -Z cf-protection=full +//@ compile-flags: --target x86_64-unknown-linux-gnu #![crate_type = "lib"] #![feature(no_core, lang_items)] diff --git a/tests/codegen/cffi/c-variadic-opt.rs b/tests/codegen/cffi/c-variadic-opt.rs index 969dce80f587..7e544ee7f37d 100644 --- a/tests/codegen/cffi/c-variadic-opt.rs +++ b/tests/codegen/cffi/c-variadic-opt.rs @@ -1,4 +1,4 @@ -// compile-flags: -C opt-level=3 +//@ compile-flags: -C opt-level=3 #![crate_type = "lib"] #![feature(c_variadic)] diff --git a/tests/codegen/cffi/c-variadic.rs b/tests/codegen/cffi/c-variadic.rs index cab32652210d..74aed36a8a1a 100644 --- a/tests/codegen/cffi/c-variadic.rs +++ b/tests/codegen/cffi/c-variadic.rs @@ -1,5 +1,5 @@ -// ignore-wasm32-bare compiled with panic=abort by default -// compile-flags: -C no-prepopulate-passes -Copt-level=0 +//@ ignore-wasm32-bare compiled with panic=abort by default +//@ compile-flags: -C no-prepopulate-passes -Copt-level=0 // #![crate_type = "lib"] diff --git a/tests/codegen/cffi/ffi-const.rs b/tests/codegen/cffi/ffi-const.rs index 937205034808..8044ad105d5d 100644 --- a/tests/codegen/cffi/ffi-const.rs +++ b/tests/codegen/cffi/ffi-const.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes +//@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] #![feature(ffi_const)] diff --git a/tests/codegen/cffi/ffi-out-of-bounds-loads.rs b/tests/codegen/cffi/ffi-out-of-bounds-loads.rs index 099726b2f086..7eda6cf4d576 100644 --- a/tests/codegen/cffi/ffi-out-of-bounds-loads.rs +++ b/tests/codegen/cffi/ffi-out-of-bounds-loads.rs @@ -1,8 +1,8 @@ // Regression test for #29988 -// compile-flags: -C no-prepopulate-passes -// only-x86_64 -// ignore-windows +//@ compile-flags: -C no-prepopulate-passes +//@ only-x86_64 +//@ ignore-windows #[repr(C)] struct S { diff --git a/tests/codegen/cffi/ffi-pure.rs b/tests/codegen/cffi/ffi-pure.rs index 2ed735813582..51135fd37535 100644 --- a/tests/codegen/cffi/ffi-pure.rs +++ b/tests/codegen/cffi/ffi-pure.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes +//@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] #![feature(ffi_pure)] diff --git a/tests/codegen/cfguard-checks.rs b/tests/codegen/cfguard-checks.rs index 571a2654bcbf..2b09a5fe12c2 100644 --- a/tests/codegen/cfguard-checks.rs +++ b/tests/codegen/cfguard-checks.rs @@ -1,5 +1,5 @@ -// compile-flags: -C control-flow-guard=checks -// only-msvc +//@ compile-flags: -C control-flow-guard=checks +//@ only-msvc #![crate_type = "lib"] diff --git a/tests/codegen/cfguard-disabled.rs b/tests/codegen/cfguard-disabled.rs index c3f8f4116819..105e02072615 100644 --- a/tests/codegen/cfguard-disabled.rs +++ b/tests/codegen/cfguard-disabled.rs @@ -1,5 +1,5 @@ -// compile-flags: -C control-flow-guard=no -// only-msvc +//@ compile-flags: -C control-flow-guard=no +//@ only-msvc #![crate_type = "lib"] diff --git a/tests/codegen/cfguard-nochecks.rs b/tests/codegen/cfguard-nochecks.rs index 3847c3e81ed7..0443880d72da 100644 --- a/tests/codegen/cfguard-nochecks.rs +++ b/tests/codegen/cfguard-nochecks.rs @@ -1,5 +1,5 @@ -// compile-flags: -C control-flow-guard=nochecks -// only-msvc +//@ compile-flags: -C control-flow-guard=nochecks +//@ only-msvc #![crate_type = "lib"] diff --git a/tests/codegen/cfguard-non-msvc.rs b/tests/codegen/cfguard-non-msvc.rs index 6278a951e35f..5d266de8a94d 100644 --- a/tests/codegen/cfguard-non-msvc.rs +++ b/tests/codegen/cfguard-non-msvc.rs @@ -1,5 +1,5 @@ -// compile-flags: -C control-flow-guard -// ignore-msvc +//@ compile-flags: -C control-flow-guard +//@ ignore-msvc #![crate_type = "lib"] diff --git a/tests/codegen/char-ascii-branchless.rs b/tests/codegen/char-ascii-branchless.rs index b612b24c7c73..76d2f617ed1c 100644 --- a/tests/codegen/char-ascii-branchless.rs +++ b/tests/codegen/char-ascii-branchless.rs @@ -1,6 +1,6 @@ // Checks that these functions are branchless. // -// compile-flags: -O +//@ compile-flags: -O #![crate_type = "lib"] diff --git a/tests/codegen/codemodels.rs b/tests/codegen/codemodels.rs index 2328f5feb4e1..06d2eade78ae 100644 --- a/tests/codegen/codemodels.rs +++ b/tests/codegen/codemodels.rs @@ -1,11 +1,11 @@ -// only-x86_64 +//@ only-x86_64 -// revisions: NOMODEL MODEL-SMALL MODEL-KERNEL MODEL-MEDIUM MODEL-LARGE -//[NOMODEL] compile-flags: -//[MODEL-SMALL] compile-flags: -C code-model=small -//[MODEL-KERNEL] compile-flags: -C code-model=kernel -//[MODEL-MEDIUM] compile-flags: -C code-model=medium -//[MODEL-LARGE] compile-flags: -C code-model=large +//@ revisions: NOMODEL MODEL-SMALL MODEL-KERNEL MODEL-MEDIUM MODEL-LARGE +//@[NOMODEL] compile-flags: +//@[MODEL-SMALL] compile-flags: -C code-model=small +//@[MODEL-KERNEL] compile-flags: -C code-model=kernel +//@[MODEL-MEDIUM] compile-flags: -C code-model=medium +//@[MODEL-LARGE] compile-flags: -C code-model=large #![crate_type = "lib"] diff --git a/tests/codegen/coercions.rs b/tests/codegen/coercions.rs index d645ca6b13ae..a205e541df10 100644 --- a/tests/codegen/coercions.rs +++ b/tests/codegen/coercions.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes +//@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/tests/codegen/cold-call-declare-and-call.rs b/tests/codegen/cold-call-declare-and-call.rs index 572dc407f513..cd41c0a6dfb6 100644 --- a/tests/codegen/cold-call-declare-and-call.rs +++ b/tests/codegen/cold-call-declare-and-call.rs @@ -1,8 +1,8 @@ -// revisions: NORMAL WINDOWS -// compile-flags: -C no-prepopulate-passes -//[NORMAL] ignore-windows -//[WINDOWS] only-windows -//[WINDOWS] only-x86_64 +//@ revisions: NORMAL WINDOWS +//@ compile-flags: -C no-prepopulate-passes +//@[NORMAL] ignore-windows +//@[WINDOWS] only-windows +//@[WINDOWS] only-x86_64 #![crate_type = "lib"] #![feature(rust_cold_cc)] diff --git a/tests/codegen/comparison-operators-2-tuple.rs b/tests/codegen/comparison-operators-2-tuple.rs index 633cfe3a8ac3..8e2915e84eb7 100644 --- a/tests/codegen/comparison-operators-2-tuple.rs +++ b/tests/codegen/comparison-operators-2-tuple.rs @@ -1,5 +1,5 @@ -// compile-flags: -C opt-level=1 -Z merge-functions=disabled -// only-x86_64 +//@ compile-flags: -C opt-level=1 -Z merge-functions=disabled +//@ only-x86_64 #![crate_type = "lib"] diff --git a/tests/codegen/comparison-operators-newtype.rs b/tests/codegen/comparison-operators-newtype.rs index 8fd8a81dfeb9..d336c4e6ed3d 100644 --- a/tests/codegen/comparison-operators-newtype.rs +++ b/tests/codegen/comparison-operators-newtype.rs @@ -2,7 +2,7 @@ // This double-checks that the `Option` intermediate values used // in the operators for such a type all optimize away. -// compile-flags: -C opt-level=1 +//@ compile-flags: -C opt-level=1 #![crate_type = "lib"] diff --git a/tests/codegen/const_scalar_pair.rs b/tests/codegen/const_scalar_pair.rs index aa4cf7a64d5c..0aa430a8efa0 100644 --- a/tests/codegen/const_scalar_pair.rs +++ b/tests/codegen/const_scalar_pair.rs @@ -1,4 +1,4 @@ -// compile-flags: --crate-type=lib -Copt-level=0 -Zmir-opt-level=0 -C debuginfo=2 +//@ compile-flags: --crate-type=lib -Copt-level=0 -Zmir-opt-level=0 -C debuginfo=2 #![feature(inline_const)] diff --git a/tests/codegen/constant-branch.rs b/tests/codegen/constant-branch.rs new file mode 100644 index 000000000000..3328b1eb4a88 --- /dev/null +++ b/tests/codegen/constant-branch.rs @@ -0,0 +1,67 @@ +//@ compile-flags: -Zmir-opt-level=0 -C no-prepopulate-passes -Copt-level=0 +// make sure that branching on a constant does not emit a conditional +// branch or a switch + +#![crate_type = "lib"] + +// CHECK-LABEL: @if_bool +#[no_mangle] +pub fn if_bool() { + // CHECK: br label %{{.+}} + _ = if true { + 0 + } else { + 1 + }; + + // CHECK: br label %{{.+}} + _ = if false { + 0 + } else { + 1 + }; +} + +// CHECK-LABEL: @if_constant_int_eq +#[no_mangle] +pub fn if_constant_int_eq() { + let val = 0; + // CHECK: br label %{{.+}} + _ = if val == 0 { + 0 + } else { + 1 + }; + + // CHECK: br label %{{.+}} + _ = if val == 1 { + 0 + } else { + 1 + }; +} + +// CHECK-LABEL: @if_constant_match +#[no_mangle] +pub fn if_constant_match() { + // CHECK: br label %{{.+}} + _ = match 1 { + 1 => 2, + 2 => 3, + _ => 4 + }; + + // CHECK: br label %{{.+}} + _ = match 1 { + 2 => 3, + _ => 4 + }; + + // CHECK: br label %[[MINUS1:.+]] + _ = match -1 { + // CHECK: [[MINUS1]]: + // CHECK: store i32 1 + -1 => 1, + _ => 0, + } +} diff --git a/tests/codegen/consts.rs b/tests/codegen/consts.rs index 3797e1a99da7..93c58c37c287 100644 --- a/tests/codegen/consts.rs +++ b/tests/codegen/consts.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes +//@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/tests/codegen/coroutine-debug-msvc.rs b/tests/codegen/coroutine-debug-msvc.rs index 6d16e7576c1a..fb1b46fe497f 100644 --- a/tests/codegen/coroutine-debug-msvc.rs +++ b/tests/codegen/coroutine-debug-msvc.rs @@ -4,8 +4,8 @@ // - Other fields are not marked artificial // // -// compile-flags: -C debuginfo=2 -// only-msvc +//@ compile-flags: -C debuginfo=2 +//@ only-msvc #![feature(coroutines, coroutine_trait)] use std::ops::Coroutine; diff --git a/tests/codegen/coroutine-debug.rs b/tests/codegen/coroutine-debug.rs index b060f3bfac7a..7eaee669559e 100644 --- a/tests/codegen/coroutine-debug.rs +++ b/tests/codegen/coroutine-debug.rs @@ -4,8 +4,8 @@ // - Other fields are not marked artificial // // -// compile-flags: -C debuginfo=2 --edition=2018 -// ignore-msvc +//@ compile-flags: -C debuginfo=2 --edition=2018 +//@ ignore-msvc #![feature(coroutines, coroutine_trait)] use std::ops::Coroutine; diff --git a/tests/codegen/cross-crate-inlining/always-inline.rs b/tests/codegen/cross-crate-inlining/always-inline.rs index f3f08bf116ae..d3a35dadb67b 100644 --- a/tests/codegen/cross-crate-inlining/always-inline.rs +++ b/tests/codegen/cross-crate-inlining/always-inline.rs @@ -1,5 +1,5 @@ -// compile-flags: -O -// aux-build:always.rs +//@ compile-flags: -O +//@ aux-build:always.rs #![crate_type = "lib"] diff --git a/tests/codegen/cross-crate-inlining/auxiliary/always.rs b/tests/codegen/cross-crate-inlining/auxiliary/always.rs index 3670307ec813..7f524e17d34a 100644 --- a/tests/codegen/cross-crate-inlining/auxiliary/always.rs +++ b/tests/codegen/cross-crate-inlining/auxiliary/always.rs @@ -1,4 +1,4 @@ -// compile-flags: -O -Zcross-crate-inline-threshold=always +//@ compile-flags: -O -Zcross-crate-inline-threshold=always #![crate_type = "lib"] diff --git a/tests/codegen/cross-crate-inlining/auxiliary/leaf.rs b/tests/codegen/cross-crate-inlining/auxiliary/leaf.rs index 963f087f22d4..5895812b5ee5 100644 --- a/tests/codegen/cross-crate-inlining/auxiliary/leaf.rs +++ b/tests/codegen/cross-crate-inlining/auxiliary/leaf.rs @@ -1,4 +1,4 @@ -// compile-flags: -O +//@ compile-flags: -O #![crate_type = "lib"] diff --git a/tests/codegen/cross-crate-inlining/auxiliary/never.rs b/tests/codegen/cross-crate-inlining/auxiliary/never.rs index e222a6dea387..3a391608df84 100644 --- a/tests/codegen/cross-crate-inlining/auxiliary/never.rs +++ b/tests/codegen/cross-crate-inlining/auxiliary/never.rs @@ -1,4 +1,4 @@ -// compile-flags: -O -Zcross-crate-inline-threshold=never +//@ compile-flags: -O -Zcross-crate-inline-threshold=never #![crate_type = "lib"] diff --git a/tests/codegen/cross-crate-inlining/leaf-inlining.rs b/tests/codegen/cross-crate-inlining/leaf-inlining.rs index 73b1a520b06c..b47898f750a2 100644 --- a/tests/codegen/cross-crate-inlining/leaf-inlining.rs +++ b/tests/codegen/cross-crate-inlining/leaf-inlining.rs @@ -1,5 +1,5 @@ -// compile-flags: -O -Zcross-crate-inline-threshold=yes -// aux-build:leaf.rs +//@ compile-flags: -O -Zcross-crate-inline-threshold=yes +//@ aux-build:leaf.rs #![crate_type = "lib"] diff --git a/tests/codegen/cross-crate-inlining/never-inline.rs b/tests/codegen/cross-crate-inlining/never-inline.rs index 4e7bc3e5154c..eedf90ceec0f 100644 --- a/tests/codegen/cross-crate-inlining/never-inline.rs +++ b/tests/codegen/cross-crate-inlining/never-inline.rs @@ -1,5 +1,5 @@ -// compile-flags: -O -// aux-build:never.rs +//@ compile-flags: -O +//@ aux-build:never.rs #![crate_type = "lib"] diff --git a/tests/codegen/dealloc-no-unwind.rs b/tests/codegen/dealloc-no-unwind.rs index c2656908f16d..667f6fea1857 100644 --- a/tests/codegen/dealloc-no-unwind.rs +++ b/tests/codegen/dealloc-no-unwind.rs @@ -1,4 +1,4 @@ -// compile-flags: -O +//@ compile-flags: -O #![crate_type="lib"] diff --git a/tests/codegen/debug-accessibility/crate-enum.rs b/tests/codegen/debug-accessibility/crate-enum.rs index eeea18dd8153..c80700d7b282 100644 --- a/tests/codegen/debug-accessibility/crate-enum.rs +++ b/tests/codegen/debug-accessibility/crate-enum.rs @@ -1,4 +1,4 @@ -// compile-flags: -C debuginfo=2 +//@ compile-flags: -C debuginfo=2 // ignore-tidy-linelength #![allow(dead_code)] diff --git a/tests/codegen/debug-accessibility/crate-struct.rs b/tests/codegen/debug-accessibility/crate-struct.rs index 68d126a3478f..73a8ce852eda 100644 --- a/tests/codegen/debug-accessibility/crate-struct.rs +++ b/tests/codegen/debug-accessibility/crate-struct.rs @@ -1,4 +1,4 @@ -// compile-flags: -C debuginfo=2 +//@ compile-flags: -C debuginfo=2 #![allow(dead_code)] diff --git a/tests/codegen/debug-accessibility/private-enum.rs b/tests/codegen/debug-accessibility/private-enum.rs index 7f81026ddecc..22d49a40eff0 100644 --- a/tests/codegen/debug-accessibility/private-enum.rs +++ b/tests/codegen/debug-accessibility/private-enum.rs @@ -1,4 +1,4 @@ -// compile-flags: -C debuginfo=2 +//@ compile-flags: -C debuginfo=2 // ignore-tidy-linelength #![allow(dead_code)] diff --git a/tests/codegen/debug-accessibility/private-struct.rs b/tests/codegen/debug-accessibility/private-struct.rs index 43b260f90247..488a680e81c0 100644 --- a/tests/codegen/debug-accessibility/private-struct.rs +++ b/tests/codegen/debug-accessibility/private-struct.rs @@ -1,4 +1,4 @@ -// compile-flags: -C debuginfo=2 +//@ compile-flags: -C debuginfo=2 #![allow(dead_code)] diff --git a/tests/codegen/debug-accessibility/public-enum.rs b/tests/codegen/debug-accessibility/public-enum.rs index 29ae5fd64210..f16ccf1a3c96 100644 --- a/tests/codegen/debug-accessibility/public-enum.rs +++ b/tests/codegen/debug-accessibility/public-enum.rs @@ -1,4 +1,4 @@ -// compile-flags: -C debuginfo=2 +//@ compile-flags: -C debuginfo=2 // ignore-tidy-linelength #![allow(dead_code)] diff --git a/tests/codegen/debug-accessibility/public-struct.rs b/tests/codegen/debug-accessibility/public-struct.rs index e7cd9b40d097..8b2a53f993c1 100644 --- a/tests/codegen/debug-accessibility/public-struct.rs +++ b/tests/codegen/debug-accessibility/public-struct.rs @@ -1,4 +1,4 @@ -// compile-flags: -C debuginfo=2 +//@ compile-flags: -C debuginfo=2 #![allow(dead_code)] diff --git a/tests/codegen/debug-accessibility/struct-fields.rs b/tests/codegen/debug-accessibility/struct-fields.rs index 76831bdc6c6a..f68bb3438be2 100644 --- a/tests/codegen/debug-accessibility/struct-fields.rs +++ b/tests/codegen/debug-accessibility/struct-fields.rs @@ -1,4 +1,4 @@ -// compile-flags: -C debuginfo=2 +//@ compile-flags: -C debuginfo=2 #![allow(dead_code)] diff --git a/tests/codegen/debug-accessibility/super-enum.rs b/tests/codegen/debug-accessibility/super-enum.rs index 9d83fb45bd0b..1b6d7d793ed5 100644 --- a/tests/codegen/debug-accessibility/super-enum.rs +++ b/tests/codegen/debug-accessibility/super-enum.rs @@ -1,4 +1,4 @@ -// compile-flags: -C debuginfo=2 +//@ compile-flags: -C debuginfo=2 // ignore-tidy-linelength #![allow(dead_code)] diff --git a/tests/codegen/debug-accessibility/super-struct.rs b/tests/codegen/debug-accessibility/super-struct.rs index 481006c39650..63954bfb2031 100644 --- a/tests/codegen/debug-accessibility/super-struct.rs +++ b/tests/codegen/debug-accessibility/super-struct.rs @@ -1,4 +1,4 @@ -// compile-flags: -C debuginfo=2 +//@ compile-flags: -C debuginfo=2 #![allow(dead_code)] diff --git a/tests/codegen/debug-accessibility/tuple-fields.rs b/tests/codegen/debug-accessibility/tuple-fields.rs index 1163ba2c7c32..feec6e9eb41f 100644 --- a/tests/codegen/debug-accessibility/tuple-fields.rs +++ b/tests/codegen/debug-accessibility/tuple-fields.rs @@ -1,4 +1,4 @@ -// compile-flags: -C debuginfo=2 +//@ compile-flags: -C debuginfo=2 #![allow(dead_code)] diff --git a/tests/codegen/debug-alignment.rs b/tests/codegen/debug-alignment.rs index f6c1062e0fc6..02fe05832a3d 100644 --- a/tests/codegen/debug-alignment.rs +++ b/tests/codegen/debug-alignment.rs @@ -1,6 +1,6 @@ // Verifies that DWARF alignment is specified properly. // -// compile-flags: -C debuginfo=2 +//@ compile-flags: -C debuginfo=2 #![crate_type = "lib"] // CHECK: !DIGlobalVariable diff --git a/tests/codegen/debug-column-msvc.rs b/tests/codegen/debug-column-msvc.rs index aad8b372a8a9..39f77f413290 100644 --- a/tests/codegen/debug-column-msvc.rs +++ b/tests/codegen/debug-column-msvc.rs @@ -1,7 +1,7 @@ // Verify that no column information is emitted for MSVC targets // -// only-msvc -// compile-flags: -C debuginfo=2 +//@ only-msvc +//@ compile-flags: -C debuginfo=2 // CHECK-NOT: !DILexicalBlock({{.*}}column: {{.*}}) // CHECK-NOT: !DILocation({{.*}}column: {{.*}}) diff --git a/tests/codegen/debug-column.rs b/tests/codegen/debug-column.rs index f3b19a2eb2f4..ff25fbe1b132 100644 --- a/tests/codegen/debug-column.rs +++ b/tests/codegen/debug-column.rs @@ -1,7 +1,7 @@ // Verify that debuginfo column numbers are 1-based byte offsets. // -// ignore-windows -// compile-flags: -C debuginfo=2 +//@ ignore-windows +//@ compile-flags: -C debuginfo=2 fn main() { unsafe { diff --git a/tests/codegen/debug-compile-unit-path.rs b/tests/codegen/debug-compile-unit-path.rs index 3661be046d0f..4be418d66103 100644 --- a/tests/codegen/debug-compile-unit-path.rs +++ b/tests/codegen/debug-compile-unit-path.rs @@ -1,4 +1,4 @@ -// compile-flags: -g --remap-path-prefix={{cwd}}=/cwd/ --remap-path-prefix={{src-base}}=/base/ +//@ compile-flags: -g --remap-path-prefix={{cwd}}=/cwd/ --remap-path-prefix={{src-base}}=/base/ // // // Ensure that we remap the compile unit directory and that we set it to the compilers current diff --git a/tests/codegen/debug-fndef-size.rs b/tests/codegen/debug-fndef-size.rs index 80eb35fa32a9..b3cc45614bc5 100644 --- a/tests/codegen/debug-fndef-size.rs +++ b/tests/codegen/debug-fndef-size.rs @@ -1,6 +1,6 @@ // Verify that `i32::cmp` FnDef type is declared with size 0 and align 1 in LLVM debuginfo. -// compile-flags: -O -g -Cno-prepopulate-passes -// ignore-msvc the types are mangled differently +//@ compile-flags: -O -g -Cno-prepopulate-passes +//@ ignore-msvc the types are mangled differently use std::cmp::Ordering; diff --git a/tests/codegen/debug-limited.rs b/tests/codegen/debug-limited.rs index 48d676887fdd..89a4ef0ca90b 100644 --- a/tests/codegen/debug-limited.rs +++ b/tests/codegen/debug-limited.rs @@ -1,6 +1,6 @@ // Verify that the limited debuginfo option emits llvm's FullDebugInfo, but no type info. // -// compile-flags: -C debuginfo=limited +//@ compile-flags: -C debuginfo=limited #[repr(C)] struct StructType { diff --git a/tests/codegen/debug-line-directives-only.rs b/tests/codegen/debug-line-directives-only.rs index 750bdd49de07..709c8789bf87 100644 --- a/tests/codegen/debug-line-directives-only.rs +++ b/tests/codegen/debug-line-directives-only.rs @@ -1,6 +1,6 @@ // Verify that the only debuginfo generated are the line directives. // -// compile-flags: -C debuginfo=line-directives-only +//@ compile-flags: -C debuginfo=line-directives-only #[repr(C)] struct StructType { diff --git a/tests/codegen/debug-line-tables-only.rs b/tests/codegen/debug-line-tables-only.rs index 3ed165a6f696..d50bffe6e60d 100644 --- a/tests/codegen/debug-line-tables-only.rs +++ b/tests/codegen/debug-line-tables-only.rs @@ -1,6 +1,6 @@ // Verify that the only debuginfo generated are the line tables. // -// compile-flags: -C debuginfo=line-tables-only +//@ compile-flags: -C debuginfo=line-tables-only #[repr(C)] struct StructType { diff --git a/tests/codegen/debug-linkage-name.rs b/tests/codegen/debug-linkage-name.rs index 9bf4d521fc01..e706040f3313 100644 --- a/tests/codegen/debug-linkage-name.rs +++ b/tests/codegen/debug-linkage-name.rs @@ -1,8 +1,8 @@ // Verifies that linkage name is omitted when it is // the same as variable / function name. // -// compile-flags: -C no-prepopulate-passes -Copt-level=0 -// compile-flags: -C debuginfo=2 -Copt-level=0 +//@ compile-flags: -C no-prepopulate-passes -Copt-level=0 +//@ compile-flags: -C debuginfo=2 -Copt-level=0 #![crate_type = "lib"] pub mod xyz { diff --git a/tests/codegen/debug-vtable.rs b/tests/codegen/debug-vtable.rs index e52392b260bd..036fff6cd237 100644 --- a/tests/codegen/debug-vtable.rs +++ b/tests/codegen/debug-vtable.rs @@ -6,7 +6,7 @@ // legacy mangling scheme rustc version and generic parameters are both hashed into a single part // of the name, thus randomizing item order with respect to rustc version. -// compile-flags: -Cdebuginfo=2 -Copt-level=0 -Csymbol-mangling-version=v0 +//@ compile-flags: -Cdebuginfo=2 -Copt-level=0 -Csymbol-mangling-version=v0 // ignore-tidy-linelength // Make sure that vtables don't have the unnamed_addr attribute when debuginfo is enabled. diff --git a/tests/codegen/debuginfo-constant-locals.rs b/tests/codegen/debuginfo-constant-locals.rs index 95a1b8c9d214..f607e0dd08bf 100644 --- a/tests/codegen/debuginfo-constant-locals.rs +++ b/tests/codegen/debuginfo-constant-locals.rs @@ -1,4 +1,4 @@ -// compile-flags: -g -O +//@ compile-flags: -g -O // Check that simple constant values are preserved in debuginfo across both MIR opts and LLVM opts diff --git a/tests/codegen/debuginfo-generic-closure-env-names.rs b/tests/codegen/debuginfo-generic-closure-env-names.rs index b29f8b4a029d..04ff7fff4399 100644 --- a/tests/codegen/debuginfo-generic-closure-env-names.rs +++ b/tests/codegen/debuginfo-generic-closure-env-names.rs @@ -15,7 +15,7 @@ // legacy mangling scheme rustc version and generic parameters are both hashed into a single part // of the name, thus randomizing item order with respect to rustc version. -// compile-flags: -Cdebuginfo=2 --edition 2021 -Copt-level=0 -Csymbol-mangling-version=v0 +//@ compile-flags: -Cdebuginfo=2 --edition 2021 -Copt-level=0 -Csymbol-mangling-version=v0 // non_generic_closure() // NONMSVC: !DICompositeType(tag: DW_TAG_structure_type, name: "{closure_env#0}", scope: ![[non_generic_closure_NAMESPACE:[0-9]+]], diff --git a/tests/codegen/debuginfo-inline-callsite-location.rs b/tests/codegen/debuginfo-inline-callsite-location.rs index d529f9ccead5..833e8c0df912 100644 --- a/tests/codegen/debuginfo-inline-callsite-location.rs +++ b/tests/codegen/debuginfo-inline-callsite-location.rs @@ -1,4 +1,4 @@ -// compile-flags: -g -O +//@ compile-flags: -g -O // Check that each inline call site for the same function uses the same "sub-program" so that LLVM // can correctly merge the debug info if it merges the inlined code (e.g., for merging of tail diff --git a/tests/codegen/deduced-param-attrs.rs b/tests/codegen/deduced-param-attrs.rs index 153046eef3c7..5e7c571b63f8 100644 --- a/tests/codegen/deduced-param-attrs.rs +++ b/tests/codegen/deduced-param-attrs.rs @@ -1,4 +1,4 @@ -// compile-flags: -O +//@ compile-flags: -O #![crate_type = "lib"] #![allow(incomplete_features)] diff --git a/tests/codegen/default-hidden-visibility.rs b/tests/codegen/default-hidden-visibility.rs index 9e5e545f0d93..2bea8f62a40d 100644 --- a/tests/codegen/default-hidden-visibility.rs +++ b/tests/codegen/default-hidden-visibility.rs @@ -3,9 +3,9 @@ // also https://github.com/rust-lang/rust/issues/73295 and // https://github.com/rust-lang/rust/issues/37530. -// revisions:DEFAULT YES NO -//[YES] compile-flags: -Zdefault-hidden-visibility=yes -//[NO] compile-flags: -Zdefault-hidden-visibility=no +//@ revisions:DEFAULT YES NO +//@[YES] compile-flags: -Zdefault-hidden-visibility=yes +//@[NO] compile-flags: -Zdefault-hidden-visibility=no // The test scenario is specifically about visibility of symbols exported out of dynamically linked // libraries. @@ -24,7 +24,7 @@ pub static tested_symbol: [u8; 6] = *b"foobar"; // additional targets can be covered by adding copies of this test file with // a different `only-X` directive. // -// only-x86_64-unknown-linux-gnu +//@ only-x86_64-unknown-linux-gnu // DEFAULT: @{{.*}}default_hidden_visibility{{.*}}tested_symbol{{.*}} = constant // YES: @{{.*}}default_hidden_visibility{{.*}}tested_symbol{{.*}} = hidden constant diff --git a/tests/codegen/default-requires-uwtable.rs b/tests/codegen/default-requires-uwtable.rs index 26424f03568b..567bd55ecc3f 100644 --- a/tests/codegen/default-requires-uwtable.rs +++ b/tests/codegen/default-requires-uwtable.rs @@ -1,9 +1,9 @@ -// revisions: WINDOWS ANDROID -// compile-flags: -C panic=abort -Copt-level=0 -// [WINDOWS] compile-flags: --target=x86_64-pc-windows-msvc -// [WINDOWS] needs-llvm-components: x86 -// [ANDROID] compile-flags: --target=armv7-linux-androideabi -// [ANDROID] needs-llvm-components: arm +//@ revisions: WINDOWS ANDROID +//@ compile-flags: -C panic=abort -Copt-level=0 +//@ [WINDOWS] compile-flags: --target=x86_64-pc-windows-msvc +//@ [WINDOWS] needs-llvm-components: x86 +//@ [ANDROID] compile-flags: --target=armv7-linux-androideabi +//@ [ANDROID] needs-llvm-components: arm #![feature(no_core, lang_items)] #![crate_type = "lib"] diff --git a/tests/codegen/direct-access-external-data.rs b/tests/codegen/direct-access-external-data.rs index ec4bfc33518d..5b2ff41ef052 100644 --- a/tests/codegen/direct-access-external-data.rs +++ b/tests/codegen/direct-access-external-data.rs @@ -1,9 +1,9 @@ -// only-loongarch64-unknown-linux-gnu +//@ only-loongarch64-unknown-linux-gnu -// revisions: DEFAULT DIRECT INDIRECT -// [DEFAULT] compile-flags: -C relocation-model=static -// [DIRECT] compile-flags: -C relocation-model=static -Z direct-access-external-data=yes -// [INDIRECT] compile-flags: -C relocation-model=static -Z direct-access-external-data=no +//@ revisions: DEFAULT DIRECT INDIRECT +//@ [DEFAULT] compile-flags: -C relocation-model=static +//@ [DIRECT] compile-flags: -C relocation-model=static -Z direct-access-external-data=yes +//@ [INDIRECT] compile-flags: -C relocation-model=static -Z direct-access-external-data=no #![crate_type = "rlib"] diff --git a/tests/codegen/dllimports/auxiliary/dummy.rs b/tests/codegen/dllimports/auxiliary/dummy.rs index 113a164f1457..ab3dbc6a3009 100644 --- a/tests/codegen/dllimports/auxiliary/dummy.rs +++ b/tests/codegen/dllimports/auxiliary/dummy.rs @@ -1,4 +1,4 @@ -// no-prefer-dynamic +//@ no-prefer-dynamic #![crate_type = "staticlib"] // Since codegen tests don't actually perform linking, this library doesn't need to export diff --git a/tests/codegen/dllimports/auxiliary/wrapper.rs b/tests/codegen/dllimports/auxiliary/wrapper.rs index 7aa90920a3ed..7d1f6ab70d5f 100644 --- a/tests/codegen/dllimports/auxiliary/wrapper.rs +++ b/tests/codegen/dllimports/auxiliary/wrapper.rs @@ -1,4 +1,4 @@ -// no-prefer-dynamic +//@ no-prefer-dynamic #![crate_type = "rlib"] #[link(name = "dummy", kind="dylib")] diff --git a/tests/codegen/dllimports/main.rs b/tests/codegen/dllimports/main.rs index 383940e95906..c1626853b16d 100644 --- a/tests/codegen/dllimports/main.rs +++ b/tests/codegen/dllimports/main.rs @@ -1,9 +1,9 @@ // This test is for *-windows-msvc only. -// only-windows -// ignore-gnu +//@ only-windows +//@ ignore-gnu -// aux-build:dummy.rs -// aux-build:wrapper.rs +//@ aux-build:dummy.rs +//@ aux-build:wrapper.rs extern crate wrapper; diff --git a/tests/codegen/drop-in-place-noalias.rs b/tests/codegen/drop-in-place-noalias.rs index ece1e426c087..36532ea8f532 100644 --- a/tests/codegen/drop-in-place-noalias.rs +++ b/tests/codegen/drop-in-place-noalias.rs @@ -1,4 +1,4 @@ -// compile-flags: -O -C no-prepopulate-passes +//@ compile-flags: -O -C no-prepopulate-passes // Tests that the compiler can apply `noalias` and other &mut attributes to `drop_in_place`. // Note that non-Unpin types should not get `noalias`, matching &mut behavior. diff --git a/tests/codegen/drop.rs b/tests/codegen/drop.rs index 14b5840e2fe2..93e54979a05f 100644 --- a/tests/codegen/drop.rs +++ b/tests/codegen/drop.rs @@ -1,6 +1,6 @@ -// ignore-wasm32-bare compiled with panic=abort by default -// needs-unwind - this test verifies the amount of drop calls when unwinding is used -// compile-flags: -C no-prepopulate-passes +//@ ignore-wasm32-bare compiled with panic=abort by default +//@ needs-unwind - this test verifies the amount of drop calls when unwinding is used +//@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/tests/codegen/dst-vtable-align-nonzero.rs b/tests/codegen/dst-vtable-align-nonzero.rs index 54f6e7f992fe..b0507f4c217d 100644 --- a/tests/codegen/dst-vtable-align-nonzero.rs +++ b/tests/codegen/dst-vtable-align-nonzero.rs @@ -1,4 +1,4 @@ -// compile-flags: -O -Z merge-functions=disabled +//@ compile-flags: -O -Z merge-functions=disabled #![crate_type = "lib"] #![feature(core_intrinsics)] diff --git a/tests/codegen/dst-vtable-size-range.rs b/tests/codegen/dst-vtable-size-range.rs index 671c8abdebd2..69d8e68497ca 100644 --- a/tests/codegen/dst-vtable-size-range.rs +++ b/tests/codegen/dst-vtable-size-range.rs @@ -1,4 +1,4 @@ -// compile-flags: -O -Z merge-functions=disabled +//@ compile-flags: -O -Z merge-functions=disabled #![crate_type = "lib"] #![feature(core_intrinsics)] diff --git a/tests/codegen/ehcontguard_disabled.rs b/tests/codegen/ehcontguard_disabled.rs index 7773384e5ead..dc4b5eb430bf 100644 --- a/tests/codegen/ehcontguard_disabled.rs +++ b/tests/codegen/ehcontguard_disabled.rs @@ -1,4 +1,4 @@ -// compile-flags: +//@ compile-flags: #![crate_type = "lib"] diff --git a/tests/codegen/ehcontguard_enabled.rs b/tests/codegen/ehcontguard_enabled.rs index 03aaa342b967..fde66f1c148e 100644 --- a/tests/codegen/ehcontguard_enabled.rs +++ b/tests/codegen/ehcontguard_enabled.rs @@ -1,4 +1,4 @@ -// compile-flags: -Z ehcont-guard +//@ compile-flags: -Z ehcont-guard #![crate_type = "lib"] diff --git a/tests/codegen/enable-lto-unit-splitting.rs b/tests/codegen/enable-lto-unit-splitting.rs index 7daa05f69d19..e46980944778 100644 --- a/tests/codegen/enable-lto-unit-splitting.rs +++ b/tests/codegen/enable-lto-unit-splitting.rs @@ -1,6 +1,6 @@ // Verifies that "EnableSplitLTOUnit" module flag is added. // -// compile-flags: -Clto -Ctarget-feature=-crt-static -Zsplit-lto-unit +//@ compile-flags: -Clto -Ctarget-feature=-crt-static -Zsplit-lto-unit #![crate_type="lib"] diff --git a/tests/codegen/enum/enum-bounds-check-derived-idx.rs b/tests/codegen/enum/enum-bounds-check-derived-idx.rs index aa66c2ed08ed..15280cb2e6c8 100644 --- a/tests/codegen/enum/enum-bounds-check-derived-idx.rs +++ b/tests/codegen/enum/enum-bounds-check-derived-idx.rs @@ -1,6 +1,6 @@ // This test checks an optimization that is not guaranteed to work. This test case should not block // a future LLVM update. -// compile-flags: -O +//@ compile-flags: -O #![crate_type = "lib"] diff --git a/tests/codegen/enum/enum-bounds-check-issue-13926.rs b/tests/codegen/enum/enum-bounds-check-issue-13926.rs index b26945bc5494..b60ff38ce392 100644 --- a/tests/codegen/enum/enum-bounds-check-issue-13926.rs +++ b/tests/codegen/enum/enum-bounds-check-issue-13926.rs @@ -1,6 +1,6 @@ // This test checks an optimization that is not guaranteed to work. This test case should not block // a future LLVM update. -// compile-flags: -O +//@ compile-flags: -O #![crate_type = "lib"] diff --git a/tests/codegen/enum/enum-bounds-check-issue-82871.rs b/tests/codegen/enum/enum-bounds-check-issue-82871.rs index 32fdc4a5f4fa..3b8a146838aa 100644 --- a/tests/codegen/enum/enum-bounds-check-issue-82871.rs +++ b/tests/codegen/enum/enum-bounds-check-issue-82871.rs @@ -1,4 +1,4 @@ -// compile-flags: -C opt-level=0 +//@ compile-flags: -C opt-level=0 #![crate_type = "lib"] diff --git a/tests/codegen/enum/enum-bounds-check.rs b/tests/codegen/enum/enum-bounds-check.rs index 17322d5911b9..a1b32ec9295b 100644 --- a/tests/codegen/enum/enum-bounds-check.rs +++ b/tests/codegen/enum/enum-bounds-check.rs @@ -1,4 +1,4 @@ -// compile-flags: -O +//@ compile-flags: -O #![crate_type = "lib"] diff --git a/tests/codegen/enum/enum-debug-clike.rs b/tests/codegen/enum/enum-debug-clike.rs index 1e369a2c4e6a..205c57d1456e 100644 --- a/tests/codegen/enum/enum-debug-clike.rs +++ b/tests/codegen/enum/enum-debug-clike.rs @@ -2,9 +2,9 @@ // This is ignored for the fallback mode on MSVC due to problems with PDB. // -// ignore-msvc +//@ ignore-msvc -// compile-flags: -g -C no-prepopulate-passes +//@ compile-flags: -g -C no-prepopulate-passes // CHECK-LABEL: @main // CHECK: {{.*}}DICompositeType{{.*}}tag: DW_TAG_enumeration_type,{{.*}}name: "E",{{.*}}flags: DIFlagEnumClass,{{.*}} diff --git a/tests/codegen/enum/enum-debug-niche-2.rs b/tests/codegen/enum/enum-debug-niche-2.rs index 4b607d505745..4315741e0bdd 100644 --- a/tests/codegen/enum/enum-debug-niche-2.rs +++ b/tests/codegen/enum/enum-debug-niche-2.rs @@ -2,9 +2,9 @@ // This is ignored for the fallback mode on MSVC due to problems with PDB. // -// ignore-msvc +//@ ignore-msvc -// compile-flags: -g -C no-prepopulate-passes +//@ compile-flags: -g -C no-prepopulate-passes // CHECK: {{.*}}DICompositeType{{.*}}tag: DW_TAG_variant_part,{{.*}}size: 32,{{.*}} // CHECK: {{.*}}DIDerivedType{{.*}}tag: DW_TAG_member,{{.*}}name: "Placeholder",{{.*}}extraData: i128 4294967295{{[,)].*}} diff --git a/tests/codegen/enum/enum-debug-niche.rs b/tests/codegen/enum/enum-debug-niche.rs index b718a6854dd7..fc6a73e84721 100644 --- a/tests/codegen/enum/enum-debug-niche.rs +++ b/tests/codegen/enum/enum-debug-niche.rs @@ -1,9 +1,9 @@ // This tests that optimized enum debug info accurately reflects the enum layout. // This is ignored for the fallback mode on MSVC due to problems with PDB. -// ignore-msvc +//@ ignore-msvc -// compile-flags: -g -C no-prepopulate-passes +//@ compile-flags: -g -C no-prepopulate-passes // CHECK-LABEL: @main // CHECK: {{.*}}DICompositeType{{.*}}tag: DW_TAG_variant_part,{{.*}}discriminator:{{.*}} diff --git a/tests/codegen/enum/enum-debug-tagged.rs b/tests/codegen/enum/enum-debug-tagged.rs index 095c49ac3acb..87a6ccae2913 100644 --- a/tests/codegen/enum/enum-debug-tagged.rs +++ b/tests/codegen/enum/enum-debug-tagged.rs @@ -1,9 +1,9 @@ // This tests that debug info for tagged (ordinary) enums is properly emitted. // This is ignored for the fallback mode on MSVC due to problems with PDB. -// ignore-msvc +//@ ignore-msvc -// compile-flags: -g -C no-prepopulate-passes +//@ compile-flags: -g -C no-prepopulate-passes // CHECK-LABEL: @main // CHECK: {{.*}}DICompositeType{{.*}}tag: DW_TAG_structure_type,{{.*}}name: "E",{{.*}} diff --git a/tests/codegen/enum/enum-discriminant-value.rs b/tests/codegen/enum/enum-discriminant-value.rs index cc14c2120025..d6b0c6d6c108 100644 --- a/tests/codegen/enum/enum-discriminant-value.rs +++ b/tests/codegen/enum/enum-discriminant-value.rs @@ -1,6 +1,6 @@ // Verify that DIEnumerator uses isUnsigned flag when appropriate. // -// compile-flags: -g -C no-prepopulate-passes +//@ compile-flags: -g -C no-prepopulate-passes #[repr(i64)] pub enum I64 { diff --git a/tests/codegen/enum/enum-match.rs b/tests/codegen/enum/enum-match.rs index 5548cd251478..2e6dad8791b2 100644 --- a/tests/codegen/enum/enum-match.rs +++ b/tests/codegen/enum/enum-match.rs @@ -1,5 +1,5 @@ -// compile-flags: -Copt-level=1 -// only-x86_64 +//@ compile-flags: -Copt-level=1 +//@ only-x86_64 #![crate_type = "lib"] diff --git a/tests/codegen/enum/enum-u128.rs b/tests/codegen/enum/enum-u128.rs index f50d360ac9f3..94e80e34068c 100644 --- a/tests/codegen/enum/enum-u128.rs +++ b/tests/codegen/enum/enum-u128.rs @@ -2,9 +2,9 @@ // This is ignored for the fallback mode on MSVC due to problems with PDB. // -// ignore-msvc +//@ ignore-msvc -// compile-flags: -g -C no-prepopulate-passes +//@ compile-flags: -g -C no-prepopulate-passes // CHECK-LABEL: @main // CHECK: {{.*}}DICompositeType{{.*}}tag: DW_TAG_enumeration_type,{{.*}}name: "Foo",{{.*}}flags: DIFlagEnumClass,{{.*}} diff --git a/tests/codegen/export-no-mangle.rs b/tests/codegen/export-no-mangle.rs index a89d48ee1533..5040684f52ec 100644 --- a/tests/codegen/export-no-mangle.rs +++ b/tests/codegen/export-no-mangle.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes +//@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/tests/codegen/external-no-mangle-fns.rs b/tests/codegen/external-no-mangle-fns.rs index 70349b2ec4f6..35ab0fd79097 100644 --- a/tests/codegen/external-no-mangle-fns.rs +++ b/tests/codegen/external-no-mangle-fns.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes +//@ compile-flags: -C no-prepopulate-passes // `#[no_mangle]`d functions always have external linkage, i.e., no `internal` in their `define`s #![crate_type = "lib"] diff --git a/tests/codegen/external-no-mangle-statics.rs b/tests/codegen/external-no-mangle-statics.rs index 48023a2a901c..a44867ff9230 100644 --- a/tests/codegen/external-no-mangle-statics.rs +++ b/tests/codegen/external-no-mangle-statics.rs @@ -1,8 +1,8 @@ -// revisions: lib staticlib -// ignore-emscripten default visibility is hidden -// compile-flags: -O -// [lib] compile-flags: --crate-type lib -// [staticlib] compile-flags: --crate-type staticlib +//@ revisions: lib staticlib +//@ ignore-emscripten default visibility is hidden +//@ compile-flags: -O +//@ [lib] compile-flags: --crate-type lib +//@ [staticlib] compile-flags: --crate-type staticlib // `#[no_mangle]`d static variables always have external linkage, i.e., no `internal` in their // definitions diff --git a/tests/codegen/fastcall-inreg.rs b/tests/codegen/fastcall-inreg.rs index ab19efa45bf9..2459ec1539e4 100644 --- a/tests/codegen/fastcall-inreg.rs +++ b/tests/codegen/fastcall-inreg.rs @@ -2,8 +2,8 @@ // as "inreg" like the C/C++ compilers for the platforms. // x86 only. -// compile-flags: --target i686-unknown-linux-gnu -O -C no-prepopulate-passes -// needs-llvm-components: x86 +//@ compile-flags: --target i686-unknown-linux-gnu -O -C no-prepopulate-passes +//@ needs-llvm-components: x86 #![crate_type = "lib"] #![no_core] diff --git a/tests/codegen/fatptr.rs b/tests/codegen/fatptr.rs index 1c49b5714ef5..0f13e66fbad0 100644 --- a/tests/codegen/fatptr.rs +++ b/tests/codegen/fatptr.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes +//@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/tests/codegen/fewer-names.rs b/tests/codegen/fewer-names.rs index 05643fab96a1..b14dd30482c5 100644 --- a/tests/codegen/fewer-names.rs +++ b/tests/codegen/fewer-names.rs @@ -1,7 +1,7 @@ -// compile-flags: -Coverflow-checks=no -O -// revisions: YES NO -// [YES]compile-flags: -Zfewer-names=yes -// [NO] compile-flags: -Zfewer-names=no +//@ compile-flags: -Coverflow-checks=no -O +//@ revisions: YES NO +//@ [YES]compile-flags: -Zfewer-names=yes +//@ [NO] compile-flags: -Zfewer-names=no #![crate_type = "lib"] #[no_mangle] diff --git a/tests/codegen/float_math.rs b/tests/codegen/float_math.rs index 592e09452df6..dcca51c2f5eb 100644 --- a/tests/codegen/float_math.rs +++ b/tests/codegen/float_math.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes +//@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] #![feature(core_intrinsics)] diff --git a/tests/codegen/fn-impl-trait-self.rs b/tests/codegen/fn-impl-trait-self.rs index 0abc8a409ed7..9f10762d8fa7 100644 --- a/tests/codegen/fn-impl-trait-self.rs +++ b/tests/codegen/fn-impl-trait-self.rs @@ -1,4 +1,4 @@ -// compile-flags: -g +//@ compile-flags: -g // // CHECK-LABEL: @main // MSVC: {{.*}}DIDerivedType(tag: DW_TAG_pointer_type, name: "recursive_type$ (*)()",{{.*}} diff --git a/tests/codegen/force-frame-pointers.rs b/tests/codegen/force-frame-pointers.rs index 5791ae47937b..c41824e024fd 100644 --- a/tests/codegen/force-frame-pointers.rs +++ b/tests/codegen/force-frame-pointers.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes -C force-frame-pointers=y -Copt-level=0 +//@ compile-flags: -C no-prepopulate-passes -C force-frame-pointers=y -Copt-level=0 #![crate_type="lib"] diff --git a/tests/codegen/force-no-unwind-tables.rs b/tests/codegen/force-no-unwind-tables.rs index 3ee23f05eb2b..0189ae7c0a68 100644 --- a/tests/codegen/force-no-unwind-tables.rs +++ b/tests/codegen/force-no-unwind-tables.rs @@ -1,5 +1,5 @@ -// compile-flags: -C no-prepopulate-passes -C panic=abort -C force-unwind-tables=n -// ignore-windows +//@ compile-flags: -C no-prepopulate-passes -C panic=abort -C force-unwind-tables=n +//@ ignore-windows #![crate_type="lib"] diff --git a/tests/codegen/force-unwind-tables.rs b/tests/codegen/force-unwind-tables.rs index c904978c9ff2..33fdf7653f49 100644 --- a/tests/codegen/force-unwind-tables.rs +++ b/tests/codegen/force-unwind-tables.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes -C force-unwind-tables=y -Copt-level=0 +//@ compile-flags: -C no-prepopulate-passes -C force-unwind-tables=y -Copt-level=0 #![crate_type="lib"] diff --git a/tests/codegen/frame-pointer.rs b/tests/codegen/frame-pointer.rs index d8933262e528..879535bcc368 100644 --- a/tests/codegen/frame-pointer.rs +++ b/tests/codegen/frame-pointer.rs @@ -1,15 +1,15 @@ -// compile-flags: --crate-type=rlib -Copt-level=0 -// revisions: aarch64-apple aarch64-linux force x64-apple x64-linux -// [aarch64-apple] needs-llvm-components: aarch64 -// [aarch64-apple] compile-flags: --target=aarch64-apple-darwin -// [aarch64-linux] needs-llvm-components: aarch64 -// [aarch64-linux] compile-flags: --target=aarch64-unknown-linux-gnu -// [force] needs-llvm-components: x86 -// [force] compile-flags: --target=x86_64-unknown-linux-gnu -Cforce-frame-pointers=yes -// [x64-apple] needs-llvm-components: x86 -// [x64-apple] compile-flags: --target=x86_64-apple-darwin -// [x64-linux] needs-llvm-components: x86 -// [x64-linux] compile-flags: --target=x86_64-unknown-linux-gnu +//@ compile-flags: --crate-type=rlib -Copt-level=0 +//@ revisions: aarch64-apple aarch64-linux force x64-apple x64-linux +//@ [aarch64-apple] needs-llvm-components: aarch64 +//@ [aarch64-apple] compile-flags: --target=aarch64-apple-darwin +//@ [aarch64-linux] needs-llvm-components: aarch64 +//@ [aarch64-linux] compile-flags: --target=aarch64-unknown-linux-gnu +//@ [force] needs-llvm-components: x86 +//@ [force] compile-flags: --target=x86_64-unknown-linux-gnu -Cforce-frame-pointers=yes +//@ [x64-apple] needs-llvm-components: x86 +//@ [x64-apple] compile-flags: --target=x86_64-apple-darwin +//@ [x64-linux] needs-llvm-components: x86 +//@ [x64-linux] compile-flags: --target=x86_64-unknown-linux-gnu #![feature(no_core, lang_items)] #![no_core] diff --git a/tests/codegen/function-arguments-noopt.rs b/tests/codegen/function-arguments-noopt.rs index 1bd735cc1af3..e99ceddfb728 100644 --- a/tests/codegen/function-arguments-noopt.rs +++ b/tests/codegen/function-arguments-noopt.rs @@ -1,4 +1,4 @@ -// compile-flags: -C opt-level=0 -C no-prepopulate-passes +//@ compile-flags: -C opt-level=0 -C no-prepopulate-passes // This test checks that arguments/returns in opt-level=0 builds, // while lacking attributes used for optimization, still have ABI-affecting attributes. diff --git a/tests/codegen/function-arguments.rs b/tests/codegen/function-arguments.rs index 64ebd3c05afe..88cedcf46b69 100644 --- a/tests/codegen/function-arguments.rs +++ b/tests/codegen/function-arguments.rs @@ -1,4 +1,4 @@ -// compile-flags: -O -C no-prepopulate-passes +//@ compile-flags: -O -C no-prepopulate-passes #![crate_type = "lib"] #![feature(dyn_star)] diff --git a/tests/codegen/function-return.rs b/tests/codegen/function-return.rs index d832d19ac392..0ca1a41ee867 100644 --- a/tests/codegen/function-return.rs +++ b/tests/codegen/function-return.rs @@ -1,13 +1,13 @@ // Test that the `fn_ret_thunk_extern` function attribute is (not) emitted when // the `-Zfunction-return={keep,thunk-extern}` flag is (not) set. -// revisions: unset keep thunk-extern keep-thunk-extern thunk-extern-keep -// needs-llvm-components: x86 -// compile-flags: --target x86_64-unknown-linux-gnu -// [keep] compile-flags: -Zfunction-return=keep -// [thunk-extern] compile-flags: -Zfunction-return=thunk-extern -// [keep-thunk-extern] compile-flags: -Zfunction-return=keep -Zfunction-return=thunk-extern -// [thunk-extern-keep] compile-flags: -Zfunction-return=thunk-extern -Zfunction-return=keep +//@ revisions: unset keep thunk-extern keep-thunk-extern thunk-extern-keep +//@ needs-llvm-components: x86 +//@ compile-flags: --target x86_64-unknown-linux-gnu +//@ [keep] compile-flags: -Zfunction-return=keep +//@ [thunk-extern] compile-flags: -Zfunction-return=thunk-extern +//@ [keep-thunk-extern] compile-flags: -Zfunction-return=keep -Zfunction-return=thunk-extern +//@ [thunk-extern-keep] compile-flags: -Zfunction-return=thunk-extern -Zfunction-return=keep #![crate_type = "lib"] #![feature(no_core, lang_items)] diff --git a/tests/codegen/gdb_debug_script_load.rs b/tests/codegen/gdb_debug_script_load.rs index 002be8d1b419..f15defeaca8b 100644 --- a/tests/codegen/gdb_debug_script_load.rs +++ b/tests/codegen/gdb_debug_script_load.rs @@ -1,10 +1,10 @@ // -// ignore-windows -// ignore-macos -// ignore-wasm -// ignore-emscripten +//@ ignore-windows +//@ ignore-macos +//@ ignore-wasm +//@ ignore-emscripten -// compile-flags: -g -C no-prepopulate-passes +//@ compile-flags: -g -C no-prepopulate-passes #![feature(start)] diff --git a/tests/codegen/generic-debug.rs b/tests/codegen/generic-debug.rs index eea16805c596..87a0ddfea93f 100644 --- a/tests/codegen/generic-debug.rs +++ b/tests/codegen/generic-debug.rs @@ -1,6 +1,6 @@ -// ignore-windows +//@ ignore-windows -// compile-flags: -g -C no-prepopulate-passes +//@ compile-flags: -g -C no-prepopulate-passes // CHECK-LABEL: @main // CHECK: {{.*}}DICompositeType{{.*}}tag: DW_TAG_structure_type,{{.*}}name: "Generic",{{.*}} diff --git a/tests/codegen/global_asm.rs b/tests/codegen/global_asm.rs index 4c2ccf4e0e95..32075daa3cf2 100644 --- a/tests/codegen/global_asm.rs +++ b/tests/codegen/global_asm.rs @@ -1,7 +1,7 @@ -// revisions: x32 x64 -//[x32] only-x86 -//[x64] only-x86_64 -// compile-flags: -C no-prepopulate-passes +//@ revisions: x32 x64 +//@[x32] only-x86 +//@[x64] only-x86_64 +//@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/tests/codegen/global_asm_include.rs b/tests/codegen/global_asm_include.rs index 0fede8c71e44..98be9c3e3332 100644 --- a/tests/codegen/global_asm_include.rs +++ b/tests/codegen/global_asm_include.rs @@ -1,7 +1,7 @@ -// revisions: x32 x64 -//[x32] only-x86 -//[x64] only-x86_64 -// compile-flags: -C no-prepopulate-passes +//@ revisions: x32 x64 +//@[x32] only-x86 +//@[x64] only-x86_64 +//@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/tests/codegen/global_asm_x2.rs b/tests/codegen/global_asm_x2.rs index 1fc2825b2bd4..9e3a00f06805 100644 --- a/tests/codegen/global_asm_x2.rs +++ b/tests/codegen/global_asm_x2.rs @@ -1,7 +1,7 @@ -// revisions: x32 x64 -//[x32] only-x86 -//[x64] only-x86_64 -// compile-flags: -C no-prepopulate-passes +//@ revisions: x32 x64 +//@[x32] only-x86 +//@[x64] only-x86_64 +//@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] #![no_std] diff --git a/tests/codegen/i128-x86-align.rs b/tests/codegen/i128-x86-align.rs index aaf5785dc9ff..9cc5c3d3ed7b 100644 --- a/tests/codegen/i128-x86-align.rs +++ b/tests/codegen/i128-x86-align.rs @@ -1,5 +1,5 @@ -// only-x86_64 -// compile-flags: -O -C no-prepopulate-passes --crate-type=lib +//@ only-x86_64 +//@ compile-flags: -O -C no-prepopulate-passes --crate-type=lib // On LLVM 17 and earlier LLVM's own data layout specifies that i128 has 8 byte alignment, // while rustc wants it to have 16 byte alignment. This test checks that we handle this diff --git a/tests/codegen/infallible-unwrap-in-opt-z.rs b/tests/codegen/infallible-unwrap-in-opt-z.rs index e8ab77f8d20d..3756fafe3840 100644 --- a/tests/codegen/infallible-unwrap-in-opt-z.rs +++ b/tests/codegen/infallible-unwrap-in-opt-z.rs @@ -1,5 +1,4 @@ -// compile-flags: -C opt-level=z --edition=2021 -// ignore-debug +//@ compile-flags: -C opt-level=z --edition=2021 #![crate_type = "lib"] diff --git a/tests/codegen/inherit_overflow.rs b/tests/codegen/inherit_overflow.rs index fa9ee0ae12a1..f08071aaa618 100644 --- a/tests/codegen/inherit_overflow.rs +++ b/tests/codegen/inherit_overflow.rs @@ -1,7 +1,7 @@ -// compile-flags: -Zmir-enable-passes=+Inline,+GVN --crate-type lib -// revisions: ASSERT NOASSERT -//[ASSERT] compile-flags: -Coverflow-checks=on -//[NOASSERT] compile-flags: -Coverflow-checks=off +//@ compile-flags: -Zmir-enable-passes=+Inline,+GVN --crate-type lib +//@ revisions: ASSERT NOASSERT +//@[ASSERT] compile-flags: -Coverflow-checks=on +//@[NOASSERT] compile-flags: -Coverflow-checks=off // CHECK-LABEL: define{{.*}} @assertion // ASSERT: call void @{{.*4core9panicking5panic}} diff --git a/tests/codegen/inline-always-works-always.rs b/tests/codegen/inline-always-works-always.rs index 912af782a8f3..e9ca05d17569 100644 --- a/tests/codegen/inline-always-works-always.rs +++ b/tests/codegen/inline-always-works-always.rs @@ -1,7 +1,7 @@ -// revisions: NO-OPT SIZE-OPT SPEED-OPT -//[NO-OPT] compile-flags: -Copt-level=0 -//[SIZE-OPT] compile-flags: -Copt-level=s -//[SPEED-OPT] compile-flags: -Copt-level=3 +//@ revisions: NO-OPT SIZE-OPT SPEED-OPT +//@[NO-OPT] compile-flags: -Copt-level=0 +//@[SIZE-OPT] compile-flags: -Copt-level=s +//@[SPEED-OPT] compile-flags: -Copt-level=3 #![crate_type="rlib"] diff --git a/tests/codegen/inline-debuginfo.rs b/tests/codegen/inline-debuginfo.rs index 5b230361f397..b6ea489f99f8 100644 --- a/tests/codegen/inline-debuginfo.rs +++ b/tests/codegen/inline-debuginfo.rs @@ -1,5 +1,5 @@ #![crate_type="rlib"] -// compile-flags: -Copt-level=3 -g +//@ compile-flags: -Copt-level=3 -g // #[no_mangle] diff --git a/tests/codegen/inline-function-args-debug-info.rs b/tests/codegen/inline-function-args-debug-info.rs index ffae99e0f24e..7263374b22e1 100644 --- a/tests/codegen/inline-function-args-debug-info.rs +++ b/tests/codegen/inline-function-args-debug-info.rs @@ -2,7 +2,7 @@ // gets inlined by MIR inlining. Without function argument indexes, `info args` in gdb won't show // arguments and their values for the current function. -// compile-flags: -Zinline-mir=yes -Cdebuginfo=2 --edition=2021 +//@ compile-flags: -Zinline-mir=yes -Cdebuginfo=2 --edition=2021 #![crate_type = "lib"] diff --git a/tests/codegen/inline-hint.rs b/tests/codegen/inline-hint.rs index bb2a8e6a649d..3d46885d5a24 100644 --- a/tests/codegen/inline-hint.rs +++ b/tests/codegen/inline-hint.rs @@ -1,7 +1,7 @@ // Checks that closures, constructors, and shims except // for a drop glue receive inline hint by default. // -// compile-flags: -Cno-prepopulate-passes -Csymbol-mangling-version=v0 -Zinline-mir=no +//@ compile-flags: -Cno-prepopulate-passes -Csymbol-mangling-version=v0 -Zinline-mir=no #![crate_type = "lib"] pub fn f() { diff --git a/tests/codegen/instrument-coverage-off.rs b/tests/codegen/instrument-coverage-off.rs index ca803beec0b1..fda3c541a25f 100644 --- a/tests/codegen/instrument-coverage-off.rs +++ b/tests/codegen/instrument-coverage-off.rs @@ -1,12 +1,12 @@ // Test that `-Cinstrument-coverage=off` does not add coverage instrumentation to LLVM IR. -// needs-profiler-support -// revisions: n no off false zero -// [n] compile-flags: -Cinstrument-coverage=n -// [no] compile-flags: -Cinstrument-coverage=no -// [off] compile-flags: -Cinstrument-coverage=off -// [false] compile-flags: -Cinstrument-coverage=false -// [zero] compile-flags: -Cinstrument-coverage=0 +//@ needs-profiler-support +//@ revisions: n no off false zero +//@ [n] compile-flags: -Cinstrument-coverage=n +//@ [no] compile-flags: -Cinstrument-coverage=no +//@ [off] compile-flags: -Cinstrument-coverage=off +//@ [false] compile-flags: -Cinstrument-coverage=false +//@ [zero] compile-flags: -Cinstrument-coverage=0 // CHECK-NOT: __llvm_profile_filename // CHECK-NOT: __llvm_coverage_mapping diff --git a/tests/codegen/instrument-coverage.rs b/tests/codegen/instrument-coverage.rs index f8437dac4632..f7d96ea34672 100644 --- a/tests/codegen/instrument-coverage.rs +++ b/tests/codegen/instrument-coverage.rs @@ -1,13 +1,13 @@ // Test that `-Cinstrument-coverage` creates expected __llvm_profile_filename symbol in LLVM IR. -// needs-profiler-support -// revisions: default y yes on true all -// [default] compile-flags: -Cinstrument-coverage -// [y] compile-flags: -Cinstrument-coverage=y -// [yes] compile-flags: -Cinstrument-coverage=yes -// [on] compile-flags: -Cinstrument-coverage=on -// [true] compile-flags: -Cinstrument-coverage=true -// [all] compile-flags: -Cinstrument-coverage=all +//@ needs-profiler-support +//@ revisions: default y yes on true all +//@ [default] compile-flags: -Cinstrument-coverage +//@ [y] compile-flags: -Cinstrument-coverage=y +//@ [yes] compile-flags: -Cinstrument-coverage=yes +//@ [on] compile-flags: -Cinstrument-coverage=on +//@ [true] compile-flags: -Cinstrument-coverage=true +//@ [all] compile-flags: -Cinstrument-coverage=all // CHECK: @__llvm_profile_filename = {{.*}}"default_%m_%p.profraw\00"{{.*}} // CHECK: @__llvm_coverage_mapping diff --git a/tests/codegen/instrument-mcount.rs b/tests/codegen/instrument-mcount.rs index 50823775a41a..8c97535d4a82 100644 --- a/tests/codegen/instrument-mcount.rs +++ b/tests/codegen/instrument-mcount.rs @@ -1,5 +1,5 @@ // -// compile-flags: -Z instrument-mcount -Copt-level=0 +//@ compile-flags: -Z instrument-mcount -Copt-level=0 #![crate_type = "lib"] diff --git a/tests/codegen/instrument-xray/basic.rs b/tests/codegen/instrument-xray/basic.rs index 5da878474f2e..7aaebf41e36e 100644 --- a/tests/codegen/instrument-xray/basic.rs +++ b/tests/codegen/instrument-xray/basic.rs @@ -1,7 +1,7 @@ // Checks that `-Z instrument-xray` produces expected instrumentation. // -// needs-xray -// compile-flags: -Z instrument-xray=always -Copt-level=0 +//@ needs-xray +//@ compile-flags: -Z instrument-xray=always -Copt-level=0 #![crate_type = "lib"] diff --git a/tests/codegen/instrument-xray/options-combine.rs b/tests/codegen/instrument-xray/options-combine.rs index d1e56586279a..d1e3b78e6b24 100644 --- a/tests/codegen/instrument-xray/options-combine.rs +++ b/tests/codegen/instrument-xray/options-combine.rs @@ -1,9 +1,9 @@ // Checks that `-Z instrument-xray` options can be specified multiple times. // -// needs-xray -// compile-flags: -Z instrument-xray=skip-exit -Copt-level=0 -// compile-flags: -Z instrument-xray=instruction-threshold=123 -Copt-level=0 -// compile-flags: -Z instrument-xray=instruction-threshold=456 -Copt-level=0 +//@ needs-xray +//@ compile-flags: -Z instrument-xray=skip-exit -Copt-level=0 +//@ compile-flags: -Z instrument-xray=instruction-threshold=123 -Copt-level=0 +//@ compile-flags: -Z instrument-xray=instruction-threshold=456 -Copt-level=0 #![crate_type = "lib"] diff --git a/tests/codegen/instrument-xray/options-override.rs b/tests/codegen/instrument-xray/options-override.rs index b1fc4c966dcb..428fb723edb1 100644 --- a/tests/codegen/instrument-xray/options-override.rs +++ b/tests/codegen/instrument-xray/options-override.rs @@ -1,8 +1,8 @@ // Checks that the last `-Z instrument-xray` option wins. // -// needs-xray -// compile-flags: -Z instrument-xray=always -Copt-level=0 -// compile-flags: -Z instrument-xray=never -Copt-level=0 +//@ needs-xray +//@ compile-flags: -Z instrument-xray=always -Copt-level=0 +//@ compile-flags: -Z instrument-xray=never -Copt-level=0 #![crate_type = "lib"] diff --git a/tests/codegen/integer-cmp.rs b/tests/codegen/integer-cmp.rs index 8ada3cf09d07..46972878da50 100644 --- a/tests/codegen/integer-cmp.rs +++ b/tests/codegen/integer-cmp.rs @@ -1,7 +1,7 @@ // This is test for more optimal Ord implementation for integers. // See for more info. -// compile-flags: -C opt-level=3 +//@ compile-flags: -C opt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/integer-overflow.rs b/tests/codegen/integer-overflow.rs index b5c351b5e35d..00780251bbc1 100644 --- a/tests/codegen/integer-overflow.rs +++ b/tests/codegen/integer-overflow.rs @@ -1,4 +1,4 @@ -// compile-flags: -O -C overflow-checks=on +//@ compile-flags: -O -C overflow-checks=on #![crate_type = "lib"] diff --git a/tests/codegen/internalize-closures.rs b/tests/codegen/internalize-closures.rs index ab3dc3fba5ef..d37aa5fee8da 100644 --- a/tests/codegen/internalize-closures.rs +++ b/tests/codegen/internalize-closures.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes -Zmir-opt-level=0 +//@ compile-flags: -C no-prepopulate-passes -Zmir-opt-level=0 pub fn main() { diff --git a/tests/codegen/intrinsic-no-unnamed-attr.rs b/tests/codegen/intrinsic-no-unnamed-attr.rs index c8a8e0b3e7a0..45d06c70a6d7 100644 --- a/tests/codegen/intrinsic-no-unnamed-attr.rs +++ b/tests/codegen/intrinsic-no-unnamed-attr.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes +//@ compile-flags: -C no-prepopulate-passes #![feature(intrinsics)] diff --git a/tests/codegen/intrinsics/compare_bytes.rs b/tests/codegen/intrinsics/compare_bytes.rs index e69224d818c0..cd592918fb0c 100644 --- a/tests/codegen/intrinsics/compare_bytes.rs +++ b/tests/codegen/intrinsics/compare_bytes.rs @@ -1,7 +1,7 @@ -// revisions: INT32 INT16 -// compile-flags: -O -// [INT32] ignore-16bit -// [INT16] only-16bit +//@ revisions: INT32 INT16 +//@ compile-flags: -O +//@ [INT32] ignore-16bit +//@ [INT16] only-16bit #![crate_type = "lib"] #![feature(core_intrinsics)] diff --git a/tests/codegen/intrinsics/const_eval_select.rs b/tests/codegen/intrinsics/const_eval_select.rs index f3877dc6b96a..c8debe8d7113 100644 --- a/tests/codegen/intrinsics/const_eval_select.rs +++ b/tests/codegen/intrinsics/const_eval_select.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes -Copt-level=0 +//@ compile-flags: -C no-prepopulate-passes -Copt-level=0 #![crate_type = "lib"] #![feature(const_eval_select)] diff --git a/tests/codegen/intrinsics/exact_div.rs b/tests/codegen/intrinsics/exact_div.rs index 68eaa39997a1..dc625ba7fe4e 100644 --- a/tests/codegen/intrinsics/exact_div.rs +++ b/tests/codegen/intrinsics/exact_div.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes +//@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] #![feature(core_intrinsics)] diff --git a/tests/codegen/intrinsics/likely.rs b/tests/codegen/intrinsics/likely.rs index c5a0185bd482..c5904085fc08 100644 --- a/tests/codegen/intrinsics/likely.rs +++ b/tests/codegen/intrinsics/likely.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes +//@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] #![feature(core_intrinsics)] diff --git a/tests/codegen/intrinsics/mask.rs b/tests/codegen/intrinsics/mask.rs index 82131c558472..5344274678cc 100644 --- a/tests/codegen/intrinsics/mask.rs +++ b/tests/codegen/intrinsics/mask.rs @@ -1,4 +1,4 @@ -// compile-flags: -Copt-level=0 +//@ compile-flags: -Copt-level=0 #![crate_type = "lib"] #![feature(core_intrinsics)] diff --git a/tests/codegen/intrinsics/nontemporal.rs b/tests/codegen/intrinsics/nontemporal.rs index dc020c121195..076d6d6d9da4 100644 --- a/tests/codegen/intrinsics/nontemporal.rs +++ b/tests/codegen/intrinsics/nontemporal.rs @@ -1,4 +1,4 @@ -// compile-flags: -O +//@ compile-flags: -O #![feature(core_intrinsics)] #![crate_type = "lib"] diff --git a/tests/codegen/intrinsics/offset.rs b/tests/codegen/intrinsics/offset.rs index 542bacf99a80..d4791cd30b0b 100644 --- a/tests/codegen/intrinsics/offset.rs +++ b/tests/codegen/intrinsics/offset.rs @@ -1,4 +1,4 @@ -// compile-flags: -O -C no-prepopulate-passes +//@ compile-flags: -O -C no-prepopulate-passes #![crate_type = "lib"] #![feature(core_intrinsics)] diff --git a/tests/codegen/intrinsics/offset_from.rs b/tests/codegen/intrinsics/offset_from.rs index d0de4c8355d0..ef1a77ef184c 100644 --- a/tests/codegen/intrinsics/offset_from.rs +++ b/tests/codegen/intrinsics/offset_from.rs @@ -1,5 +1,5 @@ -// compile-flags: -C opt-level=1 -// only-64bit (because we're using [ui]size) +//@ compile-flags: -C opt-level=1 +//@ only-64bit (because we're using [ui]size) #![crate_type = "lib"] #![feature(core_intrinsics)] diff --git a/tests/codegen/intrinsics/prefetch.rs b/tests/codegen/intrinsics/prefetch.rs index 59d7fa6381b8..edd8c20b38f1 100644 --- a/tests/codegen/intrinsics/prefetch.rs +++ b/tests/codegen/intrinsics/prefetch.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes +//@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] #![feature(core_intrinsics)] diff --git a/tests/codegen/intrinsics/transmute-niched.rs b/tests/codegen/intrinsics/transmute-niched.rs index e9c8d803cb9e..7c448c82e4b2 100644 --- a/tests/codegen/intrinsics/transmute-niched.rs +++ b/tests/codegen/intrinsics/transmute-niched.rs @@ -1,7 +1,7 @@ -// revisions: OPT DBG -// [OPT] compile-flags: -C opt-level=3 -C no-prepopulate-passes -// [DBG] compile-flags: -C opt-level=0 -C no-prepopulate-passes -// only-64bit (so I don't need to worry about usize) +//@ revisions: OPT DBG +//@ [OPT] compile-flags: -C opt-level=3 -C no-prepopulate-passes +//@ [DBG] compile-flags: -C opt-level=0 -C no-prepopulate-passes +//@ only-64bit (so I don't need to worry about usize) #![crate_type = "lib"] diff --git a/tests/codegen/intrinsics/transmute-x64.rs b/tests/codegen/intrinsics/transmute-x64.rs index 19020f6280a5..ea1c6b0e7e80 100644 --- a/tests/codegen/intrinsics/transmute-x64.rs +++ b/tests/codegen/intrinsics/transmute-x64.rs @@ -1,5 +1,5 @@ -// compile-flags: -O -C no-prepopulate-passes -// only-x86_64 (it's using arch-specific types) +//@ compile-flags: -O -C no-prepopulate-passes +//@ only-x86_64 (it's using arch-specific types) #![crate_type = "lib"] diff --git a/tests/codegen/intrinsics/transmute.rs b/tests/codegen/intrinsics/transmute.rs index eff16050875c..5a503e86010b 100644 --- a/tests/codegen/intrinsics/transmute.rs +++ b/tests/codegen/intrinsics/transmute.rs @@ -1,5 +1,5 @@ -// compile-flags: -O -C no-prepopulate-passes -// only-64bit (so I don't need to worry about usize) +//@ compile-flags: -O -C no-prepopulate-passes +//@ only-64bit (so I don't need to worry about usize) #![crate_type = "lib"] #![feature(core_intrinsics)] diff --git a/tests/codegen/intrinsics/volatile.rs b/tests/codegen/intrinsics/volatile.rs index 7980c00e7e72..2dea5ecb2ca9 100644 --- a/tests/codegen/intrinsics/volatile.rs +++ b/tests/codegen/intrinsics/volatile.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes +//@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] #![feature(core_intrinsics)] diff --git a/tests/codegen/is_val_statically_known.rs b/tests/codegen/is_val_statically_known.rs index 95f6466b2548..255d8950a974 100644 --- a/tests/codegen/is_val_statically_known.rs +++ b/tests/codegen/is_val_statically_known.rs @@ -1,4 +1,4 @@ -// compile-flags: --crate-type=lib -Zmerge-functions=disabled -O +//@ compile-flags: --crate-type=lib -Zmerge-functions=disabled -O #![feature(core_intrinsics)] diff --git a/tests/codegen/issue-97217.rs b/tests/codegen/issue-97217.rs index af7345442fc5..a0dfff2ef2eb 100644 --- a/tests/codegen/issue-97217.rs +++ b/tests/codegen/issue-97217.rs @@ -1,6 +1,5 @@ -// compile-flags: -C opt-level=3 -// ignore-debug: the debug assertions get in the way -// min-llvm-version: 17.0.2 +//@ compile-flags: -C opt-level=3 +//@ min-llvm-version: 17.0.2 #![crate_type = "lib"] // Regression test for issue 97217 (the following should result in no allocations) diff --git a/tests/codegen/issues/issue-101048.rs b/tests/codegen/issues/issue-101048.rs index e4712cf9cb3f..fa6dc550f301 100644 --- a/tests/codegen/issues/issue-101048.rs +++ b/tests/codegen/issues/issue-101048.rs @@ -1,4 +1,4 @@ -// compile-flags: -O +//@ compile-flags: -O #![crate_type = "lib"] diff --git a/tests/codegen/issues/issue-101082.rs b/tests/codegen/issues/issue-101082.rs index 58fcd75a8f2d..550d267a98fa 100644 --- a/tests/codegen/issues/issue-101082.rs +++ b/tests/codegen/issues/issue-101082.rs @@ -1,5 +1,4 @@ -// compile-flags: -O -// ignore-debug: the debug assertions get in the way +//@ compile-flags: -O #![crate_type = "lib"] diff --git a/tests/codegen/issues/issue-101814.rs b/tests/codegen/issues/issue-101814.rs index 63a8cebcb608..e3843e9edb0b 100644 --- a/tests/codegen/issues/issue-101814.rs +++ b/tests/codegen/issues/issue-101814.rs @@ -1,5 +1,4 @@ -// compile-flags: -O -// ignore-debug: the debug assertions get in the way +//@ compile-flags: -O #![crate_type = "lib"] diff --git a/tests/codegen/issues/issue-103132.rs b/tests/codegen/issues/issue-103132.rs index 521d424c2696..8c1a17c8b78c 100644 --- a/tests/codegen/issues/issue-103132.rs +++ b/tests/codegen/issues/issue-103132.rs @@ -1,4 +1,4 @@ -// compile-flags: -O -C overflow-checks +//@ compile-flags: -O -C overflow-checks #![crate_type = "lib"] diff --git a/tests/codegen/issues/issue-103285-ptr-addr-overflow-check.rs b/tests/codegen/issues/issue-103285-ptr-addr-overflow-check.rs index a3499babea21..d4a74b3d7828 100644 --- a/tests/codegen/issues/issue-103285-ptr-addr-overflow-check.rs +++ b/tests/codegen/issues/issue-103285-ptr-addr-overflow-check.rs @@ -1,4 +1,4 @@ -// compile-flags: -O -C debug-assertions=yes +//@ compile-flags: -O -C debug-assertions=yes #![crate_type = "lib"] #![feature(strict_provenance)] diff --git a/tests/codegen/issues/issue-103327.rs b/tests/codegen/issues/issue-103327.rs index 021f1ca0c3af..398b1f376b78 100644 --- a/tests/codegen/issues/issue-103327.rs +++ b/tests/codegen/issues/issue-103327.rs @@ -1,4 +1,4 @@ -// compile-flags: -O +//@ compile-flags: -O #![crate_type = "lib"] diff --git a/tests/codegen/issues/issue-103840.rs b/tests/codegen/issues/issue-103840.rs index f19d7031bb38..14f157771e07 100644 --- a/tests/codegen/issues/issue-103840.rs +++ b/tests/codegen/issues/issue-103840.rs @@ -1,4 +1,4 @@ -// compile-flags: -O +//@ compile-flags: -O #![crate_type = "lib"] pub fn foo(t: &mut Vec) { diff --git a/tests/codegen/issues/issue-105386-ub-in-debuginfo.rs b/tests/codegen/issues/issue-105386-ub-in-debuginfo.rs index 54c50f840c55..476db7c13585 100644 --- a/tests/codegen/issues/issue-105386-ub-in-debuginfo.rs +++ b/tests/codegen/issues/issue-105386-ub-in-debuginfo.rs @@ -1,4 +1,4 @@ -// compile-flags: --crate-type=lib -O -Cdebuginfo=2 -Cno-prepopulate-passes -Zmir-enable-passes=-ScalarReplacementOfAggregates +//@ compile-flags: --crate-type=lib -O -Cdebuginfo=2 -Cno-prepopulate-passes -Zmir-enable-passes=-ScalarReplacementOfAggregates // MIR SROA will decompose the closure #![feature(stmt_expr_attributes)] diff --git a/tests/codegen/issues/issue-106369.rs b/tests/codegen/issues/issue-106369.rs index 3fe7be4f1442..fd375e4e6058 100644 --- a/tests/codegen/issues/issue-106369.rs +++ b/tests/codegen/issues/issue-106369.rs @@ -1,5 +1,4 @@ -// compile-flags: -O -// ignore-debug (the extra assertions get in the way) +//@ compile-flags: -O #![crate_type = "lib"] diff --git a/tests/codegen/issues/issue-111603.rs b/tests/codegen/issues/issue-111603.rs index 06429ed3fa9b..3f4c7e7d5423 100644 --- a/tests/codegen/issues/issue-111603.rs +++ b/tests/codegen/issues/issue-111603.rs @@ -1,4 +1,4 @@ -// compile-flags: -O +//@ compile-flags: -O #![crate_type = "lib"] #![feature(get_mut_unchecked, new_uninit)] diff --git a/tests/codegen/issues/issue-114312.rs b/tests/codegen/issues/issue-114312.rs index e2fbcef721ef..54fa40dcf0d4 100644 --- a/tests/codegen/issues/issue-114312.rs +++ b/tests/codegen/issues/issue-114312.rs @@ -1,6 +1,6 @@ -// compile-flags: -O -// min-llvm-version: 17 -// only-x86_64-unknown-linux-gnu +//@ compile-flags: -O +//@ min-llvm-version: 17 +//@ only-x86_64-unknown-linux-gnu // We want to check that this function does not mis-optimize to loop jumping. diff --git a/tests/codegen/issues/issue-115385-llvm-jump-threading.rs b/tests/codegen/issues/issue-115385-llvm-jump-threading.rs index 142e3596d961..55aa69a7de03 100644 --- a/tests/codegen/issues/issue-115385-llvm-jump-threading.rs +++ b/tests/codegen/issues/issue-115385-llvm-jump-threading.rs @@ -1,4 +1,4 @@ -// compile-flags: -O -Ccodegen-units=1 +//@ compile-flags: -O -Ccodegen-units=1 #![crate_type = "lib"] diff --git a/tests/codegen/issues/issue-116878.rs b/tests/codegen/issues/issue-116878.rs index 5864f5323249..a09fac42c018 100644 --- a/tests/codegen/issues/issue-116878.rs +++ b/tests/codegen/issues/issue-116878.rs @@ -1,5 +1,4 @@ -// compile-flags: -O -// ignore-debug: the debug assertions get in the way +//@ compile-flags: -O #![crate_type = "lib"] /// Make sure no bounds checks are emitted after a `get_unchecked`. diff --git a/tests/codegen/issues/issue-119422.rs b/tests/codegen/issues/issue-119422.rs index 9c99d96317d7..937fdcf28f5d 100644 --- a/tests/codegen/issues/issue-119422.rs +++ b/tests/codegen/issues/issue-119422.rs @@ -1,8 +1,8 @@ //! This test checks that compiler don't generate useless compares to zeros //! for NonZero integer types. -// compile-flags: -O --edition=2021 -Zmerge-functions=disabled -// only-64bit (because the LLVM type of i64 for usize shows up) +//@ compile-flags: -O --edition=2021 -Zmerge-functions=disabled +//@ only-64bit (because the LLVM type of i64 for usize shows up) #![crate_type = "lib"] diff --git a/tests/codegen/issues/issue-13018.rs b/tests/codegen/issues/issue-13018.rs index b70ea1f48c8c..d0a8ce159118 100644 --- a/tests/codegen/issues/issue-13018.rs +++ b/tests/codegen/issues/issue-13018.rs @@ -1,4 +1,4 @@ -// compile-flags: -O +//@ compile-flags: -O // A drop([...].clone()) sequence on an Rc should be a no-op // In particular, no call to __rust_dealloc should be emitted diff --git a/tests/codegen/issues/issue-27130.rs b/tests/codegen/issues/issue-27130.rs index e5ee94e1f45e..9c22b41e97fe 100644 --- a/tests/codegen/issues/issue-27130.rs +++ b/tests/codegen/issues/issue-27130.rs @@ -1,4 +1,4 @@ -// compile-flags: -O +//@ compile-flags: -O #![crate_type = "lib"] diff --git a/tests/codegen/issues/issue-32031.rs b/tests/codegen/issues/issue-32031.rs index abef92c19b61..9693c414a67d 100644 --- a/tests/codegen/issues/issue-32031.rs +++ b/tests/codegen/issues/issue-32031.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes -Copt-level=0 +//@ compile-flags: -C no-prepopulate-passes -Copt-level=0 #![crate_type = "lib"] diff --git a/tests/codegen/issues/issue-32364.rs b/tests/codegen/issues/issue-32364.rs index 85493a4bb739..50006e3f2181 100644 --- a/tests/codegen/issues/issue-32364.rs +++ b/tests/codegen/issues/issue-32364.rs @@ -1,8 +1,8 @@ // Test that `extern "stdcall"` is properly translated. -// only-x86 +//@ only-x86 -// compile-flags: -C no-prepopulate-passes +//@ compile-flags: -C no-prepopulate-passes struct Foo; diff --git a/tests/codegen/issues/issue-34634.rs b/tests/codegen/issues/issue-34634.rs index f53fa240cd1a..a11f248e7404 100644 --- a/tests/codegen/issues/issue-34634.rs +++ b/tests/codegen/issues/issue-34634.rs @@ -3,7 +3,7 @@ // switch case (the second check present until rustc 1.12). // This test also verifies that a single panic call is generated (for the division by zero case). -// compile-flags: -O +//@ compile-flags: -O #![crate_type = "lib"] // CHECK-LABEL: @f diff --git a/tests/codegen/issues/issue-34947-pow-i32.rs b/tests/codegen/issues/issue-34947-pow-i32.rs index 653da8e8b5f7..c9141c0e9252 100644 --- a/tests/codegen/issues/issue-34947-pow-i32.rs +++ b/tests/codegen/issues/issue-34947-pow-i32.rs @@ -1,4 +1,4 @@ -// compile-flags: -O +//@ compile-flags: -O #![crate_type = "lib"] diff --git a/tests/codegen/issues/issue-37945.rs b/tests/codegen/issues/issue-37945.rs index 329769940f9d..756a75e2f0ed 100644 --- a/tests/codegen/issues/issue-37945.rs +++ b/tests/codegen/issues/issue-37945.rs @@ -1,6 +1,5 @@ -// compile-flags: -O -Zmerge-functions=disabled -// ignore-32bit LLVM has a bug with them -// ignore-debug +//@ compile-flags: -O -Zmerge-functions=disabled +//@ ignore-32bit LLVM has a bug with them // Check that LLVM understands that `Iter` pointer is not null. Issue #37945. diff --git a/tests/codegen/issues/issue-44056-macos-tls-align.rs b/tests/codegen/issues/issue-44056-macos-tls-align.rs index 44aa9766d3c0..c99f0b73038b 100644 --- a/tests/codegen/issues/issue-44056-macos-tls-align.rs +++ b/tests/codegen/issues/issue-44056-macos-tls-align.rs @@ -1,6 +1,6 @@ // -// only-macos -// compile-flags: -O +//@ only-macos +//@ compile-flags: -O #![crate_type = "rlib"] #![feature(thread_local)] diff --git a/tests/codegen/issues/issue-45222.rs b/tests/codegen/issues/issue-45222.rs index e9b05e648b44..d2c1ba421c45 100644 --- a/tests/codegen/issues/issue-45222.rs +++ b/tests/codegen/issues/issue-45222.rs @@ -1,5 +1,4 @@ -// compile-flags: -O -// ignore-debug: the debug assertions get in the way +//@ compile-flags: -O #![crate_type = "lib"] diff --git a/tests/codegen/issues/issue-45466.rs b/tests/codegen/issues/issue-45466.rs index c79542767774..fc714247dfb6 100644 --- a/tests/codegen/issues/issue-45466.rs +++ b/tests/codegen/issues/issue-45466.rs @@ -1,5 +1,4 @@ -// compile-flags: -O -// ignore-debug: the debug assertions get in the way +//@ compile-flags: -O #![crate_type="rlib"] diff --git a/tests/codegen/issues/issue-45964-bounds-check-slice-pos.rs b/tests/codegen/issues/issue-45964-bounds-check-slice-pos.rs index 1daa213fc821..b7568bea4d0a 100644 --- a/tests/codegen/issues/issue-45964-bounds-check-slice-pos.rs +++ b/tests/codegen/issues/issue-45964-bounds-check-slice-pos.rs @@ -1,8 +1,7 @@ // This test case checks that slice::{r}position functions do not // prevent optimizing away bounds checks -// compile-flags: -O -// ignore-debug: the debug assertions get in the way +//@ compile-flags: -O #![crate_type="rlib"] diff --git a/tests/codegen/issues/issue-56267-2.rs b/tests/codegen/issues/issue-56267-2.rs index 1715e9f05ab5..ced0d2d63bb5 100644 --- a/tests/codegen/issues/issue-56267-2.rs +++ b/tests/codegen/issues/issue-56267-2.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes +//@ compile-flags: -C no-prepopulate-passes #![crate_type="rlib"] diff --git a/tests/codegen/issues/issue-56267.rs b/tests/codegen/issues/issue-56267.rs index 90aa9f7ae899..fc3754f2d990 100644 --- a/tests/codegen/issues/issue-56267.rs +++ b/tests/codegen/issues/issue-56267.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes +//@ compile-flags: -C no-prepopulate-passes #![crate_type="rlib"] diff --git a/tests/codegen/issues/issue-56927.rs b/tests/codegen/issues/issue-56927.rs index 1b09ce565b37..e4a0a1791418 100644 --- a/tests/codegen/issues/issue-56927.rs +++ b/tests/codegen/issues/issue-56927.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes +//@ compile-flags: -C no-prepopulate-passes #![crate_type="rlib"] diff --git a/tests/codegen/issues/issue-58881.rs b/tests/codegen/issues/issue-58881.rs index a1d0e8eb7e0c..759e3b70baa1 100644 --- a/tests/codegen/issues/issue-58881.rs +++ b/tests/codegen/issues/issue-58881.rs @@ -1,7 +1,7 @@ -// compile-flags: -C no-prepopulate-passes -Copt-level=0 +//@ compile-flags: -C no-prepopulate-passes -Copt-level=0 // -// only-x86_64 -// ignore-windows +//@ only-x86_64 +//@ ignore-windows #![crate_type = "lib"] diff --git a/tests/codegen/issues/issue-59352.rs b/tests/codegen/issues/issue-59352.rs index d271fe027e30..7bedc3ffc4a1 100644 --- a/tests/codegen/issues/issue-59352.rs +++ b/tests/codegen/issues/issue-59352.rs @@ -6,7 +6,7 @@ // test case should be removed as it will become redundant. // mir-opt-level=3 enables inlining and enables LLVM to optimize away the unreachable panic call. -// compile-flags: -O -Z mir-opt-level=3 +//@ compile-flags: -O -Z mir-opt-level=3 #![crate_type = "rlib"] diff --git a/tests/codegen/issues/issue-69101-bounds-check.rs b/tests/codegen/issues/issue-69101-bounds-check.rs index 655de45fd51e..c014a1c1b1d4 100644 --- a/tests/codegen/issues/issue-69101-bounds-check.rs +++ b/tests/codegen/issues/issue-69101-bounds-check.rs @@ -1,5 +1,4 @@ -// compile-flags: -O -// ignore-debug: the debug assertions get in the way +//@ compile-flags: -O #![crate_type = "lib"] // Make sure no bounds checks are emitted in the loop when upfront slicing diff --git a/tests/codegen/issues/issue-73031.rs b/tests/codegen/issues/issue-73031.rs index a09c4bcfbeac..61a269999e90 100644 --- a/tests/codegen/issues/issue-73031.rs +++ b/tests/codegen/issues/issue-73031.rs @@ -1,4 +1,4 @@ -// compile-flags: -O +//@ compile-flags: -O #![crate_type = "lib"] // Test that LLVM can eliminate the unreachable `All::None` branch. diff --git a/tests/codegen/issues/issue-73258.rs b/tests/codegen/issues/issue-73258.rs index 0134f929b296..48f14fe2dfe3 100644 --- a/tests/codegen/issues/issue-73258.rs +++ b/tests/codegen/issues/issue-73258.rs @@ -1,5 +1,4 @@ -// compile-flags: -O -// ignore-debug (the extra assertions get in the way) +//@ compile-flags: -O #![crate_type = "lib"] diff --git a/tests/codegen/issues/issue-73338-effecient-cmp.rs b/tests/codegen/issues/issue-73338-effecient-cmp.rs index 85c2bbfd040b..a64eb56f9030 100644 --- a/tests/codegen/issues/issue-73338-effecient-cmp.rs +++ b/tests/codegen/issues/issue-73338-effecient-cmp.rs @@ -2,7 +2,7 @@ // generated by #[derive(PartialOrd)] // doesn't contain jumps for C enums -// compile-flags: -Copt-level=3 +//@ compile-flags: -Copt-level=3 #![crate_type="lib"] diff --git a/tests/codegen/issues/issue-73396-bounds-check-after-position.rs b/tests/codegen/issues/issue-73396-bounds-check-after-position.rs index 2d7797887912..ef4538ac84e1 100644 --- a/tests/codegen/issues/issue-73396-bounds-check-after-position.rs +++ b/tests/codegen/issues/issue-73396-bounds-check-after-position.rs @@ -1,5 +1,4 @@ -// compile-flags: -O -// ignore-debug: the debug assertions get in the way +//@ compile-flags: -O #![crate_type = "lib"] // Make sure no bounds checks are emitted when slicing or indexing diff --git a/tests/codegen/issues/issue-73827-bounds-check-index-in-subexpr.rs b/tests/codegen/issues/issue-73827-bounds-check-index-in-subexpr.rs index 1ad05906e21a..c3eb1a5968af 100644 --- a/tests/codegen/issues/issue-73827-bounds-check-index-in-subexpr.rs +++ b/tests/codegen/issues/issue-73827-bounds-check-index-in-subexpr.rs @@ -1,7 +1,7 @@ // This test checks that bounds checks are elided when // index is part of a (x | y) < C style condition -// compile-flags: -O +//@ compile-flags: -O #![crate_type = "lib"] diff --git a/tests/codegen/issues/issue-75525-bounds-checks.rs b/tests/codegen/issues/issue-75525-bounds-checks.rs index 2d363d8f73be..fbc10ce3d843 100644 --- a/tests/codegen/issues/issue-75525-bounds-checks.rs +++ b/tests/codegen/issues/issue-75525-bounds-checks.rs @@ -1,6 +1,6 @@ // Regression test for #75525, verifies that no bounds checks are generated. -// compile-flags: -O +//@ compile-flags: -O #![crate_type = "lib"] diff --git a/tests/codegen/issues/issue-75546.rs b/tests/codegen/issues/issue-75546.rs index 470a9e040960..992ef97d6242 100644 --- a/tests/codegen/issues/issue-75546.rs +++ b/tests/codegen/issues/issue-75546.rs @@ -1,4 +1,4 @@ -// compile-flags: -O +//@ compile-flags: -O #![crate_type = "lib"] // Test that LLVM can eliminate the impossible `i == 0` check. diff --git a/tests/codegen/issues/issue-75659.rs b/tests/codegen/issues/issue-75659.rs index 9394868c08db..1860b73f2a9a 100644 --- a/tests/codegen/issues/issue-75659.rs +++ b/tests/codegen/issues/issue-75659.rs @@ -1,8 +1,8 @@ // This test checks that the call to memchr/slice_contains is optimized away // when searching in small slices. -// compile-flags: -O -Zinline-mir=false -// only-x86_64 +//@ compile-flags: -O -Zinline-mir=false +//@ only-x86_64 #![crate_type = "lib"] diff --git a/tests/codegen/issues/issue-75978.rs b/tests/codegen/issues/issue-75978.rs index abfafc35f0b4..ed953fae7671 100644 --- a/tests/codegen/issues/issue-75978.rs +++ b/tests/codegen/issues/issue-75978.rs @@ -1,4 +1,4 @@ -// compile-flags: -O +//@ compile-flags: -O #![crate_type = "lib"] diff --git a/tests/codegen/issues/issue-77812.rs b/tests/codegen/issues/issue-77812.rs index 4cc82414546b..b9ce0a4f7db2 100644 --- a/tests/codegen/issues/issue-77812.rs +++ b/tests/codegen/issues/issue-77812.rs @@ -1,4 +1,4 @@ -// compile-flags: -O +//@ compile-flags: -O #![crate_type = "lib"] // Test that LLVM can eliminate the unreachable `Variant::Zero` branch. diff --git a/tests/codegen/issues/issue-81408-dllimport-thinlto-windows.rs b/tests/codegen/issues/issue-81408-dllimport-thinlto-windows.rs index 0b6ab4f7ecb3..49301be776fd 100644 --- a/tests/codegen/issues/issue-81408-dllimport-thinlto-windows.rs +++ b/tests/codegen/issues/issue-81408-dllimport-thinlto-windows.rs @@ -1,6 +1,6 @@ -// compile-flags: -O -C lto=thin -C prefer-dynamic=no -// only-windows -// aux-build:static_dllimport_aux.rs +//@ compile-flags: -O -C lto=thin -C prefer-dynamic=no +//@ only-windows +//@ aux-build:static_dllimport_aux.rs // Test that on Windows, when performing ThinLTO, we do not mark cross-crate static items with // dllimport because lld does not fix the symbol names for us. diff --git a/tests/codegen/issues/issue-84268.rs b/tests/codegen/issues/issue-84268.rs index 7ca195447007..379ee4f13f64 100644 --- a/tests/codegen/issues/issue-84268.rs +++ b/tests/codegen/issues/issue-84268.rs @@ -1,4 +1,4 @@ -// compile-flags: -O --crate-type=rlib +//@ compile-flags: -O --crate-type=rlib #![feature(platform_intrinsics, repr_simd)] extern "platform-intrinsic" { diff --git a/tests/codegen/issues/issue-85872-multiple-reverse.rs b/tests/codegen/issues/issue-85872-multiple-reverse.rs index a4723a0e9460..fb5ff8309e5c 100644 --- a/tests/codegen/issues/issue-85872-multiple-reverse.rs +++ b/tests/codegen/issues/issue-85872-multiple-reverse.rs @@ -1,4 +1,4 @@ -// compile-flags: -O +//@ compile-flags: -O #![crate_type = "lib"] diff --git a/tests/codegen/issues/issue-86106.rs b/tests/codegen/issues/issue-86106.rs index 5f71d46fb202..e8164c5c3802 100644 --- a/tests/codegen/issues/issue-86106.rs +++ b/tests/codegen/issues/issue-86106.rs @@ -1,5 +1,5 @@ -// only-64bit llvm appears to use stores instead of memset on 32bit -// compile-flags: -C opt-level=3 -Z merge-functions=disabled +//@ only-64bit llvm appears to use stores instead of memset on 32bit +//@ compile-flags: -C opt-level=3 -Z merge-functions=disabled // The below two functions ensure that both `String::new()` and `"".to_string()` // produce the identical code. diff --git a/tests/codegen/issues/issue-96274.rs b/tests/codegen/issues/issue-96274.rs index a44789ce350a..d278796dd02a 100644 --- a/tests/codegen/issues/issue-96274.rs +++ b/tests/codegen/issues/issue-96274.rs @@ -1,4 +1,4 @@ -// compile-flags: -O +//@ compile-flags: -O #![crate_type = "lib"] #![feature(inline_const)] diff --git a/tests/codegen/issues/issue-96497-slice-size-nowrap.rs b/tests/codegen/issues/issue-96497-slice-size-nowrap.rs index 3ea6a5405e51..c2b262b3334c 100644 --- a/tests/codegen/issues/issue-96497-slice-size-nowrap.rs +++ b/tests/codegen/issues/issue-96497-slice-size-nowrap.rs @@ -2,7 +2,7 @@ // The possibility of wrapping results in an additional branch when dropping boxed slices // in some situations, see https://github.com/rust-lang/rust/issues/96497#issuecomment-1112865218 -// compile-flags: -O +//@ compile-flags: -O #![crate_type="lib"] diff --git a/tests/codegen/issues/issue-98156-const-arg-temp-lifetime.rs b/tests/codegen/issues/issue-98156-const-arg-temp-lifetime.rs index 12ace5fff6b6..28324bfa90ef 100644 --- a/tests/codegen/issues/issue-98156-const-arg-temp-lifetime.rs +++ b/tests/codegen/issues/issue-98156-const-arg-temp-lifetime.rs @@ -1,6 +1,6 @@ // This test checks that temporaries for indirectly-passed arguments get lifetime markers. -// compile-flags: -O -C no-prepopulate-passes -Zmir-opt-level=0 +//@ compile-flags: -O -C no-prepopulate-passes -Zmir-opt-level=0 #![crate_type = "lib"] diff --git a/tests/codegen/issues/issue-98294-get-mut-copy-from-slice-opt.rs b/tests/codegen/issues/issue-98294-get-mut-copy-from-slice-opt.rs index b87e43c13b65..40827e32a012 100644 --- a/tests/codegen/issues/issue-98294-get-mut-copy-from-slice-opt.rs +++ b/tests/codegen/issues/issue-98294-get-mut-copy-from-slice-opt.rs @@ -1,5 +1,4 @@ -// ignore-debug: The debug assertions get in the way -// compile-flags: -O +//@ compile-flags: -O #![crate_type = "lib"] diff --git a/tests/codegen/issues/issue-99960.rs b/tests/codegen/issues/issue-99960.rs index ad0315a8227e..075495061750 100644 --- a/tests/codegen/issues/issue-99960.rs +++ b/tests/codegen/issues/issue-99960.rs @@ -1,4 +1,4 @@ -// compile-flags: -O +//@ compile-flags: -O #![crate_type = "lib"] diff --git a/tests/codegen/iter-repeat-n-trivial-drop.rs b/tests/codegen/iter-repeat-n-trivial-drop.rs index b052d339917d..31020b77984b 100644 --- a/tests/codegen/iter-repeat-n-trivial-drop.rs +++ b/tests/codegen/iter-repeat-n-trivial-drop.rs @@ -1,6 +1,5 @@ -// compile-flags: -O -// only-x86_64 -// ignore-debug: the debug assertions get in the way +//@ compile-flags: -O +//@ only-x86_64 #![crate_type = "lib"] #![feature(iter_repeat_n)] diff --git a/tests/codegen/layout-size-checks.rs b/tests/codegen/layout-size-checks.rs index d067cc10a948..901f8f822f32 100644 --- a/tests/codegen/layout-size-checks.rs +++ b/tests/codegen/layout-size-checks.rs @@ -1,6 +1,5 @@ -// compile-flags: -O -// only-x86_64 -// ignore-debug: the debug assertions get in the way +//@ compile-flags: -O +//@ only-x86_64 #![crate_type = "lib"] diff --git a/tests/codegen/lib-optimizations/iter-sum.rs b/tests/codegen/lib-optimizations/iter-sum.rs index ff7ca6ef6c11..b563a6debb52 100644 --- a/tests/codegen/lib-optimizations/iter-sum.rs +++ b/tests/codegen/lib-optimizations/iter-sum.rs @@ -1,6 +1,5 @@ -// ignore-debug: the debug assertions get in the way -// compile-flags: -O -// only-x86_64 (vectorization varies between architectures) +//@ compile-flags: -O +//@ only-x86_64 (vectorization varies between architectures) #![crate_type = "lib"] diff --git a/tests/codegen/lifetime_start_end.rs b/tests/codegen/lifetime_start_end.rs index 16175dc18c20..38e878451588 100644 --- a/tests/codegen/lifetime_start_end.rs +++ b/tests/codegen/lifetime_start_end.rs @@ -1,4 +1,4 @@ -// compile-flags: -O -C no-prepopulate-passes -Zmir-opt-level=0 +//@ compile-flags: -O -C no-prepopulate-passes -Zmir-opt-level=0 #![crate_type = "lib"] diff --git a/tests/codegen/link-dead-code.rs b/tests/codegen/link-dead-code.rs index de5a237c5f8a..7769622233f6 100644 --- a/tests/codegen/link-dead-code.rs +++ b/tests/codegen/link-dead-code.rs @@ -1,4 +1,4 @@ -// compile-flags:-Clink-dead-code +//@ compile-flags:-Clink-dead-code #![crate_type = "rlib"] diff --git a/tests/codegen/link_section.rs b/tests/codegen/link_section.rs index 2b26b604ad32..6747feba211b 100644 --- a/tests/codegen/link_section.rs +++ b/tests/codegen/link_section.rs @@ -1,5 +1,5 @@ -// ignore-emscripten default visibility is hidden -// compile-flags: -C no-prepopulate-passes +//@ ignore-emscripten default visibility is hidden +//@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/tests/codegen/llvm-ident.rs b/tests/codegen/llvm-ident.rs index 927f0d602ad7..923e99bb282c 100644 --- a/tests/codegen/llvm-ident.rs +++ b/tests/codegen/llvm-ident.rs @@ -1,9 +1,9 @@ // Verifies that the `!llvm.ident` named metadata is emitted. // -// revisions: NONE OPT DEBUG +//@ revisions: NONE OPT DEBUG // -// [OPT] compile-flags: -Copt-level=2 -// [DEBUG] compile-flags: -Cdebuginfo=2 +//@ [OPT] compile-flags: -Copt-level=2 +//@ [DEBUG] compile-flags: -Cdebuginfo=2 // The named metadata should contain a single metadata node (see // `LLVMRustPrepareThinLTOImport` for details). diff --git a/tests/codegen/llvm_module_flags.rs b/tests/codegen/llvm_module_flags.rs index acc035086de2..d3fae0c3927d 100644 --- a/tests/codegen/llvm_module_flags.rs +++ b/tests/codegen/llvm_module_flags.rs @@ -1,5 +1,5 @@ // Test for -Z llvm_module_flags -// compile-flags: -Z llvm_module_flag=foo:u32:123:error -Z llvm_module_flag=bar:u32:42:max +//@ compile-flags: -Z llvm_module_flag=foo:u32:123:error -Z llvm_module_flag=bar:u32:42:max fn main() {} diff --git a/tests/codegen/loads.rs b/tests/codegen/loads.rs index 4a09a1dc0339..0471d83c25a3 100644 --- a/tests/codegen/loads.rs +++ b/tests/codegen/loads.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes -Zmir-opt-level=0 +//@ compile-flags: -C no-prepopulate-passes -Zmir-opt-level=0 #![crate_type = "lib"] diff --git a/tests/codegen/local-generics-in-exe-internalized.rs b/tests/codegen/local-generics-in-exe-internalized.rs index 449c5ca75fcd..8dbc41382b5a 100644 --- a/tests/codegen/local-generics-in-exe-internalized.rs +++ b/tests/codegen/local-generics-in-exe-internalized.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes -Zshare-generics=yes -Zinline-mir=no +//@ compile-flags: -C no-prepopulate-passes -Zshare-generics=yes -Zinline-mir=no // Check that local generics are internalized if they are in the same CGU diff --git a/tests/codegen/loongarch-abi/call-llvm-intrinsics.rs b/tests/codegen/loongarch-abi/call-llvm-intrinsics.rs index 4b78f6e24f7b..9a50f7b8e3a5 100644 --- a/tests/codegen/loongarch-abi/call-llvm-intrinsics.rs +++ b/tests/codegen/loongarch-abi/call-llvm-intrinsics.rs @@ -1,6 +1,6 @@ -// compile-flags: -C no-prepopulate-passes +//@ compile-flags: -C no-prepopulate-passes -// only-loongarch64 +//@ only-loongarch64 #![feature(link_llvm_intrinsics)] #![crate_type = "lib"] diff --git a/tests/codegen/loongarch-abi/loongarch64-lp64d-abi.rs b/tests/codegen/loongarch-abi/loongarch64-lp64d-abi.rs index 591ccd45ab62..3c895eb9531a 100644 --- a/tests/codegen/loongarch-abi/loongarch64-lp64d-abi.rs +++ b/tests/codegen/loongarch-abi/loongarch64-lp64d-abi.rs @@ -1,6 +1,6 @@ -// compile-flags: -C no-prepopulate-passes -// only-loongarch64 -// only-linux +//@ compile-flags: -C no-prepopulate-passes +//@ only-loongarch64 +//@ only-linux #![crate_type = "lib"] diff --git a/tests/codegen/lto-removes-invokes.rs b/tests/codegen/lto-removes-invokes.rs index 3979a97dc01b..f0102c25d5bd 100644 --- a/tests/codegen/lto-removes-invokes.rs +++ b/tests/codegen/lto-removes-invokes.rs @@ -1,5 +1,5 @@ -// compile-flags: -C lto -C panic=abort -O -// no-prefer-dynamic +//@ compile-flags: -C lto -C panic=abort -O +//@ no-prefer-dynamic fn main() { foo(); diff --git a/tests/codegen/macos/i686-macosx-deployment-target.rs b/tests/codegen/macos/i686-macosx-deployment-target.rs index ba49178dcb6b..b854476de418 100644 --- a/tests/codegen/macos/i686-macosx-deployment-target.rs +++ b/tests/codegen/macos/i686-macosx-deployment-target.rs @@ -2,9 +2,9 @@ // Checks that we correctly modify the target when MACOSX_DEPLOYMENT_TARGET is set. // See issue #60235. -// compile-flags: -O --target=i686-apple-darwin --crate-type=rlib -// needs-llvm-components: x86 -// rustc-env:MACOSX_DEPLOYMENT_TARGET=10.14 +//@ compile-flags: -O --target=i686-apple-darwin --crate-type=rlib +//@ needs-llvm-components: x86 +//@ rustc-env:MACOSX_DEPLOYMENT_TARGET=10.14 #![feature(no_core, lang_items)] #![no_core] diff --git a/tests/codegen/macos/i686-no-macosx-deployment-target.rs b/tests/codegen/macos/i686-no-macosx-deployment-target.rs index 479fe7968f78..a49a3467e7a0 100644 --- a/tests/codegen/macos/i686-no-macosx-deployment-target.rs +++ b/tests/codegen/macos/i686-no-macosx-deployment-target.rs @@ -2,9 +2,9 @@ // Checks that we leave the target alone MACOSX_DEPLOYMENT_TARGET is unset. // See issue #60235. -// compile-flags: -O --target=i686-apple-darwin --crate-type=rlib -// needs-llvm-components: x86 -// unset-rustc-env:MACOSX_DEPLOYMENT_TARGET +//@ compile-flags: -O --target=i686-apple-darwin --crate-type=rlib +//@ needs-llvm-components: x86 +//@ unset-rustc-env:MACOSX_DEPLOYMENT_TARGET #![feature(no_core, lang_items)] #![no_core] diff --git a/tests/codegen/macos/x86_64-macosx-deployment-target.rs b/tests/codegen/macos/x86_64-macosx-deployment-target.rs index 957c727bb93a..eac989c29541 100644 --- a/tests/codegen/macos/x86_64-macosx-deployment-target.rs +++ b/tests/codegen/macos/x86_64-macosx-deployment-target.rs @@ -2,9 +2,9 @@ // Checks that we correctly modify the target when MACOSX_DEPLOYMENT_TARGET is set. // See issue #60235. -// compile-flags: -O --target=x86_64-apple-darwin --crate-type=rlib -// needs-llvm-components: x86 -// rustc-env:MACOSX_DEPLOYMENT_TARGET=10.14 +//@ compile-flags: -O --target=x86_64-apple-darwin --crate-type=rlib +//@ needs-llvm-components: x86 +//@ rustc-env:MACOSX_DEPLOYMENT_TARGET=10.14 #![feature(no_core, lang_items)] #![no_core] diff --git a/tests/codegen/macos/x86_64-no-macosx-deployment-target.rs b/tests/codegen/macos/x86_64-no-macosx-deployment-target.rs index edbc1b66c713..ed294cf4e3dc 100644 --- a/tests/codegen/macos/x86_64-no-macosx-deployment-target.rs +++ b/tests/codegen/macos/x86_64-no-macosx-deployment-target.rs @@ -2,9 +2,9 @@ // Checks that we leave the target alone when MACOSX_DEPLOYMENT_TARGET is unset. // See issue #60235. -// compile-flags: -O --target=x86_64-apple-darwin --crate-type=rlib -// needs-llvm-components: x86 -// unset-rustc-env:MACOSX_DEPLOYMENT_TARGET +//@ compile-flags: -O --target=x86_64-apple-darwin --crate-type=rlib +//@ needs-llvm-components: x86 +//@ unset-rustc-env:MACOSX_DEPLOYMENT_TARGET #![feature(no_core, lang_items)] #![no_core] diff --git a/tests/codegen/mainsubprogram.rs b/tests/codegen/mainsubprogram.rs index 790db33437b0..8e173df0e86a 100644 --- a/tests/codegen/mainsubprogram.rs +++ b/tests/codegen/mainsubprogram.rs @@ -1,10 +1,10 @@ // This test depends on a patch that was committed to upstream LLVM // before 4.0, formerly backported to the Rust LLVM fork. -// ignore-windows -// ignore-macos +//@ ignore-windows +//@ ignore-macos -// compile-flags: -g -C no-prepopulate-passes +//@ compile-flags: -g -C no-prepopulate-passes // CHECK-LABEL: @main // CHECK: {{.*}}DISubprogram{{.*}}name: "main",{{.*}}DI{{(SP)?}}FlagMainSubprogram{{.*}} diff --git a/tests/codegen/mainsubprogramstart.rs b/tests/codegen/mainsubprogramstart.rs index d4de9f59ac27..db2c1466bf5f 100644 --- a/tests/codegen/mainsubprogramstart.rs +++ b/tests/codegen/mainsubprogramstart.rs @@ -1,7 +1,7 @@ -// ignore-windows -// ignore-macos +//@ ignore-windows +//@ ignore-macos -// compile-flags: -g -C no-prepopulate-passes +//@ compile-flags: -g -C no-prepopulate-passes #![feature(start)] diff --git a/tests/codegen/match-optimized.rs b/tests/codegen/match-optimized.rs index e32a5e545042..09907edf8f29 100644 --- a/tests/codegen/match-optimized.rs +++ b/tests/codegen/match-optimized.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes -O +//@ compile-flags: -C no-prepopulate-passes -O #![crate_type = "lib"] diff --git a/tests/codegen/match-optimizes-away.rs b/tests/codegen/match-optimizes-away.rs index 400606b42d55..55ece89cec21 100644 --- a/tests/codegen/match-optimizes-away.rs +++ b/tests/codegen/match-optimizes-away.rs @@ -1,5 +1,5 @@ // -// compile-flags: -O +//@ compile-flags: -O #![crate_type="lib"] pub enum Three { A, B, C } diff --git a/tests/codegen/match-unoptimized.rs b/tests/codegen/match-unoptimized.rs index 78ea4f9b4094..3dfe78c3e16a 100644 --- a/tests/codegen/match-unoptimized.rs +++ b/tests/codegen/match-unoptimized.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes -Copt-level=0 +//@ compile-flags: -C no-prepopulate-passes -Copt-level=0 #![crate_type = "lib"] diff --git a/tests/codegen/maybeuninit-rvo.rs b/tests/codegen/maybeuninit-rvo.rs index feed513e1fbf..954514c736bd 100644 --- a/tests/codegen/maybeuninit-rvo.rs +++ b/tests/codegen/maybeuninit-rvo.rs @@ -1,4 +1,4 @@ -// compile-flags: -O +//@ compile-flags: -O #![feature(c_unwind)] #![crate_type = "lib"] diff --git a/tests/codegen/mem-replace-big-type.rs b/tests/codegen/mem-replace-big-type.rs index fc3e9d22bdf3..c71cbbd08f9a 100644 --- a/tests/codegen/mem-replace-big-type.rs +++ b/tests/codegen/mem-replace-big-type.rs @@ -3,8 +3,8 @@ // may e.g. multiply `size_of::()` with a variable "count" (which is only // known to be `1` after inlining). -// compile-flags: -C no-prepopulate-passes -Zinline-mir=no -// ignore-debug: the debug assertions get in the way +//@ compile-flags: -C no-prepopulate-passes -Zinline-mir=no +//@ ignore-debug: precondition checks in ptr::read make them a bad candidate for MIR inlining #![crate_type = "lib"] diff --git a/tests/codegen/mem-replace-simple-type.rs b/tests/codegen/mem-replace-simple-type.rs index be3af989ef01..b00fbad05d9c 100644 --- a/tests/codegen/mem-replace-simple-type.rs +++ b/tests/codegen/mem-replace-simple-type.rs @@ -1,6 +1,6 @@ -// compile-flags: -O -C no-prepopulate-passes -// only-x86_64 (to not worry about usize differing) -// ignore-debug (the debug assertions get in the way) +//@ compile-flags: -O -C no-prepopulate-passes +//@ only-x86_64 (to not worry about usize differing) +//@ ignore-debug: precondition checks make mem::replace not a candidate for MIR inlining #![crate_type = "lib"] diff --git a/tests/codegen/merge-functions.rs b/tests/codegen/merge-functions.rs index d6caeeee8966..8e4b65c9ee65 100644 --- a/tests/codegen/merge-functions.rs +++ b/tests/codegen/merge-functions.rs @@ -1,6 +1,6 @@ -// revisions: O Os -//[Os] compile-flags: -Copt-level=s -//[O] compile-flags: -O +//@ revisions: O Os +//@[Os] compile-flags: -Copt-level=s +//@[O] compile-flags: -O #![crate_type = "lib"] // CHECK: @func{{2|1}} = {{.*}}alias{{.*}}@func{{1|2}} diff --git a/tests/codegen/method-declaration.rs b/tests/codegen/method-declaration.rs index 4ae332b0107b..de2f96a51515 100644 --- a/tests/codegen/method-declaration.rs +++ b/tests/codegen/method-declaration.rs @@ -1,4 +1,4 @@ -// compile-flags: -g -Cno-prepopulate-passes +//@ compile-flags: -g -Cno-prepopulate-passes // Verify that we added a declaration for a method. diff --git a/tests/codegen/mir-inlined-line-numbers.rs b/tests/codegen/mir-inlined-line-numbers.rs index d13527b95213..57978bc70976 100644 --- a/tests/codegen/mir-inlined-line-numbers.rs +++ b/tests/codegen/mir-inlined-line-numbers.rs @@ -1,4 +1,4 @@ -// compile-flags: -O -g +//@ compile-flags: -O -g #![crate_type = "lib"] diff --git a/tests/codegen/mir_zst_stores.rs b/tests/codegen/mir_zst_stores.rs index 17e7ba3093bf..667273c2f0f7 100644 --- a/tests/codegen/mir_zst_stores.rs +++ b/tests/codegen/mir_zst_stores.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes +//@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] use std::marker::PhantomData; diff --git a/tests/codegen/move-before-nocapture-ref-arg.rs b/tests/codegen/move-before-nocapture-ref-arg.rs index c7b400c8f8d0..a530bc266729 100644 --- a/tests/codegen/move-before-nocapture-ref-arg.rs +++ b/tests/codegen/move-before-nocapture-ref-arg.rs @@ -1,7 +1,7 @@ // Verify that move before the call of the function with noalias, nocapture, readonly. // #107436 -// compile-flags: -O -// min-llvm-version: 17 +//@ compile-flags: -O +//@ min-llvm-version: 17 #![crate_type = "lib"] diff --git a/tests/codegen/move-operands.rs b/tests/codegen/move-operands.rs index cd87e6d813ca..4f22921b4a3d 100644 --- a/tests/codegen/move-operands.rs +++ b/tests/codegen/move-operands.rs @@ -1,5 +1,5 @@ // Verify that optimized MIR only copies `a` once. -// compile-flags: -O -C no-prepopulate-passes +//@ compile-flags: -O -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/tests/codegen/naked-fn/naked-functions.rs b/tests/codegen/naked-fn/naked-functions.rs index e05bbc26e830..755dd1551126 100644 --- a/tests/codegen/naked-fn/naked-functions.rs +++ b/tests/codegen/naked-fn/naked-functions.rs @@ -1,6 +1,6 @@ -// compile-flags: -C no-prepopulate-passes -Copt-level=0 -// needs-asm-support -// only-x86_64 +//@ compile-flags: -C no-prepopulate-passes -Copt-level=0 +//@ needs-asm-support +//@ only-x86_64 #![crate_type = "lib"] #![feature(naked_functions)] diff --git a/tests/codegen/naked-fn/naked-nocoverage.rs b/tests/codegen/naked-fn/naked-nocoverage.rs index 3c755e49c6db..e8d3b5834fa3 100644 --- a/tests/codegen/naked-fn/naked-nocoverage.rs +++ b/tests/codegen/naked-fn/naked-nocoverage.rs @@ -1,9 +1,9 @@ // Checks that naked functions are not instrumented by -Cinstrument-coverage. // Regression test for issue #105170. // -// needs-asm-support -// needs-profiler-support -// compile-flags: -Cinstrument-coverage +//@ needs-asm-support +//@ needs-profiler-support +//@ compile-flags: -Cinstrument-coverage #![crate_type = "lib"] #![feature(naked_functions)] use std::arch::asm; diff --git a/tests/codegen/naked-fn/naked-noinline.rs b/tests/codegen/naked-fn/naked-noinline.rs index 5cfb500c0ef8..c1e8f368249f 100644 --- a/tests/codegen/naked-fn/naked-noinline.rs +++ b/tests/codegen/naked-fn/naked-noinline.rs @@ -1,7 +1,7 @@ // Checks that naked functions are never inlined. -// compile-flags: -O -Zmir-opt-level=3 -// needs-asm-support -// ignore-wasm32 +//@ compile-flags: -O -Zmir-opt-level=3 +//@ needs-asm-support +//@ ignore-wasm32 #![crate_type = "lib"] #![feature(naked_functions)] diff --git a/tests/codegen/no-assumes-on-casts.rs b/tests/codegen/no-assumes-on-casts.rs index b5cfa2775abb..b9c264daa2d1 100644 --- a/tests/codegen/no-assumes-on-casts.rs +++ b/tests/codegen/no-assumes-on-casts.rs @@ -1,6 +1,6 @@ #![crate_type = "lib"] -// compile-flags: -Cno-prepopulate-passes +//@ compile-flags: -Cno-prepopulate-passes // CHECK-LABEL: fna #[no_mangle] diff --git a/tests/codegen/no-dllimport-w-cross-lang-lto.rs b/tests/codegen/no-dllimport-w-cross-lang-lto.rs index 33fc2bc1540d..c71eddfa287d 100644 --- a/tests/codegen/no-dllimport-w-cross-lang-lto.rs +++ b/tests/codegen/no-dllimport-w-cross-lang-lto.rs @@ -1,9 +1,9 @@ // This test makes sure that functions get annotated with the proper // "target-cpu" attribute in LLVM. -// no-prefer-dynamic -// only-msvc -// compile-flags: -C linker-plugin-lto +//@ no-prefer-dynamic +//@ only-msvc +//@ compile-flags: -C linker-plugin-lto #![crate_type = "rlib"] diff --git a/tests/codegen/no-jump-tables.rs b/tests/codegen/no-jump-tables.rs index 8e2cb47566ea..654da2cec11c 100644 --- a/tests/codegen/no-jump-tables.rs +++ b/tests/codegen/no-jump-tables.rs @@ -1,10 +1,10 @@ // Test that the `no-jump-tables` function attribute are (not) emitted when // the `-Zno-jump-tables` flag is (not) set. -// revisions: unset set -// needs-llvm-components: x86 -// compile-flags: --target x86_64-unknown-linux-gnu -// [set] compile-flags: -Zno-jump-tables +//@ revisions: unset set +//@ needs-llvm-components: x86 +//@ compile-flags: --target x86_64-unknown-linux-gnu +//@ [set] compile-flags: -Zno-jump-tables #![crate_type = "lib"] #![feature(no_core, lang_items)] diff --git a/tests/codegen/no-plt.rs b/tests/codegen/no-plt.rs index b36e9ae88f45..3a3546ff7c40 100644 --- a/tests/codegen/no-plt.rs +++ b/tests/codegen/no-plt.rs @@ -1,4 +1,4 @@ -// compile-flags: -C relocation-model=pic -Z plt=no +//@ compile-flags: -C relocation-model=pic -Z plt=no #![crate_type = "lib"] diff --git a/tests/codegen/no_builtins-at-crate.rs b/tests/codegen/no_builtins-at-crate.rs index 02ed670900ed..ba1d31f60c39 100644 --- a/tests/codegen/no_builtins-at-crate.rs +++ b/tests/codegen/no_builtins-at-crate.rs @@ -1,4 +1,4 @@ -// compile-flags: -C opt-level=1 +//@ compile-flags: -C opt-level=1 #![no_builtins] #![crate_type = "lib"] diff --git a/tests/codegen/noalias-box-off.rs b/tests/codegen/noalias-box-off.rs index c82c53b2a489..1642103903a0 100644 --- a/tests/codegen/noalias-box-off.rs +++ b/tests/codegen/noalias-box-off.rs @@ -1,4 +1,4 @@ -// compile-flags: -O -Z box-noalias=no +//@ compile-flags: -O -Z box-noalias=no #![crate_type = "lib"] diff --git a/tests/codegen/noalias-box.rs b/tests/codegen/noalias-box.rs index a3d1f093d8bd..06f94691c895 100644 --- a/tests/codegen/noalias-box.rs +++ b/tests/codegen/noalias-box.rs @@ -1,4 +1,4 @@ -// compile-flags: -O +//@ compile-flags: -O #![crate_type = "lib"] diff --git a/tests/codegen/noalias-flag.rs b/tests/codegen/noalias-flag.rs index a9ec61e286d0..35b94d813d5f 100644 --- a/tests/codegen/noalias-flag.rs +++ b/tests/codegen/noalias-flag.rs @@ -1,4 +1,4 @@ -// compile-flags: -O -Zmutable-noalias=no +//@ compile-flags: -O -Zmutable-noalias=no #![crate_type = "lib"] diff --git a/tests/codegen/noalias-refcell.rs b/tests/codegen/noalias-refcell.rs index dba73937abf1..51d13967bece 100644 --- a/tests/codegen/noalias-refcell.rs +++ b/tests/codegen/noalias-refcell.rs @@ -1,4 +1,4 @@ -// compile-flags: -O -C no-prepopulate-passes -Z mutable-noalias=yes +//@ compile-flags: -O -C no-prepopulate-passes -Z mutable-noalias=yes #![crate_type = "lib"] diff --git a/tests/codegen/noalias-rwlockreadguard.rs b/tests/codegen/noalias-rwlockreadguard.rs index 7f7b46c85a8b..7b870cb28b4f 100644 --- a/tests/codegen/noalias-rwlockreadguard.rs +++ b/tests/codegen/noalias-rwlockreadguard.rs @@ -1,4 +1,4 @@ -// compile-flags: -O -C no-prepopulate-passes -Z mutable-noalias=yes +//@ compile-flags: -O -C no-prepopulate-passes -Z mutable-noalias=yes #![crate_type = "lib"] diff --git a/tests/codegen/noalias-unpin.rs b/tests/codegen/noalias-unpin.rs index 8ca9b98eee2f..546b1edb7b61 100644 --- a/tests/codegen/noalias-unpin.rs +++ b/tests/codegen/noalias-unpin.rs @@ -1,4 +1,4 @@ -// compile-flags: -O -Z mutable-noalias=yes +//@ compile-flags: -O -Z mutable-noalias=yes #![crate_type = "lib"] diff --git a/tests/codegen/non-terminate/infinite-loop-1.rs b/tests/codegen/non-terminate/infinite-loop-1.rs index fa9c66b47c0a..9eab4939aee9 100644 --- a/tests/codegen/non-terminate/infinite-loop-1.rs +++ b/tests/codegen/non-terminate/infinite-loop-1.rs @@ -1,4 +1,4 @@ -// compile-flags: -C opt-level=3 +//@ compile-flags: -C opt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/non-terminate/infinite-loop-2.rs b/tests/codegen/non-terminate/infinite-loop-2.rs index 81d62ab33d77..da29361cc967 100644 --- a/tests/codegen/non-terminate/infinite-loop-2.rs +++ b/tests/codegen/non-terminate/infinite-loop-2.rs @@ -1,4 +1,4 @@ -// compile-flags: -C opt-level=3 +//@ compile-flags: -C opt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/non-terminate/infinite-recursion.rs b/tests/codegen/non-terminate/infinite-recursion.rs index 6d1f2d4bf8f4..804704c0292e 100644 --- a/tests/codegen/non-terminate/infinite-recursion.rs +++ b/tests/codegen/non-terminate/infinite-recursion.rs @@ -1,4 +1,4 @@ -// compile-flags: -C opt-level=3 +//@ compile-flags: -C opt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/non-terminate/nonempty-infinite-loop.rs b/tests/codegen/non-terminate/nonempty-infinite-loop.rs index 5e25e04fc24a..0db4ee61b1bc 100644 --- a/tests/codegen/non-terminate/nonempty-infinite-loop.rs +++ b/tests/codegen/non-terminate/nonempty-infinite-loop.rs @@ -1,4 +1,4 @@ -// compile-flags: -C opt-level=3 +//@ compile-flags: -C opt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/noreturn-uninhabited.rs b/tests/codegen/noreturn-uninhabited.rs index 49f93cf62c75..a10795d3f3c0 100644 --- a/tests/codegen/noreturn-uninhabited.rs +++ b/tests/codegen/noreturn-uninhabited.rs @@ -1,4 +1,4 @@ -// compile-flags: -g -C no-prepopulate-passes +//@ compile-flags: -g -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/tests/codegen/noreturnflag.rs b/tests/codegen/noreturnflag.rs index 95c100571ce6..a8f08628986a 100644 --- a/tests/codegen/noreturnflag.rs +++ b/tests/codegen/noreturnflag.rs @@ -1,4 +1,4 @@ -// compile-flags: -g -C no-prepopulate-passes +//@ compile-flags: -g -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/tests/codegen/nounwind.rs b/tests/codegen/nounwind.rs index f639c60b8935..2b237ef01208 100644 --- a/tests/codegen/nounwind.rs +++ b/tests/codegen/nounwind.rs @@ -1,7 +1,7 @@ -// aux-build:nounwind.rs -// compile-flags: -C no-prepopulate-passes -C panic=abort -C metadata=a -// ignore-windows -// ignore-android +//@ aux-build:nounwind.rs +//@ compile-flags: -C no-prepopulate-passes -C panic=abort -C metadata=a +//@ ignore-windows +//@ ignore-android #![crate_type = "lib"] diff --git a/tests/codegen/nrvo.rs b/tests/codegen/nrvo.rs index b2ae99f3761b..aa8bed941f54 100644 --- a/tests/codegen/nrvo.rs +++ b/tests/codegen/nrvo.rs @@ -1,4 +1,4 @@ -// compile-flags: -O +//@ compile-flags: -O #![crate_type = "lib"] diff --git a/tests/codegen/optimize-attr-1.rs b/tests/codegen/optimize-attr-1.rs index d95ba853030f..c8e68779aae6 100644 --- a/tests/codegen/optimize-attr-1.rs +++ b/tests/codegen/optimize-attr-1.rs @@ -1,7 +1,7 @@ -// revisions: NO-OPT SIZE-OPT SPEED-OPT -//[NO-OPT] compile-flags: -Copt-level=0 -Ccodegen-units=1 -//[SIZE-OPT] compile-flags: -Copt-level=s -Ccodegen-units=1 -//[SPEED-OPT] compile-flags: -Copt-level=3 -Ccodegen-units=1 +//@ revisions: NO-OPT SIZE-OPT SPEED-OPT +//@[NO-OPT] compile-flags: -Copt-level=0 -Ccodegen-units=1 +//@[SIZE-OPT] compile-flags: -Copt-level=s -Ccodegen-units=1 +//@[SPEED-OPT] compile-flags: -Copt-level=3 -Ccodegen-units=1 #![feature(optimize_attribute)] #![crate_type="rlib"] diff --git a/tests/codegen/option-as-slice.rs b/tests/codegen/option-as-slice.rs index 1edd9ba9f7da..990ec1d1f66b 100644 --- a/tests/codegen/option-as-slice.rs +++ b/tests/codegen/option-as-slice.rs @@ -1,6 +1,6 @@ -// compile-flags: -O -Z randomize-layout=no -// only-x86_64 -// ignore-llvm-version: 16.0.0 +//@ compile-flags: -O -Z randomize-layout=no +//@ only-x86_64 +//@ ignore-llvm-version: 16.0.0 // ^ needs https://reviews.llvm.org/D146149 in 16.0.1 #![crate_type = "lib"] diff --git a/tests/codegen/option-nonzero-eq.rs b/tests/codegen/option-nonzero-eq.rs index ce5b6328af6c..f6be90a5ddeb 100644 --- a/tests/codegen/option-nonzero-eq.rs +++ b/tests/codegen/option-nonzero-eq.rs @@ -1,4 +1,4 @@ -// compile-flags: -O -Zmerge-functions=disabled +//@ compile-flags: -O -Zmerge-functions=disabled #![crate_type = "lib"] diff --git a/tests/codegen/overaligned-constant.rs b/tests/codegen/overaligned-constant.rs index 89e497389911..351c8ea8f4b2 100644 --- a/tests/codegen/overaligned-constant.rs +++ b/tests/codegen/overaligned-constant.rs @@ -1,9 +1,9 @@ // GVN may create indirect constants with higher alignment than their type requires. Verify that we // do not ICE during codegen, and that the LLVM constant has the higher alignment. // -// compile-flags: -Zmir-opt-level=0 -Zmir-enable-passes=+GVN -// compile-flags: -Cno-prepopulate-passes -// only-64bit +//@ compile-flags: -Zmir-opt-level=0 -Zmir-enable-passes=+GVN +//@ compile-flags: -Cno-prepopulate-passes +//@ only-64bit struct S(i32); diff --git a/tests/codegen/packed.rs b/tests/codegen/packed.rs index 96cd9a42e7dd..764476b0aa13 100644 --- a/tests/codegen/packed.rs +++ b/tests/codegen/packed.rs @@ -1,5 +1,5 @@ // -// compile-flags: -O -C no-prepopulate-passes +//@ compile-flags: -O -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/tests/codegen/panic-abort-windows.rs b/tests/codegen/panic-abort-windows.rs index 2ee29762dcdf..71caa1b3d2af 100644 --- a/tests/codegen/panic-abort-windows.rs +++ b/tests/codegen/panic-abort-windows.rs @@ -1,7 +1,7 @@ // This test is for *-windows only. -// only-windows +//@ only-windows -// compile-flags: -C no-prepopulate-passes -C panic=abort -O +//@ compile-flags: -C no-prepopulate-passes -C panic=abort -O #![crate_type = "lib"] diff --git a/tests/codegen/panic-in-drop-abort.rs b/tests/codegen/panic-in-drop-abort.rs index 7a84484c4199..b150c537ad55 100644 --- a/tests/codegen/panic-in-drop-abort.rs +++ b/tests/codegen/panic-in-drop-abort.rs @@ -1,5 +1,5 @@ -// compile-flags: -Z panic-in-drop=abort -O -// ignore-msvc +//@ compile-flags: -Z panic-in-drop=abort -O +//@ ignore-msvc // Ensure that unwinding code paths are eliminated from the output after // optimization. diff --git a/tests/codegen/panic-unwind-default-uwtable.rs b/tests/codegen/panic-unwind-default-uwtable.rs index b78b159d20d5..06f616c519b2 100644 --- a/tests/codegen/panic-unwind-default-uwtable.rs +++ b/tests/codegen/panic-unwind-default-uwtable.rs @@ -1,4 +1,4 @@ -// compile-flags: -C panic=unwind -C no-prepopulate-passes -Copt-level=0 +//@ compile-flags: -C panic=unwind -C no-prepopulate-passes -Copt-level=0 #![crate_type = "lib"] diff --git a/tests/codegen/personality_lifetimes.rs b/tests/codegen/personality_lifetimes.rs index e2bc0ebcb373..06389688e0e2 100644 --- a/tests/codegen/personality_lifetimes.rs +++ b/tests/codegen/personality_lifetimes.rs @@ -1,8 +1,8 @@ -// ignore-msvc -// ignore-wasm32-bare compiled with panic=abort by default -// needs-unwind +//@ ignore-msvc +//@ ignore-wasm32-bare compiled with panic=abort by default +//@ needs-unwind -// compile-flags: -O -C no-prepopulate-passes +//@ compile-flags: -O -C no-prepopulate-passes #![crate_type="lib"] diff --git a/tests/codegen/pgo-counter-bias.rs b/tests/codegen/pgo-counter-bias.rs index 28caa7f4aa35..1263eaf206f7 100644 --- a/tests/codegen/pgo-counter-bias.rs +++ b/tests/codegen/pgo-counter-bias.rs @@ -1,9 +1,9 @@ // Test that __llvm_profile_counter_bias does not get internalized by lto. -// ignore-macos -runtime-counter-relocation not honored on Mach-O -// compile-flags: -Cprofile-generate -Cllvm-args=-runtime-counter-relocation -Clto=fat -// needs-profiler-support -// no-prefer-dynamic +//@ ignore-macos -runtime-counter-relocation not honored on Mach-O +//@ compile-flags: -Cprofile-generate -Cllvm-args=-runtime-counter-relocation -Clto=fat +//@ needs-profiler-support +//@ no-prefer-dynamic // CHECK: @__llvm_profile_counter_bias = {{.*}}global diff --git a/tests/codegen/pgo-instrumentation.rs b/tests/codegen/pgo-instrumentation.rs index 05c2d2fc0d8c..e2c348edf822 100644 --- a/tests/codegen/pgo-instrumentation.rs +++ b/tests/codegen/pgo-instrumentation.rs @@ -1,7 +1,7 @@ // Test that `-Cprofile-generate` creates expected instrumentation artifacts in LLVM IR. -// needs-profiler-support -// compile-flags: -Cprofile-generate -Ccodegen-units=1 +//@ needs-profiler-support +//@ compile-flags: -Cprofile-generate -Ccodegen-units=1 // CHECK: @__llvm_profile_raw_version = // CHECK-DAG: @__profc_{{.*}}pgo_instrumentation{{.*}}some_function{{.*}} = {{.*}}global diff --git a/tests/codegen/pic-relocation-model.rs b/tests/codegen/pic-relocation-model.rs index 518e949ffe34..10ade847133a 100644 --- a/tests/codegen/pic-relocation-model.rs +++ b/tests/codegen/pic-relocation-model.rs @@ -1,4 +1,4 @@ -// compile-flags: -C relocation-model=pic -Copt-level=0 +//@ compile-flags: -C relocation-model=pic -Copt-level=0 #![crate_type = "rlib"] diff --git a/tests/codegen/pie-relocation-model.rs b/tests/codegen/pie-relocation-model.rs index 941cca922bd3..20bf8919ac10 100644 --- a/tests/codegen/pie-relocation-model.rs +++ b/tests/codegen/pie-relocation-model.rs @@ -1,5 +1,5 @@ -// compile-flags: -C relocation-model=pie -Copt-level=0 -// only-x86_64-unknown-linux-gnu +//@ compile-flags: -C relocation-model=pie -Copt-level=0 +//@ only-x86_64-unknown-linux-gnu #![crate_type = "rlib"] diff --git a/tests/codegen/ptr-arithmetic.rs b/tests/codegen/ptr-arithmetic.rs index 292bfdaf3571..6f115d33d8dd 100644 --- a/tests/codegen/ptr-arithmetic.rs +++ b/tests/codegen/ptr-arithmetic.rs @@ -1,5 +1,4 @@ -// compile-flags: -O -Z merge-functions=disabled -// ignore-debug (the extra assertions get in the way) +//@ compile-flags: -O -Z merge-functions=disabled #![crate_type = "lib"] diff --git a/tests/codegen/ptr-read-metadata.rs b/tests/codegen/ptr-read-metadata.rs index 94152ed11ba1..4c623dee5e1e 100644 --- a/tests/codegen/ptr-read-metadata.rs +++ b/tests/codegen/ptr-read-metadata.rs @@ -1,5 +1,4 @@ -// compile-flags: -O -Z merge-functions=disabled -// ignore-debug (the extra assertions get in the way) +//@ compile-flags: -O -Z merge-functions=disabled #![crate_type = "lib"] diff --git a/tests/codegen/refs.rs b/tests/codegen/refs.rs index 9e1205f5d1d5..40ce04c07a11 100644 --- a/tests/codegen/refs.rs +++ b/tests/codegen/refs.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes -Zmir-opt-level=0 -Copt-level=0 +//@ compile-flags: -C no-prepopulate-passes -Zmir-opt-level=0 -Copt-level=0 #![crate_type = "lib"] diff --git a/tests/codegen/remap_path_prefix/aux_mod.rs b/tests/codegen/remap_path_prefix/aux_mod.rs index 44cc4bb722d1..c37e91c705cc 100644 --- a/tests/codegen/remap_path_prefix/aux_mod.rs +++ b/tests/codegen/remap_path_prefix/aux_mod.rs @@ -1,4 +1,4 @@ -// ignore-test: this is not a test +//@ ignore-test: this is not a test #[inline] pub fn some_aux_mod_function() -> i32 { diff --git a/tests/codegen/remap_path_prefix/auxiliary/remap_path_prefix_aux.rs b/tests/codegen/remap_path_prefix/auxiliary/remap_path_prefix_aux.rs index 887915955b59..7afc16ec72f3 100644 --- a/tests/codegen/remap_path_prefix/auxiliary/remap_path_prefix_aux.rs +++ b/tests/codegen/remap_path_prefix/auxiliary/remap_path_prefix_aux.rs @@ -1,6 +1,6 @@ // -// compile-flags: -g --remap-path-prefix={{cwd}}=/the/aux-cwd --remap-path-prefix={{src-base}}/remap_path_prefix/auxiliary=/the/aux-src +//@ compile-flags: -g --remap-path-prefix={{cwd}}=/the/aux-cwd --remap-path-prefix={{src-base}}/remap_path_prefix/auxiliary=/the/aux-src #[inline] pub fn some_aux_function() -> i32 { diff --git a/tests/codegen/remap_path_prefix/auxiliary/xcrate-generic.rs b/tests/codegen/remap_path_prefix/auxiliary/xcrate-generic.rs index 15bd0f174218..9d5cdfe063b6 100644 --- a/tests/codegen/remap_path_prefix/auxiliary/xcrate-generic.rs +++ b/tests/codegen/remap_path_prefix/auxiliary/xcrate-generic.rs @@ -1,5 +1,5 @@ // -// compile-flags: -g --remap-path-prefix={{cwd}}=/the/aux-cwd --remap-path-prefix={{src-base}}/remap_path_prefix/auxiliary=/the/aux-src +//@ compile-flags: -g --remap-path-prefix={{cwd}}=/the/aux-cwd --remap-path-prefix={{src-base}}/remap_path_prefix/auxiliary=/the/aux-src #![crate_type = "lib"] diff --git a/tests/codegen/remap_path_prefix/issue-73167-remap-std.rs b/tests/codegen/remap_path_prefix/issue-73167-remap-std.rs index b66abc6bedf0..eb610168dd3b 100644 --- a/tests/codegen/remap_path_prefix/issue-73167-remap-std.rs +++ b/tests/codegen/remap_path_prefix/issue-73167-remap-std.rs @@ -1,6 +1,6 @@ -// ignore-windows +//@ ignore-windows -// compile-flags: -g -C no-prepopulate-passes -Z simulate-remapped-rust-src-base=/rustc/xyz +//@ compile-flags: -g -C no-prepopulate-passes -Z simulate-remapped-rust-src-base=/rustc/xyz // Here we check that importing std will not cause real path to std source files // to leak. If rustc was compiled with remap-debuginfo = true, this should be diff --git a/tests/codegen/remap_path_prefix/main.rs b/tests/codegen/remap_path_prefix/main.rs index f1e1dd69b969..bfbccfe0df80 100644 --- a/tests/codegen/remap_path_prefix/main.rs +++ b/tests/codegen/remap_path_prefix/main.rs @@ -1,8 +1,8 @@ -// ignore-windows +//@ ignore-windows // -// compile-flags: -g -C no-prepopulate-passes --remap-path-prefix={{cwd}}=/the/cwd --remap-path-prefix={{src-base}}=/the/src -Zinline-mir=no -// aux-build:remap_path_prefix_aux.rs +//@ compile-flags: -g -C no-prepopulate-passes --remap-path-prefix={{cwd}}=/the/cwd --remap-path-prefix={{src-base}}=/the/src -Zinline-mir=no +//@ aux-build:remap_path_prefix_aux.rs extern crate remap_path_prefix_aux; diff --git a/tests/codegen/remap_path_prefix/xcrate-generic.rs b/tests/codegen/remap_path_prefix/xcrate-generic.rs index 399deec1fc93..db69b72d9049 100644 --- a/tests/codegen/remap_path_prefix/xcrate-generic.rs +++ b/tests/codegen/remap_path_prefix/xcrate-generic.rs @@ -1,6 +1,6 @@ -// ignore-windows -// compile-flags: -g -C metadata=foo -C no-prepopulate-passes -// aux-build:xcrate-generic.rs +//@ ignore-windows +//@ compile-flags: -g -C metadata=foo -C no-prepopulate-passes +//@ aux-build:xcrate-generic.rs #![crate_type = "lib"] diff --git a/tests/codegen/repeat-trusted-len.rs b/tests/codegen/repeat-trusted-len.rs index bd6ff977e1fe..fa01f2b4969d 100644 --- a/tests/codegen/repeat-trusted-len.rs +++ b/tests/codegen/repeat-trusted-len.rs @@ -1,4 +1,4 @@ -// compile-flags: -O +//@ compile-flags: -O // #![crate_type = "lib"] diff --git a/tests/codegen/repr/transparent-imm-array.rs b/tests/codegen/repr/transparent-imm-array.rs index 6d7127785095..842e36ca13da 100644 --- a/tests/codegen/repr/transparent-imm-array.rs +++ b/tests/codegen/repr/transparent-imm-array.rs @@ -1,11 +1,11 @@ -// revisions: arm mips thumb wasm32 -// compile-flags: -C no-prepopulate-passes +//@ revisions: arm mips thumb wasm32 +//@ compile-flags: -C no-prepopulate-passes // -//[arm] only-arm -//[mips] only-mips -//[thumb] only-thumb -//[wasm32] only-wasm32 -// ignore-emscripten +//@[arm] only-arm +//@[mips] only-mips +//@[thumb] only-thumb +//@[wasm32] only-wasm32 +//@ ignore-emscripten // See ./transparent.rs // Some platforms pass large aggregates using immediate arrays in LLVMIR // Other platforms pass large aggregates using struct pointer in LLVMIR diff --git a/tests/codegen/repr/transparent-mips64.rs b/tests/codegen/repr/transparent-mips64.rs index 245daf13e28f..55090e6bd808 100644 --- a/tests/codegen/repr/transparent-mips64.rs +++ b/tests/codegen/repr/transparent-mips64.rs @@ -1,7 +1,7 @@ -// compile-flags: -C no-prepopulate-passes +//@ compile-flags: -C no-prepopulate-passes // -// only-mips64 +//@ only-mips64 // See ./transparent.rs #![feature(transparent_unions)] diff --git a/tests/codegen/repr/transparent-struct-ptr.rs b/tests/codegen/repr/transparent-struct-ptr.rs index d2120f7ec143..ff531029e046 100644 --- a/tests/codegen/repr/transparent-struct-ptr.rs +++ b/tests/codegen/repr/transparent-struct-ptr.rs @@ -1,11 +1,11 @@ -// revisions: x32 x64 sparc sparc64 -// compile-flags: -O -C no-prepopulate-passes +//@ revisions: x32 x64 sparc sparc64 +//@ compile-flags: -O -C no-prepopulate-passes // -//[x32] only-x86 -//[x64] only-x86_64 -//[sparc] only-sparc -//[sparc64] only-sparc64 -// ignore-windows +//@[x32] only-x86 +//@[x64] only-x86_64 +//@[sparc] only-sparc +//@[sparc64] only-sparc64 +//@ ignore-windows // See ./transparent.rs // Some platforms pass large aggregates using immediate arrays in LLVMIR // Other platforms pass large aggregates using struct pointer in LLVMIR diff --git a/tests/codegen/repr/transparent-sysv64.rs b/tests/codegen/repr/transparent-sysv64.rs index 886b0dd9e7b0..10524adf7d7a 100644 --- a/tests/codegen/repr/transparent-sysv64.rs +++ b/tests/codegen/repr/transparent-sysv64.rs @@ -1,6 +1,6 @@ -// only-x86_64 +//@ only-x86_64 -// compile-flags: -C no-prepopulate-passes +//@ compile-flags: -C no-prepopulate-passes #![crate_type="lib"] diff --git a/tests/codegen/repr/transparent.rs b/tests/codegen/repr/transparent.rs index c5974248bb37..17ec476035f2 100644 --- a/tests/codegen/repr/transparent.rs +++ b/tests/codegen/repr/transparent.rs @@ -1,7 +1,7 @@ -// compile-flags: -O -C no-prepopulate-passes -// ignore-riscv64 riscv64 has an i128 type used with test_Vector -// ignore-s390x s390x with default march passes vector types per reference -// ignore-loongarch64 see codegen/loongarch-abi for loongarch function call tests +//@ compile-flags: -O -C no-prepopulate-passes +//@ ignore-riscv64 riscv64 has an i128 type used with test_Vector +//@ ignore-s390x s390x with default march passes vector types per reference +//@ ignore-loongarch64 see codegen/loongarch-abi for loongarch function call tests // This codegen test embeds assumptions about how certain "C" psABIs are handled // so it doesn't apply to all architectures or even all OS diff --git a/tests/codegen/riscv-abi/call-llvm-intrinsics.rs b/tests/codegen/riscv-abi/call-llvm-intrinsics.rs index 31a88f2c0a98..c3f795e88576 100644 --- a/tests/codegen/riscv-abi/call-llvm-intrinsics.rs +++ b/tests/codegen/riscv-abi/call-llvm-intrinsics.rs @@ -1,6 +1,6 @@ -// compile-flags: -C no-prepopulate-passes +//@ compile-flags: -C no-prepopulate-passes -// only-riscv64 +//@ only-riscv64 #![feature(link_llvm_intrinsics)] #![crate_type = "lib"] diff --git a/tests/codegen/riscv-abi/riscv64-lp64-lp64f-lp64d-abi.rs b/tests/codegen/riscv-abi/riscv64-lp64-lp64f-lp64d-abi.rs index fdb9c6217de9..95c936ece730 100644 --- a/tests/codegen/riscv-abi/riscv64-lp64-lp64f-lp64d-abi.rs +++ b/tests/codegen/riscv-abi/riscv64-lp64-lp64f-lp64d-abi.rs @@ -1,5 +1,5 @@ -// compile-flags: --target riscv64gc-unknown-linux-gnu -O -C no-prepopulate-passes -// needs-llvm-components: riscv +//@ compile-flags: --target riscv64gc-unknown-linux-gnu -O -C no-prepopulate-passes +//@ needs-llvm-components: riscv #![crate_type = "lib"] #![no_core] diff --git a/tests/codegen/riscv-abi/riscv64-lp64d-abi.rs b/tests/codegen/riscv-abi/riscv64-lp64d-abi.rs index 1555acadfbcc..060d91a2696a 100644 --- a/tests/codegen/riscv-abi/riscv64-lp64d-abi.rs +++ b/tests/codegen/riscv-abi/riscv64-lp64d-abi.rs @@ -1,7 +1,7 @@ // -// compile-flags: -C no-prepopulate-passes -// only-riscv64 -// only-linux +//@ compile-flags: -C no-prepopulate-passes +//@ only-riscv64 +//@ only-linux #![crate_type = "lib"] // CHECK: define void @f_fpr_tracking(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, i8 zeroext %i) diff --git a/tests/codegen/riscv-abi/riscv64-lp64f-lp64d-abi.rs b/tests/codegen/riscv-abi/riscv64-lp64f-lp64d-abi.rs index f08fabed421d..3d0512817f7c 100644 --- a/tests/codegen/riscv-abi/riscv64-lp64f-lp64d-abi.rs +++ b/tests/codegen/riscv-abi/riscv64-lp64f-lp64d-abi.rs @@ -1,7 +1,7 @@ // -// compile-flags: -C no-prepopulate-passes -// only-riscv64 -// only-linux +//@ compile-flags: -C no-prepopulate-passes +//@ only-riscv64 +//@ only-linux #![crate_type = "lib"] // CHECK: define void @f_fpr_tracking(float %0, float %1, float %2, float %3, float %4, float %5, float %6, float %7, i8 zeroext %i) diff --git a/tests/codegen/sanitizer/address-sanitizer-globals-tracking.rs b/tests/codegen/sanitizer/address-sanitizer-globals-tracking.rs index e9dd04e1927b..8ffa235c18f1 100644 --- a/tests/codegen/sanitizer/address-sanitizer-globals-tracking.rs +++ b/tests/codegen/sanitizer/address-sanitizer-globals-tracking.rs @@ -15,13 +15,13 @@ // narrower than really needed (i.e. narrower than ELF-or-MachO), but this seems ok - having a // linux-only regression test should be sufficient here. // -// needs-sanitizer-address -// only-linux +//@ needs-sanitizer-address +//@ only-linux // -// revisions:ASAN ASAN-FAT-LTO -// compile-flags: -Zsanitizer=address -Ctarget-feature=-crt-static -//[ASAN] compile-flags: -//[ASAN-FAT-LTO] compile-flags: -Cprefer-dynamic=false -Clto=fat +//@ revisions:ASAN ASAN-FAT-LTO +//@ compile-flags: -Zsanitizer=address -Ctarget-feature=-crt-static +//@[ASAN] compile-flags: +//@[ASAN-FAT-LTO] compile-flags: -Cprefer-dynamic=false -Clto=fat #![crate_type="staticlib"] diff --git a/tests/codegen/sanitizer/cfi-add-canonical-jump-tables-flag.rs b/tests/codegen/sanitizer/cfi-add-canonical-jump-tables-flag.rs index 1ee8bdfc3ab2..f122fbdc0866 100644 --- a/tests/codegen/sanitizer/cfi-add-canonical-jump-tables-flag.rs +++ b/tests/codegen/sanitizer/cfi-add-canonical-jump-tables-flag.rs @@ -1,7 +1,7 @@ // Verifies that "CFI Canonical Jump Tables" module flag is added. // -// needs-sanitizer-cfi -// compile-flags: -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi +//@ needs-sanitizer-cfi +//@ compile-flags: -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi #![crate_type="lib"] 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 index 68c91384b826..05eea13c6ee0 100644 --- a/tests/codegen/sanitizer/cfi-add-enable-split-lto-unit-flag.rs +++ b/tests/codegen/sanitizer/cfi-add-enable-split-lto-unit-flag.rs @@ -1,7 +1,7 @@ // Verifies that "EnableSplitLTOUnit" module flag is added. // -// needs-sanitizer-cfi -// compile-flags: -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi +//@ needs-sanitizer-cfi +//@ compile-flags: -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi #![crate_type="lib"] 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 index a3cd16e3dd5a..9e0cc346afba 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 @@ -1,7 +1,7 @@ // Verifies that pointer type membership tests for indirect calls are omitted. // -// needs-sanitizer-cfi -// compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Copt-level=0 +//@ needs-sanitizer-cfi +//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Copt-level=0 #![crate_type="lib"] #![feature(no_sanitize)] diff --git a/tests/codegen/sanitizer/cfi-emit-type-checks.rs b/tests/codegen/sanitizer/cfi-emit-type-checks.rs index f0fe5de9f66c..6ec6f0e5476d 100644 --- a/tests/codegen/sanitizer/cfi-emit-type-checks.rs +++ b/tests/codegen/sanitizer/cfi-emit-type-checks.rs @@ -1,7 +1,7 @@ // Verifies that pointer type membership tests for indirect calls are emitted. // -// needs-sanitizer-cfi -// compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Copt-level=0 +//@ needs-sanitizer-cfi +//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Copt-level=0 #![crate_type="lib"] 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 index f16890afad08..f15ca30b7e36 100644 --- a/tests/codegen/sanitizer/cfi-emit-type-metadata-attr-cfi-encoding.rs +++ b/tests/codegen/sanitizer/cfi-emit-type-metadata-attr-cfi-encoding.rs @@ -1,7 +1,7 @@ // Verifies that user-defined CFI encoding for types are emitted. // -// needs-sanitizer-cfi -// compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Copt-level=0 +//@ needs-sanitizer-cfi +//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Copt-level=0 #![crate_type="lib"] #![feature(cfi_encoding, extern_types)] 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 index 4ed7c27fc4e8..5f49909712f9 100644 --- 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 @@ -1,7 +1,7 @@ // 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 +//@ needs-sanitizer-cfi +//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Copt-level=0 #![crate_type="lib"] #![allow(dead_code)] 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 index d200ed9798a6..ccd7ee93ca1f 100644 --- 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 @@ -1,7 +1,7 @@ // Verifies that generalized type metadata for functions are emitted. // -// needs-sanitizer-cfi -// compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-generalize-pointers +//@ needs-sanitizer-cfi +//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-generalize-pointers #![crate_type="lib"] 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 index cdefec17a1c7..d41300341780 100644 --- 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 @@ -1,7 +1,7 @@ // Verifies that normalized and generalized type metadata for functions are emitted. // -// needs-sanitizer-cfi -// compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-normalize-integers -Zsanitizer-cfi-generalize-pointers +//@ needs-sanitizer-cfi +//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-normalize-integers -Zsanitizer-cfi-generalize-pointers #![crate_type="lib"] 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 index f360b33ddcf3..ac18379165de 100644 --- 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 @@ -1,7 +1,7 @@ // Verifies that normalized type metadata for functions are emitted. // -// needs-sanitizer-cfi -// compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-normalize-integers +//@ needs-sanitizer-cfi +//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-normalize-integers #![crate_type="lib"] 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 index 3cb817b212d1..526ba62c264d 100644 --- a/tests/codegen/sanitizer/cfi-emit-type-metadata-itanium-cxx-abi.rs +++ b/tests/codegen/sanitizer/cfi-emit-type-metadata-itanium-cxx-abi.rs @@ -1,7 +1,7 @@ // Verifies that type metadata for functions are emitted. // -// needs-sanitizer-cfi -// compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi +//@ needs-sanitizer-cfi +//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi #![crate_type="lib"] diff --git a/tests/codegen/sanitizer/cfi-emit-type-metadata-trait-objects.rs b/tests/codegen/sanitizer/cfi-emit-type-metadata-trait-objects.rs index b69e57261a8e..318aad9291c4 100644 --- a/tests/codegen/sanitizer/cfi-emit-type-metadata-trait-objects.rs +++ b/tests/codegen/sanitizer/cfi-emit-type-metadata-trait-objects.rs @@ -1,7 +1,7 @@ // Verifies that type metadata identifiers for trait objects are emitted correctly. // -// needs-sanitizer-cfi -// compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Ctarget-feature=-crt-static -Zsanitizer=cfi +//@ needs-sanitizer-cfi +//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Ctarget-feature=-crt-static -Zsanitizer=cfi #![crate_type="lib"] diff --git a/tests/codegen/sanitizer/cfi-generalize-pointers.rs b/tests/codegen/sanitizer/cfi-generalize-pointers.rs index 17cb42d3e74f..eaf3dad19092 100644 --- a/tests/codegen/sanitizer/cfi-generalize-pointers.rs +++ b/tests/codegen/sanitizer/cfi-generalize-pointers.rs @@ -1,7 +1,7 @@ // Verifies that pointer types are generalized. // -// needs-sanitizer-cfi -// compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-generalize-pointers -Copt-level=0 +//@ needs-sanitizer-cfi +//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-generalize-pointers -Copt-level=0 #![crate_type="lib"] diff --git a/tests/codegen/sanitizer/cfi-normalize-integers.rs b/tests/codegen/sanitizer/cfi-normalize-integers.rs index d3cece4c7b6f..210814eb9ae1 100644 --- a/tests/codegen/sanitizer/cfi-normalize-integers.rs +++ b/tests/codegen/sanitizer/cfi-normalize-integers.rs @@ -1,7 +1,7 @@ // Verifies that integer types are normalized. // -// needs-sanitizer-cfi -// compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-normalize-integers -Copt-level=0 +//@ needs-sanitizer-cfi +//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-normalize-integers -Copt-level=0 #![crate_type="lib"] diff --git a/tests/codegen/sanitizer/kasan-emits-instrumentation.rs b/tests/codegen/sanitizer/kasan-emits-instrumentation.rs index 18d315c9598b..56ee875286a2 100644 --- a/tests/codegen/sanitizer/kasan-emits-instrumentation.rs +++ b/tests/codegen/sanitizer/kasan-emits-instrumentation.rs @@ -1,15 +1,15 @@ // Verifies that `-Zsanitizer=kernel-address` emits sanitizer instrumentation. -// compile-flags: -Zsanitizer=kernel-address -Copt-level=0 -// revisions: aarch64 riscv64imac riscv64gc x86_64 -//[aarch64] compile-flags: --target aarch64-unknown-none -//[aarch64] needs-llvm-components: aarch64 -//[riscv64imac] compile-flags: --target riscv64imac-unknown-none-elf -//[riscv64imac] needs-llvm-components: riscv -//[riscv64gc] compile-flags: --target riscv64gc-unknown-none-elf -//[riscv64gc] needs-llvm-components: riscv -//[x86_64] compile-flags: --target x86_64-unknown-none -//[x86_64] needs-llvm-components: x86 +//@ compile-flags: -Zsanitizer=kernel-address -Copt-level=0 +//@ revisions: aarch64 riscv64imac riscv64gc x86_64 +//@[aarch64] compile-flags: --target aarch64-unknown-none +//@[aarch64] needs-llvm-components: aarch64 +//@[riscv64imac] compile-flags: --target riscv64imac-unknown-none-elf +//@[riscv64imac] needs-llvm-components: riscv +//@[riscv64gc] compile-flags: --target riscv64gc-unknown-none-elf +//@[riscv64gc] needs-llvm-components: riscv +//@[x86_64] compile-flags: --target x86_64-unknown-none +//@[x86_64] needs-llvm-components: x86 #![crate_type = "rlib"] #![feature(no_core, no_sanitize, lang_items)] diff --git a/tests/codegen/sanitizer/kcfi-add-kcfi-flag.rs b/tests/codegen/sanitizer/kcfi-add-kcfi-flag.rs index 6d466b93c406..7751d3baf79a 100644 --- a/tests/codegen/sanitizer/kcfi-add-kcfi-flag.rs +++ b/tests/codegen/sanitizer/kcfi-add-kcfi-flag.rs @@ -1,11 +1,11 @@ // Verifies that "kcfi" module flag is added. // -// revisions: aarch64 x86_64 -// [aarch64] compile-flags: --target aarch64-unknown-none -// [aarch64] needs-llvm-components: aarch64 -// [x86_64] compile-flags: --target x86_64-unknown-none -// [x86_64] needs-llvm-components: x86 -// compile-flags: -Ctarget-feature=-crt-static -Zsanitizer=kcfi +//@ revisions: aarch64 x86_64 +//@ [aarch64] compile-flags: --target aarch64-unknown-none +//@ [aarch64] needs-llvm-components: aarch64 +//@ [x86_64] compile-flags: --target x86_64-unknown-none +//@ [x86_64] needs-llvm-components: x86 +//@ compile-flags: -Ctarget-feature=-crt-static -Zsanitizer=kcfi #![feature(no_core, lang_items)] #![crate_type="lib"] 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 index 001fc956aaaf..50e591ba06be 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 @@ -1,11 +1,11 @@ // Verifies that KCFI operand bundles are omitted. // -// revisions: aarch64 x86_64 -// [aarch64] compile-flags: --target aarch64-unknown-none -// [aarch64] needs-llvm-components: aarch64 -// [x86_64] compile-flags: --target x86_64-unknown-none -// [x86_64] needs-llvm-components: -// compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Copt-level=0 +//@ revisions: aarch64 x86_64 +//@ [aarch64] compile-flags: --target aarch64-unknown-none +//@ [aarch64] needs-llvm-components: aarch64 +//@ [x86_64] compile-flags: --target x86_64-unknown-none +//@ [x86_64] needs-llvm-components: +//@ compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Copt-level=0 #![crate_type="lib"] #![feature(no_core, no_sanitize, lang_items)] 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 index 29e4df3511fb..bd1dfc4c413e 100644 --- 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 @@ -1,11 +1,11 @@ // Verifies that generalized KCFI type metadata for functions are emitted. // -// revisions: aarch64 x86_64 -// [aarch64] compile-flags: --target aarch64-unknown-none -// [aarch64] needs-llvm-components: aarch64 -// [x86_64] compile-flags: --target x86_64-unknown-none -// [x86_64] needs-llvm-components: -// compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Zsanitizer-cfi-generalize-pointers +//@ revisions: aarch64 x86_64 +//@ [aarch64] compile-flags: --target aarch64-unknown-none +//@ [aarch64] needs-llvm-components: aarch64 +//@ [x86_64] compile-flags: --target x86_64-unknown-none +//@ [x86_64] needs-llvm-components: +//@ compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Zsanitizer-cfi-generalize-pointers #![crate_type="lib"] #![feature(no_core, lang_items)] 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 index 84d678a33ba9..b8275f44fac5 100644 --- 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 @@ -1,11 +1,11 @@ // Verifies that normalized and generalized KCFI type metadata for functions are emitted. // -// revisions: aarch64 x86_64 -// [aarch64] compile-flags: --target aarch64-unknown-none -// [aarch64] needs-llvm-components: aarch64 -// [x86_64] compile-flags: --target x86_64-unknown-none -// [x86_64] needs-llvm-components: -// compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Zsanitizer-cfi-normalize-integers -Zsanitizer-cfi-generalize-pointers +//@ revisions: aarch64 x86_64 +//@ [aarch64] compile-flags: --target aarch64-unknown-none +//@ [aarch64] needs-llvm-components: aarch64 +//@ [x86_64] compile-flags: --target x86_64-unknown-none +//@ [x86_64] needs-llvm-components: +//@ compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Zsanitizer-cfi-normalize-integers -Zsanitizer-cfi-generalize-pointers #![crate_type="lib"] #![feature(no_core, lang_items)] 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 index 761c37a9e06a..cd1b0c5efb0a 100644 --- 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 @@ -1,11 +1,11 @@ // Verifies that normalized KCFI type metadata for functions are emitted. // -// revisions: aarch64 x86_64 -// [aarch64] compile-flags: --target aarch64-unknown-none -// [aarch64] needs-llvm-components: aarch64 -// [x86_64] compile-flags: --target x86_64-unknown-none -// [x86_64] needs-llvm-components: -// compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Zsanitizer-cfi-normalize-integers +//@ revisions: aarch64 x86_64 +//@ [aarch64] compile-flags: --target aarch64-unknown-none +//@ [aarch64] needs-llvm-components: aarch64 +//@ [x86_64] compile-flags: --target x86_64-unknown-none +//@ [x86_64] needs-llvm-components: +//@ compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Zsanitizer-cfi-normalize-integers #![crate_type="lib"] #![feature(no_core, lang_items)] 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 index 83cda0ef136f..12690577da7a 100644 --- 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 @@ -1,11 +1,11 @@ // Verifies that KCFI type metadata for functions are emitted. // -// revisions: aarch64 x86_64 -// [aarch64] compile-flags: --target aarch64-unknown-none -// [aarch64] needs-llvm-components: aarch64 -// [x86_64] compile-flags: --target x86_64-unknown-none -// [x86_64] needs-llvm-components: -// compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Copt-level=0 +//@ revisions: aarch64 x86_64 +//@ [aarch64] compile-flags: --target aarch64-unknown-none +//@ [aarch64] needs-llvm-components: aarch64 +//@ [x86_64] compile-flags: --target x86_64-unknown-none +//@ [x86_64] needs-llvm-components: +//@ compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Copt-level=0 #![crate_type="lib"] #![feature(no_core, lang_items)] diff --git a/tests/codegen/sanitizer/kcfi-emit-kcfi-operand-bundle.rs b/tests/codegen/sanitizer/kcfi-emit-kcfi-operand-bundle.rs index e1d617b5ee18..f4b3e48638e4 100644 --- a/tests/codegen/sanitizer/kcfi-emit-kcfi-operand-bundle.rs +++ b/tests/codegen/sanitizer/kcfi-emit-kcfi-operand-bundle.rs @@ -1,11 +1,11 @@ // Verifies that KCFI operand bundles are emitted. // -// revisions: aarch64 x86_64 -// [aarch64] compile-flags: --target aarch64-unknown-none -// [aarch64] needs-llvm-components: aarch64 -// [x86_64] compile-flags: --target x86_64-unknown-none -// [x86_64] needs-llvm-components: -// compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Copt-level=0 +//@ revisions: aarch64 x86_64 +//@ [aarch64] compile-flags: --target aarch64-unknown-none +//@ [aarch64] needs-llvm-components: aarch64 +//@ [x86_64] compile-flags: --target x86_64-unknown-none +//@ [x86_64] needs-llvm-components: +//@ compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Copt-level=0 #![crate_type="lib"] #![feature(no_core, lang_items)] diff --git a/tests/codegen/sanitizer/kcfi-emit-type-metadata-trait-objects.rs b/tests/codegen/sanitizer/kcfi-emit-type-metadata-trait-objects.rs index 7aed137f215c..f08c9e6702ed 100644 --- a/tests/codegen/sanitizer/kcfi-emit-type-metadata-trait-objects.rs +++ b/tests/codegen/sanitizer/kcfi-emit-type-metadata-trait-objects.rs @@ -1,11 +1,11 @@ // Verifies that type metadata identifiers for trait objects are emitted correctly. // -// revisions: aarch64 x86_64 -// [aarch64] compile-flags: --target aarch64-unknown-none -// [aarch64] needs-llvm-components: aarch64 -// [x86_64] compile-flags: --target x86_64-unknown-none -// [x86_64] needs-llvm-components: -// compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Copt-level=0 +//@ revisions: aarch64 x86_64 +//@ [aarch64] compile-flags: --target aarch64-unknown-none +//@ [aarch64] needs-llvm-components: aarch64 +//@ [x86_64] compile-flags: --target x86_64-unknown-none +//@ [x86_64] needs-llvm-components: +//@ compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Copt-level=0 #![crate_type="lib"] #![feature(arbitrary_self_types, no_core, lang_items)] diff --git a/tests/codegen/sanitizer/memory-track-origins.rs b/tests/codegen/sanitizer/memory-track-origins.rs index e15a3b2274ee..956053ec42c7 100644 --- a/tests/codegen/sanitizer/memory-track-origins.rs +++ b/tests/codegen/sanitizer/memory-track-origins.rs @@ -1,15 +1,15 @@ // Verifies that MemorySanitizer track-origins level can be controlled // with -Zsanitizer-memory-track-origins option. // -// needs-sanitizer-memory -// revisions:MSAN-0 MSAN-1 MSAN-2 MSAN-1-LTO MSAN-2-LTO +//@ needs-sanitizer-memory +//@ revisions:MSAN-0 MSAN-1 MSAN-2 MSAN-1-LTO MSAN-2-LTO // -// compile-flags: -Zsanitizer=memory -Ctarget-feature=-crt-static -//[MSAN-0] compile-flags: -//[MSAN-1] compile-flags: -Zsanitizer-memory-track-origins=1 -//[MSAN-2] compile-flags: -Zsanitizer-memory-track-origins -//[MSAN-1-LTO] compile-flags: -Zsanitizer-memory-track-origins=1 -C lto=fat -//[MSAN-2-LTO] compile-flags: -Zsanitizer-memory-track-origins -C lto=fat +//@ compile-flags: -Zsanitizer=memory -Ctarget-feature=-crt-static +//@[MSAN-0] compile-flags: +//@[MSAN-1] compile-flags: -Zsanitizer-memory-track-origins=1 +//@[MSAN-2] compile-flags: -Zsanitizer-memory-track-origins +//@[MSAN-1-LTO] compile-flags: -Zsanitizer-memory-track-origins=1 -C lto=fat +//@[MSAN-2-LTO] compile-flags: -Zsanitizer-memory-track-origins -C lto=fat #![crate_type="lib"] diff --git a/tests/codegen/sanitizer/memtag-attr-check.rs b/tests/codegen/sanitizer/memtag-attr-check.rs index 3e5e14e84297..ffe3a2322a20 100644 --- a/tests/codegen/sanitizer/memtag-attr-check.rs +++ b/tests/codegen/sanitizer/memtag-attr-check.rs @@ -1,8 +1,8 @@ // This tests that the sanitize_memtag attribute is // applied when enabling the memtag sanitizer. // -// needs-sanitizer-memtag -// compile-flags: -Zsanitizer=memtag -Ctarget-feature=+mte -Copt-level=0 +//@ needs-sanitizer-memtag +//@ compile-flags: -Zsanitizer=memtag -Ctarget-feature=+mte -Copt-level=0 #![crate_type = "lib"] diff --git a/tests/codegen/sanitizer/no-sanitize-inlining.rs b/tests/codegen/sanitizer/no-sanitize-inlining.rs index e371b19eb366..623bfa608ca3 100644 --- a/tests/codegen/sanitizer/no-sanitize-inlining.rs +++ b/tests/codegen/sanitizer/no-sanitize-inlining.rs @@ -1,12 +1,12 @@ // Verifies that no_sanitize attribute prevents inlining when // given sanitizer is enabled, but has no effect on inlining otherwise. // -// needs-sanitizer-address -// needs-sanitizer-leak -// revisions: ASAN LSAN -// compile-flags: -Copt-level=3 -Zmir-opt-level=4 -Ctarget-feature=-crt-static -//[ASAN] compile-flags: -Zsanitizer=address -//[LSAN] compile-flags: -Zsanitizer=leak +//@ needs-sanitizer-address +//@ needs-sanitizer-leak +//@ revisions: ASAN LSAN +//@ compile-flags: -Copt-level=3 -Zmir-opt-level=4 -Ctarget-feature=-crt-static +//@[ASAN] compile-flags: -Zsanitizer=address +//@[LSAN] compile-flags: -Zsanitizer=leak #![crate_type="lib"] #![feature(no_sanitize)] diff --git a/tests/codegen/sanitizer/no-sanitize.rs b/tests/codegen/sanitizer/no-sanitize.rs index 029cf8e7f5c9..2614416210ff 100644 --- a/tests/codegen/sanitizer/no-sanitize.rs +++ b/tests/codegen/sanitizer/no-sanitize.rs @@ -1,8 +1,8 @@ // Verifies that no_sanitize attribute can be used to // selectively disable sanitizer instrumentation. // -// needs-sanitizer-address -// compile-flags: -Zsanitizer=address -Ctarget-feature=-crt-static -Copt-level=0 +//@ needs-sanitizer-address +//@ compile-flags: -Zsanitizer=address -Ctarget-feature=-crt-static -Copt-level=0 #![crate_type="lib"] #![feature(no_sanitize)] diff --git a/tests/codegen/sanitizer/safestack-attr-check.rs b/tests/codegen/sanitizer/safestack-attr-check.rs index b19e2d131334..050a60333afa 100644 --- a/tests/codegen/sanitizer/safestack-attr-check.rs +++ b/tests/codegen/sanitizer/safestack-attr-check.rs @@ -1,7 +1,7 @@ // This tests that the safestack attribute is applied when enabling the safe-stack sanitizer. // -// needs-sanitizer-safestack -// compile-flags: -Zsanitizer=safestack -Copt-level=0 +//@ needs-sanitizer-safestack +//@ compile-flags: -Zsanitizer=safestack -Copt-level=0 #![crate_type = "lib"] diff --git a/tests/codegen/sanitizer/sanitizer-recover.rs b/tests/codegen/sanitizer/sanitizer-recover.rs index 59b1fdd6494a..6b6593204818 100644 --- a/tests/codegen/sanitizer/sanitizer-recover.rs +++ b/tests/codegen/sanitizer/sanitizer-recover.rs @@ -1,17 +1,17 @@ // Verifies that AddressSanitizer and MemorySanitizer // recovery mode can be enabled with -Zsanitizer-recover. // -// needs-sanitizer-address -// needs-sanitizer-memory -// revisions:ASAN ASAN-RECOVER MSAN MSAN-RECOVER MSAN-RECOVER-LTO -// no-prefer-dynamic +//@ needs-sanitizer-address +//@ needs-sanitizer-memory +//@ revisions:ASAN ASAN-RECOVER MSAN MSAN-RECOVER MSAN-RECOVER-LTO +//@ no-prefer-dynamic // -// compile-flags: -Ctarget-feature=-crt-static -//[ASAN] compile-flags: -Zsanitizer=address -Copt-level=0 -//[ASAN-RECOVER] compile-flags: -Zsanitizer=address -Zsanitizer-recover=address -Copt-level=0 -//[MSAN] compile-flags: -Zsanitizer=memory -//[MSAN-RECOVER] compile-flags: -Zsanitizer=memory -Zsanitizer-recover=memory -//[MSAN-RECOVER-LTO] compile-flags: -Zsanitizer=memory -Zsanitizer-recover=memory -C lto=fat +//@ compile-flags: -Ctarget-feature=-crt-static +//@[ASAN] compile-flags: -Zsanitizer=address -Copt-level=0 +//@[ASAN-RECOVER] compile-flags: -Zsanitizer=address -Zsanitizer-recover=address -Copt-level=0 +//@[MSAN] compile-flags: -Zsanitizer=memory +//@[MSAN-RECOVER] compile-flags: -Zsanitizer=memory -Zsanitizer-recover=memory +//@[MSAN-RECOVER-LTO] compile-flags: -Zsanitizer=memory -Zsanitizer-recover=memory -C lto=fat // // MSAN-NOT: @__msan_keep_going // MSAN-RECOVER: @__msan_keep_going = weak_odr {{.*}}constant i32 1 diff --git a/tests/codegen/sanitizer/scs-attr-check.rs b/tests/codegen/sanitizer/scs-attr-check.rs index a885d911717f..6f4cbc2c0a6b 100644 --- a/tests/codegen/sanitizer/scs-attr-check.rs +++ b/tests/codegen/sanitizer/scs-attr-check.rs @@ -1,8 +1,8 @@ // This tests that the shadowcallstack attribute is // applied when enabling the shadow-call-stack sanitizer. // -// needs-sanitizer-shadow-call-stack -// compile-flags: -Zsanitizer=shadow-call-stack +//@ needs-sanitizer-shadow-call-stack +//@ compile-flags: -Zsanitizer=shadow-call-stack #![crate_type = "lib"] #![feature(no_sanitize)] diff --git a/tests/codegen/scalar-pair-bool.rs b/tests/codegen/scalar-pair-bool.rs index a8d16bc8f29f..fce0648e4507 100644 --- a/tests/codegen/scalar-pair-bool.rs +++ b/tests/codegen/scalar-pair-bool.rs @@ -1,4 +1,4 @@ -// compile-flags: -O +//@ compile-flags: -O #![crate_type = "lib"] diff --git a/tests/codegen/set-discriminant-invalid.rs b/tests/codegen/set-discriminant-invalid.rs index bccb9e4c7586..593da8cf80d0 100644 --- a/tests/codegen/set-discriminant-invalid.rs +++ b/tests/codegen/set-discriminant-invalid.rs @@ -1,4 +1,4 @@ -// compile-flags: -C opt-level=0 +//@ compile-flags: -C opt-level=0 #![crate_type = "lib"] pub enum ApiError {} diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-abs.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-float-abs.rs index e7bb2327a6e0..3eb1c9d40515 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-float-abs.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-float-abs.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes +//@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-ceil.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-float-ceil.rs index e33482d75562..05c2c0f6d044 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-float-ceil.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-float-ceil.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes +//@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-cos.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-float-cos.rs index 0f52952bc0c9..8b51e76a515c 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-float-cos.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-float-cos.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes +//@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-exp.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-float-exp.rs index 1154acf6924a..370bacdaee98 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-float-exp.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-float-exp.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes +//@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-exp2.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-float-exp2.rs index 929dc9ac8dfe..888ec6ec42cf 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-float-exp2.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-float-exp2.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes +//@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-floor.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-float-floor.rs index 56ca644f6bd9..b15d89a15b27 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-float-floor.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-float-floor.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes +//@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-fma.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-float-fma.rs index fd65cb72baa4..16017526c34a 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-float-fma.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-float-fma.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes +//@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-fsqrt.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-float-fsqrt.rs index adc1919256e7..9e0f7edd62b7 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-float-fsqrt.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-float-fsqrt.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes +//@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-log.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-float-log.rs index c072519c0d65..0324411c91bd 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-float-log.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-float-log.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes +//@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-log10.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-float-log10.rs index 5fd648995078..e7e2b0838cc2 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-float-log10.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-float-log10.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes +//@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-log2.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-float-log2.rs index 35175f0ca572..912e15c6a1d8 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-float-log2.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-float-log2.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes +//@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-minmax.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-float-minmax.rs index 4e0abed78cd6..ad297952916c 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-float-minmax.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-float-minmax.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes +//@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-pow.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-float-pow.rs index 3b8d611ab675..1ae983ca20b8 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-float-pow.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-float-pow.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes +//@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-powi.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-float-powi.rs index e80c50c10767..638b78b2d72a 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-float-powi.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-float-powi.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes +//@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-sin.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-float-sin.rs index 9e3fab49aff6..c0caedb74987 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-float-sin.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-float-sin.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes +//@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-arithmetic-saturating.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-generic-arithmetic-saturating.rs index 0bcfacec6d79..1426b439c443 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-arithmetic-saturating.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-generic-arithmetic-saturating.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes +//@ compile-flags: -C no-prepopulate-passes // #![crate_type = "lib"] diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-bitmask.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-generic-bitmask.rs index ea24569bd10c..43012dece622 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-bitmask.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-generic-bitmask.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes +//@ compile-flags: -C no-prepopulate-passes // #![crate_type = "lib"] diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-extract-insert.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-generic-extract-insert.rs deleted file mode 100644 index a5d2509d0005..000000000000 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-extract-insert.rs +++ /dev/null @@ -1,47 +0,0 @@ -// compile-flags: -C no-prepopulate-passes - -#![crate_type = "lib"] - -#![feature(repr_simd, platform_intrinsics, min_const_generics)] -#![allow(non_camel_case_types)] - -#[repr(simd)] -#[derive(Copy, Clone)] -pub struct M(pub f32, pub f32, pub f32, pub f32); - -#[repr(simd)] -#[derive(Copy, Clone)] -pub struct S([f32; N]); - -extern "platform-intrinsic" { - fn simd_extract(x: T, idx: u32) -> U; - fn simd_insert(x: T, idx: u32, b: U) -> T; -} - -// CHECK-LABEL: @extract_m -#[no_mangle] -pub unsafe fn extract_m(v: M, i: u32) -> f32 { - // CHECK: extractelement <4 x float> %{{v|1|2}}, i32 %i - simd_extract(v, i) -} - -// CHECK-LABEL: @extract_s -#[no_mangle] -pub unsafe fn extract_s(v: S<4>, i: u32) -> f32 { - // CHECK: extractelement <4 x float> %{{v|1|2}}, i32 %i - simd_extract(v, i) -} - -// CHECK-LABEL: @insert_m -#[no_mangle] -pub unsafe fn insert_m(v: M, i: u32, j: f32) -> M { - // CHECK: insertelement <4 x float> %{{v|0|1}}, float %j, i32 %i - simd_insert(v, i, j) -} - -// CHECK-LABEL: @insert_s -#[no_mangle] -pub unsafe fn insert_s(v: S<4>, i: u32, j: f32) -> S<4> { - // CHECK: insertelement <4 x float> %{{v|0|1}}, float %j, i32 %i - simd_insert(v, i, j) -} diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-gather.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-generic-gather.rs index 0bb21019685e..29d9e4018e0d 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-gather.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-generic-gather.rs @@ -1,6 +1,6 @@ // -// compile-flags: -C no-prepopulate-passes +//@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-masked-load.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-generic-masked-load.rs index e573b7d21bd2..7c48f7d5120e 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-masked-load.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-generic-masked-load.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes +//@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-masked-store.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-generic-masked-store.rs index 91656622216d..366592ba3f1e 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-masked-store.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-generic-masked-store.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes +//@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-scatter.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-generic-scatter.rs index 51953560b4fd..ccfedb31dc57 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-scatter.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-generic-scatter.rs @@ -1,6 +1,6 @@ // -// compile-flags: -C no-prepopulate-passes +//@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-select.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-generic-select.rs index 03bb22655264..903bd3f4dc60 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-select.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-generic-select.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes +//@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-transmute-array.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-transmute-array.rs index eb4ce307e70f..c92ae4163ae5 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-transmute-array.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-transmute-array.rs @@ -1,5 +1,5 @@ // -// compile-flags: -C no-prepopulate-passes +//@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] #![allow(non_camel_case_types)] diff --git a/tests/codegen/simd/issue-120720-reduce-nan.rs b/tests/codegen/simd/issue-120720-reduce-nan.rs index 233131aa01c4..2c6098c04891 100644 --- a/tests/codegen/simd/issue-120720-reduce-nan.rs +++ b/tests/codegen/simd/issue-120720-reduce-nan.rs @@ -1,5 +1,5 @@ -// compile-flags: -C opt-level=3 -C target-cpu=cannonlake -// only-x86_64 +//@ compile-flags: -C opt-level=3 -C target-cpu=cannonlake +//@ only-x86_64 // In a previous implementation, _mm512_reduce_add_pd did the reduction with all fast-math flags // enabled, making it UB to reduce a vector containing a NaN. @@ -12,7 +12,7 @@ use std::arch::x86_64::*; #[no_mangle] #[target_feature(enable = "avx512f")] // Function-level target feature mismatches inhibit inlining pub unsafe fn demo() -> bool { - // CHECK: %0 = tail call reassoc nsz arcp contract double @llvm.vector.reduce.fadd.v8f64( + // CHECK: %0 = tail call reassoc double @llvm.vector.reduce.fadd.v8f64( // CHECK: %_0.i = fcmp uno double %0, 0.000000e+00 // CHECK: ret i1 %_0.i let res = unsafe { diff --git a/tests/codegen/simd/simd-wide-sum.rs b/tests/codegen/simd/simd-wide-sum.rs index 109d53813438..2edee552ca69 100644 --- a/tests/codegen/simd/simd-wide-sum.rs +++ b/tests/codegen/simd/simd-wide-sum.rs @@ -1,9 +1,8 @@ -// revisions: llvm mir-opt3 -// compile-flags: -C opt-level=3 -Z merge-functions=disabled --edition=2021 -// only-x86_64 -// ignore-debug: the debug assertions get in the way -// [mir-opt3]compile-flags: -Zmir-opt-level=3 -// [mir-opt3]build-pass +//@ revisions: llvm mir-opt3 +//@ compile-flags: -C opt-level=3 -Z merge-functions=disabled --edition=2021 +//@ only-x86_64 +//@ [mir-opt3]compile-flags: -Zmir-opt-level=3 +//@ [mir-opt3]build-pass // mir-opt3 is a regression test for https://github.com/rust-lang/rust/issues/98016 diff --git a/tests/codegen/simd/simd_arith_offset.rs b/tests/codegen/simd/simd_arith_offset.rs index 1ee73de1186f..9f1ef27053e6 100644 --- a/tests/codegen/simd/simd_arith_offset.rs +++ b/tests/codegen/simd/simd_arith_offset.rs @@ -1,5 +1,5 @@ -// compile-flags: -C no-prepopulate-passes -// only-64bit (because the LLVM type of i64 for usize shows up) +//@ compile-flags: -C no-prepopulate-passes +//@ only-64bit (because the LLVM type of i64 for usize shows up) // #![crate_type = "lib"] diff --git a/tests/codegen/simd/swap-simd-types.rs b/tests/codegen/simd/swap-simd-types.rs index 3472a42b0e65..32e75220d696 100644 --- a/tests/codegen/simd/swap-simd-types.rs +++ b/tests/codegen/simd/swap-simd-types.rs @@ -1,6 +1,5 @@ -// compile-flags: -O -C target-feature=+avx -// only-x86_64 -// ignore-debug: the debug assertions get in the way +//@ compile-flags: -O -C target-feature=+avx +//@ only-x86_64 #![crate_type = "lib"] diff --git a/tests/codegen/slice-as_chunks.rs b/tests/codegen/slice-as_chunks.rs index e832f90d07a5..631d18d78095 100644 --- a/tests/codegen/slice-as_chunks.rs +++ b/tests/codegen/slice-as_chunks.rs @@ -1,6 +1,5 @@ -// compile-flags: -O -// only-64bit (because the LLVM type of i64 for usize shows up) -// ignore-debug: the debug assertions get in the way +//@ compile-flags: -O +//@ only-64bit (because the LLVM type of i64 for usize shows up) #![crate_type = "lib"] #![feature(slice_as_chunks)] diff --git a/tests/codegen/slice-indexing.rs b/tests/codegen/slice-indexing.rs index c40d59fb0cf0..ecce92010719 100644 --- a/tests/codegen/slice-indexing.rs +++ b/tests/codegen/slice-indexing.rs @@ -1,6 +1,5 @@ -// compile-flags: -O -// only-64bit (because the LLVM type of i64 for usize shows up) -// ignore-debug: the debug assertions get in the way +//@ compile-flags: -O +//@ only-64bit (because the LLVM type of i64 for usize shows up) #![crate_type = "lib"] diff --git a/tests/codegen/slice-init.rs b/tests/codegen/slice-init.rs index c0bf1a04119b..8126bf84618a 100644 --- a/tests/codegen/slice-init.rs +++ b/tests/codegen/slice-init.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes +//@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/tests/codegen/slice-iter-fold.rs b/tests/codegen/slice-iter-fold.rs index a55425cb6bbc..1770cd4a1199 100644 --- a/tests/codegen/slice-iter-fold.rs +++ b/tests/codegen/slice-iter-fold.rs @@ -1,5 +1,4 @@ -// ignore-debug: the debug assertions get in the way -// compile-flags: -O +//@ compile-flags: -O #![crate_type = "lib"] // CHECK-LABEL: @slice_fold_to_last diff --git a/tests/codegen/slice-iter-len-eq-zero.rs b/tests/codegen/slice-iter-len-eq-zero.rs index 77febf5170da..b2a4b2495b6a 100644 --- a/tests/codegen/slice-iter-len-eq-zero.rs +++ b/tests/codegen/slice-iter-len-eq-zero.rs @@ -1,5 +1,4 @@ -// compile-flags: -O -// ignore-debug: the debug assertions add extra comparisons +//@ compile-flags: -O #![crate_type = "lib"] type Demo = [u8; 3]; diff --git a/tests/codegen/slice-iter-nonnull.rs b/tests/codegen/slice-iter-nonnull.rs index 93c8828ccd33..c960688b00c1 100644 --- a/tests/codegen/slice-iter-nonnull.rs +++ b/tests/codegen/slice-iter-nonnull.rs @@ -1,5 +1,4 @@ -// compile-flags: -O -// ignore-debug (these add extra checks that make it hard to verify) +//@ compile-flags: -O #![crate_type = "lib"] #![feature(exact_size_is_empty)] diff --git a/tests/codegen/slice-position-bounds-check.rs b/tests/codegen/slice-position-bounds-check.rs index 57904e5e4999..301895883ee3 100644 --- a/tests/codegen/slice-position-bounds-check.rs +++ b/tests/codegen/slice-position-bounds-check.rs @@ -1,4 +1,4 @@ -// compile-flags: -O -C panic=abort +//@ compile-flags: -O -C panic=abort #![crate_type = "lib"] fn search(arr: &mut [T], a: &T) -> Result { diff --git a/tests/codegen/slice-ref-equality.rs b/tests/codegen/slice-ref-equality.rs index afbdf66ce0aa..371e685ec6c9 100644 --- a/tests/codegen/slice-ref-equality.rs +++ b/tests/codegen/slice-ref-equality.rs @@ -1,5 +1,4 @@ -// compile-flags: -O -Zmerge-functions=disabled -// ignore-debug (the extra assertions get in the way) +//@ compile-flags: -O -Zmerge-functions=disabled #![crate_type = "lib"] diff --git a/tests/codegen/slice-reverse.rs b/tests/codegen/slice-reverse.rs index e50b22f3ac40..21add929f051 100644 --- a/tests/codegen/slice-reverse.rs +++ b/tests/codegen/slice-reverse.rs @@ -1,6 +1,6 @@ -// compile-flags: -O -// only-x86_64 -// ignore-debug: the debug assertions in from_raw_parts get in the way +//@ compile-flags: -O +//@ only-x86_64 +//@ ignore-debug: debug assertions prevent generating shufflevector #![crate_type = "lib"] diff --git a/tests/codegen/slice-windows-no-bounds-check.rs b/tests/codegen/slice-windows-no-bounds-check.rs index 4f5f4425c271..188011ebe7fd 100644 --- a/tests/codegen/slice-windows-no-bounds-check.rs +++ b/tests/codegen/slice-windows-no-bounds-check.rs @@ -1,6 +1,6 @@ #![crate_type = "lib"] -// compile-flags: -O +//@ compile-flags: -O use std::slice::Windows; diff --git a/tests/codegen/slice_as_from_ptr_range.rs b/tests/codegen/slice_as_from_ptr_range.rs index 3d8ab0a4b5f8..47c60461c0e8 100644 --- a/tests/codegen/slice_as_from_ptr_range.rs +++ b/tests/codegen/slice_as_from_ptr_range.rs @@ -1,6 +1,5 @@ -// compile-flags: -O -// only-64bit (because we're using [ui]size) -// ignore-debug (because the assertions get in the way) +//@ compile-flags: -O +//@ only-64bit (because we're using [ui]size) #![crate_type = "lib"] #![feature(slice_from_ptr_range)] diff --git a/tests/codegen/some-abis-do-extend-params-to-32-bits.rs b/tests/codegen/some-abis-do-extend-params-to-32-bits.rs index 9f2d9d06524f..a75a239e2ab8 100644 --- a/tests/codegen/some-abis-do-extend-params-to-32-bits.rs +++ b/tests/codegen/some-abis-do-extend-params-to-32-bits.rs @@ -1,21 +1,21 @@ -// compile-flags: -Cno-prepopulate-passes -Copt-level=0 +//@ compile-flags: -Cno-prepopulate-passes -Copt-level=0 -// revisions:x86_64 i686 aarch64-apple aarch64-windows aarch64-linux arm riscv +//@ revisions:x86_64 i686 aarch64-apple aarch64-windows aarch64-linux arm riscv -//[x86_64] compile-flags: --target x86_64-unknown-uefi -//[x86_64] needs-llvm-components: x86 -//[i686] compile-flags: --target i686-unknown-linux-musl -//[i686] needs-llvm-components: x86 -//[aarch64-windows] compile-flags: --target aarch64-pc-windows-msvc -//[aarch64-windows] needs-llvm-components: aarch64 -//[aarch64-linux] compile-flags: --target aarch64-unknown-linux-gnu -//[aarch64-linux] needs-llvm-components: aarch64 -//[aarch64-apple] compile-flags: --target aarch64-apple-darwin -//[aarch64-apple] needs-llvm-components: aarch64 -//[arm] compile-flags: --target armv7r-none-eabi -//[arm] needs-llvm-components: arm -//[riscv] compile-flags: --target riscv64gc-unknown-none-elf -//[riscv] needs-llvm-components: riscv +//@[x86_64] compile-flags: --target x86_64-unknown-uefi +//@[x86_64] needs-llvm-components: x86 +//@[i686] compile-flags: --target i686-unknown-linux-musl +//@[i686] needs-llvm-components: x86 +//@[aarch64-windows] compile-flags: --target aarch64-pc-windows-msvc +//@[aarch64-windows] needs-llvm-components: aarch64 +//@[aarch64-linux] compile-flags: --target aarch64-unknown-linux-gnu +//@[aarch64-linux] needs-llvm-components: aarch64 +//@[aarch64-apple] compile-flags: --target aarch64-apple-darwin +//@[aarch64-apple] needs-llvm-components: aarch64 +//@[arm] compile-flags: --target armv7r-none-eabi +//@[arm] needs-llvm-components: arm +//@[riscv] compile-flags: --target riscv64gc-unknown-none-elf +//@[riscv] needs-llvm-components: riscv // See bottom of file for a corresponding C source file that is meant to yield // equivalent declarations. diff --git a/tests/codegen/some-global-nonnull.rs b/tests/codegen/some-global-nonnull.rs index 59c47de4129c..8e9308a72658 100644 --- a/tests/codegen/some-global-nonnull.rs +++ b/tests/codegen/some-global-nonnull.rs @@ -1,4 +1,4 @@ -// compile-flags: -O +//@ compile-flags: -O #![crate_type = "lib"] diff --git a/tests/codegen/sparc-struct-abi.rs b/tests/codegen/sparc-struct-abi.rs index b94ef79aec7f..0850e9e15eaf 100644 --- a/tests/codegen/sparc-struct-abi.rs +++ b/tests/codegen/sparc-struct-abi.rs @@ -1,8 +1,8 @@ // Checks that we correctly codegen extern "C" functions returning structs. // See issues #52638 and #86163. -// compile-flags: -O --target=sparc64-unknown-linux-gnu --crate-type=rlib -// needs-llvm-components: sparc +//@ compile-flags: -O --target=sparc64-unknown-linux-gnu --crate-type=rlib +//@ needs-llvm-components: sparc #![feature(no_core, lang_items)] #![no_core] diff --git a/tests/codegen/split-lto-unit.rs b/tests/codegen/split-lto-unit.rs index dc6570be32b4..6cea9a2d8d5f 100644 --- a/tests/codegen/split-lto-unit.rs +++ b/tests/codegen/split-lto-unit.rs @@ -1,7 +1,7 @@ // Verifies that "EnableSplitLTOUnit" module flag is added. // -// needs-sanitizer-cfi -// compile-flags: -Clto -Ctarget-feature=-crt-static -Zsplit-lto-unit +//@ needs-sanitizer-cfi +//@ compile-flags: -Clto -Ctarget-feature=-crt-static -Zsplit-lto-unit #![crate_type="lib"] diff --git a/tests/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs b/tests/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs index 6ef0f0406d20..7aec8d545dcf 100644 --- a/tests/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs +++ b/tests/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs @@ -1,4 +1,4 @@ -// compile-flags: -g -Z src-hash-algorithm=md5 -Copt-level=0 +//@ compile-flags: -g -Z src-hash-algorithm=md5 -Copt-level=0 #![crate_type = "lib"] diff --git a/tests/codegen/src-hash-algorithm/src-hash-algorithm-sha1.rs b/tests/codegen/src-hash-algorithm/src-hash-algorithm-sha1.rs index ebfa3040acaf..5389c32f938f 100644 --- a/tests/codegen/src-hash-algorithm/src-hash-algorithm-sha1.rs +++ b/tests/codegen/src-hash-algorithm/src-hash-algorithm-sha1.rs @@ -1,4 +1,4 @@ -// compile-flags: -g -Z src-hash-algorithm=sha1 -Copt-level=0 +//@ compile-flags: -g -Z src-hash-algorithm=sha1 -Copt-level=0 #![crate_type = "lib"] diff --git a/tests/codegen/src-hash-algorithm/src-hash-algorithm-sha256.rs b/tests/codegen/src-hash-algorithm/src-hash-algorithm-sha256.rs index 5ec678d55f34..520890c47f10 100644 --- a/tests/codegen/src-hash-algorithm/src-hash-algorithm-sha256.rs +++ b/tests/codegen/src-hash-algorithm/src-hash-algorithm-sha256.rs @@ -1,4 +1,4 @@ -// compile-flags: -g -Z src-hash-algorithm=sha256 -Copt-level=0 +//@ compile-flags: -g -Z src-hash-algorithm=sha256 -Copt-level=0 #![crate_type = "lib"] diff --git a/tests/codegen/sroa-fragment-debuginfo.rs b/tests/codegen/sroa-fragment-debuginfo.rs index fb10f63beaf4..d8c2d2c6f9ef 100644 --- a/tests/codegen/sroa-fragment-debuginfo.rs +++ b/tests/codegen/sroa-fragment-debuginfo.rs @@ -1,8 +1,8 @@ -// compile-flags: -g -Zmir-opt-level=0 -Zmir-enable-passes=+ScalarReplacementOfAggregates -// compile-flags: -Cno-prepopulate-passes +//@ compile-flags: -g -Zmir-opt-level=0 -Zmir-enable-passes=+ScalarReplacementOfAggregates +//@ compile-flags: -Cno-prepopulate-passes // // Tested offsets are only correct for x86_64. -// only-x86_64 +//@ only-x86_64 #![crate_type = "lib"] diff --git a/tests/codegen/sse42-implies-crc32.rs b/tests/codegen/sse42-implies-crc32.rs index 56079d32a8d8..c627be5c30e9 100644 --- a/tests/codegen/sse42-implies-crc32.rs +++ b/tests/codegen/sse42-implies-crc32.rs @@ -1,5 +1,5 @@ -// only-x86_64 -// compile-flags: -Copt-level=3 +//@ only-x86_64 +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/stack-probes-inline.rs b/tests/codegen/stack-probes-inline.rs index 34027e918509..6bd6b0cb354c 100644 --- a/tests/codegen/stack-probes-inline.rs +++ b/tests/codegen/stack-probes-inline.rs @@ -1,22 +1,22 @@ // Check the "probe-stack" attribute for targets with `StackProbeType::Inline`, // or `StackProbeType::InlineOrCall` when running on newer LLVM. -// compile-flags: -C no-prepopulate-passes -// revisions: aarch64 powerpc powerpc64 powerpc64le s390x i686 x86_64 -//[aarch64] compile-flags: --target aarch64-unknown-linux-gnu -//[aarch64] needs-llvm-components: aarch64 -//[powerpc] compile-flags: --target powerpc-unknown-linux-gnu -//[powerpc] needs-llvm-components: powerpc -//[powerpc64] compile-flags: --target powerpc64-unknown-linux-gnu -//[powerpc64] needs-llvm-components: powerpc -//[powerpc64le] compile-flags: --target powerpc64le-unknown-linux-gnu -//[powerpc64le] needs-llvm-components: powerpc -//[s390x] compile-flags: --target s390x-unknown-linux-gnu -//[s390x] needs-llvm-components: systemz -//[i686] compile-flags: --target i686-unknown-linux-gnu -//[i686] needs-llvm-components: x86 -//[x86_64] compile-flags: --target x86_64-unknown-linux-gnu -//[x86_64] needs-llvm-components: x86 +//@ compile-flags: -C no-prepopulate-passes +//@ revisions: aarch64 powerpc powerpc64 powerpc64le s390x i686 x86_64 +//@[aarch64] compile-flags: --target aarch64-unknown-linux-gnu +//@[aarch64] needs-llvm-components: aarch64 +//@[powerpc] compile-flags: --target powerpc-unknown-linux-gnu +//@[powerpc] needs-llvm-components: powerpc +//@[powerpc64] compile-flags: --target powerpc64-unknown-linux-gnu +//@[powerpc64] needs-llvm-components: powerpc +//@[powerpc64le] compile-flags: --target powerpc64le-unknown-linux-gnu +//@[powerpc64le] needs-llvm-components: powerpc +//@[s390x] compile-flags: --target s390x-unknown-linux-gnu +//@[s390x] needs-llvm-components: systemz +//@[i686] compile-flags: --target i686-unknown-linux-gnu +//@[i686] needs-llvm-components: x86 +//@[x86_64] compile-flags: --target x86_64-unknown-linux-gnu +//@[x86_64] needs-llvm-components: x86 #![crate_type = "rlib"] #![feature(no_core, lang_items)] diff --git a/tests/codegen/stack-protector.rs b/tests/codegen/stack-protector.rs index a680789af15f..8ab25b470cda 100644 --- a/tests/codegen/stack-protector.rs +++ b/tests/codegen/stack-protector.rs @@ -1,8 +1,8 @@ -// revisions: all strong basic none -// ignore-nvptx64 stack protector not supported -// [all] compile-flags: -Z stack-protector=all -// [strong] compile-flags: -Z stack-protector=strong -// [basic] compile-flags: -Z stack-protector=basic +//@ revisions: all strong basic none +//@ ignore-nvptx64 stack protector not supported +//@ [all] compile-flags: -Z stack-protector=all +//@ [strong] compile-flags: -Z stack-protector=strong +//@ [basic] compile-flags: -Z stack-protector=basic #![crate_type = "lib"] diff --git a/tests/codegen/static-relocation-model-msvc.rs b/tests/codegen/static-relocation-model-msvc.rs index 735ef7081c95..5501827498cc 100644 --- a/tests/codegen/static-relocation-model-msvc.rs +++ b/tests/codegen/static-relocation-model-msvc.rs @@ -1,8 +1,8 @@ // Verify linkage of external symbols in the static relocation model on MSVC. // -// compile-flags: -O -C relocation-model=static -// aux-build: extern_decl.rs -// only-x86_64-pc-windows-msvc +//@ compile-flags: -O -C relocation-model=static +//@ aux-build: extern_decl.rs +//@ only-x86_64-pc-windows-msvc #![crate_type = "rlib"] diff --git a/tests/codegen/staticlib-external-inline-fns.rs b/tests/codegen/staticlib-external-inline-fns.rs index 432c063e826e..23316a2d9a5f 100644 --- a/tests/codegen/staticlib-external-inline-fns.rs +++ b/tests/codegen/staticlib-external-inline-fns.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes +//@ compile-flags: -C no-prepopulate-passes #![crate_type = "staticlib"] diff --git a/tests/codegen/stores.rs b/tests/codegen/stores.rs index a8e155c4c8a4..3fda5aa47eaf 100644 --- a/tests/codegen/stores.rs +++ b/tests/codegen/stores.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes +//@ compile-flags: -C no-prepopulate-passes // #![crate_type = "lib"] diff --git a/tests/codegen/swap-large-types.rs b/tests/codegen/swap-large-types.rs index 7b6611f3da43..b182f3ed9479 100644 --- a/tests/codegen/swap-large-types.rs +++ b/tests/codegen/swap-large-types.rs @@ -1,6 +1,5 @@ -// compile-flags: -O -// only-x86_64 -// ignore-debug: the debug assertions get in the way +//@ compile-flags: -O +//@ only-x86_64 #![crate_type = "lib"] diff --git a/tests/codegen/swap-small-types.rs b/tests/codegen/swap-small-types.rs index 2c6751744798..5fdf4a5804a9 100644 --- a/tests/codegen/swap-small-types.rs +++ b/tests/codegen/swap-small-types.rs @@ -1,6 +1,5 @@ -// compile-flags: -O -Z merge-functions=disabled -// only-x86_64 -// ignore-debug: the debug assertions get in the way +//@ compile-flags: -O -Z merge-functions=disabled +//@ only-x86_64 #![crate_type = "lib"] diff --git a/tests/codegen/target-cpu-on-functions.rs b/tests/codegen/target-cpu-on-functions.rs index d5250f22cca9..25c10e7ce448 100644 --- a/tests/codegen/target-cpu-on-functions.rs +++ b/tests/codegen/target-cpu-on-functions.rs @@ -1,9 +1,9 @@ // This test makes sure that functions get annotated with the proper // "target-cpu" attribute in LLVM. -// no-prefer-dynamic +//@ no-prefer-dynamic // -// compile-flags: -C no-prepopulate-passes -C panic=abort -C linker-plugin-lto -Cpasses=name-anon-globals +//@ compile-flags: -C no-prepopulate-passes -C panic=abort -C linker-plugin-lto -Cpasses=name-anon-globals #![crate_type = "staticlib"] diff --git a/tests/codegen/target-feature-inline-closure.rs b/tests/codegen/target-feature-inline-closure.rs index 54cb27242d5a..88bd413a8707 100644 --- a/tests/codegen/target-feature-inline-closure.rs +++ b/tests/codegen/target-feature-inline-closure.rs @@ -1,5 +1,5 @@ -// only-x86_64 -// compile-flags: -Copt-level=3 +//@ only-x86_64 +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] #![feature(target_feature_11)] diff --git a/tests/codegen/target-feature-overrides.rs b/tests/codegen/target-feature-overrides.rs index 1bebf66f0df4..61b1b3fd2578 100644 --- a/tests/codegen/target-feature-overrides.rs +++ b/tests/codegen/target-feature-overrides.rs @@ -1,8 +1,8 @@ -// revisions: COMPAT INCOMPAT -// needs-llvm-components: x86 -// compile-flags: --target=x86_64-unknown-linux-gnu -Copt-level=3 -// [COMPAT] compile-flags: -Ctarget-feature=+avx2,+avx -// [INCOMPAT] compile-flags: -Ctarget-feature=-avx2,-avx +//@ revisions: COMPAT INCOMPAT +//@ needs-llvm-components: x86 +//@ compile-flags: --target=x86_64-unknown-linux-gnu -Copt-level=3 +//@ [COMPAT] compile-flags: -Ctarget-feature=+avx2,+avx +//@ [INCOMPAT] compile-flags: -Ctarget-feature=-avx2,-avx // See also tests/assembly/target-feature-multiple.rs #![feature(no_core, lang_items)] diff --git a/tests/codegen/thin-lto.rs b/tests/codegen/thin-lto.rs index 7991cad7a0ca..c75f9841a773 100644 --- a/tests/codegen/thin-lto.rs +++ b/tests/codegen/thin-lto.rs @@ -1,5 +1,5 @@ -// compile-flags: -O -C lto=thin -C prefer-dynamic=no -// only-x86_64-unknown-linux-gnu +//@ compile-flags: -O -C lto=thin -C prefer-dynamic=no +//@ only-x86_64-unknown-linux-gnu // CHECK: main diff --git a/tests/codegen/thread-local.rs b/tests/codegen/thread-local.rs index caf0366d2c14..2ee15811cc3d 100644 --- a/tests/codegen/thread-local.rs +++ b/tests/codegen/thread-local.rs @@ -1,10 +1,10 @@ -// compile-flags: -O -// aux-build:thread_local_aux.rs -// ignore-windows FIXME(#84933) -// ignore-wasm globals are used instead of thread locals -// ignore-emscripten globals are used instead of thread locals -// ignore-android does not use #[thread_local] -// ignore-nto does not use #[thread_local] +//@ compile-flags: -O +//@ aux-build:thread_local_aux.rs +//@ ignore-windows FIXME(#84933) +//@ ignore-wasm globals are used instead of thread locals +//@ ignore-emscripten globals are used instead of thread locals +//@ ignore-android does not use #[thread_local] +//@ ignore-nto does not use #[thread_local] #![crate_type = "lib"] diff --git a/tests/codegen/tied-features-strength.rs b/tests/codegen/tied-features-strength.rs index 71cea48c4da5..b97865295a23 100644 --- a/tests/codegen/tied-features-strength.rs +++ b/tests/codegen/tied-features-strength.rs @@ -1,22 +1,22 @@ // ignore-tidy-linelength -// revisions: ENABLE_SVE DISABLE_SVE DISABLE_NEON ENABLE_NEON -// compile-flags: --crate-type=rlib --target=aarch64-unknown-linux-gnu -// needs-llvm-components: aarch64 +//@ revisions: ENABLE_SVE DISABLE_SVE DISABLE_NEON ENABLE_NEON +//@ compile-flags: --crate-type=rlib --target=aarch64-unknown-linux-gnu +//@ needs-llvm-components: aarch64 // The "+v8a" feature is matched as optional as it isn't added when we // are targeting older LLVM versions. Once the min supported version // is LLVM-14 we can remove the optional regex matching for this feature. -// [ENABLE_SVE] compile-flags: -C target-feature=+sve -Copt-level=0 +//@ [ENABLE_SVE] compile-flags: -C target-feature=+sve -Copt-level=0 // ENABLE_SVE: attributes #0 = { {{.*}} "target-features"="{{((\+outline-atomics,?)|(\+v8a,?)?|(\+sve,?)|(\+neon,?))*}}" } -// [DISABLE_SVE] compile-flags: -C target-feature=-sve -Copt-level=0 +//@ [DISABLE_SVE] compile-flags: -C target-feature=-sve -Copt-level=0 // DISABLE_SVE: attributes #0 = { {{.*}} "target-features"="{{((\+outline-atomics,?)|(\+v8a,?)?|(-sve,?)|(\+neon,?))*}}" } -// [DISABLE_NEON] compile-flags: -C target-feature=-neon -Copt-level=0 +//@ [DISABLE_NEON] compile-flags: -C target-feature=-neon -Copt-level=0 // DISABLE_NEON: attributes #0 = { {{.*}} "target-features"="{{((\+outline-atomics,?)|(\+v8a,?)?|(-fp-armv8,?)|(-neon,?))*}}" } -// [ENABLE_NEON] compile-flags: -C target-feature=+neon -Copt-level=0 +//@ [ENABLE_NEON] compile-flags: -C target-feature=+neon -Copt-level=0 // ENABLE_NEON: attributes #0 = { {{.*}} "target-features"="{{((\+outline-atomics,?)|(\+v8a,?)?|(\+fp-armv8,?)|(\+neon,?))*}}" } diff --git a/tests/codegen/to_vec.rs b/tests/codegen/to_vec.rs index 60dc4efcb625..651084d811ca 100644 --- a/tests/codegen/to_vec.rs +++ b/tests/codegen/to_vec.rs @@ -1,4 +1,4 @@ -// compile-flags: -O +//@ compile-flags: -O #![crate_type = "lib"] diff --git a/tests/codegen/trailing_zeros.rs b/tests/codegen/trailing_zeros.rs index 2ea0e447abe2..66560c0d4fc4 100644 --- a/tests/codegen/trailing_zeros.rs +++ b/tests/codegen/trailing_zeros.rs @@ -1,5 +1,5 @@ -// compile-flags: -O -// min-llvm-version: 17 +//@ compile-flags: -O +//@ min-llvm-version: 17 #![crate_type = "lib"] diff --git a/tests/codegen/transmute-optimized.rs b/tests/codegen/transmute-optimized.rs index b8c51b08499f..9217def76b51 100644 --- a/tests/codegen/transmute-optimized.rs +++ b/tests/codegen/transmute-optimized.rs @@ -1,5 +1,4 @@ -// compile-flags: -O -Z merge-functions=disabled -// ignore-debug +//@ compile-flags: -O -Z merge-functions=disabled #![crate_type = "lib"] diff --git a/tests/codegen/transmute-scalar.rs b/tests/codegen/transmute-scalar.rs index 39126b024a6e..7a5eb4dfcd5c 100644 --- a/tests/codegen/transmute-scalar.rs +++ b/tests/codegen/transmute-scalar.rs @@ -1,4 +1,4 @@ -// compile-flags: -C opt-level=0 -C no-prepopulate-passes +//@ compile-flags: -C opt-level=0 -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/tests/codegen/try_identity.rs b/tests/codegen/try_identity.rs index 92be90014ffc..87b7d0727d08 100644 --- a/tests/codegen/try_identity.rs +++ b/tests/codegen/try_identity.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes -O -Z mir-opt-level=3 -Zunsound-mir-opts +//@ compile-flags: -C no-prepopulate-passes -O -Z mir-opt-level=3 -Zunsound-mir-opts // Ensure that `x?` has no overhead on `Result` due to identity `match`es in lowering. // This requires inlining to trigger the MIR optimizations in `SimplifyArmIdentity`. diff --git a/tests/codegen/try_question_mark_nop.rs b/tests/codegen/try_question_mark_nop.rs index 9d34155bdd79..58cd6ff233a1 100644 --- a/tests/codegen/try_question_mark_nop.rs +++ b/tests/codegen/try_question_mark_nop.rs @@ -1,5 +1,5 @@ -// compile-flags: -O -Z merge-functions=disabled --edition=2021 -// only-x86_64 +//@ compile-flags: -O -Z merge-functions=disabled --edition=2021 +//@ only-x86_64 #![crate_type = "lib"] #![feature(try_blocks)] diff --git a/tests/codegen/tune-cpu-on-functions.rs b/tests/codegen/tune-cpu-on-functions.rs index 116f0772d255..dc04c4819af5 100644 --- a/tests/codegen/tune-cpu-on-functions.rs +++ b/tests/codegen/tune-cpu-on-functions.rs @@ -1,9 +1,9 @@ // This test makes sure that functions get annotated with the proper // "tune-cpu" attribute in LLVM. -// no-prefer-dynamic +//@ no-prefer-dynamic // -// compile-flags: -C no-prepopulate-passes -C panic=abort -C linker-plugin-lto -Cpasses=name-anon-globals -Z tune-cpu=generic -Copt-level=0 +//@ compile-flags: -C no-prepopulate-passes -C panic=abort -C linker-plugin-lto -Cpasses=name-anon-globals -Z tune-cpu=generic -Copt-level=0 #![crate_type = "staticlib"] diff --git a/tests/codegen/tuple-layout-opt.rs b/tests/codegen/tuple-layout-opt.rs index 7cc67a9b51c1..dab1e42f6b5d 100644 --- a/tests/codegen/tuple-layout-opt.rs +++ b/tests/codegen/tuple-layout-opt.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes -Copt-level=0 +//@ compile-flags: -C no-prepopulate-passes -Copt-level=0 // Test that tuples get optimized layout, in particular with a ZST in the last field (#63244) diff --git a/tests/codegen/unchecked-float-casts.rs b/tests/codegen/unchecked-float-casts.rs index 4e3bfcd43974..d1869abc87bb 100644 --- a/tests/codegen/unchecked-float-casts.rs +++ b/tests/codegen/unchecked-float-casts.rs @@ -1,8 +1,8 @@ // This file tests that we don't generate any code for saturation when using the // unchecked intrinsics. -// compile-flags: -C opt-level=3 -// ignore-wasm32 the wasm target is tested in `wasm_casts_*` +//@ compile-flags: -C opt-level=3 +//@ ignore-wasm32 the wasm target is tested in `wasm_casts_*` #![crate_type = "lib"] diff --git a/tests/codegen/unchecked_shifts.rs b/tests/codegen/unchecked_shifts.rs index eded894c6d08..9cf2f2b0cb67 100644 --- a/tests/codegen/unchecked_shifts.rs +++ b/tests/codegen/unchecked_shifts.rs @@ -1,5 +1,4 @@ -// compile-flags: -O -// ignore-debug (because unchecked is checked in debug) +//@ compile-flags: -O #![crate_type = "lib"] #![feature(unchecked_shifts)] diff --git a/tests/codegen/uninit-consts.rs b/tests/codegen/uninit-consts.rs index 1313e67634a3..649927b87b40 100644 --- a/tests/codegen/uninit-consts.rs +++ b/tests/codegen/uninit-consts.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes +//@ compile-flags: -C no-prepopulate-passes // Check that we use undef (and not zero) for uninitialized bytes in constants. diff --git a/tests/codegen/union-abi.rs b/tests/codegen/union-abi.rs index 4878ae5c3b68..b1b0daa13b64 100644 --- a/tests/codegen/union-abi.rs +++ b/tests/codegen/union-abi.rs @@ -1,5 +1,5 @@ -// ignore-emscripten vectors passed directly -// compile-flags: -O -C no-prepopulate-passes +//@ ignore-emscripten vectors passed directly +//@ compile-flags: -O -C no-prepopulate-passes // This test that using union forward the abi of the inner type, as // discussed in #54668 diff --git a/tests/codegen/unwind-abis/aapcs-unwind-abi.rs b/tests/codegen/unwind-abis/aapcs-unwind-abi.rs index c092e28a05ac..484af78105f1 100644 --- a/tests/codegen/unwind-abis/aapcs-unwind-abi.rs +++ b/tests/codegen/unwind-abis/aapcs-unwind-abi.rs @@ -1,5 +1,5 @@ -// needs-llvm-components: arm -// compile-flags: --target=armv7-unknown-linux-gnueabihf --crate-type=rlib -Cno-prepopulate-passes +//@ needs-llvm-components: arm +//@ compile-flags: --target=armv7-unknown-linux-gnueabihf --crate-type=rlib -Cno-prepopulate-passes #![no_core] #![feature(no_core, lang_items, c_unwind)] #[lang="sized"] diff --git a/tests/codegen/unwind-abis/c-unwind-abi-panic-abort.rs b/tests/codegen/unwind-abis/c-unwind-abi-panic-abort.rs index ea5bae18e233..8bb2122946fc 100644 --- a/tests/codegen/unwind-abis/c-unwind-abi-panic-abort.rs +++ b/tests/codegen/unwind-abis/c-unwind-abi-panic-abort.rs @@ -1,4 +1,4 @@ -// compile-flags: -C panic=abort +//@ compile-flags: -C panic=abort // Test that `nounwind` attributes are also applied to extern `C-unwind` Rust functions // when the code is compiled with `panic=abort`. diff --git a/tests/codegen/unwind-abis/c-unwind-abi.rs b/tests/codegen/unwind-abis/c-unwind-abi.rs index fa5b6bad75cb..140c18e6bb33 100644 --- a/tests/codegen/unwind-abis/c-unwind-abi.rs +++ b/tests/codegen/unwind-abis/c-unwind-abi.rs @@ -1,5 +1,5 @@ -// compile-flags: -C opt-level=0 -// needs-unwind +//@ compile-flags: -C opt-level=0 +//@ needs-unwind // Test that `nounwind` attributes are correctly applied to exported `C` and `C-unwind` extern // functions. `C-unwind` functions MUST NOT have this attribute. We disable optimizations above diff --git a/tests/codegen/unwind-abis/cdecl-unwind-abi.rs b/tests/codegen/unwind-abis/cdecl-unwind-abi.rs index 64746d32175b..5604b8d5765a 100644 --- a/tests/codegen/unwind-abis/cdecl-unwind-abi.rs +++ b/tests/codegen/unwind-abis/cdecl-unwind-abi.rs @@ -1,5 +1,5 @@ -// compile-flags: -C opt-level=0 -// needs-unwind +//@ compile-flags: -C opt-level=0 +//@ needs-unwind // Test that `nounwind` attributes are correctly applied to exported `cdecl` and // `cdecl-unwind` extern functions. `cdecl-unwind` functions MUST NOT have this attribute. We diff --git a/tests/codegen/unwind-abis/fastcall-unwind-abi.rs b/tests/codegen/unwind-abis/fastcall-unwind-abi.rs index b74099a5d965..18e2cd22c8aa 100644 --- a/tests/codegen/unwind-abis/fastcall-unwind-abi.rs +++ b/tests/codegen/unwind-abis/fastcall-unwind-abi.rs @@ -1,5 +1,5 @@ -// needs-llvm-components: x86 -// compile-flags: --target=i686-pc-windows-msvc --crate-type=rlib -Cno-prepopulate-passes +//@ needs-llvm-components: x86 +//@ compile-flags: --target=i686-pc-windows-msvc --crate-type=rlib -Cno-prepopulate-passes #![no_core] #![feature(no_core, lang_items, c_unwind)] #[lang="sized"] diff --git a/tests/codegen/unwind-abis/nounwind-on-stable-panic-abort.rs b/tests/codegen/unwind-abis/nounwind-on-stable-panic-abort.rs index 106d593b21de..0b3bfd567aa6 100644 --- a/tests/codegen/unwind-abis/nounwind-on-stable-panic-abort.rs +++ b/tests/codegen/unwind-abis/nounwind-on-stable-panic-abort.rs @@ -1,5 +1,5 @@ -// compile-flags: -C opt-level=0 -Cpanic=abort -// ignore-wasm32-bare compiled with panic=abort by default +//@ compile-flags: -C opt-level=0 -Cpanic=abort +//@ ignore-wasm32-bare compiled with panic=abort by default #![crate_type = "lib"] diff --git a/tests/codegen/unwind-abis/nounwind-on-stable-panic-unwind.rs b/tests/codegen/unwind-abis/nounwind-on-stable-panic-unwind.rs index dc3911cd4eba..1e6f8c9ede90 100644 --- a/tests/codegen/unwind-abis/nounwind-on-stable-panic-unwind.rs +++ b/tests/codegen/unwind-abis/nounwind-on-stable-panic-unwind.rs @@ -1,6 +1,6 @@ -// compile-flags: -C opt-level=0 -// ignore-wasm32-bare compiled with panic=abort by default -// needs-unwind +//@ compile-flags: -C opt-level=0 +//@ ignore-wasm32-bare compiled with panic=abort by default +//@ needs-unwind #![crate_type = "lib"] diff --git a/tests/codegen/unwind-abis/nounwind.rs b/tests/codegen/unwind-abis/nounwind.rs index c46d717331b4..ac53cd7bed3c 100644 --- a/tests/codegen/unwind-abis/nounwind.rs +++ b/tests/codegen/unwind-abis/nounwind.rs @@ -1,5 +1,5 @@ -// compile-flags: -C opt-level=0 -Cpanic=abort -// ignore-wasm32-bare compiled with panic=abort by default +//@ compile-flags: -C opt-level=0 -Cpanic=abort +//@ ignore-wasm32-bare compiled with panic=abort by default #![crate_type = "lib"] #![feature(c_unwind)] diff --git a/tests/codegen/unwind-abis/stdcall-unwind-abi.rs b/tests/codegen/unwind-abis/stdcall-unwind-abi.rs index 8eff0719f8fa..a5e600fe076f 100644 --- a/tests/codegen/unwind-abis/stdcall-unwind-abi.rs +++ b/tests/codegen/unwind-abis/stdcall-unwind-abi.rs @@ -1,5 +1,5 @@ -// needs-llvm-components: x86 -// compile-flags: --target=i686-pc-windows-msvc --crate-type=rlib -Cno-prepopulate-passes +//@ needs-llvm-components: x86 +//@ compile-flags: --target=i686-pc-windows-msvc --crate-type=rlib -Cno-prepopulate-passes #![no_core] #![feature(no_core, lang_items, c_unwind)] #[lang="sized"] diff --git a/tests/codegen/unwind-abis/system-unwind-abi.rs b/tests/codegen/unwind-abis/system-unwind-abi.rs index f274a33b0994..b001c1f951c4 100644 --- a/tests/codegen/unwind-abis/system-unwind-abi.rs +++ b/tests/codegen/unwind-abis/system-unwind-abi.rs @@ -1,5 +1,5 @@ -// compile-flags: -C opt-level=0 -// needs-unwind +//@ compile-flags: -C opt-level=0 +//@ needs-unwind // Test that `nounwind` attributes are correctly applied to exported `system` and `system-unwind` // extern functions. `system-unwind` functions MUST NOT have this attribute. We disable diff --git a/tests/codegen/unwind-abis/sysv64-unwind-abi.rs b/tests/codegen/unwind-abis/sysv64-unwind-abi.rs index 694fde17c3cb..49407f748bc3 100644 --- a/tests/codegen/unwind-abis/sysv64-unwind-abi.rs +++ b/tests/codegen/unwind-abis/sysv64-unwind-abi.rs @@ -1,5 +1,5 @@ -// needs-llvm-components: x86 -// compile-flags: --target=x86_64-unknown-linux-gnu --crate-type=rlib -Cno-prepopulate-passes +//@ needs-llvm-components: x86 +//@ compile-flags: --target=x86_64-unknown-linux-gnu --crate-type=rlib -Cno-prepopulate-passes #![no_core] #![feature(no_core, lang_items, c_unwind)] #[lang="sized"] diff --git a/tests/codegen/unwind-abis/thiscall-unwind-abi.rs b/tests/codegen/unwind-abis/thiscall-unwind-abi.rs index 0a02755a2cd8..d07e9b81d783 100644 --- a/tests/codegen/unwind-abis/thiscall-unwind-abi.rs +++ b/tests/codegen/unwind-abis/thiscall-unwind-abi.rs @@ -1,5 +1,5 @@ -// needs-llvm-components: x86 -// compile-flags: --target=i686-pc-windows-msvc --crate-type=rlib -Cno-prepopulate-passes +//@ needs-llvm-components: x86 +//@ compile-flags: --target=i686-pc-windows-msvc --crate-type=rlib -Cno-prepopulate-passes #![no_core] #![feature(no_core, lang_items, c_unwind)] #[lang="sized"] diff --git a/tests/codegen/unwind-abis/vectorcall-unwind-abi.rs b/tests/codegen/unwind-abis/vectorcall-unwind-abi.rs index d7eca2a97000..a89794fbf6e3 100644 --- a/tests/codegen/unwind-abis/vectorcall-unwind-abi.rs +++ b/tests/codegen/unwind-abis/vectorcall-unwind-abi.rs @@ -1,5 +1,5 @@ -// needs-llvm-components: x86 -// compile-flags: --target=i686-pc-windows-msvc --crate-type=rlib -Cno-prepopulate-passes +//@ needs-llvm-components: x86 +//@ compile-flags: --target=i686-pc-windows-msvc --crate-type=rlib -Cno-prepopulate-passes #![no_core] #![feature(no_core, lang_items, c_unwind, abi_vectorcall)] #[lang="sized"] diff --git a/tests/codegen/unwind-abis/win64-unwind-abi.rs b/tests/codegen/unwind-abis/win64-unwind-abi.rs index 6591348c35d3..aa466469c4de 100644 --- a/tests/codegen/unwind-abis/win64-unwind-abi.rs +++ b/tests/codegen/unwind-abis/win64-unwind-abi.rs @@ -1,5 +1,5 @@ -// needs-llvm-components: x86 -// compile-flags: --target=x86_64-unknown-linux-gnu --crate-type=rlib -Cno-prepopulate-passes +//@ needs-llvm-components: x86 +//@ compile-flags: --target=x86_64-unknown-linux-gnu --crate-type=rlib -Cno-prepopulate-passes #![no_core] #![feature(no_core, lang_items, c_unwind)] #[lang="sized"] diff --git a/tests/codegen/unwind-and-panic-abort.rs b/tests/codegen/unwind-and-panic-abort.rs index e43e73b96b99..430502308cf0 100644 --- a/tests/codegen/unwind-and-panic-abort.rs +++ b/tests/codegen/unwind-and-panic-abort.rs @@ -1,4 +1,4 @@ -// compile-flags: -C panic=abort +//@ compile-flags: -C panic=abort #![crate_type = "lib"] #![feature(c_unwind)] diff --git a/tests/codegen/unwind-extern-exports.rs b/tests/codegen/unwind-extern-exports.rs index 4e1e719d5cd1..d670a776ac69 100644 --- a/tests/codegen/unwind-extern-exports.rs +++ b/tests/codegen/unwind-extern-exports.rs @@ -1,6 +1,6 @@ -// compile-flags: -C opt-level=0 -// ignore-wasm32-bare compiled with panic=abort by default -// needs-unwind +//@ compile-flags: -C opt-level=0 +//@ ignore-wasm32-bare compiled with panic=abort by default +//@ needs-unwind #![crate_type = "lib"] #![feature(c_unwind)] diff --git a/tests/codegen/unwind-extern-imports.rs b/tests/codegen/unwind-extern-imports.rs index 260dcc628cc0..7386704b4309 100644 --- a/tests/codegen/unwind-extern-imports.rs +++ b/tests/codegen/unwind-extern-imports.rs @@ -1,6 +1,6 @@ -// compile-flags: -C no-prepopulate-passes -// ignore-wasm32-bare compiled with panic=abort by default -// needs-unwind +//@ compile-flags: -C no-prepopulate-passes +//@ ignore-wasm32-bare compiled with panic=abort by default +//@ needs-unwind #![crate_type = "lib"] #![feature(c_unwind)] diff --git a/tests/codegen/unwind-landingpad-cold.rs b/tests/codegen/unwind-landingpad-cold.rs index 3a902a7d7123..fa200bc300cf 100644 --- a/tests/codegen/unwind-landingpad-cold.rs +++ b/tests/codegen/unwind-landingpad-cold.rs @@ -1,6 +1,6 @@ -// compile-flags: -Cno-prepopulate-passes -// needs-unwind -// min-llvm-version: 17.0.2 +//@ compile-flags: -Cno-prepopulate-passes +//@ needs-unwind +//@ min-llvm-version: 17.0.2 #![crate_type = "lib"] // This test checks that drop calls in unwind landing pads diff --git a/tests/codegen/unwind-landingpad-inline.rs b/tests/codegen/unwind-landingpad-inline.rs index 0774cefdd2d1..77ef8d2a5fe7 100644 --- a/tests/codegen/unwind-landingpad-inline.rs +++ b/tests/codegen/unwind-landingpad-inline.rs @@ -1,6 +1,5 @@ -// min-llvm-version: 17.0.2 -// compile-flags: -Copt-level=3 -// ignore-debug: the debug assertions get in the way +//@ min-llvm-version: 17.0.2 +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] // This test checks that we can inline drop_in_place in diff --git a/tests/codegen/var-names.rs b/tests/codegen/var-names.rs index d4715efad73c..fd163a55551b 100644 --- a/tests/codegen/var-names.rs +++ b/tests/codegen/var-names.rs @@ -1,4 +1,4 @@ -// compile-flags: -O -C no-prepopulate-passes +//@ compile-flags: -O -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/tests/codegen/vec-as-ptr.rs b/tests/codegen/vec-as-ptr.rs index 76098bc08a31..17869c21c832 100644 --- a/tests/codegen/vec-as-ptr.rs +++ b/tests/codegen/vec-as-ptr.rs @@ -1,4 +1,4 @@ -// compile-flags: -O -Zmerge-functions=disabled +//@ compile-flags: -O -Zmerge-functions=disabled #![crate_type = "lib"] diff --git a/tests/codegen/vec-calloc.rs b/tests/codegen/vec-calloc.rs index a5fda7b2449a..f88ed7ae8a55 100644 --- a/tests/codegen/vec-calloc.rs +++ b/tests/codegen/vec-calloc.rs @@ -1,6 +1,5 @@ -// compile-flags: -O -Z merge-functions=disabled -// only-x86_64 -// ignore-debug +//@ compile-flags: -O -Z merge-functions=disabled +//@ only-x86_64 #![crate_type = "lib"] diff --git a/tests/codegen/vec-in-place.rs b/tests/codegen/vec-in-place.rs index 5cf7add836df..7a175dc4f7e1 100644 --- a/tests/codegen/vec-in-place.rs +++ b/tests/codegen/vec-in-place.rs @@ -1,5 +1,5 @@ -// ignore-debug: the debug assertions get in the way -// compile-flags: -O -Z merge-functions=disabled +//@ ignore-debug: FIXME: checks for call detect scoped noalias metadata +//@ compile-flags: -O -Z merge-functions=disabled #![crate_type = "lib"] // Ensure that trivial casts of vec elements are O(1) diff --git a/tests/codegen/vec-iter-collect-len.rs b/tests/codegen/vec-iter-collect-len.rs index 3a0d6c309192..e4242c574023 100644 --- a/tests/codegen/vec-iter-collect-len.rs +++ b/tests/codegen/vec-iter-collect-len.rs @@ -1,5 +1,4 @@ -// ignore-debug: the debug assertions get in the way -// compile-flags: -O +//@ compile-flags: -O #![crate_type="lib"] #[no_mangle] diff --git a/tests/codegen/vec-iter.rs b/tests/codegen/vec-iter.rs index 4e2068587510..310680969c4f 100644 --- a/tests/codegen/vec-iter.rs +++ b/tests/codegen/vec-iter.rs @@ -1,5 +1,4 @@ -// ignore-debug: the debug assertions get in the way -// compile-flags: -O +//@ compile-flags: -O #![crate_type = "lib"] #![feature(exact_size_is_empty)] diff --git a/tests/codegen/vec-optimizes-away.rs b/tests/codegen/vec-optimizes-away.rs index 3be342dabeb6..77a94b0b4294 100644 --- a/tests/codegen/vec-optimizes-away.rs +++ b/tests/codegen/vec-optimizes-away.rs @@ -1,5 +1,4 @@ -// ignore-debug: the debug assertions get in the way -// compile-flags: -O +//@ compile-flags: -O #![crate_type = "lib"] #[no_mangle] diff --git a/tests/codegen/vec-reserve-extend.rs b/tests/codegen/vec-reserve-extend.rs index 395373ff4f10..1f00f7d20633 100644 --- a/tests/codegen/vec-reserve-extend.rs +++ b/tests/codegen/vec-reserve-extend.rs @@ -1,6 +1,4 @@ -// compile-flags: -O -// ignore-debug -// (with debug assertions turned on, `assert_unchecked` generates a real assertion) +//@ compile-flags: -O #![crate_type = "lib"] diff --git a/tests/codegen/vec-shrink-panik.rs b/tests/codegen/vec-shrink-panik.rs index 14fef4e2cd55..4e996b234f98 100644 --- a/tests/codegen/vec-shrink-panik.rs +++ b/tests/codegen/vec-shrink-panik.rs @@ -1,11 +1,11 @@ -// revisions: old new +//@ revisions: old new // LLVM 17 realizes double panic is not possible and doesn't generate calls // to panic_cannot_unwind. -// [old]ignore-llvm-version: 17 - 99 -// [new]min-llvm-version: 17 -// compile-flags: -O -// ignore-debug: the debug assertions get in the way -// needs-unwind +//@ [old]ignore-llvm-version: 17 - 99 +//@ [new]min-llvm-version: 17 +//@ compile-flags: -O +//@ ignore-debug: plain old debug assertions +//@ needs-unwind #![crate_type = "lib"] #![feature(shrink_to)] diff --git a/tests/codegen/vec_pop_push_noop.rs b/tests/codegen/vec_pop_push_noop.rs index d9293f2b75de..83765d108541 100644 --- a/tests/codegen/vec_pop_push_noop.rs +++ b/tests/codegen/vec_pop_push_noop.rs @@ -1,6 +1,4 @@ -// compile-flags: -O -// ignore-debug -// (with debug assertions turned on, `assert_unchecked` generates a real assertion) +//@ compile-flags: -O #![crate_type = "lib"] diff --git a/tests/codegen/vecdeque-drain.rs b/tests/codegen/vecdeque-drain.rs index f8263c695724..31fcf035f115 100644 --- a/tests/codegen/vecdeque-drain.rs +++ b/tests/codegen/vecdeque-drain.rs @@ -1,7 +1,7 @@ // Check that draining at the front or back doesn't copy memory. -// compile-flags: -O -// ignore-debug: the debug assertions get in the way +//@ compile-flags: -O +//@ ignore-debug: FIXME: checks for call detect scoped noalias metadata #![crate_type = "lib"] diff --git a/tests/codegen/vecdeque-nonempty-get-no-panic.rs b/tests/codegen/vecdeque-nonempty-get-no-panic.rs index c2877d2d0ca9..3f802de9eeed 100644 --- a/tests/codegen/vecdeque-nonempty-get-no-panic.rs +++ b/tests/codegen/vecdeque-nonempty-get-no-panic.rs @@ -1,7 +1,6 @@ // Guards against regression for optimization discussed in issue #80836 -// compile-flags: -O -// ignore-debug: the debug assertions get in the way +//@ compile-flags: -O #![crate_type = "lib"] diff --git a/tests/codegen/vecdeque_no_panic.rs b/tests/codegen/vecdeque_no_panic.rs index cbf420bada99..be2c4810ebc4 100644 --- a/tests/codegen/vecdeque_no_panic.rs +++ b/tests/codegen/vecdeque_no_panic.rs @@ -1,7 +1,7 @@ // This test checks that `VecDeque::front[_mut]()` and `VecDeque::back[_mut]()` can't panic. -// compile-flags: -O -// ignore-debug: the debug assertions get in the way +//@ compile-flags: -O +//@ ignore-debug: plain old debug assertions #![crate_type = "lib"] diff --git a/tests/codegen/virtual-function-elimination-32bit.rs b/tests/codegen/virtual-function-elimination-32bit.rs index 6f963363a998..76223be1f3da 100644 --- a/tests/codegen/virtual-function-elimination-32bit.rs +++ b/tests/codegen/virtual-function-elimination-32bit.rs @@ -1,5 +1,5 @@ -// compile-flags: -Zvirtual-function-elimination -Clto -O -Csymbol-mangling-version=v0 -// ignore-64bit +//@ compile-flags: -Zvirtual-function-elimination -Clto -O -Csymbol-mangling-version=v0 +//@ ignore-64bit // CHECK: @vtable.0 = {{.*}}, !type ![[TYPE0:[0-9]+]], !vcall_visibility ![[VCALL_VIS0:[0-9]+]] diff --git a/tests/codegen/virtual-function-elimination.rs b/tests/codegen/virtual-function-elimination.rs index f22176a024fc..6c391d9114b4 100644 --- a/tests/codegen/virtual-function-elimination.rs +++ b/tests/codegen/virtual-function-elimination.rs @@ -1,6 +1,5 @@ -// compile-flags: -Zvirtual-function-elimination -Clto -O -Csymbol-mangling-version=v0 -// ignore-32bit -// ignore-debug +//@ compile-flags: -Zvirtual-function-elimination -Clto -O -Csymbol-mangling-version=v0 +//@ ignore-32bit // CHECK: @vtable.0 = {{.*}}, !type ![[TYPE0:[0-9]+]], !vcall_visibility ![[VCALL_VIS0:[0-9]+]] // CHECK: @vtable.1 = {{.*}}, !type ![[TYPE1:[0-9]+]], !vcall_visibility ![[VCALL_VIS0:[0-9]+]] diff --git a/tests/codegen/wasm_casts_trapping.rs b/tests/codegen/wasm_casts_trapping.rs index eb06c4975bb7..0908acd85fcb 100644 --- a/tests/codegen/wasm_casts_trapping.rs +++ b/tests/codegen/wasm_casts_trapping.rs @@ -1,5 +1,5 @@ -// only-wasm32 -// compile-flags: -C target-feature=-nontrapping-fptoint +//@ only-wasm32 +//@ compile-flags: -C target-feature=-nontrapping-fptoint #![crate_type = "lib"] // CHECK-LABEL: @cast_f64_i64 diff --git a/tests/codegen/wasm_exceptions.rs b/tests/codegen/wasm_exceptions.rs index 2b2359f5b6ca..48a7357bfd8d 100644 --- a/tests/codegen/wasm_exceptions.rs +++ b/tests/codegen/wasm_exceptions.rs @@ -1,5 +1,5 @@ -// only-wasm32-bare -// compile-flags: -C panic=unwind +//@ only-wasm32-bare +//@ compile-flags: -C panic=unwind #![crate_type = "lib"] #![feature(core_intrinsics)] diff --git a/tests/codegen/zip.rs b/tests/codegen/zip.rs index e55f4f1a2de3..5db0a93b78ef 100644 --- a/tests/codegen/zip.rs +++ b/tests/codegen/zip.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes -O +//@ compile-flags: -C no-prepopulate-passes -O #![crate_type = "lib"] diff --git a/tests/codegen/zst-offset.rs b/tests/codegen/zst-offset.rs index 56dfd96ab2cf..ad996d8ae1b6 100644 --- a/tests/codegen/zst-offset.rs +++ b/tests/codegen/zst-offset.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes -Copt-level=0 +//@ compile-flags: -C no-prepopulate-passes -Copt-level=0 #![crate_type = "lib"] #![feature(repr_simd)] diff --git a/tests/coverage-run-rustdoc/doctest.coverage b/tests/coverage-run-rustdoc/doctest.coverage index 5125dc075ee2..1bbf364759ba 100644 --- a/tests/coverage-run-rustdoc/doctest.coverage +++ b/tests/coverage-run-rustdoc/doctest.coverage @@ -10,7 +10,7 @@ $DIR/auxiliary/doctest_crate.rs: LL| 3|} $DIR/doctest.rs: - LL| |// aux-build:doctest_crate.rs + LL| |//@ aux-build:doctest_crate.rs LL| | LL| |//! This test ensures that code from doctests is properly re-mapped. LL| |//! See for more info. diff --git a/tests/coverage-run-rustdoc/doctest.rs b/tests/coverage-run-rustdoc/doctest.rs index 4006d723ce02..ddf493ae1f29 100644 --- a/tests/coverage-run-rustdoc/doctest.rs +++ b/tests/coverage-run-rustdoc/doctest.rs @@ -1,4 +1,4 @@ -// aux-build:doctest_crate.rs +//@ aux-build:doctest_crate.rs //! This test ensures that code from doctests is properly re-mapped. //! See for more info. diff --git a/tests/coverage/assert.coverage b/tests/coverage/assert.coverage index 8b997724c4a7..22fb6821fba3 100644 --- a/tests/coverage/assert.coverage +++ b/tests/coverage/assert.coverage @@ -1,5 +1,5 @@ LL| |#![allow(unused_assignments)] - LL| |// failure-status: 101 + LL| |//@ failure-status: 101 LL| | LL| 4|fn might_fail_assert(one_plus_one: u32) { LL| 4| println!("does 1 + 1 = {}?", one_plus_one); diff --git a/tests/coverage/assert.rs b/tests/coverage/assert.rs index 85e6662a6adc..bb7741bedbb5 100644 --- a/tests/coverage/assert.rs +++ b/tests/coverage/assert.rs @@ -1,5 +1,5 @@ #![allow(unused_assignments)] -// failure-status: 101 +//@ failure-status: 101 fn might_fail_assert(one_plus_one: u32) { println!("does 1 + 1 = {}?", one_plus_one); diff --git a/tests/coverage/assert_not.coverage b/tests/coverage/assert_not.coverage index 4cfdab974ed4..fd8247630c0e 100644 --- a/tests/coverage/assert_not.coverage +++ b/tests/coverage/assert_not.coverage @@ -1,4 +1,4 @@ - LL| |// edition: 2021 + LL| |//@ edition: 2021 LL| | LL| |// Regression test for . LL| |// `assert!(true)` and `assert!(!false)` should have similar coverage spans. diff --git a/tests/coverage/assert_not.rs b/tests/coverage/assert_not.rs index 95204fcadd1c..3d882f97d46d 100644 --- a/tests/coverage/assert_not.rs +++ b/tests/coverage/assert_not.rs @@ -1,4 +1,4 @@ -// edition: 2021 +//@ edition: 2021 // Regression test for . // `assert!(true)` and `assert!(!false)` should have similar coverage spans. diff --git a/tests/coverage/async.coverage b/tests/coverage/async.coverage index b4f6fc3a8a21..e943911d3104 100644 --- a/tests/coverage/async.coverage +++ b/tests/coverage/async.coverage @@ -3,8 +3,8 @@ LL| |#![feature(noop_waker)] LL| |#![allow(unused_assignments, dead_code)] LL| |#![rustfmt::skip] - LL| |// edition: 2018 - LL| |// compile-flags: -Copt-level=1 + LL| |//@ edition: 2018 + LL| |//@ compile-flags: -Copt-level=1 LL| | LL| 1|async fn c(x: u8) -> u8 { LL| 1| if x == 8 { diff --git a/tests/coverage/async.rs b/tests/coverage/async.rs index 6047cb79fb1b..5018ade0125f 100644 --- a/tests/coverage/async.rs +++ b/tests/coverage/async.rs @@ -3,8 +3,8 @@ #![feature(noop_waker)] #![allow(unused_assignments, dead_code)] #![rustfmt::skip] -// edition: 2018 -// compile-flags: -Copt-level=1 +//@ edition: 2018 +//@ compile-flags: -Copt-level=1 async fn c(x: u8) -> u8 { if x == 8 { diff --git a/tests/coverage/async2.coverage b/tests/coverage/async2.coverage index a69eefe72cbc..bd5b701491b5 100644 --- a/tests/coverage/async2.coverage +++ b/tests/coverage/async2.coverage @@ -1,6 +1,6 @@ LL| |#![feature(coverage_attribute)] LL| |#![feature(noop_waker)] - LL| |// edition: 2018 + LL| |//@ edition: 2018 LL| | LL| 1|fn non_async_func() { LL| 1| println!("non_async_func was covered"); diff --git a/tests/coverage/async2.rs b/tests/coverage/async2.rs index ae83f0103e64..713c70d277a7 100644 --- a/tests/coverage/async2.rs +++ b/tests/coverage/async2.rs @@ -1,6 +1,6 @@ #![feature(coverage_attribute)] #![feature(noop_waker)] -// edition: 2018 +//@ edition: 2018 fn non_async_func() { println!("non_async_func was covered"); diff --git a/tests/coverage/async_block.coverage b/tests/coverage/async_block.coverage index 0e24b80124f4..7fd17bc51c3e 100644 --- a/tests/coverage/async_block.coverage +++ b/tests/coverage/async_block.coverage @@ -1,6 +1,6 @@ LL| |#![feature(coverage_attribute)] LL| |#![feature(noop_waker)] - LL| |// edition: 2021 + LL| |//@ edition: 2021 LL| | LL| 1|fn main() { LL| 17| for i in 0..16 { diff --git a/tests/coverage/async_block.rs b/tests/coverage/async_block.rs index f94bcfe31937..a70dd7470327 100644 --- a/tests/coverage/async_block.rs +++ b/tests/coverage/async_block.rs @@ -1,6 +1,6 @@ #![feature(coverage_attribute)] #![feature(noop_waker)] -// edition: 2021 +//@ edition: 2021 fn main() { for i in 0..16 { diff --git a/tests/coverage/auxiliary/inline_always_with_dead_code.rs b/tests/coverage/auxiliary/inline_always_with_dead_code.rs index 9dc50dae25ae..99ba5e743689 100644 --- a/tests/coverage/auxiliary/inline_always_with_dead_code.rs +++ b/tests/coverage/auxiliary/inline_always_with_dead_code.rs @@ -1,4 +1,4 @@ -// compile-flags: -Cinstrument-coverage -Ccodegen-units=4 -Copt-level=0 +//@ compile-flags: -Cinstrument-coverage -Ccodegen-units=4 -Copt-level=0 #![allow(dead_code)] diff --git a/tests/coverage/auxiliary/macro_name_span_helper.rs b/tests/coverage/auxiliary/macro_name_span_helper.rs index 6797c081d938..ff1e4a9fca1d 100644 --- a/tests/coverage/auxiliary/macro_name_span_helper.rs +++ b/tests/coverage/auxiliary/macro_name_span_helper.rs @@ -1,4 +1,4 @@ -// edition: 2021 +//@ edition: 2021 #[macro_export] macro_rules! macro_that_defines_a_function { diff --git a/tests/coverage/auxiliary/used_crate.rs b/tests/coverage/auxiliary/used_crate.rs index c086ef21e1a9..22837ef6d3cb 100644 --- a/tests/coverage/auxiliary/used_crate.rs +++ b/tests/coverage/auxiliary/used_crate.rs @@ -1,6 +1,6 @@ #![allow(unused_assignments, unused_variables)] // Verify that coverage works with optimizations: -// compile-flags: -C opt-level=3 +//@ compile-flags: -C opt-level=3 use std::fmt::Debug; diff --git a/tests/coverage/auxiliary/used_inline_crate.rs b/tests/coverage/auxiliary/used_inline_crate.rs index e8929de6b360..d5fe7478aa41 100644 --- a/tests/coverage/auxiliary/used_inline_crate.rs +++ b/tests/coverage/auxiliary/used_inline_crate.rs @@ -1,6 +1,6 @@ #![allow(unused_assignments, unused_variables)] // Verify that coverage works with optimizations: -// compile-flags: -C opt-level=3 +//@ compile-flags: -C opt-level=3 use std::fmt::Debug; diff --git a/tests/coverage/bad_counter_ids.coverage b/tests/coverage/bad_counter_ids.coverage index 39e6cae11dda..f6c69913cdd2 100644 --- a/tests/coverage/bad_counter_ids.coverage +++ b/tests/coverage/bad_counter_ids.coverage @@ -1,6 +1,6 @@ LL| |#![feature(coverage_attribute)] - LL| |// edition: 2021 - LL| |// compile-flags: -Copt-level=0 -Zmir-opt-level=3 + LL| |//@ edition: 2021 + LL| |//@ compile-flags: -Copt-level=0 -Zmir-opt-level=3 LL| | LL| |// Regression test for . LL| |// diff --git a/tests/coverage/bad_counter_ids.rs b/tests/coverage/bad_counter_ids.rs index e22b96468abd..ef31d682e4f1 100644 --- a/tests/coverage/bad_counter_ids.rs +++ b/tests/coverage/bad_counter_ids.rs @@ -1,6 +1,6 @@ #![feature(coverage_attribute)] -// edition: 2021 -// compile-flags: -Copt-level=0 -Zmir-opt-level=3 +//@ edition: 2021 +//@ compile-flags: -Copt-level=0 -Zmir-opt-level=3 // Regression test for . // diff --git a/tests/coverage/bench.coverage b/tests/coverage/bench.coverage index 64945dc64150..aed780a959cf 100644 --- a/tests/coverage/bench.coverage +++ b/tests/coverage/bench.coverage @@ -1,6 +1,6 @@ LL| |#![feature(test)] - LL| |// edition: 2021 - LL| |// compile-flags: --test + LL| |//@ edition: 2021 + LL| |//@ compile-flags: --test LL| | LL| |extern crate test; LL| | diff --git a/tests/coverage/bench.rs b/tests/coverage/bench.rs index 2dcd7355b2f7..b1aa42aabd7f 100644 --- a/tests/coverage/bench.rs +++ b/tests/coverage/bench.rs @@ -1,6 +1,6 @@ #![feature(test)] -// edition: 2021 -// compile-flags: --test +//@ edition: 2021 +//@ compile-flags: --test extern crate test; diff --git a/tests/coverage/closure.coverage b/tests/coverage/closure.coverage index 58224eeaf626..2f040b39f88a 100644 --- a/tests/coverage/closure.coverage +++ b/tests/coverage/closure.coverage @@ -1,5 +1,5 @@ LL| |#![allow(unused_assignments, unused_variables)] - LL| |// compile-flags: -C opt-level=2 + LL| |//@ compile-flags: -C opt-level=2 LL| | LL| |// This test used to be sensitive to certain coverage-specific hacks in LL| |// `rustc_middle/mir/mono.rs`, but those hacks were later cleaned up by diff --git a/tests/coverage/closure.rs b/tests/coverage/closure.rs index 4be78062f3f5..1e433b61a6c3 100644 --- a/tests/coverage/closure.rs +++ b/tests/coverage/closure.rs @@ -1,5 +1,5 @@ #![allow(unused_assignments, unused_variables)] -// compile-flags: -C opt-level=2 +//@ compile-flags: -C opt-level=2 // This test used to be sensitive to certain coverage-specific hacks in // `rustc_middle/mir/mono.rs`, but those hacks were later cleaned up by diff --git a/tests/coverage/closure_macro.coverage b/tests/coverage/closure_macro.coverage index 716d75cb8d75..00022bbff89f 100644 --- a/tests/coverage/closure_macro.coverage +++ b/tests/coverage/closure_macro.coverage @@ -1,4 +1,4 @@ - LL| |// edition: 2018 + LL| |//@ edition: 2018 LL| | LL| |macro_rules! bail { LL| | ($msg:literal $(,)?) => { diff --git a/tests/coverage/closure_macro.rs b/tests/coverage/closure_macro.rs index 6fe1212de8d0..8b6ca4819144 100644 --- a/tests/coverage/closure_macro.rs +++ b/tests/coverage/closure_macro.rs @@ -1,4 +1,4 @@ -// edition: 2018 +//@ edition: 2018 macro_rules! bail { ($msg:literal $(,)?) => { diff --git a/tests/coverage/closure_macro_async.coverage b/tests/coverage/closure_macro_async.coverage index 1032e027cd97..0557ce47d687 100644 --- a/tests/coverage/closure_macro_async.coverage +++ b/tests/coverage/closure_macro_async.coverage @@ -1,6 +1,6 @@ LL| |#![feature(coverage_attribute)] LL| |#![feature(noop_waker)] - LL| |// edition: 2018 + LL| |//@ edition: 2018 LL| | LL| |macro_rules! bail { LL| | ($msg:literal $(,)?) => { diff --git a/tests/coverage/closure_macro_async.rs b/tests/coverage/closure_macro_async.rs index db656fca1983..735214629b6f 100644 --- a/tests/coverage/closure_macro_async.rs +++ b/tests/coverage/closure_macro_async.rs @@ -1,6 +1,6 @@ #![feature(coverage_attribute)] #![feature(noop_waker)] -// edition: 2018 +//@ edition: 2018 macro_rules! bail { ($msg:literal $(,)?) => { diff --git a/tests/coverage/closure_unit_return.coverage b/tests/coverage/closure_unit_return.coverage index 1056baa385cb..5e57e0db1600 100644 --- a/tests/coverage/closure_unit_return.coverage +++ b/tests/coverage/closure_unit_return.coverage @@ -1,5 +1,5 @@ LL| |#![feature(coverage_attribute)] - LL| |// edition: 2021 + LL| |//@ edition: 2021 LL| | LL| |// Regression test for an inconsistency between functions that return the value LL| |// of their trailing expression, and functions that implicitly return `()`. diff --git a/tests/coverage/closure_unit_return.rs b/tests/coverage/closure_unit_return.rs index d2b4ab8bd9ff..d4f139dd363b 100644 --- a/tests/coverage/closure_unit_return.rs +++ b/tests/coverage/closure_unit_return.rs @@ -1,5 +1,5 @@ #![feature(coverage_attribute)] -// edition: 2021 +//@ edition: 2021 // Regression test for an inconsistency between functions that return the value // of their trailing expression, and functions that implicitly return `()`. diff --git a/tests/coverage/color.coverage b/tests/coverage/color.coverage index bc49fff9cb75..b12f20204b4f 100644 --- a/tests/coverage/color.coverage +++ b/tests/coverage/color.coverage @@ -1,7 +1,7 @@ - LL| |// edition: 2021 - LL| |// ignore-mode-coverage-map - LL| |// ignore-windows - LL| |// llvm-cov-flags: --use-color + LL| |//@ edition: 2021 + LL| |//@ ignore-mode-coverage-map + LL| |//@ ignore-windows + LL| |//@ llvm-cov-flags: --use-color LL| | LL| |// Verify that telling `llvm-cov` to use colored output actually works. LL| |// Ignored on Windows because we can't tell the tool to use ANSI escapes. diff --git a/tests/coverage/color.rs b/tests/coverage/color.rs index bd727946c781..144e798ba5d7 100644 --- a/tests/coverage/color.rs +++ b/tests/coverage/color.rs @@ -1,7 +1,7 @@ -// edition: 2021 -// ignore-mode-coverage-map -// ignore-windows -// llvm-cov-flags: --use-color +//@ edition: 2021 +//@ ignore-mode-coverage-map +//@ ignore-windows +//@ llvm-cov-flags: --use-color // Verify that telling `llvm-cov` to use colored output actually works. // Ignored on Windows because we can't tell the tool to use ANSI escapes. diff --git a/tests/coverage/coverage_attr_closure.coverage b/tests/coverage/coverage_attr_closure.coverage index 3474ad65063e..7bdb96bdab85 100644 --- a/tests/coverage/coverage_attr_closure.coverage +++ b/tests/coverage/coverage_attr_closure.coverage @@ -1,6 +1,6 @@ LL| |#![feature(coverage_attribute, stmt_expr_attributes)] LL| |#![allow(dead_code)] - LL| |// edition: 2021 + LL| |//@ edition: 2021 LL| | LL| |static GLOBAL_CLOSURE_ON: fn(&str) = #[coverage(on)] LL| 0||input: &str| { diff --git a/tests/coverage/coverage_attr_closure.rs b/tests/coverage/coverage_attr_closure.rs index 1904c89c9204..4341a868ab84 100644 --- a/tests/coverage/coverage_attr_closure.rs +++ b/tests/coverage/coverage_attr_closure.rs @@ -1,6 +1,6 @@ #![feature(coverage_attribute, stmt_expr_attributes)] #![allow(dead_code)] -// edition: 2021 +//@ edition: 2021 static GLOBAL_CLOSURE_ON: fn(&str) = #[coverage(on)] |input: &str| { diff --git a/tests/coverage/drop_trait.coverage b/tests/coverage/drop_trait.coverage index 2c9439a93b12..85d557573cf3 100644 --- a/tests/coverage/drop_trait.coverage +++ b/tests/coverage/drop_trait.coverage @@ -1,5 +1,5 @@ LL| |#![allow(unused_assignments)] - LL| |// failure-status: 1 + LL| |//@ failure-status: 1 LL| | LL| |struct Firework { LL| | strength: i32, diff --git a/tests/coverage/drop_trait.rs b/tests/coverage/drop_trait.rs index 7b062719c6b0..5a723eb9e833 100644 --- a/tests/coverage/drop_trait.rs +++ b/tests/coverage/drop_trait.rs @@ -1,5 +1,5 @@ #![allow(unused_assignments)] -// failure-status: 1 +//@ failure-status: 1 struct Firework { strength: i32, diff --git a/tests/coverage/fn_sig_into_try.coverage b/tests/coverage/fn_sig_into_try.coverage index aac5c9d9a94e..cabe747ce5ac 100644 --- a/tests/coverage/fn_sig_into_try.coverage +++ b/tests/coverage/fn_sig_into_try.coverage @@ -1,5 +1,5 @@ LL| |#![feature(coverage_attribute)] - LL| |// edition: 2021 + LL| |//@ edition: 2021 LL| | LL| |// Regression test for inconsistent handling of function signature spans that LL| |// are followed by code using the `?` operator. diff --git a/tests/coverage/fn_sig_into_try.rs b/tests/coverage/fn_sig_into_try.rs index 5d8e7929ef97..cda5e716edf5 100644 --- a/tests/coverage/fn_sig_into_try.rs +++ b/tests/coverage/fn_sig_into_try.rs @@ -1,5 +1,5 @@ #![feature(coverage_attribute)] -// edition: 2021 +//@ edition: 2021 // Regression test for inconsistent handling of function signature spans that // are followed by code using the `?` operator. diff --git a/tests/coverage/generics.coverage b/tests/coverage/generics.coverage index c68c0be80b15..a2cd1465d26f 100644 --- a/tests/coverage/generics.coverage +++ b/tests/coverage/generics.coverage @@ -1,5 +1,5 @@ LL| |#![allow(unused_assignments)] - LL| |// failure-status: 1 + LL| |//@ failure-status: 1 LL| | LL| |struct Firework { LL| | strength: T, diff --git a/tests/coverage/generics.rs b/tests/coverage/generics.rs index fd3811b6937b..acfbd6a90836 100644 --- a/tests/coverage/generics.rs +++ b/tests/coverage/generics.rs @@ -1,5 +1,5 @@ #![allow(unused_assignments)] -// failure-status: 1 +//@ failure-status: 1 struct Firework { strength: T, diff --git a/tests/coverage/if_not.coverage b/tests/coverage/if_not.coverage index 86ff7fc4f07d..678ccf9f2f85 100644 --- a/tests/coverage/if_not.coverage +++ b/tests/coverage/if_not.coverage @@ -1,5 +1,5 @@ LL| |#![feature(coverage_attribute)] - LL| |// edition: 2021 + LL| |//@ edition: 2021 LL| | LL| |#[rustfmt::skip] LL| 12|fn if_not(cond: bool) { diff --git a/tests/coverage/if_not.rs b/tests/coverage/if_not.rs index 7b166662b5d0..69283ef2527d 100644 --- a/tests/coverage/if_not.rs +++ b/tests/coverage/if_not.rs @@ -1,5 +1,5 @@ #![feature(coverage_attribute)] -// edition: 2021 +//@ edition: 2021 #[rustfmt::skip] fn if_not(cond: bool) { diff --git a/tests/coverage/ignore_map.coverage b/tests/coverage/ignore_map.coverage index 04bcb5bec6ec..a796a7375a76 100644 --- a/tests/coverage/ignore_map.coverage +++ b/tests/coverage/ignore_map.coverage @@ -1,4 +1,4 @@ - LL| |// ignore-mode-coverage-map + LL| |//@ ignore-mode-coverage-map LL| | LL| 1|fn main() {} diff --git a/tests/coverage/ignore_map.rs b/tests/coverage/ignore_map.rs index 71b82e8fc9de..deee6e27d99b 100644 --- a/tests/coverage/ignore_map.rs +++ b/tests/coverage/ignore_map.rs @@ -1,3 +1,3 @@ -// ignore-mode-coverage-map +//@ ignore-mode-coverage-map fn main() {} diff --git a/tests/coverage/ignore_run.rs b/tests/coverage/ignore_run.rs index 87108867a057..0363524d369d 100644 --- a/tests/coverage/ignore_run.rs +++ b/tests/coverage/ignore_run.rs @@ -1,3 +1,3 @@ -// ignore-mode-coverage-run +//@ ignore-mode-coverage-run fn main() {} diff --git a/tests/coverage/inline-dead.coverage b/tests/coverage/inline-dead.coverage index a643332bce1f..a2d24fd2f6a6 100644 --- a/tests/coverage/inline-dead.coverage +++ b/tests/coverage/inline-dead.coverage @@ -1,5 +1,5 @@ LL| |// Regression test for issue #98833. - LL| |// compile-flags: -Zinline-mir -Cdebug-assertions=off + LL| |//@ compile-flags: -Zinline-mir -Cdebug-assertions=off LL| | LL| 1|fn main() { LL| 1| println!("{}", live::()); diff --git a/tests/coverage/inline-dead.rs b/tests/coverage/inline-dead.rs index a854c17f6d59..327e68c60bb7 100644 --- a/tests/coverage/inline-dead.rs +++ b/tests/coverage/inline-dead.rs @@ -1,5 +1,5 @@ // Regression test for issue #98833. -// compile-flags: -Zinline-mir -Cdebug-assertions=off +//@ compile-flags: -Zinline-mir -Cdebug-assertions=off fn main() { println!("{}", live::()); diff --git a/tests/coverage/inline.coverage b/tests/coverage/inline.coverage index 68a2e408306d..3d322126a38b 100644 --- a/tests/coverage/inline.coverage +++ b/tests/coverage/inline.coverage @@ -1,4 +1,4 @@ - LL| |// compile-flags: -Zinline-mir + LL| |//@ compile-flags: -Zinline-mir LL| | LL| |use std::fmt::Display; LL| | diff --git a/tests/coverage/inline.rs b/tests/coverage/inline.rs index 9cfab9ddbadf..04a308ea5dd9 100644 --- a/tests/coverage/inline.rs +++ b/tests/coverage/inline.rs @@ -1,4 +1,4 @@ -// compile-flags: -Zinline-mir +//@ compile-flags: -Zinline-mir use std::fmt::Display; diff --git a/tests/coverage/issue-84561.coverage b/tests/coverage/issue-84561.coverage index 90a2d069d394..2a642e2427b9 100644 --- a/tests/coverage/issue-84561.coverage +++ b/tests/coverage/issue-84561.coverage @@ -1,6 +1,6 @@ LL| |// This demonstrated Issue #84561: function-like macros produce unintuitive coverage results. LL| | - LL| |// failure-status: 101 + LL| |//@ failure-status: 101 LL| |#[derive(PartialEq, Eq)] LL| |struct Foo(u32); LL| | diff --git a/tests/coverage/issue-84561.rs b/tests/coverage/issue-84561.rs index 9c218a37e6c4..517c045a031f 100644 --- a/tests/coverage/issue-84561.rs +++ b/tests/coverage/issue-84561.rs @@ -1,6 +1,6 @@ // This demonstrated Issue #84561: function-like macros produce unintuitive coverage results. -// failure-status: 101 +//@ failure-status: 101 #[derive(PartialEq, Eq)] struct Foo(u32); diff --git a/tests/coverage/issue-85461.coverage b/tests/coverage/issue-85461.coverage index cbc910664d06..0a9cc78c2eeb 100644 --- a/tests/coverage/issue-85461.coverage +++ b/tests/coverage/issue-85461.coverage @@ -1,5 +1,5 @@ $DIR/auxiliary/inline_always_with_dead_code.rs: - LL| |// compile-flags: -Cinstrument-coverage -Ccodegen-units=4 -Copt-level=0 + LL| |//@ compile-flags: -Cinstrument-coverage -Ccodegen-units=4 -Copt-level=0 LL| | LL| |#![allow(dead_code)] LL| | @@ -25,7 +25,7 @@ $DIR/auxiliary/inline_always_with_dead_code.rs: $DIR/issue-85461.rs: LL| |// Regression test for #85461: MSVC sometimes fail to link with dead code and #[inline(always)] LL| | - LL| |// aux-build:inline_always_with_dead_code.rs + LL| |//@ aux-build:inline_always_with_dead_code.rs LL| |extern crate inline_always_with_dead_code; LL| | LL| |use inline_always_with_dead_code::{bar, baz}; diff --git a/tests/coverage/issue-85461.rs b/tests/coverage/issue-85461.rs index 9d4c90a827ee..4d8ea77ad9ce 100644 --- a/tests/coverage/issue-85461.rs +++ b/tests/coverage/issue-85461.rs @@ -1,6 +1,6 @@ // Regression test for #85461: MSVC sometimes fail to link with dead code and #[inline(always)] -// aux-build:inline_always_with_dead_code.rs +//@ aux-build:inline_always_with_dead_code.rs extern crate inline_always_with_dead_code; use inline_always_with_dead_code::{bar, baz}; diff --git a/tests/coverage/issue-93054.coverage b/tests/coverage/issue-93054.coverage index 6ae8ffb5cb4f..c3068cf428bf 100644 --- a/tests/coverage/issue-93054.coverage +++ b/tests/coverage/issue-93054.coverage @@ -1,5 +1,5 @@ LL| |#![allow(dead_code, unreachable_code)] - LL| |// edition: 2021 + LL| |//@ edition: 2021 LL| | LL| |// Regression test for #93054: Functions using uninhabited types often only have a single, LL| |// unreachable basic block which doesn't get instrumented. This should not cause llvm-cov to fail. diff --git a/tests/coverage/issue-93054.rs b/tests/coverage/issue-93054.rs index f16fc1e42396..12313cd16cf0 100644 --- a/tests/coverage/issue-93054.rs +++ b/tests/coverage/issue-93054.rs @@ -1,5 +1,5 @@ #![allow(dead_code, unreachable_code)] -// edition: 2021 +//@ edition: 2021 // Regression test for #93054: Functions using uninhabited types often only have a single, // unreachable basic block which doesn't get instrumented. This should not cause llvm-cov to fail. diff --git a/tests/coverage/long_and_wide.coverage b/tests/coverage/long_and_wide.coverage index cf4dd2811406..f0898d9f4662 100644 --- a/tests/coverage/long_and_wide.coverage +++ b/tests/coverage/long_and_wide.coverage @@ -1,4 +1,4 @@ - LL| |// edition: 2021 + LL| |//@ edition: 2021 LL| |// ignore-tidy-linelength LL| | LL| |// This file deliberately contains line and column numbers larger than 127, diff --git a/tests/coverage/long_and_wide.rs b/tests/coverage/long_and_wide.rs index 87f2207bd7e6..58dfdd0b20ab 100644 --- a/tests/coverage/long_and_wide.rs +++ b/tests/coverage/long_and_wide.rs @@ -1,4 +1,4 @@ -// edition: 2021 +//@ edition: 2021 // ignore-tidy-linelength // This file deliberately contains line and column numbers larger than 127, diff --git a/tests/coverage/macro_in_closure.coverage b/tests/coverage/macro_in_closure.coverage index 7f6f873439df..a23ad2c37ec2 100644 --- a/tests/coverage/macro_in_closure.coverage +++ b/tests/coverage/macro_in_closure.coverage @@ -1,5 +1,5 @@ LL| |#![feature(coverage_attribute)] - LL| |// edition: 2021 + LL| |//@ edition: 2021 LL| | LL| |// If a closure body consists entirely of a single bang-macro invocation, the LL| |// body span ends up inside the macro-expansion, so we need to un-expand it diff --git a/tests/coverage/macro_in_closure.rs b/tests/coverage/macro_in_closure.rs index 6948c9079c09..3d62b54073f1 100644 --- a/tests/coverage/macro_in_closure.rs +++ b/tests/coverage/macro_in_closure.rs @@ -1,5 +1,5 @@ #![feature(coverage_attribute)] -// edition: 2021 +//@ edition: 2021 // If a closure body consists entirely of a single bang-macro invocation, the // body span ends up inside the macro-expansion, so we need to un-expand it diff --git a/tests/coverage/macro_name_span.coverage b/tests/coverage/macro_name_span.coverage index 0e12ce4a27ca..b9a7ede0b4d4 100644 --- a/tests/coverage/macro_name_span.coverage +++ b/tests/coverage/macro_name_span.coverage @@ -1,11 +1,11 @@ - LL| |// edition: 2021 + LL| |//@ edition: 2021 LL| | LL| |// Regression test for . LL| |// Under some circumstances, the heuristics that detect macro name spans can LL| |// get confused and produce incorrect spans beyond the bounds of the span LL| |// being processed. LL| | - LL| |// aux-build: macro_name_span_helper.rs + LL| |//@ aux-build: macro_name_span_helper.rs LL| |extern crate macro_name_span_helper; LL| | LL| 1|fn main() { diff --git a/tests/coverage/macro_name_span.rs b/tests/coverage/macro_name_span.rs index 5d15977c498f..178c7ded9626 100644 --- a/tests/coverage/macro_name_span.rs +++ b/tests/coverage/macro_name_span.rs @@ -1,11 +1,11 @@ -// edition: 2021 +//@ edition: 2021 // Regression test for . // Under some circumstances, the heuristics that detect macro name spans can // get confused and produce incorrect spans beyond the bounds of the span // being processed. -// aux-build: macro_name_span_helper.rs +//@ aux-build: macro_name_span_helper.rs extern crate macro_name_span_helper; fn main() { diff --git a/tests/coverage/no_spans.coverage b/tests/coverage/no_spans.coverage index b117c32ffd0d..19e8c2fe5b6b 100644 --- a/tests/coverage/no_spans.coverage +++ b/tests/coverage/no_spans.coverage @@ -1,5 +1,5 @@ LL| |#![feature(coverage_attribute)] - LL| |// edition: 2021 + LL| |//@ edition: 2021 LL| | LL| |// If the span extractor can't find any relevant spans for a function, the LL| |// refinement loop will terminate with nothing in its `prev` slot. If the diff --git a/tests/coverage/no_spans.rs b/tests/coverage/no_spans.rs index a5234bc6b60d..e5312406f8a1 100644 --- a/tests/coverage/no_spans.rs +++ b/tests/coverage/no_spans.rs @@ -1,5 +1,5 @@ #![feature(coverage_attribute)] -// edition: 2021 +//@ edition: 2021 // If the span extractor can't find any relevant spans for a function, the // refinement loop will terminate with nothing in its `prev` slot. If the diff --git a/tests/coverage/no_spans_if_not.coverage b/tests/coverage/no_spans_if_not.coverage index d235568db654..b5606c9043c3 100644 --- a/tests/coverage/no_spans_if_not.coverage +++ b/tests/coverage/no_spans_if_not.coverage @@ -1,4 +1,4 @@ - LL| |// edition: 2021 + LL| |//@ edition: 2021 LL| | LL| |// If the span extractor can't find any relevant spans for a function, LL| |// but the function contains coverage span-marker statements (e.g. inserted diff --git a/tests/coverage/no_spans_if_not.rs b/tests/coverage/no_spans_if_not.rs index 2bbdc11cd5e5..3e7c13808fbb 100644 --- a/tests/coverage/no_spans_if_not.rs +++ b/tests/coverage/no_spans_if_not.rs @@ -1,4 +1,4 @@ -// edition: 2021 +//@ edition: 2021 // If the span extractor can't find any relevant spans for a function, // but the function contains coverage span-marker statements (e.g. inserted diff --git a/tests/coverage/overflow.coverage b/tests/coverage/overflow.coverage index 4f8dffc0c481..9057c244ccf0 100644 --- a/tests/coverage/overflow.coverage +++ b/tests/coverage/overflow.coverage @@ -1,6 +1,6 @@ LL| |#![allow(unused_assignments)] - LL| |// compile-flags: -Coverflow-checks=yes - LL| |// failure-status: 101 + LL| |//@ compile-flags: -Coverflow-checks=yes + LL| |//@ failure-status: 101 LL| | LL| 4|fn might_overflow(to_add: u32) -> u32 { LL| 4| if to_add > 5 { diff --git a/tests/coverage/overflow.rs b/tests/coverage/overflow.rs index 1c40771b2747..526728c087fe 100644 --- a/tests/coverage/overflow.rs +++ b/tests/coverage/overflow.rs @@ -1,6 +1,6 @@ #![allow(unused_assignments)] -// compile-flags: -Coverflow-checks=yes -// failure-status: 101 +//@ compile-flags: -Coverflow-checks=yes +//@ failure-status: 101 fn might_overflow(to_add: u32) -> u32 { if to_add > 5 { diff --git a/tests/coverage/panic_unwind.coverage b/tests/coverage/panic_unwind.coverage index 2b0777ef215d..eaf96cb02896 100644 --- a/tests/coverage/panic_unwind.coverage +++ b/tests/coverage/panic_unwind.coverage @@ -1,5 +1,5 @@ LL| |#![allow(unused_assignments)] - LL| |// failure-status: 101 + LL| |//@ failure-status: 101 LL| | LL| 4|fn might_panic(should_panic: bool) { LL| 4| if should_panic { diff --git a/tests/coverage/panic_unwind.rs b/tests/coverage/panic_unwind.rs index 638d2eb6aaaf..1d230565e410 100644 --- a/tests/coverage/panic_unwind.rs +++ b/tests/coverage/panic_unwind.rs @@ -1,5 +1,5 @@ #![allow(unused_assignments)] -// failure-status: 101 +//@ failure-status: 101 fn might_panic(should_panic: bool) { if should_panic { diff --git a/tests/coverage/sort_groups.coverage b/tests/coverage/sort_groups.coverage index 77cbb09c74a7..33a4d9546ce9 100644 --- a/tests/coverage/sort_groups.coverage +++ b/tests/coverage/sort_groups.coverage @@ -1,4 +1,4 @@ - LL| |// edition: 2021 + LL| |//@ edition: 2021 LL| | LL| |// Demonstrate that `sort_subviews.py` can sort instantiation groups into a LL| |// predictable order, while preserving their heterogeneous contents. diff --git a/tests/coverage/sort_groups.rs b/tests/coverage/sort_groups.rs index 17fd862ca2ca..6bd861b764bf 100644 --- a/tests/coverage/sort_groups.rs +++ b/tests/coverage/sort_groups.rs @@ -1,4 +1,4 @@ -// edition: 2021 +//@ edition: 2021 // Demonstrate that `sort_subviews.py` can sort instantiation groups into a // predictable order, while preserving their heterogeneous contents. diff --git a/tests/coverage/test_harness.coverage b/tests/coverage/test_harness.coverage index c3f660506fbd..22b1a3938f05 100644 --- a/tests/coverage/test_harness.coverage +++ b/tests/coverage/test_harness.coverage @@ -1,7 +1,7 @@ LL| |// Verify that the entry point injected by the test harness doesn't cause LL| |// weird artifacts in the coverage report (e.g. issue #10749). LL| | - LL| |// compile-flags: --test + LL| |//@ compile-flags: --test LL| | LL| |#[allow(dead_code)] LL| 0|fn unused() {} diff --git a/tests/coverage/test_harness.rs b/tests/coverage/test_harness.rs index 12a755734c19..1361274b716d 100644 --- a/tests/coverage/test_harness.rs +++ b/tests/coverage/test_harness.rs @@ -1,7 +1,7 @@ // Verify that the entry point injected by the test harness doesn't cause // weird artifacts in the coverage report (e.g. issue #10749). -// compile-flags: --test +//@ compile-flags: --test #[allow(dead_code)] fn unused() {} diff --git a/tests/coverage/thin-lto.coverage b/tests/coverage/thin-lto.coverage index 7ece467217ac..5255aa7f5a40 100644 --- a/tests/coverage/thin-lto.coverage +++ b/tests/coverage/thin-lto.coverage @@ -1,4 +1,4 @@ - LL| |// compile-flags: -O -C lto=thin -C prefer-dynamic=no + LL| |//@ compile-flags: -O -C lto=thin -C prefer-dynamic=no LL| | LL| 1|pub fn main() {} diff --git a/tests/coverage/thin-lto.rs b/tests/coverage/thin-lto.rs index 04e9cd0e8088..08843ea32ee1 100644 --- a/tests/coverage/thin-lto.rs +++ b/tests/coverage/thin-lto.rs @@ -1,3 +1,3 @@ -// compile-flags: -O -C lto=thin -C prefer-dynamic=no +//@ compile-flags: -O -C lto=thin -C prefer-dynamic=no pub fn main() {} diff --git a/tests/coverage/trivial.coverage b/tests/coverage/trivial.coverage index af4be7b8f335..9e425bd59305 100644 --- a/tests/coverage/trivial.coverage +++ b/tests/coverage/trivial.coverage @@ -1,4 +1,4 @@ - LL| |// edition: 2021 + LL| |//@ edition: 2021 LL| | LL| 1|fn main() {} diff --git a/tests/coverage/trivial.rs b/tests/coverage/trivial.rs index 782472739a00..7f5001d1eec0 100644 --- a/tests/coverage/trivial.rs +++ b/tests/coverage/trivial.rs @@ -1,3 +1,3 @@ -// edition: 2021 +//@ edition: 2021 fn main() {} diff --git a/tests/coverage/try_error_result.coverage b/tests/coverage/try_error_result.coverage index 418efa7fcb5c..6fbe8b8db13f 100644 --- a/tests/coverage/try_error_result.coverage +++ b/tests/coverage/try_error_result.coverage @@ -1,5 +1,5 @@ LL| |#![allow(unused_assignments)] - LL| |// failure-status: 1 + LL| |//@ failure-status: 1 LL| | LL| 6|fn call(return_error: bool) -> Result<(), ()> { LL| 6| if return_error { diff --git a/tests/coverage/try_error_result.rs b/tests/coverage/try_error_result.rs index 1acc26169123..f36283c34c8b 100644 --- a/tests/coverage/try_error_result.rs +++ b/tests/coverage/try_error_result.rs @@ -1,5 +1,5 @@ #![allow(unused_assignments)] -// failure-status: 1 +//@ failure-status: 1 fn call(return_error: bool) -> Result<(), ()> { if return_error { diff --git a/tests/coverage/unicode.coverage b/tests/coverage/unicode.coverage index af586111ba34..305591c70625 100644 --- a/tests/coverage/unicode.coverage +++ b/tests/coverage/unicode.coverage @@ -1,6 +1,6 @@ - LL| |// edition: 2021 - LL| |// ignore-windows - we can't force `llvm-cov` to use ANSI escapes on Windows - LL| |// llvm-cov-flags: --use-color + LL| |//@ edition: 2021 + LL| |//@ ignore-windows - we can't force `llvm-cov` to use ANSI escapes on Windows + LL| |//@ llvm-cov-flags: --use-color LL| | LL| |// Check that column numbers are denoted in bytes, so that they don't cause LL| |// `llvm-cov` to fail or emit malformed output. diff --git a/tests/coverage/unicode.rs b/tests/coverage/unicode.rs index dfc5ea69dd23..dc02d2c8ab4e 100644 --- a/tests/coverage/unicode.rs +++ b/tests/coverage/unicode.rs @@ -1,6 +1,6 @@ -// edition: 2021 -// ignore-windows - we can't force `llvm-cov` to use ANSI escapes on Windows -// llvm-cov-flags: --use-color +//@ edition: 2021 +//@ ignore-windows - we can't force `llvm-cov` to use ANSI escapes on Windows +//@ llvm-cov-flags: --use-color // Check that column numbers are denoted in bytes, so that they don't cause // `llvm-cov` to fail or emit malformed output. diff --git a/tests/coverage/unreachable.coverage b/tests/coverage/unreachable.coverage index a58765f688be..fdb6d3616d9a 100644 --- a/tests/coverage/unreachable.coverage +++ b/tests/coverage/unreachable.coverage @@ -1,6 +1,6 @@ LL| |#![feature(core_intrinsics)] LL| |#![feature(coverage_attribute)] - LL| |// edition: 2021 + LL| |//@ edition: 2021 LL| | LL| |// LL| |// If we instrument a function for coverage, but all of its counter-increment diff --git a/tests/coverage/unreachable.rs b/tests/coverage/unreachable.rs index 6d0c7b3ca8db..0e05c1d11be4 100644 --- a/tests/coverage/unreachable.rs +++ b/tests/coverage/unreachable.rs @@ -1,6 +1,6 @@ #![feature(core_intrinsics)] #![feature(coverage_attribute)] -// edition: 2021 +//@ edition: 2021 // // If we instrument a function for coverage, but all of its counter-increment diff --git a/tests/coverage/uses_crate.coverage b/tests/coverage/uses_crate.coverage index 50d92102a109..3ab47dbca79c 100644 --- a/tests/coverage/uses_crate.coverage +++ b/tests/coverage/uses_crate.coverage @@ -1,7 +1,7 @@ $DIR/auxiliary/used_crate.rs: LL| |#![allow(unused_assignments, unused_variables)] LL| |// Verify that coverage works with optimizations: - LL| |// compile-flags: -C opt-level=3 + LL| |//@ compile-flags: -C opt-level=3 LL| | LL| |use std::fmt::Debug; LL| | @@ -155,11 +155,11 @@ $DIR/uses_crate.rs: LL| |// the unused functions not instrumented, but it seems to be fine now. LL| | LL| |// Validates coverage now works with optimizations - LL| |// compile-flags: -C opt-level=3 + LL| |//@ compile-flags: -C opt-level=3 LL| | LL| |#![allow(unused_assignments, unused_variables)] LL| | - LL| |// aux-build:used_crate.rs + LL| |//@ aux-build:used_crate.rs LL| |extern crate used_crate; LL| | LL| 1|fn main() { diff --git a/tests/coverage/uses_crate.rs b/tests/coverage/uses_crate.rs index ab203ad781d6..12a53ac7278d 100644 --- a/tests/coverage/uses_crate.rs +++ b/tests/coverage/uses_crate.rs @@ -2,11 +2,11 @@ // the unused functions not instrumented, but it seems to be fine now. // Validates coverage now works with optimizations -// compile-flags: -C opt-level=3 +//@ compile-flags: -C opt-level=3 #![allow(unused_assignments, unused_variables)] -// aux-build:used_crate.rs +//@ aux-build:used_crate.rs extern crate used_crate; fn main() { diff --git a/tests/coverage/uses_inline_crate.coverage b/tests/coverage/uses_inline_crate.coverage index cc0e01ffde1c..0c9735990c7e 100644 --- a/tests/coverage/uses_inline_crate.coverage +++ b/tests/coverage/uses_inline_crate.coverage @@ -1,7 +1,7 @@ $DIR/auxiliary/used_inline_crate.rs: LL| |#![allow(unused_assignments, unused_variables)] LL| |// Verify that coverage works with optimizations: - LL| |// compile-flags: -C opt-level=3 + LL| |//@ compile-flags: -C opt-level=3 LL| | LL| |use std::fmt::Debug; LL| | @@ -138,11 +138,11 @@ $DIR/uses_inline_crate.rs: LL| |// the unused functions not instrumented, but it seems to be fine now. LL| | LL| |// Validates coverage now works with optimizations - LL| |// compile-flags: -C opt-level=3 + LL| |//@ compile-flags: -C opt-level=3 LL| | LL| |#![allow(unused_assignments, unused_variables)] LL| | - LL| |// aux-build:used_inline_crate.rs + LL| |//@ aux-build:used_inline_crate.rs LL| |extern crate used_inline_crate; LL| | LL| 1|fn main() { diff --git a/tests/coverage/uses_inline_crate.rs b/tests/coverage/uses_inline_crate.rs index d7b4c3c057f4..a5b65ff7d84e 100644 --- a/tests/coverage/uses_inline_crate.rs +++ b/tests/coverage/uses_inline_crate.rs @@ -2,11 +2,11 @@ // the unused functions not instrumented, but it seems to be fine now. // Validates coverage now works with optimizations -// compile-flags: -C opt-level=3 +//@ compile-flags: -C opt-level=3 #![allow(unused_assignments, unused_variables)] -// aux-build:used_inline_crate.rs +//@ aux-build:used_inline_crate.rs extern crate used_inline_crate; fn main() { diff --git a/tests/coverage/while_early_ret.coverage b/tests/coverage/while_early_ret.coverage index f4372ad282e3..649642712c6f 100644 --- a/tests/coverage/while_early_ret.coverage +++ b/tests/coverage/while_early_ret.coverage @@ -1,5 +1,5 @@ LL| |#![allow(unused_assignments)] - LL| |// failure-status: 1 + LL| |//@ failure-status: 1 LL| | LL| |#[rustfmt::skip] LL| 1|fn main() -> Result<(), u8> { diff --git a/tests/coverage/while_early_ret.rs b/tests/coverage/while_early_ret.rs index a6421e797f61..cf115a8e3f95 100644 --- a/tests/coverage/while_early_ret.rs +++ b/tests/coverage/while_early_ret.rs @@ -1,5 +1,5 @@ #![allow(unused_assignments)] -// failure-status: 1 +//@ failure-status: 1 #[rustfmt::skip] fn main() -> Result<(), u8> { diff --git a/tests/debuginfo/associated-types.rs b/tests/debuginfo/associated-types.rs index a1735520b117..ab41073b7c44 100644 --- a/tests/debuginfo/associated-types.rs +++ b/tests/debuginfo/associated-types.rs @@ -1,8 +1,8 @@ // Some versions of the non-rust-enabled LLDB print the wrong generic // parameter type names in this test. -// needs-rust-lldb +//@ needs-rust-lldb -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== // gdb-command:run diff --git a/tests/debuginfo/auxiliary/cross_crate_debuginfo_type_uniquing.rs b/tests/debuginfo/auxiliary/cross_crate_debuginfo_type_uniquing.rs index b9bb3ba7209f..a53c821a383a 100644 --- a/tests/debuginfo/auxiliary/cross_crate_debuginfo_type_uniquing.rs +++ b/tests/debuginfo/auxiliary/cross_crate_debuginfo_type_uniquing.rs @@ -1,6 +1,6 @@ -// no-prefer-dynamic +//@ no-prefer-dynamic #![crate_type = "rlib"] -// compile-flags:-g +//@ compile-flags:-g struct S1; diff --git a/tests/debuginfo/auxiliary/cross_crate_spans.rs b/tests/debuginfo/auxiliary/cross_crate_spans.rs index efe5e419542e..af853ee0b003 100644 --- a/tests/debuginfo/auxiliary/cross_crate_spans.rs +++ b/tests/debuginfo/auxiliary/cross_crate_spans.rs @@ -4,8 +4,8 @@ #![feature(omit_gdb_pretty_printer_section)] #![omit_gdb_pretty_printer_section] -// no-prefer-dynamic -// compile-flags:-g +//@ no-prefer-dynamic +//@ compile-flags:-g pub fn generic_function(val: T) -> (T, T) { let result = (val.clone(), val.clone()); diff --git a/tests/debuginfo/auxiliary/dependency-with-embedded-visualizers.rs b/tests/debuginfo/auxiliary/dependency-with-embedded-visualizers.rs index c187df637fdc..555f99784278 100644 --- a/tests/debuginfo/auxiliary/dependency-with-embedded-visualizers.rs +++ b/tests/debuginfo/auxiliary/dependency-with-embedded-visualizers.rs @@ -1,6 +1,6 @@ -// compile-flags:-g -// ignore-lldb -// no-prefer-dynamic +//@ compile-flags:-g +//@ ignore-lldb +//@ no-prefer-dynamic #![debugger_visualizer(natvis_file = "dependency-with-embedded-visualizers.natvis")] #![debugger_visualizer(gdb_script_file = "dependency-with-embedded-visualizers.py")] diff --git a/tests/debuginfo/auxiliary/issue-13213-aux.rs b/tests/debuginfo/auxiliary/issue-13213-aux.rs index bde98b44544d..b4787d557a53 100644 --- a/tests/debuginfo/auxiliary/issue-13213-aux.rs +++ b/tests/debuginfo/auxiliary/issue-13213-aux.rs @@ -1,5 +1,5 @@ #![crate_type = "lib"] -// compile-flags:-g +//@ compile-flags:-g pub use private::P; diff --git a/tests/debuginfo/auxiliary/macro-stepping.rs b/tests/debuginfo/auxiliary/macro-stepping.rs index ae50e11440bc..ce6137e55509 100644 --- a/tests/debuginfo/auxiliary/macro-stepping.rs +++ b/tests/debuginfo/auxiliary/macro-stepping.rs @@ -1,4 +1,4 @@ -// compile-flags:-g +//@ compile-flags:-g #![crate_type = "rlib"] diff --git a/tests/debuginfo/basic-types-globals-metadata.rs b/tests/debuginfo/basic-types-globals-metadata.rs index 3934d3c7a685..124be655c352 100644 --- a/tests/debuginfo/basic-types-globals-metadata.rs +++ b/tests/debuginfo/basic-types-globals-metadata.rs @@ -1,7 +1,7 @@ -// min-lldb-version: 310 -// ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 +//@ min-lldb-version: 310 +//@ ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 -// compile-flags:-g +//@ compile-flags:-g // gdb-command:run // gdbg-command:whatis 'basic_types_globals_metadata::B' // gdbr-command:whatis basic_types_globals_metadata::B diff --git a/tests/debuginfo/basic-types-globals.rs b/tests/debuginfo/basic-types-globals.rs index 8a3df8ba2d18..319e86ad4601 100644 --- a/tests/debuginfo/basic-types-globals.rs +++ b/tests/debuginfo/basic-types-globals.rs @@ -1,15 +1,15 @@ // Caveat - gdb doesn't know about UTF-32 character encoding and will print a // rust char as only its numerical value. -// min-lldb-version: 310 -// min-gdb-version: 8.0 +//@ min-lldb-version: 310 +//@ min-gdb-version: 8.0 -// revisions: lto no-lto +//@ revisions: lto no-lto -// compile-flags:-g +//@ compile-flags:-g -// [lto] compile-flags:-C lto -// [lto] no-prefer-dynamic +//@ [lto] compile-flags:-C lto +//@ [lto] no-prefer-dynamic // gdb-command:run // gdbg-command:print 'basic_types_globals::B' diff --git a/tests/debuginfo/basic-types-metadata.rs b/tests/debuginfo/basic-types-metadata.rs index ca0a6e232027..8a25c0c45241 100644 --- a/tests/debuginfo/basic-types-metadata.rs +++ b/tests/debuginfo/basic-types-metadata.rs @@ -1,7 +1,7 @@ -// min-lldb-version: 310 -// ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 +//@ min-lldb-version: 310 +//@ ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 -// compile-flags:-g +//@ compile-flags:-g // gdb-command:run // gdb-command:whatis unit // gdb-check:type = () diff --git a/tests/debuginfo/basic-types-mut-globals.rs b/tests/debuginfo/basic-types-mut-globals.rs index 9b0c46fa478c..c3e5f2534d31 100644 --- a/tests/debuginfo/basic-types-mut-globals.rs +++ b/tests/debuginfo/basic-types-mut-globals.rs @@ -4,10 +4,10 @@ // about UTF-32 character encoding and will print a rust char as only // its numerical value. -// min-lldb-version: 310 -// ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 +//@ min-lldb-version: 310 +//@ ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 -// compile-flags:-g +//@ compile-flags:-g // gdb-command:run diff --git a/tests/debuginfo/basic-types.rs b/tests/debuginfo/basic-types.rs index 9e82f0714690..8319b71bfcda 100644 --- a/tests/debuginfo/basic-types.rs +++ b/tests/debuginfo/basic-types.rs @@ -4,12 +4,12 @@ // about UTF-32 character encoding and will print a rust char as only // its numerical value. -// min-lldb-version: 310 +//@ min-lldb-version: 310 // This fails on lldb 6.0.1 on x86-64 Fedora 28; so ignore Linux for now. -// ignore-linux +//@ ignore-linux -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/borrowed-basic.rs b/tests/debuginfo/borrowed-basic.rs index 45f5df228e3f..52d61f33e7c0 100644 --- a/tests/debuginfo/borrowed-basic.rs +++ b/tests/debuginfo/borrowed-basic.rs @@ -1,5 +1,5 @@ -// compile-flags:-g -// min-lldb-version: 310 +//@ compile-flags:-g +//@ min-lldb-version: 310 // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/borrowed-c-style-enum.rs b/tests/debuginfo/borrowed-c-style-enum.rs index f212ff3951e3..950a05a0992f 100644 --- a/tests/debuginfo/borrowed-c-style-enum.rs +++ b/tests/debuginfo/borrowed-c-style-enum.rs @@ -1,5 +1,5 @@ -// compile-flags:-g -// min-lldb-version: 310 +//@ compile-flags:-g +//@ min-lldb-version: 310 // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/borrowed-enum.rs b/tests/debuginfo/borrowed-enum.rs index 37d458cb494c..aee4631a8b3d 100644 --- a/tests/debuginfo/borrowed-enum.rs +++ b/tests/debuginfo/borrowed-enum.rs @@ -1,8 +1,8 @@ // Require a gdb or lldb that can read DW_TAG_variant_part. -// min-gdb-version: 8.2 -// needs-rust-lldb +//@ min-gdb-version: 8.2 +//@ needs-rust-lldb -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/borrowed-struct.rs b/tests/debuginfo/borrowed-struct.rs index fe945266b13c..467de7878ee7 100644 --- a/tests/debuginfo/borrowed-struct.rs +++ b/tests/debuginfo/borrowed-struct.rs @@ -1,5 +1,5 @@ -// compile-flags:-g -// min-lldb-version: 310 +//@ compile-flags:-g +//@ min-lldb-version: 310 // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/borrowed-tuple.rs b/tests/debuginfo/borrowed-tuple.rs index cc28e49c4474..4fe1abbaba2c 100644 --- a/tests/debuginfo/borrowed-tuple.rs +++ b/tests/debuginfo/borrowed-tuple.rs @@ -1,6 +1,6 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/borrowed-unique-basic.rs b/tests/debuginfo/borrowed-unique-basic.rs index 94229bf27f3c..ae843c355bc5 100644 --- a/tests/debuginfo/borrowed-unique-basic.rs +++ b/tests/debuginfo/borrowed-unique-basic.rs @@ -1,6 +1,6 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/box.rs b/tests/debuginfo/box.rs index 3713c8c135d2..f2e744e87b91 100644 --- a/tests/debuginfo/box.rs +++ b/tests/debuginfo/box.rs @@ -1,6 +1,6 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/boxed-struct.rs b/tests/debuginfo/boxed-struct.rs index 64bc124756d6..c47bffb3a384 100644 --- a/tests/debuginfo/boxed-struct.rs +++ b/tests/debuginfo/boxed-struct.rs @@ -1,6 +1,6 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/by-value-non-immediate-argument.rs b/tests/debuginfo/by-value-non-immediate-argument.rs index b417567dcfec..52e3dc9a76bc 100644 --- a/tests/debuginfo/by-value-non-immediate-argument.rs +++ b/tests/debuginfo/by-value-non-immediate-argument.rs @@ -1,7 +1,7 @@ -// ignore-test // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 -// min-lldb-version: 310 +//@ ignore-test // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== 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 e60cfc9242aa..247d6c27a06e 100644 --- a/tests/debuginfo/by-value-self-argument-in-trait-impl.rs +++ b/tests/debuginfo/by-value-self-argument-in-trait-impl.rs @@ -1,6 +1,6 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/c-style-enum-in-composite.rs b/tests/debuginfo/c-style-enum-in-composite.rs index 2ed49de58cd2..3f0968f09afd 100644 --- a/tests/debuginfo/c-style-enum-in-composite.rs +++ b/tests/debuginfo/c-style-enum-in-composite.rs @@ -1,6 +1,6 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/c-style-enum.rs b/tests/debuginfo/c-style-enum.rs index dce34fc0dcf5..2794575d3287 100644 --- a/tests/debuginfo/c-style-enum.rs +++ b/tests/debuginfo/c-style-enum.rs @@ -1,8 +1,8 @@ -// ignore-aarch64 -// ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 -// min-lldb-version: 310 +//@ ignore-aarch64 +//@ ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/captured-fields-1.rs b/tests/debuginfo/captured-fields-1.rs index b71734c2354d..f5fdf4fb3d9c 100644 --- a/tests/debuginfo/captured-fields-1.rs +++ b/tests/debuginfo/captured-fields-1.rs @@ -1,5 +1,5 @@ -// compile-flags:-g -// edition:2021 +//@ compile-flags:-g +//@ edition:2021 // === GDB TESTS =================================================================================== // gdb-command:run diff --git a/tests/debuginfo/captured-fields-2.rs b/tests/debuginfo/captured-fields-2.rs index 8d463fb24516..aaf4fa1bc454 100644 --- a/tests/debuginfo/captured-fields-2.rs +++ b/tests/debuginfo/captured-fields-2.rs @@ -1,5 +1,5 @@ -// compile-flags:-g -// edition:2021 +//@ compile-flags:-g +//@ edition:2021 // === GDB TESTS =================================================================================== // gdb-command:run diff --git a/tests/debuginfo/closure-in-generic-function.rs b/tests/debuginfo/closure-in-generic-function.rs index 91d7ddc5416d..676a624191c2 100644 --- a/tests/debuginfo/closure-in-generic-function.rs +++ b/tests/debuginfo/closure-in-generic-function.rs @@ -1,6 +1,6 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/collapse-debuginfo-external-attr.rs b/tests/debuginfo/collapse-debuginfo-external-attr.rs index f36b0833ad51..fba609bf89e6 100644 --- a/tests/debuginfo/collapse-debuginfo-external-attr.rs +++ b/tests/debuginfo/collapse-debuginfo-external-attr.rs @@ -1,9 +1,9 @@ -// ignore-lldb +//@ ignore-lldb #![feature(collapse_debuginfo)] // Test that local macro debug info is not collapsed with #[collapse_debuginfo(external)] -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/collapse-debuginfo-external-flag-overriden-by-attr.rs b/tests/debuginfo/collapse-debuginfo-external-flag-overriden-by-attr.rs index e5cbc1a685d0..51aa1f8ce19e 100644 --- a/tests/debuginfo/collapse-debuginfo-external-flag-overriden-by-attr.rs +++ b/tests/debuginfo/collapse-debuginfo-external-flag-overriden-by-attr.rs @@ -1,10 +1,10 @@ -// ignore-lldb +//@ ignore-lldb #![feature(collapse_debuginfo)] // Test that macro attribute #[collapse_debuginfo(no)] // overrides "collapse_macro_debuginfo=external" flag -// compile-flags:-g -Z collapse_macro_debuginfo=external +//@ compile-flags:-g -Z collapse_macro_debuginfo=external // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/collapse-debuginfo-external-flag.rs b/tests/debuginfo/collapse-debuginfo-external-flag.rs index 9a0aef38ea6c..f9ef1ae8a258 100644 --- a/tests/debuginfo/collapse-debuginfo-external-flag.rs +++ b/tests/debuginfo/collapse-debuginfo-external-flag.rs @@ -1,9 +1,9 @@ -// ignore-lldb +//@ ignore-lldb #![feature(collapse_debuginfo)] // Test that println macro debug info is collapsed with "collapse_macro_debuginfo=external" flag -// compile-flags:-g -Z collapse_macro_debuginfo=external +//@ compile-flags:-g -Z collapse_macro_debuginfo=external // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/collapse-debuginfo-in-non-collapse-macro.rs b/tests/debuginfo/collapse-debuginfo-in-non-collapse-macro.rs index d9500c3641ef..e67e1d83cdc9 100644 --- a/tests/debuginfo/collapse-debuginfo-in-non-collapse-macro.rs +++ b/tests/debuginfo/collapse-debuginfo-in-non-collapse-macro.rs @@ -1,4 +1,4 @@ -// ignore-lldb +//@ ignore-lldb #![feature(collapse_debuginfo)] // Test that statement, skipped/added/reordered by macros, is correctly processed in debuginfo. @@ -7,7 +7,7 @@ // without collapse_debuginfo attribute. // collapse_debuginfo feature enabled. -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/collapse-debuginfo-no-attr-flag.rs b/tests/debuginfo/collapse-debuginfo-no-attr-flag.rs index 413f6120105e..fbc7d03e0df8 100644 --- a/tests/debuginfo/collapse-debuginfo-no-attr-flag.rs +++ b/tests/debuginfo/collapse-debuginfo-no-attr-flag.rs @@ -1,11 +1,11 @@ -// ignore-lldb +//@ ignore-lldb #![feature(collapse_debuginfo)] // Test that line numbers are not replaced with those of the outermost expansion site when the // `collapse_debuginfo` is active, `-Zdebug-macros` is provided and `#[collapse_debuginfo]` not // being used. -// compile-flags:-g -Zdebug-macros +//@ compile-flags:-g -Zdebug-macros // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/collapse-debuginfo-no-attr.rs b/tests/debuginfo/collapse-debuginfo-no-attr.rs index d156c381a150..4ea1b2cf7a4e 100644 --- a/tests/debuginfo/collapse-debuginfo-no-attr.rs +++ b/tests/debuginfo/collapse-debuginfo-no-attr.rs @@ -1,10 +1,10 @@ -// ignore-lldb +//@ ignore-lldb #![feature(collapse_debuginfo)] // Test that line numbers are not replaced with those of the outermost expansion site when the // `collapse_debuginfo` feature is active and the attribute is not provided. -// compile-flags:-g -Z collapse_macro_debuginfo=no +//@ compile-flags:-g -Z collapse_macro_debuginfo=no // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/collapse-debuginfo-with-attr-flag.rs b/tests/debuginfo/collapse-debuginfo-with-attr-flag.rs index 183cf537e85d..b585cdf13e09 100644 --- a/tests/debuginfo/collapse-debuginfo-with-attr-flag.rs +++ b/tests/debuginfo/collapse-debuginfo-with-attr-flag.rs @@ -1,11 +1,11 @@ -// ignore-lldb +//@ ignore-lldb #![feature(collapse_debuginfo)] // Test that line numbers are not replaced with those of the outermost expansion site when the // `collapse_debuginfo` is active and `-Zdebug-macros` is provided, despite `#[collapse_debuginfo]` // being used. -// compile-flags:-g -Zdebug-macros +//@ compile-flags:-g -Zdebug-macros // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/collapse-debuginfo-with-attr.rs b/tests/debuginfo/collapse-debuginfo-with-attr.rs index 34d03c18bc72..e7698c5f6299 100644 --- a/tests/debuginfo/collapse-debuginfo-with-attr.rs +++ b/tests/debuginfo/collapse-debuginfo-with-attr.rs @@ -1,10 +1,10 @@ -// ignore-lldb +//@ ignore-lldb #![feature(collapse_debuginfo)] // Test that line numbers are replaced with those of the outermost expansion site when the // `collapse_debuginfo` feature is active and the attribute is provided. -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/collapse-debuginfo-with-yes-flag.rs b/tests/debuginfo/collapse-debuginfo-with-yes-flag.rs index 76a97a325d7e..2c3ecf3f5afb 100644 --- a/tests/debuginfo/collapse-debuginfo-with-yes-flag.rs +++ b/tests/debuginfo/collapse-debuginfo-with-yes-flag.rs @@ -1,10 +1,10 @@ -// ignore-lldb +//@ ignore-lldb #![feature(collapse_debuginfo)] // Test that line numbers are replaced with those of the outermost expansion site when the // `collapse_debuginfo` feature is active and the command line flag is provided. -// compile-flags:-g -Z collapse_macro_debuginfo=yes +//@ compile-flags:-g -Z collapse_macro_debuginfo=yes // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/constant-debug-locs.rs b/tests/debuginfo/constant-debug-locs.rs index bf85fdca4210..d834d9909859 100644 --- a/tests/debuginfo/constant-debug-locs.rs +++ b/tests/debuginfo/constant-debug-locs.rs @@ -1,6 +1,6 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g #![allow(dead_code, unused_variables)] #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/constant-in-match-pattern.rs b/tests/debuginfo/constant-in-match-pattern.rs index e1b533b723b9..f34284be1640 100644 --- a/tests/debuginfo/constant-in-match-pattern.rs +++ b/tests/debuginfo/constant-in-match-pattern.rs @@ -1,6 +1,6 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g #![allow(dead_code, unused_variables)] #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/coroutine-locals.rs b/tests/debuginfo/coroutine-locals.rs index e5eb1022ff49..0430e1d313bd 100644 --- a/tests/debuginfo/coroutine-locals.rs +++ b/tests/debuginfo/coroutine-locals.rs @@ -1,6 +1,6 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/coroutine-objects.rs b/tests/debuginfo/coroutine-objects.rs index 3e658b2136e7..98b37ac2001d 100644 --- a/tests/debuginfo/coroutine-objects.rs +++ b/tests/debuginfo/coroutine-objects.rs @@ -1,11 +1,11 @@ // Require a gdb that can read DW_TAG_variant_part. -// min-gdb-version: 8.2 +//@ min-gdb-version: 8.2 // LLDB without native Rust support cannot read DW_TAG_variant_part, // so it prints nothing for coroutines. But those tests are kept to // ensure that LLDB won't crash at least (like #57822). -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/cross-crate-spans.rs b/tests/debuginfo/cross-crate-spans.rs index 7c58e1db23f3..75550e1794cc 100644 --- a/tests/debuginfo/cross-crate-spans.rs +++ b/tests/debuginfo/cross-crate-spans.rs @@ -1,16 +1,16 @@ #![feature(omit_gdb_pretty_printer_section)] #![omit_gdb_pretty_printer_section] -// min-lldb-version: 310 +//@ min-lldb-version: 310 // This fails on lldb 6.0.1 on x86-64 Fedora 28; so mark it macOS-only // for now. -// only-macos +//@ only-macos -// aux-build:cross_crate_spans.rs +//@ aux-build:cross_crate_spans.rs extern crate cross_crate_spans; -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/cross-crate-type-uniquing.rs b/tests/debuginfo/cross-crate-type-uniquing.rs index 5974ddb3a174..88f8bac5d6f4 100644 --- a/tests/debuginfo/cross-crate-type-uniquing.rs +++ b/tests/debuginfo/cross-crate-type-uniquing.rs @@ -1,10 +1,10 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// aux-build:cross_crate_debuginfo_type_uniquing.rs +//@ aux-build:cross_crate_debuginfo_type_uniquing.rs extern crate cross_crate_debuginfo_type_uniquing; -// no-prefer-dynamic -// compile-flags:-g -C lto +//@ no-prefer-dynamic +//@ compile-flags:-g -C lto pub struct C; pub fn p() -> C { diff --git a/tests/debuginfo/destructured-fn-argument.rs b/tests/debuginfo/destructured-fn-argument.rs index 9cd3874a5dfb..e6e697c518a1 100644 --- a/tests/debuginfo/destructured-fn-argument.rs +++ b/tests/debuginfo/destructured-fn-argument.rs @@ -1,6 +1,6 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/destructured-for-loop-variable.rs b/tests/debuginfo/destructured-for-loop-variable.rs index 15cb88ef25d5..3e27d122c4be 100644 --- a/tests/debuginfo/destructured-for-loop-variable.rs +++ b/tests/debuginfo/destructured-for-loop-variable.rs @@ -1,10 +1,10 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 // This fails on lldb 6.0.1 on x86-64 Fedora 28; so mark it macOS-only // for now. -// only-macos +//@ only-macos -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/destructured-local.rs b/tests/debuginfo/destructured-local.rs index 3a2a889777ea..3e0557382b3c 100644 --- a/tests/debuginfo/destructured-local.rs +++ b/tests/debuginfo/destructured-local.rs @@ -1,6 +1,6 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/drop-locations.rs b/tests/debuginfo/drop-locations.rs index c195f46208a0..6404bf9c3dad 100644 --- a/tests/debuginfo/drop-locations.rs +++ b/tests/debuginfo/drop-locations.rs @@ -1,11 +1,11 @@ -// ignore-windows -// ignore-android -// ignore-test // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 -// min-lldb-version: 310 +//@ ignore-windows +//@ ignore-android +//@ ignore-test // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 +//@ min-lldb-version: 310 #![allow(unused)] -// compile-flags:-g -O -C no-prepopulate-passes +//@ compile-flags:-g -O -C no-prepopulate-passes // -O -C no-prepopulate-passes added to work around https://bugs.llvm.org/show_bug.cgi?id=32123 // This test checks that drop glue code gets attributed to scope's closing brace, diff --git a/tests/debuginfo/duration-type.rs b/tests/debuginfo/duration-type.rs index bc0266d644ec..4e4b17c02e10 100644 --- a/tests/debuginfo/duration-type.rs +++ b/tests/debuginfo/duration-type.rs @@ -1,5 +1,5 @@ -// only-cdb -// compile-flags:-g +//@ only-cdb +//@ compile-flags:-g // === CDB TESTS ================================================================================== diff --git a/tests/debuginfo/embedded-visualizer.rs b/tests/debuginfo/embedded-visualizer.rs index ac421092839f..69afd273f773 100644 --- a/tests/debuginfo/embedded-visualizer.rs +++ b/tests/debuginfo/embedded-visualizer.rs @@ -1,7 +1,7 @@ -// compile-flags:-g -// min-gdb-version: 8.1 -// ignore-lldb -// ignore-windows-gnu // emit_debug_gdb_scripts is disabled on Windows +//@ compile-flags:-g +//@ min-gdb-version: 8.1 +//@ ignore-lldb +//@ ignore-windows-gnu // emit_debug_gdb_scripts is disabled on Windows // === CDB TESTS ================================================================================== @@ -63,7 +63,7 @@ #![debugger_visualizer(natvis_file = "embedded-visualizer.natvis")] #![debugger_visualizer(gdb_script_file = "embedded-visualizer.py")] -// aux-build: dependency-with-embedded-visualizers.rs +//@ aux-build: dependency-with-embedded-visualizers.rs extern crate dependency_with_embedded_visualizers; use dependency_with_embedded_visualizers::Person; diff --git a/tests/debuginfo/empty-string.rs b/tests/debuginfo/empty-string.rs index 66eb8bae26b9..838e160e74ea 100644 --- a/tests/debuginfo/empty-string.rs +++ b/tests/debuginfo/empty-string.rs @@ -1,9 +1,9 @@ -// ignore-windows failing on win32 bot -// ignore-android: FIXME(#10381) -// compile-flags:-g -// min-gdb-version: 8.1 -// ignore-gdb-version: 7.11.90 - 8.0.9 -// min-lldb-version: 310 +//@ ignore-windows failing on win32 bot +//@ ignore-android: FIXME(#10381) +//@ compile-flags:-g +//@ min-gdb-version: 8.1 +//@ ignore-gdb-version: 7.11.90 - 8.0.9 +//@ min-lldb-version: 310 // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/enum-thinlto.rs b/tests/debuginfo/enum-thinlto.rs index b10e04a4a9eb..5c27fe4271ca 100644 --- a/tests/debuginfo/enum-thinlto.rs +++ b/tests/debuginfo/enum-thinlto.rs @@ -1,7 +1,7 @@ // Require a gdb that can read DW_TAG_variant_part. -// min-gdb-version: 8.2 +//@ min-gdb-version: 8.2 -// compile-flags:-g -Z thinlto +//@ compile-flags:-g -Z thinlto // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/evec-in-struct.rs b/tests/debuginfo/evec-in-struct.rs index 0d94cd224ec0..d238cc9eded1 100644 --- a/tests/debuginfo/evec-in-struct.rs +++ b/tests/debuginfo/evec-in-struct.rs @@ -1,6 +1,6 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/extern-c-fn.rs b/tests/debuginfo/extern-c-fn.rs index 17a452ec6344..62c2b6099692 100644 --- a/tests/debuginfo/extern-c-fn.rs +++ b/tests/debuginfo/extern-c-fn.rs @@ -1,6 +1,6 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== // gdb-command:run diff --git a/tests/debuginfo/fixed-sized-array.rs b/tests/debuginfo/fixed-sized-array.rs index d8899224d284..e538c57f5fef 100644 --- a/tests/debuginfo/fixed-sized-array.rs +++ b/tests/debuginfo/fixed-sized-array.rs @@ -1,8 +1,8 @@ // Testing the display of fixed sized arrays in cdb. // cdb-only -// min-cdb-version: 10.0.18317.1001 -// compile-flags:-g +//@ min-cdb-version: 10.0.18317.1001 +//@ compile-flags:-g // === CDB TESTS ================================================================================== diff --git a/tests/debuginfo/function-arg-initialization.rs b/tests/debuginfo/function-arg-initialization.rs index dea1339517b4..4bdaefd9bdd2 100644 --- a/tests/debuginfo/function-arg-initialization.rs +++ b/tests/debuginfo/function-arg-initialization.rs @@ -1,5 +1,5 @@ -// ignore-test // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 -// min-lldb-version: 310 +//@ ignore-test // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 +//@ min-lldb-version: 310 // This test case checks if function arguments already have the correct value // when breaking at the first line of the function, that is if the function @@ -8,7 +8,7 @@ // arguments have been properly loaded when setting the breakpoint via the // function name. -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/function-arguments.rs b/tests/debuginfo/function-arguments.rs index 5cfd7d1f8f19..c6b865bd458e 100644 --- a/tests/debuginfo/function-arguments.rs +++ b/tests/debuginfo/function-arguments.rs @@ -1,6 +1,6 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/function-call.rs b/tests/debuginfo/function-call.rs index 75334558b589..3d8d798928d7 100644 --- a/tests/debuginfo/function-call.rs +++ b/tests/debuginfo/function-call.rs @@ -1,7 +1,7 @@ // This test does not passed with gdb < 8.0. See #53497. -// min-gdb-version: 10.1 +//@ min-gdb-version: 10.1 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/function-names.rs b/tests/debuginfo/function-names.rs index d29b3ea76b70..1e4be4324455 100644 --- a/tests/debuginfo/function-names.rs +++ b/tests/debuginfo/function-names.rs @@ -1,7 +1,7 @@ // Function names are formatted differently in old versions of GDB -// min-gdb-version: 10.1 +//@ min-gdb-version: 10.1 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/function-prologue-stepping-regular.rs b/tests/debuginfo/function-prologue-stepping-regular.rs index 699ff84ee0a6..e52d17a70bd7 100644 --- a/tests/debuginfo/function-prologue-stepping-regular.rs +++ b/tests/debuginfo/function-prologue-stepping-regular.rs @@ -1,10 +1,10 @@ // This test case checks if function arguments already have the correct value when breaking at the // beginning of a function. -// min-lldb-version: 310 -// ignore-gdb -// ignore-test // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 -// compile-flags:-g +//@ min-lldb-version: 310 +//@ ignore-gdb +//@ ignore-test // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 +//@ compile-flags:-g // lldb-command:breakpoint set --name immediate_args // lldb-command:breakpoint set --name non_immediate_args diff --git a/tests/debuginfo/gdb-char.rs b/tests/debuginfo/gdb-char.rs index 1863405bf1e9..7d8608d4f511 100644 --- a/tests/debuginfo/gdb-char.rs +++ b/tests/debuginfo/gdb-char.rs @@ -1,8 +1,8 @@ // GDB got support for DW_ATE_UTF in 11.2, see // https://sourceware.org/bugzilla/show_bug.cgi?id=28637. -// min-gdb-version: 11.2 -// compile-flags: -g +//@ min-gdb-version: 11.2 +//@ compile-flags: -g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/gdb-pretty-struct-and-enums.rs b/tests/debuginfo/gdb-pretty-struct-and-enums.rs index 3314f0a4e43c..235295e887c2 100644 --- a/tests/debuginfo/gdb-pretty-struct-and-enums.rs +++ b/tests/debuginfo/gdb-pretty-struct-and-enums.rs @@ -1,8 +1,8 @@ -// ignore-lldb -// ignore-android: FIXME(#10381) -// min-gdb-version: 8.1 +//@ ignore-lldb +//@ ignore-android: FIXME(#10381) +//@ min-gdb-version: 8.1 -// compile-flags:-g +//@ compile-flags:-g // gdb-command: run diff --git a/tests/debuginfo/generic-enum-with-different-disr-sizes.rs b/tests/debuginfo/generic-enum-with-different-disr-sizes.rs index adcb04da30d0..6a8aa831c404 100644 --- a/tests/debuginfo/generic-enum-with-different-disr-sizes.rs +++ b/tests/debuginfo/generic-enum-with-different-disr-sizes.rs @@ -1,10 +1,10 @@ -// ignore-lldb: FIXME(#27089) -// min-lldb-version: 310 +//@ ignore-lldb: FIXME(#27089) +//@ min-lldb-version: 310 // Require a gdb that can read DW_TAG_variant_part. -// min-gdb-version: 8.2 +//@ min-gdb-version: 8.2 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== // gdb-command:run diff --git a/tests/debuginfo/generic-function.rs b/tests/debuginfo/generic-function.rs index e8f3940c8360..eab781d2150d 100644 --- a/tests/debuginfo/generic-function.rs +++ b/tests/debuginfo/generic-function.rs @@ -1,6 +1,6 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/generic-functions-nested.rs b/tests/debuginfo/generic-functions-nested.rs index 4c4297f942a9..a146015246e8 100644 --- a/tests/debuginfo/generic-functions-nested.rs +++ b/tests/debuginfo/generic-functions-nested.rs @@ -1,6 +1,6 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/generic-method-on-generic-struct.rs b/tests/debuginfo/generic-method-on-generic-struct.rs index 2d54c2b07df3..dd1f482f3fa6 100644 --- a/tests/debuginfo/generic-method-on-generic-struct.rs +++ b/tests/debuginfo/generic-method-on-generic-struct.rs @@ -1,8 +1,8 @@ -// compile-flags:-g +//@ compile-flags:-g // Some versions of the non-rust-enabled LLDB print the wrong generic // parameter type names in this test. -// needs-rust-lldb +//@ needs-rust-lldb // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/generic-static-method-on-struct-and-enum.rs b/tests/debuginfo/generic-static-method-on-struct-and-enum.rs index b0ac8ae85772..98608e329148 100644 --- a/tests/debuginfo/generic-static-method-on-struct-and-enum.rs +++ b/tests/debuginfo/generic-static-method-on-struct-and-enum.rs @@ -1,6 +1,6 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g // gdb-command:run diff --git a/tests/debuginfo/generic-struct-style-enum.rs b/tests/debuginfo/generic-struct-style-enum.rs index 764330ae27f5..7d929b91064c 100644 --- a/tests/debuginfo/generic-struct-style-enum.rs +++ b/tests/debuginfo/generic-struct-style-enum.rs @@ -1,9 +1,9 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 // Require a gdb that can read DW_TAG_variant_part. -// min-gdb-version: 8.2 +//@ min-gdb-version: 8.2 -// compile-flags:-g +//@ compile-flags:-g // gdb-command:set print union on // gdb-command:run diff --git a/tests/debuginfo/generic-struct.rs b/tests/debuginfo/generic-struct.rs index 5213eebc18bd..82ed17618aaa 100644 --- a/tests/debuginfo/generic-struct.rs +++ b/tests/debuginfo/generic-struct.rs @@ -1,8 +1,8 @@ // Some versions of the non-rust-enabled LLDB print the wrong generic // parameter type names in this test. -// needs-rust-lldb +//@ needs-rust-lldb -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/generic-tuple-style-enum.rs b/tests/debuginfo/generic-tuple-style-enum.rs index a55402691dc3..fb5deb9b1982 100644 --- a/tests/debuginfo/generic-tuple-style-enum.rs +++ b/tests/debuginfo/generic-tuple-style-enum.rs @@ -1,8 +1,8 @@ // Require a gdb or lldb that can read DW_TAG_variant_part. -// min-gdb-version: 8.2 -// needs-rust-lldb +//@ min-gdb-version: 8.2 +//@ needs-rust-lldb -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/include_string.rs b/tests/debuginfo/include_string.rs index 30e9deabb04a..6f7d2b28b418 100644 --- a/tests/debuginfo/include_string.rs +++ b/tests/debuginfo/include_string.rs @@ -1,6 +1,6 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g // gdb-command:run // gdb-command:print string1.length // gdb-check:$1 = 48 diff --git a/tests/debuginfo/issue-12886.rs b/tests/debuginfo/issue-12886.rs index 389221cbbf15..c6cf0dd4e05e 100644 --- a/tests/debuginfo/issue-12886.rs +++ b/tests/debuginfo/issue-12886.rs @@ -1,8 +1,8 @@ -// ignore-windows failing on 64-bit bots FIXME #17638 -// ignore-lldb -// ignore-aarch64 +//@ ignore-windows failing on 64-bit bots FIXME #17638 +//@ ignore-lldb +//@ ignore-aarch64 -// compile-flags:-g +//@ compile-flags:-g // gdb-command:run // gdb-command:next diff --git a/tests/debuginfo/issue-13213.rs b/tests/debuginfo/issue-13213.rs index 393478460d48..7ef9178ce9d9 100644 --- a/tests/debuginfo/issue-13213.rs +++ b/tests/debuginfo/issue-13213.rs @@ -1,11 +1,11 @@ -// min-lldb-version: 310 -// ignore-cdb: Fails with exit code 0xc0000135 ("the application failed to initialize properly") +//@ min-lldb-version: 310 +//@ ignore-cdb: Fails with exit code 0xc0000135 ("the application failed to initialize properly") -// aux-build:issue-13213-aux.rs +//@ aux-build:issue-13213-aux.rs extern crate issue_13213_aux; -// compile-flags:-g +//@ compile-flags:-g // This tests make sure that we get no linker error when using a completely inlined static. Some // statics that are marked with AvailableExternallyLinkage in the importing crate, may actually not diff --git a/tests/debuginfo/issue-14411.rs b/tests/debuginfo/issue-14411.rs index 19609f428467..3258fec1e870 100644 --- a/tests/debuginfo/issue-14411.rs +++ b/tests/debuginfo/issue-14411.rs @@ -1,6 +1,6 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g // No debugger interaction required: just make sure it compiles without // crashing. diff --git a/tests/debuginfo/issue-22656.rs b/tests/debuginfo/issue-22656.rs index f286566277e9..acbe2b12a248 100644 --- a/tests/debuginfo/issue-22656.rs +++ b/tests/debuginfo/issue-22656.rs @@ -2,10 +2,10 @@ // when trying to handle a Vec<> or anything else that contains zero-sized // fields. -// min-lldb-version: 310 -// ignore-gdb +//@ min-lldb-version: 310 +//@ ignore-gdb -// compile-flags:-g +//@ compile-flags:-g // === LLDB TESTS ================================================================================== // lldb-command:run diff --git a/tests/debuginfo/issue-57822.rs b/tests/debuginfo/issue-57822.rs index a12a562a033d..f4ef45f1d74b 100644 --- a/tests/debuginfo/issue-57822.rs +++ b/tests/debuginfo/issue-57822.rs @@ -2,9 +2,9 @@ // for nested closures and coroutines. // Require a gdb that can read DW_TAG_variant_part. -// min-gdb-version: 8.2 +//@ min-gdb-version: 8.2 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/issue-7712.rs b/tests/debuginfo/issue-7712.rs index 3a7565f559a7..35e6b10c4e58 100644 --- a/tests/debuginfo/issue-7712.rs +++ b/tests/debuginfo/issue-7712.rs @@ -1,5 +1,5 @@ -// compile-flags:-C debuginfo=1 -// min-lldb-version: 310 +//@ compile-flags:-C debuginfo=1 +//@ min-lldb-version: 310 pub trait TraitWithDefaultMethod : Sized { fn method(self) { diff --git a/tests/debuginfo/lexical-scope-in-for-loop.rs b/tests/debuginfo/lexical-scope-in-for-loop.rs index 28acab5cb974..93be5288a640 100644 --- a/tests/debuginfo/lexical-scope-in-for-loop.rs +++ b/tests/debuginfo/lexical-scope-in-for-loop.rs @@ -1,6 +1,6 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/lexical-scope-in-if-let.rs b/tests/debuginfo/lexical-scope-in-if-let.rs index 8fee459bd7ac..6e5e9900abea 100644 --- a/tests/debuginfo/lexical-scope-in-if-let.rs +++ b/tests/debuginfo/lexical-scope-in-if-let.rs @@ -1,4 +1,4 @@ -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS ================================================================================== diff --git a/tests/debuginfo/lexical-scope-in-if.rs b/tests/debuginfo/lexical-scope-in-if.rs index 06bef329df51..88b4244a503e 100644 --- a/tests/debuginfo/lexical-scope-in-if.rs +++ b/tests/debuginfo/lexical-scope-in-if.rs @@ -1,6 +1,6 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/lexical-scope-in-match.rs b/tests/debuginfo/lexical-scope-in-match.rs index 64b7c809d0d8..8a9ecfad249e 100644 --- a/tests/debuginfo/lexical-scope-in-match.rs +++ b/tests/debuginfo/lexical-scope-in-match.rs @@ -1,6 +1,6 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/lexical-scope-in-parameterless-closure.rs b/tests/debuginfo/lexical-scope-in-parameterless-closure.rs index d6b947fad8e1..fa2cd281c807 100644 --- a/tests/debuginfo/lexical-scope-in-parameterless-closure.rs +++ b/tests/debuginfo/lexical-scope-in-parameterless-closure.rs @@ -1,6 +1,6 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-C debuginfo=1 +//@ compile-flags:-C debuginfo=1 // gdb-command:run // lldb-command:run diff --git a/tests/debuginfo/lexical-scope-in-stack-closure.rs b/tests/debuginfo/lexical-scope-in-stack-closure.rs index 18d9a809e284..eeafed9f4db1 100644 --- a/tests/debuginfo/lexical-scope-in-stack-closure.rs +++ b/tests/debuginfo/lexical-scope-in-stack-closure.rs @@ -1,6 +1,6 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/lexical-scope-in-unconditional-loop.rs b/tests/debuginfo/lexical-scope-in-unconditional-loop.rs index 6b6af20639e4..ec998975bc7c 100644 --- a/tests/debuginfo/lexical-scope-in-unconditional-loop.rs +++ b/tests/debuginfo/lexical-scope-in-unconditional-loop.rs @@ -1,6 +1,6 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/lexical-scope-in-unique-closure.rs b/tests/debuginfo/lexical-scope-in-unique-closure.rs index 9dd44ae8baf3..9376d0391875 100644 --- a/tests/debuginfo/lexical-scope-in-unique-closure.rs +++ b/tests/debuginfo/lexical-scope-in-unique-closure.rs @@ -1,6 +1,6 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/lexical-scope-in-while.rs b/tests/debuginfo/lexical-scope-in-while.rs index 07f4a846fd90..f70ef9c2dd17 100644 --- a/tests/debuginfo/lexical-scope-in-while.rs +++ b/tests/debuginfo/lexical-scope-in-while.rs @@ -1,6 +1,6 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/lexical-scope-with-macro.rs b/tests/debuginfo/lexical-scope-with-macro.rs index 3dab7939265a..400dde6af313 100644 --- a/tests/debuginfo/lexical-scope-with-macro.rs +++ b/tests/debuginfo/lexical-scope-with-macro.rs @@ -1,7 +1,7 @@ -// min-lldb-version: 310 -// ignore-lldb FIXME #48807 +//@ min-lldb-version: 310 +//@ ignore-lldb FIXME #48807 -// compile-flags:-g -Zdebug-macros +//@ compile-flags:-g -Zdebug-macros // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/lexical-scopes-in-block-expression.rs b/tests/debuginfo/lexical-scopes-in-block-expression.rs index 72621ffc7426..09cb81424747 100644 --- a/tests/debuginfo/lexical-scopes-in-block-expression.rs +++ b/tests/debuginfo/lexical-scopes-in-block-expression.rs @@ -1,7 +1,7 @@ -// min-lldb-version: 310 -// ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 +//@ min-lldb-version: 310 +//@ ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/limited-debuginfo.rs b/tests/debuginfo/limited-debuginfo.rs index bd381cd0e22d..32f14955bfa3 100644 --- a/tests/debuginfo/limited-debuginfo.rs +++ b/tests/debuginfo/limited-debuginfo.rs @@ -1,7 +1,7 @@ -// ignore-lldb -// ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 +//@ ignore-lldb +//@ ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 -// compile-flags:-C debuginfo=1 +//@ compile-flags:-C debuginfo=1 // Make sure functions have proper names // gdb-command:info functions diff --git a/tests/debuginfo/macro-stepping.rs b/tests/debuginfo/macro-stepping.rs index a7287cffd029..69cabd92298c 100644 --- a/tests/debuginfo/macro-stepping.rs +++ b/tests/debuginfo/macro-stepping.rs @@ -1,17 +1,17 @@ -// ignore-windows -// ignore-android -// ignore-aarch64 -// min-lldb-version: 310 -// ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 +//@ ignore-windows +//@ ignore-android +//@ ignore-aarch64 +//@ min-lldb-version: 310 +//@ ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 -// aux-build:macro-stepping.rs +//@ aux-build:macro-stepping.rs #![allow(unused)] #[macro_use] extern crate macro_stepping; // exports new_scope!() -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/marker-types.rs b/tests/debuginfo/marker-types.rs index 8373d7856bb3..6686b057ef7b 100644 --- a/tests/debuginfo/marker-types.rs +++ b/tests/debuginfo/marker-types.rs @@ -1,5 +1,5 @@ -// only-cdb -// compile-flags:-g +//@ only-cdb +//@ compile-flags:-g // === CDB TESTS ================================================================================== diff --git a/tests/debuginfo/method-on-enum.rs b/tests/debuginfo/method-on-enum.rs index aaa9bd9d6f97..454967c6cb71 100644 --- a/tests/debuginfo/method-on-enum.rs +++ b/tests/debuginfo/method-on-enum.rs @@ -1,7 +1,7 @@ -// min-lldb-version: 310 -// ignore-test // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 +//@ min-lldb-version: 310 +//@ ignore-test // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/method-on-generic-struct.rs b/tests/debuginfo/method-on-generic-struct.rs index 138d8391d40a..562798c27daa 100644 --- a/tests/debuginfo/method-on-generic-struct.rs +++ b/tests/debuginfo/method-on-generic-struct.rs @@ -1,8 +1,8 @@ // Some versions of the non-rust-enabled LLDB print the wrong generic // parameter type names in this test. -// needs-rust-lldb +//@ needs-rust-lldb -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/method-on-struct.rs b/tests/debuginfo/method-on-struct.rs index deed4f9cc0ad..bb94ced305d6 100644 --- a/tests/debuginfo/method-on-struct.rs +++ b/tests/debuginfo/method-on-struct.rs @@ -1,6 +1,6 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/method-on-trait.rs b/tests/debuginfo/method-on-trait.rs index 7ebebfa72b92..bc8def40105c 100644 --- a/tests/debuginfo/method-on-trait.rs +++ b/tests/debuginfo/method-on-trait.rs @@ -1,6 +1,6 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/method-on-tuple-struct.rs b/tests/debuginfo/method-on-tuple-struct.rs index a5a87b2ad6f2..7ac0a2d85748 100644 --- a/tests/debuginfo/method-on-tuple-struct.rs +++ b/tests/debuginfo/method-on-tuple-struct.rs @@ -1,6 +1,6 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/msvc-pretty-enums.rs b/tests/debuginfo/msvc-pretty-enums.rs index 400e8801ca21..c6dd9f7939df 100644 --- a/tests/debuginfo/msvc-pretty-enums.rs +++ b/tests/debuginfo/msvc-pretty-enums.rs @@ -1,5 +1,5 @@ -// only-cdb -// compile-flags:-g +//@ only-cdb +//@ compile-flags:-g // cdb-command: g diff --git a/tests/debuginfo/msvc-scalarpair-params.rs b/tests/debuginfo/msvc-scalarpair-params.rs index ae67f6981519..436a5e07035e 100644 --- a/tests/debuginfo/msvc-scalarpair-params.rs +++ b/tests/debuginfo/msvc-scalarpair-params.rs @@ -1,5 +1,5 @@ -// only-cdb -// compile-flags: -g +//@ only-cdb +//@ compile-flags: -g // cdb-command: g diff --git a/tests/debuginfo/multi-byte-chars.rs b/tests/debuginfo/multi-byte-chars.rs index 5c68a88f2fb1..8fb066c71857 100644 --- a/tests/debuginfo/multi-byte-chars.rs +++ b/tests/debuginfo/multi-byte-chars.rs @@ -1,6 +1,6 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g // This test checks whether debuginfo generation can handle multi-byte UTF-8 // characters at the end of a block. There's no need to do anything in the diff --git a/tests/debuginfo/multi-cgu.rs b/tests/debuginfo/multi-cgu.rs index 0ca7ce60e490..b2ad1d3cd95c 100644 --- a/tests/debuginfo/multi-cgu.rs +++ b/tests/debuginfo/multi-cgu.rs @@ -2,9 +2,9 @@ // compiled with multiple codegen units. (see #39160) -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g -Ccodegen-units=2 +//@ compile-flags:-g -Ccodegen-units=2 // === GDB TESTS =============================================================== diff --git a/tests/debuginfo/multiple-functions-equal-var-names.rs b/tests/debuginfo/multiple-functions-equal-var-names.rs index 32b639c7f213..08446997b424 100644 --- a/tests/debuginfo/multiple-functions-equal-var-names.rs +++ b/tests/debuginfo/multiple-functions-equal-var-names.rs @@ -1,6 +1,6 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/multiple-functions.rs b/tests/debuginfo/multiple-functions.rs index 873857b6ae7c..2c4092fd5a33 100644 --- a/tests/debuginfo/multiple-functions.rs +++ b/tests/debuginfo/multiple-functions.rs @@ -1,6 +1,6 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/mutable-locs.rs b/tests/debuginfo/mutable-locs.rs index 688483e43e4d..5ba4adeca20e 100644 --- a/tests/debuginfo/mutable-locs.rs +++ b/tests/debuginfo/mutable-locs.rs @@ -1,8 +1,8 @@ // Testing the display of Cell, RefCell, and RefMut in cdb. // cdb-only -// min-cdb-version: 10.0.18317.1001 -// compile-flags:-g +//@ min-cdb-version: 10.0.18317.1001 +//@ compile-flags:-g // === CDB TESTS ================================================================================== diff --git a/tests/debuginfo/mutex.rs b/tests/debuginfo/mutex.rs index ab9fb8b7e81d..1201da0dd7b8 100644 --- a/tests/debuginfo/mutex.rs +++ b/tests/debuginfo/mutex.rs @@ -1,8 +1,8 @@ // Testing the display of Mutex and MutexGuard in cdb. // cdb-only -// min-cdb-version: 10.0.21287.1005 -// compile-flags:-g +//@ min-cdb-version: 10.0.21287.1005 +//@ compile-flags:-g // === CDB TESTS ================================================================================== // diff --git a/tests/debuginfo/name-shadowing-and-scope-nesting.rs b/tests/debuginfo/name-shadowing-and-scope-nesting.rs index 6cee893ce3fa..e8860b2d1048 100644 --- a/tests/debuginfo/name-shadowing-and-scope-nesting.rs +++ b/tests/debuginfo/name-shadowing-and-scope-nesting.rs @@ -1,6 +1,6 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/no_mangle-info.rs b/tests/debuginfo/no_mangle-info.rs index e22d368745f5..15629d217ba7 100644 --- a/tests/debuginfo/no_mangle-info.rs +++ b/tests/debuginfo/no_mangle-info.rs @@ -1,5 +1,5 @@ -// compile-flags:-g -// min-gdb-version: 10.1 +//@ compile-flags:-g +//@ min-gdb-version: 10.1 // === GDB TESTS =================================================================================== // gdb-command:run diff --git a/tests/debuginfo/numeric-types.rs b/tests/debuginfo/numeric-types.rs index a1b5ae792a16..e3df1fbc5201 100644 --- a/tests/debuginfo/numeric-types.rs +++ b/tests/debuginfo/numeric-types.rs @@ -1,7 +1,7 @@ -// compile-flags:-g +//@ compile-flags:-g -// min-gdb-version: 8.1 -// ignore-windows-gnu // emit_debug_gdb_scripts is disabled on Windows +//@ min-gdb-version: 8.1 +//@ ignore-windows-gnu // emit_debug_gdb_scripts is disabled on Windows // Tests the visualizations for `NonZero`, `Wrapping` and // `Atomic{Bool,I8,I16,I32,I64,Isize,U8,U16,U32,U64,Usize}` located in `libcore.natvis`. diff --git a/tests/debuginfo/option-like-enum.rs b/tests/debuginfo/option-like-enum.rs index 04d08b9e6a5c..b2a8aa1c29a0 100644 --- a/tests/debuginfo/option-like-enum.rs +++ b/tests/debuginfo/option-like-enum.rs @@ -1,8 +1,8 @@ -// ignore-test // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 +//@ ignore-test // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/packed-struct-with-destructor.rs b/tests/debuginfo/packed-struct-with-destructor.rs index 196d85b4181f..19788339efa9 100644 --- a/tests/debuginfo/packed-struct-with-destructor.rs +++ b/tests/debuginfo/packed-struct-with-destructor.rs @@ -1,6 +1,6 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/packed-struct.rs b/tests/debuginfo/packed-struct.rs index 7d1893a9431c..0276a0ffb082 100644 --- a/tests/debuginfo/packed-struct.rs +++ b/tests/debuginfo/packed-struct.rs @@ -1,7 +1,7 @@ -// min-lldb-version: 310 -// ignore-gdb-version: 7.11.90 - 7.12.9 +//@ min-lldb-version: 310 +//@ ignore-gdb-version: 7.11.90 - 7.12.9 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/pretty-huge-vec.rs b/tests/debuginfo/pretty-huge-vec.rs index 84f76ba4e6e0..f4b5345b66d7 100644 --- a/tests/debuginfo/pretty-huge-vec.rs +++ b/tests/debuginfo/pretty-huge-vec.rs @@ -1,9 +1,9 @@ -// ignore-windows failing on win32 bot -// ignore-freebsd: gdb package too new -// ignore-android: FIXME(#10381) -// compile-flags:-g -// min-gdb-version: 8.1 -// min-lldb-version: 310 +//@ ignore-windows failing on win32 bot +//@ ignore-freebsd: gdb package too new +//@ ignore-android: FIXME(#10381) +//@ compile-flags:-g +//@ min-gdb-version: 8.1 +//@ min-lldb-version: 310 // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/pretty-slices.rs b/tests/debuginfo/pretty-slices.rs index 6adc8757b726..4faa317d6a19 100644 --- a/tests/debuginfo/pretty-slices.rs +++ b/tests/debuginfo/pretty-slices.rs @@ -1,6 +1,6 @@ -// ignore-android: FIXME(#10381) -// ignore-windows -// compile-flags:-g +//@ ignore-android: FIXME(#10381) +//@ ignore-windows +//@ compile-flags:-g // gdb-command: run diff --git a/tests/debuginfo/pretty-std-collections-hash.rs b/tests/debuginfo/pretty-std-collections-hash.rs index 40bde8606996..2504a60cbcd8 100644 --- a/tests/debuginfo/pretty-std-collections-hash.rs +++ b/tests/debuginfo/pretty-std-collections-hash.rs @@ -1,9 +1,9 @@ // CDB doesn't like how libstd.natvis casts to tuples before this version. // https://github.com/rust-lang/rust/issues/76352#issuecomment-687640746 -// min-cdb-version: 10.0.18362.1 +//@ min-cdb-version: 10.0.18362.1 // cdb-only -// compile-flags:-g +//@ compile-flags:-g // === CDB TESTS ================================================================================== diff --git a/tests/debuginfo/pretty-std-collections.rs b/tests/debuginfo/pretty-std-collections.rs index 93a0dff68489..6e7c8dfbbe82 100644 --- a/tests/debuginfo/pretty-std-collections.rs +++ b/tests/debuginfo/pretty-std-collections.rs @@ -1,13 +1,13 @@ -// ignore-windows failing on win32 bot -// ignore-freebsd: gdb package too new -// ignore-android: FIXME(#10381) -// compile-flags:-g +//@ ignore-windows failing on win32 bot +//@ ignore-freebsd: gdb package too new +//@ ignore-android: FIXME(#10381) +//@ compile-flags:-g // The pretty printers being tested here require the patch from // https://sourceware.org/bugzilla/show_bug.cgi?id=21763 -// min-gdb-version: 8.1 +//@ min-gdb-version: 8.1 -// min-lldb-version: 310 +//@ min-lldb-version: 310 // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/pretty-std.rs b/tests/debuginfo/pretty-std.rs index c7df7dc3cb3b..2c2795379c93 100644 --- a/tests/debuginfo/pretty-std.rs +++ b/tests/debuginfo/pretty-std.rs @@ -1,10 +1,11 @@ -// ignore-freebsd: gdb package too new -// only-cdb // "Temporarily" ignored on GDB/LLDB due to debuginfo tests being disabled, see PR 47155 -// ignore-android: FIXME(#10381) -// compile-flags:-g -// min-gdb-version: 7.7 -// min-lldb-version: 310 -// min-cdb-version: 10.0.18317.1001 +// ignore-tidy-linelength +//@ ignore-freebsd: gdb package too new +//@ only-cdb // "Temporarily" ignored on GDB/LLDB due to debuginfo tests being disabled, see PR 47155 +//@ ignore-android: FIXME(#10381) +//@ compile-flags:-g +//@ min-gdb-version: 7.7 +//@ min-lldb-version: 310 +//@ min-cdb-version: 10.0.18317.1001 // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/pretty-uninitialized-vec.rs b/tests/debuginfo/pretty-uninitialized-vec.rs index 61791f48f4db..225b4a6d5345 100644 --- a/tests/debuginfo/pretty-uninitialized-vec.rs +++ b/tests/debuginfo/pretty-uninitialized-vec.rs @@ -1,9 +1,9 @@ -// ignore-windows failing on win32 bot -// ignore-freebsd: gdb package too new -// ignore-android: FIXME(#10381) -// compile-flags:-g -// min-gdb-version: 8.1 -// min-lldb-version: 310 +//@ ignore-windows failing on win32 bot +//@ ignore-freebsd: gdb package too new +//@ ignore-android: FIXME(#10381) +//@ compile-flags:-g +//@ min-gdb-version: 8.1 +//@ min-lldb-version: 310 // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/range-types.rs b/tests/debuginfo/range-types.rs index 7362a50a0301..8c18fd9addd4 100644 --- a/tests/debuginfo/range-types.rs +++ b/tests/debuginfo/range-types.rs @@ -1,8 +1,8 @@ // Testing the display of range types in cdb. // cdb-only -// min-cdb-version: 10.0.18317.1001 -// compile-flags:-g +//@ min-cdb-version: 10.0.18317.1001 +//@ compile-flags:-g // === CDB TESTS ================================================================================== diff --git a/tests/debuginfo/rc_arc.rs b/tests/debuginfo/rc_arc.rs index 1d07bd76eabd..3cf6635a173b 100644 --- a/tests/debuginfo/rc_arc.rs +++ b/tests/debuginfo/rc_arc.rs @@ -1,8 +1,8 @@ -// ignore-windows-gnu: pretty-printers are not loaded -// compile-flags:-g +//@ ignore-windows-gnu: pretty-printers are not loaded +//@ compile-flags:-g -// min-gdb-version: 8.1 -// min-cdb-version: 10.0.18317.1001 +//@ min-gdb-version: 8.1 +//@ min-cdb-version: 10.0.18317.1001 // === GDB TESTS ================================================================================== diff --git a/tests/debuginfo/recursive-enum.rs b/tests/debuginfo/recursive-enum.rs index a62d4807a6cd..c2c3e71b8a4f 100644 --- a/tests/debuginfo/recursive-enum.rs +++ b/tests/debuginfo/recursive-enum.rs @@ -1,6 +1,6 @@ -// ignore-lldb +//@ ignore-lldb -// compile-flags:-g +//@ compile-flags:-g // gdb-command:run // Test whether compiling a recursive enum definition crashes debug info generation. The test case diff --git a/tests/debuginfo/recursive-struct.rs b/tests/debuginfo/recursive-struct.rs index eb14af8c588d..1d039527d1ab 100644 --- a/tests/debuginfo/recursive-struct.rs +++ b/tests/debuginfo/recursive-struct.rs @@ -1,9 +1,9 @@ -// ignore-lldb +//@ ignore-lldb // Require a gdb that can read DW_TAG_variant_part. -// min-gdb-version: 8.2 +//@ min-gdb-version: 8.2 -// compile-flags:-g +//@ compile-flags:-g // gdb-command:run diff --git a/tests/debuginfo/reference-debuginfo.rs b/tests/debuginfo/reference-debuginfo.rs index 85ade170ac6f..1051cc7113c4 100644 --- a/tests/debuginfo/reference-debuginfo.rs +++ b/tests/debuginfo/reference-debuginfo.rs @@ -2,8 +2,8 @@ // That pass replaces debuginfo for `a => _x` where `_x = &b` to be `a => &b`, // and leaves codegen to create a ladder of allocations so as `*a == b`. // -// compile-flags:-g -Zmir-enable-passes=+ReferencePropagation,-ConstDebugInfo -// min-lldb-version: 310 +//@ compile-flags:-g -Zmir-enable-passes=+ReferencePropagation,-ConstDebugInfo +//@ min-lldb-version: 310 // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/regression-bad-location-list-67992.rs b/tests/debuginfo/regression-bad-location-list-67992.rs index cc7c4a0d71a3..c397b403026d 100644 --- a/tests/debuginfo/regression-bad-location-list-67992.rs +++ b/tests/debuginfo/regression-bad-location-list-67992.rs @@ -1,4 +1,4 @@ -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/result-types.rs b/tests/debuginfo/result-types.rs index f1944fa38d27..8b91d0ba27ef 100644 --- a/tests/debuginfo/result-types.rs +++ b/tests/debuginfo/result-types.rs @@ -1,6 +1,6 @@ // cdb-only -// min-cdb-version: 10.0.18317.1001 -// compile-flags:-g +//@ min-cdb-version: 10.0.18317.1001 +//@ compile-flags:-g // === CDB TESTS ================================================================================== diff --git a/tests/debuginfo/rwlock-read.rs b/tests/debuginfo/rwlock-read.rs index 7e9838871ba4..7abbfd70ffb1 100644 --- a/tests/debuginfo/rwlock-read.rs +++ b/tests/debuginfo/rwlock-read.rs @@ -1,8 +1,8 @@ // Testing the display of RwLock and RwLockReadGuard in cdb. // cdb-only -// min-cdb-version: 10.0.18317.1001 -// compile-flags:-g +//@ min-cdb-version: 10.0.18317.1001 +//@ compile-flags:-g // === CDB TESTS ================================================================================== // diff --git a/tests/debuginfo/rwlock-write.rs b/tests/debuginfo/rwlock-write.rs index 8decf54c1773..d78643036668 100644 --- a/tests/debuginfo/rwlock-write.rs +++ b/tests/debuginfo/rwlock-write.rs @@ -1,8 +1,8 @@ // Testing the display of RwLockWriteGuard. // cdb-only -// min-cdb-version: 10.0.18317.1001 -// compile-flags:-g +//@ min-cdb-version: 10.0.18317.1001 +//@ compile-flags:-g // === CDB TESTS ================================================================================== // diff --git a/tests/debuginfo/self-in-default-method.rs b/tests/debuginfo/self-in-default-method.rs index b8b5add0996a..eae1d58c1244 100644 --- a/tests/debuginfo/self-in-default-method.rs +++ b/tests/debuginfo/self-in-default-method.rs @@ -1,6 +1,6 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/self-in-generic-default-method.rs b/tests/debuginfo/self-in-generic-default-method.rs index efce449e312e..92be253e18ab 100644 --- a/tests/debuginfo/self-in-generic-default-method.rs +++ b/tests/debuginfo/self-in-generic-default-method.rs @@ -1,6 +1,6 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/shadowed-argument.rs b/tests/debuginfo/shadowed-argument.rs index 0835273ac297..33f73340a832 100644 --- a/tests/debuginfo/shadowed-argument.rs +++ b/tests/debuginfo/shadowed-argument.rs @@ -1,6 +1,6 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/shadowed-variable.rs b/tests/debuginfo/shadowed-variable.rs index 9f060811f180..60c392b15cb0 100644 --- a/tests/debuginfo/shadowed-variable.rs +++ b/tests/debuginfo/shadowed-variable.rs @@ -1,5 +1,5 @@ -// min-lldb-version: 310 -// compile-flags:-g +//@ min-lldb-version: 310 +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/should-fail.rs b/tests/debuginfo/should-fail.rs index eef6d99d2a91..f3a8f52e0fa5 100644 --- a/tests/debuginfo/should-fail.rs +++ b/tests/debuginfo/should-fail.rs @@ -1,9 +1,9 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 // == Test [gdb|lldb]-[command|check] are parsed correctly === -// should-fail -// needs-run-enabled -// compile-flags:-g +//@ should-fail +//@ needs-run-enabled +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/simd.rs b/tests/debuginfo/simd.rs index b7bfe44b6ec4..a5dd2e61a8de 100644 --- a/tests/debuginfo/simd.rs +++ b/tests/debuginfo/simd.rs @@ -1,12 +1,12 @@ // Need a fix for LLDB first... -// ignore-lldb +//@ ignore-lldb // FIXME: LLVM generates invalid debug info for variables requiring // dynamic stack realignment, which is the case on s390x for vector // types with non-vector ABI. -// ignore-s390x +//@ ignore-s390x -// compile-flags:-g +//@ compile-flags:-g // gdb-command:run // gdbg-command:print/d vi8x16 diff --git a/tests/debuginfo/simple-lexical-scope.rs b/tests/debuginfo/simple-lexical-scope.rs index 01db79e1e66b..f4be2035d3cb 100644 --- a/tests/debuginfo/simple-lexical-scope.rs +++ b/tests/debuginfo/simple-lexical-scope.rs @@ -1,6 +1,6 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/simple-struct.rs b/tests/debuginfo/simple-struct.rs index fea8109223ad..100763f60b6f 100644 --- a/tests/debuginfo/simple-struct.rs +++ b/tests/debuginfo/simple-struct.rs @@ -1,7 +1,7 @@ -// min-lldb-version: 310 -// ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 +//@ min-lldb-version: 310 +//@ ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 -// compile-flags: -g -Zmir-enable-passes=-CheckAlignment +//@ compile-flags: -g -Zmir-enable-passes=-CheckAlignment // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/simple-tuple.rs b/tests/debuginfo/simple-tuple.rs index 0807cfedce01..2d8905a77bf7 100644 --- a/tests/debuginfo/simple-tuple.rs +++ b/tests/debuginfo/simple-tuple.rs @@ -1,7 +1,7 @@ -// min-lldb-version: 310 -// ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 +//@ min-lldb-version: 310 +//@ ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/skip_second_statement.rs b/tests/debuginfo/skip_second_statement.rs index 535b54747631..e0f3325bcff5 100644 --- a/tests/debuginfo/skip_second_statement.rs +++ b/tests/debuginfo/skip_second_statement.rs @@ -1,10 +1,10 @@ -// ignore-lldb +//@ ignore-lldb // Test that statement, skipped/added/reordered by macros, is correctly processed in debuginfo. // Performed step-over and step-into debug stepping through call statements. // collapse_debuginfo feature disabled. -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/skip_second_statement_collapse.rs b/tests/debuginfo/skip_second_statement_collapse.rs index a0557ca9feec..f1a74b629e48 100644 --- a/tests/debuginfo/skip_second_statement_collapse.rs +++ b/tests/debuginfo/skip_second_statement_collapse.rs @@ -1,11 +1,11 @@ -// ignore-lldb +//@ ignore-lldb #![feature(collapse_debuginfo)] // Test that statement, skipped/added/reordered by macros, is correctly processed in debuginfo // Performed step-over and step-into debug stepping through call statements. // collapse_debuginfo feature enabled. -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/static-method-on-struct-and-enum.rs b/tests/debuginfo/static-method-on-struct-and-enum.rs index 864c61c15d14..ad078122ddeb 100644 --- a/tests/debuginfo/static-method-on-struct-and-enum.rs +++ b/tests/debuginfo/static-method-on-struct-and-enum.rs @@ -1,6 +1,6 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/step-into-match.rs b/tests/debuginfo/step-into-match.rs index 4a5f7857097a..f702b116b20b 100644 --- a/tests/debuginfo/step-into-match.rs +++ b/tests/debuginfo/step-into-match.rs @@ -1,5 +1,5 @@ -// compile-flags: -g -// ignore-android: FIXME(#10381) +//@ compile-flags: -g +//@ ignore-android: FIXME(#10381) // === GDB TESTS ============================================================== diff --git a/tests/debuginfo/struct-in-enum.rs b/tests/debuginfo/struct-in-enum.rs index 41d15af14ede..c340f71a6cc4 100644 --- a/tests/debuginfo/struct-in-enum.rs +++ b/tests/debuginfo/struct-in-enum.rs @@ -1,8 +1,8 @@ -// min-lldb-version: 310 -// ignore-gdb-version: 7.11.90 - 7.12.9 -// ignore-test // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 +//@ min-lldb-version: 310 +//@ ignore-gdb-version: 7.11.90 - 7.12.9 +//@ ignore-test // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/struct-in-struct.rs b/tests/debuginfo/struct-in-struct.rs index a9e7797ec700..287564a36cd3 100644 --- a/tests/debuginfo/struct-in-struct.rs +++ b/tests/debuginfo/struct-in-struct.rs @@ -1,6 +1,6 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/struct-namespace.rs b/tests/debuginfo/struct-namespace.rs index 81752c269805..f9262a458d52 100644 --- a/tests/debuginfo/struct-namespace.rs +++ b/tests/debuginfo/struct-namespace.rs @@ -1,6 +1,6 @@ -// ignore-gdb -// compile-flags:-g -// min-lldb-version: 310 +//@ ignore-gdb +//@ compile-flags:-g +//@ min-lldb-version: 310 // Check that structs get placed in the correct namespace diff --git a/tests/debuginfo/struct-style-enum.rs b/tests/debuginfo/struct-style-enum.rs index 0152dd9ea9b1..2f155d2b83ee 100644 --- a/tests/debuginfo/struct-style-enum.rs +++ b/tests/debuginfo/struct-style-enum.rs @@ -1,8 +1,8 @@ // Require a gdb or lldb that can read DW_TAG_variant_part. -// min-gdb-version: 8.2 -// needs-rust-lldb +//@ min-gdb-version: 8.2 +//@ needs-rust-lldb -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/struct-with-destructor.rs b/tests/debuginfo/struct-with-destructor.rs index 4334cd9028b8..9b81136e7a88 100644 --- a/tests/debuginfo/struct-with-destructor.rs +++ b/tests/debuginfo/struct-with-destructor.rs @@ -1,6 +1,6 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/thread-names.rs b/tests/debuginfo/thread-names.rs index 2c5b3f272e04..1b9ada6fc52d 100644 --- a/tests/debuginfo/thread-names.rs +++ b/tests/debuginfo/thread-names.rs @@ -1,10 +1,10 @@ -// compile-flags:-g -// revisions: macos windows +//@ compile-flags:-g +//@ revisions: macos windows // We can't set the main thread name on Linux because it renames the process (#97191) -//[macos] only-macos -//[windows] only-windows -// ignore-sgx -// ignore-windows-gnu +//@[macos] only-macos +//@[windows] only-windows +//@ ignore-sgx +//@ ignore-windows-gnu // === GDB TESTS ================================================================================== // diff --git a/tests/debuginfo/thread.rs b/tests/debuginfo/thread.rs index 5516f4fec3ed..0415f586f5d9 100644 --- a/tests/debuginfo/thread.rs +++ b/tests/debuginfo/thread.rs @@ -1,8 +1,8 @@ // Testing the display of JoinHandle and Thread in cdb. // cdb-only -// min-cdb-version: 10.0.18317.1001 -// compile-flags:-g +//@ min-cdb-version: 10.0.18317.1001 +//@ compile-flags:-g // === CDB TESTS ================================================================================== // diff --git a/tests/debuginfo/trait-pointers.rs b/tests/debuginfo/trait-pointers.rs index e12daaf114e1..2b4dde4d3a0c 100644 --- a/tests/debuginfo/trait-pointers.rs +++ b/tests/debuginfo/trait-pointers.rs @@ -1,6 +1,6 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g // gdb-command:run // lldb-command:run diff --git a/tests/debuginfo/tuple-in-struct.rs b/tests/debuginfo/tuple-in-struct.rs index 759eab8e8a0c..e36d924e9259 100644 --- a/tests/debuginfo/tuple-in-struct.rs +++ b/tests/debuginfo/tuple-in-struct.rs @@ -1,6 +1,6 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g // gdb-command:run diff --git a/tests/debuginfo/tuple-in-tuple.rs b/tests/debuginfo/tuple-in-tuple.rs index 578db74e9eeb..c1cfe64a52e9 100644 --- a/tests/debuginfo/tuple-in-tuple.rs +++ b/tests/debuginfo/tuple-in-tuple.rs @@ -1,6 +1,6 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/tuple-struct.rs b/tests/debuginfo/tuple-struct.rs index b8702f970a3a..5eeb1a6eed4e 100644 --- a/tests/debuginfo/tuple-struct.rs +++ b/tests/debuginfo/tuple-struct.rs @@ -1,6 +1,6 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/tuple-style-enum.rs b/tests/debuginfo/tuple-style-enum.rs index 60f3ecbd21e2..e3e1684cc28a 100644 --- a/tests/debuginfo/tuple-style-enum.rs +++ b/tests/debuginfo/tuple-style-enum.rs @@ -1,8 +1,8 @@ // Require a gdb or lldb that can read DW_TAG_variant_part. -// min-gdb-version: 8.2 -// needs-rust-lldb +//@ min-gdb-version: 8.2 +//@ needs-rust-lldb -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/type-names.rs b/tests/debuginfo/type-names.rs index c5ce044dd53f..6831786c228d 100644 --- a/tests/debuginfo/type-names.rs +++ b/tests/debuginfo/type-names.rs @@ -1,9 +1,9 @@ -// ignore-lldb +//@ ignore-lldb // GDB changed the way that it formatted Foreign types -// min-gdb-version: 9.2 +//@ min-gdb-version: 9.2 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/union-smoke.rs b/tests/debuginfo/union-smoke.rs index 4d4b6cc96fb5..aa57ebdc844c 100644 --- a/tests/debuginfo/union-smoke.rs +++ b/tests/debuginfo/union-smoke.rs @@ -1,9 +1,9 @@ -// min-lldb-version: 310 -// ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 +//@ min-lldb-version: 310 +//@ ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 -// ignore-gdb-version: 7.11.90 - 7.12.9 +//@ ignore-gdb-version: 7.11.90 - 7.12.9 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/unique-enum.rs b/tests/debuginfo/unique-enum.rs index 1ff6f5d9cbe1..db2b4403ec66 100644 --- a/tests/debuginfo/unique-enum.rs +++ b/tests/debuginfo/unique-enum.rs @@ -1,8 +1,8 @@ // Require a gdb or lldb that can read DW_TAG_variant_part. -// min-gdb-version: 8.2 -// needs-rust-lldb +//@ min-gdb-version: 8.2 +//@ needs-rust-lldb -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/unit-type.rs b/tests/debuginfo/unit-type.rs index 7aab41a3e7c9..60b105fc53d0 100644 --- a/tests/debuginfo/unit-type.rs +++ b/tests/debuginfo/unit-type.rs @@ -1,7 +1,7 @@ -// compile-flags:-g +//@ compile-flags:-g // We only test Rust-aware versions of GDB: -// min-gdb-version: 8.2 +//@ min-gdb-version: 8.2 // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/unreachable-locals.rs b/tests/debuginfo/unreachable-locals.rs index 5787f819cb93..72effc103913 100644 --- a/tests/debuginfo/unreachable-locals.rs +++ b/tests/debuginfo/unreachable-locals.rs @@ -1,6 +1,6 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g #![allow(unused_variables)] #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/unsized.rs b/tests/debuginfo/unsized.rs index 3b8280bc4a9e..f76376de3836 100644 --- a/tests/debuginfo/unsized.rs +++ b/tests/debuginfo/unsized.rs @@ -1,5 +1,5 @@ -// compile-flags:-g -// ignore-gdb-version: 13.1 - 99.0 +//@ compile-flags:-g +//@ ignore-gdb-version: 13.1 - 99.0 // ^ https://sourceware.org/bugzilla/show_bug.cgi?id=30330 // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/var-captured-in-nested-closure.rs b/tests/debuginfo/var-captured-in-nested-closure.rs index 537c0b50b8b6..75ab245e13e0 100644 --- a/tests/debuginfo/var-captured-in-nested-closure.rs +++ b/tests/debuginfo/var-captured-in-nested-closure.rs @@ -1,6 +1,6 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/var-captured-in-sendable-closure.rs b/tests/debuginfo/var-captured-in-sendable-closure.rs index 39930e04e4c5..b7992deef44c 100644 --- a/tests/debuginfo/var-captured-in-sendable-closure.rs +++ b/tests/debuginfo/var-captured-in-sendable-closure.rs @@ -1,6 +1,6 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/var-captured-in-stack-closure.rs b/tests/debuginfo/var-captured-in-stack-closure.rs index d68409a9d520..eb68b081a6d8 100644 --- a/tests/debuginfo/var-captured-in-stack-closure.rs +++ b/tests/debuginfo/var-captured-in-stack-closure.rs @@ -1,6 +1,6 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/vec-slices.rs b/tests/debuginfo/vec-slices.rs index de4099a7f50c..b044110fc789 100644 --- a/tests/debuginfo/vec-slices.rs +++ b/tests/debuginfo/vec-slices.rs @@ -1,6 +1,6 @@ -// min-lldb-version: 310 +//@ min-lldb-version: 310 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/vec.rs b/tests/debuginfo/vec.rs index 895661816b86..27d04094e3c6 100644 --- a/tests/debuginfo/vec.rs +++ b/tests/debuginfo/vec.rs @@ -1,7 +1,7 @@ -// min-lldb-version: 310 -// ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 +//@ min-lldb-version: 310 +//@ ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 -// compile-flags:-g +//@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/incremental/add_private_fn_at_krate_root_cc/struct_point.rs b/tests/incremental/add_private_fn_at_krate_root_cc/struct_point.rs index ea1ea1943e97..65d363b35a67 100644 --- a/tests/incremental/add_private_fn_at_krate_root_cc/struct_point.rs +++ b/tests/incremental/add_private_fn_at_krate_root_cc/struct_point.rs @@ -2,10 +2,10 @@ // crate. This should not cause anything we use to be invalidated. // Regression test for #36168. -// revisions:cfail1 cfail2 -// compile-flags: -Z query-dep-graph -// aux-build:point.rs -// build-pass +//@ revisions:cfail1 cfail2 +//@ compile-flags: -Z query-dep-graph +//@ aux-build:point.rs +//@ build-pass #![feature(rustc_attrs)] #![feature(stmt_expr_attributes)] diff --git a/tests/incremental/async-lifetimes.rs b/tests/incremental/async-lifetimes.rs index 90a0b93b99a1..8d55e7293df8 100644 --- a/tests/incremental/async-lifetimes.rs +++ b/tests/incremental/async-lifetimes.rs @@ -1,5 +1,5 @@ -// revisions: rpass1 rpass2 -// edition:2021 +//@ revisions: rpass1 rpass2 +//@ edition:2021 // See https://github.com/rust-lang/rust/issues/98890 diff --git a/tests/incremental/auxiliary/circular-dependencies-aux.rs b/tests/incremental/auxiliary/circular-dependencies-aux.rs index 0e74eb1b2f26..e28a6a2ca0e0 100644 --- a/tests/incremental/auxiliary/circular-dependencies-aux.rs +++ b/tests/incremental/auxiliary/circular-dependencies-aux.rs @@ -1,5 +1,5 @@ -// edition: 2021 -// compile-flags: --crate-type lib --extern circular_dependencies={{build-base}}/circular-dependencies/libcircular_dependencies.rmeta --emit dep-info,metadata +//@ edition: 2021 +//@ compile-flags: --crate-type lib --extern circular_dependencies={{build-base}}/circular-dependencies/libcircular_dependencies.rmeta --emit dep-info,metadata use circular_dependencies::Foo; diff --git a/tests/incremental/auxiliary/incremental_proc_macro_aux.rs b/tests/incremental/auxiliary/incremental_proc_macro_aux.rs index 6961450b4346..505a9ee27a40 100644 --- a/tests/incremental/auxiliary/incremental_proc_macro_aux.rs +++ b/tests/incremental/auxiliary/incremental_proc_macro_aux.rs @@ -1,5 +1,5 @@ -// force-host -// no-prefer-dynamic +//@ force-host +//@ no-prefer-dynamic #![crate_type = "proc-macro"] diff --git a/tests/incremental/auxiliary/issue-49482-macro-def.rs b/tests/incremental/auxiliary/issue-49482-macro-def.rs index bfa7abb1a9d0..9218d6b62cbb 100644 --- a/tests/incremental/auxiliary/issue-49482-macro-def.rs +++ b/tests/incremental/auxiliary/issue-49482-macro-def.rs @@ -1,5 +1,5 @@ -// force-host -// no-prefer-dynamic +//@ force-host +//@ no-prefer-dynamic #![crate_type="proc-macro"] #![allow(non_snake_case)] diff --git a/tests/incremental/auxiliary/issue-54059.rs b/tests/incremental/auxiliary/issue-54059.rs index fa2814a77f2b..5f45403735cd 100644 --- a/tests/incremental/auxiliary/issue-54059.rs +++ b/tests/incremental/auxiliary/issue-54059.rs @@ -1,5 +1,5 @@ -// force-host -// no-prefer-dynamic +//@ force-host +//@ no-prefer-dynamic // check that having extern "C" functions in a proc macro doesn't crash. diff --git a/tests/incremental/auxiliary/rustc-rust-log-aux.rs b/tests/incremental/auxiliary/rustc-rust-log-aux.rs index a361373dc195..b467f8095294 100644 --- a/tests/incremental/auxiliary/rustc-rust-log-aux.rs +++ b/tests/incremental/auxiliary/rustc-rust-log-aux.rs @@ -1,4 +1,4 @@ -// rustc-env:RUSTC_LOG=debug +//@ rustc-env:RUSTC_LOG=debug #[cfg(rpass1)] pub fn foo() {} diff --git a/tests/incremental/cache_file_headers.rs b/tests/incremental/cache_file_headers.rs index 9cf611c3379e..d9b390171569 100644 --- a/tests/incremental/cache_file_headers.rs +++ b/tests/incremental/cache_file_headers.rs @@ -7,10 +7,10 @@ // The `l33t haxx0r` Rust compiler is known to produce incr. comp. artifacts // that are outrageously incompatible with just about anything, even itself: -//[rpass1] rustc-env:RUSTC_FORCE_RUSTC_VERSION="l33t haxx0r rustc 2.1 LTS" +//@[rpass1] rustc-env:RUSTC_FORCE_RUSTC_VERSION="l33t haxx0r rustc 2.1 LTS" -// revisions:rpass1 rpass2 -// compile-flags: -Z query-dep-graph +//@ revisions:rpass1 rpass2 +//@ compile-flags: -Z query-dep-graph #![feature(rustc_attrs)] #![rustc_partition_codegened(module="cache_file_headers", cfg="rpass2")] diff --git a/tests/incremental/callee_caller_cross_crate/b.rs b/tests/incremental/callee_caller_cross_crate/b.rs index 084ed232a55e..b9012ecf7f77 100644 --- a/tests/incremental/callee_caller_cross_crate/b.rs +++ b/tests/incremental/callee_caller_cross_crate/b.rs @@ -1,6 +1,6 @@ -// aux-build:a.rs -// revisions:rpass1 rpass2 -// compile-flags:-Z query-dep-graph +//@ aux-build:a.rs +//@ revisions:rpass1 rpass2 +//@ compile-flags:-Z query-dep-graph #![feature(rustc_attrs)] diff --git a/tests/incremental/change_add_field/struct_point.rs b/tests/incremental/change_add_field/struct_point.rs index 3308ea56222f..8ff992771fdc 100644 --- a/tests/incremental/change_add_field/struct_point.rs +++ b/tests/incremental/change_add_field/struct_point.rs @@ -3,9 +3,9 @@ // Fns with that type used only in their body are also recompiled, but // their callers are not. -// revisions:cfail1 cfail2 -// compile-flags: -Z query-dep-graph -// build-pass +//@ revisions:cfail1 cfail2 +//@ compile-flags: -Z query-dep-graph +//@ build-pass #![feature(rustc_attrs)] #![feature(stmt_expr_attributes)] diff --git a/tests/incremental/change_crate_dep_kind.rs b/tests/incremental/change_crate_dep_kind.rs index b9f74340472c..d3408f7ad2b3 100644 --- a/tests/incremental/change_crate_dep_kind.rs +++ b/tests/incremental/change_crate_dep_kind.rs @@ -1,12 +1,12 @@ // Test that we detect changes to the `dep_kind` query. If the change is not // detected then -Zincremental-verify-ich will trigger an assertion. -// ignore-wasm32-bare compiled with panic=abort by default -// needs-unwind -// revisions:cfail1 cfail2 -// compile-flags: -Z query-dep-graph -Cpanic=unwind -// needs-unwind -// build-pass (FIXME(62277): could be check-pass?) +//@ ignore-wasm32-bare compiled with panic=abort by default +//@ needs-unwind +//@ revisions:cfail1 cfail2 +//@ compile-flags: -Z query-dep-graph -Cpanic=unwind +//@ needs-unwind +//@ build-pass (FIXME(62277): could be check-pass?) #![feature(panic_unwind)] diff --git a/tests/incremental/change_crate_order/main.rs b/tests/incremental/change_crate_order/main.rs index 7448b54dd079..23f1782578e9 100644 --- a/tests/incremental/change_crate_order/main.rs +++ b/tests/incremental/change_crate_order/main.rs @@ -1,6 +1,6 @@ -// aux-build:a.rs -// aux-build:b.rs -// revisions:rpass1 rpass2 +//@ aux-build:a.rs +//@ aux-build:b.rs +//@ revisions:rpass1 rpass2 #![feature(rustc_attrs)] diff --git a/tests/incremental/change_implementation_cross_crate/main.rs b/tests/incremental/change_implementation_cross_crate/main.rs index dee9ebd74a89..9919b0d01cb6 100644 --- a/tests/incremental/change_implementation_cross_crate/main.rs +++ b/tests/incremental/change_implementation_cross_crate/main.rs @@ -1,9 +1,9 @@ // Test that we are able to reuse `main` despite the changes in the implementation of `foo` and // `bar`. -// revisions: rpass1 rpass2 -// aux-build: a.rs -// compile-flags: -Zquery-dep-graph +//@ revisions: rpass1 rpass2 +//@ aux-build: a.rs +//@ compile-flags: -Zquery-dep-graph #![feature(rustc_attrs)] #![crate_type = "bin"] diff --git a/tests/incremental/change_name_of_static_in_fn.rs b/tests/incremental/change_name_of_static_in_fn.rs index fd16ad2dca41..808194501866 100644 --- a/tests/incremental/change_name_of_static_in_fn.rs +++ b/tests/incremental/change_name_of_static_in_fn.rs @@ -1,4 +1,4 @@ -// revisions:rpass1 rpass2 rpass3 +//@ revisions:rpass1 rpass2 rpass3 // See issue #57692. diff --git a/tests/incremental/change_private_fn/struct_point.rs b/tests/incremental/change_private_fn/struct_point.rs index d57267adc6bd..a4c0a8db4098 100644 --- a/tests/incremental/change_private_fn/struct_point.rs +++ b/tests/incremental/change_private_fn/struct_point.rs @@ -1,9 +1,9 @@ // Test where we change the body of a private method in an impl. // We then test what sort of functions must be rebuilt as a result. -// revisions:cfail1 cfail2 -// compile-flags: -Z query-dep-graph -// build-pass (FIXME(62277): could be check-pass?) +//@ revisions:cfail1 cfail2 +//@ compile-flags: -Z query-dep-graph +//@ build-pass (FIXME(62277): could be check-pass?) #![feature(rustc_attrs)] #![feature(stmt_expr_attributes)] diff --git a/tests/incremental/change_private_fn_cc/struct_point.rs b/tests/incremental/change_private_fn_cc/struct_point.rs index 1c27ec3a3f7e..6262e32a807d 100644 --- a/tests/incremental/change_private_fn_cc/struct_point.rs +++ b/tests/incremental/change_private_fn_cc/struct_point.rs @@ -1,10 +1,10 @@ // Test where we change the body of a private method in an impl. // We then test what sort of functions must be rebuilt as a result. -// revisions:cfail1 cfail2 -// compile-flags: -Z query-dep-graph -// aux-build:point.rs -// build-pass (FIXME(62277): could be check-pass?) +//@ revisions:cfail1 cfail2 +//@ compile-flags: -Z query-dep-graph +//@ aux-build:point.rs +//@ build-pass (FIXME(62277): could be check-pass?) #![crate_type = "rlib"] #![feature(rustc_attrs)] diff --git a/tests/incremental/change_private_impl_method/struct_point.rs b/tests/incremental/change_private_impl_method/struct_point.rs index cf43e4757cb8..953d58101510 100644 --- a/tests/incremental/change_private_impl_method/struct_point.rs +++ b/tests/incremental/change_private_impl_method/struct_point.rs @@ -1,9 +1,9 @@ // Test where we change the body of a private method in an impl. // We then test what sort of functions must be rebuilt as a result. -// revisions:cfail1 cfail2 -// compile-flags: -Z query-dep-graph -// build-pass +//@ revisions:cfail1 cfail2 +//@ compile-flags: -Z query-dep-graph +//@ build-pass #![feature(rustc_attrs)] #![feature(stmt_expr_attributes)] diff --git a/tests/incremental/change_private_impl_method_cc/struct_point.rs b/tests/incremental/change_private_impl_method_cc/struct_point.rs index 9fe8b5df93a2..42cc41da4c8b 100644 --- a/tests/incremental/change_private_impl_method_cc/struct_point.rs +++ b/tests/incremental/change_private_impl_method_cc/struct_point.rs @@ -1,10 +1,10 @@ // Test where we change the body of a private method in an impl. // We then test what sort of functions must be rebuilt as a result. -// revisions:cfail1 cfail2 -// compile-flags: -Z query-dep-graph -// aux-build:point.rs -// build-pass (FIXME(62277): could be check-pass?) +//@ revisions:cfail1 cfail2 +//@ compile-flags: -Z query-dep-graph +//@ aux-build:point.rs +//@ build-pass (FIXME(62277): could be check-pass?) #![crate_type = "rlib"] #![feature(rustc_attrs)] diff --git a/tests/incremental/change_pub_inherent_method_body/struct_point.rs b/tests/incremental/change_pub_inherent_method_body/struct_point.rs index 1b87b18fcd42..e112b25df5c5 100644 --- a/tests/incremental/change_pub_inherent_method_body/struct_point.rs +++ b/tests/incremental/change_pub_inherent_method_body/struct_point.rs @@ -1,8 +1,8 @@ // Test where we change the body of a public, inherent method. -// revisions:cfail1 cfail2 -// compile-flags: -Z query-dep-graph -// build-pass +//@ revisions:cfail1 cfail2 +//@ compile-flags: -Z query-dep-graph +//@ build-pass #![crate_type = "rlib"] #![feature(rustc_attrs)] diff --git a/tests/incremental/change_pub_inherent_method_sig/struct_point.rs b/tests/incremental/change_pub_inherent_method_sig/struct_point.rs index 0a672956768a..d67011f1e88c 100644 --- a/tests/incremental/change_pub_inherent_method_sig/struct_point.rs +++ b/tests/incremental/change_pub_inherent_method_sig/struct_point.rs @@ -1,8 +1,8 @@ // Test where we change the *signature* of a public, inherent method. -// revisions:cfail1 cfail2 -// compile-flags: -Z query-dep-graph -// build-pass +//@ revisions:cfail1 cfail2 +//@ compile-flags: -Z query-dep-graph +//@ build-pass #![crate_type = "rlib"] #![feature(rustc_attrs)] diff --git a/tests/incremental/change_symbol_export_status.rs b/tests/incremental/change_symbol_export_status.rs index 83737a022009..5fc6afa74119 100644 --- a/tests/incremental/change_symbol_export_status.rs +++ b/tests/incremental/change_symbol_export_status.rs @@ -1,7 +1,7 @@ -// revisions: rpass1 rpass2 rpass3 rpass4 -// compile-flags: -Zquery-dep-graph -// [rpass1]compile-flags: -Zincremental-ignore-spans -// [rpass2]compile-flags: -Zincremental-ignore-spans +//@ revisions: rpass1 rpass2 rpass3 rpass4 +//@ compile-flags: -Zquery-dep-graph +//@ [rpass1]compile-flags: -Zincremental-ignore-spans +//@ [rpass2]compile-flags: -Zincremental-ignore-spans #![feature(rustc_attrs)] #![rustc_partition_reused(module = "change_symbol_export_status-mod1", cfg = "rpass2")] diff --git a/tests/incremental/circular-dependencies.rs b/tests/incremental/circular-dependencies.rs index 10673066a9df..320edad3fde9 100644 --- a/tests/incremental/circular-dependencies.rs +++ b/tests/incremental/circular-dependencies.rs @@ -1,9 +1,9 @@ // ignore-tidy-linelength -// revisions: cpass1 cfail2 -// edition: 2021 -// [cpass1] compile-flags: --crate-type lib --emit dep-info,metadata -// [cfail2] aux-build: circular-dependencies-aux.rs -// [cfail2] compile-flags: --test --extern aux={{build-base}}/circular-dependencies/auxiliary/libcircular_dependencies_aux.rmeta -L dependency={{build-base}}/circular-dependencies +//@ revisions: cpass1 cfail2 +//@ edition: 2021 +//@ [cpass1] compile-flags: --crate-type lib --emit dep-info,metadata +//@ [cfail2] aux-build: circular-dependencies-aux.rs +//@ [cfail2] compile-flags: --test --extern aux={{build-base}}/circular-dependencies/auxiliary/libcircular_dependencies_aux.rmeta -L dependency={{build-base}}/circular-dependencies pub struct Foo; //[cfail2]~^ NOTE `Foo` is defined in the current crate diff --git a/tests/incremental/commandline-args.rs b/tests/incremental/commandline-args.rs index 7a4c33d36e41..f7aabe1e6d00 100644 --- a/tests/incremental/commandline-args.rs +++ b/tests/incremental/commandline-args.rs @@ -1,8 +1,8 @@ // Test that changing a tracked commandline argument invalidates // the cache while changing an untracked one doesn't. -// revisions:rpass1 rpass2 rpass3 rpass4 -// compile-flags: -Z query-dep-graph +//@ revisions:rpass1 rpass2 rpass3 rpass4 +//@ compile-flags: -Z query-dep-graph #![feature(rustc_attrs)] @@ -14,10 +14,10 @@ // invalidate the cache. Between revisions 2 and 3, we are adding `--diagnostic-width` // which should have no effect on the cache. Between revisions, we are adding // `--remap-path-prefix` which should invalidate the cache: -//[rpass1] compile-flags: -C debuginfo=0 -//[rpass2] compile-flags: -C debuginfo=2 -//[rpass3] compile-flags: -C debuginfo=2 --diagnostic-width=80 -//[rpass4] compile-flags: -C debuginfo=2 --diagnostic-width=80 --remap-path-prefix=/home/bors/r=src +//@[rpass1] compile-flags: -C debuginfo=0 +//@[rpass2] compile-flags: -C debuginfo=2 +//@[rpass3] compile-flags: -C debuginfo=2 --diagnostic-width=80 +//@[rpass4] compile-flags: -C debuginfo=2 --diagnostic-width=80 --remap-path-prefix=/home/bors/r=src pub fn main() { // empty diff --git a/tests/incremental/const-generic-type-cycle.rs b/tests/incremental/const-generic-type-cycle.rs index ca7b12e9e627..cd0437f7ef66 100644 --- a/tests/incremental/const-generic-type-cycle.rs +++ b/tests/incremental/const-generic-type-cycle.rs @@ -1,9 +1,9 @@ // Verify that we do not ICE when we try to overwrite an anon-const's type because of a trait // cycle. // -// compile-flags: -Zincremental-ignore-spans -// revisions: cpass cfail -// error-pattern: cycle detected when computing type of `Bar::N` +//@ compile-flags: -Zincremental-ignore-spans +//@ revisions: cpass cfail +//@ error-pattern: cycle detected when computing type of `Bar::N` #![feature(trait_alias)] #![crate_type="lib"] diff --git a/tests/incremental/const-generics/change-const-param-gat.rs b/tests/incremental/const-generics/change-const-param-gat.rs index f1449d5681e0..9fdac0142935 100644 --- a/tests/incremental/const-generics/change-const-param-gat.rs +++ b/tests/incremental/const-generics/change-const-param-gat.rs @@ -1,5 +1,5 @@ -// revisions: rpass1 rpass2 rpass3 -// compile-flags: -Zincremental-ignore-spans +//@ revisions: rpass1 rpass2 rpass3 +//@ compile-flags: -Zincremental-ignore-spans #![feature(generic_associated_types)] // This test unsures that with_opt_const_param returns the diff --git a/tests/incremental/const-generics/change-const-param-type.rs b/tests/incremental/const-generics/change-const-param-type.rs index 1aac1bc7d722..989ad56990db 100644 --- a/tests/incremental/const-generics/change-const-param-type.rs +++ b/tests/incremental/const-generics/change-const-param-type.rs @@ -1,5 +1,5 @@ -// revisions: rpass1 rpass2 rpass3 -// compile-flags: -Zincremental-ignore-spans +//@ revisions: rpass1 rpass2 rpass3 +//@ compile-flags: -Zincremental-ignore-spans enum Foo { Variant, diff --git a/tests/incremental/const-generics/hash-tyvid-regression-1.rs b/tests/incremental/const-generics/hash-tyvid-regression-1.rs index 06d674234510..727dceb2d272 100644 --- a/tests/incremental/const-generics/hash-tyvid-regression-1.rs +++ b/tests/incremental/const-generics/hash-tyvid-regression-1.rs @@ -1,4 +1,4 @@ -// revisions: cfail +//@ revisions: cfail #![feature(generic_const_exprs, adt_const_params)] #![allow(incomplete_features)] diff --git a/tests/incremental/const-generics/hash-tyvid-regression-2.rs b/tests/incremental/const-generics/hash-tyvid-regression-2.rs index 33f226ff611e..dbac296eb4a7 100644 --- a/tests/incremental/const-generics/hash-tyvid-regression-2.rs +++ b/tests/incremental/const-generics/hash-tyvid-regression-2.rs @@ -1,4 +1,4 @@ -// revisions: cfail +//@ revisions: cfail #![feature(generic_const_exprs, adt_const_params)] #![allow(incomplete_features)] diff --git a/tests/incremental/const-generics/hash-tyvid-regression-3.rs b/tests/incremental/const-generics/hash-tyvid-regression-3.rs index 61f568f79ef9..77e87c47cdc0 100644 --- a/tests/incremental/const-generics/hash-tyvid-regression-3.rs +++ b/tests/incremental/const-generics/hash-tyvid-regression-3.rs @@ -1,4 +1,4 @@ -// revisions: cfail +//@ revisions: cfail #![feature(generic_const_exprs)] #![allow(incomplete_features)] // regression test for #79251 diff --git a/tests/incremental/const-generics/hash-tyvid-regression-4.rs b/tests/incremental/const-generics/hash-tyvid-regression-4.rs index 12e8ac7abadc..621ca16230b2 100644 --- a/tests/incremental/const-generics/hash-tyvid-regression-4.rs +++ b/tests/incremental/const-generics/hash-tyvid-regression-4.rs @@ -1,4 +1,4 @@ -// revisions: cfail +//@ revisions: cfail #![feature(generic_const_exprs)] #![allow(incomplete_features)] // regression test for #79251 diff --git a/tests/incremental/const-generics/issue-61338.rs b/tests/incremental/const-generics/issue-61338.rs index e9d67fee2969..2152667be3a3 100644 --- a/tests/incremental/const-generics/issue-61338.rs +++ b/tests/incremental/const-generics/issue-61338.rs @@ -1,4 +1,4 @@ -// revisions:rpass1 +//@ revisions:rpass1 struct Struct(T); diff --git a/tests/incremental/const-generics/issue-61516.rs b/tests/incremental/const-generics/issue-61516.rs index c781484d1e2e..9d56ca413825 100644 --- a/tests/incremental/const-generics/issue-61516.rs +++ b/tests/incremental/const-generics/issue-61516.rs @@ -1,4 +1,4 @@ -// revisions:rpass1 +//@ revisions:rpass1 struct FakeArray(T); diff --git a/tests/incremental/const-generics/issue-62536.rs b/tests/incremental/const-generics/issue-62536.rs index 022376768f2a..ebabc8576415 100644 --- a/tests/incremental/const-generics/issue-62536.rs +++ b/tests/incremental/const-generics/issue-62536.rs @@ -1,4 +1,4 @@ -// revisions:cfail1 +//@ revisions:cfail1 #![allow(unused_variables)] diff --git a/tests/incremental/const-generics/issue-64087.rs b/tests/incremental/const-generics/issue-64087.rs index 81c813531bd5..97f212b3fbba 100644 --- a/tests/incremental/const-generics/issue-64087.rs +++ b/tests/incremental/const-generics/issue-64087.rs @@ -1,4 +1,4 @@ -// revisions:cfail1 +//@ revisions:cfail1 fn combinator() -> [T; S] {} //[cfail1]~^ ERROR mismatched types diff --git a/tests/incremental/const-generics/issue-65623.rs b/tests/incremental/const-generics/issue-65623.rs index 22bbcbcabed1..aaabde8253be 100644 --- a/tests/incremental/const-generics/issue-65623.rs +++ b/tests/incremental/const-generics/issue-65623.rs @@ -1,4 +1,4 @@ -// revisions:rpass1 +//@ revisions:rpass1 pub struct Foo([T; 0]); impl Foo { diff --git a/tests/incremental/const-generics/issue-68477.rs b/tests/incremental/const-generics/issue-68477.rs index 9e35cf93d091..e9d1e8ad14df 100644 --- a/tests/incremental/const-generics/issue-68477.rs +++ b/tests/incremental/const-generics/issue-68477.rs @@ -1,5 +1,5 @@ -// edition:2018 -// revisions:rpass1 +//@ edition:2018 +//@ revisions:rpass1 // Needed to supply generic arguments to the anon const in `[(); FOO]`. #![feature(generic_const_exprs)] diff --git a/tests/incremental/const-generics/try_unify_abstract_const_regression_tests/issue-77708-1.rs b/tests/incremental/const-generics/try_unify_abstract_const_regression_tests/issue-77708-1.rs index 5c8af47ccbe8..0233a0b197ab 100644 --- a/tests/incremental/const-generics/try_unify_abstract_const_regression_tests/issue-77708-1.rs +++ b/tests/incremental/const-generics/try_unify_abstract_const_regression_tests/issue-77708-1.rs @@ -1,4 +1,4 @@ -// revisions: cfail +//@ revisions: cfail #![feature(generic_const_exprs)] #![allow(incomplete_features, unused_braces, unused_variables)] diff --git a/tests/incremental/const-generics/try_unify_abstract_const_regression_tests/issue-77708-2.rs b/tests/incremental/const-generics/try_unify_abstract_const_regression_tests/issue-77708-2.rs index 92bbcba4b38a..257a4196c0c9 100644 --- a/tests/incremental/const-generics/try_unify_abstract_const_regression_tests/issue-77708-2.rs +++ b/tests/incremental/const-generics/try_unify_abstract_const_regression_tests/issue-77708-2.rs @@ -1,4 +1,4 @@ -// revisions: rpass +//@ revisions: rpass #![feature(generic_const_exprs)] #![allow(incomplete_features)] diff --git a/tests/incremental/const-generics/try_unify_abstract_const_regression_tests/issue-77708-3.rs b/tests/incremental/const-generics/try_unify_abstract_const_regression_tests/issue-77708-3.rs index f1c108fed11b..13767e1c82ad 100644 --- a/tests/incremental/const-generics/try_unify_abstract_const_regression_tests/issue-77708-3.rs +++ b/tests/incremental/const-generics/try_unify_abstract_const_regression_tests/issue-77708-3.rs @@ -1,4 +1,4 @@ -// revisions: rpass +//@ revisions: rpass #![feature(generic_const_exprs, adt_const_params)] #![allow(incomplete_features)] diff --git a/tests/incremental/const-generics/try_unify_abstract_const_regression_tests/issue-82034.rs b/tests/incremental/const-generics/try_unify_abstract_const_regression_tests/issue-82034.rs index c05d8355c280..54450abf2a43 100644 --- a/tests/incremental/const-generics/try_unify_abstract_const_regression_tests/issue-82034.rs +++ b/tests/incremental/const-generics/try_unify_abstract_const_regression_tests/issue-82034.rs @@ -1,4 +1,4 @@ -// revisions: rpass +//@ revisions: rpass #![feature(generic_const_exprs)] #![allow(incomplete_features)] pub trait IsTrue {} diff --git a/tests/incremental/const-generics/try_unify_abstract_const_regression_tests/issue-85031-1.rs b/tests/incremental/const-generics/try_unify_abstract_const_regression_tests/issue-85031-1.rs index 8886a556dbb2..ccdc9615cbff 100644 --- a/tests/incremental/const-generics/try_unify_abstract_const_regression_tests/issue-85031-1.rs +++ b/tests/incremental/const-generics/try_unify_abstract_const_regression_tests/issue-85031-1.rs @@ -1,4 +1,4 @@ -// revisions: rpass +//@ revisions: rpass #![feature(generic_const_exprs)] #![allow(incomplete_features)] diff --git a/tests/incremental/const-generics/try_unify_abstract_const_regression_tests/issue-85031-3.rs b/tests/incremental/const-generics/try_unify_abstract_const_regression_tests/issue-85031-3.rs index 5b2f5edc8500..a8878a5c88e9 100644 --- a/tests/incremental/const-generics/try_unify_abstract_const_regression_tests/issue-85031-3.rs +++ b/tests/incremental/const-generics/try_unify_abstract_const_regression_tests/issue-85031-3.rs @@ -1,4 +1,4 @@ -// revisions: rpass +//@ revisions: rpass #![feature(generic_const_exprs)] #![allow(incomplete_features)] diff --git a/tests/incremental/const-generics/try_unify_abstract_const_regression_tests/issue-86953.rs b/tests/incremental/const-generics/try_unify_abstract_const_regression_tests/issue-86953.rs index d659c5676336..a67a242d223f 100644 --- a/tests/incremental/const-generics/try_unify_abstract_const_regression_tests/issue-86953.rs +++ b/tests/incremental/const-generics/try_unify_abstract_const_regression_tests/issue-86953.rs @@ -1,4 +1,4 @@ -// revisions: rpass +//@ revisions: rpass #![feature(generic_const_exprs)] #![allow(incomplete_features)] diff --git a/tests/incremental/const-generics/try_unify_abstract_const_regression_tests/issue-88022.rs b/tests/incremental/const-generics/try_unify_abstract_const_regression_tests/issue-88022.rs index 5f5435ba9f28..99eb92f432c2 100644 --- a/tests/incremental/const-generics/try_unify_abstract_const_regression_tests/issue-88022.rs +++ b/tests/incremental/const-generics/try_unify_abstract_const_regression_tests/issue-88022.rs @@ -1,4 +1,4 @@ -// revisions: cfail +//@ revisions: cfail #![feature(generic_const_exprs)] #![allow(incomplete_features, unused_braces)] diff --git a/tests/incremental/crate_hash_reorder.rs b/tests/incremental/crate_hash_reorder.rs index ca476b4d2db1..bd26d604a825 100644 --- a/tests/incremental/crate_hash_reorder.rs +++ b/tests/incremental/crate_hash_reorder.rs @@ -1,7 +1,7 @@ // Test that the crate hash is not affected by reordering items. -// revisions:rpass1 rpass2 rpass3 -// compile-flags: -Z query-dep-graph +//@ revisions:rpass1 rpass2 rpass3 +//@ compile-flags: -Z query-dep-graph #![feature(rustc_attrs)] diff --git a/tests/incremental/cyclic-trait-hierarchy.rs b/tests/incremental/cyclic-trait-hierarchy.rs index b502e7207d56..6a6aedee8320 100644 --- a/tests/incremental/cyclic-trait-hierarchy.rs +++ b/tests/incremental/cyclic-trait-hierarchy.rs @@ -1,6 +1,6 @@ // Adapted from rust-lang/rust#58813 -// revisions: rpass1 cfail2 +//@ revisions: rpass1 cfail2 #[cfg(rpass1)] pub trait T2 {} diff --git a/tests/incremental/delayed_span_bug.rs b/tests/incremental/delayed_span_bug.rs index 5c9d3c2c1d52..958e9dd07e2d 100644 --- a/tests/incremental/delayed_span_bug.rs +++ b/tests/incremental/delayed_span_bug.rs @@ -1,6 +1,6 @@ -// revisions: cfail1 cfail2 -// should-ice -// error-pattern: delayed bug triggered by #[rustc_error(delayed_bug_from_inside_query)] +//@ revisions: cfail1 cfail2 +//@ should-ice +//@ error-pattern: delayed bug triggered by #[rustc_error(delayed_bug_from_inside_query)] #![feature(rustc_attrs)] diff --git a/tests/incremental/dirty_clean.rs b/tests/incremental/dirty_clean.rs index e6379286805e..24aedb011c6b 100644 --- a/tests/incremental/dirty_clean.rs +++ b/tests/incremental/dirty_clean.rs @@ -1,5 +1,5 @@ -// revisions: rpass1 cfail2 -// compile-flags: -Z query-dep-graph +//@ revisions: rpass1 cfail2 +//@ compile-flags: -Z query-dep-graph #![allow(warnings)] #![feature(rustc_attrs)] diff --git a/tests/incremental/extern_static/issue-49153.rs b/tests/incremental/extern_static/issue-49153.rs index f1dbac288853..72340173b5ca 100644 --- a/tests/incremental/extern_static/issue-49153.rs +++ b/tests/incremental/extern_static/issue-49153.rs @@ -1,6 +1,6 @@ // https://github.com/rust-lang/rust/issues/49153 -// revisions:rpass1 rpass2 +//@ revisions:rpass1 rpass2 extern "C" { pub static __ImageBase: u8; diff --git a/tests/incremental/feature_gate.rs b/tests/incremental/feature_gate.rs index 5317a9962f47..54c2dbb352e1 100644 --- a/tests/incremental/feature_gate.rs +++ b/tests/incremental/feature_gate.rs @@ -1,7 +1,7 @@ // This test makes sure that we detect changed feature gates. -// revisions:rpass1 cfail2 -// compile-flags: -Z query-dep-graph +//@ revisions:rpass1 cfail2 +//@ compile-flags: -Z query-dep-graph #![feature(rustc_attrs)] #![cfg_attr(rpass1, feature(abi_unadjusted))] diff --git a/tests/incremental/foreign.rs b/tests/incremental/foreign.rs index f46f92eb5002..cb040fe1296d 100644 --- a/tests/incremental/foreign.rs +++ b/tests/incremental/foreign.rs @@ -1,8 +1,8 @@ // Test what happens we save incremental compilation state that makes // use of foreign items. This used to ICE (#34991). -// ignore-sgx no libc +//@ ignore-sgx no libc -// revisions: rpass1 +//@ revisions: rpass1 #![feature(rustc_private)] diff --git a/tests/incremental/hash-module-order.rs b/tests/incremental/hash-module-order.rs index 2e71884a531a..c29e1e5b64c9 100644 --- a/tests/incremental/hash-module-order.rs +++ b/tests/incremental/hash-module-order.rs @@ -1,5 +1,5 @@ -// revisions: rpass1 rpass2 -// compile-flags: -Z incremental-ignore-spans -Z query-dep-graph +//@ revisions: rpass1 rpass2 +//@ compile-flags: -Z incremental-ignore-spans -Z query-dep-graph // Tests that module hashing depends on the order of the items // (since the order is exposed through `Mod.item_ids`). diff --git a/tests/incremental/hashes/call_expressions.rs b/tests/incremental/hashes/call_expressions.rs index bad2e10e497d..36b6980bcc67 100644 --- a/tests/incremental/hashes/call_expressions.rs +++ b/tests/incremental/hashes/call_expressions.rs @@ -5,12 +5,12 @@ // and make sure that the hash has changed, then change nothing between rev2 and // rev3 and make sure that the hash has not changed. -// build-pass (FIXME(62277): could be check-pass?) -// revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 -// compile-flags: -Z query-dep-graph -O -// [cfail1]compile-flags: -Zincremental-ignore-spans -// [cfail2]compile-flags: -Zincremental-ignore-spans -// [cfail3]compile-flags: -Zincremental-ignore-spans +//@ build-pass (FIXME(62277): could be check-pass?) +//@ revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 +//@ compile-flags: -Z query-dep-graph -O +//@ [cfail1]compile-flags: -Zincremental-ignore-spans +//@ [cfail2]compile-flags: -Zincremental-ignore-spans +//@ [cfail3]compile-flags: -Zincremental-ignore-spans #![allow(warnings)] diff --git a/tests/incremental/hashes/closure_expressions.rs b/tests/incremental/hashes/closure_expressions.rs index 0173d129b239..e548e0b6ddc3 100644 --- a/tests/incremental/hashes/closure_expressions.rs +++ b/tests/incremental/hashes/closure_expressions.rs @@ -5,12 +5,12 @@ // and make sure that the hash has changed, then change nothing between rev2 and // rev3 and make sure that the hash has not changed. -// build-pass (FIXME(62277): could be check-pass?) -// revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 -// compile-flags: -Z query-dep-graph -O -// [cfail1]compile-flags: -Zincremental-ignore-spans -// [cfail2]compile-flags: -Zincremental-ignore-spans -// [cfail3]compile-flags: -Zincremental-ignore-spans +//@ build-pass (FIXME(62277): could be check-pass?) +//@ revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 +//@ compile-flags: -Z query-dep-graph -O +//@ [cfail1]compile-flags: -Zincremental-ignore-spans +//@ [cfail2]compile-flags: -Zincremental-ignore-spans +//@ [cfail3]compile-flags: -Zincremental-ignore-spans #![allow(warnings)] #![feature(rustc_attrs)] diff --git a/tests/incremental/hashes/consts.rs b/tests/incremental/hashes/consts.rs index 138618a982d2..bd5cc89caa86 100644 --- a/tests/incremental/hashes/consts.rs +++ b/tests/incremental/hashes/consts.rs @@ -5,9 +5,9 @@ // and make sure that the hash has changed, then change nothing between rev2 and // rev3 and make sure that the hash has not changed. -// build-pass (FIXME(62277): could be check-pass?) -// revisions: cfail1 cfail2 cfail3 -// compile-flags: -Z query-dep-graph -O +//@ build-pass (FIXME(62277): could be check-pass?) +//@ revisions: cfail1 cfail2 cfail3 +//@ compile-flags: -Z query-dep-graph -O #![allow(warnings)] #![feature(rustc_attrs)] diff --git a/tests/incremental/hashes/enum_constructors.rs b/tests/incremental/hashes/enum_constructors.rs index 1e0db8ffc928..d839dabf293a 100644 --- a/tests/incremental/hashes/enum_constructors.rs +++ b/tests/incremental/hashes/enum_constructors.rs @@ -5,12 +5,12 @@ // and make sure that the hash has changed, then change nothing between rev2 and // rev3 and make sure that the hash has not changed. -// build-pass (FIXME(62277): could be check-pass?) -// revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 -// compile-flags: -Z query-dep-graph -O -// [cfail1]compile-flags: -Zincremental-ignore-spans -// [cfail2]compile-flags: -Zincremental-ignore-spans -// [cfail3]compile-flags: -Zincremental-ignore-spans +//@ build-pass (FIXME(62277): could be check-pass?) +//@ revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 +//@ compile-flags: -Z query-dep-graph -O +//@ [cfail1]compile-flags: -Zincremental-ignore-spans +//@ [cfail2]compile-flags: -Zincremental-ignore-spans +//@ [cfail3]compile-flags: -Zincremental-ignore-spans #![allow(warnings)] #![feature(rustc_attrs)] diff --git a/tests/incremental/hashes/enum_defs.rs b/tests/incremental/hashes/enum_defs.rs index 2293d15b97f2..bc1a2a31e97a 100644 --- a/tests/incremental/hashes/enum_defs.rs +++ b/tests/incremental/hashes/enum_defs.rs @@ -10,12 +10,12 @@ // results in a change of the ICH for the enum's metadata, and that it stays // the same between rev2 and rev3. -// build-pass (FIXME(62277): could be check-pass?) -// revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 -// compile-flags: -Z query-dep-graph -O -// [cfail1]compile-flags: -Zincremental-ignore-spans -// [cfail2]compile-flags: -Zincremental-ignore-spans -// [cfail3]compile-flags: -Zincremental-ignore-spans +//@ build-pass (FIXME(62277): could be check-pass?) +//@ revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 +//@ compile-flags: -Z query-dep-graph -O +//@ [cfail1]compile-flags: -Zincremental-ignore-spans +//@ [cfail2]compile-flags: -Zincremental-ignore-spans +//@ [cfail3]compile-flags: -Zincremental-ignore-spans #![allow(warnings)] #![feature(rustc_attrs)] diff --git a/tests/incremental/hashes/exported_vs_not.rs b/tests/incremental/hashes/exported_vs_not.rs index 358ba1d93d1a..1bd7756c1c6e 100644 --- a/tests/incremental/hashes/exported_vs_not.rs +++ b/tests/incremental/hashes/exported_vs_not.rs @@ -1,9 +1,9 @@ -// build-pass (FIXME(62277): could be check-pass?) -// revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 -// compile-flags: -Z query-dep-graph -O -// [cfail1]compile-flags: -Zincremental-ignore-spans -// [cfail2]compile-flags: -Zincremental-ignore-spans -// [cfail3]compile-flags: -Zincremental-ignore-spans +//@ build-pass (FIXME(62277): could be check-pass?) +//@ revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 +//@ compile-flags: -Z query-dep-graph -O +//@ [cfail1]compile-flags: -Zincremental-ignore-spans +//@ [cfail2]compile-flags: -Zincremental-ignore-spans +//@ [cfail3]compile-flags: -Zincremental-ignore-spans #![allow(warnings)] #![feature(rustc_attrs)] diff --git a/tests/incremental/hashes/extern_mods.rs b/tests/incremental/hashes/extern_mods.rs index efac5c91658c..c26fc90dd01e 100644 --- a/tests/incremental/hashes/extern_mods.rs +++ b/tests/incremental/hashes/extern_mods.rs @@ -5,12 +5,12 @@ // and make sure that the hash has changed, then change nothing between rev2 and // rev3 and make sure that the hash has not changed. -// build-pass (FIXME(62277): could be check-pass?) -// revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 -// compile-flags: -Z query-dep-graph -O -// [cfail1]compile-flags: -Zincremental-ignore-spans -// [cfail2]compile-flags: -Zincremental-ignore-spans -// [cfail3]compile-flags: -Zincremental-ignore-spans +//@ build-pass (FIXME(62277): could be check-pass?) +//@ revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 +//@ compile-flags: -Z query-dep-graph -O +//@ [cfail1]compile-flags: -Zincremental-ignore-spans +//@ [cfail2]compile-flags: -Zincremental-ignore-spans +//@ [cfail3]compile-flags: -Zincremental-ignore-spans #![allow(warnings)] #![feature(rustc_attrs)] diff --git a/tests/incremental/hashes/for_loops.rs b/tests/incremental/hashes/for_loops.rs index e297fcdd329d..9cd99bf76b7a 100644 --- a/tests/incremental/hashes/for_loops.rs +++ b/tests/incremental/hashes/for_loops.rs @@ -5,12 +5,12 @@ // and make sure that the hash has changed, then change nothing between rev2 and // rev3 and make sure that the hash has not changed. -// build-pass (FIXME(62277): could be check-pass?) -// revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 -// compile-flags: -Z query-dep-graph -O -// [cfail1]compile-flags: -Zincremental-ignore-spans -// [cfail2]compile-flags: -Zincremental-ignore-spans -// [cfail3]compile-flags: -Zincremental-ignore-spans +//@ build-pass (FIXME(62277): could be check-pass?) +//@ revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 +//@ compile-flags: -Z query-dep-graph -O +//@ [cfail1]compile-flags: -Zincremental-ignore-spans +//@ [cfail2]compile-flags: -Zincremental-ignore-spans +//@ [cfail3]compile-flags: -Zincremental-ignore-spans #![allow(warnings)] #![feature(rustc_attrs)] diff --git a/tests/incremental/hashes/function_interfaces.rs b/tests/incremental/hashes/function_interfaces.rs index 5ba4781c5f1c..3be30fab99cf 100644 --- a/tests/incremental/hashes/function_interfaces.rs +++ b/tests/incremental/hashes/function_interfaces.rs @@ -5,12 +5,12 @@ // and make sure that the hash has changed, then change nothing between rev2 and // rev3 and make sure that the hash has not changed. -// build-pass (FIXME(62277): could be check-pass?) -// revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 -// compile-flags: -Z query-dep-graph -O -// [cfail1]compile-flags: -Zincremental-ignore-spans -// [cfail2]compile-flags: -Zincremental-ignore-spans -// [cfail3]compile-flags: -Zincremental-ignore-spans +//@ build-pass (FIXME(62277): could be check-pass?) +//@ revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 +//@ compile-flags: -Z query-dep-graph -O +//@ [cfail1]compile-flags: -Zincremental-ignore-spans +//@ [cfail2]compile-flags: -Zincremental-ignore-spans +//@ [cfail3]compile-flags: -Zincremental-ignore-spans #![allow(warnings)] #![feature(linkage)] diff --git a/tests/incremental/hashes/if_expressions.rs b/tests/incremental/hashes/if_expressions.rs index 430a6015bd5a..a21625c4f4ed 100644 --- a/tests/incremental/hashes/if_expressions.rs +++ b/tests/incremental/hashes/if_expressions.rs @@ -5,12 +5,12 @@ // and make sure that the hash has changed, then change nothing between rev2 and // rev3 and make sure that the hash has not changed. -// build-pass (FIXME(62277): could be check-pass?) -// revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 -// compile-flags: -Z query-dep-graph -O -// [cfail1]compile-flags: -Zincremental-ignore-spans -// [cfail2]compile-flags: -Zincremental-ignore-spans -// [cfail3]compile-flags: -Zincremental-ignore-spans +//@ build-pass (FIXME(62277): could be check-pass?) +//@ revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 +//@ compile-flags: -Z query-dep-graph -O +//@ [cfail1]compile-flags: -Zincremental-ignore-spans +//@ [cfail2]compile-flags: -Zincremental-ignore-spans +//@ [cfail3]compile-flags: -Zincremental-ignore-spans #![allow(warnings)] #![feature(rustc_attrs)] diff --git a/tests/incremental/hashes/indexing_expressions.rs b/tests/incremental/hashes/indexing_expressions.rs index f07550305f12..1b90483c50c3 100644 --- a/tests/incremental/hashes/indexing_expressions.rs +++ b/tests/incremental/hashes/indexing_expressions.rs @@ -5,12 +5,12 @@ // and make sure that the hash has changed, then change nothing between rev2 and // rev3 and make sure that the hash has not changed. -// build-pass (FIXME(62277): could be check-pass?) -// revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 -// compile-flags: -Z query-dep-graph -O -// [cfail1]compile-flags: -Zincremental-ignore-spans -// [cfail2]compile-flags: -Zincremental-ignore-spans -// [cfail3]compile-flags: -Zincremental-ignore-spans +//@ build-pass (FIXME(62277): could be check-pass?) +//@ revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 +//@ compile-flags: -Z query-dep-graph -O +//@ [cfail1]compile-flags: -Zincremental-ignore-spans +//@ [cfail2]compile-flags: -Zincremental-ignore-spans +//@ [cfail3]compile-flags: -Zincremental-ignore-spans #![allow(warnings)] #![feature(rustc_attrs)] diff --git a/tests/incremental/hashes/inherent_impls.rs b/tests/incremental/hashes/inherent_impls.rs index a2b3dcdc1587..2b0de1edc0c6 100644 --- a/tests/incremental/hashes/inherent_impls.rs +++ b/tests/incremental/hashes/inherent_impls.rs @@ -5,12 +5,12 @@ // and make sure that the hash has changed, then change nothing between rev2 and // rev3 and make sure that the hash has not changed. -// build-pass (FIXME(62277): could be check-pass?) -// revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 -// compile-flags: -Z query-dep-graph -O -// [cfail1]compile-flags: -Zincremental-ignore-spans -// [cfail2]compile-flags: -Zincremental-ignore-spans -// [cfail3]compile-flags: -Zincremental-ignore-spans +//@ build-pass (FIXME(62277): could be check-pass?) +//@ revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 +//@ compile-flags: -Z query-dep-graph -O +//@ [cfail1]compile-flags: -Zincremental-ignore-spans +//@ [cfail2]compile-flags: -Zincremental-ignore-spans +//@ [cfail3]compile-flags: -Zincremental-ignore-spans #![allow(warnings)] diff --git a/tests/incremental/hashes/inline_asm.rs b/tests/incremental/hashes/inline_asm.rs index 1570030dbeae..105ca7611356 100644 --- a/tests/incremental/hashes/inline_asm.rs +++ b/tests/incremental/hashes/inline_asm.rs @@ -5,13 +5,13 @@ // and make sure that the hash has changed, then change nothing between rev2 and // rev3 and make sure that the hash has not changed. -// build-pass (FIXME(62277): could be check-pass?) -// revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 -// compile-flags: -Z query-dep-graph -O -// needs-asm-support -// [cfail1]compile-flags: -Zincremental-ignore-spans -// [cfail2]compile-flags: -Zincremental-ignore-spans -// [cfail3]compile-flags: -Zincremental-ignore-spans +//@ build-pass (FIXME(62277): could be check-pass?) +//@ revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 +//@ compile-flags: -Z query-dep-graph -O +//@ needs-asm-support +//@ [cfail1]compile-flags: -Zincremental-ignore-spans +//@ [cfail2]compile-flags: -Zincremental-ignore-spans +//@ [cfail3]compile-flags: -Zincremental-ignore-spans #![allow(warnings)] #![feature(rustc_attrs)] diff --git a/tests/incremental/hashes/let_expressions.rs b/tests/incremental/hashes/let_expressions.rs index 62a91bf75f8a..86578855699b 100644 --- a/tests/incremental/hashes/let_expressions.rs +++ b/tests/incremental/hashes/let_expressions.rs @@ -5,12 +5,12 @@ // and make sure that the hash has changed, then change nothing between rev2 and // rev3 and make sure that the hash has not changed. -// build-pass (FIXME(62277): could be check-pass?) -// revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 -// compile-flags: -Z query-dep-graph -O -// [cfail1]compile-flags: -Zincremental-ignore-spans -// [cfail2]compile-flags: -Zincremental-ignore-spans -// [cfail3]compile-flags: -Zincremental-ignore-spans +//@ build-pass (FIXME(62277): could be check-pass?) +//@ revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 +//@ compile-flags: -Z query-dep-graph -O +//@ [cfail1]compile-flags: -Zincremental-ignore-spans +//@ [cfail2]compile-flags: -Zincremental-ignore-spans +//@ [cfail3]compile-flags: -Zincremental-ignore-spans #![allow(warnings)] #![feature(rustc_attrs)] diff --git a/tests/incremental/hashes/loop_expressions.rs b/tests/incremental/hashes/loop_expressions.rs index 810ba877061c..631699d3d687 100644 --- a/tests/incremental/hashes/loop_expressions.rs +++ b/tests/incremental/hashes/loop_expressions.rs @@ -5,12 +5,12 @@ // and make sure that the hash has changed, then change nothing between rev2 and // rev3 and make sure that the hash has not changed. -// build-pass (FIXME(62277): could be check-pass?) -// revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 -// compile-flags: -Z query-dep-graph -O -// [cfail1]compile-flags: -Zincremental-ignore-spans -// [cfail2]compile-flags: -Zincremental-ignore-spans -// [cfail3]compile-flags: -Zincremental-ignore-spans +//@ build-pass (FIXME(62277): could be check-pass?) +//@ revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 +//@ compile-flags: -Z query-dep-graph -O +//@ [cfail1]compile-flags: -Zincremental-ignore-spans +//@ [cfail2]compile-flags: -Zincremental-ignore-spans +//@ [cfail3]compile-flags: -Zincremental-ignore-spans #![allow(warnings)] #![feature(rustc_attrs)] diff --git a/tests/incremental/hashes/match_expressions.rs b/tests/incremental/hashes/match_expressions.rs index c77ac27d4962..9ed5b55fb250 100644 --- a/tests/incremental/hashes/match_expressions.rs +++ b/tests/incremental/hashes/match_expressions.rs @@ -5,12 +5,12 @@ // and make sure that the hash has changed, then change nothing between rev2 and // rev3 and make sure that the hash has not changed. -// build-pass (FIXME(62277): could be check-pass?) -// revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 -// compile-flags: -Z query-dep-graph -O -// [cfail1]compile-flags: -Zincremental-ignore-spans -// [cfail2]compile-flags: -Zincremental-ignore-spans -// [cfail3]compile-flags: -Zincremental-ignore-spans +//@ build-pass (FIXME(62277): could be check-pass?) +//@ revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 +//@ compile-flags: -Z query-dep-graph -O +//@ [cfail1]compile-flags: -Zincremental-ignore-spans +//@ [cfail2]compile-flags: -Zincremental-ignore-spans +//@ [cfail3]compile-flags: -Zincremental-ignore-spans #![allow(warnings)] #![feature(rustc_attrs)] diff --git a/tests/incremental/hashes/panic_exprs.rs b/tests/incremental/hashes/panic_exprs.rs index 440a7b6fbf41..509e111edc7a 100644 --- a/tests/incremental/hashes/panic_exprs.rs +++ b/tests/incremental/hashes/panic_exprs.rs @@ -8,9 +8,9 @@ // and make sure that the hash has changed, then change nothing between rev2 and // rev3 and make sure that the hash has not changed. -// build-pass (FIXME(62277): could be check-pass?) -// revisions: cfail1 cfail2 cfail3 -// compile-flags: -Z query-dep-graph -C debug-assertions -O +//@ build-pass (FIXME(62277): could be check-pass?) +//@ revisions: cfail1 cfail2 cfail3 +//@ compile-flags: -Z query-dep-graph -C debug-assertions -O #![allow(warnings)] #![feature(rustc_attrs)] diff --git a/tests/incremental/hashes/statics.rs b/tests/incremental/hashes/statics.rs index 7e2ccc4ce6f2..9ea21d84ba15 100644 --- a/tests/incremental/hashes/statics.rs +++ b/tests/incremental/hashes/statics.rs @@ -5,12 +5,12 @@ // and make sure that the hash has changed, then change nothing between rev2 and // rev3 and make sure that the hash has not changed. -// build-pass (FIXME(62277): could be check-pass?) -// revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 -// compile-flags: -Z query-dep-graph -O -// [cfail1]compile-flags: -Zincremental-ignore-spans -// [cfail2]compile-flags: -Zincremental-ignore-spans -// [cfail3]compile-flags: -Zincremental-ignore-spans +//@ build-pass (FIXME(62277): could be check-pass?) +//@ revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 +//@ compile-flags: -Z query-dep-graph -O +//@ [cfail1]compile-flags: -Zincremental-ignore-spans +//@ [cfail2]compile-flags: -Zincremental-ignore-spans +//@ [cfail3]compile-flags: -Zincremental-ignore-spans #![allow(warnings)] #![feature(rustc_attrs)] diff --git a/tests/incremental/hashes/struct_constructors.rs b/tests/incremental/hashes/struct_constructors.rs index 458f4d1a6d7d..31c549c6e7a9 100644 --- a/tests/incremental/hashes/struct_constructors.rs +++ b/tests/incremental/hashes/struct_constructors.rs @@ -5,12 +5,12 @@ // and make sure that the hash has changed, then change nothing between rev2 and // rev3 and make sure that the hash has not changed. -// build-pass (FIXME(62277): could be check-pass?) -// revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 -// compile-flags: -Z query-dep-graph -O -// [cfail1]compile-flags: -Zincremental-ignore-spans -// [cfail2]compile-flags: -Zincremental-ignore-spans -// [cfail3]compile-flags: -Zincremental-ignore-spans +//@ build-pass (FIXME(62277): could be check-pass?) +//@ revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 +//@ compile-flags: -Z query-dep-graph -O +//@ [cfail1]compile-flags: -Zincremental-ignore-spans +//@ [cfail2]compile-flags: -Zincremental-ignore-spans +//@ [cfail3]compile-flags: -Zincremental-ignore-spans #![allow(warnings)] #![feature(rustc_attrs)] diff --git a/tests/incremental/hashes/struct_defs.rs b/tests/incremental/hashes/struct_defs.rs index 113ada2855d1..06ea08733979 100644 --- a/tests/incremental/hashes/struct_defs.rs +++ b/tests/incremental/hashes/struct_defs.rs @@ -10,12 +10,12 @@ // results in a change of the ICH for the struct's metadata, and that it stays // the same between rev2 and rev3. -// build-pass (FIXME(62277): could be check-pass?) -// revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 -// compile-flags: -Z query-dep-graph -O -// [cfail1]compile-flags: -Zincremental-ignore-spans -// [cfail2]compile-flags: -Zincremental-ignore-spans -// [cfail3]compile-flags: -Zincremental-ignore-spans +//@ build-pass (FIXME(62277): could be check-pass?) +//@ revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 +//@ compile-flags: -Z query-dep-graph -O +//@ [cfail1]compile-flags: -Zincremental-ignore-spans +//@ [cfail2]compile-flags: -Zincremental-ignore-spans +//@ [cfail3]compile-flags: -Zincremental-ignore-spans #![allow(warnings)] #![feature(rustc_attrs)] diff --git a/tests/incremental/hashes/trait_defs.rs b/tests/incremental/hashes/trait_defs.rs index 60faf3c47d69..cb8716d90b07 100644 --- a/tests/incremental/hashes/trait_defs.rs +++ b/tests/incremental/hashes/trait_defs.rs @@ -10,12 +10,12 @@ // results in a change of the ICH for the trait's metadata, and that it stays // the same between rev2 and rev3. -// build-pass (FIXME(62277): could be check-pass?) -// revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 -// compile-flags: -Z query-dep-graph -O -// [cfail1]compile-flags: -Zincremental-ignore-spans -// [cfail2]compile-flags: -Zincremental-ignore-spans -// [cfail3]compile-flags: -Zincremental-ignore-spans +//@ build-pass (FIXME(62277): could be check-pass?) +//@ revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 +//@ compile-flags: -Z query-dep-graph -O +//@ [cfail1]compile-flags: -Zincremental-ignore-spans +//@ [cfail2]compile-flags: -Zincremental-ignore-spans +//@ [cfail3]compile-flags: -Zincremental-ignore-spans #![allow(warnings)] #![feature(rustc_attrs)] diff --git a/tests/incremental/hashes/trait_impls.rs b/tests/incremental/hashes/trait_impls.rs index e103be0a0856..a5003a8d4326 100644 --- a/tests/incremental/hashes/trait_impls.rs +++ b/tests/incremental/hashes/trait_impls.rs @@ -5,12 +5,12 @@ // and make sure that the hash has changed, then change nothing between rev2 and // rev3 and make sure that the hash has not changed. -// build-pass (FIXME(62277): could be check-pass?) -// revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 -// compile-flags: -Z query-dep-graph -O -// [cfail1]compile-flags: -Zincremental-ignore-spans -// [cfail2]compile-flags: -Zincremental-ignore-spans -// [cfail3]compile-flags: -Zincremental-ignore-spans +//@ build-pass (FIXME(62277): could be check-pass?) +//@ revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 +//@ compile-flags: -Z query-dep-graph -O +//@ [cfail1]compile-flags: -Zincremental-ignore-spans +//@ [cfail2]compile-flags: -Zincremental-ignore-spans +//@ [cfail3]compile-flags: -Zincremental-ignore-spans #![allow(warnings)] #![feature(rustc_attrs)] diff --git a/tests/incremental/hashes/type_defs.rs b/tests/incremental/hashes/type_defs.rs index 6b0dac1fe69b..137bffd9aeb6 100644 --- a/tests/incremental/hashes/type_defs.rs +++ b/tests/incremental/hashes/type_defs.rs @@ -10,9 +10,9 @@ // results in a change of the ICH for the enum's metadata, and that it stays // the same between rev2 and rev3. -// build-pass (FIXME(62277): could be check-pass?) -// revisions: cfail1 cfail2 cfail3 -// compile-flags: -Z query-dep-graph -O +//@ build-pass (FIXME(62277): could be check-pass?) +//@ revisions: cfail1 cfail2 cfail3 +//@ compile-flags: -Z query-dep-graph -O #![allow(warnings)] #![feature(rustc_attrs)] diff --git a/tests/incremental/hashes/unary_and_binary_exprs.rs b/tests/incremental/hashes/unary_and_binary_exprs.rs index 3d48f2d28a37..d0b502845071 100644 --- a/tests/incremental/hashes/unary_and_binary_exprs.rs +++ b/tests/incremental/hashes/unary_and_binary_exprs.rs @@ -5,12 +5,12 @@ // and make sure that the hash has changed, then change nothing between rev2 and // rev3 and make sure that the hash has not changed. -// build-pass (FIXME(62277): could be check-pass?) -// revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 -// compile-flags: -Z query-dep-graph -O -// [cfail1]compile-flags: -Zincremental-ignore-spans -// [cfail2]compile-flags: -Zincremental-ignore-spans -// [cfail3]compile-flags: -Zincremental-ignore-spans +//@ build-pass (FIXME(62277): could be check-pass?) +//@ revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 +//@ compile-flags: -Z query-dep-graph -O +//@ [cfail1]compile-flags: -Zincremental-ignore-spans +//@ [cfail2]compile-flags: -Zincremental-ignore-spans +//@ [cfail3]compile-flags: -Zincremental-ignore-spans #![allow(warnings)] #![feature(rustc_attrs)] diff --git a/tests/incremental/hashes/while_let_loops.rs b/tests/incremental/hashes/while_let_loops.rs index 64ba3f6e7ef8..7a7bcb7d039d 100644 --- a/tests/incremental/hashes/while_let_loops.rs +++ b/tests/incremental/hashes/while_let_loops.rs @@ -5,12 +5,12 @@ // and make sure that the hash has changed, then change nothing between rev2 and // rev3 and make sure that the hash has not changed. -// build-pass (FIXME(62277): could be check-pass?) -// revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 -// compile-flags: -Z query-dep-graph -O -// [cfail1]compile-flags: -Zincremental-ignore-spans -// [cfail2]compile-flags: -Zincremental-ignore-spans -// [cfail3]compile-flags: -Zincremental-ignore-spans +//@ build-pass (FIXME(62277): could be check-pass?) +//@ revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 +//@ compile-flags: -Z query-dep-graph -O +//@ [cfail1]compile-flags: -Zincremental-ignore-spans +//@ [cfail2]compile-flags: -Zincremental-ignore-spans +//@ [cfail3]compile-flags: -Zincremental-ignore-spans #![allow(warnings)] #![feature(rustc_attrs)] diff --git a/tests/incremental/hashes/while_loops.rs b/tests/incremental/hashes/while_loops.rs index 534f61b84bde..dc343c3cbfae 100644 --- a/tests/incremental/hashes/while_loops.rs +++ b/tests/incremental/hashes/while_loops.rs @@ -5,12 +5,12 @@ // and make sure that the hash has changed, then change nothing between rev2 and // rev3 and make sure that the hash has not changed. -// build-pass (FIXME(62277): could be check-pass?) -// revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 -// compile-flags: -Z query-dep-graph -O -// [cfail1]compile-flags: -Zincremental-ignore-spans -// [cfail2]compile-flags: -Zincremental-ignore-spans -// [cfail3]compile-flags: -Zincremental-ignore-spans +//@ build-pass (FIXME(62277): could be check-pass?) +//@ revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 +//@ compile-flags: -Z query-dep-graph -O +//@ [cfail1]compile-flags: -Zincremental-ignore-spans +//@ [cfail2]compile-flags: -Zincremental-ignore-spans +//@ [cfail3]compile-flags: -Zincremental-ignore-spans #![allow(warnings)] #![feature(rustc_attrs)] diff --git a/tests/incremental/hello_world.rs b/tests/incremental/hello_world.rs index d5ec6e92bc0e..ab1f9dbf1840 100644 --- a/tests/incremental/hello_world.rs +++ b/tests/incremental/hello_world.rs @@ -1,5 +1,5 @@ -// revisions: rpass1 rpass2 -// compile-flags: -Z query-dep-graph +//@ revisions: rpass1 rpass2 +//@ compile-flags: -Z query-dep-graph #![allow(warnings)] #![feature(rustc_attrs)] diff --git a/tests/incremental/hygiene/auxiliary/cached_hygiene.rs b/tests/incremental/hygiene/auxiliary/cached_hygiene.rs index c1fd47cb2bb4..a49715761582 100644 --- a/tests/incremental/hygiene/auxiliary/cached_hygiene.rs +++ b/tests/incremental/hygiene/auxiliary/cached_hygiene.rs @@ -1,5 +1,5 @@ -// revisions:rpass1 rpass2 -// compile-flags: -Z query-dep-graph +//@ revisions:rpass1 rpass2 +//@ compile-flags: -Z query-dep-graph // We use #[inline(always)] to ensure that the downstream crate // will always load the MIR for these functions diff --git a/tests/incremental/hygiene/load_cached_hygiene.rs b/tests/incremental/hygiene/load_cached_hygiene.rs index 355d33458524..4ad9c7d49fda 100644 --- a/tests/incremental/hygiene/load_cached_hygiene.rs +++ b/tests/incremental/hygiene/load_cached_hygiene.rs @@ -1,13 +1,13 @@ -// revisions:rpass1 rpass2 -// compile-flags: -Z query-dep-graph -// aux-build:cached_hygiene.rs +//@ revisions:rpass1 rpass2 +//@ compile-flags: -Z query-dep-graph +//@ aux-build:cached_hygiene.rs // This tests the following scenario // 1. A foreign crate is compiled with incremental compilation. // This causes hygiene information to be saved to the incr cache. // 2. One function is the foreign crate is modified. This causes the // optimized mir for an unmodified function to be loaded from the -// incremental cache and written out to the crate metadata. +//@ incremental cache and written out to the crate metadata. // 3. In the process of loading and writing out this function's MIR, // we load hygiene information from the incremental cache and // write it to our metadata. diff --git a/tests/incremental/ich_method_call_trait_scope.rs b/tests/incremental/ich_method_call_trait_scope.rs index 5566506c039d..a4c6558602f7 100644 --- a/tests/incremental/ich_method_call_trait_scope.rs +++ b/tests/incremental/ich_method_call_trait_scope.rs @@ -1,8 +1,8 @@ // Check that the hash for a method call is sensitive to the traits in // scope. -// revisions: rpass1 rpass2 -// compile-flags: -Z query-dep-graph +//@ revisions: rpass1 rpass2 +//@ compile-flags: -Z query-dep-graph #![feature(rustc_attrs)] diff --git a/tests/incremental/ich_nested_items.rs b/tests/incremental/ich_nested_items.rs index f0310e94015c..19628e0bce1b 100644 --- a/tests/incremental/ich_nested_items.rs +++ b/tests/incremental/ich_nested_items.rs @@ -1,9 +1,9 @@ // Check that the hash of `foo` doesn't change just because we ordered // the nested items (or even added new ones). -// revisions: cfail1 cfail2 -// build-pass (FIXME(62277): could be check-pass?) -// compile-flags: -Z query-dep-graph +//@ revisions: cfail1 cfail2 +//@ build-pass (FIXME(62277): could be check-pass?) +//@ compile-flags: -Z query-dep-graph #![crate_type = "rlib"] #![feature(rustc_attrs)] diff --git a/tests/incremental/ich_resolve_results.rs b/tests/incremental/ich_resolve_results.rs index 9b5afcd80121..c5b2b66fef9f 100644 --- a/tests/incremental/ich_resolve_results.rs +++ b/tests/incremental/ich_resolve_results.rs @@ -1,8 +1,8 @@ // Check that the hash for `mod3::bar` changes when we change the // `use` to something different. -// revisions: rpass1 rpass2 rpass3 -// compile-flags: -Z query-dep-graph +//@ revisions: rpass1 rpass2 rpass3 +//@ compile-flags: -Z query-dep-graph #![feature(rustc_attrs)] diff --git a/tests/incremental/incremental_proc_macro.rs b/tests/incremental/incremental_proc_macro.rs index becc1538fb22..97faf8e698a2 100644 --- a/tests/incremental/incremental_proc_macro.rs +++ b/tests/incremental/incremental_proc_macro.rs @@ -1,6 +1,6 @@ -// aux-build:incremental_proc_macro_aux.rs -// revisions: cfail1 cfail2 -// build-pass (FIXME(62277): could be check-pass?) +//@ aux-build:incremental_proc_macro_aux.rs +//@ revisions: cfail1 cfail2 +//@ build-pass (FIXME(62277): could be check-pass?) // This test makes sure that we still find the proc-macro registrar function // when we compile proc-macros incrementally (see #47292). diff --git a/tests/incremental/inlined_hir_34991/main.rs b/tests/incremental/inlined_hir_34991/main.rs index bb76a0bb8fe8..7754add917d2 100644 --- a/tests/incremental/inlined_hir_34991/main.rs +++ b/tests/incremental/inlined_hir_34991/main.rs @@ -4,7 +4,7 @@ // error because the `X` is remapped to the original def-id (in // libstd), and we can't hash a HIR node from std. -// revisions:rpass1 rpass2 +//@ revisions:rpass1 rpass2 #![feature(rustc_attrs)] diff --git a/tests/incremental/issue-100521-change-struct-name-assocty.rs b/tests/incremental/issue-100521-change-struct-name-assocty.rs index 7f8d1e608819..0c1938beef27 100644 --- a/tests/incremental/issue-100521-change-struct-name-assocty.rs +++ b/tests/incremental/issue-100521-change-struct-name-assocty.rs @@ -1,4 +1,4 @@ -// revisions: rpass1 rpass2 +//@ revisions: rpass1 rpass2 pub fn foo() { bar(); diff --git a/tests/incremental/issue-101518.rs b/tests/incremental/issue-101518.rs index 39373da6a9f6..02f4f5d42e74 100644 --- a/tests/incremental/issue-101518.rs +++ b/tests/incremental/issue-101518.rs @@ -1,4 +1,4 @@ -// revisions: cpass +//@ revisions: cpass #[derive(PartialEq, Eq)] struct Id<'a> { diff --git a/tests/incremental/issue-108481-feed-eval-always.rs b/tests/incremental/issue-108481-feed-eval-always.rs index 8f346a7207e7..ef2e2fb59c2d 100644 --- a/tests/incremental/issue-108481-feed-eval-always.rs +++ b/tests/incremental/issue-108481-feed-eval-always.rs @@ -1,4 +1,4 @@ -// revisions: cpass1 cpass2 +//@ revisions: cpass1 cpass2 #![crate_type = "rlib"] diff --git a/tests/incremental/issue-110457-same-span-closures/auxiliary/egui_inspect_derive.rs b/tests/incremental/issue-110457-same-span-closures/auxiliary/egui_inspect_derive.rs index e7d91235e735..3b4933811d3f 100644 --- a/tests/incremental/issue-110457-same-span-closures/auxiliary/egui_inspect_derive.rs +++ b/tests/incremental/issue-110457-same-span-closures/auxiliary/egui_inspect_derive.rs @@ -1,5 +1,5 @@ -// force-host -// no-prefer-dynamic +//@ force-host +//@ no-prefer-dynamic #![crate_type = "proc-macro"] extern crate proc_macro; diff --git a/tests/incremental/issue-110457-same-span-closures/main.rs b/tests/incremental/issue-110457-same-span-closures/main.rs index b44fda3d36a2..c36b7e3ca804 100644 --- a/tests/incremental/issue-110457-same-span-closures/main.rs +++ b/tests/incremental/issue-110457-same-span-closures/main.rs @@ -1,5 +1,5 @@ -// aux-build: egui_inspect_derive.rs -// revisions: cpass1 cpass2 +//@ aux-build: egui_inspect_derive.rs +//@ revisions: cpass1 cpass2 extern crate egui_inspect_derive; diff --git a/tests/incremental/issue-35593.rs b/tests/incremental/issue-35593.rs index 009e37d17c3b..5e5235dc2c4c 100644 --- a/tests/incremental/issue-35593.rs +++ b/tests/incremental/issue-35593.rs @@ -1,8 +1,8 @@ // Regression test for #35593. Check that we can reuse this trivially // equal example. -// revisions:rpass1 rpass2 -// compile-flags: -Z query-dep-graph +//@ revisions:rpass1 rpass2 +//@ compile-flags: -Z query-dep-graph #![feature(rustc_attrs)] #![rustc_partition_reused(module="issue_35593", cfg="rpass2")] diff --git a/tests/incremental/issue-38222.rs b/tests/incremental/issue-38222.rs index 20d4d4200bc1..e45a16f99b33 100644 --- a/tests/incremental/issue-38222.rs +++ b/tests/incremental/issue-38222.rs @@ -1,8 +1,8 @@ // Test that debuginfo does not introduce a dependency edge to the hir_crate // dep-node. -// revisions:rpass1 rpass2 -// compile-flags: -Z query-dep-graph +//@ revisions:rpass1 rpass2 +//@ compile-flags: -Z query-dep-graph #![feature(rustc_attrs)] #![rustc_partition_reused(module = "issue_38222-mod1", cfg = "rpass2")] @@ -10,8 +10,8 @@ // be re-used, so checking that this module was re-used is sufficient. #![rustc_partition_reused(module = "issue_38222", cfg = "rpass2")] -//[rpass1] compile-flags: -C debuginfo=1 -//[rpass2] compile-flags: -C debuginfo=1 +//@[rpass1] compile-flags: -C debuginfo=1 +//@[rpass2] compile-flags: -C debuginfo=1 pub fn main() { mod1::some_fn(); diff --git a/tests/incremental/issue-39569.rs b/tests/incremental/issue-39569.rs index 881ecfca740b..6fd0776bd733 100644 --- a/tests/incremental/issue-39569.rs +++ b/tests/incremental/issue-39569.rs @@ -3,8 +3,8 @@ // don't end up with an edge to any HIR nodes, but it still gets // preserved in the dep graph. -// revisions:rpass1 rpass2 -// compile-flags: -Z query-dep-graph +//@ revisions:rpass1 rpass2 +//@ compile-flags: -Z query-dep-graph use std::sync::Arc; diff --git a/tests/incremental/issue-39828/auxiliary/generic.rs b/tests/incremental/issue-39828/auxiliary/generic.rs index a5bb0d65f1b0..5400570377d7 100644 --- a/tests/incremental/issue-39828/auxiliary/generic.rs +++ b/tests/incremental/issue-39828/auxiliary/generic.rs @@ -1,5 +1,5 @@ -// revisions:rpass1 rpass2 -// compile-flags: -Z query-dep-graph +//@ revisions:rpass1 rpass2 +//@ compile-flags: -Z query-dep-graph #![rustc_partition_reused(module="generic-fallback.cgu", cfg="rpass2")] #![feature(rustc_attrs)] diff --git a/tests/incremental/issue-39828/issue-39828.rs b/tests/incremental/issue-39828/issue-39828.rs index 8cef916ff542..703d8e8dd228 100644 --- a/tests/incremental/issue-39828/issue-39828.rs +++ b/tests/incremental/issue-39828/issue-39828.rs @@ -5,8 +5,8 @@ // reload, we would consider that node dirty since it is not recreated // (it is not the target of any edges). -// revisions:rpass1 rpass2 -// aux-build:generic.rs +//@ revisions:rpass1 rpass2 +//@ aux-build:generic.rs extern crate generic; fn main() { } diff --git a/tests/incremental/issue-42602.rs b/tests/incremental/issue-42602.rs index b8d5303fb473..d02c7f74665d 100644 --- a/tests/incremental/issue-42602.rs +++ b/tests/incremental/issue-42602.rs @@ -6,9 +6,9 @@ // This was fixed by improving the resolution of the `FnOnce` trait // selection node. -// revisions:cfail1 cfail2 cfail3 -// compile-flags:-Zquery-dep-graph -// build-pass (FIXME(62277): could be check-pass?) +//@ revisions:cfail1 cfail2 cfail3 +//@ compile-flags:-Zquery-dep-graph +//@ build-pass (FIXME(62277): could be check-pass?) #![feature(rustc_attrs)] diff --git a/tests/incremental/issue-49043.rs b/tests/incremental/issue-49043.rs index 8d13718b8d84..e9613683cc5e 100644 --- a/tests/incremental/issue-49043.rs +++ b/tests/incremental/issue-49043.rs @@ -4,7 +4,7 @@ // would then produce a `?0` which -- in turn -- triggered an ICE in // hashing. -// revisions:cfail1 +//@ revisions:cfail1 fn main() { println!("Hello, world! {}",*thread_rng().choose(&[0, 1, 2, 3]).unwrap()); diff --git a/tests/incremental/issue-49482.rs b/tests/incremental/issue-49482.rs index 042ecc0f2795..2dddde6c1710 100644 --- a/tests/incremental/issue-49482.rs +++ b/tests/incremental/issue-49482.rs @@ -1,6 +1,6 @@ -// aux-build:issue-49482-macro-def.rs -// aux-build:issue-49482-reexport.rs -// revisions: rpass1 +//@ aux-build:issue-49482-macro-def.rs +//@ aux-build:issue-49482-reexport.rs +//@ revisions: rpass1 extern crate issue_49482_reexport; diff --git a/tests/incremental/issue-49595/issue-49595.rs b/tests/incremental/issue-49595/issue-49595.rs index 7b1096a64c1d..a291188f746e 100644 --- a/tests/incremental/issue-49595/issue-49595.rs +++ b/tests/incremental/issue-49595/issue-49595.rs @@ -1,6 +1,6 @@ -// revisions:cfail1 cfail2 cfail3 -// compile-flags: -Z query-dep-graph --test -// build-pass +//@ revisions:cfail1 cfail2 cfail3 +//@ compile-flags: -Z query-dep-graph --test +//@ build-pass #![feature(rustc_attrs)] #![crate_type = "rlib"] diff --git a/tests/incremental/issue-51409.rs b/tests/incremental/issue-51409.rs index 280094ec04a2..ed0d8ff49e1f 100644 --- a/tests/incremental/issue-51409.rs +++ b/tests/incremental/issue-51409.rs @@ -1,4 +1,4 @@ -// revisions: rpass1 +//@ revisions: rpass1 // Regression test that `infer_outlives_predicates` can be // used with incremental without an ICE. diff --git a/tests/incremental/issue-54059.rs b/tests/incremental/issue-54059.rs index 0a5a547509f6..a5408c671b76 100644 --- a/tests/incremental/issue-54059.rs +++ b/tests/incremental/issue-54059.rs @@ -1,7 +1,7 @@ -// aux-build:issue-54059.rs -// ignore-wasm32-bare no libc for ffi testing -// ignore-windows - dealing with weird symbols issues on dylibs isn't worth it -// revisions: rpass1 +//@ aux-build:issue-54059.rs +//@ ignore-wasm32-bare no libc for ffi testing +//@ ignore-windows - dealing with weird symbols issues on dylibs isn't worth it +//@ revisions: rpass1 extern crate issue_54059; diff --git a/tests/incremental/issue-54242.rs b/tests/incremental/issue-54242.rs index 806c84152598..9fa5363e0045 100644 --- a/tests/incremental/issue-54242.rs +++ b/tests/incremental/issue-54242.rs @@ -1,4 +1,4 @@ -// revisions: rpass cfail +//@ revisions: rpass cfail trait Tr where diff --git a/tests/incremental/issue-59523-on-implemented-is-not-unused.rs b/tests/incremental/issue-59523-on-implemented-is-not-unused.rs index fa52ca90b105..973757223230 100644 --- a/tests/incremental/issue-59523-on-implemented-is-not-unused.rs +++ b/tests/incremental/issue-59523-on-implemented-is-not-unused.rs @@ -2,8 +2,8 @@ // rustc_on_unimplemented, but with this bug we are seeing it fire (on // subsequent runs) if incremental compilation is enabled. -// revisions: cfail1 cfail2 -// build-pass (FIXME(62277): could be check-pass?) +//@ revisions: cfail1 cfail2 +//@ build-pass (FIXME(62277): could be check-pass?) #![feature(rustc_attrs)] #![deny(unused_attributes)] diff --git a/tests/incremental/issue-59524-layout-scalar-valid-range-is-not-unused.rs b/tests/incremental/issue-59524-layout-scalar-valid-range-is-not-unused.rs index bfb5e539cc18..fcd58f7a8d65 100644 --- a/tests/incremental/issue-59524-layout-scalar-valid-range-is-not-unused.rs +++ b/tests/incremental/issue-59524-layout-scalar-valid-range-is-not-unused.rs @@ -3,8 +3,8 @@ // seeing it fire (on subsequent runs) if incremental compilation is // enabled. -// revisions: cfail1 cfail2 -// build-pass (FIXME(62277): could be check-pass?) +//@ revisions: cfail1 cfail2 +//@ build-pass (FIXME(62277): could be check-pass?) #![feature(rustc_attrs)] #![deny(unused_attributes)] diff --git a/tests/incremental/issue-60629.rs b/tests/incremental/issue-60629.rs index 4807af4b3cf7..117e222fc393 100644 --- a/tests/incremental/issue-60629.rs +++ b/tests/incremental/issue-60629.rs @@ -1,4 +1,4 @@ -// revisions:rpass1 rpass2 +//@ revisions:rpass1 rpass2 struct A; diff --git a/tests/incremental/issue-61323.rs b/tests/incremental/issue-61323.rs index 7ce47947cbb0..b7423c81fc16 100644 --- a/tests/incremental/issue-61323.rs +++ b/tests/incremental/issue-61323.rs @@ -1,4 +1,4 @@ -// revisions: rpass cfail +//@ revisions: rpass cfail enum A { //[cfail]~^ ERROR 3:1: 3:7: recursive types `A` and `C` have infinite size [E0072] diff --git a/tests/incremental/issue-61530.rs b/tests/incremental/issue-61530.rs index 1dcb41ddedae..0197beb48d8c 100644 --- a/tests/incremental/issue-61530.rs +++ b/tests/incremental/issue-61530.rs @@ -1,6 +1,6 @@ #![feature(repr_simd, platform_intrinsics)] -// revisions:rpass1 rpass2 +//@ revisions:rpass1 rpass2 #[repr(simd)] struct I32x2(i32, i32); diff --git a/tests/incremental/issue-62649-path-collisions-happen.rs b/tests/incremental/issue-62649-path-collisions-happen.rs index ee81be76bafe..3b04f0ac9d71 100644 --- a/tests/incremental/issue-62649-path-collisions-happen.rs +++ b/tests/incremental/issue-62649-path-collisions-happen.rs @@ -1,4 +1,4 @@ -// revisions: rpass1 rpass2 +//@ revisions: rpass1 rpass2 #[cfg(rpass1)] pub trait Something { diff --git a/tests/incremental/issue-69596.rs b/tests/incremental/issue-69596.rs index dc587fdc44b0..00d0d2b64a4f 100644 --- a/tests/incremental/issue-69596.rs +++ b/tests/incremental/issue-69596.rs @@ -1,4 +1,4 @@ -// revisions: rpass1 rpass2 +//@ revisions: rpass1 rpass2 #![allow(unused_imports)] diff --git a/tests/incremental/issue-72386.rs b/tests/incremental/issue-72386.rs index 5917152e1bcf..b3cd2a642081 100644 --- a/tests/incremental/issue-72386.rs +++ b/tests/incremental/issue-72386.rs @@ -1,6 +1,6 @@ -// revisions: rpass1 cfail1 rpass3 -// needs-asm-support -// only-x86_64 +//@ revisions: rpass1 cfail1 rpass3 +//@ needs-asm-support +//@ only-x86_64 // Regression test for issue #72386 // Checks that we don't ICE when switching to an invalid register // and back again diff --git a/tests/incremental/issue-79661-missing-def-path-hash.rs b/tests/incremental/issue-79661-missing-def-path-hash.rs index f86fb33fbf68..c063c6a33a28 100644 --- a/tests/incremental/issue-79661-missing-def-path-hash.rs +++ b/tests/incremental/issue-79661-missing-def-path-hash.rs @@ -1,5 +1,5 @@ -// aux-build:issue-79661.rs -// revisions: rpass1 rpass2 rpass3 +//@ aux-build:issue-79661.rs +//@ revisions: rpass1 rpass2 rpass3 // Regression test for issue #79661 // We were failing to copy over a DefPathHash->DefId mapping diff --git a/tests/incremental/issue-79890-imported-crates-changed.rs b/tests/incremental/issue-79890-imported-crates-changed.rs index 93daa5ca9358..8c70d224f9e5 100644 --- a/tests/incremental/issue-79890-imported-crates-changed.rs +++ b/tests/incremental/issue-79890-imported-crates-changed.rs @@ -1,7 +1,7 @@ -// aux-build:issue-79890.rs -// revisions:rpass1 rpass2 rpass3 -// compile-flags:--extern issue_79890 --test -// edition:2018 +//@ aux-build:issue-79890.rs +//@ revisions:rpass1 rpass2 rpass3 +//@ compile-flags:--extern issue_79890 --test +//@ edition:2018 // Tests that we don't ICE when the set of imported crates changes #[cfg(rpass2)] use issue_79890::MyTrait; diff --git a/tests/incremental/issue-80336-invalid-span.rs b/tests/incremental/issue-80336-invalid-span.rs index 7757d915911d..251a59c3b57d 100644 --- a/tests/incremental/issue-80336-invalid-span.rs +++ b/tests/incremental/issue-80336-invalid-span.rs @@ -2,8 +2,8 @@ // Test that we properly handle encoding, decoding, and hashing // of spans with an invalid location and non-root `SyntaxContext` -// revisions:rpass1 rpass2 -// only-x86_64 +//@ revisions:rpass1 rpass2 +//@ only-x86_64 pub fn main() { let _ = is_x86_feature_detected!("avx2"); diff --git a/tests/incremental/issue-80691-bad-eval-cache.rs b/tests/incremental/issue-80691-bad-eval-cache.rs index ad8a338a7964..4f897bd64a0d 100644 --- a/tests/incremental/issue-80691-bad-eval-cache.rs +++ b/tests/incremental/issue-80691-bad-eval-cache.rs @@ -1,7 +1,7 @@ -// revisions: rfail1 rfail2 -// failure-status: 101 -// error-pattern: not implemented -// needs-unwind -Cpanic=abort causes abort instead of exit(101) +//@ revisions: rfail1 rfail2 +//@ failure-status: 101 +//@ error-pattern: not implemented +//@ needs-unwind -Cpanic=abort causes abort instead of exit(101) pub trait Interner { type InternedVariableKinds; diff --git a/tests/incremental/issue-82920-predicate-order-miscompile.rs b/tests/incremental/issue-82920-predicate-order-miscompile.rs index 793af679c9fc..e1c8b1253f62 100644 --- a/tests/incremental/issue-82920-predicate-order-miscompile.rs +++ b/tests/incremental/issue-82920-predicate-order-miscompile.rs @@ -1,4 +1,4 @@ -// revisions: rpass1 rpass2 +//@ revisions: rpass1 rpass2 trait MyTrait: One + Two {} impl One for T { diff --git a/tests/incremental/issue-84252-global-alloc.rs b/tests/incremental/issue-84252-global-alloc.rs index d2438df89ff5..8dc611df9d87 100644 --- a/tests/incremental/issue-84252-global-alloc.rs +++ b/tests/incremental/issue-84252-global-alloc.rs @@ -1,5 +1,5 @@ -// revisions: cfail1 cfail2 -// build-pass +//@ revisions: cfail1 cfail2 +//@ build-pass #![crate_type="lib"] #![crate_type="cdylib"] diff --git a/tests/incremental/issue-85197-invalid-span/auxiliary/invalid-span-helper-lib.rs b/tests/incremental/issue-85197-invalid-span/auxiliary/invalid-span-helper-lib.rs index 2453af5b6b47..f84c4fe9895e 100644 --- a/tests/incremental/issue-85197-invalid-span/auxiliary/invalid-span-helper-lib.rs +++ b/tests/incremental/issue-85197-invalid-span/auxiliary/invalid-span-helper-lib.rs @@ -1,4 +1,4 @@ -// revisions: rpass1 rpass2 +//@ revisions: rpass1 rpass2 extern crate respan; diff --git a/tests/incremental/issue-85197-invalid-span/auxiliary/respan.rs b/tests/incremental/issue-85197-invalid-span/auxiliary/respan.rs index 5088eab62946..c56d9052e32c 100644 --- a/tests/incremental/issue-85197-invalid-span/auxiliary/respan.rs +++ b/tests/incremental/issue-85197-invalid-span/auxiliary/respan.rs @@ -1,5 +1,5 @@ -// force-host -// no-prefer-dynamic +//@ force-host +//@ no-prefer-dynamic #![crate_type = "proc-macro"] diff --git a/tests/incremental/issue-85197-invalid-span/invalid_span_main.rs b/tests/incremental/issue-85197-invalid-span/invalid_span_main.rs index f358460b3382..eaad44780c74 100644 --- a/tests/incremental/issue-85197-invalid-span/invalid_span_main.rs +++ b/tests/incremental/issue-85197-invalid-span/invalid_span_main.rs @@ -1,6 +1,6 @@ -// revisions: rpass1 rpass2 -// aux-build:respan.rs -// aux-build:invalid-span-helper-lib.rs +//@ revisions: rpass1 rpass2 +//@ aux-build:respan.rs +//@ aux-build:invalid-span-helper-lib.rs // This issue has several different parts. The high level idea is: // 1. We create an 'invalid' span with the help of the `respan` proc-macro, diff --git a/tests/incremental/issue-85360-eval-obligation-ice.rs b/tests/incremental/issue-85360-eval-obligation-ice.rs index 1796c9d197c2..6efae1aa12d7 100644 --- a/tests/incremental/issue-85360-eval-obligation-ice.rs +++ b/tests/incremental/issue-85360-eval-obligation-ice.rs @@ -1,7 +1,7 @@ -// revisions:cfail1 cfail2 -//[cfail1] compile-flags: --crate-type=lib --edition=2021 -Zassert-incr-state=not-loaded -//[cfail2] compile-flags: --crate-type=lib --edition=2021 -Zassert-incr-state=loaded -// build-pass +//@ revisions:cfail1 cfail2 +//@[cfail1] compile-flags: --crate-type=lib --edition=2021 -Zassert-incr-state=not-loaded +//@[cfail2] compile-flags: --crate-type=lib --edition=2021 -Zassert-incr-state=loaded +//@ build-pass use core::any::Any; use core::marker::PhantomData; diff --git a/tests/incremental/issue-86753.rs b/tests/incremental/issue-86753.rs index 4d6c4354e2bd..20357b02c8da 100644 --- a/tests/incremental/issue-86753.rs +++ b/tests/incremental/issue-86753.rs @@ -1,5 +1,5 @@ -// edition:2018 -// revisions: rpass1 +//@ edition:2018 +//@ revisions: rpass1 // Regression test for #86753. The `type_implements_trait` query (since moved to a method) diff --git a/tests/incremental/issue-92163-missing-sourcefile/auxiliary/second_crate.rs b/tests/incremental/issue-92163-missing-sourcefile/auxiliary/second_crate.rs index ab7961f38237..d19c3d34b6e0 100644 --- a/tests/incremental/issue-92163-missing-sourcefile/auxiliary/second_crate.rs +++ b/tests/incremental/issue-92163-missing-sourcefile/auxiliary/second_crate.rs @@ -1,4 +1,4 @@ -// compile-flags:--extern first_crate +//@ compile-flags:--extern first_crate // Note: adding `first_crate` to the extern prelude // (instead of using `extern_crate`) appears to be necessary to diff --git a/tests/incremental/issue-92163-missing-sourcefile/issue_92163_main.rs b/tests/incremental/issue-92163-missing-sourcefile/issue_92163_main.rs index e9219c6f5ab2..c5e73f056d70 100644 --- a/tests/incremental/issue-92163-missing-sourcefile/issue_92163_main.rs +++ b/tests/incremental/issue-92163-missing-sourcefile/issue_92163_main.rs @@ -1,6 +1,6 @@ -// aux-build:first_crate.rs -// aux-build:second_crate.rs -// revisions:rpass1 rpass2 +//@ aux-build:first_crate.rs +//@ aux-build:second_crate.rs +//@ revisions:rpass1 rpass2 // Regression test for issue #92163 // Under certain circumstances, we may end up trying to diff --git a/tests/incremental/issue-92987-provisional-dep-node.rs b/tests/incremental/issue-92987-provisional-dep-node.rs index a48a8373c2b5..4daeb69189d5 100644 --- a/tests/incremental/issue-92987-provisional-dep-node.rs +++ b/tests/incremental/issue-92987-provisional-dep-node.rs @@ -1,4 +1,4 @@ -// revisions: rpass1 rpass2 +//@ revisions: rpass1 rpass2 // Regression test for issue #92987 // Tests that we properly manage `DepNode`s during trait evaluation diff --git a/tests/incremental/issue-96319-coinductive-cycle.rs b/tests/incremental/issue-96319-coinductive-cycle.rs index b5ff9112a202..cf98b325271d 100644 --- a/tests/incremental/issue-96319-coinductive-cycle.rs +++ b/tests/incremental/issue-96319-coinductive-cycle.rs @@ -1,5 +1,5 @@ -// edition:2018 -// revisions: rpass1 rpass2 +//@ edition:2018 +//@ revisions: rpass1 rpass2 pub struct Stmt { pub stmt_type: StmtKind, diff --git a/tests/incremental/krate-inherent.rs b/tests/incremental/krate-inherent.rs index 2c04e110525a..0322d112560c 100644 --- a/tests/incremental/krate-inherent.rs +++ b/tests/incremental/krate-inherent.rs @@ -1,6 +1,6 @@ -// revisions: cfail1 cfail2 -// compile-flags: -Z query-dep-graph -// build-pass (FIXME(62277): could be check-pass?) +//@ revisions: cfail1 cfail2 +//@ compile-flags: -Z query-dep-graph +//@ build-pass (FIXME(62277): could be check-pass?) #![allow(warnings)] #![feature(rustc_attrs)] diff --git a/tests/incremental/krate-inlined.rs b/tests/incremental/krate-inlined.rs index 6b1db74a37c6..3d96b0570f15 100644 --- a/tests/incremental/krate-inlined.rs +++ b/tests/incremental/krate-inlined.rs @@ -2,8 +2,8 @@ // a dependency from the local hir_crate node. We can't easily test that // directly anymore, so now we test that we get reuse. -// revisions: rpass1 rpass2 -// compile-flags: -Z query-dep-graph +//@ revisions: rpass1 rpass2 +//@ compile-flags: -Z query-dep-graph #![allow(warnings)] #![feature(rustc_attrs)] diff --git a/tests/incremental/krate_reassign_34991/main.rs b/tests/incremental/krate_reassign_34991/main.rs index c4ae19ac942f..50f418a3fddb 100644 --- a/tests/incremental/krate_reassign_34991/main.rs +++ b/tests/incremental/krate_reassign_34991/main.rs @@ -1,5 +1,5 @@ -// aux-build:a.rs -// revisions:rpass1 rpass2 +//@ aux-build:a.rs +//@ revisions:rpass1 rpass2 #![feature(rustc_attrs)] diff --git a/tests/incremental/link_order/auxiliary/my_lib.rs b/tests/incremental/link_order/auxiliary/my_lib.rs index 1e7d823050c3..8c083a6701da 100644 --- a/tests/incremental/link_order/auxiliary/my_lib.rs +++ b/tests/incremental/link_order/auxiliary/my_lib.rs @@ -1,3 +1,3 @@ -// no-prefer-dynamic -//[cfail1] compile-flags: -lbar -lfoo --crate-type lib -Zassert-incr-state=not-loaded -//[cfail2] compile-flags: -lfoo -lbar --crate-type lib -Zassert-incr-state=not-loaded +//@ no-prefer-dynamic +//@[cfail1] compile-flags: -lbar -lfoo --crate-type lib -Zassert-incr-state=not-loaded +//@[cfail2] compile-flags: -lfoo -lbar --crate-type lib -Zassert-incr-state=not-loaded diff --git a/tests/incremental/link_order/main.rs b/tests/incremental/link_order/main.rs index d211c295bc49..847a47a75598 100644 --- a/tests/incremental/link_order/main.rs +++ b/tests/incremental/link_order/main.rs @@ -1,7 +1,7 @@ -// aux-build:my_lib.rs -// error-pattern: error: linking with -// revisions:cfail1 cfail2 -// compile-flags:-Z query-dep-graph +//@ aux-build:my_lib.rs +//@ error-pattern: error: linking with +//@ revisions:cfail1 cfail2 +//@ compile-flags:-Z query-dep-graph // Tests that re-ordering the `-l` arguments used // when compiling an external dependency does not lead to diff --git a/tests/incremental/lto-in-linker.rs b/tests/incremental/lto-in-linker.rs index 0e8c1ebb9198..b5009d683486 100644 --- a/tests/incremental/lto-in-linker.rs +++ b/tests/incremental/lto-in-linker.rs @@ -1,7 +1,7 @@ -// revisions:cfail1 cfail2 -// compile-flags: -Z query-dep-graph --crate-type rlib -C linker-plugin-lto -O -// no-prefer-dynamic -// build-pass +//@ revisions:cfail1 cfail2 +//@ compile-flags: -Z query-dep-graph --crate-type rlib -C linker-plugin-lto -O +//@ no-prefer-dynamic +//@ build-pass #![feature(rustc_attrs)] #![rustc_partition_reused(module = "lto_in_linker", cfg = "cfail2")] diff --git a/tests/incremental/lto.rs b/tests/incremental/lto.rs index 2a3e3c2467cd..044267a9cfdf 100644 --- a/tests/incremental/lto.rs +++ b/tests/incremental/lto.rs @@ -1,6 +1,6 @@ -// no-prefer-dynamic -// revisions:rpass1 rpass2 -// compile-flags: -C lto +//@ no-prefer-dynamic +//@ revisions:rpass1 rpass2 +//@ compile-flags: -C lto mod x { pub struct X { diff --git a/tests/incremental/macro_export.rs b/tests/incremental/macro_export.rs index 044d63fd2a9f..23e8f01cf330 100644 --- a/tests/incremental/macro_export.rs +++ b/tests/incremental/macro_export.rs @@ -1,5 +1,5 @@ -// revisions: cfail1 cfail2 cfail3 -// build-pass (FIXME(62277): could be check-pass?) +//@ revisions: cfail1 cfail2 cfail3 +//@ build-pass (FIXME(62277): could be check-pass?) // This test case makes sure that we can compile with incremental compilation // enabled when there are macros exported from this crate. (See #37756) diff --git a/tests/incremental/mir-opt.rs b/tests/incremental/mir-opt.rs index 5bd863439df5..04b82d9ea7fd 100644 --- a/tests/incremental/mir-opt.rs +++ b/tests/incremental/mir-opt.rs @@ -1,8 +1,8 @@ // MIR optimizations can create expansions after the TyCtxt has been created. // This test verifies that those expansions can be decoded correctly. -// revisions:rpass1 rpass2 -// compile-flags: -Z query-dep-graph -Z mir-opt-level=3 +//@ revisions:rpass1 rpass2 +//@ compile-flags: -Z query-dep-graph -Z mir-opt-level=3 fn main() { if std::env::var("a").is_ok() { diff --git a/tests/incremental/no_mangle.rs b/tests/incremental/no_mangle.rs index b1c9b2bc37f6..1a01a40113a2 100644 --- a/tests/incremental/no_mangle.rs +++ b/tests/incremental/no_mangle.rs @@ -1,6 +1,6 @@ -// revisions:cfail1 cfail2 -// check-pass -// compile-flags: --crate-type cdylib +//@ revisions:cfail1 cfail2 +//@ check-pass +//@ compile-flags: --crate-type cdylib #![deny(unused_attributes)] diff --git a/tests/incremental/remapped_paths_cc/auxiliary/extern_crate.rs b/tests/incremental/remapped_paths_cc/auxiliary/extern_crate.rs index 627b99445ea8..166000f3214b 100644 --- a/tests/incremental/remapped_paths_cc/auxiliary/extern_crate.rs +++ b/tests/incremental/remapped_paths_cc/auxiliary/extern_crate.rs @@ -1,6 +1,6 @@ -//[rpass1] compile-flags: -g -//[rpass2] compile-flags: -g -//[rpass3] compile-flags: -g --remap-path-prefix={{src-base}}=/the/src +//@[rpass1] compile-flags: -g +//@[rpass2] compile-flags: -g +//@[rpass3] compile-flags: -g --remap-path-prefix={{src-base}}=/the/src #![feature(rustc_attrs)] #![crate_type="rlib"] diff --git a/tests/incremental/remapped_paths_cc/main.rs b/tests/incremental/remapped_paths_cc/main.rs index 12411a928799..35e03d754469 100644 --- a/tests/incremental/remapped_paths_cc/main.rs +++ b/tests/incremental/remapped_paths_cc/main.rs @@ -1,6 +1,6 @@ -// revisions:rpass1 rpass2 rpass3 -// compile-flags: -Z query-dep-graph -g -// aux-build:extern_crate.rs +//@ revisions:rpass1 rpass2 rpass3 +//@ compile-flags: -Z query-dep-graph -g +//@ aux-build:extern_crate.rs // This test case makes sure that we detect if paths emitted into debuginfo // are changed, even when the change happens in an external crate. diff --git a/tests/incremental/remove-private-item-cross-crate/main.rs b/tests/incremental/remove-private-item-cross-crate/main.rs index c831ab6fec12..209b061dfb66 100644 --- a/tests/incremental/remove-private-item-cross-crate/main.rs +++ b/tests/incremental/remove-private-item-cross-crate/main.rs @@ -1,9 +1,9 @@ // Test that we are able to reuse `main` even though a private // item was removed from the root module of crate`a`. -// revisions:rpass1 rpass2 -// aux-build:a.rs -// compile-flags: -Zquery-dep-graph +//@ revisions:rpass1 rpass2 +//@ aux-build:a.rs +//@ compile-flags: -Zquery-dep-graph #![feature(rustc_attrs)] #![crate_type = "bin"] diff --git a/tests/incremental/remove_crate/main.rs b/tests/incremental/remove_crate/main.rs index 14b80df0d389..e3f15bd9c8cd 100644 --- a/tests/incremental/remove_crate/main.rs +++ b/tests/incremental/remove_crate/main.rs @@ -1,7 +1,7 @@ // Test that removing an upstream crate does not cause any trouble. -// revisions:rpass1 rpass2 -// aux-build:extern_crate.rs +//@ revisions:rpass1 rpass2 +//@ aux-build:extern_crate.rs #[cfg(rpass1)] extern crate extern_crate; diff --git a/tests/incremental/remove_source_file/main.rs b/tests/incremental/remove_source_file/main.rs index b2411c0946fd..979d768e0be2 100644 --- a/tests/incremental/remove_source_file/main.rs +++ b/tests/incremental/remove_source_file/main.rs @@ -1,12 +1,12 @@ // This test case makes sure that the compiler doesn't crash due to a failing // table lookup when a source file is removed. -// revisions:cfail1 cfail2 +//@ revisions:cfail1 cfail2 // Note that we specify -g so that the SourceFiles actually get referenced by the // incr. comp. cache: -// compile-flags: -Z query-dep-graph -g -// build-pass (FIXME(62277): could be check-pass?) +//@ compile-flags: -Z query-dep-graph -g +//@ build-pass (FIXME(62277): could be check-pass?) #![crate_type= "rlib"] diff --git a/tests/incremental/reorder_vtable.rs b/tests/incremental/reorder_vtable.rs index 8dacba63351e..89ff14e8feee 100644 --- a/tests/incremental/reorder_vtable.rs +++ b/tests/incremental/reorder_vtable.rs @@ -1,4 +1,4 @@ -// revisions:rpass1 rpass2 +//@ revisions:rpass1 rpass2 // This test case makes sure re-order the methods in a vtable will // trigger recompilation of codegen units that instantiate it. diff --git a/tests/incremental/rlib-lto.rs b/tests/incremental/rlib-lto.rs index 752fee5a0d5b..51090615b1fa 100644 --- a/tests/incremental/rlib-lto.rs +++ b/tests/incremental/rlib-lto.rs @@ -1,6 +1,6 @@ -// revisions:cfail1 cfail2 -// compile-flags: -Z query-dep-graph --crate-type rlib -C lto -// build-pass +//@ revisions:cfail1 cfail2 +//@ compile-flags: -Z query-dep-graph --crate-type rlib -C lto +//@ build-pass #![feature(rustc_attrs)] #![rustc_partition_reused(module = "rlib_lto", cfg = "cfail2")] diff --git a/tests/incremental/rlib_cross_crate/auxiliary/a.rs b/tests/incremental/rlib_cross_crate/auxiliary/a.rs index 5a26df9ae50c..d2403ebbfdb4 100644 --- a/tests/incremental/rlib_cross_crate/auxiliary/a.rs +++ b/tests/incremental/rlib_cross_crate/auxiliary/a.rs @@ -1,5 +1,5 @@ -// no-prefer-dynamic -// compile-flags: -Z query-dep-graph +//@ no-prefer-dynamic +//@ compile-flags: -Z query-dep-graph #![crate_type="rlib"] diff --git a/tests/incremental/rlib_cross_crate/b.rs b/tests/incremental/rlib_cross_crate/b.rs index 639cfc918cb4..672d2ba40684 100644 --- a/tests/incremental/rlib_cross_crate/b.rs +++ b/tests/incremental/rlib_cross_crate/b.rs @@ -3,10 +3,10 @@ // build rlibs (before we were only testing dylibs, which meant we // didn't realize we had to preserve a `bc` file as well). -// aux-build:a.rs -// revisions:rpass1 rpass2 rpass3 -// no-prefer-dynamic -// compile-flags: -Z query-dep-graph +//@ aux-build:a.rs +//@ revisions:rpass1 rpass2 rpass3 +//@ no-prefer-dynamic +//@ compile-flags: -Z query-dep-graph #![feature(rustc_attrs)] diff --git a/tests/incremental/rustc-rust-log.rs b/tests/incremental/rustc-rust-log.rs index 566f0d96d973..602d376bae5f 100644 --- a/tests/incremental/rustc-rust-log.rs +++ b/tests/incremental/rustc-rust-log.rs @@ -1,11 +1,11 @@ -// revisions: rpass1 rpass2 +//@ revisions: rpass1 rpass2 // This test is just checking that we won't ICE if logging is turned // on; don't bother trying to compare that (copious) output. // -// dont-check-compiler-stdout -// dont-check-compiler-stderr -// aux-build: rustc-rust-log-aux.rs -// rustc-env:RUSTC_LOG=debug +//@ dont-check-compiler-stdout +//@ dont-check-compiler-stderr +//@ aux-build: rustc-rust-log-aux.rs +//@ rustc-env:RUSTC_LOG=debug #[cfg(rpass1)] fn main() {} diff --git a/tests/incremental/source_loc_macros.rs b/tests/incremental/source_loc_macros.rs index 16ad4d1899e9..dbe0a4ba9046 100644 --- a/tests/incremental/source_loc_macros.rs +++ b/tests/incremental/source_loc_macros.rs @@ -1,9 +1,9 @@ // This test makes sure that different expansions of the file!(), line!(), // column!() macros get picked up by the incr. comp. hash. -// revisions:rpass1 rpass2 +//@ revisions:rpass1 rpass2 -// compile-flags: -Z query-dep-graph +//@ compile-flags: -Z query-dep-graph #![feature(rustc_attrs)] diff --git a/tests/incremental/span_hash_stable/main.rs b/tests/incremental/span_hash_stable/main.rs index f1d7de145593..0dba650163d3 100644 --- a/tests/incremental/span_hash_stable/main.rs +++ b/tests/incremental/span_hash_stable/main.rs @@ -3,8 +3,8 @@ // the spans and this test makes sure that we handle them correctly by hashing // file:line:column instead of raw byte offset. -// revisions:rpass1 rpass2 -// compile-flags: -g -Z query-dep-graph +//@ revisions:rpass1 rpass2 +//@ compile-flags: -g -Z query-dep-graph #![feature(rustc_attrs)] diff --git a/tests/incremental/spans_in_type_debuginfo.rs b/tests/incremental/spans_in_type_debuginfo.rs index 8ed469db6e63..e8ae592c0c74 100644 --- a/tests/incremental/spans_in_type_debuginfo.rs +++ b/tests/incremental/spans_in_type_debuginfo.rs @@ -1,8 +1,8 @@ // Test that moving a type definition within a source file does not affect // re-compilation. -// revisions:rpass1 rpass2 -// compile-flags: -Z query-dep-graph -g +//@ revisions:rpass1 rpass2 +//@ compile-flags: -Z query-dep-graph -g #![rustc_partition_reused(module="spans_in_type_debuginfo-structs", cfg="rpass2")] #![rustc_partition_reused(module="spans_in_type_debuginfo-enums", cfg="rpass2")] diff --git a/tests/incremental/spans_significant_w_debuginfo.rs b/tests/incremental/spans_significant_w_debuginfo.rs index a036d3e69fe4..48be9cd3bc96 100644 --- a/tests/incremental/spans_significant_w_debuginfo.rs +++ b/tests/incremental/spans_significant_w_debuginfo.rs @@ -1,9 +1,9 @@ // This test makes sure that just changing a definition's location in the // source file also changes its incr. comp. hash, if debuginfo is enabled. -// revisions:rpass1 rpass2 +//@ revisions:rpass1 rpass2 -// compile-flags: -g -Z query-dep-graph +//@ compile-flags: -g -Z query-dep-graph #![feature(rustc_attrs)] #![rustc_partition_codegened(module = "spans_significant_w_debuginfo", cfg = "rpass2")] diff --git a/tests/incremental/spans_significant_w_panic.rs b/tests/incremental/spans_significant_w_panic.rs index 085e4cd78ca1..f9016725258b 100644 --- a/tests/incremental/spans_significant_w_panic.rs +++ b/tests/incremental/spans_significant_w_panic.rs @@ -1,9 +1,9 @@ // This test makes sure that just changing a definition's location in the // source file also changes its incr. comp. hash, if debuginfo is enabled. -// revisions:rpass1 rpass2 +//@ revisions:rpass1 rpass2 -// compile-flags: -C overflow-checks=on -Z query-dep-graph +//@ compile-flags: -C overflow-checks=on -Z query-dep-graph #![feature(rustc_attrs)] #![rustc_partition_codegened(module = "spans_significant_w_panic", cfg = "rpass2")] diff --git a/tests/incremental/spike-neg1.rs b/tests/incremental/spike-neg1.rs index 97812ffe3be9..c5fe31862b47 100644 --- a/tests/incremental/spike-neg1.rs +++ b/tests/incremental/spike-neg1.rs @@ -2,11 +2,11 @@ // `rustc_partition_reused` and `rustc_partition_codegened` tests. // Here we change and say that the `x` module will be reused (when in // fact it will not), and then indicate that the test itself -// should-fail (because an error will be reported, and hence the +//@ should-fail (because an error will be reported, and hence the // revision rpass2 will not compile, despite being named rpass). -// revisions:rpass1 rpass2 -// should-fail +//@ revisions:rpass1 rpass2 +//@ should-fail #![feature(rustc_attrs)] diff --git a/tests/incremental/spike-neg2.rs b/tests/incremental/spike-neg2.rs index 3bb1914fd6a4..140aa4684a77 100644 --- a/tests/incremental/spike-neg2.rs +++ b/tests/incremental/spike-neg2.rs @@ -2,11 +2,11 @@ // `rustc_partition_reused` and `rustc_partition_codegened` tests. // Here we change and say that the `y` module will be codegened (when // in fact it will not), and then indicate that the test itself -// should-fail (because an error will be reported, and hence the +//@ should-fail (because an error will be reported, and hence the // revision rpass2 will not compile, despite being named rpass). -// revisions:rpass1 rpass2 -// should-fail +//@ revisions:rpass1 rpass2 +//@ should-fail #![feature(rustc_attrs)] diff --git a/tests/incremental/spike.rs b/tests/incremental/spike.rs index a6a05e7c3db8..5e6cd2fe3b39 100644 --- a/tests/incremental/spike.rs +++ b/tests/incremental/spike.rs @@ -2,8 +2,8 @@ // content of the `make` function, and we find that we can reuse the // `y` module entirely (but not the `x` module). -// revisions:rpass1 rpass2 -// compile-flags: -Z query-dep-graph +//@ revisions:rpass1 rpass2 +//@ compile-flags: -Z query-dep-graph #![feature(rustc_attrs)] diff --git a/tests/incremental/split_debuginfo_cached.rs b/tests/incremental/split_debuginfo_cached.rs index ba8385f89a72..4dea77308a71 100644 --- a/tests/incremental/split_debuginfo_cached.rs +++ b/tests/incremental/split_debuginfo_cached.rs @@ -3,11 +3,11 @@ // pack into a DWARF package. // ignore-tidy-linelength -// only-x86_64-unknown-linux-gnu -// revisions:rpass1 rpass2 +//@ only-x86_64-unknown-linux-gnu +//@ revisions:rpass1 rpass2 -// [rpass1]compile-flags: -g -Zquery-dep-graph -Csplit-debuginfo=packed -Zsplit-dwarf-kind=split -// [rpass2]compile-flags: -g -Zquery-dep-graph -Csplit-debuginfo=packed -Zsplit-dwarf-kind=split +//@ [rpass1]compile-flags: -g -Zquery-dep-graph -Csplit-debuginfo=packed -Zsplit-dwarf-kind=split +//@ [rpass2]compile-flags: -g -Zquery-dep-graph -Csplit-debuginfo=packed -Zsplit-dwarf-kind=split #![feature(rustc_attrs)] // For `rpass2`, nothing has changed so everything should re-used. diff --git a/tests/incremental/split_debuginfo_mode.rs b/tests/incremental/split_debuginfo_mode.rs index edc1a80d30e0..d994e24cd587 100644 --- a/tests/incremental/split_debuginfo_mode.rs +++ b/tests/incremental/split_debuginfo_mode.rs @@ -3,13 +3,13 @@ // and the test is platform-independent otherwise. // ignore-tidy-linelength -// only-x86_64-unknown-linux-gnu -// revisions:rpass1 rpass2 rpass3 rpass4 +//@ only-x86_64-unknown-linux-gnu +//@ revisions:rpass1 rpass2 rpass3 rpass4 -// [rpass1]compile-flags: -Zquery-dep-graph -Csplit-debuginfo=unpacked -Zsplit-dwarf-kind=single -Zsplit-dwarf-inlining=on -// [rpass2]compile-flags: -Zquery-dep-graph -Csplit-debuginfo=packed -Zsplit-dwarf-kind=single -Zsplit-dwarf-inlining=on -// [rpass3]compile-flags: -Zquery-dep-graph -Csplit-debuginfo=packed -Zsplit-dwarf-kind=split -Zsplit-dwarf-inlining=on -// [rpass4]compile-flags: -Zquery-dep-graph -Csplit-debuginfo=packed -Zsplit-dwarf-kind=split -Zsplit-dwarf-inlining=off +//@ [rpass1]compile-flags: -Zquery-dep-graph -Csplit-debuginfo=unpacked -Zsplit-dwarf-kind=single -Zsplit-dwarf-inlining=on +//@ [rpass2]compile-flags: -Zquery-dep-graph -Csplit-debuginfo=packed -Zsplit-dwarf-kind=single -Zsplit-dwarf-inlining=on +//@ [rpass3]compile-flags: -Zquery-dep-graph -Csplit-debuginfo=packed -Zsplit-dwarf-kind=split -Zsplit-dwarf-inlining=on +//@ [rpass4]compile-flags: -Zquery-dep-graph -Csplit-debuginfo=packed -Zsplit-dwarf-kind=split -Zsplit-dwarf-inlining=off #![feature(rustc_attrs)] // For rpass2 we change -Csplit-debuginfo and thus expect every CGU to be recompiled diff --git a/tests/incremental/static_cycle/b.rs b/tests/incremental/static_cycle/b.rs index 064213fbabbf..7054b2ea4e36 100644 --- a/tests/incremental/static_cycle/b.rs +++ b/tests/incremental/static_cycle/b.rs @@ -1,4 +1,4 @@ -// revisions:rpass1 rpass2 +//@ revisions:rpass1 rpass2 #![cfg_attr(rpass2, warn(dead_code))] diff --git a/tests/incremental/static_refering_to_other_static/issue-49081.rs b/tests/incremental/static_refering_to_other_static/issue-49081.rs index 8e3715d1d834..b6c1c1a9c8bd 100644 --- a/tests/incremental/static_refering_to_other_static/issue-49081.rs +++ b/tests/incremental/static_refering_to_other_static/issue-49081.rs @@ -1,6 +1,6 @@ // https://github.com/rust-lang/rust/issues/49081 -// revisions:rpass1 rpass2 +//@ revisions:rpass1 rpass2 pub static A: i32 = 42; pub static B: &i32 = &A; diff --git a/tests/incremental/static_refering_to_other_static2/issue.rs b/tests/incremental/static_refering_to_other_static2/issue.rs index 720bb1e222b4..8b6dc6d3e4b0 100644 --- a/tests/incremental/static_refering_to_other_static2/issue.rs +++ b/tests/incremental/static_refering_to_other_static2/issue.rs @@ -1,4 +1,4 @@ -// revisions:rpass1 rpass2 +//@ revisions:rpass1 rpass2 #[cfg(rpass1)] pub static A: i32 = 42; diff --git a/tests/incremental/static_refering_to_other_static3/issue.rs b/tests/incremental/static_refering_to_other_static3/issue.rs index 80999813dc5b..39e46745f8a2 100644 --- a/tests/incremental/static_refering_to_other_static3/issue.rs +++ b/tests/incremental/static_refering_to_other_static3/issue.rs @@ -1,4 +1,4 @@ -// revisions:rpass1 rpass2 +//@ revisions:rpass1 rpass2 #[cfg(rpass1)] pub static A: u8 = 42; diff --git a/tests/incremental/static_stable_hash/issue-49301.rs b/tests/incremental/static_stable_hash/issue-49301.rs index fdd05c72ca3c..68dc6d214c4e 100644 --- a/tests/incremental/static_stable_hash/issue-49301.rs +++ b/tests/incremental/static_stable_hash/issue-49301.rs @@ -1,6 +1,6 @@ // https://github.com/rust-lang/rust/issues/49081 -// revisions:rpass1 rpass2 +//@ revisions:rpass1 rpass2 #[cfg(rpass1)] pub static A: &str = "hello"; diff --git a/tests/incremental/string_constant.rs b/tests/incremental/string_constant.rs index 325b200e69b4..901e2f0c59b0 100644 --- a/tests/incremental/string_constant.rs +++ b/tests/incremental/string_constant.rs @@ -1,6 +1,6 @@ -// revisions: cfail1 cfail2 -// compile-flags: -Z query-dep-graph -Copt-level=0 -// build-pass (FIXME(62277): could be check-pass?) +//@ revisions: cfail1 cfail2 +//@ compile-flags: -Z query-dep-graph -Copt-level=0 +//@ build-pass (FIXME(62277): could be check-pass?) #![allow(warnings)] #![feature(rustc_attrs)] diff --git a/tests/incremental/struct_add_field.rs b/tests/incremental/struct_add_field.rs index 720854f16052..ad1b6fcfe282 100644 --- a/tests/incremental/struct_add_field.rs +++ b/tests/incremental/struct_add_field.rs @@ -1,8 +1,8 @@ // Test incremental compilation tracking where we change field names // in between revisions (hashing should be stable). -// revisions:rpass1 rpass2 -// compile-flags: -Z query-dep-graph +//@ revisions:rpass1 rpass2 +//@ compile-flags: -Z query-dep-graph #![feature(rustc_attrs)] diff --git a/tests/incremental/struct_change_field_name.rs b/tests/incremental/struct_change_field_name.rs index bd952bcc1c89..1519f8d477e5 100644 --- a/tests/incremental/struct_change_field_name.rs +++ b/tests/incremental/struct_change_field_name.rs @@ -1,9 +1,9 @@ // Test incremental compilation tracking where we change field names // in between revisions (hashing should be stable). -// revisions:rpass1 cfail2 -// compile-flags: -Z query-dep-graph -// [cfail2] compile-flags: -Z query-dep-graph -Z assert-incr-state=loaded +//@ revisions:rpass1 cfail2 +//@ compile-flags: -Z query-dep-graph +//@ [cfail2] compile-flags: -Z query-dep-graph -Z assert-incr-state=loaded #![feature(rustc_attrs)] #![allow(unused_variables)] diff --git a/tests/incremental/struct_change_field_type.rs b/tests/incremental/struct_change_field_type.rs index 37d2fba9901a..aed6c8884ac4 100644 --- a/tests/incremental/struct_change_field_type.rs +++ b/tests/incremental/struct_change_field_type.rs @@ -1,8 +1,8 @@ // Test incremental compilation tracking where we change nothing // in between revisions (hashing should be stable). -// revisions:rpass1 rpass2 -// compile-flags: -Z query-dep-graph +//@ revisions:rpass1 rpass2 +//@ compile-flags: -Z query-dep-graph #![feature(rustc_attrs)] diff --git a/tests/incremental/struct_change_field_type_cross_crate/b.rs b/tests/incremental/struct_change_field_type_cross_crate/b.rs index c78207bcb1a1..00bc3db0de86 100644 --- a/tests/incremental/struct_change_field_type_cross_crate/b.rs +++ b/tests/incremental/struct_change_field_type_cross_crate/b.rs @@ -1,6 +1,6 @@ -// aux-build:a.rs -// revisions:rpass1 rpass2 -// compile-flags: -Z query-dep-graph +//@ aux-build:a.rs +//@ revisions:rpass1 rpass2 +//@ compile-flags: -Z query-dep-graph #![feature(rustc_attrs)] diff --git a/tests/incremental/struct_change_nothing.rs b/tests/incremental/struct_change_nothing.rs index de30c818cfe0..3fc9a1c4de7f 100644 --- a/tests/incremental/struct_change_nothing.rs +++ b/tests/incremental/struct_change_nothing.rs @@ -1,8 +1,8 @@ // Test incremental compilation tracking where we change nothing // in between revisions (hashing should be stable). -// revisions:rpass1 rpass2 -// compile-flags: -Z query-dep-graph +//@ revisions:rpass1 rpass2 +//@ compile-flags: -Z query-dep-graph #![feature(rustc_attrs)] diff --git a/tests/incremental/struct_remove_field.rs b/tests/incremental/struct_remove_field.rs index b97a87e09629..488d7996b339 100644 --- a/tests/incremental/struct_remove_field.rs +++ b/tests/incremental/struct_remove_field.rs @@ -1,8 +1,8 @@ // Test incremental compilation tracking where we change field names // in between revisions (hashing should be stable). -// revisions:rpass1 rpass2 -// compile-flags: -Z query-dep-graph +//@ revisions:rpass1 rpass2 +//@ compile-flags: -Z query-dep-graph #![feature(rustc_attrs)] diff --git a/tests/incremental/thinlto/cgu_invalidated_via_import.rs b/tests/incremental/thinlto/cgu_invalidated_via_import.rs index a81b4f7e9d0d..04a5a06384a3 100644 --- a/tests/incremental/thinlto/cgu_invalidated_via_import.rs +++ b/tests/incremental/thinlto/cgu_invalidated_via_import.rs @@ -2,9 +2,9 @@ // via ThinLTO and that imported thing changes while the definition of the CGU // stays untouched. -// revisions: cfail1 cfail2 cfail3 -// compile-flags: -Z query-dep-graph -O -// build-pass +//@ revisions: cfail1 cfail2 cfail3 +//@ compile-flags: -Z query-dep-graph -O +//@ build-pass #![feature(rustc_attrs)] #![crate_type="rlib"] diff --git a/tests/incremental/thinlto/cgu_invalidated_when_export_added.rs b/tests/incremental/thinlto/cgu_invalidated_when_export_added.rs index 95f3b8ae4d98..a9b05467bf68 100644 --- a/tests/incremental/thinlto/cgu_invalidated_when_export_added.rs +++ b/tests/incremental/thinlto/cgu_invalidated_when_export_added.rs @@ -1,5 +1,5 @@ -// revisions: cfail1 cfail2 -// build-pass +//@ revisions: cfail1 cfail2 +//@ build-pass // rust-lang/rust#69798: // diff --git a/tests/incremental/thinlto/cgu_invalidated_when_export_removed.rs b/tests/incremental/thinlto/cgu_invalidated_when_export_removed.rs index e86ebd354b1a..3a78a290c7b2 100644 --- a/tests/incremental/thinlto/cgu_invalidated_when_export_removed.rs +++ b/tests/incremental/thinlto/cgu_invalidated_when_export_removed.rs @@ -1,5 +1,5 @@ -// revisions: cfail1 cfail2 -// build-pass +//@ revisions: cfail1 cfail2 +//@ build-pass // rust-lang/rust#69798: // diff --git a/tests/incremental/thinlto/cgu_invalidated_when_import_added.rs b/tests/incremental/thinlto/cgu_invalidated_when_import_added.rs index 9c17c8745f8c..4198c6c273ba 100644 --- a/tests/incremental/thinlto/cgu_invalidated_when_import_added.rs +++ b/tests/incremental/thinlto/cgu_invalidated_when_import_added.rs @@ -1,6 +1,6 @@ -// revisions: cfail1 cfail2 -// compile-flags: -O -Zhuman-readable-cgu-names -Cllvm-args=-import-instr-limit=10 -// build-pass +//@ revisions: cfail1 cfail2 +//@ compile-flags: -O -Zhuman-readable-cgu-names -Cllvm-args=-import-instr-limit=10 +//@ build-pass // rust-lang/rust#59535: // diff --git a/tests/incremental/thinlto/cgu_invalidated_when_import_removed.rs b/tests/incremental/thinlto/cgu_invalidated_when_import_removed.rs index fc53acf75cb8..4880d376fcc0 100644 --- a/tests/incremental/thinlto/cgu_invalidated_when_import_removed.rs +++ b/tests/incremental/thinlto/cgu_invalidated_when_import_removed.rs @@ -1,6 +1,6 @@ -// revisions: cfail1 cfail2 -// compile-flags: -O -Zhuman-readable-cgu-names -Cllvm-args=-import-instr-limit=10 -// build-pass +//@ revisions: cfail1 cfail2 +//@ compile-flags: -O -Zhuman-readable-cgu-names -Cllvm-args=-import-instr-limit=10 +//@ build-pass // rust-lang/rust#59535: // diff --git a/tests/incremental/thinlto/cgu_keeps_identical_fn.rs b/tests/incremental/thinlto/cgu_keeps_identical_fn.rs index 9e840f67ab27..5751759223b9 100644 --- a/tests/incremental/thinlto/cgu_keeps_identical_fn.rs +++ b/tests/incremental/thinlto/cgu_keeps_identical_fn.rs @@ -3,9 +3,9 @@ // ends up with any spans in its LLVM bitecode, so LLVM is able to skip // re-building any modules which import 'inlined_fn' -// revisions: cfail1 cfail2 cfail3 -// compile-flags: -Z query-dep-graph -O -// build-pass +//@ revisions: cfail1 cfail2 cfail3 +//@ compile-flags: -Z query-dep-graph -O +//@ build-pass #![feature(rustc_attrs)] #![crate_type = "rlib"] diff --git a/tests/incremental/thinlto/independent_cgus_dont_affect_each_other.rs b/tests/incremental/thinlto/independent_cgus_dont_affect_each_other.rs index 45eb13828743..e05508fa8e30 100644 --- a/tests/incremental/thinlto/independent_cgus_dont_affect_each_other.rs +++ b/tests/incremental/thinlto/independent_cgus_dont_affect_each_other.rs @@ -1,9 +1,9 @@ // This test checks that a change in a CGU does not invalidate an unrelated CGU // during incremental ThinLTO. -// revisions: cfail1 cfail2 cfail3 -// compile-flags: -Z query-dep-graph -O -// build-pass +//@ revisions: cfail1 cfail2 cfail3 +//@ compile-flags: -Z query-dep-graph -O +//@ build-pass #![feature(rustc_attrs)] #![crate_type="rlib"] diff --git a/tests/incremental/type_alias_cross_crate/auxiliary/a.rs b/tests/incremental/type_alias_cross_crate/auxiliary/a.rs index 61fe297d73dd..bb3703dd7faa 100644 --- a/tests/incremental/type_alias_cross_crate/auxiliary/a.rs +++ b/tests/incremental/type_alias_cross_crate/auxiliary/a.rs @@ -1,4 +1,4 @@ -// compile-flags: -Z query-dep-graph +//@ compile-flags: -Z query-dep-graph #![crate_type="rlib"] diff --git a/tests/incremental/type_alias_cross_crate/b.rs b/tests/incremental/type_alias_cross_crate/b.rs index f6c2526841c2..7187336ba5ee 100644 --- a/tests/incremental/type_alias_cross_crate/b.rs +++ b/tests/incremental/type_alias_cross_crate/b.rs @@ -1,6 +1,6 @@ -// aux-build:a.rs -// revisions:rpass1 rpass2 rpass3 -// compile-flags: -Z query-dep-graph +//@ aux-build:a.rs +//@ revisions:rpass1 rpass2 rpass3 +//@ compile-flags: -Z query-dep-graph #![feature(rustc_attrs)] diff --git a/tests/incremental/unchecked_dirty_clean.rs b/tests/incremental/unchecked_dirty_clean.rs index 3c8692a302dd..aab3333dff34 100644 --- a/tests/incremental/unchecked_dirty_clean.rs +++ b/tests/incremental/unchecked_dirty_clean.rs @@ -1,5 +1,5 @@ -// revisions: rpass1 cfail2 -// compile-flags: -Z query-dep-graph +//@ revisions: rpass1 cfail2 +//@ compile-flags: -Z query-dep-graph #![allow(warnings)] #![feature(rustc_attrs)] diff --git a/tests/incremental/warnings-reemitted.rs b/tests/incremental/warnings-reemitted.rs index 0e6b8823241c..c38c43d46df6 100644 --- a/tests/incremental/warnings-reemitted.rs +++ b/tests/incremental/warnings-reemitted.rs @@ -1,6 +1,6 @@ -// revisions: cfail1 cfail2 cfail3 -// compile-flags: -Coverflow-checks=on -// build-pass +//@ revisions: cfail1 cfail2 cfail3 +//@ compile-flags: -Coverflow-checks=on +//@ build-pass #![warn(arithmetic_overflow)] diff --git a/tests/mir-opt/array_index_is_temporary.rs b/tests/mir-opt/array_index_is_temporary.rs index f5edc68905b6..3e5d5d5dd27f 100644 --- a/tests/mir-opt/array_index_is_temporary.rs +++ b/tests/mir-opt/array_index_is_temporary.rs @@ -1,4 +1,4 @@ -// unit-test: SimplifyCfg-elaborate-drops +//@ unit-test: SimplifyCfg-elaborate-drops // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // Retagging (from Stacked Borrows) relies on the array index being a fresh // temporary, so that side-effects cannot change it. diff --git a/tests/mir-opt/asm_unwind_panic_abort.rs b/tests/mir-opt/asm_unwind_panic_abort.rs index a80dcb385b33..d6830e12287e 100644 --- a/tests/mir-opt/asm_unwind_panic_abort.rs +++ b/tests/mir-opt/asm_unwind_panic_abort.rs @@ -1,9 +1,9 @@ //! Tests that unwinding from an asm block is caught and forced to abort //! when `-C panic=abort`. -// only-x86_64 -// compile-flags: -C panic=abort -// no-prefer-dynamic +//@ only-x86_64 +//@ compile-flags: -C panic=abort +//@ no-prefer-dynamic #![feature(asm_unwind)] diff --git a/tests/mir-opt/async_closure_shims.rs b/tests/mir-opt/async_closure_shims.rs index 2c99a2dad37a..5e8753214001 100644 --- a/tests/mir-opt/async_closure_shims.rs +++ b/tests/mir-opt/async_closure_shims.rs @@ -1,4 +1,4 @@ -// edition:2021 +//@ edition:2021 // skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY diff --git a/tests/mir-opt/basic_assignment.rs b/tests/mir-opt/basic_assignment.rs index 30a410988885..0a23cddf620b 100644 --- a/tests/mir-opt/basic_assignment.rs +++ b/tests/mir-opt/basic_assignment.rs @@ -1,5 +1,5 @@ -// unit-test: ElaborateDrops -// needs-unwind +//@ unit-test: ElaborateDrops +//@ needs-unwind // this tests move up progration, which is not yet implemented // EMIT_MIR basic_assignment.main.ElaborateDrops.diff diff --git a/tests/mir-opt/box_expr.rs b/tests/mir-opt/box_expr.rs index 0421e232ae4a..8c016629770b 100644 --- a/tests/mir-opt/box_expr.rs +++ b/tests/mir-opt/box_expr.rs @@ -1,5 +1,5 @@ -// unit-test: ElaborateDrops -// needs-unwind +//@ unit-test: ElaborateDrops +//@ needs-unwind #![feature(rustc_attrs, stmt_expr_attributes)] diff --git a/tests/mir-opt/building/async_await.rs b/tests/mir-opt/building/async_await.rs index abdeafef6e44..6c44570d109c 100644 --- a/tests/mir-opt/building/async_await.rs +++ b/tests/mir-opt/building/async_await.rs @@ -3,8 +3,8 @@ // `get_context`, and that the MIR argument type for an async fn and all locals // related to `yield` are `&mut Context`, and its return type is `Poll`. -// edition:2018 -// compile-flags: -C panic=abort +//@ edition:2018 +//@ compile-flags: -C panic=abort #![crate_type = "lib"] diff --git a/tests/mir-opt/building/custom/operators.rs b/tests/mir-opt/building/custom/operators.rs index 91bdf2b9113c..bc72ed8dfe39 100644 --- a/tests/mir-opt/building/custom/operators.rs +++ b/tests/mir-opt/building/custom/operators.rs @@ -1,5 +1,5 @@ // skip-filecheck -// compile-flags: --crate-type=lib +//@ compile-flags: --crate-type=lib #![feature(custom_mir, core_intrinsics, inline_const)] use std::intrinsics::mir::*; diff --git a/tests/mir-opt/building/custom/unwind_action.rs b/tests/mir-opt/building/custom/unwind_action.rs index 0dfbf780f676..e3d54c721457 100644 --- a/tests/mir-opt/building/custom/unwind_action.rs +++ b/tests/mir-opt/building/custom/unwind_action.rs @@ -1,6 +1,6 @@ -// compile-flags: --crate-type=lib -// edition:2021 -// needs-unwind +//@ compile-flags: --crate-type=lib +//@ edition:2021 +//@ needs-unwind #![feature(custom_mir, core_intrinsics)] use core::intrinsics::mir::*; diff --git a/tests/mir-opt/building/custom/unwind_terminate.rs b/tests/mir-opt/building/custom/unwind_terminate.rs index efdf2ddb1d02..c5374fa7b690 100644 --- a/tests/mir-opt/building/custom/unwind_terminate.rs +++ b/tests/mir-opt/building/custom/unwind_terminate.rs @@ -1,5 +1,5 @@ -// compile-flags: --crate-type=lib -// edition:2021 +//@ compile-flags: --crate-type=lib +//@ edition:2021 #![feature(custom_mir, core_intrinsics)] use core::intrinsics::mir::*; diff --git a/tests/mir-opt/building/logical_or_in_conditional.rs b/tests/mir-opt/building/logical_or_in_conditional.rs index 00e666ed94f0..deb841f2b0d5 100644 --- a/tests/mir-opt/building/logical_or_in_conditional.rs +++ b/tests/mir-opt/building/logical_or_in_conditional.rs @@ -1,5 +1,5 @@ // skip-filecheck -// compile-flags: -Z validate-mir +//@ compile-flags: -Z validate-mir #![feature(let_chains)] struct Droppy(u8); impl Drop for Droppy { diff --git a/tests/mir-opt/building/shifts.rs b/tests/mir-opt/building/shifts.rs index c94a142d3362..849d7b55f3a0 100644 --- a/tests/mir-opt/building/shifts.rs +++ b/tests/mir-opt/building/shifts.rs @@ -1,5 +1,5 @@ // skip-filecheck -// compile-flags: -C debug-assertions=yes +//@ compile-flags: -C debug-assertions=yes // EMIT_MIR shifts.shift_signed.built.after.mir fn shift_signed(small: i8, big: u128, a: i8, b: i32, c: i128) -> ([i8; 3], [u128; 3]) { diff --git a/tests/mir-opt/building/while_storage.rs b/tests/mir-opt/building/while_storage.rs index b06c1639c3f3..83095316f005 100644 --- a/tests/mir-opt/building/while_storage.rs +++ b/tests/mir-opt/building/while_storage.rs @@ -1,7 +1,7 @@ // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // Test that we correctly generate StorageDead statements for while loop // conditions on all branches -// compile-flags: -Zmir-opt-level=0 +//@ compile-flags: -Zmir-opt-level=0 fn get_bool(c: bool) -> bool { c diff --git a/tests/mir-opt/byte_slice.rs b/tests/mir-opt/byte_slice.rs index 813d9ccfdc26..c064e2945fd2 100644 --- a/tests/mir-opt/byte_slice.rs +++ b/tests/mir-opt/byte_slice.rs @@ -1,5 +1,5 @@ // skip-filecheck -// compile-flags: -Z mir-opt-level=0 +//@ compile-flags: -Z mir-opt-level=0 // EMIT_MIR byte_slice.main.SimplifyCfg-elaborate-drops.after.mir fn main() { diff --git a/tests/mir-opt/const_allocation.rs b/tests/mir-opt/const_allocation.rs index 5b5fb524fdb3..038caaa0ae73 100644 --- a/tests/mir-opt/const_allocation.rs +++ b/tests/mir-opt/const_allocation.rs @@ -1,6 +1,6 @@ // skip-filecheck -// unit-test: GVN -// ignore-endian-big +//@ unit-test: GVN +//@ ignore-endian-big // EMIT_MIR_FOR_EACH_BIT_WIDTH static FOO: &[(Option, &[&str])] = &[(None, &[]), (None, &["foo", "bar"]), (Some(42), &["meh", "mop", "möp"])]; diff --git a/tests/mir-opt/const_allocation2.rs b/tests/mir-opt/const_allocation2.rs index 171592889d57..ba987c1c26b9 100644 --- a/tests/mir-opt/const_allocation2.rs +++ b/tests/mir-opt/const_allocation2.rs @@ -1,6 +1,6 @@ // skip-filecheck -// unit-test: GVN -// ignore-endian-big +//@ unit-test: GVN +//@ ignore-endian-big // EMIT_MIR_FOR_EACH_BIT_WIDTH // EMIT_MIR const_allocation2.main.GVN.after.mir fn main() { diff --git a/tests/mir-opt/const_allocation3.rs b/tests/mir-opt/const_allocation3.rs index 91a30f0587bf..86ffdef24aba 100644 --- a/tests/mir-opt/const_allocation3.rs +++ b/tests/mir-opt/const_allocation3.rs @@ -1,6 +1,6 @@ // skip-filecheck -// unit-test: GVN -// ignore-endian-big +//@ unit-test: GVN +//@ ignore-endian-big // EMIT_MIR_FOR_EACH_BIT_WIDTH // EMIT_MIR const_allocation3.main.GVN.after.mir fn main() { diff --git a/tests/mir-opt/const_debuginfo.rs b/tests/mir-opt/const_debuginfo.rs index db0c5dbb28fa..319bcf484111 100644 --- a/tests/mir-opt/const_debuginfo.rs +++ b/tests/mir-opt/const_debuginfo.rs @@ -1,5 +1,5 @@ -// unit-test: ConstDebugInfo -// compile-flags: -C overflow-checks=no -Zmir-enable-passes=+GVN +//@ unit-test: ConstDebugInfo +//@ compile-flags: -C overflow-checks=no -Zmir-enable-passes=+GVN struct Point { x: u32, diff --git a/tests/mir-opt/const_goto_const_eval_fail.rs b/tests/mir-opt/const_goto_const_eval_fail.rs index c0e8e144b152..fa0f5f614590 100644 --- a/tests/mir-opt/const_goto_const_eval_fail.rs +++ b/tests/mir-opt/const_goto_const_eval_fail.rs @@ -2,7 +2,7 @@ #![feature(min_const_generics)] #![crate_type = "lib"] -// compile-flags: -Zunsound-mir-opts +//@ compile-flags: -Zunsound-mir-opts // If const eval fails, then don't crash // EMIT_MIR const_goto_const_eval_fail.f.JumpThreading.diff diff --git a/tests/mir-opt/const_promotion_extern_static.rs b/tests/mir-opt/const_promotion_extern_static.rs index edc3a522338c..077e74e91f43 100644 --- a/tests/mir-opt/const_promotion_extern_static.rs +++ b/tests/mir-opt/const_promotion_extern_static.rs @@ -1,5 +1,5 @@ // skip-filecheck -// ignore-endian-big +//@ ignore-endian-big extern "C" { static X: i32; } diff --git a/tests/mir-opt/const_prop/address_of_pair.rs b/tests/mir-opt/const_prop/address_of_pair.rs index 1ab8a6028233..c6bd57669903 100644 --- a/tests/mir-opt/const_prop/address_of_pair.rs +++ b/tests/mir-opt/const_prop/address_of_pair.rs @@ -1,4 +1,4 @@ -// unit-test: GVN +//@ unit-test: GVN // EMIT_MIR address_of_pair.fn0.GVN.diff pub fn fn0() -> bool { diff --git a/tests/mir-opt/const_prop/aggregate.rs b/tests/mir-opt/const_prop/aggregate.rs index 3dd37b5910ef..2db477077728 100644 --- a/tests/mir-opt/const_prop/aggregate.rs +++ b/tests/mir-opt/const_prop/aggregate.rs @@ -1,6 +1,6 @@ // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// unit-test: GVN -// compile-flags: -O +//@ unit-test: GVN +//@ compile-flags: -O // EMIT_MIR aggregate.main.GVN.diff fn main() { diff --git a/tests/mir-opt/const_prop/array_index.rs b/tests/mir-opt/const_prop/array_index.rs index 2ae5087751f2..2a9ca5f95e65 100644 --- a/tests/mir-opt/const_prop/array_index.rs +++ b/tests/mir-opt/const_prop/array_index.rs @@ -1,4 +1,4 @@ -// unit-test: GVN +//@ unit-test: GVN // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // EMIT_MIR_FOR_EACH_BIT_WIDTH diff --git a/tests/mir-opt/const_prop/bad_op_div_by_zero.rs b/tests/mir-opt/const_prop/bad_op_div_by_zero.rs index 2ba53a80c43d..c411d3b59ab2 100644 --- a/tests/mir-opt/const_prop/bad_op_div_by_zero.rs +++ b/tests/mir-opt/const_prop/bad_op_div_by_zero.rs @@ -1,4 +1,4 @@ -// unit-test: GVN +//@ unit-test: GVN // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // EMIT_MIR bad_op_div_by_zero.main.GVN.diff diff --git a/tests/mir-opt/const_prop/bad_op_mod_by_zero.rs b/tests/mir-opt/const_prop/bad_op_mod_by_zero.rs index 9ab57750de0b..aa09c1639b35 100644 --- a/tests/mir-opt/const_prop/bad_op_mod_by_zero.rs +++ b/tests/mir-opt/const_prop/bad_op_mod_by_zero.rs @@ -1,4 +1,4 @@ -// unit-test: GVN +//@ unit-test: GVN // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // EMIT_MIR bad_op_mod_by_zero.main.GVN.diff diff --git a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs index c6d63f0bf184..25d513e21327 100644 --- a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs +++ b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs @@ -1,4 +1,4 @@ -// unit-test: GVN +//@ unit-test: GVN // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // EMIT_MIR_FOR_EACH_BIT_WIDTH diff --git a/tests/mir-opt/const_prop/boolean_identities.rs b/tests/mir-opt/const_prop/boolean_identities.rs index 3b7ea25ad46e..cbc106aa41ca 100644 --- a/tests/mir-opt/const_prop/boolean_identities.rs +++ b/tests/mir-opt/const_prop/boolean_identities.rs @@ -1,4 +1,4 @@ -// unit-test: GVN +//@ unit-test: GVN // EMIT_MIR boolean_identities.test.GVN.diff pub fn test(x: bool, y: bool) -> bool { diff --git a/tests/mir-opt/const_prop/boxes.rs b/tests/mir-opt/const_prop/boxes.rs index d2d61f86d5eb..859491cf3614 100644 --- a/tests/mir-opt/const_prop/boxes.rs +++ b/tests/mir-opt/const_prop/boxes.rs @@ -1,5 +1,5 @@ -// unit-test: GVN -// compile-flags: -O +//@ unit-test: GVN +//@ compile-flags: -O // EMIT_MIR_FOR_EACH_PANIC_STRATEGY #![feature(rustc_attrs, stmt_expr_attributes)] diff --git a/tests/mir-opt/const_prop/cast.rs b/tests/mir-opt/const_prop/cast.rs index 00a8bcd1adbe..ad95515b41b5 100644 --- a/tests/mir-opt/const_prop/cast.rs +++ b/tests/mir-opt/const_prop/cast.rs @@ -1,4 +1,4 @@ -// unit-test: GVN +//@ unit-test: GVN // EMIT_MIR cast.main.GVN.diff fn main() { diff --git a/tests/mir-opt/const_prop/checked_add.rs b/tests/mir-opt/const_prop/checked_add.rs index 0abcb5dd3d42..6f43e6abdc1e 100644 --- a/tests/mir-opt/const_prop/checked_add.rs +++ b/tests/mir-opt/const_prop/checked_add.rs @@ -1,6 +1,6 @@ // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// unit-test: GVN -// compile-flags: -C overflow-checks=on +//@ unit-test: GVN +//@ compile-flags: -C overflow-checks=on // EMIT_MIR checked_add.main.GVN.diff fn main() { diff --git a/tests/mir-opt/const_prop/control_flow_simplification.rs b/tests/mir-opt/const_prop/control_flow_simplification.rs index 3cb9a4911a9d..eb336827dc29 100644 --- a/tests/mir-opt/const_prop/control_flow_simplification.rs +++ b/tests/mir-opt/const_prop/control_flow_simplification.rs @@ -1,7 +1,7 @@ // skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// unit-test: GVN -// compile-flags: -Zmir-opt-level=1 +//@ unit-test: GVN +//@ compile-flags: -Zmir-opt-level=1 trait NeedsDrop: Sized { const NEEDS: bool = std::mem::needs_drop::(); diff --git a/tests/mir-opt/const_prop/discriminant.rs b/tests/mir-opt/const_prop/discriminant.rs index 53874e9528ef..51542afa4bc3 100644 --- a/tests/mir-opt/const_prop/discriminant.rs +++ b/tests/mir-opt/const_prop/discriminant.rs @@ -1,4 +1,4 @@ -// unit-test: GVN +//@ unit-test: GVN // FIXME(wesleywiser): Ideally, we could const-prop away all of this and just be left with // `let x = 42` but that doesn't work because const-prop doesn't support `Operand::Indirect` diff --git a/tests/mir-opt/const_prop/indirect.rs b/tests/mir-opt/const_prop/indirect.rs index d089418e8984..5c469c5d844a 100644 --- a/tests/mir-opt/const_prop/indirect.rs +++ b/tests/mir-opt/const_prop/indirect.rs @@ -1,6 +1,6 @@ // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// unit-test: GVN -// compile-flags: -C overflow-checks=on +//@ unit-test: GVN +//@ compile-flags: -C overflow-checks=on // EMIT_MIR indirect.main.GVN.diff fn main() { diff --git a/tests/mir-opt/const_prop/indirect_mutation.rs b/tests/mir-opt/const_prop/indirect_mutation.rs index a4236060c814..b2a9d5db367a 100644 --- a/tests/mir-opt/const_prop/indirect_mutation.rs +++ b/tests/mir-opt/const_prop/indirect_mutation.rs @@ -1,4 +1,4 @@ -// unit-test: GVN +//@ unit-test: GVN // Check that we do not propagate past an indirect mutation. #![feature(raw_ref_op)] diff --git a/tests/mir-opt/const_prop/inherit_overflow.rs b/tests/mir-opt/const_prop/inherit_overflow.rs index c5b1dbe37a95..e71a05ce760b 100644 --- a/tests/mir-opt/const_prop/inherit_overflow.rs +++ b/tests/mir-opt/const_prop/inherit_overflow.rs @@ -1,6 +1,6 @@ // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// unit-test: GVN -// compile-flags: -Zmir-enable-passes=+Inline +//@ unit-test: GVN +//@ compile-flags: -Zmir-enable-passes=+Inline // After inlining, this will contain a `CheckedBinaryOp`. // Propagating the overflow is ok as codegen will just skip emitting the panic. diff --git a/tests/mir-opt/const_prop/invalid_constant.rs b/tests/mir-opt/const_prop/invalid_constant.rs index 142f148d064b..1df82f2ee79d 100644 --- a/tests/mir-opt/const_prop/invalid_constant.rs +++ b/tests/mir-opt/const_prop/invalid_constant.rs @@ -1,6 +1,6 @@ // skip-filecheck -// unit-test: GVN -// compile-flags: -Zmir-enable-passes=+RemoveZsts +//@ unit-test: GVN +//@ compile-flags: -Zmir-enable-passes=+RemoveZsts // Verify that we can pretty print invalid constants. #![feature(adt_const_params)] diff --git a/tests/mir-opt/const_prop/issue_66971.rs b/tests/mir-opt/const_prop/issue_66971.rs index 30f8ea1606a7..30a9d62d499e 100644 --- a/tests/mir-opt/const_prop/issue_66971.rs +++ b/tests/mir-opt/const_prop/issue_66971.rs @@ -1,5 +1,5 @@ // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// unit-test: GVN +//@ unit-test: GVN // Due to a bug in propagating scalar pairs the assertion below used to fail. In the expected // outputs below, after GVN this is how _2 would look like with the bug: diff --git a/tests/mir-opt/const_prop/issue_67019.rs b/tests/mir-opt/const_prop/issue_67019.rs index e589ed4edccf..bf788b924ce1 100644 --- a/tests/mir-opt/const_prop/issue_67019.rs +++ b/tests/mir-opt/const_prop/issue_67019.rs @@ -1,5 +1,5 @@ // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// unit-test: GVN +//@ unit-test: GVN // This used to ICE in const-prop diff --git a/tests/mir-opt/const_prop/large_array_index.rs b/tests/mir-opt/const_prop/large_array_index.rs index 12507b9434f4..1cefc85676ff 100644 --- a/tests/mir-opt/const_prop/large_array_index.rs +++ b/tests/mir-opt/const_prop/large_array_index.rs @@ -1,5 +1,5 @@ // skip-filecheck -// unit-test: GVN +//@ unit-test: GVN // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // EMIT_MIR_FOR_EACH_BIT_WIDTH diff --git a/tests/mir-opt/const_prop/mult_by_zero.rs b/tests/mir-opt/const_prop/mult_by_zero.rs index b8afaeef43fd..d79f3e851615 100644 --- a/tests/mir-opt/const_prop/mult_by_zero.rs +++ b/tests/mir-opt/const_prop/mult_by_zero.rs @@ -1,4 +1,4 @@ -// unit-test: GVN +//@ unit-test: GVN // EMIT_MIR mult_by_zero.test.GVN.diff fn test(x: i32) -> i32 { diff --git a/tests/mir-opt/const_prop/mutable_variable.rs b/tests/mir-opt/const_prop/mutable_variable.rs index 194f39f826eb..4445bd224802 100644 --- a/tests/mir-opt/const_prop/mutable_variable.rs +++ b/tests/mir-opt/const_prop/mutable_variable.rs @@ -1,4 +1,4 @@ -// unit-test: GVN +//@ unit-test: GVN // EMIT_MIR mutable_variable.main.GVN.diff fn main() { diff --git a/tests/mir-opt/const_prop/mutable_variable_aggregate.rs b/tests/mir-opt/const_prop/mutable_variable_aggregate.rs index b59132007aa2..c2b2731b2a6c 100644 --- a/tests/mir-opt/const_prop/mutable_variable_aggregate.rs +++ b/tests/mir-opt/const_prop/mutable_variable_aggregate.rs @@ -1,4 +1,4 @@ -// unit-test: GVN +//@ unit-test: GVN // EMIT_MIR mutable_variable_aggregate.main.GVN.diff fn main() { diff --git a/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.rs b/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.rs index 1867f7300bd2..c9f09f878fe5 100644 --- a/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.rs +++ b/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.rs @@ -1,4 +1,4 @@ -// unit-test: GVN +//@ unit-test: GVN // EMIT_MIR mutable_variable_aggregate_mut_ref.main.GVN.diff fn main() { diff --git a/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.rs b/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.rs index d0a44d8f4a01..5b7804b11647 100644 --- a/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.rs +++ b/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.rs @@ -1,5 +1,5 @@ // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// unit-test: GVN +//@ unit-test: GVN // EMIT_MIR mutable_variable_aggregate_partial_read.main.GVN.diff fn main() { diff --git a/tests/mir-opt/const_prop/mutable_variable_no_prop.rs b/tests/mir-opt/const_prop/mutable_variable_no_prop.rs index 180e194928e5..9ea2e78d8b20 100644 --- a/tests/mir-opt/const_prop/mutable_variable_no_prop.rs +++ b/tests/mir-opt/const_prop/mutable_variable_no_prop.rs @@ -1,4 +1,4 @@ -// unit-test: GVN +//@ unit-test: GVN // Verify that we do not propagate the contents of this mutable static. static mut STATIC: u32 = 0x42424242; diff --git a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.rs b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.rs index 585363572a51..39ac1fa3c946 100644 --- a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.rs +++ b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.rs @@ -1,5 +1,5 @@ // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// unit-test: GVN +//@ unit-test: GVN // EMIT_MIR mutable_variable_unprop_assign.main.GVN.diff fn main() { diff --git a/tests/mir-opt/const_prop/offset_of.rs b/tests/mir-opt/const_prop/offset_of.rs index f15d15bfcb26..7d258f2e3628 100644 --- a/tests/mir-opt/const_prop/offset_of.rs +++ b/tests/mir-opt/const_prop/offset_of.rs @@ -1,5 +1,5 @@ // skip-filecheck -// unit-test: GVN +//@ unit-test: GVN // EMIT_MIR_FOR_EACH_PANIC_STRATEGY #![feature(offset_of_enum, offset_of_nested)] diff --git a/tests/mir-opt/const_prop/overwrite_with_const_with_params.rs b/tests/mir-opt/const_prop/overwrite_with_const_with_params.rs index 2a3499bf2fe4..836f837d15ff 100644 --- a/tests/mir-opt/const_prop/overwrite_with_const_with_params.rs +++ b/tests/mir-opt/const_prop/overwrite_with_const_with_params.rs @@ -1,5 +1,5 @@ -// unit-test: GVN -// compile-flags: -O +//@ unit-test: GVN +//@ compile-flags: -O // Regression test for https://github.com/rust-lang/rust/issues/118328 diff --git a/tests/mir-opt/const_prop/pointer_expose_address.rs b/tests/mir-opt/const_prop/pointer_expose_address.rs index 8944232f71ee..4d0dfecd324c 100644 --- a/tests/mir-opt/const_prop/pointer_expose_address.rs +++ b/tests/mir-opt/const_prop/pointer_expose_address.rs @@ -1,5 +1,5 @@ // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// unit-test: GVN +//@ unit-test: GVN #[inline(never)] fn read(_: usize) { } diff --git a/tests/mir-opt/const_prop/read_immutable_static.rs b/tests/mir-opt/const_prop/read_immutable_static.rs index a3d8fee65d74..ec2dbf6485a8 100644 --- a/tests/mir-opt/const_prop/read_immutable_static.rs +++ b/tests/mir-opt/const_prop/read_immutable_static.rs @@ -1,4 +1,4 @@ -// unit-test: GVN +//@ unit-test: GVN static FOO: u8 = 2; diff --git a/tests/mir-opt/const_prop/ref_deref.rs b/tests/mir-opt/const_prop/ref_deref.rs index 67de110d8bb5..20c1fba52099 100644 --- a/tests/mir-opt/const_prop/ref_deref.rs +++ b/tests/mir-opt/const_prop/ref_deref.rs @@ -1,4 +1,4 @@ -// unit-test: GVN +//@ unit-test: GVN // EMIT_MIR ref_deref.main.GVN.diff fn main() { diff --git a/tests/mir-opt/const_prop/ref_deref_project.rs b/tests/mir-opt/const_prop/ref_deref_project.rs index 0f706b91b386..59e7f1a50b80 100644 --- a/tests/mir-opt/const_prop/ref_deref_project.rs +++ b/tests/mir-opt/const_prop/ref_deref_project.rs @@ -1,5 +1,5 @@ // This does not currently propagate (#67862) -// unit-test: GVN +//@ unit-test: GVN // EMIT_MIR ref_deref_project.main.GVN.diff fn main() { diff --git a/tests/mir-opt/const_prop/reify_fn_ptr.rs b/tests/mir-opt/const_prop/reify_fn_ptr.rs index 96077d5b773b..ad73b0842195 100644 --- a/tests/mir-opt/const_prop/reify_fn_ptr.rs +++ b/tests/mir-opt/const_prop/reify_fn_ptr.rs @@ -1,4 +1,4 @@ -// unit-test: GVN +//@ unit-test: GVN // EMIT_MIR reify_fn_ptr.main.GVN.diff fn main() { diff --git a/tests/mir-opt/const_prop/repeat.rs b/tests/mir-opt/const_prop/repeat.rs index 2c8717d25bb5..d881462b877e 100644 --- a/tests/mir-opt/const_prop/repeat.rs +++ b/tests/mir-opt/const_prop/repeat.rs @@ -1,4 +1,4 @@ -// unit-test: GVN +//@ unit-test: GVN // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // EMIT_MIR_FOR_EACH_BIT_WIDTH diff --git a/tests/mir-opt/const_prop/return_place.rs b/tests/mir-opt/const_prop/return_place.rs index c207bcbdd620..fea28c93dc3d 100644 --- a/tests/mir-opt/const_prop/return_place.rs +++ b/tests/mir-opt/const_prop/return_place.rs @@ -1,6 +1,6 @@ -// unit-test: GVN +//@ unit-test: GVN // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// compile-flags: -C overflow-checks=on +//@ compile-flags: -C overflow-checks=on // EMIT_MIR return_place.add.GVN.diff // EMIT_MIR return_place.add.PreCodegen.before.mir diff --git a/tests/mir-opt/const_prop/scalar_literal_propagation.rs b/tests/mir-opt/const_prop/scalar_literal_propagation.rs index 70d0eb535918..e07774683506 100644 --- a/tests/mir-opt/const_prop/scalar_literal_propagation.rs +++ b/tests/mir-opt/const_prop/scalar_literal_propagation.rs @@ -1,4 +1,4 @@ -// unit-test: GVN +//@ unit-test: GVN // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // EMIT_MIR scalar_literal_propagation.main.GVN.diff diff --git a/tests/mir-opt/const_prop/slice_len.rs b/tests/mir-opt/const_prop/slice_len.rs index a4973c099cd9..4a48f92ec2b4 100644 --- a/tests/mir-opt/const_prop/slice_len.rs +++ b/tests/mir-opt/const_prop/slice_len.rs @@ -1,5 +1,5 @@ -// unit-test: GVN -// compile-flags: -Zmir-enable-passes=+InstSimplify +//@ unit-test: GVN +//@ compile-flags: -Zmir-enable-passes=+InstSimplify // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // EMIT_MIR_FOR_EACH_BIT_WIDTH diff --git a/tests/mir-opt/const_prop/switch_int.rs b/tests/mir-opt/const_prop/switch_int.rs index c81b574d1500..a176bf144389 100644 --- a/tests/mir-opt/const_prop/switch_int.rs +++ b/tests/mir-opt/const_prop/switch_int.rs @@ -1,5 +1,5 @@ -// unit-test: GVN -// compile-flags: -Zmir-enable-passes=+SimplifyConstCondition-after-const-prop +//@ unit-test: GVN +//@ compile-flags: -Zmir-enable-passes=+SimplifyConstCondition-after-const-prop // EMIT_MIR_FOR_EACH_PANIC_STRATEGY #[inline(never)] diff --git a/tests/mir-opt/const_prop/transmute.rs b/tests/mir-opt/const_prop/transmute.rs index 6ff0ba422f42..5f2d76711599 100644 --- a/tests/mir-opt/const_prop/transmute.rs +++ b/tests/mir-opt/const_prop/transmute.rs @@ -1,6 +1,6 @@ -// unit-test: GVN -// compile-flags: -O --crate-type=lib -// ignore-endian-big +//@ unit-test: GVN +//@ compile-flags: -O --crate-type=lib +//@ ignore-endian-big // EMIT_MIR_FOR_EACH_BIT_WIDTH use std::mem::transmute; diff --git a/tests/mir-opt/const_prop/tuple_literal_propagation.rs b/tests/mir-opt/const_prop/tuple_literal_propagation.rs index 6803612f0a5c..5992bb151d3e 100644 --- a/tests/mir-opt/const_prop/tuple_literal_propagation.rs +++ b/tests/mir-opt/const_prop/tuple_literal_propagation.rs @@ -1,4 +1,4 @@ -// unit-test: GVN +//@ unit-test: GVN // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // EMIT_MIR tuple_literal_propagation.main.GVN.diff diff --git a/tests/mir-opt/const_prop/while_let_loops.rs b/tests/mir-opt/const_prop/while_let_loops.rs index d6527552bb04..6a421da0807d 100644 --- a/tests/mir-opt/const_prop/while_let_loops.rs +++ b/tests/mir-opt/const_prop/while_let_loops.rs @@ -1,4 +1,4 @@ -// unit-test: GVN +//@ unit-test: GVN // EMIT_MIR while_let_loops.change_loop_body.GVN.diff pub fn change_loop_body() { diff --git a/tests/mir-opt/copy-prop/borrowed_local.rs b/tests/mir-opt/copy-prop/borrowed_local.rs index af40f5bce8b2..24b8e45532cf 100644 --- a/tests/mir-opt/copy-prop/borrowed_local.rs +++ b/tests/mir-opt/copy-prop/borrowed_local.rs @@ -1,6 +1,6 @@ // skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// unit-test: CopyProp +//@ unit-test: CopyProp #![feature(custom_mir, core_intrinsics)] #![allow(unused_assignments)] diff --git a/tests/mir-opt/copy-prop/branch.rs b/tests/mir-opt/copy-prop/branch.rs index 2785089579ff..0944bb3d59aa 100644 --- a/tests/mir-opt/copy-prop/branch.rs +++ b/tests/mir-opt/copy-prop/branch.rs @@ -1,7 +1,7 @@ // skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY //! Tests that we bail out when there are multiple assignments to the same local. -// unit-test: CopyProp +//@ unit-test: CopyProp fn val() -> i32 { 1 } diff --git a/tests/mir-opt/copy-prop/calls.rs b/tests/mir-opt/copy-prop/calls.rs index a6b5d511805c..7d123e64950c 100644 --- a/tests/mir-opt/copy-prop/calls.rs +++ b/tests/mir-opt/copy-prop/calls.rs @@ -1,7 +1,7 @@ // skip-filecheck // Check that CopyProp does propagate return values of call terminators. -// unit-test: CopyProp -// needs-unwind +//@ unit-test: CopyProp +//@ needs-unwind #![feature(custom_mir, core_intrinsics)] use std::intrinsics::mir::*; diff --git a/tests/mir-opt/copy-prop/copy_propagation_arg.rs b/tests/mir-opt/copy-prop/copy_propagation_arg.rs index 83bbefe09ed5..3516d8f7f62f 100644 --- a/tests/mir-opt/copy-prop/copy_propagation_arg.rs +++ b/tests/mir-opt/copy-prop/copy_propagation_arg.rs @@ -2,7 +2,7 @@ // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // Check that CopyProp does not propagate an assignment to a function argument // (doing so can break usages of the original argument value) -// unit-test: CopyProp +//@ unit-test: CopyProp fn dummy(x: u8) -> u8 { x } diff --git a/tests/mir-opt/copy-prop/custom_move_arg.rs b/tests/mir-opt/copy-prop/custom_move_arg.rs index 1ee294fcfd91..3577ed2a4a18 100644 --- a/tests/mir-opt/copy-prop/custom_move_arg.rs +++ b/tests/mir-opt/copy-prop/custom_move_arg.rs @@ -1,6 +1,6 @@ // skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// unit-test: CopyProp +//@ unit-test: CopyProp #![feature(custom_mir, core_intrinsics)] #![allow(unused_assignments)] diff --git a/tests/mir-opt/copy-prop/cycle.rs b/tests/mir-opt/copy-prop/cycle.rs index 58e049fde4b5..ed97e86f83ac 100644 --- a/tests/mir-opt/copy-prop/cycle.rs +++ b/tests/mir-opt/copy-prop/cycle.rs @@ -1,7 +1,7 @@ // skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY //! Tests that cyclic assignments don't hang CopyProp, and result in reasonable code. -// unit-test: CopyProp +//@ unit-test: CopyProp fn val() -> i32 { 1 } diff --git a/tests/mir-opt/copy-prop/dead_stores_79191.rs b/tests/mir-opt/copy-prop/dead_stores_79191.rs index 81306ab613a0..f6e0eac6c2c9 100644 --- a/tests/mir-opt/copy-prop/dead_stores_79191.rs +++ b/tests/mir-opt/copy-prop/dead_stores_79191.rs @@ -1,6 +1,6 @@ // skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// unit-test: CopyProp +//@ unit-test: CopyProp fn id(x: T) -> T { x diff --git a/tests/mir-opt/copy-prop/dead_stores_better.rs b/tests/mir-opt/copy-prop/dead_stores_better.rs index 7addf6af23bd..fdf42876909a 100644 --- a/tests/mir-opt/copy-prop/dead_stores_better.rs +++ b/tests/mir-opt/copy-prop/dead_stores_better.rs @@ -3,8 +3,8 @@ // This is a copy of the `dead_stores_79191` test, except that we turn on DSE. This demonstrates // that that pass enables this one to do more optimizations. -// unit-test: CopyProp -// compile-flags: -Zmir-enable-passes=+DeadStoreElimination +//@ unit-test: CopyProp +//@ compile-flags: -Zmir-enable-passes=+DeadStoreElimination fn id(x: T) -> T { x diff --git a/tests/mir-opt/copy-prop/issue_107511.rs b/tests/mir-opt/copy-prop/issue_107511.rs index 53fd9366276b..d9bd08b1bcf1 100644 --- a/tests/mir-opt/copy-prop/issue_107511.rs +++ b/tests/mir-opt/copy-prop/issue_107511.rs @@ -1,6 +1,6 @@ // skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// unit-test: CopyProp +//@ unit-test: CopyProp // EMIT_MIR issue_107511.main.CopyProp.diff fn main() { diff --git a/tests/mir-opt/copy-prop/move_arg.rs b/tests/mir-opt/copy-prop/move_arg.rs index fc2932a65dd6..85ced0f6c0d5 100644 --- a/tests/mir-opt/copy-prop/move_arg.rs +++ b/tests/mir-opt/copy-prop/move_arg.rs @@ -1,7 +1,7 @@ // skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // Test that we do not move multiple times from the same local. -// unit-test: CopyProp +//@ unit-test: CopyProp // EMIT_MIR move_arg.f.CopyProp.diff pub fn f(a: T) { diff --git a/tests/mir-opt/copy-prop/move_projection.rs b/tests/mir-opt/copy-prop/move_projection.rs index f31e82c1f030..d68ffad78bcb 100644 --- a/tests/mir-opt/copy-prop/move_projection.rs +++ b/tests/mir-opt/copy-prop/move_projection.rs @@ -1,6 +1,6 @@ // skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// unit-test: CopyProp +//@ unit-test: CopyProp #![feature(custom_mir, core_intrinsics)] #![allow(unused_assignments)] diff --git a/tests/mir-opt/copy-prop/mutate_through_pointer.rs b/tests/mir-opt/copy-prop/mutate_through_pointer.rs index e36a10846a62..610f5401084a 100644 --- a/tests/mir-opt/copy-prop/mutate_through_pointer.rs +++ b/tests/mir-opt/copy-prop/mutate_through_pointer.rs @@ -1,5 +1,5 @@ // skip-filecheck -// unit-test: CopyProp +//@ unit-test: CopyProp // // This attempts to mutate `a` via a pointer derived from `addr_of!(a)`. That is UB // according to Miri. However, the decision to make this UB - and to allow diff --git a/tests/mir-opt/copy-prop/non_dominate.rs b/tests/mir-opt/copy-prop/non_dominate.rs index c26ac444e5c6..d8b42b7f96e5 100644 --- a/tests/mir-opt/copy-prop/non_dominate.rs +++ b/tests/mir-opt/copy-prop/non_dominate.rs @@ -1,5 +1,5 @@ // skip-filecheck -// unit-test: CopyProp +//@ unit-test: CopyProp #![feature(custom_mir, core_intrinsics)] #![allow(unused_assignments)] diff --git a/tests/mir-opt/copy-prop/partial_init.rs b/tests/mir-opt/copy-prop/partial_init.rs index 44cc203de0d4..46390556418d 100644 --- a/tests/mir-opt/copy-prop/partial_init.rs +++ b/tests/mir-opt/copy-prop/partial_init.rs @@ -1,5 +1,5 @@ // skip-filecheck -// unit-test: CopyProp +//@ unit-test: CopyProp // Verify that we do not ICE on partial initializations. #![feature(custom_mir, core_intrinsics)] diff --git a/tests/mir-opt/copy-prop/reborrow.rs b/tests/mir-opt/copy-prop/reborrow.rs index 57c4fb8ade9e..7d02fb328eef 100644 --- a/tests/mir-opt/copy-prop/reborrow.rs +++ b/tests/mir-opt/copy-prop/reborrow.rs @@ -1,7 +1,7 @@ // skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // Check that CopyProp considers reborrows as not mutating the pointer. -// unit-test: CopyProp +//@ unit-test: CopyProp #![feature(raw_ref_op)] diff --git a/tests/mir-opt/coroutine_tiny.rs b/tests/mir-opt/coroutine_tiny.rs index 0fd785b28f87..9728425f2326 100644 --- a/tests/mir-opt/coroutine_tiny.rs +++ b/tests/mir-opt/coroutine_tiny.rs @@ -2,8 +2,8 @@ //! Tests that coroutines that cannot return or unwind don't have unnecessary //! panic branches. -// compile-flags: -C panic=abort -// no-prefer-dynamic +//@ compile-flags: -C panic=abort +//@ no-prefer-dynamic #![feature(coroutines, coroutine_trait)] diff --git a/tests/mir-opt/dataflow-const-prop/array_index.rs b/tests/mir-opt/dataflow-const-prop/array_index.rs index 8f0cc489a5bb..df8baf77add4 100644 --- a/tests/mir-opt/dataflow-const-prop/array_index.rs +++ b/tests/mir-opt/dataflow-const-prop/array_index.rs @@ -1,5 +1,5 @@ // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// unit-test: DataflowConstProp +//@ unit-test: DataflowConstProp // EMIT_MIR_FOR_EACH_BIT_WIDTH // EMIT_MIR array_index.main.DataflowConstProp.diff diff --git a/tests/mir-opt/dataflow-const-prop/boolean_identities.rs b/tests/mir-opt/dataflow-const-prop/boolean_identities.rs index c9be1d65b030..e2b7dbc096b2 100644 --- a/tests/mir-opt/dataflow-const-prop/boolean_identities.rs +++ b/tests/mir-opt/dataflow-const-prop/boolean_identities.rs @@ -1,4 +1,4 @@ -// unit-test: DataflowConstProp +//@ unit-test: DataflowConstProp // EMIT_MIR boolean_identities.test.DataflowConstProp.diff diff --git a/tests/mir-opt/dataflow-const-prop/cast.rs b/tests/mir-opt/dataflow-const-prop/cast.rs index 298ff4980393..bd6141eedd16 100644 --- a/tests/mir-opt/dataflow-const-prop/cast.rs +++ b/tests/mir-opt/dataflow-const-prop/cast.rs @@ -1,4 +1,4 @@ -// unit-test: DataflowConstProp +//@ unit-test: DataflowConstProp // EMIT_MIR cast.main.DataflowConstProp.diff diff --git a/tests/mir-opt/dataflow-const-prop/checked.rs b/tests/mir-opt/dataflow-const-prop/checked.rs index 30b0afa8334d..2c419bc98548 100644 --- a/tests/mir-opt/dataflow-const-prop/checked.rs +++ b/tests/mir-opt/dataflow-const-prop/checked.rs @@ -1,5 +1,5 @@ -// unit-test: DataflowConstProp -// compile-flags: -Coverflow-checks=on +//@ unit-test: DataflowConstProp +//@ compile-flags: -Coverflow-checks=on // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // EMIT_MIR checked.main.DataflowConstProp.diff diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.rs b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.rs index 6c1aafcfa5df..9986d903501b 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.rs +++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.rs @@ -1,6 +1,6 @@ -// unit-test: DataflowConstProp -// compile-flags: -Zmir-enable-passes=+GVN,+Inline -// ignore-debug assertions change the output MIR +//@ unit-test: DataflowConstProp +//@ compile-flags: -Zmir-enable-passes=+GVN,+Inline +//@ ignore-debug assertions change the output MIR // EMIT_MIR_FOR_EACH_BIT_WIDTH // EMIT_MIR_FOR_EACH_PANIC_STRATEGY diff --git a/tests/mir-opt/dataflow-const-prop/enum.rs b/tests/mir-opt/dataflow-const-prop/enum.rs index 34792cb9f018..b00f2912519c 100644 --- a/tests/mir-opt/dataflow-const-prop/enum.rs +++ b/tests/mir-opt/dataflow-const-prop/enum.rs @@ -1,4 +1,4 @@ -// unit-test: DataflowConstProp +//@ unit-test: DataflowConstProp // EMIT_MIR_FOR_EACH_BIT_WIDTH #![feature(custom_mir, core_intrinsics, rustc_attrs)] diff --git a/tests/mir-opt/dataflow-const-prop/if.rs b/tests/mir-opt/dataflow-const-prop/if.rs index 3400068baba2..7df3bb9c42eb 100644 --- a/tests/mir-opt/dataflow-const-prop/if.rs +++ b/tests/mir-opt/dataflow-const-prop/if.rs @@ -1,4 +1,4 @@ -// unit-test: DataflowConstProp +//@ unit-test: DataflowConstProp // EMIT_MIR if.main.DataflowConstProp.diff // CHECK-LABEL: fn main( diff --git a/tests/mir-opt/dataflow-const-prop/inherit_overflow.rs b/tests/mir-opt/dataflow-const-prop/inherit_overflow.rs index b0acc31e0dbc..d0063a8e7e49 100644 --- a/tests/mir-opt/dataflow-const-prop/inherit_overflow.rs +++ b/tests/mir-opt/dataflow-const-prop/inherit_overflow.rs @@ -1,6 +1,6 @@ // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// unit-test: DataflowConstProp -// compile-flags: -Zmir-enable-passes=+Inline +//@ unit-test: DataflowConstProp +//@ compile-flags: -Zmir-enable-passes=+Inline // EMIT_MIR inherit_overflow.main.DataflowConstProp.diff // CHECK-LABEL: fn main( diff --git a/tests/mir-opt/dataflow-const-prop/issue_81605.rs b/tests/mir-opt/dataflow-const-prop/issue_81605.rs index f13c364279d4..9231bb22c4ce 100644 --- a/tests/mir-opt/dataflow-const-prop/issue_81605.rs +++ b/tests/mir-opt/dataflow-const-prop/issue_81605.rs @@ -1,4 +1,4 @@ -// unit-test: DataflowConstProp +//@ unit-test: DataflowConstProp // EMIT_MIR issue_81605.f.DataflowConstProp.diff diff --git a/tests/mir-opt/dataflow-const-prop/large_array_index.rs b/tests/mir-opt/dataflow-const-prop/large_array_index.rs index 62be2c3824fa..3a4159ab105f 100644 --- a/tests/mir-opt/dataflow-const-prop/large_array_index.rs +++ b/tests/mir-opt/dataflow-const-prop/large_array_index.rs @@ -1,4 +1,4 @@ -// unit-test: DataflowConstProp +//@ unit-test: DataflowConstProp // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // EMIT_MIR_FOR_EACH_BIT_WIDTH diff --git a/tests/mir-opt/dataflow-const-prop/mult_by_zero.rs b/tests/mir-opt/dataflow-const-prop/mult_by_zero.rs index be8ce7310564..b15fba29bdf8 100644 --- a/tests/mir-opt/dataflow-const-prop/mult_by_zero.rs +++ b/tests/mir-opt/dataflow-const-prop/mult_by_zero.rs @@ -1,4 +1,4 @@ -// unit-test: DataflowConstProp +//@ unit-test: DataflowConstProp // EMIT_MIR mult_by_zero.test.DataflowConstProp.diff // CHECK-LABEL: fn test( diff --git a/tests/mir-opt/dataflow-const-prop/offset_of.rs b/tests/mir-opt/dataflow-const-prop/offset_of.rs index ed8e8fcec16e..867890dcf253 100644 --- a/tests/mir-opt/dataflow-const-prop/offset_of.rs +++ b/tests/mir-opt/dataflow-const-prop/offset_of.rs @@ -1,4 +1,4 @@ -// unit-test: DataflowConstProp +//@ unit-test: DataflowConstProp // EMIT_MIR_FOR_EACH_PANIC_STRATEGY #![feature(offset_of_nested)] diff --git a/tests/mir-opt/dataflow-const-prop/ref_without_sb.rs b/tests/mir-opt/dataflow-const-prop/ref_without_sb.rs index 7bf2b1840785..aa669fffd446 100644 --- a/tests/mir-opt/dataflow-const-prop/ref_without_sb.rs +++ b/tests/mir-opt/dataflow-const-prop/ref_without_sb.rs @@ -1,5 +1,5 @@ // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// unit-test: DataflowConstProp +//@ unit-test: DataflowConstProp #[inline(never)] fn escape(x: &T) {} diff --git a/tests/mir-opt/dataflow-const-prop/repeat.rs b/tests/mir-opt/dataflow-const-prop/repeat.rs index daa8dbaf0765..bebedbb94642 100644 --- a/tests/mir-opt/dataflow-const-prop/repeat.rs +++ b/tests/mir-opt/dataflow-const-prop/repeat.rs @@ -1,4 +1,4 @@ -// unit-test: DataflowConstProp +//@ unit-test: DataflowConstProp // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // EMIT_MIR_FOR_EACH_BIT_WIDTH diff --git a/tests/mir-opt/dataflow-const-prop/repr_transparent.rs b/tests/mir-opt/dataflow-const-prop/repr_transparent.rs index 39a2b357193a..ace38364ee3f 100644 --- a/tests/mir-opt/dataflow-const-prop/repr_transparent.rs +++ b/tests/mir-opt/dataflow-const-prop/repr_transparent.rs @@ -1,4 +1,4 @@ -// unit-test: DataflowConstProp +//@ unit-test: DataflowConstProp // The struct has scalar ABI, but is not a scalar type. // Make sure that we handle this correctly. diff --git a/tests/mir-opt/dataflow-const-prop/self_assign.rs b/tests/mir-opt/dataflow-const-prop/self_assign.rs index a5b232131286..4171d2991aea 100644 --- a/tests/mir-opt/dataflow-const-prop/self_assign.rs +++ b/tests/mir-opt/dataflow-const-prop/self_assign.rs @@ -1,4 +1,4 @@ -// unit-test: DataflowConstProp +//@ unit-test: DataflowConstProp // EMIT_MIR self_assign.main.DataflowConstProp.diff diff --git a/tests/mir-opt/dataflow-const-prop/self_assign_add.rs b/tests/mir-opt/dataflow-const-prop/self_assign_add.rs index 7bfbda7a96c6..d958025c7077 100644 --- a/tests/mir-opt/dataflow-const-prop/self_assign_add.rs +++ b/tests/mir-opt/dataflow-const-prop/self_assign_add.rs @@ -1,4 +1,4 @@ -// unit-test: DataflowConstProp +//@ unit-test: DataflowConstProp // EMIT_MIR self_assign_add.main.DataflowConstProp.diff diff --git a/tests/mir-opt/dataflow-const-prop/sibling_ptr.rs b/tests/mir-opt/dataflow-const-prop/sibling_ptr.rs index 9c610aabe821..ad24c5855b8b 100644 --- a/tests/mir-opt/dataflow-const-prop/sibling_ptr.rs +++ b/tests/mir-opt/dataflow-const-prop/sibling_ptr.rs @@ -6,7 +6,7 @@ // used to modify `x.1` - if it did not, then it might incorrectly assume that it // can infer the value of `x.1` at the end of this function. -// unit-test: DataflowConstProp +//@ unit-test: DataflowConstProp // EMIT_MIR sibling_ptr.main.DataflowConstProp.diff diff --git a/tests/mir-opt/dataflow-const-prop/slice_len.rs b/tests/mir-opt/dataflow-const-prop/slice_len.rs index 65c87580330f..08707779e2c8 100644 --- a/tests/mir-opt/dataflow-const-prop/slice_len.rs +++ b/tests/mir-opt/dataflow-const-prop/slice_len.rs @@ -1,6 +1,6 @@ // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// unit-test: DataflowConstProp -// compile-flags: -Zmir-enable-passes=+InstSimplify +//@ unit-test: DataflowConstProp +//@ compile-flags: -Zmir-enable-passes=+InstSimplify // EMIT_MIR_FOR_EACH_BIT_WIDTH // EMIT_MIR slice_len.main.DataflowConstProp.diff diff --git a/tests/mir-opt/dataflow-const-prop/struct.rs b/tests/mir-opt/dataflow-const-prop/struct.rs index a7e0f6a987d5..0180e978a09f 100644 --- a/tests/mir-opt/dataflow-const-prop/struct.rs +++ b/tests/mir-opt/dataflow-const-prop/struct.rs @@ -1,4 +1,4 @@ -// unit-test: DataflowConstProp +//@ unit-test: DataflowConstProp // EMIT_MIR_FOR_EACH_BIT_WIDTH #[derive(Copy, Clone)] diff --git a/tests/mir-opt/dataflow-const-prop/terminator.rs b/tests/mir-opt/dataflow-const-prop/terminator.rs index 4472861f132d..d33f3216933a 100644 --- a/tests/mir-opt/dataflow-const-prop/terminator.rs +++ b/tests/mir-opt/dataflow-const-prop/terminator.rs @@ -1,5 +1,5 @@ // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// unit-test: DataflowConstProp +//@ unit-test: DataflowConstProp fn foo(n: i32) {} diff --git a/tests/mir-opt/dataflow-const-prop/transmute.rs b/tests/mir-opt/dataflow-const-prop/transmute.rs index bb85e4586787..7cf0dad5e483 100644 --- a/tests/mir-opt/dataflow-const-prop/transmute.rs +++ b/tests/mir-opt/dataflow-const-prop/transmute.rs @@ -1,6 +1,6 @@ -// unit-test: DataflowConstProp -// compile-flags: -O --crate-type=lib -// ignore-endian-big +//@ unit-test: DataflowConstProp +//@ compile-flags: -O --crate-type=lib +//@ ignore-endian-big // EMIT_MIR_FOR_EACH_BIT_WIDTH use std::mem::transmute; diff --git a/tests/mir-opt/dataflow-const-prop/tuple.rs b/tests/mir-opt/dataflow-const-prop/tuple.rs index 563558da04a5..5d7c38970f6c 100644 --- a/tests/mir-opt/dataflow-const-prop/tuple.rs +++ b/tests/mir-opt/dataflow-const-prop/tuple.rs @@ -1,4 +1,4 @@ -// unit-test: DataflowConstProp +//@ unit-test: DataflowConstProp // EMIT_MIR_FOR_EACH_BIT_WIDTH // EMIT_MIR tuple.main.DataflowConstProp.diff diff --git a/tests/mir-opt/dead-store-elimination/call_arg_copy.rs b/tests/mir-opt/dead-store-elimination/call_arg_copy.rs index 37b3313f7d04..2ce1e9023a76 100644 --- a/tests/mir-opt/dead-store-elimination/call_arg_copy.rs +++ b/tests/mir-opt/dead-store-elimination/call_arg_copy.rs @@ -1,6 +1,6 @@ // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// unit-test: DeadStoreElimination-final -// compile-flags: -Zmir-enable-passes=+CopyProp +//@ unit-test: DeadStoreElimination-final +//@ compile-flags: -Zmir-enable-passes=+CopyProp #![feature(core_intrinsics)] #![feature(custom_mir)] diff --git a/tests/mir-opt/dead-store-elimination/cycle.rs b/tests/mir-opt/dead-store-elimination/cycle.rs index e8f566b4aa7b..ddbc89a7ae2c 100644 --- a/tests/mir-opt/dead-store-elimination/cycle.rs +++ b/tests/mir-opt/dead-store-elimination/cycle.rs @@ -1,8 +1,8 @@ // This example is interesting because the non-transitive version of `MaybeLiveLocals` would // report that *all* of these stores are live. // -// needs-unwind -// unit-test: DeadStoreElimination-initial +//@ needs-unwind +//@ unit-test: DeadStoreElimination-initial #![feature(core_intrinsics, custom_mir)] use std::intrinsics::mir::*; diff --git a/tests/mir-opt/dead-store-elimination/place_mention.rs b/tests/mir-opt/dead-store-elimination/place_mention.rs index ae75e622ff7f..d276f6fa0259 100644 --- a/tests/mir-opt/dead-store-elimination/place_mention.rs +++ b/tests/mir-opt/dead-store-elimination/place_mention.rs @@ -1,8 +1,8 @@ // Verify that we account for the `PlaceMention` statement as a use of the tuple, // and don't remove it as a dead store. // -// unit-test: DeadStoreElimination-initial -// compile-flags: -Zmir-keep-place-mention +//@ unit-test: DeadStoreElimination-initial +//@ compile-flags: -Zmir-keep-place-mention // EMIT_MIR place_mention.main.DeadStoreElimination-initial.diff fn main() { diff --git a/tests/mir-opt/dead-store-elimination/provenance_soundness.rs b/tests/mir-opt/dead-store-elimination/provenance_soundness.rs index 916c393b9de0..96268cd957ef 100644 --- a/tests/mir-opt/dead-store-elimination/provenance_soundness.rs +++ b/tests/mir-opt/dead-store-elimination/provenance_soundness.rs @@ -1,6 +1,6 @@ // Test that we don't remove pointer to int casts or retags -// unit-test: DeadStoreElimination-initial -// compile-flags: -Zmir-emit-retag +//@ unit-test: DeadStoreElimination-initial +//@ compile-flags: -Zmir-emit-retag // EMIT_MIR provenance_soundness.pointer_to_int.DeadStoreElimination-initial.diff fn pointer_to_int(p: *mut i32) { diff --git a/tests/mir-opt/deduplicate_blocks.rs b/tests/mir-opt/deduplicate_blocks.rs index d3b89102f0ca..7979fdfe768c 100644 --- a/tests/mir-opt/deduplicate_blocks.rs +++ b/tests/mir-opt/deduplicate_blocks.rs @@ -1,6 +1,6 @@ // skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// unit-test: DeduplicateBlocks +//@ unit-test: DeduplicateBlocks // EMIT_MIR deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.diff pub const fn is_line_doc_comment_2(s: &str) -> bool { diff --git a/tests/mir-opt/deref-patterns/string.rs b/tests/mir-opt/deref-patterns/string.rs index 0c8385b5c483..bb4b5379b275 100644 --- a/tests/mir-opt/deref-patterns/string.rs +++ b/tests/mir-opt/deref-patterns/string.rs @@ -1,5 +1,5 @@ // skip-filecheck -// compile-flags: -Z mir-opt-level=0 -C panic=abort +//@ compile-flags: -Z mir-opt-level=0 -C panic=abort #![feature(string_deref_patterns)] #![crate_type = "lib"] diff --git a/tests/mir-opt/derefer_complex_case.rs b/tests/mir-opt/derefer_complex_case.rs index 6097d8739fb5..bdaf83fcb5bf 100644 --- a/tests/mir-opt/derefer_complex_case.rs +++ b/tests/mir-opt/derefer_complex_case.rs @@ -1,5 +1,5 @@ // skip-filecheck -// unit-test: Derefer +//@ unit-test: Derefer // EMIT_MIR derefer_complex_case.main.Derefer.diff // EMIT_MIR_FOR_EACH_PANIC_STRATEGY diff --git a/tests/mir-opt/derefer_inline_test.rs b/tests/mir-opt/derefer_inline_test.rs index 713c051f44ad..89de514a2808 100644 --- a/tests/mir-opt/derefer_inline_test.rs +++ b/tests/mir-opt/derefer_inline_test.rs @@ -1,5 +1,5 @@ // skip-filecheck -// unit-test: Derefer +//@ unit-test: Derefer // EMIT_MIR derefer_inline_test.main.Derefer.diff // EMIT_MIR_FOR_EACH_PANIC_STRATEGY diff --git a/tests/mir-opt/derefer_terminator_test.rs b/tests/mir-opt/derefer_terminator_test.rs index 3780ff5df7df..e225db5bbe8a 100644 --- a/tests/mir-opt/derefer_terminator_test.rs +++ b/tests/mir-opt/derefer_terminator_test.rs @@ -1,5 +1,5 @@ // skip-filecheck -// unit-test: Derefer +//@ unit-test: Derefer // EMIT_MIR derefer_terminator_test.main.Derefer.diff // EMIT_MIR_FOR_EACH_PANIC_STRATEGY diff --git a/tests/mir-opt/derefer_test.rs b/tests/mir-opt/derefer_test.rs index 171925bb19df..e30a286805fe 100644 --- a/tests/mir-opt/derefer_test.rs +++ b/tests/mir-opt/derefer_test.rs @@ -1,5 +1,5 @@ // skip-filecheck -// unit-test: Derefer +//@ unit-test: Derefer // EMIT_MIR derefer_test.main.Derefer.diff fn main() { let mut a = (42,43); diff --git a/tests/mir-opt/derefer_test_multiple.rs b/tests/mir-opt/derefer_test_multiple.rs index ac778a9c9b74..4efc735b22eb 100644 --- a/tests/mir-opt/derefer_test_multiple.rs +++ b/tests/mir-opt/derefer_test_multiple.rs @@ -1,5 +1,5 @@ // skip-filecheck -// unit-test: Derefer +//@ unit-test: Derefer // EMIT_MIR derefer_test_multiple.main.Derefer.diff fn main () { let mut a = (42, 43); diff --git a/tests/mir-opt/dest-prop/branch.rs b/tests/mir-opt/dest-prop/branch.rs index d8c74a0aa91d..cd5513072857 100644 --- a/tests/mir-opt/dest-prop/branch.rs +++ b/tests/mir-opt/dest-prop/branch.rs @@ -1,7 +1,7 @@ // skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY //! Tests that assignment in both branches of an `if` are eliminated. -// unit-test: DestinationPropagation +//@ unit-test: DestinationPropagation fn val() -> i32 { 1 } diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.rs b/tests/mir-opt/dest-prop/copy_propagation_arg.rs index 435cf07ab0c0..f84b5fde8d88 100644 --- a/tests/mir-opt/dest-prop/copy_propagation_arg.rs +++ b/tests/mir-opt/dest-prop/copy_propagation_arg.rs @@ -2,7 +2,7 @@ // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // Check that DestinationPropagation does not propagate an assignment to a function argument // (doing so can break usages of the original argument value) -// unit-test: DestinationPropagation +//@ unit-test: DestinationPropagation fn dummy(x: u8) -> u8 { x } diff --git a/tests/mir-opt/dest-prop/cycle.rs b/tests/mir-opt/dest-prop/cycle.rs index 77cff062cc46..e6663956d782 100644 --- a/tests/mir-opt/dest-prop/cycle.rs +++ b/tests/mir-opt/dest-prop/cycle.rs @@ -1,7 +1,7 @@ // skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY //! Tests that cyclic assignments don't hang DestinationPropagation, and result in reasonable code. -// unit-test: DestinationPropagation +//@ unit-test: DestinationPropagation fn val() -> i32 { 1 } diff --git a/tests/mir-opt/dest-prop/dead_stores_79191.rs b/tests/mir-opt/dest-prop/dead_stores_79191.rs index a6fd542d3b58..b3e370966d05 100644 --- a/tests/mir-opt/dest-prop/dead_stores_79191.rs +++ b/tests/mir-opt/dest-prop/dead_stores_79191.rs @@ -1,6 +1,6 @@ // skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// unit-test: DestinationPropagation +//@ unit-test: DestinationPropagation fn id(x: T) -> T { x diff --git a/tests/mir-opt/dest-prop/dead_stores_better.rs b/tests/mir-opt/dest-prop/dead_stores_better.rs index c9895f35cf1d..c241d71594ba 100644 --- a/tests/mir-opt/dest-prop/dead_stores_better.rs +++ b/tests/mir-opt/dest-prop/dead_stores_better.rs @@ -3,8 +3,8 @@ // This is a copy of the `dead_stores_79191` test, except that we turn on DSE. This demonstrates // that that pass enables this one to do more optimizations. -// unit-test: DestinationPropagation -// compile-flags: -Zmir-enable-passes=+DeadStoreElimination +//@ unit-test: DestinationPropagation +//@ compile-flags: -Zmir-enable-passes=+DeadStoreElimination fn id(x: T) -> T { x diff --git a/tests/mir-opt/dest-prop/simple.rs b/tests/mir-opt/dest-prop/simple.rs index 03d20962690e..4aa6b6a4876e 100644 --- a/tests/mir-opt/dest-prop/simple.rs +++ b/tests/mir-opt/dest-prop/simple.rs @@ -1,7 +1,7 @@ // skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY //! Copy of `nrvo-simple.rs`, to ensure that full dest-prop handles it too. -// unit-test: DestinationPropagation +//@ unit-test: DestinationPropagation // EMIT_MIR simple.nrvo.DestinationPropagation.diff fn nrvo(init: fn(&mut [u8; 1024])) -> [u8; 1024] { let mut buf = [0; 1024]; diff --git a/tests/mir-opt/dest-prop/union.rs b/tests/mir-opt/dest-prop/union.rs index 6d3e6d7fa760..abd1f1b2c937 100644 --- a/tests/mir-opt/dest-prop/union.rs +++ b/tests/mir-opt/dest-prop/union.rs @@ -1,7 +1,7 @@ // skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY //! Tests that we can propagate into places that are projections into unions -// compile-flags: -Zunsound-mir-opts +//@ compile-flags: -Zunsound-mir-opts fn val() -> u32 { 1 } diff --git a/tests/mir-opt/dont_inline_type_id.rs b/tests/mir-opt/dont_inline_type_id.rs index 788c2f55dc02..ae72eb11735e 100644 --- a/tests/mir-opt/dont_inline_type_id.rs +++ b/tests/mir-opt/dont_inline_type_id.rs @@ -1,6 +1,6 @@ // skip-filecheck -// unit-test: Inline -// compile-flags: --crate-type=lib -C panic=abort +//@ unit-test: Inline +//@ compile-flags: --crate-type=lib -C panic=abort use std::any::Any; use std::any::TypeId; diff --git a/tests/mir-opt/early_otherwise_branch.rs b/tests/mir-opt/early_otherwise_branch.rs index b48516c5aa1b..c984c271ccd5 100644 --- a/tests/mir-opt/early_otherwise_branch.rs +++ b/tests/mir-opt/early_otherwise_branch.rs @@ -1,5 +1,5 @@ // skip-filecheck -// unit-test: EarlyOtherwiseBranch +//@ unit-test: EarlyOtherwiseBranch // EMIT_MIR early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff fn opt1(x: Option, y: Option) -> u32 { match (x, y) { diff --git a/tests/mir-opt/early_otherwise_branch_3_element_tuple.rs b/tests/mir-opt/early_otherwise_branch_3_element_tuple.rs index 2a0fba9bea41..320813475587 100644 --- a/tests/mir-opt/early_otherwise_branch_3_element_tuple.rs +++ b/tests/mir-opt/early_otherwise_branch_3_element_tuple.rs @@ -1,5 +1,5 @@ // skip-filecheck -// unit-test: EarlyOtherwiseBranch +//@ unit-test: EarlyOtherwiseBranch // EMIT_MIR early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff fn opt1(x: Option, y: Option, z: Option) -> u32 { diff --git a/tests/mir-opt/early_otherwise_branch_68867.rs b/tests/mir-opt/early_otherwise_branch_68867.rs index f27527b96ab8..805d21533c5d 100644 --- a/tests/mir-opt/early_otherwise_branch_68867.rs +++ b/tests/mir-opt/early_otherwise_branch_68867.rs @@ -1,5 +1,5 @@ // skip-filecheck -// unit-test: EarlyOtherwiseBranch +//@ unit-test: EarlyOtherwiseBranch // FIXME: This test was broken by the derefer change. diff --git a/tests/mir-opt/early_otherwise_branch_noopt.rs b/tests/mir-opt/early_otherwise_branch_noopt.rs index 351640c27c52..648089e2df1d 100644 --- a/tests/mir-opt/early_otherwise_branch_noopt.rs +++ b/tests/mir-opt/early_otherwise_branch_noopt.rs @@ -1,5 +1,5 @@ // skip-filecheck -// unit-test: EarlyOtherwiseBranch +//@ unit-test: EarlyOtherwiseBranch // must not optimize as it does not follow the pattern of // left and right hand side being the same variant diff --git a/tests/mir-opt/early_otherwise_branch_soundness.rs b/tests/mir-opt/early_otherwise_branch_soundness.rs index 02c25a1bd598..b4f5821c420c 100644 --- a/tests/mir-opt/early_otherwise_branch_soundness.rs +++ b/tests/mir-opt/early_otherwise_branch_soundness.rs @@ -1,5 +1,5 @@ // skip-filecheck -// unit-test: EarlyOtherwiseBranch +//@ unit-test: EarlyOtherwiseBranch // Tests various cases that the `early_otherwise_branch` opt should *not* optimize diff --git a/tests/mir-opt/enum_opt.rs b/tests/mir-opt/enum_opt.rs index 7738c4310405..c5b3e61a4cb2 100644 --- a/tests/mir-opt/enum_opt.rs +++ b/tests/mir-opt/enum_opt.rs @@ -1,7 +1,7 @@ // skip-filecheck -// unit-test: EnumSizeOpt +//@ unit-test: EnumSizeOpt // EMIT_MIR_FOR_EACH_BIT_WIDTH -// compile-flags: -Zunsound-mir-opts +//@ compile-flags: -Zunsound-mir-opts #![feature(arbitrary_enum_discriminant, repr128)] diff --git a/tests/mir-opt/fn_ptr_shim.rs b/tests/mir-opt/fn_ptr_shim.rs index 2650cbf9704f..326188efe019 100644 --- a/tests/mir-opt/fn_ptr_shim.rs +++ b/tests/mir-opt/fn_ptr_shim.rs @@ -1,5 +1,5 @@ // skip-filecheck -// compile-flags: -Zmir-opt-level=0 +//@ compile-flags: -Zmir-opt-level=0 // Tests that the `` shim does not create a `Call` terminator with a `Self` callee // (as only `FnDef` and `FnPtr` callees are allowed in MIR). diff --git a/tests/mir-opt/funky_arms.rs b/tests/mir-opt/funky_arms.rs index eae158f9f778..189cd7951fb7 100644 --- a/tests/mir-opt/funky_arms.rs +++ b/tests/mir-opt/funky_arms.rs @@ -1,6 +1,6 @@ // skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// compile-flags: --crate-type lib -Cdebug-assertions=no +//@ compile-flags: --crate-type lib -Cdebug-assertions=no #![feature(flt2dec)] diff --git a/tests/mir-opt/graphviz.rs b/tests/mir-opt/graphviz.rs index 61b5a2fb3d86..f5e8fd77d854 100644 --- a/tests/mir-opt/graphviz.rs +++ b/tests/mir-opt/graphviz.rs @@ -1,6 +1,6 @@ // skip-filecheck // Test graphviz output -// compile-flags: -Z dump-mir-graphviz +//@ compile-flags: -Z dump-mir-graphviz // EMIT_MIR graphviz.main.built.after.dot fn main() {} diff --git a/tests/mir-opt/gvn.rs b/tests/mir-opt/gvn.rs index fccd4484a294..6f4d1e35585b 100644 --- a/tests/mir-opt/gvn.rs +++ b/tests/mir-opt/gvn.rs @@ -1,6 +1,6 @@ -// unit-test: GVN +//@ unit-test: GVN // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// only-64bit +//@ only-64bit #![feature(raw_ref_op)] #![feature(rustc_attrs)] diff --git a/tests/mir-opt/gvn_copy_moves.rs b/tests/mir-opt/gvn_copy_moves.rs index d216825e5e68..9d83a19e4a58 100644 --- a/tests/mir-opt/gvn_copy_moves.rs +++ b/tests/mir-opt/gvn_copy_moves.rs @@ -1,4 +1,4 @@ -// unit-test: GVN +//@ unit-test: GVN #![feature(custom_mir, core_intrinsics)] extern crate core; diff --git a/tests/mir-opt/gvn_uninhabited.rs b/tests/mir-opt/gvn_uninhabited.rs index a55b2dd763ac..5f9df7953c8e 100644 --- a/tests/mir-opt/gvn_uninhabited.rs +++ b/tests/mir-opt/gvn_uninhabited.rs @@ -1,5 +1,5 @@ -// unit-test: GVN -// compile-flags: -O +//@ unit-test: GVN +//@ compile-flags: -O // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // skip-filecheck diff --git a/tests/mir-opt/if_condition_int.rs b/tests/mir-opt/if_condition_int.rs index a3dd74d9a379..2f3f64330456 100644 --- a/tests/mir-opt/if_condition_int.rs +++ b/tests/mir-opt/if_condition_int.rs @@ -1,5 +1,5 @@ // skip-filecheck -// unit-test: SimplifyComparisonIntegral +//@ unit-test: SimplifyComparisonIntegral // EMIT_MIR if_condition_int.opt_u32.SimplifyComparisonIntegral.diff // EMIT_MIR if_condition_int.opt_negative.SimplifyComparisonIntegral.diff // EMIT_MIR if_condition_int.opt_char.SimplifyComparisonIntegral.diff diff --git a/tests/mir-opt/inline/asm_unwind.rs b/tests/mir-opt/inline/asm_unwind.rs index 0ae20e522111..7708f567c717 100644 --- a/tests/mir-opt/inline/asm_unwind.rs +++ b/tests/mir-opt/inline/asm_unwind.rs @@ -1,9 +1,9 @@ // Tests inlining of `may_unwind` inline assembly. // // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// needs-asm-support -// needs-unwind -// compile-flags: -Zinline-mir-hint-threshold=1000 +//@ needs-asm-support +//@ needs-unwind +//@ compile-flags: -Zinline-mir-hint-threshold=1000 #![feature(asm_unwind)] struct D; diff --git a/tests/mir-opt/inline/caller_with_trivial_bound.rs b/tests/mir-opt/inline/caller_with_trivial_bound.rs index 40f7f4bbab2f..2e26a9486457 100644 --- a/tests/mir-opt/inline/caller_with_trivial_bound.rs +++ b/tests/mir-opt/inline/caller_with_trivial_bound.rs @@ -1,5 +1,5 @@ // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// needs-unwind +//@ needs-unwind #![crate_type = "lib"] pub trait Factory { diff --git a/tests/mir-opt/inline/cycle.rs b/tests/mir-opt/inline/cycle.rs index c251226673d5..b2eacfe33b17 100644 --- a/tests/mir-opt/inline/cycle.rs +++ b/tests/mir-opt/inline/cycle.rs @@ -1,5 +1,5 @@ // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// compile-flags: -Zinline-mir-hint-threshold=1000 +//@ compile-flags: -Zinline-mir-hint-threshold=1000 // EMIT_MIR cycle.f.Inline.diff #[inline(always)] diff --git a/tests/mir-opt/inline/dont_ice_on_generic_rust_call.rs b/tests/mir-opt/inline/dont_ice_on_generic_rust_call.rs index ce5e1855a716..abc0ef5c61d5 100644 --- a/tests/mir-opt/inline/dont_ice_on_generic_rust_call.rs +++ b/tests/mir-opt/inline/dont_ice_on_generic_rust_call.rs @@ -1,5 +1,5 @@ // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// compile-flags: -Zmir-enable-passes=+Inline --crate-type=lib +//@ compile-flags: -Zmir-enable-passes=+Inline --crate-type=lib #![feature(fn_traits, tuple_trait, unboxed_closures)] diff --git a/tests/mir-opt/inline/indirect_destination.rs b/tests/mir-opt/inline/indirect_destination.rs index 82143d85c258..337f617e7036 100644 --- a/tests/mir-opt/inline/indirect_destination.rs +++ b/tests/mir-opt/inline/indirect_destination.rs @@ -1,8 +1,8 @@ // Test for inlining with an indirect destination place. // -// unit-test: Inline -// edition: 2021 -// needs-unwind +//@ unit-test: Inline +//@ edition: 2021 +//@ needs-unwind #![crate_type = "lib"] #![feature(custom_mir, core_intrinsics)] use core::intrinsics::mir::*; diff --git a/tests/mir-opt/inline/inline_any_operand.rs b/tests/mir-opt/inline/inline_any_operand.rs index 659b7c3a0a1f..8151949214b1 100644 --- a/tests/mir-opt/inline/inline_any_operand.rs +++ b/tests/mir-opt/inline/inline_any_operand.rs @@ -1,4 +1,4 @@ -// compile-flags: -Z span_free_formats +//@ compile-flags: -Z span_free_formats // Tests that MIR inliner works for any operand diff --git a/tests/mir-opt/inline/inline_async.rs b/tests/mir-opt/inline/inline_async.rs index 1de87e1e43cf..c5684f51cce5 100644 --- a/tests/mir-opt/inline/inline_async.rs +++ b/tests/mir-opt/inline/inline_async.rs @@ -3,7 +3,7 @@ // The outcome of optimization is not verfied, just the absence of the cycle. // Regression test for #76181. // -// edition:2018 +//@ edition:2018 #![crate_type = "lib"] diff --git a/tests/mir-opt/inline/inline_box_fn.rs b/tests/mir-opt/inline/inline_box_fn.rs index d2da23939923..3e006016f8c3 100644 --- a/tests/mir-opt/inline/inline_box_fn.rs +++ b/tests/mir-opt/inline/inline_box_fn.rs @@ -1,6 +1,6 @@ // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// unit-test: Inline -// compile-flags: --crate-type=lib +//@ unit-test: Inline +//@ compile-flags: --crate-type=lib // EMIT_MIR inline_box_fn.call.Inline.diff fn call(x: Box) { diff --git a/tests/mir-opt/inline/inline_closure.rs b/tests/mir-opt/inline/inline_closure.rs index 65f55d49a806..9a3cf54ef078 100644 --- a/tests/mir-opt/inline/inline_closure.rs +++ b/tests/mir-opt/inline/inline_closure.rs @@ -1,4 +1,4 @@ -// compile-flags: -Z span_free_formats +//@ compile-flags: -Z span_free_formats // Tests that MIR inliner can handle closure arguments. (#45894) diff --git a/tests/mir-opt/inline/inline_closure_borrows_arg.rs b/tests/mir-opt/inline/inline_closure_borrows_arg.rs index 1570ab057c72..367037e113c8 100644 --- a/tests/mir-opt/inline/inline_closure_borrows_arg.rs +++ b/tests/mir-opt/inline/inline_closure_borrows_arg.rs @@ -1,4 +1,4 @@ -// compile-flags: -Z span_free_formats -Zunsound-mir-opts +//@ compile-flags: -Z span_free_formats -Zunsound-mir-opts // Tests that MIR inliner can handle closure arguments, // even when (#45894) diff --git a/tests/mir-opt/inline/inline_closure_captures.rs b/tests/mir-opt/inline/inline_closure_captures.rs index 2b08b1068872..2c2d556f9a9a 100644 --- a/tests/mir-opt/inline/inline_closure_captures.rs +++ b/tests/mir-opt/inline/inline_closure_captures.rs @@ -1,4 +1,4 @@ -// compile-flags: -Z span_free_formats +//@ compile-flags: -Z span_free_formats // Tests that MIR inliner can handle closure captures. diff --git a/tests/mir-opt/inline/inline_compatibility.rs b/tests/mir-opt/inline/inline_compatibility.rs index 3ad880715fe6..13f28aaacd6a 100644 --- a/tests/mir-opt/inline/inline_compatibility.rs +++ b/tests/mir-opt/inline/inline_compatibility.rs @@ -1,6 +1,6 @@ // Checks that only functions with compatible attributes are inlined. -// only-x86_64 -// compile-flags: -Cpanic=abort +//@ only-x86_64 +//@ compile-flags: -Cpanic=abort #![crate_type = "lib"] #![feature(no_sanitize)] diff --git a/tests/mir-opt/inline/inline_coroutine.rs b/tests/mir-opt/inline/inline_coroutine.rs index a82586bf2bfa..9500c2261cc1 100644 --- a/tests/mir-opt/inline/inline_coroutine.rs +++ b/tests/mir-opt/inline/inline_coroutine.rs @@ -1,5 +1,5 @@ // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// compile-flags: -Zinline-mir-hint-threshold=1000 +//@ compile-flags: -Zinline-mir-hint-threshold=1000 #![feature(coroutines, coroutine_trait)] use std::ops::Coroutine; diff --git a/tests/mir-opt/inline/inline_diverging.rs b/tests/mir-opt/inline/inline_diverging.rs index 25a5b9c5c5e7..89ef0fc4a61f 100644 --- a/tests/mir-opt/inline/inline_diverging.rs +++ b/tests/mir-opt/inline/inline_diverging.rs @@ -1,7 +1,7 @@ // Tests inlining of diverging calls. // // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// compile-flags: -Zinline-mir-hint-threshold=1000 +//@ compile-flags: -Zinline-mir-hint-threshold=1000 #![crate_type = "lib"] // EMIT_MIR inline_diverging.f.Inline.diff diff --git a/tests/mir-opt/inline/inline_instruction_set.rs b/tests/mir-opt/inline/inline_instruction_set.rs index 7cb59645587b..44faf3a4ed9a 100644 --- a/tests/mir-opt/inline/inline_instruction_set.rs +++ b/tests/mir-opt/inline/inline_instruction_set.rs @@ -2,8 +2,8 @@ // // A function is "compatible" when the *callee* has the same attribute or no attribute. // -// compile-flags: --target thumbv4t-none-eabi -// needs-llvm-components: arm +//@ compile-flags: --target thumbv4t-none-eabi +//@ needs-llvm-components: arm #![crate_type = "lib"] #![feature(rustc_attrs)] diff --git a/tests/mir-opt/inline/inline_options.rs b/tests/mir-opt/inline/inline_options.rs index b940c64f0b88..7d7c4f718bd7 100644 --- a/tests/mir-opt/inline/inline_options.rs +++ b/tests/mir-opt/inline/inline_options.rs @@ -2,8 +2,8 @@ // Checks that inlining threshold can be controlled with // inline-mir-threshold and inline-hint-threshold options. // -// compile-flags: -Zinline-mir-threshold=90 -// compile-flags: -Zinline-mir-hint-threshold=50 +//@ compile-flags: -Zinline-mir-threshold=90 +//@ compile-flags: -Zinline-mir-hint-threshold=50 // EMIT_MIR inline_options.main.Inline.after.mir fn main() { diff --git a/tests/mir-opt/inline/inline_retag.rs b/tests/mir-opt/inline/inline_retag.rs index 9fb6f709223c..5cf7f768f917 100644 --- a/tests/mir-opt/inline/inline_retag.rs +++ b/tests/mir-opt/inline/inline_retag.rs @@ -1,4 +1,4 @@ -// compile-flags: -Z span_free_formats -Z mir-emit-retag +//@ compile-flags: -Z span_free_formats -Z mir-emit-retag // Tests that MIR inliner fixes up `Retag`'s `fn_entry` flag diff --git a/tests/mir-opt/inline/inline_trait_method.rs b/tests/mir-opt/inline/inline_trait_method.rs index b39355637a1c..34d2c205791c 100644 --- a/tests/mir-opt/inline/inline_trait_method.rs +++ b/tests/mir-opt/inline/inline_trait_method.rs @@ -1,6 +1,6 @@ // Verify that we do not inline the default impl in a trait object. // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// compile-flags: -Z span_free_formats +//@ compile-flags: -Z span_free_formats fn main() { println!("{}", test(&())); diff --git a/tests/mir-opt/inline/inline_trait_method_2.rs b/tests/mir-opt/inline/inline_trait_method_2.rs index b0b6a7b9b01d..c3a71e63783f 100644 --- a/tests/mir-opt/inline/inline_trait_method_2.rs +++ b/tests/mir-opt/inline/inline_trait_method_2.rs @@ -1,5 +1,5 @@ // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// compile-flags: -Z span_free_formats -Z mir-opt-level=4 +//@ compile-flags: -Z span_free_formats -Z mir-opt-level=4 // EMIT_MIR inline_trait_method_2.test2.Inline.after.mir fn test2(x: &dyn X) -> bool { diff --git a/tests/mir-opt/inline/issue_78442.rs b/tests/mir-opt/inline/issue_78442.rs index f9a5234283a0..2fbe0c6c64c6 100644 --- a/tests/mir-opt/inline/issue_78442.rs +++ b/tests/mir-opt/inline/issue_78442.rs @@ -1,4 +1,4 @@ -// compile-flags: -Z mir-opt-level=3 -Z inline-mir +//@ compile-flags: -Z mir-opt-level=3 -Z inline-mir // EMIT_MIR_FOR_EACH_PANIC_STRATEGY #![crate_type = "lib"] diff --git a/tests/mir-opt/inline/polymorphic_recursion.rs b/tests/mir-opt/inline/polymorphic_recursion.rs index f71e382e867f..0338d604635e 100644 --- a/tests/mir-opt/inline/polymorphic_recursion.rs +++ b/tests/mir-opt/inline/polymorphic_recursion.rs @@ -1,6 +1,6 @@ // skip-filecheck // Make sure that the MIR inliner does not loop indefinitely on polymorphic recursion. -// compile-flags: --crate-type lib +//@ compile-flags: --crate-type lib // Randomize `def_path_hash` by defining them under a module with different names macro_rules! emit { diff --git a/tests/mir-opt/inline/rustc_no_mir_inline.caller.Inline.panic-abort.diff b/tests/mir-opt/inline/rustc_no_mir_inline.caller.Inline.panic-abort.diff new file mode 100644 index 000000000000..dd79cff1dcf8 --- /dev/null +++ b/tests/mir-opt/inline/rustc_no_mir_inline.caller.Inline.panic-abort.diff @@ -0,0 +1,19 @@ +- // MIR for `caller` before Inline ++ // MIR for `caller` after Inline + + fn caller() -> () { + let mut _0: (); + let _1: (); + + bb0: { + StorageLive(_1); + _1 = callee() -> [return: bb1, unwind unreachable]; + } + + bb1: { + StorageDead(_1); + _0 = const (); + return; + } + } + diff --git a/tests/mir-opt/inline/rustc_no_mir_inline.caller.Inline.panic-unwind.diff b/tests/mir-opt/inline/rustc_no_mir_inline.caller.Inline.panic-unwind.diff new file mode 100644 index 000000000000..4506a338edd7 --- /dev/null +++ b/tests/mir-opt/inline/rustc_no_mir_inline.caller.Inline.panic-unwind.diff @@ -0,0 +1,19 @@ +- // MIR for `caller` before Inline ++ // MIR for `caller` after Inline + + fn caller() -> () { + let mut _0: (); + let _1: (); + + bb0: { + StorageLive(_1); + _1 = callee() -> [return: bb1, unwind continue]; + } + + bb1: { + StorageDead(_1); + _0 = const (); + return; + } + } + diff --git a/tests/mir-opt/inline/rustc_no_mir_inline.caller.PreCodegen.after.panic-abort.mir b/tests/mir-opt/inline/rustc_no_mir_inline.caller.PreCodegen.after.panic-abort.mir new file mode 100644 index 000000000000..d0772e51a07f --- /dev/null +++ b/tests/mir-opt/inline/rustc_no_mir_inline.caller.PreCodegen.after.panic-abort.mir @@ -0,0 +1,14 @@ +// MIR for `caller` after PreCodegen + +fn caller() -> () { + let mut _0: (); + let _1: (); + + bb0: { + _1 = callee() -> [return: bb1, unwind unreachable]; + } + + bb1: { + return; + } +} diff --git a/tests/mir-opt/inline/rustc_no_mir_inline.caller.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/inline/rustc_no_mir_inline.caller.PreCodegen.after.panic-unwind.mir new file mode 100644 index 000000000000..39ad4f1010b7 --- /dev/null +++ b/tests/mir-opt/inline/rustc_no_mir_inline.caller.PreCodegen.after.panic-unwind.mir @@ -0,0 +1,14 @@ +// MIR for `caller` after PreCodegen + +fn caller() -> () { + let mut _0: (); + let _1: (); + + bb0: { + _1 = callee() -> [return: bb1, unwind continue]; + } + + bb1: { + return; + } +} diff --git a/tests/mir-opt/inline/rustc_no_mir_inline.rs b/tests/mir-opt/inline/rustc_no_mir_inline.rs new file mode 100644 index 000000000000..b008df32726b --- /dev/null +++ b/tests/mir-opt/inline/rustc_no_mir_inline.rs @@ -0,0 +1,17 @@ +// EMIT_MIR_FOR_EACH_PANIC_STRATEGY +#![crate_type = "lib"] +#![feature(rustc_attrs)] + +//@ compile-flags: -Zmir-opt-level=2 -Zinline-mir + +#[inline] +#[rustc_no_mir_inline] +pub fn callee() {} + +// EMIT_MIR rustc_no_mir_inline.caller.Inline.diff +// EMIT_MIR rustc_no_mir_inline.caller.PreCodegen.after.mir +pub fn caller() { + // CHECK-LABEL: fn caller( + // CHECK: callee() + callee(); +} diff --git a/tests/mir-opt/inline/unchecked_shifts.rs b/tests/mir-opt/inline/unchecked_shifts.rs index 0de80641c9c3..2fd18f3d5ebe 100644 --- a/tests/mir-opt/inline/unchecked_shifts.rs +++ b/tests/mir-opt/inline/unchecked_shifts.rs @@ -2,8 +2,8 @@ #![crate_type = "lib"] #![feature(unchecked_shifts)] -// ignore-debug: the debug assertions prevent the inlining we are testing for -// compile-flags: -Zmir-opt-level=2 -Zinline-mir +//@ ignore-debug: the debug assertions prevent the inlining we are testing for +//@ compile-flags: -Zmir-opt-level=2 -Zinline-mir // EMIT_MIR unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.diff // EMIT_MIR unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.mir diff --git a/tests/mir-opt/inline/unit_test.rs b/tests/mir-opt/inline/unit_test.rs index 0d877bb10b42..f6c3d6a58de0 100644 --- a/tests/mir-opt/inline/unit_test.rs +++ b/tests/mir-opt/inline/unit_test.rs @@ -1,5 +1,5 @@ // Check that `-Zmir-enable-passes=+Inline` does not ICE because of stolen MIR. -// unit-test: Inline +//@ unit-test: Inline // skip-filecheck #![crate_type = "lib"] diff --git a/tests/mir-opt/inline/unsized_argument.rs b/tests/mir-opt/inline/unsized_argument.rs index e8c2bc10be22..281f7fe77538 100644 --- a/tests/mir-opt/inline/unsized_argument.rs +++ b/tests/mir-opt/inline/unsized_argument.rs @@ -1,4 +1,4 @@ -// needs-unwind +//@ needs-unwind #![feature(unsized_fn_params)] #[inline(always)] diff --git a/tests/mir-opt/inline/unwrap_unchecked.rs b/tests/mir-opt/inline/unwrap_unchecked.rs index 1adf2224d976..e44e4e23a2c0 100644 --- a/tests/mir-opt/inline/unwrap_unchecked.rs +++ b/tests/mir-opt/inline/unwrap_unchecked.rs @@ -1,8 +1,8 @@ #![crate_type = "lib"] // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// ignore-debug: the debug assertions prevent the inlining we are testing for -// compile-flags: -Zmir-opt-level=2 -Zinline-mir -Cdebug-assertions=no +//@ ignore-debug: the debug assertions prevent the inlining we are testing for +//@ compile-flags: -Zmir-opt-level=2 -Zinline-mir -Cdebug-assertions=no // EMIT_MIR unwrap_unchecked.unwrap_unchecked.Inline.diff // EMIT_MIR unwrap_unchecked.unwrap_unchecked.PreCodegen.after.mir diff --git a/tests/mir-opt/inline_generically_if_sized.rs b/tests/mir-opt/inline_generically_if_sized.rs index 1a7512a4b8d1..794ce3dabbca 100644 --- a/tests/mir-opt/inline_generically_if_sized.rs +++ b/tests/mir-opt/inline_generically_if_sized.rs @@ -1,6 +1,6 @@ // skip-filecheck -// unit-test: Inline -// compile-flags: --crate-type=lib -C panic=abort +//@ unit-test: Inline +//@ compile-flags: --crate-type=lib -C panic=abort trait Foo { fn bar(&self) -> i32; diff --git a/tests/mir-opt/instrument_coverage.rs b/tests/mir-opt/instrument_coverage.rs index f131fc0a3241..010f7bf4d80b 100644 --- a/tests/mir-opt/instrument_coverage.rs +++ b/tests/mir-opt/instrument_coverage.rs @@ -2,10 +2,10 @@ // Test that `-C instrument-coverage` injects Coverage statements. The Coverage Counter statements // are later converted into LLVM instrprof.increment intrinsics, during codegen. -// unit-test: InstrumentCoverage -// needs-profiler-support -// ignore-windows -// compile-flags: -C instrument-coverage --remap-path-prefix={{src-base}}=/the/src +//@ unit-test: InstrumentCoverage +//@ needs-profiler-support +//@ ignore-windows +//@ compile-flags: -C instrument-coverage --remap-path-prefix={{src-base}}=/the/src // EMIT_MIR instrument_coverage.main.InstrumentCoverage.diff // EMIT_MIR instrument_coverage.bar.InstrumentCoverage.diff diff --git a/tests/mir-opt/instsimplify/bool_compare.rs b/tests/mir-opt/instsimplify/bool_compare.rs index 77f427b0d7c8..47984edd669f 100644 --- a/tests/mir-opt/instsimplify/bool_compare.rs +++ b/tests/mir-opt/instsimplify/bool_compare.rs @@ -1,4 +1,4 @@ -// unit-test: InstSimplify +//@ unit-test: InstSimplify // EMIT_MIR bool_compare.eq_true.InstSimplify.diff fn eq_true(x: bool) -> u32 { diff --git a/tests/mir-opt/instsimplify/casts.rs b/tests/mir-opt/instsimplify/casts.rs index 86f9b34ea047..adcf325e3f5c 100644 --- a/tests/mir-opt/instsimplify/casts.rs +++ b/tests/mir-opt/instsimplify/casts.rs @@ -1,5 +1,5 @@ -// unit-test: InstSimplify -// compile-flags: -Zinline-mir +//@ unit-test: InstSimplify +//@ compile-flags: -Zinline-mir #![crate_type = "lib"] #[inline(always)] diff --git a/tests/mir-opt/instsimplify/combine_array_len.rs b/tests/mir-opt/instsimplify/combine_array_len.rs index 3b6795bc9430..4b4054a7a2d6 100644 --- a/tests/mir-opt/instsimplify/combine_array_len.rs +++ b/tests/mir-opt/instsimplify/combine_array_len.rs @@ -1,5 +1,5 @@ // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// unit-test: InstSimplify +//@ unit-test: InstSimplify // EMIT_MIR combine_array_len.norm2.InstSimplify.diff fn norm2(x: [f32; 2]) -> f32 { diff --git a/tests/mir-opt/instsimplify/combine_clone_of_primitives.rs b/tests/mir-opt/instsimplify/combine_clone_of_primitives.rs index 2adbe778d232..d0c85595dbcf 100644 --- a/tests/mir-opt/instsimplify/combine_clone_of_primitives.rs +++ b/tests/mir-opt/instsimplify/combine_clone_of_primitives.rs @@ -1,4 +1,4 @@ -// unit-test: InstSimplify +//@ unit-test: InstSimplify // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // EMIT_MIR combine_clone_of_primitives.{impl#0}-clone.InstSimplify.diff diff --git a/tests/mir-opt/instsimplify/combine_transmutes.rs b/tests/mir-opt/instsimplify/combine_transmutes.rs index b8e15da905bd..7f45ebf2c863 100644 --- a/tests/mir-opt/instsimplify/combine_transmutes.rs +++ b/tests/mir-opt/instsimplify/combine_transmutes.rs @@ -1,5 +1,5 @@ -// unit-test: InstSimplify -// compile-flags: -C panic=abort +//@ unit-test: InstSimplify +//@ compile-flags: -C panic=abort #![crate_type = "lib"] #![feature(core_intrinsics)] diff --git a/tests/mir-opt/instsimplify/duplicate_switch_targets.rs b/tests/mir-opt/instsimplify/duplicate_switch_targets.rs index e40bc7edaac7..fd09d632a4f0 100644 --- a/tests/mir-opt/instsimplify/duplicate_switch_targets.rs +++ b/tests/mir-opt/instsimplify/duplicate_switch_targets.rs @@ -1,4 +1,4 @@ -// unit-test: InstSimplify +//@ unit-test: InstSimplify #![feature(custom_mir, core_intrinsics)] #![crate_type = "lib"] diff --git a/tests/mir-opt/instsimplify/intrinsic_asserts.rs b/tests/mir-opt/instsimplify/intrinsic_asserts.rs index 43998b2dbf02..c14b1ac5a218 100644 --- a/tests/mir-opt/instsimplify/intrinsic_asserts.rs +++ b/tests/mir-opt/instsimplify/intrinsic_asserts.rs @@ -1,4 +1,4 @@ -// unit-test: InstSimplify +//@ unit-test: InstSimplify #![crate_type = "lib"] #![feature(core_intrinsics)] diff --git a/tests/mir-opt/issue_101973.rs b/tests/mir-opt/issue_101973.rs index 83a4dfb20b52..c40eaa1f2a9b 100644 --- a/tests/mir-opt/issue_101973.rs +++ b/tests/mir-opt/issue_101973.rs @@ -1,6 +1,6 @@ // skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// compile-flags: -O -C debug-assertions=on +//@ compile-flags: -O -C debug-assertions=on // This needs inlining followed by GVN to reproduce, so we cannot use "unit-test". #[inline] diff --git a/tests/mir-opt/issue_72181.rs b/tests/mir-opt/issue_72181.rs index 226709bab2fe..3748c2af83d2 100644 --- a/tests/mir-opt/issue_72181.rs +++ b/tests/mir-opt/issue_72181.rs @@ -1,5 +1,5 @@ // skip-filecheck -// compile-flags: -Z mir-opt-level=1 +//@ compile-flags: -Z mir-opt-level=1 // Regression test for #72181, this ICE requires `-Z mir-opt-level=1` flags. use std::mem; diff --git a/tests/mir-opt/issue_72181_1.rs b/tests/mir-opt/issue_72181_1.rs index f9ee33ef991d..32e946559d77 100644 --- a/tests/mir-opt/issue_72181_1.rs +++ b/tests/mir-opt/issue_72181_1.rs @@ -1,5 +1,5 @@ // skip-filecheck -// compile-flags: -Z mir-opt-level=1 +//@ compile-flags: -Z mir-opt-level=1 // Regression test for #72181, this ICE requires `-Z mir-opt-level=1` flags. #![feature(never_type)] diff --git a/tests/mir-opt/issue_76432.rs b/tests/mir-opt/issue_76432.rs index f0f12c535c5b..be5ccbd49e24 100644 --- a/tests/mir-opt/issue_76432.rs +++ b/tests/mir-opt/issue_76432.rs @@ -1,6 +1,6 @@ // skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// compile-flags: -Zmir-enable-passes=-NormalizeArrayLen +//@ compile-flags: -Zmir-enable-passes=-NormalizeArrayLen // Check that we do not insert StorageDead at each target if StorageDead was never seen // EMIT_MIR issue_76432.test.SimplifyComparisonIntegral.diff diff --git a/tests/mir-opt/issue_78192.rs b/tests/mir-opt/issue_78192.rs index b08c3615e8b1..857b1dec951e 100644 --- a/tests/mir-opt/issue_78192.rs +++ b/tests/mir-opt/issue_78192.rs @@ -1,5 +1,5 @@ // skip-filecheck -// compile-flags: -Zmir-opt-level=1 -Zinline-mir +//@ compile-flags: -Zmir-opt-level=1 -Zinline-mir pub fn f(a: &T) -> *const T { let b: &*const T = &(a as *const T); *b diff --git a/tests/mir-opt/issue_91633.rs b/tests/mir-opt/issue_91633.rs index 047a0cd9bdbd..f7d59f5adfb6 100644 --- a/tests/mir-opt/issue_91633.rs +++ b/tests/mir-opt/issue_91633.rs @@ -1,5 +1,5 @@ // skip-filecheck -// compile-flags: -Z mir-opt-level=0 +//@ compile-flags: -Z mir-opt-level=0 // EMIT_MIR issue_91633.hey.built.after.mir fn hey (it: &[T]) where diff --git a/tests/mir-opt/issues/issue_59352.rs b/tests/mir-opt/issues/issue_59352.rs index 1cbeaec28bb2..5c06b7e56f71 100644 --- a/tests/mir-opt/issues/issue_59352.rs +++ b/tests/mir-opt/issues/issue_59352.rs @@ -9,7 +9,7 @@ // removed. // EMIT_MIR issue_59352.num_to_digit.PreCodegen.after.mir -// compile-flags: -Z mir-opt-level=3 -Z span_free_formats +//@ compile-flags: -Z mir-opt-level=3 -Z span_free_formats pub fn num_to_digit(num: char) -> u32 { // CHECK-NOT: panic diff --git a/tests/mir-opt/issues/issue_75439.rs b/tests/mir-opt/issues/issue_75439.rs index 0ab496e474d8..8c710a33aa8e 100644 --- a/tests/mir-opt/issues/issue_75439.rs +++ b/tests/mir-opt/issues/issue_75439.rs @@ -1,6 +1,6 @@ // skip-filecheck // EMIT_MIR issue_75439.foo.MatchBranchSimplification.diff -// ignore-endian-big +//@ ignore-endian-big use std::mem::transmute; diff --git a/tests/mir-opt/jump_threading.rs b/tests/mir-opt/jump_threading.rs index 512aebd857a6..eedb26ad41a5 100644 --- a/tests/mir-opt/jump_threading.rs +++ b/tests/mir-opt/jump_threading.rs @@ -1,5 +1,5 @@ -// unit-test: JumpThreading -// compile-flags: -Zmir-enable-passes=+Inline +//@ unit-test: JumpThreading +//@ compile-flags: -Zmir-enable-passes=+Inline // EMIT_MIR_FOR_EACH_PANIC_STRATEGY #![feature(control_flow_enum)] diff --git a/tests/mir-opt/loop_test.rs b/tests/mir-opt/loop_test.rs index 81a0d9df0a0a..bc9b65961070 100644 --- a/tests/mir-opt/loop_test.rs +++ b/tests/mir-opt/loop_test.rs @@ -1,5 +1,5 @@ // skip-filecheck -// compile-flags: -Z identify_regions +//@ compile-flags: -Z identify_regions // Tests to make sure we correctly generate falseUnwind edges in loops diff --git a/tests/mir-opt/lower_array_len.rs b/tests/mir-opt/lower_array_len.rs index effd83b6af03..7fcea75aaaf4 100644 --- a/tests/mir-opt/lower_array_len.rs +++ b/tests/mir-opt/lower_array_len.rs @@ -1,6 +1,6 @@ // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// unit-test: NormalizeArrayLen -// compile-flags: -Zmir-enable-passes=+LowerSliceLenCalls +//@ unit-test: NormalizeArrayLen +//@ compile-flags: -Zmir-enable-passes=+LowerSliceLenCalls // EMIT_MIR lower_array_len.array_bound.NormalizeArrayLen.diff pub fn array_bound(index: usize, slice: &[u8; N]) -> u8 { diff --git a/tests/mir-opt/lower_intrinsics.rs b/tests/mir-opt/lower_intrinsics.rs index cba2bc18d867..278ddfce1c33 100644 --- a/tests/mir-opt/lower_intrinsics.rs +++ b/tests/mir-opt/lower_intrinsics.rs @@ -1,4 +1,4 @@ -// unit-test: LowerIntrinsics +//@ unit-test: LowerIntrinsics // EMIT_MIR_FOR_EACH_PANIC_STRATEGY #![feature(core_intrinsics, intrinsics, rustc_attrs)] diff --git a/tests/mir-opt/lower_slice_len.rs b/tests/mir-opt/lower_slice_len.rs index 7b967a16588c..38d5e984cee7 100644 --- a/tests/mir-opt/lower_slice_len.rs +++ b/tests/mir-opt/lower_slice_len.rs @@ -1,4 +1,4 @@ -// unit-test: LowerSliceLenCalls +//@ unit-test: LowerSliceLenCalls // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // EMIT_MIR lower_slice_len.bound.LowerSliceLenCalls.diff diff --git a/tests/mir-opt/matches_reduce_branches.rs b/tests/mir-opt/matches_reduce_branches.rs index 13db79734143..4bf14e5a7bd0 100644 --- a/tests/mir-opt/matches_reduce_branches.rs +++ b/tests/mir-opt/matches_reduce_branches.rs @@ -1,5 +1,5 @@ // skip-filecheck -// unit-test: MatchBranchSimplification +//@ unit-test: MatchBranchSimplification // EMIT_MIR matches_reduce_branches.foo.MatchBranchSimplification.diff diff --git a/tests/mir-opt/matches_u8.rs b/tests/mir-opt/matches_u8.rs index 47c4ffee0246..e855c913226a 100644 --- a/tests/mir-opt/matches_u8.rs +++ b/tests/mir-opt/matches_u8.rs @@ -1,5 +1,5 @@ // skip-filecheck -// unit-test: MatchBranchSimplification +//@ unit-test: MatchBranchSimplification // EMIT_MIR matches_u8.exhaustive_match.MatchBranchSimplification.diff diff --git a/tests/mir-opt/multiple_return_terminators.rs b/tests/mir-opt/multiple_return_terminators.rs index f33243ecf730..8d83082a829e 100644 --- a/tests/mir-opt/multiple_return_terminators.rs +++ b/tests/mir-opt/multiple_return_terminators.rs @@ -1,5 +1,5 @@ // skip-filecheck -// compile-flags: -Z mir-opt-level=4 +//@ compile-flags: -Z mir-opt-level=4 // EMIT_MIR multiple_return_terminators.test.MultipleReturnTerminators.diff fn test(x: bool) { diff --git a/tests/mir-opt/nll/named_lifetimes_basic.rs b/tests/mir-opt/nll/named_lifetimes_basic.rs index bb22ce0ed955..cc8385370038 100644 --- a/tests/mir-opt/nll/named_lifetimes_basic.rs +++ b/tests/mir-opt/nll/named_lifetimes_basic.rs @@ -4,7 +4,7 @@ // suitable variables and that we setup the outlives relationship // between R0 and R1 properly. -// compile-flags: -Zverbose-internals +//@ compile-flags: -Zverbose-internals // ^^^^^^^^^^^^^^^^^^^ force compiler to dump more region information #![allow(warnings)] diff --git a/tests/mir-opt/nll/region_subtyping_basic.rs b/tests/mir-opt/nll/region_subtyping_basic.rs index 940f8d173444..ee74f7af2eb7 100644 --- a/tests/mir-opt/nll/region_subtyping_basic.rs +++ b/tests/mir-opt/nll/region_subtyping_basic.rs @@ -3,7 +3,7 @@ // in the type of `p` includes the points after `&v[0]` up to (but not // including) the call to `use_x`. The `else` branch is not included. -// compile-flags:-Zverbose-internals +//@ compile-flags:-Zverbose-internals // ^^^^^^^^^^^^^^^^^^^ force compiler to dump more region information #![allow(warnings)] diff --git a/tests/mir-opt/nrvo_miscompile_111005.rs b/tests/mir-opt/nrvo_miscompile_111005.rs index aff037ae4f29..3087c98d0528 100644 --- a/tests/mir-opt/nrvo_miscompile_111005.rs +++ b/tests/mir-opt/nrvo_miscompile_111005.rs @@ -1,7 +1,7 @@ // skip-filecheck // This is a miscompilation, #111005 to track -// unit-test: RenameReturnPlace +//@ unit-test: RenameReturnPlace #![feature(custom_mir, core_intrinsics)] extern crate core; diff --git a/tests/mir-opt/nrvo_simple.rs b/tests/mir-opt/nrvo_simple.rs index 5b403c560a7e..adb787a09fb6 100644 --- a/tests/mir-opt/nrvo_simple.rs +++ b/tests/mir-opt/nrvo_simple.rs @@ -1,6 +1,6 @@ // skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// unit-test: RenameReturnPlace +//@ unit-test: RenameReturnPlace // EMIT_MIR nrvo_simple.nrvo.RenameReturnPlace.diff fn nrvo(init: fn(&mut [u8; 1024])) -> [u8; 1024] { diff --git a/tests/mir-opt/pre-codegen/chained_comparison.rs b/tests/mir-opt/pre-codegen/chained_comparison.rs index d1d400af22f4..4869f1e01a02 100644 --- a/tests/mir-opt/pre-codegen/chained_comparison.rs +++ b/tests/mir-opt/pre-codegen/chained_comparison.rs @@ -1,5 +1,5 @@ // skip-filecheck -// compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=2 +//@ compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=2 #![crate_type = "lib"] diff --git a/tests/mir-opt/pre-codegen/checked_ops.rs b/tests/mir-opt/pre-codegen/checked_ops.rs index d386219f4a6b..d36502d35478 100644 --- a/tests/mir-opt/pre-codegen/checked_ops.rs +++ b/tests/mir-opt/pre-codegen/checked_ops.rs @@ -1,7 +1,7 @@ // skip-filecheck -// compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=2 -// needs-unwind -// only-x86_64 +//@ compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=2 +//@ needs-unwind +//@ only-x86_64 #![crate_type = "lib"] #![feature(step_trait)] diff --git a/tests/mir-opt/pre-codegen/duplicate_switch_targets.rs b/tests/mir-opt/pre-codegen/duplicate_switch_targets.rs index b1a00d293725..67540676f4a5 100644 --- a/tests/mir-opt/pre-codegen/duplicate_switch_targets.rs +++ b/tests/mir-opt/pre-codegen/duplicate_switch_targets.rs @@ -1,6 +1,6 @@ // skip-filecheck -// compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=0 -// ignore-debug: standard library debug assertions add a panic that breaks this optimization +//@ compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=0 +//@ ignore-debug: standard library debug assertions add a panic that breaks this optimization #![crate_type = "lib"] diff --git a/tests/mir-opt/pre-codegen/intrinsics.rs b/tests/mir-opt/pre-codegen/intrinsics.rs index 565bd89e5716..ed7320cd3c4d 100644 --- a/tests/mir-opt/pre-codegen/intrinsics.rs +++ b/tests/mir-opt/pre-codegen/intrinsics.rs @@ -1,10 +1,10 @@ // skip-filecheck -// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2 -// only-64bit +//@ compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2 +//@ only-64bit // Checks that we do not have any branches in the MIR for the two tested functions. -// compile-flags: -Cpanic=abort +//@ compile-flags: -Cpanic=abort #![feature(core_intrinsics)] #![crate_type = "lib"] diff --git a/tests/mir-opt/pre-codegen/loops.rs b/tests/mir-opt/pre-codegen/loops.rs index 9412c3f234e3..2d179abc9f31 100644 --- a/tests/mir-opt/pre-codegen/loops.rs +++ b/tests/mir-opt/pre-codegen/loops.rs @@ -1,7 +1,7 @@ // skip-filecheck -// compile-flags: -O -Zmir-opt-level=2 -g -// needs-unwind -// only-64bit +//@ compile-flags: -O -Zmir-opt-level=2 -g +//@ needs-unwind +//@ only-64bit #![crate_type = "lib"] diff --git a/tests/mir-opt/pre-codegen/mem_replace.rs b/tests/mir-opt/pre-codegen/mem_replace.rs index 551afea3ba5a..535c1062669a 100644 --- a/tests/mir-opt/pre-codegen/mem_replace.rs +++ b/tests/mir-opt/pre-codegen/mem_replace.rs @@ -1,7 +1,7 @@ // skip-filecheck -// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2 -Zinline-mir -// only-64bit -// ignore-debug the standard library debug assertions leak into this test +//@ compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2 -Zinline-mir +//@ only-64bit +//@ ignore-debug the standard library debug assertions leak into this test // EMIT_MIR_FOR_EACH_PANIC_STRATEGY #![crate_type = "lib"] diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.rs b/tests/mir-opt/pre-codegen/optimizes_into_variable.rs index fb634ca85ef0..7a1fb1e76c03 100644 --- a/tests/mir-opt/pre-codegen/optimizes_into_variable.rs +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.rs @@ -1,6 +1,6 @@ // skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// compile-flags: -C overflow-checks=on +//@ compile-flags: -C overflow-checks=on struct Point { x: u32, diff --git a/tests/mir-opt/pre-codegen/range_iter.rs b/tests/mir-opt/pre-codegen/range_iter.rs index 80b1a5b2fa5e..fe7d0e67f7a1 100644 --- a/tests/mir-opt/pre-codegen/range_iter.rs +++ b/tests/mir-opt/pre-codegen/range_iter.rs @@ -1,6 +1,6 @@ // skip-filecheck -// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2 -// only-64bit +//@ compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2 +//@ only-64bit // EMIT_MIR_FOR_EACH_PANIC_STRATEGY #![crate_type = "lib"] diff --git a/tests/mir-opt/pre-codegen/simple_option_map.rs b/tests/mir-opt/pre-codegen/simple_option_map.rs index 35f9ab3e154c..c563f6af2a53 100644 --- a/tests/mir-opt/pre-codegen/simple_option_map.rs +++ b/tests/mir-opt/pre-codegen/simple_option_map.rs @@ -1,6 +1,6 @@ // skip-filecheck -// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2 -// only-64bit +//@ compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2 +//@ only-64bit #[inline(always)] fn map(slf: Option, f: F) -> Option diff --git a/tests/mir-opt/pre-codegen/slice_filter.rs b/tests/mir-opt/pre-codegen/slice_filter.rs index 483e5876615f..35881ff2b18c 100644 --- a/tests/mir-opt/pre-codegen/slice_filter.rs +++ b/tests/mir-opt/pre-codegen/slice_filter.rs @@ -1,6 +1,5 @@ // skip-filecheck -// compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=2 -// ignore-debug: standard library debug assertions add a panic that breaks this optimization +//@ compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=2 #![crate_type = "lib"] diff --git a/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir index 7370da5629c1..65cac0a81ef1 100644 --- a/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir @@ -1,6 +1,6 @@ // MIR for `variant_a::{closure#0}` after PreCodegen -fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:8:25: 8:39}, _2: &&(usize, usize, usize, usize)) -> bool { +fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2: &&(usize, usize, usize, usize)) -> bool { let mut _0: bool; let mut _3: &(usize, usize, usize, usize); let _4: &usize; diff --git a/tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir index 5477796512c5..d9e118d879a6 100644 --- a/tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir @@ -1,6 +1,6 @@ // MIR for `variant_b::{closure#0}` after PreCodegen -fn variant_b::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:12:25: 12:41}, _2: &&(usize, usize, usize, usize)) -> bool { +fn variant_b::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:11:25: 11:41}, _2: &&(usize, usize, usize, usize)) -> bool { let mut _0: bool; let mut _3: &(usize, usize, usize, usize); let _4: usize; diff --git a/tests/mir-opt/pre-codegen/slice_index.rs b/tests/mir-opt/pre-codegen/slice_index.rs index 5225fc5c6e18..80bbffbd097d 100644 --- a/tests/mir-opt/pre-codegen/slice_index.rs +++ b/tests/mir-opt/pre-codegen/slice_index.rs @@ -1,7 +1,7 @@ // skip-filecheck -// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2 -// only-64bit -// ignore-debug the standard library debug assertions leak into this test +//@ compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2 +//@ only-64bit +//@ ignore-debug the standard library debug assertions leak into this test // EMIT_MIR_FOR_EACH_PANIC_STRATEGY #![crate_type = "lib"] diff --git a/tests/mir-opt/pre-codegen/slice_iter.rs b/tests/mir-opt/pre-codegen/slice_iter.rs index 10a5c3070d89..0269eb39ddf0 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.rs +++ b/tests/mir-opt/pre-codegen/slice_iter.rs @@ -1,7 +1,7 @@ // skip-filecheck -// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2 -// only-64bit -// ignore-debug the standard library debug assertions leak into this test +//@ compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2 +//@ only-64bit +//@ ignore-debug the standard library debug assertions leak into this test // EMIT_MIR_FOR_EACH_PANIC_STRATEGY #![crate_type = "lib"] diff --git a/tests/mir-opt/pre-codegen/spans.rs b/tests/mir-opt/pre-codegen/spans.rs index aa36648ce395..4d3dc7ec3e59 100644 --- a/tests/mir-opt/pre-codegen/spans.rs +++ b/tests/mir-opt/pre-codegen/spans.rs @@ -2,7 +2,7 @@ // Test that the comments we emit in MIR opts are accurate. // // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// compile-flags: -Zmir-include-spans +//@ compile-flags: -Zmir-include-spans #![crate_type = "lib"] diff --git a/tests/mir-opt/pre-codegen/try_identity.rs b/tests/mir-opt/pre-codegen/try_identity.rs index b6e4eaad7e1d..9da02d65e159 100644 --- a/tests/mir-opt/pre-codegen/try_identity.rs +++ b/tests/mir-opt/pre-codegen/try_identity.rs @@ -1,6 +1,6 @@ // skip-filecheck -// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2 -// only-64bit +//@ compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2 +//@ only-64bit // Track the status of MIR optimizations simplifying `Ok(res?)` for both the old and new desugarings // of that syntax. diff --git a/tests/mir-opt/reference_prop.rs b/tests/mir-opt/reference_prop.rs index b71ad90abb19..70587dff0b54 100644 --- a/tests/mir-opt/reference_prop.rs +++ b/tests/mir-opt/reference_prop.rs @@ -1,6 +1,6 @@ -// compile-flags: -Zlint-mir=no -// unit-test: ReferencePropagation -// needs-unwind +//@ compile-flags: -Zlint-mir=no +//@ unit-test: ReferencePropagation +//@ needs-unwind #![feature(raw_ref_op)] #![feature(core_intrinsics, custom_mir)] diff --git a/tests/mir-opt/remove_storage_markers.rs b/tests/mir-opt/remove_storage_markers.rs index 27661ab32541..c53c38750452 100644 --- a/tests/mir-opt/remove_storage_markers.rs +++ b/tests/mir-opt/remove_storage_markers.rs @@ -1,9 +1,9 @@ // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// unit-test: RemoveStorageMarkers +//@ unit-test: RemoveStorageMarkers // Checks that storage markers are removed at opt-level=0. // -// compile-flags: -C opt-level=0 -Coverflow-checks=off +//@ compile-flags: -C opt-level=0 -Coverflow-checks=off // EMIT_MIR remove_storage_markers.main.RemoveStorageMarkers.diff fn main() { diff --git a/tests/mir-opt/retag.rs b/tests/mir-opt/retag.rs index 554b8ece90f2..0f2659ebfe85 100644 --- a/tests/mir-opt/retag.rs +++ b/tests/mir-opt/retag.rs @@ -1,8 +1,8 @@ // skip-filecheck -// unit-test: AddRetag +//@ unit-test: AddRetag // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // ignore-tidy-linelength -// compile-flags: -Z mir-emit-retag -Z mir-opt-level=0 -Z span_free_formats +//@ compile-flags: -Z mir-emit-retag -Z mir-opt-level=0 -Z span_free_formats #![allow(unused)] diff --git a/tests/mir-opt/separate_const_switch.rs b/tests/mir-opt/separate_const_switch.rs index bad61d97475a..5e8371b3e490 100644 --- a/tests/mir-opt/separate_const_switch.rs +++ b/tests/mir-opt/separate_const_switch.rs @@ -2,7 +2,7 @@ #![feature(control_flow_enum)] #![feature(try_trait_v2)] -// compile-flags: -Zunsound-mir-opts +//@ compile-flags: -Zunsound-mir-opts use std::ops::ControlFlow; diff --git a/tests/mir-opt/set_no_discriminant.rs b/tests/mir-opt/set_no_discriminant.rs index 8ffb9a2910ab..995bd11a1a92 100644 --- a/tests/mir-opt/set_no_discriminant.rs +++ b/tests/mir-opt/set_no_discriminant.rs @@ -1,6 +1,6 @@ // `SetDiscriminant` does not actually write anything if the chosen variant is the untagged variant // of a niche encoding. Verify that we do not thread over this case. -// unit-test: JumpThreading +//@ unit-test: JumpThreading #![feature(custom_mir)] #![feature(core_intrinsics)] diff --git a/tests/mir-opt/simplify_arm.rs b/tests/mir-opt/simplify_arm.rs index e933cb987d87..5d9c31121dda 100644 --- a/tests/mir-opt/simplify_arm.rs +++ b/tests/mir-opt/simplify_arm.rs @@ -1,5 +1,5 @@ // skip-filecheck -// compile-flags: -Z mir-opt-level=3 -Zunsound-mir-opts +//@ compile-flags: -Z mir-opt-level=3 -Zunsound-mir-opts // EMIT_MIR simplify_arm.id.SimplifyArmIdentity.diff // EMIT_MIR simplify_arm.id.SimplifyBranchSame.diff // EMIT_MIR simplify_arm.id_result.SimplifyArmIdentity.diff @@ -7,7 +7,7 @@ // EMIT_MIR simplify_arm.id_try.SimplifyArmIdentity.diff // EMIT_MIR simplify_arm.id_try.SimplifyBranchSame.diff -// ignore-test This pass is broken since deaggregation changed +//@ ignore-test This pass is broken since deaggregation changed fn id(o: Option) -> Option { match o { diff --git a/tests/mir-opt/simplify_arm_identity.rs b/tests/mir-opt/simplify_arm_identity.rs index 1b546c3938ea..79395b312ace 100644 --- a/tests/mir-opt/simplify_arm_identity.rs +++ b/tests/mir-opt/simplify_arm_identity.rs @@ -2,10 +2,10 @@ // Checks that `SimplifyArmIdentity` is not applied if enums have incompatible layouts. // Regression test for issue #66856. // -// compile-flags: -Zmir-opt-level=3 +//@ compile-flags: -Zmir-opt-level=3 // EMIT_MIR_FOR_EACH_BIT_WIDTH -// ignore-test This pass is broken since deaggregation changed +//@ ignore-test This pass is broken since deaggregation changed enum Src { Foo(u8), diff --git a/tests/mir-opt/simplify_cfg.rs b/tests/mir-opt/simplify_cfg.rs index a87aaca544ce..8dea0e50a61b 100644 --- a/tests/mir-opt/simplify_cfg.rs +++ b/tests/mir-opt/simplify_cfg.rs @@ -1,7 +1,7 @@ // skip-filecheck // Test that the goto chain starting from bb0 is collapsed. -// compile-flags: -Cpanic=abort -// no-prefer-dynamic +//@ compile-flags: -Cpanic=abort +//@ no-prefer-dynamic // EMIT_MIR simplify_cfg.main.SimplifyCfg-initial.diff // EMIT_MIR simplify_cfg.main.SimplifyCfg-early-opt.diff diff --git a/tests/mir-opt/simplify_duplicate_unreachable_blocks.rs b/tests/mir-opt/simplify_duplicate_unreachable_blocks.rs index 5c4277898cd0..d94e61118556 100644 --- a/tests/mir-opt/simplify_duplicate_unreachable_blocks.rs +++ b/tests/mir-opt/simplify_duplicate_unreachable_blocks.rs @@ -4,7 +4,7 @@ use std::intrinsics::mir::*; -// unit-test: SimplifyCfg-after-uninhabited-enum-branching +//@ unit-test: SimplifyCfg-after-uninhabited-enum-branching // EMIT_MIR simplify_duplicate_unreachable_blocks.assert_nonzero_nonmax.SimplifyCfg-after-uninhabited-enum-branching.diff #[custom_mir(dialect = "runtime", phase = "post-cleanup")] diff --git a/tests/mir-opt/simplify_locals.rs b/tests/mir-opt/simplify_locals.rs index d4052e521dea..f95e9185f448 100644 --- a/tests/mir-opt/simplify_locals.rs +++ b/tests/mir-opt/simplify_locals.rs @@ -1,5 +1,5 @@ // skip-filecheck -// unit-test: SimplifyLocals-before-const-prop +//@ unit-test: SimplifyLocals-before-const-prop #![feature(thread_local)] diff --git a/tests/mir-opt/simplify_locals_fixedpoint.rs b/tests/mir-opt/simplify_locals_fixedpoint.rs index b0c6e2d8eb59..6947d31dc3e1 100644 --- a/tests/mir-opt/simplify_locals_fixedpoint.rs +++ b/tests/mir-opt/simplify_locals_fixedpoint.rs @@ -1,6 +1,6 @@ // skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// compile-flags: -Zmir-opt-level=1 +//@ compile-flags: -Zmir-opt-level=1 fn foo() { if let (Some(a), None) = (Option::::None, Option::::None) { diff --git a/tests/mir-opt/simplify_locals_removes_unused_consts.rs b/tests/mir-opt/simplify_locals_removes_unused_consts.rs index 42879254d714..3a461647e362 100644 --- a/tests/mir-opt/simplify_locals_removes_unused_consts.rs +++ b/tests/mir-opt/simplify_locals_removes_unused_consts.rs @@ -1,7 +1,7 @@ // skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// unit-test: SimplifyLocals-before-const-prop -// compile-flags: -C overflow-checks=no +//@ unit-test: SimplifyLocals-before-const-prop +//@ compile-flags: -C overflow-checks=no fn use_zst(_: ((), ())) {} diff --git a/tests/mir-opt/simplify_locals_removes_unused_discriminant_reads.rs b/tests/mir-opt/simplify_locals_removes_unused_discriminant_reads.rs index 615b972209c3..52afb4f2c527 100644 --- a/tests/mir-opt/simplify_locals_removes_unused_discriminant_reads.rs +++ b/tests/mir-opt/simplify_locals_removes_unused_discriminant_reads.rs @@ -1,5 +1,5 @@ // skip-filecheck -// unit-test: SimplifyLocals-before-const-prop +//@ unit-test: SimplifyLocals-before-const-prop fn map(x: Option>) -> Option> { match x { diff --git a/tests/mir-opt/simplify_try_if_let.rs b/tests/mir-opt/simplify_try_if_let.rs index 3a59d78500ce..98df9a54abb3 100644 --- a/tests/mir-opt/simplify_try_if_let.rs +++ b/tests/mir-opt/simplify_try_if_let.rs @@ -1,6 +1,6 @@ // skip-filecheck -// compile-flags: -Zmir-opt-level=1 -Zunsound-mir-opts -// ignore-test +//@ compile-flags: -Zmir-opt-level=1 -Zunsound-mir-opts +//@ ignore-test // FIXME: the pass is unsound and causes ICEs in the MIR validator // EMIT_MIR simplify_try_if_let.{impl#0}-append.SimplifyArmIdentity.diff diff --git a/tests/mir-opt/slice_drop_shim.rs b/tests/mir-opt/slice_drop_shim.rs index 037e048b3b79..c2f4c82ecc86 100644 --- a/tests/mir-opt/slice_drop_shim.rs +++ b/tests/mir-opt/slice_drop_shim.rs @@ -1,5 +1,5 @@ // skip-filecheck -// compile-flags: -Zmir-opt-level=0 -Clink-dead-code +//@ compile-flags: -Zmir-opt-level=0 -Clink-dead-code // mir-opt tests are always built as rlibs so that they seamlessly cross-compile, // so this test only produces MIR for the drop_in_place we're looking for // if we use -Clink-dead-code. diff --git a/tests/mir-opt/sroa/lifetimes.rs b/tests/mir-opt/sroa/lifetimes.rs index ea04fac15710..3f5c99404d86 100644 --- a/tests/mir-opt/sroa/lifetimes.rs +++ b/tests/mir-opt/sroa/lifetimes.rs @@ -1,6 +1,6 @@ -// unit-test: ScalarReplacementOfAggregates -// compile-flags: -Cpanic=abort -// no-prefer-dynamic +//@ unit-test: ScalarReplacementOfAggregates +//@ compile-flags: -Cpanic=abort +//@ no-prefer-dynamic trait Err { type Err; diff --git a/tests/mir-opt/sroa/structs.rs b/tests/mir-opt/sroa/structs.rs index 5ea3795b86e2..cbe4b9895303 100644 --- a/tests/mir-opt/sroa/structs.rs +++ b/tests/mir-opt/sroa/structs.rs @@ -1,6 +1,6 @@ -// unit-test: ScalarReplacementOfAggregates -// compile-flags: -Cpanic=abort -// no-prefer-dynamic +//@ unit-test: ScalarReplacementOfAggregates +//@ compile-flags: -Cpanic=abort +//@ no-prefer-dynamic struct Tag(usize); diff --git a/tests/mir-opt/tls_access.rs b/tests/mir-opt/tls_access.rs index 450dd9b47302..3dfc85def99e 100644 --- a/tests/mir-opt/tls_access.rs +++ b/tests/mir-opt/tls_access.rs @@ -1,6 +1,6 @@ // skip-filecheck // EMIT_MIR tls_access.main.PreCodegen.after.mir -// compile-flags: -Zmir-opt-level=0 +//@ compile-flags: -Zmir-opt-level=0 #![feature(thread_local)] diff --git a/tests/mir-opt/uninhabited_enum_branching.rs b/tests/mir-opt/uninhabited_enum_branching.rs index 65552fb058a4..08eca57afc63 100644 --- a/tests/mir-opt/uninhabited_enum_branching.rs +++ b/tests/mir-opt/uninhabited_enum_branching.rs @@ -1,4 +1,4 @@ -// unit-test: UninhabitedEnumBranching +//@ unit-test: UninhabitedEnumBranching enum Empty {} // test matching an enum with uninhabited variants diff --git a/tests/mir-opt/unreachable.rs b/tests/mir-opt/unreachable.rs index 5b96681d9df5..b07b8230faf3 100644 --- a/tests/mir-opt/unreachable.rs +++ b/tests/mir-opt/unreachable.rs @@ -1,4 +1,4 @@ -// unit-test: UnreachablePropagation +//@ unit-test: UnreachablePropagation // EMIT_MIR_FOR_EACH_PANIC_STRATEGY enum Empty {} diff --git a/tests/mir-opt/unreachable_diverging.rs b/tests/mir-opt/unreachable_diverging.rs index b1df6f85262d..b7e0f6eff9bf 100644 --- a/tests/mir-opt/unreachable_diverging.rs +++ b/tests/mir-opt/unreachable_diverging.rs @@ -1,4 +1,4 @@ -// unit-test: UnreachablePropagation +//@ unit-test: UnreachablePropagation // EMIT_MIR_FOR_EACH_PANIC_STRATEGY pub enum Empty {} diff --git a/tests/mir-opt/unusual_item_types.rs b/tests/mir-opt/unusual_item_types.rs index fa6ba515473b..788475431044 100644 --- a/tests/mir-opt/unusual_item_types.rs +++ b/tests/mir-opt/unusual_item_types.rs @@ -1,7 +1,7 @@ // skip-filecheck // Test that we don't ICE when trying to dump MIR for unusual item types and // that we don't create filenames containing `<` and `>` -// compile-flags: -Zmir-opt-level=0 +//@ compile-flags: -Zmir-opt-level=0 struct A; diff --git a/tests/pretty/asm.pp b/tests/pretty/asm.pp index 5eade2933b82..e6c9545f51ee 100644 --- a/tests/pretty/asm.pp +++ b/tests/pretty/asm.pp @@ -4,9 +4,9 @@ use ::std::prelude::rust_2015::*; #[macro_use] extern crate std; -// pretty-mode:expanded -// pp-exact:asm.pp -// only-x86_64 +//@ pretty-mode:expanded +//@ pp-exact:asm.pp +//@ only-x86_64 use std::arch::asm; diff --git a/tests/pretty/asm.rs b/tests/pretty/asm.rs index 1a3f972c8f2e..4b8257f0ae12 100644 --- a/tests/pretty/asm.rs +++ b/tests/pretty/asm.rs @@ -1,6 +1,6 @@ -// pretty-mode:expanded -// pp-exact:asm.pp -// only-x86_64 +//@ pretty-mode:expanded +//@ pp-exact:asm.pp +//@ only-x86_64 use std::arch::asm; diff --git a/tests/pretty/ast-stmt-expr-attr.rs b/tests/pretty/ast-stmt-expr-attr.rs index a958666e3eea..fd7272a1b1fd 100644 --- a/tests/pretty/ast-stmt-expr-attr.rs +++ b/tests/pretty/ast-stmt-expr-attr.rs @@ -1,4 +1,4 @@ -// pp-exact +//@ pp-exact fn main() {} diff --git a/tests/pretty/async.rs b/tests/pretty/async.rs index 573e79bffd7e..17bb9abd7201 100644 --- a/tests/pretty/async.rs +++ b/tests/pretty/async.rs @@ -1,6 +1,6 @@ -// pp-exact -// pretty-compare-only -// edition:2021 +//@ pp-exact +//@ pretty-compare-only +//@ edition:2021 async fn f() { let first = async { 1 }; diff --git a/tests/pretty/attr-derive.rs b/tests/pretty/attr-derive.rs index 0eb403c6bc84..79b6ea514463 100644 --- a/tests/pretty/attr-derive.rs +++ b/tests/pretty/attr-derive.rs @@ -1,5 +1,5 @@ -// aux-build:derive-foo.rs -// pp-exact +//@ aux-build:derive-foo.rs +//@ pp-exact // Testing that both the inner item and next outer item are // preserved, and that the first outer item parsed in main is not // accidentally carried over to each inner function diff --git a/tests/pretty/attr-fn-inner.rs b/tests/pretty/attr-fn-inner.rs index 6d9cb89f0229..67537eccb07b 100644 --- a/tests/pretty/attr-fn-inner.rs +++ b/tests/pretty/attr-fn-inner.rs @@ -2,7 +2,7 @@ // preserved, and that the first outer item parsed in main is not // accidentally carried over to each inner function -// pp-exact +//@ pp-exact #![feature(rustc_attrs)] diff --git a/tests/pretty/attr-literals.rs b/tests/pretty/attr-literals.rs index d132014420df..6e5d6f035925 100644 --- a/tests/pretty/attr-literals.rs +++ b/tests/pretty/attr-literals.rs @@ -1,6 +1,6 @@ // Tests literals in attributes. -// pp-exact +//@ pp-exact #![feature(rustc_attrs)] diff --git a/tests/pretty/attr-tokens-raw-ident.rs b/tests/pretty/attr-tokens-raw-ident.rs index 8486342b0879..ce0027f282eb 100644 --- a/tests/pretty/attr-tokens-raw-ident.rs +++ b/tests/pretty/attr-tokens-raw-ident.rs @@ -1,7 +1,7 @@ // Keywords in attribute paths are printed as raw idents, // but keywords in attribute arguments are not. -// pp-exact +//@ pp-exact #[rustfmt::r#final(final)] fn main() {} diff --git a/tests/pretty/auto-trait.rs b/tests/pretty/auto-trait.rs index c3c47cff5eda..80d952599402 100644 --- a/tests/pretty/auto-trait.rs +++ b/tests/pretty/auto-trait.rs @@ -1,6 +1,6 @@ #![feature(auto_traits)] -// pp-exact +//@ pp-exact auto trait MyTrait {} diff --git a/tests/pretty/auxiliary/derive-foo.rs b/tests/pretty/auxiliary/derive-foo.rs index 675a93b3dad7..dc682beafade 100644 --- a/tests/pretty/auxiliary/derive-foo.rs +++ b/tests/pretty/auxiliary/derive-foo.rs @@ -1,5 +1,5 @@ -// force-host -// no-prefer-dynamic +//@ force-host +//@ no-prefer-dynamic #![crate_type = "proc-macro"] diff --git a/tests/pretty/blank-lines.rs b/tests/pretty/blank-lines.rs index b9153d0482c8..89a95fcda2de 100644 --- a/tests/pretty/blank-lines.rs +++ b/tests/pretty/blank-lines.rs @@ -1,6 +1,6 @@ -// compile-flags: --crate-type=lib +//@ compile-flags: --crate-type=lib -// pp-exact +//@ pp-exact fn f() -> [isize; 3] { let picard = 0; diff --git a/tests/pretty/block-comment-multiple-asterisks.rs b/tests/pretty/block-comment-multiple-asterisks.rs index bb090b746367..537924f786bd 100644 --- a/tests/pretty/block-comment-multiple-asterisks.rs +++ b/tests/pretty/block-comment-multiple-asterisks.rs @@ -1,6 +1,6 @@ -// compile-flags: --crate-type=lib +//@ compile-flags: --crate-type=lib -// pp-exact +//@ pp-exact /*** More than two asterisks means that it isn't a doc comment. */ diff --git a/tests/pretty/block-comment-trailing-whitespace.rs b/tests/pretty/block-comment-trailing-whitespace.rs index 4d502f603d1d..aac062869bfa 100644 --- a/tests/pretty/block-comment-trailing-whitespace.rs +++ b/tests/pretty/block-comment-trailing-whitespace.rs @@ -1,6 +1,6 @@ -// compile-flags: --crate-type=lib +//@ compile-flags: --crate-type=lib -// pp-exact +//@ pp-exact fn f() { /* The next line should not be indented. diff --git a/tests/pretty/block-comment-trailing-whitespace2.rs b/tests/pretty/block-comment-trailing-whitespace2.rs index e53d51e34cef..59cb6c06abe7 100644 --- a/tests/pretty/block-comment-trailing-whitespace2.rs +++ b/tests/pretty/block-comment-trailing-whitespace2.rs @@ -1,6 +1,6 @@ -// compile-flags: --crate-type=lib +//@ compile-flags: --crate-type=lib -// pp-exact +//@ pp-exact fn f() {} /* The next line should not be indented. diff --git a/tests/pretty/block-comment-wchar.pp b/tests/pretty/block-comment-wchar.pp index 9d64fb4156ca..863fe686d7d4 100644 --- a/tests/pretty/block-comment-wchar.pp +++ b/tests/pretty/block-comment-wchar.pp @@ -3,7 +3,7 @@ // Test via: rustc -Zunpretty normal tests/pretty/block-comment-wchar.rs // ignore-tidy-cr // ignore-tidy-tab -// pp-exact:block-comment-wchar.pp +//@ pp-exact:block-comment-wchar.pp fn f() { fn nested() { /* diff --git a/tests/pretty/block-comment-wchar.rs b/tests/pretty/block-comment-wchar.rs index c042ea685900..bf58192cd9b7 100644 --- a/tests/pretty/block-comment-wchar.rs +++ b/tests/pretty/block-comment-wchar.rs @@ -3,7 +3,7 @@ // Test via: rustc -Zunpretty normal tests/pretty/block-comment-wchar.rs // ignore-tidy-cr // ignore-tidy-tab -// pp-exact:block-comment-wchar.pp +//@ pp-exact:block-comment-wchar.pp fn f() { fn nested() { /* diff --git a/tests/pretty/block-disambig.rs b/tests/pretty/block-disambig.rs index ac9b84a5d7e3..33e51f3c2f5f 100644 --- a/tests/pretty/block-disambig.rs +++ b/tests/pretty/block-disambig.rs @@ -1,4 +1,4 @@ -// compile-flags: --crate-type=lib +//@ compile-flags: --crate-type=lib // A bunch of tests for syntactic forms involving blocks that were // previously ambiguous (e.g., 'if true { } *val;' gets parsed as a diff --git a/tests/pretty/cast-lt.pp b/tests/pretty/cast-lt.pp index 61cd8f59712f..f6155c9d827b 100644 --- a/tests/pretty/cast-lt.pp +++ b/tests/pretty/cast-lt.pp @@ -4,9 +4,9 @@ use ::std::prelude::rust_2015::*; #[macro_use] extern crate std; -// pretty-compare-only -// pretty-mode:expanded -// pp-exact:cast-lt.pp +//@ pretty-compare-only +//@ pretty-mode:expanded +//@ pp-exact:cast-lt.pp macro_rules! negative { ($e:expr) => { $e < 0 } } diff --git a/tests/pretty/cast-lt.rs b/tests/pretty/cast-lt.rs index e14bdd1f3b3e..96fff450dcfd 100644 --- a/tests/pretty/cast-lt.rs +++ b/tests/pretty/cast-lt.rs @@ -1,6 +1,6 @@ -// pretty-compare-only -// pretty-mode:expanded -// pp-exact:cast-lt.pp +//@ pretty-compare-only +//@ pretty-mode:expanded +//@ pp-exact:cast-lt.pp macro_rules! negative { ($e:expr) => { $e < 0 } diff --git a/tests/pretty/closure-reform-pretty.rs b/tests/pretty/closure-reform-pretty.rs index 1eba1e6bdec3..b4d0be472c97 100644 --- a/tests/pretty/closure-reform-pretty.rs +++ b/tests/pretty/closure-reform-pretty.rs @@ -1,7 +1,7 @@ // Any copyright is dedicated to the Public Domain. // http://creativecommons.org/publicdomain/zero/1.0/ -// pp-exact +//@ pp-exact fn call_it(f: Box String>) {} diff --git a/tests/pretty/delegation.rs b/tests/pretty/delegation.rs index 6a46437f7d63..2d0123363c50 100644 --- a/tests/pretty/delegation.rs +++ b/tests/pretty/delegation.rs @@ -1,7 +1,7 @@ #![feature(fn_delegation)] //~^ WARN the feature `fn_delegation` is incomplete -// pp-exact +//@ pp-exact trait Trait { fn bar(&self, x: i32) -> i32 { x } diff --git a/tests/pretty/delimited-token-groups.rs b/tests/pretty/delimited-token-groups.rs index b24c35bf0813..8160b9f41e6c 100644 --- a/tests/pretty/delimited-token-groups.rs +++ b/tests/pretty/delimited-token-groups.rs @@ -1,4 +1,4 @@ -// pp-exact +//@ pp-exact #![feature(rustc_attrs)] diff --git a/tests/pretty/disamb-stmt-expr.rs b/tests/pretty/disamb-stmt-expr.rs index 734f9fa123ee..7420e5401f27 100644 --- a/tests/pretty/disamb-stmt-expr.rs +++ b/tests/pretty/disamb-stmt-expr.rs @@ -1,4 +1,4 @@ -// pp-exact +//@ pp-exact // Here we check that the parentheses around the body of `wsucc()` are // preserved. They are needed to disambiguate `{return n+1}; - 0` from diff --git a/tests/pretty/do1.rs b/tests/pretty/do1.rs index 233ccdb0098b..dfcbbf78bc99 100644 --- a/tests/pretty/do1.rs +++ b/tests/pretty/do1.rs @@ -1,4 +1,4 @@ -// pp-exact +//@ pp-exact fn f(f: F) where F: Fn(isize) { f(10) } diff --git a/tests/pretty/doc-comments.rs b/tests/pretty/doc-comments.rs index a49860daa6ad..66a270e4f921 100644 --- a/tests/pretty/doc-comments.rs +++ b/tests/pretty/doc-comments.rs @@ -1,6 +1,6 @@ -// compile-flags: --crate-type=lib +//@ compile-flags: --crate-type=lib -// pp-exact +//@ pp-exact // some single-line non-doc comment diff --git a/tests/pretty/dollar-crate.pp b/tests/pretty/dollar-crate.pp index 60fddb630d96..561a9500aaaa 100644 --- a/tests/pretty/dollar-crate.pp +++ b/tests/pretty/dollar-crate.pp @@ -4,8 +4,8 @@ use ::std::prelude::rust_2015::*; #[macro_use] extern crate std; -// pretty-compare-only -// pretty-mode:expanded -// pp-exact:dollar-crate.pp +//@ pretty-compare-only +//@ pretty-mode:expanded +//@ pp-exact:dollar-crate.pp fn main() { { ::std::io::_print(format_args!("rust\n")); }; } diff --git a/tests/pretty/dollar-crate.rs b/tests/pretty/dollar-crate.rs index e46bc7f4859a..6b500e1db753 100644 --- a/tests/pretty/dollar-crate.rs +++ b/tests/pretty/dollar-crate.rs @@ -1,6 +1,6 @@ -// pretty-compare-only -// pretty-mode:expanded -// pp-exact:dollar-crate.pp +//@ pretty-compare-only +//@ pretty-mode:expanded +//@ pp-exact:dollar-crate.pp fn main() { println!("rust"); diff --git a/tests/pretty/empty-impl.rs b/tests/pretty/empty-impl.rs index d570933592a0..b0275e4a3a38 100644 --- a/tests/pretty/empty-impl.rs +++ b/tests/pretty/empty-impl.rs @@ -1,4 +1,4 @@ -// compile-flags: --crate-type=lib +//@ compile-flags: --crate-type=lib trait X { fn dummy(&self) { } } impl X for usize { } diff --git a/tests/pretty/empty-lines.rs b/tests/pretty/empty-lines.rs index 15d7625d4e7c..f08ab5a11702 100644 --- a/tests/pretty/empty-lines.rs +++ b/tests/pretty/empty-lines.rs @@ -1,4 +1,4 @@ -// compile-flags: --crate-type=lib +//@ compile-flags: --crate-type=lib // Issue #759 // Whitespace under block opening should not expand forever diff --git a/tests/pretty/enum-variant-vis.rs b/tests/pretty/enum-variant-vis.rs index fc646c2956c4..3397e7dc8e28 100644 --- a/tests/pretty/enum-variant-vis.rs +++ b/tests/pretty/enum-variant-vis.rs @@ -1,4 +1,4 @@ -// pp-exact +//@ pp-exact // Check that the visibility is printed on an enum variant. diff --git a/tests/pretty/example1.rs b/tests/pretty/example1.rs index 8df74e8e1f9c..252d2828c92f 100644 --- a/tests/pretty/example1.rs +++ b/tests/pretty/example1.rs @@ -1,3 +1,3 @@ -// pp-exact +//@ pp-exact fn main() {} diff --git a/tests/pretty/example2.pp b/tests/pretty/example2.pp index 3f7129afde26..2524382e2b53 100644 --- a/tests/pretty/example2.pp +++ b/tests/pretty/example2.pp @@ -1,3 +1,3 @@ -// pp-exact:example2.pp +//@ pp-exact:example2.pp fn main() {} diff --git a/tests/pretty/example2.rs b/tests/pretty/example2.rs index 3f7129afde26..2524382e2b53 100644 --- a/tests/pretty/example2.rs +++ b/tests/pretty/example2.rs @@ -1,3 +1,3 @@ -// pp-exact:example2.pp +//@ pp-exact:example2.pp fn main() {} diff --git a/tests/pretty/expanded-and-path-remap-80832.pp b/tests/pretty/expanded-and-path-remap-80832.pp index 8385c5fa8c91..5b3922bb3294 100644 --- a/tests/pretty/expanded-and-path-remap-80832.pp +++ b/tests/pretty/expanded-and-path-remap-80832.pp @@ -6,8 +6,8 @@ use ::std::prelude::rust_2015::*; extern crate std; // Test for issue 80832 // -// pretty-mode:expanded -// pp-exact:expanded-and-path-remap-80832.pp -// compile-flags: --remap-path-prefix {{src-base}}=the/src +//@ pretty-mode:expanded +//@ pp-exact:expanded-and-path-remap-80832.pp +//@ compile-flags: --remap-path-prefix {{src-base}}=the/src fn main() {} diff --git a/tests/pretty/expanded-and-path-remap-80832.rs b/tests/pretty/expanded-and-path-remap-80832.rs index f48441fbc575..2e5dacfc0c17 100644 --- a/tests/pretty/expanded-and-path-remap-80832.rs +++ b/tests/pretty/expanded-and-path-remap-80832.rs @@ -1,7 +1,7 @@ // Test for issue 80832 // -// pretty-mode:expanded -// pp-exact:expanded-and-path-remap-80832.pp -// compile-flags: --remap-path-prefix {{src-base}}=the/src +//@ pretty-mode:expanded +//@ pp-exact:expanded-and-path-remap-80832.pp +//@ compile-flags: --remap-path-prefix {{src-base}}=the/src fn main() {} diff --git a/tests/pretty/fn-return.rs b/tests/pretty/fn-return.rs index b932e83aaf10..fc284a737bd2 100644 --- a/tests/pretty/fn-return.rs +++ b/tests/pretty/fn-return.rs @@ -1,4 +1,4 @@ -// pp-exact +//@ pp-exact // Check that `fn f() -> () {}` does not print as `fn f() {}`. diff --git a/tests/pretty/fn-types.rs b/tests/pretty/fn-types.rs index f012763c3f60..49c4d86acdb8 100644 --- a/tests/pretty/fn-types.rs +++ b/tests/pretty/fn-types.rs @@ -1,4 +1,4 @@ -// pp-exact +//@ pp-exact fn from_foreign_fn(_x: fn()) {} fn from_stack_closure(_x: F) where F: Fn() {} diff --git a/tests/pretty/fn-variadic.rs b/tests/pretty/fn-variadic.rs index 59e477cfa8ec..e11ec9bcdcbb 100644 --- a/tests/pretty/fn-variadic.rs +++ b/tests/pretty/fn-variadic.rs @@ -1,7 +1,7 @@ // Check that `fn foo(x: i32, ...)` does not print as `fn foo(x: i32, ..., ...)`. // See issue #58853. -// pp-exact +//@ pp-exact #![feature(c_variadic)] extern "C" { diff --git a/tests/pretty/for-comment.rs b/tests/pretty/for-comment.rs index 447e7f918c22..b35dd344d50c 100644 --- a/tests/pretty/for-comment.rs +++ b/tests/pretty/for-comment.rs @@ -1,6 +1,6 @@ -// compile-flags: --crate-type=lib +//@ compile-flags: --crate-type=lib -// pp-exact +//@ pp-exact fn f(v: &[isize]) -> isize { let mut n = 0; diff --git a/tests/pretty/format-args-str-escape.pp b/tests/pretty/format-args-str-escape.pp index b84bc2303b73..277b608475cf 100644 --- a/tests/pretty/format-args-str-escape.pp +++ b/tests/pretty/format-args-str-escape.pp @@ -4,9 +4,9 @@ use ::std::prelude::rust_2015::*; #[macro_use] extern crate std; -// pretty-compare-only -// pretty-mode:expanded -// pp-exact:format-args-str-escape.pp +//@ pretty-compare-only +//@ pretty-mode:expanded +//@ pp-exact:format-args-str-escape.pp fn main() { { ::std::io::_print(format_args!("\u{1b}[1mHello, world!\u{1b}[0m\n")); }; diff --git a/tests/pretty/format-args-str-escape.rs b/tests/pretty/format-args-str-escape.rs index e596fcfd8bcb..ab4e85b38347 100644 --- a/tests/pretty/format-args-str-escape.rs +++ b/tests/pretty/format-args-str-escape.rs @@ -1,6 +1,6 @@ -// pretty-compare-only -// pretty-mode:expanded -// pp-exact:format-args-str-escape.pp +//@ pretty-compare-only +//@ pretty-mode:expanded +//@ pp-exact:format-args-str-escape.pp fn main() { println!("\x1B[1mHello, world!\x1B[0m"); diff --git a/tests/pretty/gat-bounds.rs b/tests/pretty/gat-bounds.rs index 0a361a3835f7..7f5cdeef7359 100644 --- a/tests/pretty/gat-bounds.rs +++ b/tests/pretty/gat-bounds.rs @@ -1,7 +1,7 @@ // Check that associated types print generic parameters and where clauses. // See issue #67509. -// pretty-compare-only +//@ pretty-compare-only trait X { type Y: Trait where Self: Sized; diff --git a/tests/pretty/hir-fn-variadic.pp b/tests/pretty/hir-fn-variadic.pp index 577d9400ad4e..978e65c825bb 100644 --- a/tests/pretty/hir-fn-variadic.pp +++ b/tests/pretty/hir-fn-variadic.pp @@ -1,6 +1,6 @@ -// pretty-compare-only -// pretty-mode:hir -// pp-exact:hir-fn-variadic.pp +//@ pretty-compare-only +//@ pretty-mode:hir +//@ pp-exact:hir-fn-variadic.pp #![feature(c_variadic)] #[prelude_import] diff --git a/tests/pretty/hir-fn-variadic.rs b/tests/pretty/hir-fn-variadic.rs index efb2754df623..3d3f7ee18315 100644 --- a/tests/pretty/hir-fn-variadic.rs +++ b/tests/pretty/hir-fn-variadic.rs @@ -1,6 +1,6 @@ -// pretty-compare-only -// pretty-mode:hir -// pp-exact:hir-fn-variadic.pp +//@ pretty-compare-only +//@ pretty-mode:hir +//@ pp-exact:hir-fn-variadic.pp #![feature(c_variadic)] diff --git a/tests/pretty/hir-pretty-loop.pp b/tests/pretty/hir-pretty-loop.pp index a59a3002c7f6..15f1677885ae 100644 --- a/tests/pretty/hir-pretty-loop.pp +++ b/tests/pretty/hir-pretty-loop.pp @@ -2,8 +2,8 @@ use ::std::prelude::rust_2015::*; #[macro_use] extern crate std; -// pretty-compare-only -// pretty-mode:hir -// pp-exact:hir-pretty-loop.pp +//@ pretty-compare-only +//@ pretty-mode:hir +//@ pp-exact:hir-pretty-loop.pp fn foo() { loop { break; } } diff --git a/tests/pretty/hir-pretty-loop.rs b/tests/pretty/hir-pretty-loop.rs index 87a3ef8b8f91..148e8316a674 100644 --- a/tests/pretty/hir-pretty-loop.rs +++ b/tests/pretty/hir-pretty-loop.rs @@ -1,6 +1,6 @@ -// pretty-compare-only -// pretty-mode:hir -// pp-exact:hir-pretty-loop.pp +//@ pretty-compare-only +//@ pretty-mode:hir +//@ pp-exact:hir-pretty-loop.pp pub fn foo(){ loop{ diff --git a/tests/pretty/if-attr.rs b/tests/pretty/if-attr.rs index 7b90b0becacb..89d6130f6592 100644 --- a/tests/pretty/if-attr.rs +++ b/tests/pretty/if-attr.rs @@ -1,4 +1,4 @@ -// pp-exact +//@ pp-exact #[cfg(FALSE)] fn simple_attr() { diff --git a/tests/pretty/import-renames.rs b/tests/pretty/import-renames.rs index ce6b5058ba6b..b8c743696843 100644 --- a/tests/pretty/import-renames.rs +++ b/tests/pretty/import-renames.rs @@ -1,6 +1,6 @@ -// compile-flags: --crate-type=lib +//@ compile-flags: --crate-type=lib -// pp-exact +//@ pp-exact use std::io::{self, Error as IoError}; use std::net::{self as stdnet, TcpStream}; diff --git a/tests/pretty/issue-12590-a.rs b/tests/pretty/issue-12590-a.rs index 3c88f5cb8a41..fbf983b5a628 100644 --- a/tests/pretty/issue-12590-a.rs +++ b/tests/pretty/issue-12590-a.rs @@ -1,5 +1,5 @@ -// pp-exact -// pretty-compare-only +//@ pp-exact +//@ pretty-compare-only // The next line should not be expanded diff --git a/tests/pretty/issue-12590-c.pp b/tests/pretty/issue-12590-c.pp index 07b3f5653d36..691738a89ed8 100644 --- a/tests/pretty/issue-12590-c.pp +++ b/tests/pretty/issue-12590-c.pp @@ -4,9 +4,9 @@ use ::std::prelude::rust_2015::*; #[macro_use] extern crate std; -// pretty-compare-only -// pretty-mode:expanded -// pp-exact:issue-12590-c.pp +//@ pretty-compare-only +//@ pretty-mode:expanded +//@ pp-exact:issue-12590-c.pp // The next line should be expanded diff --git a/tests/pretty/issue-12590-c.rs b/tests/pretty/issue-12590-c.rs index 0ec05f9a8051..bfaf92d72246 100644 --- a/tests/pretty/issue-12590-c.rs +++ b/tests/pretty/issue-12590-c.rs @@ -1,6 +1,6 @@ -// pretty-compare-only -// pretty-mode:expanded -// pp-exact:issue-12590-c.pp +//@ pretty-compare-only +//@ pretty-mode:expanded +//@ pp-exact:issue-12590-c.pp // The next line should be expanded diff --git a/tests/pretty/issue-19077.rs b/tests/pretty/issue-19077.rs index 0d2702804d12..c57ea0cf02d1 100644 --- a/tests/pretty/issue-19077.rs +++ b/tests/pretty/issue-19077.rs @@ -1,6 +1,6 @@ // // Testing that unsafe blocks in match arms are followed by a comma -// pp-exact +//@ pp-exact fn main() { match true { true if true => (), diff --git a/tests/pretty/issue-25031.rs b/tests/pretty/issue-25031.rs index d91494891d4d..5874631a2b41 100644 --- a/tests/pretty/issue-25031.rs +++ b/tests/pretty/issue-25031.rs @@ -1,7 +1,7 @@ // // Testing that type items with where clauses output correctly. -// pp-exact +//@ pp-exact fn main() { type Foo where T: Copy = Box; diff --git a/tests/pretty/issue-30731.rs b/tests/pretty/issue-30731.rs index 607cbebee170..73bdafe2e683 100644 --- a/tests/pretty/issue-30731.rs +++ b/tests/pretty/issue-30731.rs @@ -2,7 +2,7 @@ // Test pretty printing of macro with braces but without terminating semicolon, // this used to panic before fix. -// pretty-compare-only -// pp-exact +//@ pretty-compare-only +//@ pp-exact fn main() { b! {} c } diff --git a/tests/pretty/issue-31073.pp b/tests/pretty/issue-31073.pp index 75795f6d5689..b3f8c6ce5dae 100644 --- a/tests/pretty/issue-31073.pp +++ b/tests/pretty/issue-31073.pp @@ -1,4 +1,4 @@ -// pp-exact:issue-31073.pp +//@ pp-exact:issue-31073.pp fn main() { fn f1(x: i32, y: i32) -> i32 { y } diff --git a/tests/pretty/issue-31073.rs b/tests/pretty/issue-31073.rs index 75795f6d5689..b3f8c6ce5dae 100644 --- a/tests/pretty/issue-31073.rs +++ b/tests/pretty/issue-31073.rs @@ -1,4 +1,4 @@ -// pp-exact:issue-31073.pp +//@ pp-exact:issue-31073.pp fn main() { fn f1(x: i32, y: i32) -> i32 { y } diff --git a/tests/pretty/issue-4264.pp b/tests/pretty/issue-4264.pp index 2d713832dcd3..af64260d0200 100644 --- a/tests/pretty/issue-4264.pp +++ b/tests/pretty/issue-4264.pp @@ -2,9 +2,9 @@ use ::std::prelude::rust_2015::*; #[macro_use] extern crate std; -// pretty-compare-only -// pretty-mode:hir,typed -// pp-exact:issue-4264.pp +//@ pretty-compare-only +//@ pretty-mode:hir,typed +//@ pp-exact:issue-4264.pp // #4264 fixed-length vector types diff --git a/tests/pretty/issue-4264.rs b/tests/pretty/issue-4264.rs index 3dea81129818..09840234b8c0 100644 --- a/tests/pretty/issue-4264.rs +++ b/tests/pretty/issue-4264.rs @@ -1,6 +1,6 @@ -// pretty-compare-only -// pretty-mode:hir,typed -// pp-exact:issue-4264.pp +//@ pretty-compare-only +//@ pretty-mode:hir,typed +//@ pp-exact:issue-4264.pp // #4264 fixed-length vector types diff --git a/tests/pretty/issue-68710-field-attr-proc-mac-lost.rs b/tests/pretty/issue-68710-field-attr-proc-mac-lost.rs index 80f739f4f9e1..ce17abea3549 100644 --- a/tests/pretty/issue-68710-field-attr-proc-mac-lost.rs +++ b/tests/pretty/issue-68710-field-attr-proc-mac-lost.rs @@ -1,4 +1,4 @@ -// pp-exact +//@ pp-exact fn main() {} diff --git a/tests/pretty/issue-74745.rs b/tests/pretty/issue-74745.rs index e255cd6caa86..b2f10b758628 100644 --- a/tests/pretty/issue-74745.rs +++ b/tests/pretty/issue-74745.rs @@ -1,5 +1,5 @@ // ignore-tidy-trailing-newlines -// pretty-compare-only +//@ pretty-compare-only /* */ \ No newline at end of file diff --git a/tests/pretty/issue-85089.pp b/tests/pretty/issue-85089.pp index f84e9df04a2a..f4e0eb3dd5ff 100644 --- a/tests/pretty/issue-85089.pp +++ b/tests/pretty/issue-85089.pp @@ -4,9 +4,9 @@ use ::std::prelude::rust_2015::*; extern crate std; // Test to print lifetimes on HIR pretty-printing. -// pretty-compare-only -// pretty-mode:hir -// pp-exact:issue-85089.pp +//@ pretty-compare-only +//@ pretty-mode:hir +//@ pp-exact:issue-85089.pp trait A<'x> { } trait B<'x> { } diff --git a/tests/pretty/issue-85089.rs b/tests/pretty/issue-85089.rs index eb45d473119d..0327dee6959b 100644 --- a/tests/pretty/issue-85089.rs +++ b/tests/pretty/issue-85089.rs @@ -1,8 +1,8 @@ // Test to print lifetimes on HIR pretty-printing. -// pretty-compare-only -// pretty-mode:hir -// pp-exact:issue-85089.pp +//@ pretty-compare-only +//@ pretty-mode:hir +//@ pp-exact:issue-85089.pp trait A<'x> {} trait B<'x> {} diff --git a/tests/pretty/let.rs b/tests/pretty/let.rs index 20ffb7578182..04eb0d9ead1b 100644 --- a/tests/pretty/let.rs +++ b/tests/pretty/let.rs @@ -1,4 +1,4 @@ -// pp-exact +//@ pp-exact // Check that `let x: _ = 0;` does not print as `let x = 0;`. diff --git a/tests/pretty/lifetime.rs b/tests/pretty/lifetime.rs index 34eae849be45..2a36fe8312ec 100644 --- a/tests/pretty/lifetime.rs +++ b/tests/pretty/lifetime.rs @@ -1,4 +1,4 @@ -// pp-exact +//@ pp-exact fn f1<'a, 'b, 'c>(_x: &'a u32, _y: &'b u32, _z: &'c u32) where 'c: 'a + 'b {} diff --git a/tests/pretty/macro.rs b/tests/pretty/macro.rs index b88ae703950b..d8ce285d0d5f 100644 --- a/tests/pretty/macro.rs +++ b/tests/pretty/macro.rs @@ -1,4 +1,4 @@ -// pp-exact +//@ pp-exact #![feature(decl_macro)] diff --git a/tests/pretty/macro_rules.rs b/tests/pretty/macro_rules.rs index a5265446ee79..b817c395ed25 100644 --- a/tests/pretty/macro_rules.rs +++ b/tests/pretty/macro_rules.rs @@ -1,4 +1,4 @@ -// pp-exact +//@ pp-exact macro_rules! brace { () => {}; } diff --git a/tests/pretty/match-block-expr.rs b/tests/pretty/match-block-expr.rs index 10903e928cda..151a2d40f25f 100644 --- a/tests/pretty/match-block-expr.rs +++ b/tests/pretty/match-block-expr.rs @@ -1,4 +1,4 @@ -// pp-exact +//@ pp-exact fn main() { let x = match { 5 } { 1 => 5, 2 => 6, _ => 7, }; diff --git a/tests/pretty/match-naked-expr-medium.rs b/tests/pretty/match-naked-expr-medium.rs index 836af99002d6..1d18544384cc 100644 --- a/tests/pretty/match-naked-expr-medium.rs +++ b/tests/pretty/match-naked-expr-medium.rs @@ -1,4 +1,4 @@ -// pp-exact +//@ pp-exact fn main() { let x = Some(3); diff --git a/tests/pretty/match-naked-expr.rs b/tests/pretty/match-naked-expr.rs index 7c16bbefe3c2..9d79b7b18e65 100644 --- a/tests/pretty/match-naked-expr.rs +++ b/tests/pretty/match-naked-expr.rs @@ -1,4 +1,4 @@ -// pp-exact +//@ pp-exact fn main() { let x = Some(3); diff --git a/tests/pretty/nested-item-vis-defaultness.rs b/tests/pretty/nested-item-vis-defaultness.rs index b094ba577db2..1e971fcf07a5 100644 --- a/tests/pretty/nested-item-vis-defaultness.rs +++ b/tests/pretty/nested-item-vis-defaultness.rs @@ -1,6 +1,6 @@ // Check that nested items have their visibility and `default`nesses in the right order. -// pp-exact +//@ pp-exact fn main() {} diff --git a/tests/pretty/offset_of.rs b/tests/pretty/offset_of.rs index 1307c335ad32..6cb27c7fdfb7 100644 --- a/tests/pretty/offset_of.rs +++ b/tests/pretty/offset_of.rs @@ -1,3 +1,3 @@ -// pp-exact +//@ pp-exact fn main() { std::mem::offset_of!(std :: ops :: Range < usize >, end); } diff --git a/tests/pretty/path-type-bounds.rs b/tests/pretty/path-type-bounds.rs index f1970de6feb4..e7ae1331e401 100644 --- a/tests/pretty/path-type-bounds.rs +++ b/tests/pretty/path-type-bounds.rs @@ -1,4 +1,4 @@ -// pp-exact +//@ pp-exact trait Tr { diff --git a/tests/pretty/qpath-associated-type-bound.rs b/tests/pretty/qpath-associated-type-bound.rs index 67a5d1dd8ec6..031e36a7dfa1 100644 --- a/tests/pretty/qpath-associated-type-bound.rs +++ b/tests/pretty/qpath-associated-type-bound.rs @@ -1,4 +1,4 @@ -// pp-exact +//@ pp-exact mod m { diff --git a/tests/pretty/raw-address-of.rs b/tests/pretty/raw-address-of.rs index 6ccc434a1e79..6e97ab99407f 100644 --- a/tests/pretty/raw-address-of.rs +++ b/tests/pretty/raw-address-of.rs @@ -1,4 +1,4 @@ -// pp-exact +//@ pp-exact #![feature(raw_ref_op)] const C_PTR: () = { let a = 1; &raw const a; }; diff --git a/tests/pretty/raw-str-nonexpr.rs b/tests/pretty/raw-str-nonexpr.rs index 12440b5ae6ed..5b9347b012bb 100644 --- a/tests/pretty/raw-str-nonexpr.rs +++ b/tests/pretty/raw-str-nonexpr.rs @@ -1,5 +1,5 @@ -// needs-asm-support -// pp-exact +//@ needs-asm-support +//@ pp-exact #[cfg(foo = r#"just parse this"#)] extern crate blah as blah; diff --git a/tests/pretty/stmt_expr_attributes.rs b/tests/pretty/stmt_expr_attributes.rs index 69b153175615..98ad98b863ac 100644 --- a/tests/pretty/stmt_expr_attributes.rs +++ b/tests/pretty/stmt_expr_attributes.rs @@ -1,4 +1,4 @@ -// pp-exact +//@ pp-exact #![feature(inline_const)] #![feature(inline_const_pat)] diff --git a/tests/pretty/struct-pattern.rs b/tests/pretty/struct-pattern.rs index 6acb2e27f4fa..31de95e74a37 100644 --- a/tests/pretty/struct-pattern.rs +++ b/tests/pretty/struct-pattern.rs @@ -1,5 +1,5 @@ -// pp-exact -// pretty-compare-only +//@ pp-exact +//@ pretty-compare-only // Testing that shorthand struct patterns are preserved fn main() { let Foo { a, ref b, mut c, x: y, z: z } = foo; } diff --git a/tests/pretty/struct-tuple.rs b/tests/pretty/struct-tuple.rs index 77e064b4fa41..5f1de04f0c63 100644 --- a/tests/pretty/struct-tuple.rs +++ b/tests/pretty/struct-tuple.rs @@ -1,4 +1,4 @@ -// pp-exact +//@ pp-exact struct Foo; struct Bar(isize, isize); diff --git a/tests/pretty/tag-blank-lines.rs b/tests/pretty/tag-blank-lines.rs index d53f6e4b5285..42f33dfef8a6 100644 --- a/tests/pretty/tag-blank-lines.rs +++ b/tests/pretty/tag-blank-lines.rs @@ -1,4 +1,4 @@ -// pp-exact +//@ pp-exact enum foo { bar, // a bar. diff --git a/tests/pretty/tests-are-sorted.pp b/tests/pretty/tests-are-sorted.pp index fbdad0c323f3..816cd5a5c072 100644 --- a/tests/pretty/tests-are-sorted.pp +++ b/tests/pretty/tests-are-sorted.pp @@ -4,10 +4,10 @@ use ::std::prelude::rust_2015::*; #[macro_use] extern crate std; -// compile-flags: --crate-type=lib --test --remap-path-prefix={{src-base}}/=/the/src/ --remap-path-prefix={{src-base}}\=/the/src/ -// pretty-compare-only -// pretty-mode:expanded -// pp-exact:tests-are-sorted.pp +//@ compile-flags: --crate-type=lib --test --remap-path-prefix={{src-base}}/=/the/src/ --remap-path-prefix={{src-base}}\=/the/src/ +//@ pretty-compare-only +//@ pretty-mode:expanded +//@ pp-exact:tests-are-sorted.pp extern crate test; #[cfg(test)] diff --git a/tests/pretty/tests-are-sorted.rs b/tests/pretty/tests-are-sorted.rs index 39e0922250b8..0326eba4a449 100644 --- a/tests/pretty/tests-are-sorted.rs +++ b/tests/pretty/tests-are-sorted.rs @@ -1,7 +1,7 @@ -// compile-flags: --crate-type=lib --test --remap-path-prefix={{src-base}}/=/the/src/ --remap-path-prefix={{src-base}}\=/the/src/ -// pretty-compare-only -// pretty-mode:expanded -// pp-exact:tests-are-sorted.pp +//@ compile-flags: --crate-type=lib --test --remap-path-prefix={{src-base}}/=/the/src/ --remap-path-prefix={{src-base}}\=/the/src/ +//@ pretty-compare-only +//@ pretty-mode:expanded +//@ pp-exact:tests-are-sorted.pp #[test] fn m_test() {} diff --git a/tests/pretty/top-level-doc-comments.rs b/tests/pretty/top-level-doc-comments.rs index b97927124c30..b20e45c2c400 100644 --- a/tests/pretty/top-level-doc-comments.rs +++ b/tests/pretty/top-level-doc-comments.rs @@ -1,7 +1,7 @@ /// Some doc comment. struct X; -// pp-exact +//@ pp-exact // Test that rust can properly pretty print a doc comment if it's the first line in a file. some diff --git a/tests/pretty/trait-inner-attr.rs b/tests/pretty/trait-inner-attr.rs index 6cb0e4136b62..ad3fed1877cf 100644 --- a/tests/pretty/trait-inner-attr.rs +++ b/tests/pretty/trait-inner-attr.rs @@ -1,4 +1,4 @@ -// pp-exact +//@ pp-exact trait Foo { #![allow(bar)] diff --git a/tests/pretty/trait-polarity.rs b/tests/pretty/trait-polarity.rs index 310506eabca1..d4d8bd6fd61e 100644 --- a/tests/pretty/trait-polarity.rs +++ b/tests/pretty/trait-polarity.rs @@ -1,6 +1,6 @@ #![feature(negative_impls)] -// pp-exact +//@ pp-exact struct Test; diff --git a/tests/pretty/trait-safety.rs b/tests/pretty/trait-safety.rs index c4ae7606946b..8865573e7d08 100644 --- a/tests/pretty/trait-safety.rs +++ b/tests/pretty/trait-safety.rs @@ -1,4 +1,4 @@ -// pp-exact +//@ pp-exact unsafe trait UnsafeTrait { fn foo(&self); diff --git a/tests/pretty/unary-op-disambig.rs b/tests/pretty/unary-op-disambig.rs index 0c57e0a33717..d6f698cdf416 100644 --- a/tests/pretty/unary-op-disambig.rs +++ b/tests/pretty/unary-op-disambig.rs @@ -1,4 +1,4 @@ -// compile-flags: --crate-type=lib +//@ compile-flags: --crate-type=lib // Preserve semicolons that disambiguate unops diff --git a/tests/pretty/use-tree.rs b/tests/pretty/use-tree.rs index 5da952352455..ead26e8ab477 100644 --- a/tests/pretty/use-tree.rs +++ b/tests/pretty/use-tree.rs @@ -1,5 +1,5 @@ -// pp-exact -// edition:2021 +//@ pp-exact +//@ edition:2021 #![allow(unused_imports)] diff --git a/tests/pretty/vec-comments.pp b/tests/pretty/vec-comments.pp index f2f807c59de9..04189589a387 100644 --- a/tests/pretty/vec-comments.pp +++ b/tests/pretty/vec-comments.pp @@ -1,6 +1,6 @@ // Issue #679 // Testing that comments are correctly interleaved -// pp-exact:vec-comments.pp +//@ pp-exact:vec-comments.pp fn main() { let _v1 = [ diff --git a/tests/pretty/vec-comments.rs b/tests/pretty/vec-comments.rs index a150cf0b8ea8..64ae5ae5eb7c 100644 --- a/tests/pretty/vec-comments.rs +++ b/tests/pretty/vec-comments.rs @@ -1,6 +1,6 @@ // Issue #679 // Testing that comments are correctly interleaved -// pp-exact:vec-comments.pp +//@ pp-exact:vec-comments.pp fn main() { let _v1 = [ diff --git a/tests/pretty/where-clauses.rs b/tests/pretty/where-clauses.rs index 4183799457b7..27807d4c3820 100644 --- a/tests/pretty/where-clauses.rs +++ b/tests/pretty/where-clauses.rs @@ -1,4 +1,4 @@ -// pp-exact +//@ pp-exact fn f<'a, 'b, T>(t: T) -> isize where T: 'a, 'a: 'b, T: Eq { 0 } diff --git a/tests/pretty/yeet-expr.rs b/tests/pretty/yeet-expr.rs index c899f11b7240..6c449eb8851d 100644 --- a/tests/pretty/yeet-expr.rs +++ b/tests/pretty/yeet-expr.rs @@ -1,4 +1,4 @@ -// pp-exact +//@ pp-exact #![feature(yeet_expr)] fn yeet_no_expr() -> Option { do yeet } diff --git a/tests/run-make/const_fn_mir/main.rs b/tests/run-make/const_fn_mir/main.rs index e8552bd285a8..f3f7dc576dd9 100644 --- a/tests/run-make/const_fn_mir/main.rs +++ b/tests/run-make/const_fn_mir/main.rs @@ -1,5 +1,5 @@ // emit-mir -// check-pass +//@ check-pass const fn foo() -> i32 { 5 + 6 diff --git a/tests/run-make/export-executable-symbols/main.rs b/tests/run-make/export-executable-symbols/main.rs index c498381a33f6..a9bd6412b448 100644 --- a/tests/run-make/export-executable-symbols/main.rs +++ b/tests/run-make/export-executable-symbols/main.rs @@ -1,4 +1,4 @@ -// edition:2018 +//@ edition:2018 fn main() {} diff --git a/tests/run-make/issue-47551/eh_frame-terminator.rs b/tests/run-make/issue-47551/eh_frame-terminator.rs index a2c7a31b7c32..35db4bc7d1f7 100644 --- a/tests/run-make/issue-47551/eh_frame-terminator.rs +++ b/tests/run-make/issue-47551/eh_frame-terminator.rs @@ -1,4 +1,4 @@ -// run-pass +//@ run-pass #[derive(Clone, Copy)] struct Foo { diff --git a/tests/run-pass-valgrind/coerce-match-calls.rs b/tests/run-pass-valgrind/coerce-match-calls.rs index 60943aad80dc..f6c7151ff103 100644 --- a/tests/run-pass-valgrind/coerce-match-calls.rs +++ b/tests/run-pass-valgrind/coerce-match-calls.rs @@ -1,6 +1,6 @@ // Check that coercions are propagated through match and if expressions. -// pretty-expanded FIXME #23616 +//@ pretty-expanded FIXME #23616 use std::boxed::Box; diff --git a/tests/run-pass-valgrind/coerce-match.rs b/tests/run-pass-valgrind/coerce-match.rs index 5b78f1ec77c5..3f33264c5a80 100644 --- a/tests/run-pass-valgrind/coerce-match.rs +++ b/tests/run-pass-valgrind/coerce-match.rs @@ -1,6 +1,6 @@ // Check that coercions are propagated through match and if expressions. -// pretty-expanded FIXME #23616 +//@ pretty-expanded FIXME #23616 pub fn main() { let _: Box<[isize]> = if true { diff --git a/tests/run-pass-valgrind/down-with-thread-dtors.rs b/tests/run-pass-valgrind/down-with-thread-dtors.rs index 8531b8d83260..15aeac98c667 100644 --- a/tests/run-pass-valgrind/down-with-thread-dtors.rs +++ b/tests/run-pass-valgrind/down-with-thread-dtors.rs @@ -1,4 +1,4 @@ -// ignore-emscripten +//@ ignore-emscripten thread_local!(static FOO: Foo = Foo); thread_local!(static BAR: Bar = Bar(1)); diff --git a/tests/run-pass-valgrind/exit-flushes.rs b/tests/run-pass-valgrind/exit-flushes.rs index 9daf487d39fe..c54f9243950e 100644 --- a/tests/run-pass-valgrind/exit-flushes.rs +++ b/tests/run-pass-valgrind/exit-flushes.rs @@ -1,6 +1,6 @@ -// ignore-emscripten -// ignore-sgx no processes -// ignore-macos this needs valgrind 3.11 or higher; see +//@ ignore-emscripten +//@ ignore-sgx no processes +//@ ignore-macos this needs valgrind 3.11 or higher; see // https://github.com/rust-lang/rust/pull/30365#issuecomment-165763679 use std::env; diff --git a/tests/run-pass-valgrind/osx-frameworks.rs b/tests/run-pass-valgrind/osx-frameworks.rs index 571621c1de77..71465c0d1997 100644 --- a/tests/run-pass-valgrind/osx-frameworks.rs +++ b/tests/run-pass-valgrind/osx-frameworks.rs @@ -1,4 +1,4 @@ -// pretty-expanded FIXME #23616 +//@ pretty-expanded FIXME #23616 #![feature(rustc_private)] diff --git a/tests/rustdoc-gui/src/extend_css/lib.rs b/tests/rustdoc-gui/src/extend_css/lib.rs index 2308c0932fd0..734195823fc6 100644 --- a/tests/rustdoc-gui/src/extend_css/lib.rs +++ b/tests/rustdoc-gui/src/extend_css/lib.rs @@ -1,2 +1,2 @@ -// compile-flags: --extend-css extra.css +//@ compile-flags: --extend-css extra.css //!
text in red
diff --git a/tests/rustdoc-gui/src/link_to_definition/lib.rs b/tests/rustdoc-gui/src/link_to_definition/lib.rs index 6fed79aedb89..539b6fe35c60 100644 --- a/tests/rustdoc-gui/src/link_to_definition/lib.rs +++ b/tests/rustdoc-gui/src/link_to_definition/lib.rs @@ -1,4 +1,4 @@ -// compile-flags: -Zunstable-options --generate-link-to-definition +//@ compile-flags: -Zunstable-options --generate-link-to-definition pub fn sub_fn() { barbar(); } diff --git a/tests/rustdoc-gui/src/scrape_examples/src/lib.rs b/tests/rustdoc-gui/src/scrape_examples/src/lib.rs index 6666587ad541..d6351c53074d 100644 --- a/tests/rustdoc-gui/src/scrape_examples/src/lib.rs +++ b/tests/rustdoc-gui/src/scrape_examples/src/lib.rs @@ -1,4 +1,4 @@ -// run-flags:-Zrustdoc-scrape-examples +//@ run-flags:-Zrustdoc-scrape-examples /// # Examples /// /// ``` diff --git a/tests/rustdoc-gui/src/theme_css/lib.rs b/tests/rustdoc-gui/src/theme_css/lib.rs index e9f3265fa6ba..8ec524639a5f 100644 --- a/tests/rustdoc-gui/src/theme_css/lib.rs +++ b/tests/rustdoc-gui/src/theme_css/lib.rs @@ -1,2 +1,2 @@ -// compile-flags: --theme custom-theme.css +//@ compile-flags: --theme custom-theme.css //!
custom text
diff --git a/tests/rustdoc-js/search-non-local-trait-impl.rs b/tests/rustdoc-js/search-non-local-trait-impl.rs index 462b75b0b132..7c9b2ad80d0d 100644 --- a/tests/rustdoc-js/search-non-local-trait-impl.rs +++ b/tests/rustdoc-js/search-non-local-trait-impl.rs @@ -1,6 +1,6 @@ -// aux-crate:priv:equivalent=equivalent.rs -// compile-flags: -Zunstable-options --extern equivalent -// edition:2018 +//@ aux-crate:priv:equivalent=equivalent.rs +//@ compile-flags: -Zunstable-options --extern equivalent +//@ edition:2018 extern crate equivalent; diff --git a/tests/rustdoc-json/enums/doc_link_to_foreign_variant.rs b/tests/rustdoc-json/enums/doc_link_to_foreign_variant.rs index b00156124fc2..784a93c893ac 100644 --- a/tests/rustdoc-json/enums/doc_link_to_foreign_variant.rs +++ b/tests/rustdoc-json/enums/doc_link_to_foreign_variant.rs @@ -1,4 +1,4 @@ -// aux-build: color.rs +//@ aux-build: color.rs //! The purpose of this test it to have a link to [a foreign variant](Red). diff --git a/tests/rustdoc-json/enums/use_variant_foreign.rs b/tests/rustdoc-json/enums/use_variant_foreign.rs index a79e899d85f3..c42ead644614 100644 --- a/tests/rustdoc-json/enums/use_variant_foreign.rs +++ b/tests/rustdoc-json/enums/use_variant_foreign.rs @@ -1,4 +1,4 @@ -// aux-build: color.rs +//@ aux-build: color.rs extern crate color; diff --git a/tests/rustdoc-json/fns/async_return.rs b/tests/rustdoc-json/fns/async_return.rs index 8192f2e6ae63..32117d73657d 100644 --- a/tests/rustdoc-json/fns/async_return.rs +++ b/tests/rustdoc-json/fns/async_return.rs @@ -1,4 +1,4 @@ -// edition:2021 +//@ edition:2021 // ignore-tidy-linelength // Regression test for diff --git a/tests/rustdoc-json/fns/qualifiers.rs b/tests/rustdoc-json/fns/qualifiers.rs index 643865a3f07f..6293b8112267 100644 --- a/tests/rustdoc-json/fns/qualifiers.rs +++ b/tests/rustdoc-json/fns/qualifiers.rs @@ -1,4 +1,4 @@ -// edition:2018 +//@ edition:2018 // @is "$.index[*][?(@.name=='nothing_fn')].inner.function.header.async" false // @is "$.index[*][?(@.name=='nothing_fn')].inner.function.header.const" false diff --git a/tests/rustdoc-json/impls/foreign_for_local.rs b/tests/rustdoc-json/impls/foreign_for_local.rs index 20e1cecd778c..d5265ba11bd7 100644 --- a/tests/rustdoc-json/impls/foreign_for_local.rs +++ b/tests/rustdoc-json/impls/foreign_for_local.rs @@ -1,4 +1,4 @@ -// aux-build: foreign_trait.rs +//@ aux-build: foreign_trait.rs extern crate foreign_trait; /// ForeignTrait id hack diff --git a/tests/rustdoc-json/impls/impl_item_visibility_show_hidden.rs b/tests/rustdoc-json/impls/impl_item_visibility_show_hidden.rs index fa3a36df8563..431220a473d6 100644 --- a/tests/rustdoc-json/impls/impl_item_visibility_show_hidden.rs +++ b/tests/rustdoc-json/impls/impl_item_visibility_show_hidden.rs @@ -1,4 +1,4 @@ -// compile-flags: --document-hidden-items +//@ compile-flags: --document-hidden-items pub struct Foo; diff --git a/tests/rustdoc-json/impls/impl_item_visibility_show_private.rs b/tests/rustdoc-json/impls/impl_item_visibility_show_private.rs index 7c68a2412f36..aa1eb9896650 100644 --- a/tests/rustdoc-json/impls/impl_item_visibility_show_private.rs +++ b/tests/rustdoc-json/impls/impl_item_visibility_show_private.rs @@ -1,4 +1,4 @@ -// compile-flags: --document-private-items +//@ compile-flags: --document-private-items pub struct Foo; diff --git a/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id-3.rs b/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id-3.rs index 836f1fe87da3..c09c916a530f 100644 --- a/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id-3.rs +++ b/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id-3.rs @@ -1,4 +1,4 @@ -// compile-flags: --document-hidden-items +//@ compile-flags: --document-hidden-items // @has "$.index[*][?(@.name == 'HiddenPubStruct')]" // @has "$.index[*][?(@.inner.impl)]" diff --git a/tests/rustdoc-json/impls/local_for_foreign.rs b/tests/rustdoc-json/impls/local_for_foreign.rs index 72352ce88da0..019f7d625cb2 100644 --- a/tests/rustdoc-json/impls/local_for_foreign.rs +++ b/tests/rustdoc-json/impls/local_for_foreign.rs @@ -1,4 +1,4 @@ -// aux-build: foreign_struct.rs +//@ aux-build: foreign_struct.rs extern crate foreign_struct; /// ForeignStruct id hack diff --git a/tests/rustdoc-json/intra-doc-links/foreign_variant.rs b/tests/rustdoc-json/intra-doc-links/foreign_variant.rs index e29682313386..40e1f6b1f0af 100644 --- a/tests/rustdoc-json/intra-doc-links/foreign_variant.rs +++ b/tests/rustdoc-json/intra-doc-links/foreign_variant.rs @@ -1,5 +1,5 @@ // Regression test for -// aux-build: enum_variant_in_trait_method.rs +//@ aux-build: enum_variant_in_trait_method.rs extern crate enum_variant_in_trait_method; diff --git a/tests/rustdoc-json/methods/qualifiers.rs b/tests/rustdoc-json/methods/qualifiers.rs index 65977bc826fe..dac90b7ff6fb 100644 --- a/tests/rustdoc-json/methods/qualifiers.rs +++ b/tests/rustdoc-json/methods/qualifiers.rs @@ -1,4 +1,4 @@ -// edition:2018 +//@ edition:2018 pub struct Foo; diff --git a/tests/rustdoc-json/nested.rs b/tests/rustdoc-json/nested.rs index e012cfc5014c..c0a47c467e3f 100644 --- a/tests/rustdoc-json/nested.rs +++ b/tests/rustdoc-json/nested.rs @@ -1,5 +1,5 @@ -// edition:2018 -// compile-flags: --crate-version 1.0.0 +//@ edition:2018 +//@ compile-flags: --crate-version 1.0.0 // @is "$.crate_version" \"1.0.0\" // @has "$.index[*][?(@.name=='nested')].inner.module" diff --git a/tests/rustdoc-json/output_generics.rs b/tests/rustdoc-json/output_generics.rs index 04b1a358fba4..d421eafbb47b 100644 --- a/tests/rustdoc-json/output_generics.rs +++ b/tests/rustdoc-json/output_generics.rs @@ -1,4 +1,4 @@ -// compile-flags: --document-private-items --document-hidden-items +//@ compile-flags: --document-private-items --document-hidden-items // This is a regression test for #98009. diff --git a/tests/rustdoc-json/primitives/primitive_overloading.rs b/tests/rustdoc-json/primitives/primitive_overloading.rs index 50e23fc06d3e..e4ffbdf02958 100644 --- a/tests/rustdoc-json/primitives/primitive_overloading.rs +++ b/tests/rustdoc-json/primitives/primitive_overloading.rs @@ -1,4 +1,4 @@ -// compile-flags: --document-private-items +//@ compile-flags: --document-private-items // Regression test for . diff --git a/tests/rustdoc-json/primitives/use_primitive.rs b/tests/rustdoc-json/primitives/use_primitive.rs index f8118b82094e..7f5ffc043093 100644 --- a/tests/rustdoc-json/primitives/use_primitive.rs +++ b/tests/rustdoc-json/primitives/use_primitive.rs @@ -1,4 +1,4 @@ -// edition:2018 +//@ edition:2018 #![feature(rustc_attrs)] diff --git a/tests/rustdoc-json/reexport/doc_inline_external_crate.rs b/tests/rustdoc-json/reexport/doc_inline_external_crate.rs index 1c5fed8c6b2b..7326649d9042 100644 --- a/tests/rustdoc-json/reexport/doc_inline_external_crate.rs +++ b/tests/rustdoc-json/reexport/doc_inline_external_crate.rs @@ -1,5 +1,5 @@ // Regression Test for https://github.com/rust-lang/rust/issues/110138 -// aux-build: enum_with_discriminant.rs +//@ aux-build: enum_with_discriminant.rs // ignore-tidy-linelength #[doc(inline)] diff --git a/tests/rustdoc-json/reexport/extern_crate_glob.rs b/tests/rustdoc-json/reexport/extern_crate_glob.rs index 553ee79b44e4..07497f6d7be4 100644 --- a/tests/rustdoc-json/reexport/extern_crate_glob.rs +++ b/tests/rustdoc-json/reexport/extern_crate_glob.rs @@ -1,4 +1,4 @@ -// aux-build: enum_with_discriminant.rs +//@ aux-build: enum_with_discriminant.rs extern crate enum_with_discriminant; diff --git a/tests/rustdoc-json/reexport/glob_extern.rs b/tests/rustdoc-json/reexport/glob_extern.rs index ed0c4a420d48..b95765410d52 100644 --- a/tests/rustdoc-json/reexport/glob_extern.rs +++ b/tests/rustdoc-json/reexport/glob_extern.rs @@ -1,4 +1,4 @@ -// edition:2018 +//@ edition:2018 // @is "$.index[*][?(@.name=='mod1')].inner.module.is_stripped" "true" mod mod1 { diff --git a/tests/rustdoc-json/reexport/glob_private.rs b/tests/rustdoc-json/reexport/glob_private.rs index 11ea5aa3522b..9764b4046828 100644 --- a/tests/rustdoc-json/reexport/glob_private.rs +++ b/tests/rustdoc-json/reexport/glob_private.rs @@ -1,4 +1,4 @@ -// edition:2018 +//@ edition:2018 // @is "$.index[*][?(@.name=='mod1')].inner.module.is_stripped" "true" mod mod1 { diff --git a/tests/rustdoc-json/reexport/macro.rs b/tests/rustdoc-json/reexport/macro.rs index be09cb47629d..2cca238908e6 100644 --- a/tests/rustdoc-json/reexport/macro.rs +++ b/tests/rustdoc-json/reexport/macro.rs @@ -1,4 +1,4 @@ -// edition:2018 +//@ edition:2018 // @set repro_id = "$.index[*][?(@.name=='repro')].id" #[macro_export] diff --git a/tests/rustdoc-json/reexport/private_twice_one_inline.rs b/tests/rustdoc-json/reexport/private_twice_one_inline.rs index d7b766235578..5e6a10af5299 100644 --- a/tests/rustdoc-json/reexport/private_twice_one_inline.rs +++ b/tests/rustdoc-json/reexport/private_twice_one_inline.rs @@ -1,4 +1,4 @@ -// aux-build:pub-struct.rs +//@ aux-build:pub-struct.rs // ignore-tidy-linelength // Test for the ICE in https://github.com/rust-lang/rust/issues/83057 diff --git a/tests/rustdoc-json/reexport/reexport_of_hidden.rs b/tests/rustdoc-json/reexport/reexport_of_hidden.rs index 1b6ff5fadca1..62c1dbff2789 100644 --- a/tests/rustdoc-json/reexport/reexport_of_hidden.rs +++ b/tests/rustdoc-json/reexport/reexport_of_hidden.rs @@ -1,4 +1,4 @@ -// compile-flags: --document-hidden-items +//@ compile-flags: --document-hidden-items // @has "$.index[*].inner[?(@.import.name=='UsedHidden')]" // @has "$.index[*][?(@.name=='Hidden')]" diff --git a/tests/rustdoc-json/reexport/rename_private.rs b/tests/rustdoc-json/reexport/rename_private.rs index 3924282a49e5..433829bab308 100644 --- a/tests/rustdoc-json/reexport/rename_private.rs +++ b/tests/rustdoc-json/reexport/rename_private.rs @@ -1,4 +1,4 @@ -// edition:2018 +//@ edition:2018 // @!has "$.index[*][?(@.name=='inner')]" mod inner { diff --git a/tests/rustdoc-json/reexport/rename_public.rs b/tests/rustdoc-json/reexport/rename_public.rs index 636937874483..ebfa3d9f1769 100644 --- a/tests/rustdoc-json/reexport/rename_public.rs +++ b/tests/rustdoc-json/reexport/rename_public.rs @@ -1,4 +1,4 @@ -// edition:2018 +//@ edition:2018 // @set inner_id = "$.index[*][?(@.name=='inner')].id" pub mod inner { diff --git a/tests/rustdoc-json/reexport/simple_private.rs b/tests/rustdoc-json/reexport/simple_private.rs index 2ca8c7fa6be6..7b6509abc8dd 100644 --- a/tests/rustdoc-json/reexport/simple_private.rs +++ b/tests/rustdoc-json/reexport/simple_private.rs @@ -1,4 +1,4 @@ -// edition:2018 +//@ edition:2018 // @!has "$.index[*][?(@.name=='inner')]" mod inner { diff --git a/tests/rustdoc-json/reexport/simple_public.rs b/tests/rustdoc-json/reexport/simple_public.rs index 04611eeb95ca..55d32b99951a 100644 --- a/tests/rustdoc-json/reexport/simple_public.rs +++ b/tests/rustdoc-json/reexport/simple_public.rs @@ -1,4 +1,4 @@ -// edition:2018 +//@ edition:2018 // @set inner_id = "$.index[*][?(@.name=='inner')].id" pub mod inner { diff --git a/tests/rustdoc-json/reexport/synthesize_trait_with_docs.rs b/tests/rustdoc-json/reexport/synthesize_trait_with_docs.rs index 25a7c08d6892..de67badffd53 100644 --- a/tests/rustdoc-json/reexport/synthesize_trait_with_docs.rs +++ b/tests/rustdoc-json/reexport/synthesize_trait_with_docs.rs @@ -1,5 +1,5 @@ // Regression test for -// aux-build: trait_with_docs.rs +//@ aux-build: trait_with_docs.rs extern crate trait_with_docs; diff --git a/tests/rustdoc-ui/ambiguous-inherent-assoc-ty.rs b/tests/rustdoc-ui/ambiguous-inherent-assoc-ty.rs index 94ea0e93bf63..47e431d5cf1b 100644 --- a/tests/rustdoc-ui/ambiguous-inherent-assoc-ty.rs +++ b/tests/rustdoc-ui/ambiguous-inherent-assoc-ty.rs @@ -1,4 +1,4 @@ -// check-pass +//@ check-pass // This test ensures that rustdoc does not panic on inherented associated types // that are referred to without fully-qualified syntax. diff --git a/tests/rustdoc-ui/apit-46976.rs b/tests/rustdoc-ui/apit-46976.rs index c17688e3b1d7..515b5af9465d 100644 --- a/tests/rustdoc-ui/apit-46976.rs +++ b/tests/rustdoc-ui/apit-46976.rs @@ -1,4 +1,4 @@ -// check-pass +//@ check-pass // https://github.com/rust-lang/rust/issues/46976 pub fn ice(f: impl Fn()) {} diff --git a/tests/rustdoc-ui/auxiliary/panic-item.rs b/tests/rustdoc-ui/auxiliary/panic-item.rs index 17b26850d4d2..ccf784f72842 100644 --- a/tests/rustdoc-ui/auxiliary/panic-item.rs +++ b/tests/rustdoc-ui/auxiliary/panic-item.rs @@ -1,4 +1,4 @@ -// no-prefer-dynamic +//@ no-prefer-dynamic #![crate_type = "lib"] #![no_std] #![feature(lang_items)] diff --git a/tests/rustdoc-ui/check-cfg/check-cfg-unstable.rs b/tests/rustdoc-ui/check-cfg/check-cfg-unstable.rs index 806b6d1253da..b24b198e807a 100644 --- a/tests/rustdoc-ui/check-cfg/check-cfg-unstable.rs +++ b/tests/rustdoc-ui/check-cfg/check-cfg-unstable.rs @@ -1,2 +1,2 @@ -// check-fail -// compile-flags: --check-cfg=cfg() +//@ check-fail +//@ compile-flags: --check-cfg=cfg() diff --git a/tests/rustdoc-ui/check-cfg/check-cfg.rs b/tests/rustdoc-ui/check-cfg/check-cfg.rs index 96fa9e08ddee..27b09985728d 100644 --- a/tests/rustdoc-ui/check-cfg/check-cfg.rs +++ b/tests/rustdoc-ui/check-cfg/check-cfg.rs @@ -1,5 +1,5 @@ -// check-pass -// compile-flags: --check-cfg=cfg() -Z unstable-options +//@ check-pass +//@ compile-flags: --check-cfg=cfg() -Z unstable-options /// uniz is nor a builtin nor pass as arguments so is unexpected #[cfg(uniz)] diff --git a/tests/rustdoc-ui/circular-intra-doc-link-48414.rs b/tests/rustdoc-ui/circular-intra-doc-link-48414.rs index 46367ccaef9a..23dc072c6a2d 100644 --- a/tests/rustdoc-ui/circular-intra-doc-link-48414.rs +++ b/tests/rustdoc-ui/circular-intra-doc-link-48414.rs @@ -1,5 +1,5 @@ -// aux-build:issue-48414.rs -// check-pass +//@ aux-build:issue-48414.rs +//@ check-pass // https://github.com/rust-lang/rust/issues/48414 diff --git a/tests/rustdoc-ui/commandline-argfile-badutf8.rs b/tests/rustdoc-ui/commandline-argfile-badutf8.rs index e2984e3ca97a..b3a19fa62741 100644 --- a/tests/rustdoc-ui/commandline-argfile-badutf8.rs +++ b/tests/rustdoc-ui/commandline-argfile-badutf8.rs @@ -1,6 +1,6 @@ // Check to see if we can get parameters from an @argsfile file // -// compile-flags: --cfg cmdline_set @{{src-base}}/commandline-argfile-badutf8.args +//@ compile-flags: --cfg cmdline_set @{{src-base}}/commandline-argfile-badutf8.args #[cfg(not(cmdline_set))] compile_error!("cmdline_set not set"); diff --git a/tests/rustdoc-ui/commandline-argfile-missing.rs b/tests/rustdoc-ui/commandline-argfile-missing.rs index 5a6465bd0646..bb9644d66ce1 100644 --- a/tests/rustdoc-ui/commandline-argfile-missing.rs +++ b/tests/rustdoc-ui/commandline-argfile-missing.rs @@ -1,8 +1,8 @@ // Check to see if we can get parameters from an @argsfile file // -// normalize-stderr-test: "os error \d+" -> "os error $$ERR" -// normalize-stderr-test: "commandline-argfile-missing.args:[^(]*" -> "commandline-argfile-missing.args: $$FILE_MISSING " -// compile-flags: --cfg cmdline_set @{{src-base}}/commandline-argfile-missing.args +//@ normalize-stderr-test: "os error \d+" -> "os error $$ERR" +//@ normalize-stderr-test: "commandline-argfile-missing.args:[^(]*" -> "commandline-argfile-missing.args: $$FILE_MISSING " +//@ compile-flags: --cfg cmdline_set @{{src-base}}/commandline-argfile-missing.args #[cfg(not(cmdline_set))] compile_error!("cmdline_set not set"); diff --git a/tests/rustdoc-ui/commandline-argfile.rs b/tests/rustdoc-ui/commandline-argfile.rs index cc8c8722c1c3..d71bc72562b7 100644 --- a/tests/rustdoc-ui/commandline-argfile.rs +++ b/tests/rustdoc-ui/commandline-argfile.rs @@ -1,7 +1,7 @@ // Check to see if we can get parameters from an @argsfile file // -// check-pass -// compile-flags: --cfg cmdline_set @{{src-base}}/commandline-argfile.args +//@ check-pass +//@ compile-flags: --cfg cmdline_set @{{src-base}}/commandline-argfile.args #[cfg(not(cmdline_set))] compile_error!("cmdline_set not set"); diff --git a/tests/rustdoc-ui/coverage/allow_missing_docs.rs b/tests/rustdoc-ui/coverage/allow_missing_docs.rs index c771c09da883..43f0d731fdea 100644 --- a/tests/rustdoc-ui/coverage/allow_missing_docs.rs +++ b/tests/rustdoc-ui/coverage/allow_missing_docs.rs @@ -1,5 +1,5 @@ -// compile-flags:-Z unstable-options --show-coverage -// check-pass +//@ compile-flags:-Z unstable-options --show-coverage +//@ check-pass //! Make sure to have some docs on your crate root diff --git a/tests/rustdoc-ui/coverage/basic.rs b/tests/rustdoc-ui/coverage/basic.rs index 6c26b751c5e0..febcc80fbbb5 100644 --- a/tests/rustdoc-ui/coverage/basic.rs +++ b/tests/rustdoc-ui/coverage/basic.rs @@ -1,5 +1,5 @@ -// compile-flags:-Z unstable-options --show-coverage -// check-pass +//@ compile-flags:-Z unstable-options --show-coverage +//@ check-pass #![feature(extern_types)] diff --git a/tests/rustdoc-ui/coverage/doc-examples-json.rs b/tests/rustdoc-ui/coverage/doc-examples-json.rs index 1da1813790e8..4aa4bf23771d 100644 --- a/tests/rustdoc-ui/coverage/doc-examples-json.rs +++ b/tests/rustdoc-ui/coverage/doc-examples-json.rs @@ -1,5 +1,5 @@ -// check-pass -// compile-flags:-Z unstable-options --output-format json --show-coverage +//@ check-pass +//@ compile-flags:-Z unstable-options --output-format json --show-coverage // This check ensures that only one doc example is counted since they're "optional" on // certain items. diff --git a/tests/rustdoc-ui/coverage/doc-examples.rs b/tests/rustdoc-ui/coverage/doc-examples.rs index cd718f8a34d1..283d9c424aa1 100644 --- a/tests/rustdoc-ui/coverage/doc-examples.rs +++ b/tests/rustdoc-ui/coverage/doc-examples.rs @@ -1,5 +1,5 @@ -// compile-flags:-Z unstable-options --show-coverage -// check-pass +//@ compile-flags:-Z unstable-options --show-coverage +//@ check-pass //! This test ensure that only rust code examples are counted. diff --git a/tests/rustdoc-ui/coverage/empty.rs b/tests/rustdoc-ui/coverage/empty.rs index 55a87e9d97b3..bcd3e48988b1 100644 --- a/tests/rustdoc-ui/coverage/empty.rs +++ b/tests/rustdoc-ui/coverage/empty.rs @@ -1,4 +1,4 @@ -// compile-flags:-Z unstable-options --show-coverage -// check-pass +//@ compile-flags:-Z unstable-options --show-coverage +//@ check-pass // an empty crate still has one item to document: the crate root diff --git a/tests/rustdoc-ui/coverage/enum-tuple-documented.rs b/tests/rustdoc-ui/coverage/enum-tuple-documented.rs index e9c165b1916e..4cbeb7a164da 100644 --- a/tests/rustdoc-ui/coverage/enum-tuple-documented.rs +++ b/tests/rustdoc-ui/coverage/enum-tuple-documented.rs @@ -1,5 +1,5 @@ -// compile-flags:-Z unstable-options --show-coverage -// check-pass +//@ compile-flags:-Z unstable-options --show-coverage +//@ check-pass // The point of this test is to ensure that the number of "documented" items // is higher than in `enum-tuple.rs`. diff --git a/tests/rustdoc-ui/coverage/enum-tuple.rs b/tests/rustdoc-ui/coverage/enum-tuple.rs index 5fb205450755..5cbc52a7d033 100644 --- a/tests/rustdoc-ui/coverage/enum-tuple.rs +++ b/tests/rustdoc-ui/coverage/enum-tuple.rs @@ -1,5 +1,5 @@ -// compile-flags:-Z unstable-options --show-coverage -// check-pass +//@ compile-flags:-Z unstable-options --show-coverage +//@ check-pass //! (remember the crate root is still a module) diff --git a/tests/rustdoc-ui/coverage/enums.rs b/tests/rustdoc-ui/coverage/enums.rs index a4ae36d6837a..29e419845761 100644 --- a/tests/rustdoc-ui/coverage/enums.rs +++ b/tests/rustdoc-ui/coverage/enums.rs @@ -1,5 +1,5 @@ -// compile-flags:-Z unstable-options --show-coverage -// check-pass +//@ compile-flags:-Z unstable-options --show-coverage +//@ check-pass //! (remember the crate root is still a module) diff --git a/tests/rustdoc-ui/coverage/exotic.rs b/tests/rustdoc-ui/coverage/exotic.rs index f45405fbf5dc..9fc1498cb2a3 100644 --- a/tests/rustdoc-ui/coverage/exotic.rs +++ b/tests/rustdoc-ui/coverage/exotic.rs @@ -1,5 +1,5 @@ -// compile-flags:-Z unstable-options --show-coverage -// check-pass +//@ compile-flags:-Z unstable-options --show-coverage +//@ check-pass #![feature(rustdoc_internals)] #![feature(rustc_attrs)] diff --git a/tests/rustdoc-ui/coverage/html.rs b/tests/rustdoc-ui/coverage/html.rs index 181cb4c5061a..41e1ce1609dc 100644 --- a/tests/rustdoc-ui/coverage/html.rs +++ b/tests/rustdoc-ui/coverage/html.rs @@ -1,4 +1,4 @@ -// compile-flags:-Z unstable-options --output-format html --show-coverage +//@ compile-flags:-Z unstable-options --output-format html --show-coverage /// Foo pub struct Xo; diff --git a/tests/rustdoc-ui/coverage/json.rs b/tests/rustdoc-ui/coverage/json.rs index a591cd5dba40..bfa8dc700830 100644 --- a/tests/rustdoc-ui/coverage/json.rs +++ b/tests/rustdoc-ui/coverage/json.rs @@ -1,5 +1,5 @@ -// check-pass -// compile-flags:-Z unstable-options --output-format json --show-coverage +//@ check-pass +//@ compile-flags:-Z unstable-options --output-format json --show-coverage pub mod foo { /// Hello! diff --git a/tests/rustdoc-ui/coverage/private.rs b/tests/rustdoc-ui/coverage/private.rs index 2a0271727f26..91490eff7a8d 100644 --- a/tests/rustdoc-ui/coverage/private.rs +++ b/tests/rustdoc-ui/coverage/private.rs @@ -1,5 +1,5 @@ -// compile-flags:-Z unstable-options --show-coverage --document-private-items -// check-pass +//@ compile-flags:-Z unstable-options --show-coverage --document-private-items +//@ check-pass #![allow(unused)] diff --git a/tests/rustdoc-ui/coverage/statics-consts.rs b/tests/rustdoc-ui/coverage/statics-consts.rs index 5a35260fa358..85cc23847396 100644 --- a/tests/rustdoc-ui/coverage/statics-consts.rs +++ b/tests/rustdoc-ui/coverage/statics-consts.rs @@ -1,5 +1,5 @@ -// compile-flags:-Z unstable-options --show-coverage -// check-pass +//@ compile-flags:-Z unstable-options --show-coverage +//@ check-pass //! gotta make sure we can count statics and consts correctly, too diff --git a/tests/rustdoc-ui/coverage/traits.rs b/tests/rustdoc-ui/coverage/traits.rs index daa08ec25823..89044369e6a7 100644 --- a/tests/rustdoc-ui/coverage/traits.rs +++ b/tests/rustdoc-ui/coverage/traits.rs @@ -1,5 +1,5 @@ -// compile-flags:-Z unstable-options --show-coverage -// check-pass +//@ compile-flags:-Z unstable-options --show-coverage +//@ check-pass #![feature(trait_alias)] #![feature(type_alias_impl_trait)] diff --git a/tests/rustdoc-ui/crate-reference-in-block-module.rs b/tests/rustdoc-ui/crate-reference-in-block-module.rs index aede030e072b..e27c48568671 100644 --- a/tests/rustdoc-ui/crate-reference-in-block-module.rs +++ b/tests/rustdoc-ui/crate-reference-in-block-module.rs @@ -1,4 +1,4 @@ -// check-pass +//@ check-pass fn main() { /// [](crate) struct X; diff --git a/tests/rustdoc-ui/deprecated-attrs.rs b/tests/rustdoc-ui/deprecated-attrs.rs index 4f6a14fc2c26..e4802ee25182 100644 --- a/tests/rustdoc-ui/deprecated-attrs.rs +++ b/tests/rustdoc-ui/deprecated-attrs.rs @@ -1,6 +1,6 @@ -// check-pass -// compile-flags: --passes unknown-pass -// error-pattern: the `passes` flag no longer functions +//@ check-pass +//@ compile-flags: --passes unknown-pass +//@ error-pattern: the `passes` flag no longer functions #![doc(no_default_passes)] //~^ WARNING attribute is deprecated diff --git a/tests/rustdoc-ui/deref-generic.rs b/tests/rustdoc-ui/deref-generic.rs index bc64beb1b939..51d6dc3db37b 100644 --- a/tests/rustdoc-ui/deref-generic.rs +++ b/tests/rustdoc-ui/deref-generic.rs @@ -1,4 +1,4 @@ -// check-pass +//@ check-pass // #81395: Fix ICE when recursing into Deref target only differing in type args pub struct Generic(T); diff --git a/tests/rustdoc-ui/diagnostic-width.rs b/tests/rustdoc-ui/diagnostic-width.rs index 290d9db775b7..e255496f02e4 100644 --- a/tests/rustdoc-ui/diagnostic-width.rs +++ b/tests/rustdoc-ui/diagnostic-width.rs @@ -1,4 +1,4 @@ -// compile-flags: --diagnostic-width=10 +//@ compile-flags: --diagnostic-width=10 #![deny(rustdoc::bare_urls)] /// This is a long line that contains a http://link.com diff --git a/tests/rustdoc-ui/doc-include-suggestion.rs b/tests/rustdoc-ui/doc-include-suggestion.rs index 0c0100735514..5c8d1efa76fe 100644 --- a/tests/rustdoc-ui/doc-include-suggestion.rs +++ b/tests/rustdoc-ui/doc-include-suggestion.rs @@ -1,4 +1,4 @@ -// check-pass +//@ check-pass #[doc(include = "external-cross-doc.md")] //~^ WARNING unknown `doc` attribute `include` diff --git a/tests/rustdoc-ui/doctest/block-doc-comment.rs b/tests/rustdoc-ui/doctest/block-doc-comment.rs index ce529916e5ed..fdb500a8bdfa 100644 --- a/tests/rustdoc-ui/doctest/block-doc-comment.rs +++ b/tests/rustdoc-ui/doctest/block-doc-comment.rs @@ -1,6 +1,6 @@ -// check-pass -// compile-flags:--test -// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" +//@ check-pass +//@ compile-flags:--test +//@ normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" // This test ensures that no code block is detected in the doc comments. diff --git a/tests/rustdoc-ui/doctest/cfg-test.rs b/tests/rustdoc-ui/doctest/cfg-test.rs index a263baa9738c..3b01f8bd0d0a 100644 --- a/tests/rustdoc-ui/doctest/cfg-test.rs +++ b/tests/rustdoc-ui/doctest/cfg-test.rs @@ -1,7 +1,7 @@ -// check-pass -// compile-flags:--test --test-args --test-threads=1 -// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" -// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" +//@ check-pass +//@ compile-flags:--test --test-args --test-threads=1 +//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +//@ normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" // Crates like core have doctests gated on `cfg(not(test))` so we need to make // sure `cfg(test)` is not active when running `rustdoc --test`. diff --git a/tests/rustdoc-ui/doctest/check-attr-test.rs b/tests/rustdoc-ui/doctest/check-attr-test.rs index e955470148a1..81281db624b3 100644 --- a/tests/rustdoc-ui/doctest/check-attr-test.rs +++ b/tests/rustdoc-ui/doctest/check-attr-test.rs @@ -1,4 +1,4 @@ -// compile-flags:--test +//@ compile-flags:--test #![deny(rustdoc::invalid_codeblock_attributes)] diff --git a/tests/rustdoc-ui/doctest/check-cfg-test.rs b/tests/rustdoc-ui/doctest/check-cfg-test.rs index 38cd59aa790d..c96f0c35333f 100644 --- a/tests/rustdoc-ui/doctest/check-cfg-test.rs +++ b/tests/rustdoc-ui/doctest/check-cfg-test.rs @@ -1,8 +1,8 @@ -// check-pass -// compile-flags: --test --nocapture --check-cfg=cfg(feature,values("test")) -Z unstable-options -// normalize-stderr-test: "tests/rustdoc-ui/doctest" -> "$$DIR" -// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" -// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" +//@ check-pass +//@ compile-flags: --test --nocapture --check-cfg=cfg(feature,values("test")) -Z unstable-options +//@ normalize-stderr-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +//@ normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" /// The doctest will produce a warning because feature invalid is unexpected /// ``` diff --git a/tests/rustdoc-ui/doctest/display-output.rs b/tests/rustdoc-ui/doctest/display-output.rs index 7a26dbff9861..080d34398a56 100644 --- a/tests/rustdoc-ui/doctest/display-output.rs +++ b/tests/rustdoc-ui/doctest/display-output.rs @@ -1,10 +1,10 @@ // Test that `--show-output` has an effect and `allow(unused)` can be overridden. -// check-pass -// edition:2018 -// compile-flags:--test --test-args=--show-output -// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" -// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" +//@ check-pass +//@ edition:2018 +//@ compile-flags:--test --test-args=--show-output +//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +//@ normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" /// ``` /// #![warn(unused)] diff --git a/tests/rustdoc-ui/doctest/doc-comment-multi-line-attr.rs b/tests/rustdoc-ui/doctest/doc-comment-multi-line-attr.rs index 75508f435b3c..c09796df6f1d 100644 --- a/tests/rustdoc-ui/doctest/doc-comment-multi-line-attr.rs +++ b/tests/rustdoc-ui/doctest/doc-comment-multi-line-attr.rs @@ -1,8 +1,8 @@ // Regression test for #97440: Multiline inner attribute triggers ICE during doctest -// compile-flags:--test -// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" -// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" -// check-pass +//@ compile-flags:--test +//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +//@ normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" +//@ check-pass //! ```rust //! #![deny( diff --git a/tests/rustdoc-ui/doctest/doc-comment-multi-line-cfg-attr.rs b/tests/rustdoc-ui/doctest/doc-comment-multi-line-cfg-attr.rs index 3b0b27edb7d0..832f720ef3f6 100644 --- a/tests/rustdoc-ui/doctest/doc-comment-multi-line-cfg-attr.rs +++ b/tests/rustdoc-ui/doctest/doc-comment-multi-line-cfg-attr.rs @@ -1,7 +1,7 @@ -// compile-flags:--test -// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" -// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" -// check-pass +//@ compile-flags:--test +//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +//@ normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" +//@ check-pass /// ``` /// # #![cfg_attr(not(dox), deny(missing_abi, diff --git a/tests/rustdoc-ui/doctest/doc-test-attr-pass.rs b/tests/rustdoc-ui/doctest/doc-test-attr-pass.rs index 12608f244507..edbfde90bcef 100644 --- a/tests/rustdoc-ui/doctest/doc-test-attr-pass.rs +++ b/tests/rustdoc-ui/doctest/doc-test-attr-pass.rs @@ -1,4 +1,4 @@ -// check-pass +//@ check-pass #![crate_type = "lib"] #![deny(invalid_doc_attributes)] diff --git a/tests/rustdoc-ui/doctest/doc-test-doctest-feature.rs b/tests/rustdoc-ui/doctest/doc-test-doctest-feature.rs index 9c1f4936eab3..2bec9414f1d7 100644 --- a/tests/rustdoc-ui/doctest/doc-test-doctest-feature.rs +++ b/tests/rustdoc-ui/doctest/doc-test-doctest-feature.rs @@ -1,7 +1,7 @@ -// check-pass -// compile-flags:--test -// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" -// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" +//@ check-pass +//@ compile-flags:--test +//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +//@ normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" // Make sure `cfg(doctest)` is set when finding doctests but not inside // the doctests. diff --git a/tests/rustdoc-ui/doctest/doc-test-rustdoc-feature.rs b/tests/rustdoc-ui/doctest/doc-test-rustdoc-feature.rs index 1f90d13af84f..765bbd244a60 100644 --- a/tests/rustdoc-ui/doctest/doc-test-rustdoc-feature.rs +++ b/tests/rustdoc-ui/doctest/doc-test-rustdoc-feature.rs @@ -1,7 +1,7 @@ -// check-pass -// compile-flags:--test -// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" -// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" +//@ check-pass +//@ compile-flags:--test +//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +//@ normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" #![feature(doc_cfg)] diff --git a/tests/rustdoc-ui/doctest/doctest-edition.rs b/tests/rustdoc-ui/doctest/doctest-edition.rs index b0787be972f2..008c84f71623 100644 --- a/tests/rustdoc-ui/doctest/doctest-edition.rs +++ b/tests/rustdoc-ui/doctest/doctest-edition.rs @@ -1,4 +1,4 @@ -// edition:2021 +//@ edition:2021 #![deny(rustdoc::invalid_rust_codeblocks)] //~^ NOTE lint level is defined here diff --git a/tests/rustdoc-ui/doctest/doctest-multiline-crate-attribute.rs b/tests/rustdoc-ui/doctest/doctest-multiline-crate-attribute.rs index a3bde6cb9410..c626c3b62610 100644 --- a/tests/rustdoc-ui/doctest/doctest-multiline-crate-attribute.rs +++ b/tests/rustdoc-ui/doctest/doctest-multiline-crate-attribute.rs @@ -1,7 +1,7 @@ -// compile-flags:--test --test-args=--test-threads=1 -// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" -// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" -// check-pass +//@ compile-flags:--test --test-args=--test-threads=1 +//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +//@ normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" +//@ check-pass /// ``` /// #![deprecated(since = "5.2", note = "foo was rarely used. \ diff --git a/tests/rustdoc-ui/doctest/doctest-output.rs b/tests/rustdoc-ui/doctest/doctest-output.rs index 26754b73f0bc..0bd032669f8e 100644 --- a/tests/rustdoc-ui/doctest/doctest-output.rs +++ b/tests/rustdoc-ui/doctest/doctest-output.rs @@ -1,9 +1,9 @@ -// edition:2018 -// aux-build:extern_macros.rs -// compile-flags:--test --test-args=--test-threads=1 -// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" -// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" -// check-pass +//@ edition:2018 +//@ aux-build:extern_macros.rs +//@ compile-flags:--test --test-args=--test-threads=1 +//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +//@ normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" +//@ check-pass //! ``` //! assert_eq!(1 + 1, 2); diff --git a/tests/rustdoc-ui/doctest/failed-doctest-compile-fail.rs b/tests/rustdoc-ui/doctest/failed-doctest-compile-fail.rs index 53b3857dfde6..5e79ee04687a 100644 --- a/tests/rustdoc-ui/doctest/failed-doctest-compile-fail.rs +++ b/tests/rustdoc-ui/doctest/failed-doctest-compile-fail.rs @@ -1,10 +1,10 @@ // FIXME: if/when the output of the test harness can be tested on its own, this test should be // adapted to use that, and that normalize line can go away -// compile-flags:--test -// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" -// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" -// failure-status: 101 +//@ compile-flags:--test +//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +//@ normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" +//@ failure-status: 101 /// ```compile_fail /// println!("Hello"); diff --git a/tests/rustdoc-ui/doctest/failed-doctest-extra-semicolon-on-item.rs b/tests/rustdoc-ui/doctest/failed-doctest-extra-semicolon-on-item.rs index 84e4d61603ae..bedb2ac64dba 100644 --- a/tests/rustdoc-ui/doctest/failed-doctest-extra-semicolon-on-item.rs +++ b/tests/rustdoc-ui/doctest/failed-doctest-extra-semicolon-on-item.rs @@ -1,10 +1,10 @@ // FIXME: if/when the output of the test harness can be tested on its own, this test should be // adapted to use that, and that normalize line can go away -// compile-flags:--test -// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" -// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" -// failure-status: 101 +//@ compile-flags:--test +//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +//@ normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" +//@ failure-status: 101 /// /// diff --git a/tests/rustdoc-ui/doctest/failed-doctest-missing-codes.rs b/tests/rustdoc-ui/doctest/failed-doctest-missing-codes.rs index 4e3b848fc02b..70db072f7266 100644 --- a/tests/rustdoc-ui/doctest/failed-doctest-missing-codes.rs +++ b/tests/rustdoc-ui/doctest/failed-doctest-missing-codes.rs @@ -1,10 +1,10 @@ // FIXME: if/when the output of the test harness can be tested on its own, this test should be // adapted to use that, and that normalize line can go away -// compile-flags:--test -// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" -// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" -// failure-status: 101 +//@ compile-flags:--test +//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +//@ normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" +//@ failure-status: 101 /// ```compile_fail,E0004 /// let x: () = 5i32; diff --git a/tests/rustdoc-ui/doctest/failed-doctest-output-windows.rs b/tests/rustdoc-ui/doctest/failed-doctest-output-windows.rs index 6bc6c33c76ec..5e1ecf82f582 100644 --- a/tests/rustdoc-ui/doctest/failed-doctest-output-windows.rs +++ b/tests/rustdoc-ui/doctest/failed-doctest-output-windows.rs @@ -1,15 +1,15 @@ -// only-windows +//@ only-windows // There's a parallel generic version of this test for non-windows platforms. // Issue #51162: A failed doctest was not printing its stdout/stderr // FIXME: if/when the output of the test harness can be tested on its own, this test should be // adapted to use that, and that normalize line can go away -// compile-flags:--test --test-args --test-threads=1 -// rustc-env:RUST_BACKTRACE=0 -// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" -// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" -// failure-status: 101 +//@ compile-flags:--test --test-args --test-threads=1 +//@ rustc-env:RUST_BACKTRACE=0 +//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +//@ normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" +//@ failure-status: 101 // doctest fails at runtime /// ``` diff --git a/tests/rustdoc-ui/doctest/failed-doctest-output.rs b/tests/rustdoc-ui/doctest/failed-doctest-output.rs index 3e1312382ee8..d4d49b73793e 100644 --- a/tests/rustdoc-ui/doctest/failed-doctest-output.rs +++ b/tests/rustdoc-ui/doctest/failed-doctest-output.rs @@ -1,15 +1,15 @@ -// ignore-windows +//@ ignore-windows // There's a parallel version of this test for Windows. // Issue #51162: A failed doctest was not printing its stdout/stderr // FIXME: if/when the output of the test harness can be tested on its own, this test should be // adapted to use that, and that normalize line can go away -// compile-flags:--test --test-args --test-threads=1 -// rustc-env:RUST_BACKTRACE=0 -// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" -// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" -// failure-status: 101 +//@ compile-flags:--test --test-args --test-threads=1 +//@ rustc-env:RUST_BACKTRACE=0 +//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +//@ normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" +//@ failure-status: 101 // doctest fails at runtime /// ``` diff --git a/tests/rustdoc-ui/doctest/failed-doctest-should-panic.rs b/tests/rustdoc-ui/doctest/failed-doctest-should-panic.rs index 36284e814f3c..6426fd353a7f 100644 --- a/tests/rustdoc-ui/doctest/failed-doctest-should-panic.rs +++ b/tests/rustdoc-ui/doctest/failed-doctest-should-panic.rs @@ -1,10 +1,10 @@ // FIXME: if/when the output of the test harness can be tested on its own, this test should be // adapted to use that, and that normalize line can go away -// compile-flags:--test -// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" -// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" -// failure-status: 101 +//@ compile-flags:--test +//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +//@ normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" +//@ failure-status: 101 /// ```should_panic /// println!("Hello, world!"); diff --git a/tests/rustdoc-ui/doctest/no-run-flag-error.rs b/tests/rustdoc-ui/doctest/no-run-flag-error.rs index 4ead621482bf..896d7729b8df 100644 --- a/tests/rustdoc-ui/doctest/no-run-flag-error.rs +++ b/tests/rustdoc-ui/doctest/no-run-flag-error.rs @@ -1,6 +1,6 @@ // test the behavior of the --no-run flag without the --test flag -// compile-flags:-Z unstable-options --no-run --test-args=--test-threads=1 -// error-pattern: the `--test` flag must be passed +//@ compile-flags:-Z unstable-options --no-run --test-args=--test-threads=1 +//@ error-pattern: the `--test` flag must be passed pub fn f() {} diff --git a/tests/rustdoc-ui/doctest/no-run-flag.rs b/tests/rustdoc-ui/doctest/no-run-flag.rs index 1cf3b7c4bb3d..bdb977b5504d 100644 --- a/tests/rustdoc-ui/doctest/no-run-flag.rs +++ b/tests/rustdoc-ui/doctest/no-run-flag.rs @@ -1,9 +1,9 @@ // test the behavior of the --no-run flag -// check-pass -// compile-flags:-Z unstable-options --test --no-run --test-args=--test-threads=1 -// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" -// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" +//@ check-pass +//@ compile-flags:-Z unstable-options --test --no-run --test-args=--test-threads=1 +//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +//@ normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" /// ``` /// let a = true; diff --git a/tests/rustdoc-ui/doctest/nocapture-fail.rs b/tests/rustdoc-ui/doctest/nocapture-fail.rs index ce487a43db41..9c225174270c 100644 --- a/tests/rustdoc-ui/doctest/nocapture-fail.rs +++ b/tests/rustdoc-ui/doctest/nocapture-fail.rs @@ -1,8 +1,8 @@ -// check-pass -// compile-flags:--test -Zunstable-options --nocapture -// normalize-stderr-test: "tests/rustdoc-ui/doctest" -> "$$DIR" -// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" -// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" +//@ check-pass +//@ compile-flags:--test -Zunstable-options --nocapture +//@ normalize-stderr-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +//@ normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" /// ```compile_fail /// fn foo() { diff --git a/tests/rustdoc-ui/doctest/nocapture.rs b/tests/rustdoc-ui/doctest/nocapture.rs index 25fbcf857e25..39785286fb17 100644 --- a/tests/rustdoc-ui/doctest/nocapture.rs +++ b/tests/rustdoc-ui/doctest/nocapture.rs @@ -1,7 +1,7 @@ -// check-pass -// compile-flags:--test -Zunstable-options --nocapture -// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" -// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" +//@ check-pass +//@ compile-flags:--test -Zunstable-options --nocapture +//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +//@ normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" /// ``` /// println!("hello!"); diff --git a/tests/rustdoc-ui/doctest/private-doc-test.rs b/tests/rustdoc-ui/doctest/private-doc-test.rs index a1f9f8dca083..911cbdbb89da 100644 --- a/tests/rustdoc-ui/doctest/private-doc-test.rs +++ b/tests/rustdoc-ui/doctest/private-doc-test.rs @@ -1,4 +1,4 @@ -// check-pass +//@ check-pass #![deny(rustdoc::private_doc_tests)] diff --git a/tests/rustdoc-ui/doctest/public-reexported-item-doc-test.rs b/tests/rustdoc-ui/doctest/public-reexported-item-doc-test.rs index b86a53305a17..e786c03470b7 100644 --- a/tests/rustdoc-ui/doctest/public-reexported-item-doc-test.rs +++ b/tests/rustdoc-ui/doctest/public-reexported-item-doc-test.rs @@ -1,4 +1,4 @@ -// check-pass +//@ check-pass #![deny(rustdoc::private_doc_tests)] diff --git a/tests/rustdoc-ui/doctest/run-directory.rs b/tests/rustdoc-ui/doctest/run-directory.rs index 1ff0af2d17cb..2fc18470133c 100644 --- a/tests/rustdoc-ui/doctest/run-directory.rs +++ b/tests/rustdoc-ui/doctest/run-directory.rs @@ -1,11 +1,11 @@ // this test asserts that the cwd of doctest invocations is set correctly. -// revisions: correct incorrect -// check-pass -// [correct]compile-flags:--test --test-run-directory={{src-base}} -// [incorrect]compile-flags:--test --test-run-directory={{src-base}}/coverage -// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" -// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" +//@ revisions: correct incorrect +//@ check-pass +//@ [correct]compile-flags:--test --test-run-directory={{src-base}} +//@ [incorrect]compile-flags:--test --test-run-directory={{src-base}}/coverage +//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +//@ normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" /// ``` /// assert_eq!( diff --git a/tests/rustdoc-ui/doctest/test-compile-fail1.rs b/tests/rustdoc-ui/doctest/test-compile-fail1.rs index a05390238784..278f01f4c838 100644 --- a/tests/rustdoc-ui/doctest/test-compile-fail1.rs +++ b/tests/rustdoc-ui/doctest/test-compile-fail1.rs @@ -1,4 +1,4 @@ -// compile-flags:--test +//@ compile-flags:--test /// ``` /// assert!(true) diff --git a/tests/rustdoc-ui/doctest/test-compile-fail2.rs b/tests/rustdoc-ui/doctest/test-compile-fail2.rs index 651ded0a0479..7432cc9f8263 100644 --- a/tests/rustdoc-ui/doctest/test-compile-fail2.rs +++ b/tests/rustdoc-ui/doctest/test-compile-fail2.rs @@ -1,3 +1,3 @@ -// compile-flags:--test +//@ compile-flags:--test fail diff --git a/tests/rustdoc-ui/doctest/test-compile-fail3.rs b/tests/rustdoc-ui/doctest/test-compile-fail3.rs index faa30ad83671..a2486d9dc6f2 100644 --- a/tests/rustdoc-ui/doctest/test-compile-fail3.rs +++ b/tests/rustdoc-ui/doctest/test-compile-fail3.rs @@ -1,3 +1,3 @@ -// compile-flags:--test +//@ compile-flags:--test "fail diff --git a/tests/rustdoc-ui/doctest/test-no_std.rs b/tests/rustdoc-ui/doctest/test-no_std.rs index fd651d1a3442..897927f41569 100644 --- a/tests/rustdoc-ui/doctest/test-no_std.rs +++ b/tests/rustdoc-ui/doctest/test-no_std.rs @@ -1,7 +1,7 @@ -// compile-flags:--test -// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" -// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" -// check-pass +//@ compile-flags:--test +//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +//@ normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" +//@ check-pass #![no_std] diff --git a/tests/rustdoc-ui/doctest/test-type.rs b/tests/rustdoc-ui/doctest/test-type.rs index 036d37f9db2b..d18143368e86 100644 --- a/tests/rustdoc-ui/doctest/test-type.rs +++ b/tests/rustdoc-ui/doctest/test-type.rs @@ -1,7 +1,7 @@ -// compile-flags: --test --test-args=--test-threads=1 -// check-pass -// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" -// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" +//@ compile-flags: --test --test-args=--test-threads=1 +//@ check-pass +//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +//@ normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" /// ``` /// let a = true; diff --git a/tests/rustdoc-ui/doctest/unparseable-doc-test.rs b/tests/rustdoc-ui/doctest/unparseable-doc-test.rs index fd8b2094d020..e96e3b9cd358 100644 --- a/tests/rustdoc-ui/doctest/unparseable-doc-test.rs +++ b/tests/rustdoc-ui/doctest/unparseable-doc-test.rs @@ -1,8 +1,8 @@ -// compile-flags: --test -// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" -// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" -// failure-status: 101 -// rustc-env: RUST_BACKTRACE=0 +//@ compile-flags: --test +//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +//@ normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" +//@ failure-status: 101 +//@ rustc-env: RUST_BACKTRACE=0 /// ```rust /// let x = 7; diff --git a/tests/rustdoc-ui/error-in-impl-trait/async.rs b/tests/rustdoc-ui/error-in-impl-trait/async.rs index cda53bff07a1..b7e740163cdc 100644 --- a/tests/rustdoc-ui/error-in-impl-trait/async.rs +++ b/tests/rustdoc-ui/error-in-impl-trait/async.rs @@ -1,5 +1,5 @@ -// edition:2018 -// check-pass +//@ edition:2018 +//@ check-pass /// Should compile fine pub async fn a() -> u32 { diff --git a/tests/rustdoc-ui/error-in-impl-trait/closure.rs b/tests/rustdoc-ui/error-in-impl-trait/closure.rs index 628c61a6a1a8..74aae098e575 100644 --- a/tests/rustdoc-ui/error-in-impl-trait/closure.rs +++ b/tests/rustdoc-ui/error-in-impl-trait/closure.rs @@ -1,4 +1,4 @@ -// check-pass +//@ check-pass // manually desugared version of an `async fn` (but with a closure instead of a coroutine) pub fn a() -> impl Fn() -> u32 { || content::doesnt::matter() diff --git a/tests/rustdoc-ui/error-in-impl-trait/const-generics.rs b/tests/rustdoc-ui/error-in-impl-trait/const-generics.rs index ed62f0208aa5..948014bb8580 100644 --- a/tests/rustdoc-ui/error-in-impl-trait/const-generics.rs +++ b/tests/rustdoc-ui/error-in-impl-trait/const-generics.rs @@ -1,5 +1,5 @@ -// check-pass -// edition:2018 +//@ check-pass +//@ edition:2018 trait ValidTrait {} /// This has docs diff --git a/tests/rustdoc-ui/error-in-impl-trait/generic-argument.rs b/tests/rustdoc-ui/error-in-impl-trait/generic-argument.rs index dcec379d47e9..735d0f5db389 100644 --- a/tests/rustdoc-ui/error-in-impl-trait/generic-argument.rs +++ b/tests/rustdoc-ui/error-in-impl-trait/generic-argument.rs @@ -1,4 +1,4 @@ -// check-pass +//@ check-pass trait ValidTrait {} /// This has docs diff --git a/tests/rustdoc-ui/error-in-impl-trait/impl-keyword-closure.rs b/tests/rustdoc-ui/error-in-impl-trait/impl-keyword-closure.rs index b935b0832f06..fef2520ddbe2 100644 --- a/tests/rustdoc-ui/error-in-impl-trait/impl-keyword-closure.rs +++ b/tests/rustdoc-ui/error-in-impl-trait/impl-keyword-closure.rs @@ -1,4 +1,4 @@ -// check-pass +//@ check-pass pub trait ValidTrait {} /// This returns impl trait pub fn g() -> impl ValidTrait { diff --git a/tests/rustdoc-ui/error-in-impl-trait/impl-keyword.rs b/tests/rustdoc-ui/error-in-impl-trait/impl-keyword.rs index 701126f87a1f..0cb5c33ef0de 100644 --- a/tests/rustdoc-ui/error-in-impl-trait/impl-keyword.rs +++ b/tests/rustdoc-ui/error-in-impl-trait/impl-keyword.rs @@ -1,4 +1,4 @@ -// check-pass +//@ check-pass pub trait ValidTrait {} /// This returns impl trait pub fn g() -> impl ValidTrait { diff --git a/tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type-impl-trait-return.rs b/tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type-impl-trait-return.rs index 939da186fbcd..dfa528acb263 100644 --- a/tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type-impl-trait-return.rs +++ b/tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type-impl-trait-return.rs @@ -1,6 +1,6 @@ -// normalize-stderr-test: "`.*`" -> "`DEF_ID`" -// normalize-stdout-test: "`.*`" -> "`DEF_ID`" -// edition:2018 +//@ normalize-stderr-test: "`.*`" -> "`DEF_ID`" +//@ normalize-stdout-test: "`.*`" -> "`DEF_ID`" +//@ edition:2018 pub async fn f() -> impl std::fmt::Debug { #[derive(Debug)] diff --git a/tests/rustdoc-ui/error-in-impl-trait/realistic-async.rs b/tests/rustdoc-ui/error-in-impl-trait/realistic-async.rs index 248575d35284..6c53c2912e1e 100644 --- a/tests/rustdoc-ui/error-in-impl-trait/realistic-async.rs +++ b/tests/rustdoc-ui/error-in-impl-trait/realistic-async.rs @@ -1,5 +1,5 @@ -// edition:2018 -// check-pass +//@ edition:2018 +//@ check-pass mod windows { pub trait WinFoo { diff --git a/tests/rustdoc-ui/error-in-impl-trait/trait-alias-closure.rs b/tests/rustdoc-ui/error-in-impl-trait/trait-alias-closure.rs index 31dd786cbbf8..b3fd59a72756 100644 --- a/tests/rustdoc-ui/error-in-impl-trait/trait-alias-closure.rs +++ b/tests/rustdoc-ui/error-in-impl-trait/trait-alias-closure.rs @@ -1,4 +1,4 @@ -// check-pass +//@ check-pass #![feature(type_alias_impl_trait)] pub trait ValidTrait {} diff --git a/tests/rustdoc-ui/error-in-impl-trait/trait-alias.rs b/tests/rustdoc-ui/error-in-impl-trait/trait-alias.rs index c18a024af4bb..9e715e0d324e 100644 --- a/tests/rustdoc-ui/error-in-impl-trait/trait-alias.rs +++ b/tests/rustdoc-ui/error-in-impl-trait/trait-alias.rs @@ -1,4 +1,4 @@ -// check-pass +//@ check-pass #![feature(type_alias_impl_trait)] pub trait ValidTrait {} diff --git a/tests/rustdoc-ui/feature-gate-custom_code_classes_in_docs.rs b/tests/rustdoc-ui/feature-gate-custom_code_classes_in_docs.rs index 1e7cdfc9ba7a..e96444039f4c 100644 --- a/tests/rustdoc-ui/feature-gate-custom_code_classes_in_docs.rs +++ b/tests/rustdoc-ui/feature-gate-custom_code_classes_in_docs.rs @@ -1,4 +1,4 @@ -// check-pass +//@ check-pass /// ```{class=language-c} /// int main(void) { return 0; } diff --git a/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt-unstable.rs b/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt-unstable.rs index 87620d74ee64..0ea2edb6f5a6 100644 --- a/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt-unstable.rs +++ b/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt-unstable.rs @@ -1,6 +1,6 @@ // This test purpose is to check that the "--generate-link-to-definition" // option can only be used on nightly. -// compile-flags: --generate-link-to-definition +//@ compile-flags: --generate-link-to-definition pub fn f() {} diff --git a/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt.rs b/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt.rs index 8f4f561b44dc..f11b94bb036c 100644 --- a/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt.rs +++ b/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt.rs @@ -1,6 +1,6 @@ // This test purpose is to check that the "--generate-link-to-definition" // option can only be used with HTML generation. -// compile-flags: -Zunstable-options --generate-link-to-definition --output-format json +//@ compile-flags: -Zunstable-options --generate-link-to-definition --output-format json pub fn f() {} diff --git a/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt2.rs b/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt2.rs index da5142087dde..718522059799 100644 --- a/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt2.rs +++ b/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt2.rs @@ -1,6 +1,6 @@ // This test purpose is to check that the "--generate-link-to-definition" // option can only be used with HTML generation. -// compile-flags: -Zunstable-options --generate-link-to-definition --show-coverage +//@ compile-flags: -Zunstable-options --generate-link-to-definition --show-coverage pub fn f() {} diff --git a/tests/rustdoc-ui/hidden-trait-method-34423.rs b/tests/rustdoc-ui/hidden-trait-method-34423.rs index f3107d2379c9..8f3572e35bcd 100644 --- a/tests/rustdoc-ui/hidden-trait-method-34423.rs +++ b/tests/rustdoc-ui/hidden-trait-method-34423.rs @@ -1,4 +1,4 @@ -// check-pass +//@ check-pass // https://github.com/rust-lang/rust/issues/34423 pub struct Foo; diff --git a/tests/rustdoc-ui/ice-assoc-const-for-primitive-31808.rs b/tests/rustdoc-ui/ice-assoc-const-for-primitive-31808.rs index 6e4709403a4d..2c1c666b22c2 100644 --- a/tests/rustdoc-ui/ice-assoc-const-for-primitive-31808.rs +++ b/tests/rustdoc-ui/ice-assoc-const-for-primitive-31808.rs @@ -1,4 +1,4 @@ -// check-pass +//@ check-pass // Test that associated item impls on primitive types don't crash rustdoc diff --git a/tests/rustdoc-ui/ice-blanket-impl-52873.rs b/tests/rustdoc-ui/ice-blanket-impl-52873.rs index 2520957bd005..b150d41ce2ad 100644 --- a/tests/rustdoc-ui/ice-blanket-impl-52873.rs +++ b/tests/rustdoc-ui/ice-blanket-impl-52873.rs @@ -1,4 +1,4 @@ -// check-pass +//@ check-pass // https://github.com/rust-lang/rust/issues/52873 #![crate_name="foo"] diff --git a/tests/rustdoc-ui/ice-blanket-impl-selection-55001.rs b/tests/rustdoc-ui/ice-blanket-impl-selection-55001.rs index babcb3dda143..89d3904af4e1 100644 --- a/tests/rustdoc-ui/ice-blanket-impl-selection-55001.rs +++ b/tests/rustdoc-ui/ice-blanket-impl-selection-55001.rs @@ -1,4 +1,4 @@ -// check-pass +//@ check-pass // https://github.com/rust-lang/rust/issues/55001 #![crate_name="foo"] diff --git a/tests/rustdoc-ui/ice-bug-report-url.rs b/tests/rustdoc-ui/ice-bug-report-url.rs index a3fa819ab5e1..7c289b7c0cb6 100644 --- a/tests/rustdoc-ui/ice-bug-report-url.rs +++ b/tests/rustdoc-ui/ice-bug-report-url.rs @@ -1,15 +1,15 @@ -// compile-flags: -Ztreat-err-as-bug -// rustc-env:RUSTC_ICE=0 -// failure-status: 101 -// error-pattern: aborting due to -// error-pattern: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-rustdoc&template=ice.md +//@ compile-flags: -Ztreat-err-as-bug +//@ rustc-env:RUSTC_ICE=0 +//@ failure-status: 101 +//@ error-pattern: aborting due to +//@ error-pattern: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-rustdoc&template=ice.md -// normalize-stderr-test "note: compiler flags.*\n\n" -> "" -// normalize-stderr-test "note: rustc.*running on.*" -> "note: rustc {version} running on {platform}" -// normalize-stderr-test "thread.*panicked at compiler.*" -> "" -// normalize-stderr-test " +\d{1,}: .*\n" -> "" -// normalize-stderr-test " + at .*\n" -> "" -// normalize-stderr-test ".*note: Some details are omitted.*\n" -> "" +//@ normalize-stderr-test "note: compiler flags.*\n\n" -> "" +//@ normalize-stderr-test "note: rustc.*running on.*" -> "note: rustc {version} running on {platform}" +//@ normalize-stderr-test "thread.*panicked at compiler.*" -> "" +//@ normalize-stderr-test " +\d{1,}: .*\n" -> "" +//@ normalize-stderr-test " + at .*\n" -> "" +//@ normalize-stderr-test ".*note: Some details are omitted.*\n" -> "" fn wrong() //~^ ERROR expected one of diff --git a/tests/rustdoc-ui/ignore-block-help.rs b/tests/rustdoc-ui/ignore-block-help.rs index 86f6a2868fb5..bc46cdb0e00c 100644 --- a/tests/rustdoc-ui/ignore-block-help.rs +++ b/tests/rustdoc-ui/ignore-block-help.rs @@ -1,4 +1,4 @@ -// check-pass +//@ check-pass /// ```ignore (to-prevent-tidy-error) /// let heart = '❤️'; diff --git a/tests/rustdoc-ui/inherent-assoc-consts-36031.rs b/tests/rustdoc-ui/inherent-assoc-consts-36031.rs index 755fc1cfdff2..e487d130671f 100644 --- a/tests/rustdoc-ui/inherent-assoc-consts-36031.rs +++ b/tests/rustdoc-ui/inherent-assoc-consts-36031.rs @@ -1,7 +1,7 @@ -// aux-build:issue-36031.rs -// check-pass -// build-aux-docs -// ignore-cross-compile +//@ aux-build:issue-36031.rs +//@ check-pass +//@ build-aux-docs +//@ ignore-cross-compile // https://github.com/rust-lang/rust/issues/36031 diff --git a/tests/rustdoc-ui/intra-doc/assoc-field.rs b/tests/rustdoc-ui/intra-doc/assoc-field.rs index e18404e44306..00373fe21de6 100644 --- a/tests/rustdoc-ui/intra-doc/assoc-field.rs +++ b/tests/rustdoc-ui/intra-doc/assoc-field.rs @@ -1,7 +1,7 @@ // Traits in scope are collected for doc links in field attributes. -// check-pass -// aux-build: assoc-field-dep.rs +//@ check-pass +//@ aux-build: assoc-field-dep.rs extern crate assoc_field_dep; pub use assoc_field_dep::*; diff --git a/tests/rustdoc-ui/intra-doc/assoc-mod-inner-outer.rs b/tests/rustdoc-ui/intra-doc/assoc-mod-inner-outer.rs index b4ce3443ccd1..cb656edb5b30 100644 --- a/tests/rustdoc-ui/intra-doc/assoc-mod-inner-outer.rs +++ b/tests/rustdoc-ui/intra-doc/assoc-mod-inner-outer.rs @@ -1,7 +1,7 @@ // Traits in scope are collected for doc links in both outer and inner module attributes. -// check-pass -// aux-build: assoc-mod-inner-outer-dep.rs +//@ check-pass +//@ aux-build: assoc-mod-inner-outer-dep.rs extern crate assoc_mod_inner_outer_dep; pub use assoc_mod_inner_outer_dep::*; diff --git a/tests/rustdoc-ui/intra-doc/auxiliary/through-proc-macro-aux.rs b/tests/rustdoc-ui/intra-doc/auxiliary/through-proc-macro-aux.rs index 5c4a01ee3a74..80f0797e83fe 100644 --- a/tests/rustdoc-ui/intra-doc/auxiliary/through-proc-macro-aux.rs +++ b/tests/rustdoc-ui/intra-doc/auxiliary/through-proc-macro-aux.rs @@ -1,5 +1,5 @@ -// force-host -// no-prefer-dynamic +//@ force-host +//@ no-prefer-dynamic #![crate_type = "proc-macro"] #![crate_name="some_macros"] diff --git a/tests/rustdoc-ui/intra-doc/broken-link-in-unused-doc-string.rs b/tests/rustdoc-ui/intra-doc/broken-link-in-unused-doc-string.rs index f3f044f61058..b88a52fb80f8 100644 --- a/tests/rustdoc-ui/intra-doc/broken-link-in-unused-doc-string.rs +++ b/tests/rustdoc-ui/intra-doc/broken-link-in-unused-doc-string.rs @@ -1,7 +1,7 @@ // Test that we don't ICE with broken links that don't show up in the docs. -// check-pass -// edition: 2021 +//@ check-pass +//@ edition: 2021 /// [1] //~^ WARN unresolved link to `1` diff --git a/tests/rustdoc-ui/intra-doc/broken-reexport.rs b/tests/rustdoc-ui/intra-doc/broken-reexport.rs index 862faa50b4dd..233396fbddaf 100644 --- a/tests/rustdoc-ui/intra-doc/broken-reexport.rs +++ b/tests/rustdoc-ui/intra-doc/broken-reexport.rs @@ -1,5 +1,5 @@ -// aux-build:intra-doc-broken.rs -// check-pass +//@ aux-build:intra-doc-broken.rs +//@ check-pass #![deny(rustdoc::broken_intra_doc_links)] diff --git a/tests/rustdoc-ui/intra-doc/double-anchor.rs b/tests/rustdoc-ui/intra-doc/double-anchor.rs index a01211c4f32b..ceb74c25af23 100644 --- a/tests/rustdoc-ui/intra-doc/double-anchor.rs +++ b/tests/rustdoc-ui/intra-doc/double-anchor.rs @@ -1,4 +1,4 @@ -// check-pass +//@ check-pass // regression test for #73264 // should only give one error diff --git a/tests/rustdoc-ui/intra-doc/email-address-localhost.rs b/tests/rustdoc-ui/intra-doc/email-address-localhost.rs index 7a5156e81c4c..adef39527eb0 100644 --- a/tests/rustdoc-ui/intra-doc/email-address-localhost.rs +++ b/tests/rustdoc-ui/intra-doc/email-address-localhost.rs @@ -1,5 +1,5 @@ -// normalize-stderr-test: "nightly|beta|1\.[0-9][0-9]\.[0-9]" -> "$$CHANNEL" -// check-pass +//@ normalize-stderr-test: "nightly|beta|1\.[0-9][0-9]\.[0-9]" -> "$$CHANNEL" +//@ check-pass #![deny(warnings)] //! Email me at . diff --git a/tests/rustdoc-ui/intra-doc/extern-crate-load.rs b/tests/rustdoc-ui/intra-doc/extern-crate-load.rs index 438c56aa516a..df32f556e73c 100644 --- a/tests/rustdoc-ui/intra-doc/extern-crate-load.rs +++ b/tests/rustdoc-ui/intra-doc/extern-crate-load.rs @@ -1,8 +1,8 @@ -// check-pass -// aux-crate:dep1=dep1.rs -// aux-crate:dep2=dep2.rs -// aux-crate:dep3=dep3.rs -// aux-crate:dep4=dep4.rs +//@ check-pass +//@ aux-crate:dep1=dep1.rs +//@ aux-crate:dep2=dep2.rs +//@ aux-crate:dep3=dep3.rs +//@ aux-crate:dep4=dep4.rs #![deny(rustdoc::broken_intra_doc_links)] pub trait Trait { diff --git a/tests/rustdoc-ui/intra-doc/global-path.rs b/tests/rustdoc-ui/intra-doc/global-path.rs index cc7a5fa1c737..4064475355f3 100644 --- a/tests/rustdoc-ui/intra-doc/global-path.rs +++ b/tests/rustdoc-ui/intra-doc/global-path.rs @@ -1,7 +1,7 @@ // Doc link path with empty prefix that resolves to "extern prelude" instead of a module. -// check-pass -// edition:2018 +//@ check-pass +//@ edition:2018 /// [::Unresolved] //~^ WARN unresolved link to `::Unresolved` diff --git a/tests/rustdoc-ui/intra-doc/import-inline-merge-module.rs b/tests/rustdoc-ui/intra-doc/import-inline-merge-module.rs index 4d6a32566457..636c3c8de42c 100644 --- a/tests/rustdoc-ui/intra-doc/import-inline-merge-module.rs +++ b/tests/rustdoc-ui/intra-doc/import-inline-merge-module.rs @@ -1,9 +1,9 @@ // Test for issue #108501. // Module parent scope doesn't hijack import's parent scope for the import's doc links. -// check-pass -// aux-build: inner-crate-doc.rs -// compile-flags: --extern inner_crate_doc --edition 2018 +//@ check-pass +//@ aux-build: inner-crate-doc.rs +//@ compile-flags: --extern inner_crate_doc --edition 2018 /// Import doc comment [inner_crate_doc] #[doc(inline)] diff --git a/tests/rustdoc-ui/intra-doc/import-inline-merge.rs b/tests/rustdoc-ui/intra-doc/import-inline-merge.rs index 31fef032b0fc..9307ec23b1e6 100644 --- a/tests/rustdoc-ui/intra-doc/import-inline-merge.rs +++ b/tests/rustdoc-ui/intra-doc/import-inline-merge.rs @@ -1,7 +1,7 @@ // Import for `A` is inlined and doc comments on the import and `A` itself are merged. // After the merge they still have correct parent scopes to resolve both `[A]` and `[B]`. -// check-pass +//@ check-pass #![allow(rustdoc::private_intra_doc_links)] diff --git a/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-10.rs b/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-10.rs index 464c5f0d5439..23dd8a140bf6 100644 --- a/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-10.rs +++ b/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-10.rs @@ -15,7 +15,7 @@ // 1 | //! [`derive@PartialEq`] // | +++++++ -// check-pass +//@ check-pass #![deny(rustdoc::broken_intra_doc_links)] diff --git a/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-9.rs b/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-9.rs index 3357ccf2460d..e4c8bcec2d3b 100644 --- a/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-9.rs +++ b/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-9.rs @@ -1,4 +1,4 @@ -// check-pass +//@ check-pass #![deny(warnings)] diff --git a/tests/rustdoc-ui/intra-doc/macro-rules-error.rs b/tests/rustdoc-ui/intra-doc/macro-rules-error.rs index 8490584c1b42..0c9457c69da4 100644 --- a/tests/rustdoc-ui/intra-doc/macro-rules-error.rs +++ b/tests/rustdoc-ui/intra-doc/macro-rules-error.rs @@ -1,6 +1,6 @@ // `macro_rules` scopes are respected during doc link resolution. -// compile-flags: --document-private-items +//@ compile-flags: --document-private-items #![deny(rustdoc::broken_intra_doc_links)] diff --git a/tests/rustdoc-ui/intra-doc/macro-rules.rs b/tests/rustdoc-ui/intra-doc/macro-rules.rs index 3aeb370ef6dc..a82a936fe039 100644 --- a/tests/rustdoc-ui/intra-doc/macro-rules.rs +++ b/tests/rustdoc-ui/intra-doc/macro-rules.rs @@ -1,4 +1,4 @@ -// check-pass +//@ check-pass #![allow(rustdoc::private_intra_doc_links)] macro_rules! foo { diff --git a/tests/rustdoc-ui/intra-doc/pointer-reexports-allowed.rs b/tests/rustdoc-ui/intra-doc/pointer-reexports-allowed.rs index 8654a8e1bd2b..567524438cab 100644 --- a/tests/rustdoc-ui/intra-doc/pointer-reexports-allowed.rs +++ b/tests/rustdoc-ui/intra-doc/pointer-reexports-allowed.rs @@ -1,4 +1,4 @@ -// aux-build:pointer-reexports-allowed.rs -// check-pass +//@ aux-build:pointer-reexports-allowed.rs +//@ check-pass extern crate inner; pub use inner::foo; diff --git a/tests/rustdoc-ui/intra-doc/private-from-crate-level.rs b/tests/rustdoc-ui/intra-doc/private-from-crate-level.rs index e429e75b2148..0ec11d861752 100644 --- a/tests/rustdoc-ui/intra-doc/private-from-crate-level.rs +++ b/tests/rustdoc-ui/intra-doc/private-from-crate-level.rs @@ -1,4 +1,4 @@ -// check-pass +//@ check-pass //! [my_module] //~^ WARN public documentation for `private_from_crate_level` links to private item `my_module` diff --git a/tests/rustdoc-ui/intra-doc/private.rs b/tests/rustdoc-ui/intra-doc/private.rs index 525332ddaac3..b1ab0a462aa5 100644 --- a/tests/rustdoc-ui/intra-doc/private.rs +++ b/tests/rustdoc-ui/intra-doc/private.rs @@ -1,6 +1,6 @@ -// check-pass -// revisions: public private -// [private]compile-flags: --document-private-items +//@ check-pass +//@ revisions: public private +//@ [private]compile-flags: --document-private-items // make sure to update `rustdoc/intra-doc/private.rs` if you update this file diff --git a/tests/rustdoc-ui/intra-doc/proc-macro-doc.rs b/tests/rustdoc-ui/intra-doc/proc-macro-doc.rs index 8335fc902cc5..5d6819273b70 100644 --- a/tests/rustdoc-ui/intra-doc/proc-macro-doc.rs +++ b/tests/rustdoc-ui/intra-doc/proc-macro-doc.rs @@ -1,7 +1,7 @@ -// check-pass -// force-host -// no-prefer-dynamic -// compile-flags: --crate-type proc-macro +//@ check-pass +//@ force-host +//@ no-prefer-dynamic +//@ compile-flags: --crate-type proc-macro #![deny(rustdoc::broken_intra_doc_links)] diff --git a/tests/rustdoc-ui/intra-doc/reachable-non-exported.rs b/tests/rustdoc-ui/intra-doc/reachable-non-exported.rs index 6afcad4f9211..5eabf3a09ad1 100644 --- a/tests/rustdoc-ui/intra-doc/reachable-non-exported.rs +++ b/tests/rustdoc-ui/intra-doc/reachable-non-exported.rs @@ -1,7 +1,7 @@ // The structure is reachable, but not exported, so rustdoc // doesn't attempt to request doc link resolutions on it. -// check-pass +//@ check-pass mod private { /// [core::str::FromStr] diff --git a/tests/rustdoc-ui/intra-doc/through-proc-macro.rs b/tests/rustdoc-ui/intra-doc/through-proc-macro.rs index 7628c3928fec..beec9e2833c7 100644 --- a/tests/rustdoc-ui/intra-doc/through-proc-macro.rs +++ b/tests/rustdoc-ui/intra-doc/through-proc-macro.rs @@ -1,6 +1,6 @@ -// check-pass -// aux-build:through-proc-macro-aux.rs -// build-aux-docs +//@ check-pass +//@ aux-build:through-proc-macro-aux.rs +//@ build-aux-docs // Ensure rustdoc doesn't panic on this code. diff --git a/tests/rustdoc-ui/intra-doc/unknown-disambiguator.rs b/tests/rustdoc-ui/intra-doc/unknown-disambiguator.rs index 0aa1e5a415aa..68b818e32b35 100644 --- a/tests/rustdoc-ui/intra-doc/unknown-disambiguator.rs +++ b/tests/rustdoc-ui/intra-doc/unknown-disambiguator.rs @@ -1,4 +1,4 @@ -// normalize-stderr-test: "nightly|beta|1\.[0-9][0-9]\.[0-9]" -> "$$CHANNEL" +//@ normalize-stderr-test: "nightly|beta|1\.[0-9][0-9]\.[0-9]" -> "$$CHANNEL" #![deny(warnings)] //! Linking to [foo@banana] and [`bar@banana!()`]. diff --git a/tests/rustdoc-ui/intra-doc/unused-extern-crate.rs b/tests/rustdoc-ui/intra-doc/unused-extern-crate.rs index 9565830930f4..f1f30c2a93d7 100644 --- a/tests/rustdoc-ui/intra-doc/unused-extern-crate.rs +++ b/tests/rustdoc-ui/intra-doc/unused-extern-crate.rs @@ -1,4 +1,4 @@ -// compile-flags: --extern zip=whatever.rlib +//@ compile-flags: --extern zip=whatever.rlib #![deny(rustdoc::broken_intra_doc_links)] /// See [zip] crate. //~^ ERROR unresolved diff --git a/tests/rustdoc-ui/intra-doc/warning-crlf.rs b/tests/rustdoc-ui/intra-doc/warning-crlf.rs index a19c33b53be0..ab096b860f81 100644 --- a/tests/rustdoc-ui/intra-doc/warning-crlf.rs +++ b/tests/rustdoc-ui/intra-doc/warning-crlf.rs @@ -1,5 +1,5 @@ // ignore-tidy-cr -// check-pass +//@ check-pass // This file checks the spans of intra-link warnings in a file with CRLF line endings. The // .gitattributes file in this directory should enforce it. diff --git a/tests/rustdoc-ui/intra-doc/warning.rs b/tests/rustdoc-ui/intra-doc/warning.rs index eab1f0348046..96b5c2b36a18 100644 --- a/tests/rustdoc-ui/intra-doc/warning.rs +++ b/tests/rustdoc-ui/intra-doc/warning.rs @@ -1,4 +1,4 @@ -// check-pass +//@ check-pass //! Test with [Foo::baz], [Bar::foo], ... //~^ WARNING `Foo::baz` diff --git a/tests/rustdoc-ui/invalid-syntax.rs b/tests/rustdoc-ui/invalid-syntax.rs index acb2a6f084f2..42469da83761 100644 --- a/tests/rustdoc-ui/invalid-syntax.rs +++ b/tests/rustdoc-ui/invalid-syntax.rs @@ -1,4 +1,4 @@ -// check-pass +//@ check-pass /// ``` /// \__________pkt->size___________/ \_result->size_/ \__pkt->size__/ diff --git a/tests/rustdoc-ui/invalid-theme-name.rs b/tests/rustdoc-ui/invalid-theme-name.rs index c22ebf02718e..d632a08ebc80 100644 --- a/tests/rustdoc-ui/invalid-theme-name.rs +++ b/tests/rustdoc-ui/invalid-theme-name.rs @@ -1,3 +1,3 @@ -// compile-flags:--theme {{src-base}}/invalid-theme-name.rs -// error-pattern: invalid argument -// error-pattern: must have a .css extension +//@ compile-flags:--theme {{src-base}}/invalid-theme-name.rs +//@ error-pattern: invalid argument +//@ error-pattern: must have a .css extension diff --git a/tests/rustdoc-ui/issue-110629-private-type-cycle.rs b/tests/rustdoc-ui/issue-110629-private-type-cycle.rs index 2d46ddbfa6e5..b31b9d03e7cb 100644 --- a/tests/rustdoc-ui/issue-110629-private-type-cycle.rs +++ b/tests/rustdoc-ui/issue-110629-private-type-cycle.rs @@ -1,4 +1,4 @@ -// check-pass +//@ check-pass #![feature(type_alias_impl_trait)] diff --git a/tests/rustdoc-ui/issues/auxiliary/empty-fn.rs b/tests/rustdoc-ui/issues/auxiliary/empty-fn.rs index 877810f15d7f..b270c93fd639 100644 --- a/tests/rustdoc-ui/issues/auxiliary/empty-fn.rs +++ b/tests/rustdoc-ui/issues/auxiliary/empty-fn.rs @@ -1,3 +1,3 @@ -// no-prefer-dynamic +//@ no-prefer-dynamic #![crate_type = "lib"] pub fn empty() {} diff --git a/tests/rustdoc-ui/issues/auxiliary/panic-handler.rs b/tests/rustdoc-ui/issues/auxiliary/panic-handler.rs index 0aaaeee10514..d157c6a434e5 100644 --- a/tests/rustdoc-ui/issues/auxiliary/panic-handler.rs +++ b/tests/rustdoc-ui/issues/auxiliary/panic-handler.rs @@ -1,4 +1,4 @@ -// compile-flags: -C panic=abort +//@ compile-flags: -C panic=abort #![no_std] #![no_main] diff --git a/tests/rustdoc-ui/issues/issue-101076.rs b/tests/rustdoc-ui/issues/issue-101076.rs index 648f9902908a..f9b93c408fd6 100644 --- a/tests/rustdoc-ui/issues/issue-101076.rs +++ b/tests/rustdoc-ui/issues/issue-101076.rs @@ -1,4 +1,4 @@ -// check-pass +//@ check-pass const _: () = { #[macro_export] diff --git a/tests/rustdoc-ui/issues/issue-103997.rs b/tests/rustdoc-ui/issues/issue-103997.rs index 36f42fb15f7e..ebd1d2e4447d 100644 --- a/tests/rustdoc-ui/issues/issue-103997.rs +++ b/tests/rustdoc-ui/issues/issue-103997.rs @@ -1,4 +1,4 @@ -// check-pass +//@ check-pass pub fn foo() {} diff --git a/tests/rustdoc-ui/issues/issue-105742.rs b/tests/rustdoc-ui/issues/issue-105742.rs index 5e493515cad5..bd8ec4e8b589 100644 --- a/tests/rustdoc-ui/issues/issue-105742.rs +++ b/tests/rustdoc-ui/issues/issue-105742.rs @@ -1,4 +1,4 @@ -// compile-flags: -Znormalize-docs +//@ compile-flags: -Znormalize-docs use std::ops::Index; pub fn next<'a, T>(s: &'a mut dyn SVec) { diff --git a/tests/rustdoc-ui/issues/issue-106213.rs b/tests/rustdoc-ui/issues/issue-106213.rs index 6d51846b7d0c..5c3a83902523 100644 --- a/tests/rustdoc-ui/issues/issue-106213.rs +++ b/tests/rustdoc-ui/issues/issue-106213.rs @@ -1,5 +1,5 @@ -// compile-flags: --document-private-items -// edition:2021 +//@ compile-flags: --document-private-items +//@ edition:2021 fn use_avx() -> dyn { //~^ ERROR at least one trait is required for an object type diff --git a/tests/rustdoc-ui/issues/issue-107918.rs b/tests/rustdoc-ui/issues/issue-107918.rs index 0ddb3dc92150..19d53f84cb66 100644 --- a/tests/rustdoc-ui/issues/issue-107918.rs +++ b/tests/rustdoc-ui/issues/issue-107918.rs @@ -1,7 +1,7 @@ -// aux-build:panic-handler.rs -// compile-flags: --document-private-items -// build-pass -// only-linux +//@ aux-build:panic-handler.rs +//@ compile-flags: --document-private-items +//@ build-pass +//@ only-linux #![no_std] #![no_main] diff --git a/tests/rustdoc-ui/issues/issue-109282-import-inline-merge.rs b/tests/rustdoc-ui/issues/issue-109282-import-inline-merge.rs index 0ec8523222fb..e4486ab26f90 100644 --- a/tests/rustdoc-ui/issues/issue-109282-import-inline-merge.rs +++ b/tests/rustdoc-ui/issues/issue-109282-import-inline-merge.rs @@ -2,7 +2,7 @@ // Import for `ValueEnum` is inlined and doc comments on the import and `ValueEnum` itself are // merged. After the merge they still have correct parent scopes to resolve both `[ValueEnum]`. -// check-pass +//@ check-pass mod m { pub enum ValueEnum {} diff --git a/tests/rustdoc-ui/issues/issue-110900.rs b/tests/rustdoc-ui/issues/issue-110900.rs index e3154baf860a..5f90444dfd30 100644 --- a/tests/rustdoc-ui/issues/issue-110900.rs +++ b/tests/rustdoc-ui/issues/issue-110900.rs @@ -1,4 +1,4 @@ -// check-pass +//@ check-pass #![crate_type="lib"] #![feature(associated_type_bounds)] diff --git a/tests/rustdoc-ui/issues/issue-120444-1.rs b/tests/rustdoc-ui/issues/issue-120444-1.rs index 25d0111a7b76..51f2b98fb304 100644 --- a/tests/rustdoc-ui/issues/issue-120444-1.rs +++ b/tests/rustdoc-ui/issues/issue-120444-1.rs @@ -1,4 +1,4 @@ -// compile-flags: --document-private-items +//@ compile-flags: --document-private-items #![deny(rustdoc::redundant_explicit_links)] diff --git a/tests/rustdoc-ui/issues/issue-120444-2.rs b/tests/rustdoc-ui/issues/issue-120444-2.rs index d13bf8846243..f0e842fd8587 100644 --- a/tests/rustdoc-ui/issues/issue-120444-2.rs +++ b/tests/rustdoc-ui/issues/issue-120444-2.rs @@ -1,4 +1,4 @@ -// compile-flags: --document-private-items +//@ compile-flags: --document-private-items #![deny(rustdoc::redundant_explicit_links)] diff --git a/tests/rustdoc-ui/issues/issue-58473-2.rs b/tests/rustdoc-ui/issues/issue-58473-2.rs index 000b6a329c1a..1653da0d139a 100644 --- a/tests/rustdoc-ui/issues/issue-58473-2.rs +++ b/tests/rustdoc-ui/issues/issue-58473-2.rs @@ -1,4 +1,4 @@ -// check-pass +//@ check-pass #![deny(rustdoc::private_doc_tests)] diff --git a/tests/rustdoc-ui/issues/issue-58473.rs b/tests/rustdoc-ui/issues/issue-58473.rs index 44e1f58d0a0f..2d3772ed7523 100644 --- a/tests/rustdoc-ui/issues/issue-58473.rs +++ b/tests/rustdoc-ui/issues/issue-58473.rs @@ -1,4 +1,4 @@ -// check-pass +//@ check-pass pub trait Foo { /** diff --git a/tests/rustdoc-ui/issues/issue-61592-2.rs b/tests/rustdoc-ui/issues/issue-61592-2.rs index 5b4fc5ee7006..3553f51ed969 100644 --- a/tests/rustdoc-ui/issues/issue-61592-2.rs +++ b/tests/rustdoc-ui/issues/issue-61592-2.rs @@ -1,4 +1,4 @@ -// aux-build:issue-61592.rs +//@ aux-build:issue-61592.rs extern crate foo; diff --git a/tests/rustdoc-ui/issues/issue-61592.rs b/tests/rustdoc-ui/issues/issue-61592.rs index 66772557f2c2..4721f7d35c53 100644 --- a/tests/rustdoc-ui/issues/issue-61592.rs +++ b/tests/rustdoc-ui/issues/issue-61592.rs @@ -1,4 +1,4 @@ -// aux-build:issue-61592.rs +//@ aux-build:issue-61592.rs extern crate foo; diff --git a/tests/rustdoc-ui/issues/issue-74134.rs b/tests/rustdoc-ui/issues/issue-74134.rs index b1be9123aaf8..919435c64b52 100644 --- a/tests/rustdoc-ui/issues/issue-74134.rs +++ b/tests/rustdoc-ui/issues/issue-74134.rs @@ -1,6 +1,6 @@ -// revisions: public private -// [private]compile-flags: --document-private-items -// check-pass +//@ revisions: public private +//@ [private]compile-flags: --document-private-items +//@ check-pass // There are 4 cases here: // 1. public item -> public type: no warning diff --git a/tests/rustdoc-ui/issues/issue-79494.rs b/tests/rustdoc-ui/issues/issue-79494.rs index fc39424b793f..7a1890c4429a 100644 --- a/tests/rustdoc-ui/issues/issue-79494.rs +++ b/tests/rustdoc-ui/issues/issue-79494.rs @@ -1,4 +1,4 @@ -// only-x86_64-unknown-linux-gnu +//@ only-x86_64-unknown-linux-gnu #![feature(const_transmute)] diff --git a/tests/rustdoc-ui/issues/issue-80992.rs b/tests/rustdoc-ui/issues/issue-80992.rs index f5ae16981ca1..4e112fc92513 100644 --- a/tests/rustdoc-ui/issues/issue-80992.rs +++ b/tests/rustdoc-ui/issues/issue-80992.rs @@ -1,7 +1,7 @@ -// check-pass -// compile-flags:--test -// normalize-stdout-test: "tests/rustdoc-ui/issues" -> "$$DIR" -// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" +//@ check-pass +//@ compile-flags:--test +//@ normalize-stdout-test: "tests/rustdoc-ui/issues" -> "$$DIR" +//@ normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" pub fn test() -> Result<(), ()> { //! ```compile_fail diff --git a/tests/rustdoc-ui/issues/issue-81662-shortness.rs b/tests/rustdoc-ui/issues/issue-81662-shortness.rs index 79fb65dec48a..736ca3c5bad2 100644 --- a/tests/rustdoc-ui/issues/issue-81662-shortness.rs +++ b/tests/rustdoc-ui/issues/issue-81662-shortness.rs @@ -1,9 +1,9 @@ -// compile-flags:--test --error-format=short -// check-stdout -// error-pattern:cannot find function `foo` in this scope -// normalize-stdout-test: "tests/rustdoc-ui/issues" -> "$$DIR" -// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" -// failure-status: 101 +//@ compile-flags:--test --error-format=short +//@ check-stdout +//@ error-pattern:cannot find function `foo` in this scope +//@ normalize-stdout-test: "tests/rustdoc-ui/issues" -> "$$DIR" +//@ normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" +//@ failure-status: 101 /// ```rust /// foo(); diff --git a/tests/rustdoc-ui/issues/issue-83883-describe-lints.rs b/tests/rustdoc-ui/issues/issue-83883-describe-lints.rs index 0474d6c143e9..a7b1c734d7f5 100644 --- a/tests/rustdoc-ui/issues/issue-83883-describe-lints.rs +++ b/tests/rustdoc-ui/issues/issue-83883-describe-lints.rs @@ -1,10 +1,10 @@ -// compile-flags: -W help -// check-pass -// check-stdout -// error-pattern:Lint checks provided -// error-pattern:rustdoc::broken-intra-doc-links +//@ compile-flags: -W help +//@ check-pass +//@ check-stdout +//@ error-pattern:Lint checks provided +//@ error-pattern:rustdoc::broken-intra-doc-links // // ignore-tidy-linelength // -// normalize-stdout-test: "( +name default meaning\n +---- ------- -------\n)?( *[[:word:]:-]+ (allow |warn |deny |forbid ) [^\n]+\n)+" -> " $$NAMES $$LEVELS $$MEANINGS" -// normalize-stdout-test: " +name sub-lints\n +---- ---------\n( *[[:word:]:-]+ [^\n]+\n)+" -> " $$NAMES $$SUB_LINTS" +//@ normalize-stdout-test: "( +name default meaning\n +---- ------- -------\n)?( *[[:word:]:-]+ (allow |warn |deny |forbid ) [^\n]+\n)+" -> " $$NAMES $$LEVELS $$MEANINGS" +//@ normalize-stdout-test: " +name sub-lints\n +---- ---------\n( *[[:word:]:-]+ [^\n]+\n)+" -> " $$NAMES $$SUB_LINTS" diff --git a/tests/rustdoc-ui/issues/issue-91134.rs b/tests/rustdoc-ui/issues/issue-91134.rs index 85362f186cc7..b80d6539ebe9 100644 --- a/tests/rustdoc-ui/issues/issue-91134.rs +++ b/tests/rustdoc-ui/issues/issue-91134.rs @@ -1,9 +1,9 @@ -// compile-flags: --test --crate-name=empty_fn --extern=empty_fn --test-args=--test-threads=1 -// aux-build:empty-fn.rs -// check-pass -// normalize-stdout-test: "tests/rustdoc-ui/issues" -> "$$DIR" -// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" -// edition:2021 +//@ compile-flags: --test --crate-name=empty_fn --extern=empty_fn --test-args=--test-threads=1 +//@ aux-build:empty-fn.rs +//@ check-pass +//@ normalize-stdout-test: "tests/rustdoc-ui/issues" -> "$$DIR" +//@ normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" +//@ edition:2021 /// /// diff --git a/tests/rustdoc-ui/issues/issue-91713.rs b/tests/rustdoc-ui/issues/issue-91713.rs index 610bbf11d9cb..9875b5d4ad69 100644 --- a/tests/rustdoc-ui/issues/issue-91713.rs +++ b/tests/rustdoc-ui/issues/issue-91713.rs @@ -1,3 +1,3 @@ -// check-pass -// compile-flags: --passes list -// error-pattern: the `passes` flag no longer functions +//@ check-pass +//@ compile-flags: --passes list +//@ error-pattern: the `passes` flag no longer functions diff --git a/tests/rustdoc-ui/issues/issue-98690.rs b/tests/rustdoc-ui/issues/issue-98690.rs index fe9bd87ab28e..01708f3f64d3 100644 --- a/tests/rustdoc-ui/issues/issue-98690.rs +++ b/tests/rustdoc-ui/issues/issue-98690.rs @@ -1,6 +1,6 @@ -// compile-flags: --test --persist-doctests /../../ -Z unstable-options -// failure-status: 101 -// only-linux +//@ compile-flags: --test --persist-doctests /../../ -Z unstable-options +//@ failure-status: 101 +//@ only-linux #![crate_name = "foo"] diff --git a/tests/rustdoc-ui/lints/bare-urls.fixed b/tests/rustdoc-ui/lints/bare-urls.fixed index 23aa5c44c21f..7938d715199d 100644 --- a/tests/rustdoc-ui/lints/bare-urls.fixed +++ b/tests/rustdoc-ui/lints/bare-urls.fixed @@ -1,4 +1,4 @@ -// run-rustfix +//@ run-rustfix #![deny(rustdoc::bare_urls)] diff --git a/tests/rustdoc-ui/lints/bare-urls.rs b/tests/rustdoc-ui/lints/bare-urls.rs index 592f57343bc9..75f42b78ffbb 100644 --- a/tests/rustdoc-ui/lints/bare-urls.rs +++ b/tests/rustdoc-ui/lints/bare-urls.rs @@ -1,4 +1,4 @@ -// run-rustfix +//@ run-rustfix #![deny(rustdoc::bare_urls)] diff --git a/tests/rustdoc-ui/lints/check-fail.rs b/tests/rustdoc-ui/lints/check-fail.rs index 02632b4ce7d3..903cbdb532ab 100644 --- a/tests/rustdoc-ui/lints/check-fail.rs +++ b/tests/rustdoc-ui/lints/check-fail.rs @@ -1,4 +1,4 @@ -// compile-flags: -Z unstable-options --check +//@ compile-flags: -Z unstable-options --check #![feature(rustdoc_missing_doc_code_examples)] #![deny(missing_docs)] diff --git a/tests/rustdoc-ui/lints/check.rs b/tests/rustdoc-ui/lints/check.rs index e389a81bb33c..391ba517077c 100644 --- a/tests/rustdoc-ui/lints/check.rs +++ b/tests/rustdoc-ui/lints/check.rs @@ -1,6 +1,6 @@ -// check-pass -// compile-flags: -Z unstable-options --check -// normalize-stderr-test: "nightly|beta|1\.[0-9][0-9]\.[0-9]" -> "$$CHANNEL" +//@ check-pass +//@ compile-flags: -Z unstable-options --check +//@ normalize-stderr-test: "nightly|beta|1\.[0-9][0-9]\.[0-9]" -> "$$CHANNEL" #![feature(rustdoc_missing_doc_code_examples)] //~^ WARN diff --git a/tests/rustdoc-ui/lints/doc-spotlight.fixed b/tests/rustdoc-ui/lints/doc-spotlight.fixed index 4b58778eacd1..6de95a33589b 100644 --- a/tests/rustdoc-ui/lints/doc-spotlight.fixed +++ b/tests/rustdoc-ui/lints/doc-spotlight.fixed @@ -1,4 +1,4 @@ -// run-rustfix +//@ run-rustfix #![deny(warnings)] #![feature(doc_notable_trait)] diff --git a/tests/rustdoc-ui/lints/doc-spotlight.rs b/tests/rustdoc-ui/lints/doc-spotlight.rs index 16e387245802..9823ea905228 100644 --- a/tests/rustdoc-ui/lints/doc-spotlight.rs +++ b/tests/rustdoc-ui/lints/doc-spotlight.rs @@ -1,4 +1,4 @@ -// run-rustfix +//@ run-rustfix #![deny(warnings)] #![feature(doc_notable_trait)] diff --git a/tests/rustdoc-ui/lints/expect-tool-lint-rfc-2383.rs b/tests/rustdoc-ui/lints/expect-tool-lint-rfc-2383.rs index ffd694e98790..169505b04066 100644 --- a/tests/rustdoc-ui/lints/expect-tool-lint-rfc-2383.rs +++ b/tests/rustdoc-ui/lints/expect-tool-lint-rfc-2383.rs @@ -1,4 +1,4 @@ -// check-pass +//@ check-pass #![feature(lint_reasons)] //! This file tests the `#[expect]` attribute implementation for tool lints. The same diff --git a/tests/rustdoc-ui/lints/feature-gate-rustdoc_missing_doc_code_examples.rs b/tests/rustdoc-ui/lints/feature-gate-rustdoc_missing_doc_code_examples.rs index 832f129fab2d..46e337cf2b3f 100644 --- a/tests/rustdoc-ui/lints/feature-gate-rustdoc_missing_doc_code_examples.rs +++ b/tests/rustdoc-ui/lints/feature-gate-rustdoc_missing_doc_code_examples.rs @@ -1,4 +1,4 @@ -// compile-flags: -Zdeduplicate-diagnostics=yes +//@ compile-flags: -Zdeduplicate-diagnostics=yes #![deny(unknown_lints)] //~^ NOTE defined here #![allow(rustdoc::missing_doc_code_examples)] diff --git a/tests/rustdoc-ui/lints/inline-doc-link.rs b/tests/rustdoc-ui/lints/inline-doc-link.rs index 596f89be3d6d..0792bc38af48 100644 --- a/tests/rustdoc-ui/lints/inline-doc-link.rs +++ b/tests/rustdoc-ui/lints/inline-doc-link.rs @@ -1,6 +1,6 @@ // Regression test for -// check-pass +//@ check-pass #![deny(rustdoc::redundant_explicit_links)] mod m { diff --git a/tests/rustdoc-ui/lints/no-crate-level-doc-lint.rs b/tests/rustdoc-ui/lints/no-crate-level-doc-lint.rs index a186410acf48..12d4892d36a8 100644 --- a/tests/rustdoc-ui/lints/no-crate-level-doc-lint.rs +++ b/tests/rustdoc-ui/lints/no-crate-level-doc-lint.rs @@ -1,5 +1,5 @@ -// error-pattern: no documentation found -// normalize-stderr-test: "nightly|beta|1\.[0-9][0-9]\.[0-9]" -> "$$CHANNEL" +//@ error-pattern: no documentation found +//@ normalize-stderr-test: "nightly|beta|1\.[0-9][0-9]\.[0-9]" -> "$$CHANNEL" #![deny(rustdoc::missing_crate_level_docs)] //^~ NOTE defined here diff --git a/tests/rustdoc-ui/lints/no-redundancy.rs b/tests/rustdoc-ui/lints/no-redundancy.rs index e3358728b1b1..6609ce6a4f8d 100644 --- a/tests/rustdoc-ui/lints/no-redundancy.rs +++ b/tests/rustdoc-ui/lints/no-redundancy.rs @@ -1,4 +1,4 @@ -// check-pass +//@ check-pass #![deny(rustdoc::redundant_explicit_links)] diff --git a/tests/rustdoc-ui/lints/redundant_explicit_links-utf8.rs b/tests/rustdoc-ui/lints/redundant_explicit_links-utf8.rs index fecefb7b25ff..4f4590d45fc8 100644 --- a/tests/rustdoc-ui/lints/redundant_explicit_links-utf8.rs +++ b/tests/rustdoc-ui/lints/redundant_explicit_links-utf8.rs @@ -1,4 +1,4 @@ -// check-pass +//@ check-pass /// [`…foo`] [`…bar`] [`Err`] pub struct Broken {} diff --git a/tests/rustdoc-ui/lints/redundant_explicit_links.fixed b/tests/rustdoc-ui/lints/redundant_explicit_links.fixed index 900234e31e98..c40c5691e608 100644 --- a/tests/rustdoc-ui/lints/redundant_explicit_links.fixed +++ b/tests/rustdoc-ui/lints/redundant_explicit_links.fixed @@ -1,4 +1,4 @@ -// run-rustfix +//@ run-rustfix #![deny(rustdoc::redundant_explicit_links)] diff --git a/tests/rustdoc-ui/lints/redundant_explicit_links.rs b/tests/rustdoc-ui/lints/redundant_explicit_links.rs index 13feb85e0517..dc64a5613fb2 100644 --- a/tests/rustdoc-ui/lints/redundant_explicit_links.rs +++ b/tests/rustdoc-ui/lints/redundant_explicit_links.rs @@ -1,4 +1,4 @@ -// run-rustfix +//@ run-rustfix #![deny(rustdoc::redundant_explicit_links)] diff --git a/tests/rustdoc-ui/lints/rustdoc-all-only-stable-lints.rs b/tests/rustdoc-ui/lints/rustdoc-all-only-stable-lints.rs index e106d06aff59..d628867cb9b5 100644 --- a/tests/rustdoc-ui/lints/rustdoc-all-only-stable-lints.rs +++ b/tests/rustdoc-ui/lints/rustdoc-all-only-stable-lints.rs @@ -1,4 +1,4 @@ -// check-pass +//@ check-pass // Ensure `rustdoc::all` only affects stable lints. See #106289. diff --git a/tests/rustdoc-ui/lints/unused-braces-lint.rs b/tests/rustdoc-ui/lints/unused-braces-lint.rs index be0e31e4be2f..fc5dcbf4d74a 100644 --- a/tests/rustdoc-ui/lints/unused-braces-lint.rs +++ b/tests/rustdoc-ui/lints/unused-braces-lint.rs @@ -1,4 +1,4 @@ -// check-pass +//@ check-pass // This tests the bug in #70814, where the unused_braces lint triggered on the following code // without providing a span. diff --git a/tests/rustdoc-ui/lints/unused.rs b/tests/rustdoc-ui/lints/unused.rs index 702b24c36c56..f52f4c9c9e32 100644 --- a/tests/rustdoc-ui/lints/unused.rs +++ b/tests/rustdoc-ui/lints/unused.rs @@ -1,4 +1,4 @@ -// check-pass +//@ check-pass // This test purpose is to check that unused_imports lint isn't fired // by rustdoc. Why would it? Because when rustdoc is running, it uses diff --git a/tests/rustdoc-ui/macro-docs.rs b/tests/rustdoc-ui/macro-docs.rs index 0e8472eb2427..f7040289e038 100644 --- a/tests/rustdoc-ui/macro-docs.rs +++ b/tests/rustdoc-ui/macro-docs.rs @@ -1,4 +1,4 @@ -// check-pass +//@ check-pass macro_rules! m { () => { diff --git a/tests/rustdoc-ui/nested-extern-crate-46271.rs b/tests/rustdoc-ui/nested-extern-crate-46271.rs index d2ac38f3e455..9efc8063f92c 100644 --- a/tests/rustdoc-ui/nested-extern-crate-46271.rs +++ b/tests/rustdoc-ui/nested-extern-crate-46271.rs @@ -1,4 +1,4 @@ -// check-pass +//@ check-pass // hopefully this doesn't cause an ICE // https://github.com/rust-lang/rust/issues/46271 diff --git a/tests/rustdoc-ui/nested-macro-rules-47639.rs b/tests/rustdoc-ui/nested-macro-rules-47639.rs index 210b1e79cd2f..32c4e7b10b43 100644 --- a/tests/rustdoc-ui/nested-macro-rules-47639.rs +++ b/tests/rustdoc-ui/nested-macro-rules-47639.rs @@ -1,4 +1,4 @@ -// check-pass +//@ check-pass // This should not ICE // https://github.com/rust-lang/rust/issues/47639 diff --git a/tests/rustdoc-ui/normalize-cycle.rs b/tests/rustdoc-ui/normalize-cycle.rs index 1ed9ac6bc34a..35c03df0ca91 100644 --- a/tests/rustdoc-ui/normalize-cycle.rs +++ b/tests/rustdoc-ui/normalize-cycle.rs @@ -1,5 +1,5 @@ -// check-pass -// compile-flags: -Znormalize-docs +//@ check-pass +//@ compile-flags: -Znormalize-docs // Regression test for . pub trait Query {} diff --git a/tests/rustdoc-ui/normalize-in-inlined-type-alias.rs b/tests/rustdoc-ui/normalize-in-inlined-type-alias.rs index 45e04a70c091..2f92f173c35b 100644 --- a/tests/rustdoc-ui/normalize-in-inlined-type-alias.rs +++ b/tests/rustdoc-ui/normalize-in-inlined-type-alias.rs @@ -1,5 +1,5 @@ -// check-pass -// compile-flags: -Znormalize-docs +//@ check-pass +//@ compile-flags: -Znormalize-docs trait Woo { type Assoc; diff --git a/tests/rustdoc-ui/normalize-overflow.rs b/tests/rustdoc-ui/normalize-overflow.rs index 3698fe70e7f7..30b0d2f26e81 100644 --- a/tests/rustdoc-ui/normalize-overflow.rs +++ b/tests/rustdoc-ui/normalize-overflow.rs @@ -1,5 +1,5 @@ -// aux-crate:overflow=overflow.rs -// check-pass +//@ aux-crate:overflow=overflow.rs +//@ check-pass // Regression test for . extern crate overflow; diff --git a/tests/rustdoc-ui/not-wf-ambiguous-normalization.rs b/tests/rustdoc-ui/not-wf-ambiguous-normalization.rs index 3e4825d83b1f..16e2c7d60b83 100644 --- a/tests/rustdoc-ui/not-wf-ambiguous-normalization.rs +++ b/tests/rustdoc-ui/not-wf-ambiguous-normalization.rs @@ -1,4 +1,4 @@ -// compile-flags: -Znormalize-docs +//@ compile-flags: -Znormalize-docs #![feature(type_alias_impl_trait)] diff --git a/tests/rustdoc-ui/output-format-html-stable.rs b/tests/rustdoc-ui/output-format-html-stable.rs index fa0362640bb8..f178c51a7142 100644 --- a/tests/rustdoc-ui/output-format-html-stable.rs +++ b/tests/rustdoc-ui/output-format-html-stable.rs @@ -1,4 +1,4 @@ -// compile-flags: --output-format html -// check-pass +//@ compile-flags: --output-format html +//@ check-pass // This tests that `--output-format html` is accepted without `-Z unstable-options`, // since it has been stable since 1.0. diff --git a/tests/rustdoc-ui/range-pattern.rs b/tests/rustdoc-ui/range-pattern.rs index fd255d02fcb6..5e47dc826fe5 100644 --- a/tests/rustdoc-ui/range-pattern.rs +++ b/tests/rustdoc-ui/range-pattern.rs @@ -1,3 +1,3 @@ -// check-pass +//@ check-pass fn func(0u8..=255: u8) {} diff --git a/tests/rustdoc-ui/recursive-deref-ice.rs b/tests/rustdoc-ui/recursive-deref-ice.rs index 9e62841f99be..5957434e85b9 100644 --- a/tests/rustdoc-ui/recursive-deref-ice.rs +++ b/tests/rustdoc-ui/recursive-deref-ice.rs @@ -1,4 +1,4 @@ -// check-pass +//@ check-pass // ICE found in https://github.com/rust-lang/rust/issues/83123 diff --git a/tests/rustdoc-ui/scrape-examples/scrape-examples-fail-if-type-error.rs b/tests/rustdoc-ui/scrape-examples/scrape-examples-fail-if-type-error.rs index 8f4fde96d7e4..4fb5c9ab36fa 100644 --- a/tests/rustdoc-ui/scrape-examples/scrape-examples-fail-if-type-error.rs +++ b/tests/rustdoc-ui/scrape-examples/scrape-examples-fail-if-type-error.rs @@ -1,5 +1,5 @@ -// check-fail -// compile-flags: -Z unstable-options --scrape-examples-output-path {{build-base}}/t.calls --scrape-examples-target-crate foobar +//@ check-fail +//@ compile-flags: -Z unstable-options --scrape-examples-output-path {{build-base}}/t.calls --scrape-examples-target-crate foobar pub fn foo() { INVALID_FUNC(); diff --git a/tests/rustdoc-ui/scrape-examples/scrape-examples-ice.rs b/tests/rustdoc-ui/scrape-examples/scrape-examples-ice.rs index d629b62a7241..0c7aeb800dcc 100644 --- a/tests/rustdoc-ui/scrape-examples/scrape-examples-ice.rs +++ b/tests/rustdoc-ui/scrape-examples/scrape-examples-ice.rs @@ -1,4 +1,4 @@ -// compile-flags: -Z unstable-options --scrape-examples-output-path {{build-base}}/t.calls --scrape-examples-target-crate foobar -// check-pass +//@ compile-flags: -Z unstable-options --scrape-examples-output-path {{build-base}}/t.calls --scrape-examples-target-crate foobar +//@ check-pass #![no_std] use core as _; diff --git a/tests/rustdoc-ui/scrape-examples/scrape-examples-wrong-options-1.rs b/tests/rustdoc-ui/scrape-examples/scrape-examples-wrong-options-1.rs index a1f005c32ee0..df7b41e20f6f 100644 --- a/tests/rustdoc-ui/scrape-examples/scrape-examples-wrong-options-1.rs +++ b/tests/rustdoc-ui/scrape-examples/scrape-examples-wrong-options-1.rs @@ -1 +1 @@ -// compile-flags: -Z unstable-options --scrape-examples-target-crate foobar +//@ compile-flags: -Z unstable-options --scrape-examples-target-crate foobar diff --git a/tests/rustdoc-ui/scrape-examples/scrape-examples-wrong-options-2.rs b/tests/rustdoc-ui/scrape-examples/scrape-examples-wrong-options-2.rs index 4aacec7f0949..ef270a08f48b 100644 --- a/tests/rustdoc-ui/scrape-examples/scrape-examples-wrong-options-2.rs +++ b/tests/rustdoc-ui/scrape-examples/scrape-examples-wrong-options-2.rs @@ -1 +1 @@ -// compile-flags: -Z unstable-options --scrape-examples-output-path ex.calls +//@ compile-flags: -Z unstable-options --scrape-examples-output-path ex.calls diff --git a/tests/rustdoc-ui/search-index-generics-recursion-bug-issue-59502.rs b/tests/rustdoc-ui/search-index-generics-recursion-bug-issue-59502.rs index ce51556dd418..d889024802f2 100644 --- a/tests/rustdoc-ui/search-index-generics-recursion-bug-issue-59502.rs +++ b/tests/rustdoc-ui/search-index-generics-recursion-bug-issue-59502.rs @@ -1,4 +1,4 @@ -// check-pass +//@ check-pass // Minimization of issue #59502 diff --git a/tests/rustdoc-ui/suggestions/html-as-generics.fixed b/tests/rustdoc-ui/suggestions/html-as-generics.fixed index 003542d3855a..6c004b537048 100644 --- a/tests/rustdoc-ui/suggestions/html-as-generics.fixed +++ b/tests/rustdoc-ui/suggestions/html-as-generics.fixed @@ -1,4 +1,4 @@ -// run-rustfix +//@ run-rustfix #![deny(rustdoc::invalid_html_tags)] /// This `Vec` thing! diff --git a/tests/rustdoc-ui/suggestions/html-as-generics.rs b/tests/rustdoc-ui/suggestions/html-as-generics.rs index 4254a660b19e..1b54b598b2c1 100644 --- a/tests/rustdoc-ui/suggestions/html-as-generics.rs +++ b/tests/rustdoc-ui/suggestions/html-as-generics.rs @@ -1,4 +1,4 @@ -// run-rustfix +//@ run-rustfix #![deny(rustdoc::invalid_html_tags)] /// This Vec thing! diff --git a/tests/rustdoc-ui/super-glob-40936.rs b/tests/rustdoc-ui/super-glob-40936.rs index a06e977b10a5..75dd40bb37a5 100644 --- a/tests/rustdoc-ui/super-glob-40936.rs +++ b/tests/rustdoc-ui/super-glob-40936.rs @@ -1,6 +1,6 @@ -// aux-build:issue-40936.rs -// check-pass -// build-aux-docs +//@ aux-build:issue-40936.rs +//@ check-pass +//@ build-aux-docs // https://github.com/rust-lang/rust/issues/40936 diff --git a/tests/rustdoc-ui/track-diagnostics.rs b/tests/rustdoc-ui/track-diagnostics.rs index fcc50a7aba07..75f2517a408a 100644 --- a/tests/rustdoc-ui/track-diagnostics.rs +++ b/tests/rustdoc-ui/track-diagnostics.rs @@ -1,9 +1,9 @@ -// compile-flags: -Z track-diagnostics -// error-pattern: created at +//@ compile-flags: -Z track-diagnostics +//@ error-pattern: created at // Normalize the emitted location so this doesn't need // updating everytime someone adds or removes a line. -// normalize-stderr-test ".rs:\d+:\d+" -> ".rs:LL:CC" +//@ normalize-stderr-test ".rs:\d+:\d+" -> ".rs:LL:CC" struct A; struct B; diff --git a/tests/rustdoc-ui/unused-extern-crate.rs b/tests/rustdoc-ui/unused-extern-crate.rs index f703a1837907..240dd1f00e22 100644 --- a/tests/rustdoc-ui/unused-extern-crate.rs +++ b/tests/rustdoc-ui/unused-extern-crate.rs @@ -1,3 +1,3 @@ -// check-pass -// aux-crate:panic_item=panic-item.rs +//@ check-pass +//@ aux-crate:panic_item=panic-item.rs // @has unused_extern_crate/index.html diff --git a/tests/rustdoc-ui/use_both_out_dir_and_output_options.rs b/tests/rustdoc-ui/use_both_out_dir_and_output_options.rs index 5037043f19ad..62d3d955855e 100644 --- a/tests/rustdoc-ui/use_both_out_dir_and_output_options.rs +++ b/tests/rustdoc-ui/use_both_out_dir_and_output_options.rs @@ -1 +1 @@ -// compile-flags: --output ./foo +//@ compile-flags: --output ./foo diff --git a/tests/rustdoc-ui/wasm-safe.rs b/tests/rustdoc-ui/wasm-safe.rs index ba971342b46f..6ee5e0b99ff3 100644 --- a/tests/rustdoc-ui/wasm-safe.rs +++ b/tests/rustdoc-ui/wasm-safe.rs @@ -1,4 +1,4 @@ -// check-pass +//@ check-pass #[cfg(any(target_arch = "wasm32", doc))] #[target_feature(enable = "simd128")] diff --git a/tests/rustdoc/alias-reexport.rs b/tests/rustdoc/alias-reexport.rs index 4003ecec21cb..0f77d8b3f96f 100644 --- a/tests/rustdoc/alias-reexport.rs +++ b/tests/rustdoc/alias-reexport.rs @@ -1,5 +1,5 @@ -// aux-build:alias-reexport.rs -// aux-build:alias-reexport2.rs +//@ aux-build:alias-reexport.rs +//@ aux-build:alias-reexport2.rs #![crate_name = "foo"] #![feature(lazy_type_alias)] diff --git a/tests/rustdoc/alias-reexport2.rs b/tests/rustdoc/alias-reexport2.rs index 5f6357ad1286..60b7a5f9b83d 100644 --- a/tests/rustdoc/alias-reexport2.rs +++ b/tests/rustdoc/alias-reexport2.rs @@ -1,5 +1,5 @@ // gate-test-lazy_type_alias -// aux-build:alias-reexport.rs +//@ aux-build:alias-reexport.rs #![crate_name = "foo"] #![feature(lazy_type_alias)] diff --git a/tests/rustdoc/asm-foreign2.rs b/tests/rustdoc/asm-foreign2.rs index 87306901eb77..c3b194b16604 100644 --- a/tests/rustdoc/asm-foreign2.rs +++ b/tests/rustdoc/asm-foreign2.rs @@ -1,4 +1,4 @@ -// only-aarch64 +//@ only-aarch64 // Make sure rustdoc accepts options(att_syntax) asm! on non-x86 targets. use std::arch::asm; diff --git a/tests/rustdoc/assoc-type-bindings-20646.rs b/tests/rustdoc/assoc-type-bindings-20646.rs index 375b5b5b23ea..3d752551d1b6 100644 --- a/tests/rustdoc/assoc-type-bindings-20646.rs +++ b/tests/rustdoc/assoc-type-bindings-20646.rs @@ -1,5 +1,5 @@ -// aux-build:issue-20646.rs -// ignore-cross-compile +//@ aux-build:issue-20646.rs +//@ ignore-cross-compile // https://github.com/rust-lang/rust/issues/20646 #![crate_name="issue_20646"] diff --git a/tests/rustdoc/async-fn-opaque-item.rs b/tests/rustdoc/async-fn-opaque-item.rs index 2c030824fe7b..566c1c233ce7 100644 --- a/tests/rustdoc/async-fn-opaque-item.rs +++ b/tests/rustdoc/async-fn-opaque-item.rs @@ -1,5 +1,5 @@ -// compile-flags: --document-private-items --crate-type=lib -// edition: 2021 +//@ compile-flags: --document-private-items --crate-type=lib +//@ edition: 2021 // Issue 109931 -- test against accidentally documenting the `impl Future` // that comes from an async fn desugaring. diff --git a/tests/rustdoc/async-fn.rs b/tests/rustdoc/async-fn.rs index b3c35c8c3f30..010263f6ad31 100644 --- a/tests/rustdoc/async-fn.rs +++ b/tests/rustdoc/async-fn.rs @@ -1,4 +1,4 @@ -// edition:2018 +//@ edition:2018 // @has async_fn/fn.foo.html '//pre[@class="rust item-decl"]' 'pub async fn foo() -> Option' pub async fn foo() -> Option { None diff --git a/tests/rustdoc/async-move-doctest.rs b/tests/rustdoc/async-move-doctest.rs index 2ba61388c9e3..e18ec353533d 100644 --- a/tests/rustdoc/async-move-doctest.rs +++ b/tests/rustdoc/async-move-doctest.rs @@ -1,5 +1,5 @@ -// compile-flags:--test -// edition:2018 +//@ compile-flags:--test +//@ edition:2018 // Prior to setting the default edition for the doctest pre-parser, // this doctest would fail due to a fatal parsing error. diff --git a/tests/rustdoc/async-trait-sig.rs b/tests/rustdoc/async-trait-sig.rs index db1848f716d9..40e68ce9b3c5 100644 --- a/tests/rustdoc/async-trait-sig.rs +++ b/tests/rustdoc/async-trait-sig.rs @@ -1,4 +1,4 @@ -// edition:2021 +//@ edition:2021 #![allow(incomplete_features)] diff --git a/tests/rustdoc/async-trait.rs b/tests/rustdoc/async-trait.rs index 8de95aac22cb..980a812815b8 100644 --- a/tests/rustdoc/async-trait.rs +++ b/tests/rustdoc/async-trait.rs @@ -1,5 +1,5 @@ -// aux-build:async-trait-dep.rs -// edition:2021 +//@ aux-build:async-trait-dep.rs +//@ edition:2021 #![allow(incomplete_features)] diff --git a/tests/rustdoc/auto-traits.rs b/tests/rustdoc/auto-traits.rs index 93d4bf2f656a..01439c8601b4 100644 --- a/tests/rustdoc/auto-traits.rs +++ b/tests/rustdoc/auto-traits.rs @@ -1,4 +1,4 @@ -// aux-build:auto-traits.rs +//@ aux-build:auto-traits.rs #![feature(auto_traits)] diff --git a/tests/rustdoc/auxiliary/async-trait-dep.rs b/tests/rustdoc/auxiliary/async-trait-dep.rs index d455ee99e093..d89ec6d2998f 100644 --- a/tests/rustdoc/auxiliary/async-trait-dep.rs +++ b/tests/rustdoc/auxiliary/async-trait-dep.rs @@ -1,4 +1,4 @@ -// edition:2021 +//@ edition:2021 #![allow(incomplete_features)] diff --git a/tests/rustdoc/auxiliary/external-macro-src.rs b/tests/rustdoc/auxiliary/external-macro-src.rs index ce20ca5c91e6..79df5dc98eba 100644 --- a/tests/rustdoc/auxiliary/external-macro-src.rs +++ b/tests/rustdoc/auxiliary/external-macro-src.rs @@ -1,4 +1,4 @@ -// compile-flags:--remap-path-prefix={{src-base}}=/does-not-exist +//@ compile-flags:--remap-path-prefix={{src-base}}=/does-not-exist #![doc(html_root_url = "https://example.com/")] diff --git a/tests/rustdoc/auxiliary/inline-default-methods.rs b/tests/rustdoc/auxiliary/inline-default-methods.rs index f06a20b27dce..10f8676e5afe 100644 --- a/tests/rustdoc/auxiliary/inline-default-methods.rs +++ b/tests/rustdoc/auxiliary/inline-default-methods.rs @@ -1,4 +1,4 @@ -// compile-flags: -Cmetadata=aux +//@ compile-flags: -Cmetadata=aux pub trait Foo { fn bar(&self); diff --git a/tests/rustdoc/auxiliary/issue-13698.rs b/tests/rustdoc/auxiliary/issue-13698.rs index a65ebfe36a49..5e5381e0d07a 100644 --- a/tests/rustdoc/auxiliary/issue-13698.rs +++ b/tests/rustdoc/auxiliary/issue-13698.rs @@ -1,4 +1,4 @@ -// compile-flags: -Cmetadata=aux +//@ compile-flags: -Cmetadata=aux pub trait Foo { #[doc(hidden)] diff --git a/tests/rustdoc/auxiliary/issue-15318.rs b/tests/rustdoc/auxiliary/issue-15318.rs index a2f426c6352e..d3dc89113fc5 100644 --- a/tests/rustdoc/auxiliary/issue-15318.rs +++ b/tests/rustdoc/auxiliary/issue-15318.rs @@ -1,5 +1,5 @@ -// no-prefer-dynamic -// compile-flags: -Cmetadata=aux +//@ no-prefer-dynamic +//@ compile-flags: -Cmetadata=aux #![crate_type = "rlib"] #![doc(html_root_url = "http://example.com/")] #![feature(rustc_attrs)] diff --git a/tests/rustdoc/auxiliary/issue-17476.rs b/tests/rustdoc/auxiliary/issue-17476.rs index 80c915eb7cfa..0a63b893fffc 100644 --- a/tests/rustdoc/auxiliary/issue-17476.rs +++ b/tests/rustdoc/auxiliary/issue-17476.rs @@ -1,4 +1,4 @@ -// compile-flags: -Cmetadata=aux +//@ compile-flags: -Cmetadata=aux #![doc(html_root_url = "http://example.com")] diff --git a/tests/rustdoc/auxiliary/issue-19190-3.rs b/tests/rustdoc/auxiliary/issue-19190-3.rs index 8c526a89a882..d3567e3146a7 100644 --- a/tests/rustdoc/auxiliary/issue-19190-3.rs +++ b/tests/rustdoc/auxiliary/issue-19190-3.rs @@ -1,4 +1,4 @@ -// compile-flags: -Cmetadata=aux +//@ compile-flags: -Cmetadata=aux use std::ops::Deref; diff --git a/tests/rustdoc/auxiliary/issue-20646.rs b/tests/rustdoc/auxiliary/issue-20646.rs index 8e16f2de0d97..d1df1defb055 100644 --- a/tests/rustdoc/auxiliary/issue-20646.rs +++ b/tests/rustdoc/auxiliary/issue-20646.rs @@ -1,4 +1,4 @@ -// compile-flags: -Cmetadata=aux +//@ compile-flags: -Cmetadata=aux pub trait Trait { type Output; diff --git a/tests/rustdoc/auxiliary/issue-20727.rs b/tests/rustdoc/auxiliary/issue-20727.rs index 7ffc1985b058..a102d1a4897c 100644 --- a/tests/rustdoc/auxiliary/issue-20727.rs +++ b/tests/rustdoc/auxiliary/issue-20727.rs @@ -1,4 +1,4 @@ -// compile-flags: -Cmetadata=aux +//@ compile-flags: -Cmetadata=aux pub trait Deref { type Target: ?Sized; diff --git a/tests/rustdoc/auxiliary/issue-21092.rs b/tests/rustdoc/auxiliary/issue-21092.rs index 51ab7de1c546..49522e0d4b5a 100644 --- a/tests/rustdoc/auxiliary/issue-21092.rs +++ b/tests/rustdoc/auxiliary/issue-21092.rs @@ -1,4 +1,4 @@ -// compile-flags: -Cmetadata=aux +//@ compile-flags: -Cmetadata=aux pub trait Foo { type Bar; diff --git a/tests/rustdoc/auxiliary/issue-22025.rs b/tests/rustdoc/auxiliary/issue-22025.rs index 5346c0e92bde..6bc550732837 100644 --- a/tests/rustdoc/auxiliary/issue-22025.rs +++ b/tests/rustdoc/auxiliary/issue-22025.rs @@ -1,4 +1,4 @@ -// compile-flags: -Cmetadata=aux +//@ compile-flags: -Cmetadata=aux pub mod foo { diff --git a/tests/rustdoc/auxiliary/issue-57180.rs b/tests/rustdoc/auxiliary/issue-57180.rs index 4e2f4b87c020..cd905b7a5986 100644 --- a/tests/rustdoc/auxiliary/issue-57180.rs +++ b/tests/rustdoc/auxiliary/issue-57180.rs @@ -1,4 +1,4 @@ -// compile-flags: -Cmetadata=aux +//@ compile-flags: -Cmetadata=aux pub trait Trait { } diff --git a/tests/rustdoc/auxiliary/issue-73061.rs b/tests/rustdoc/auxiliary/issue-73061.rs index 01e9a984d440..9a2e4aaf75e4 100644 --- a/tests/rustdoc/auxiliary/issue-73061.rs +++ b/tests/rustdoc/auxiliary/issue-73061.rs @@ -1,4 +1,4 @@ -//edition:2018 +//@edition:2018 #![feature(impl_trait_in_assoc_type)] diff --git a/tests/rustdoc/auxiliary/macro_pub_in_module.rs b/tests/rustdoc/auxiliary/macro_pub_in_module.rs index 137b12386007..81efa1db536b 100644 --- a/tests/rustdoc/auxiliary/macro_pub_in_module.rs +++ b/tests/rustdoc/auxiliary/macro_pub_in_module.rs @@ -1,4 +1,4 @@ -// edition:2018 +//@ edition:2018 #![feature(decl_macro)] #![crate_name = "external_crate"] diff --git a/tests/rustdoc/auxiliary/mod-stackoverflow.rs b/tests/rustdoc/auxiliary/mod-stackoverflow.rs index e0b90f180ee2..428fedfab663 100644 --- a/tests/rustdoc/auxiliary/mod-stackoverflow.rs +++ b/tests/rustdoc/auxiliary/mod-stackoverflow.rs @@ -1,4 +1,4 @@ -// compile-flags: -Cmetadata=aux +//@ compile-flags: -Cmetadata=aux pub mod tree { pub use tree; diff --git a/tests/rustdoc/auxiliary/primitive-doc.rs b/tests/rustdoc/auxiliary/primitive-doc.rs index d1785e423911..a7253ed2450b 100644 --- a/tests/rustdoc/auxiliary/primitive-doc.rs +++ b/tests/rustdoc/auxiliary/primitive-doc.rs @@ -1,4 +1,4 @@ -// compile-flags: --crate-type lib --edition 2018 +//@ compile-flags: --crate-type lib --edition 2018 #![feature(rustc_attrs)] #![feature(no_core)] diff --git a/tests/rustdoc/auxiliary/primitive-reexport.rs b/tests/rustdoc/auxiliary/primitive-reexport.rs index b2e9fa43b395..18b57037634d 100644 --- a/tests/rustdoc/auxiliary/primitive-reexport.rs +++ b/tests/rustdoc/auxiliary/primitive-reexport.rs @@ -1,4 +1,4 @@ -// compile-flags: --emit metadata --crate-type lib --edition 2018 +//@ compile-flags: --emit metadata --crate-type lib --edition 2018 #![crate_name = "foo"] diff --git a/tests/rustdoc/auxiliary/real_gimli.rs b/tests/rustdoc/auxiliary/real_gimli.rs index 80d5c4ba8bb0..871d9b31be9e 100644 --- a/tests/rustdoc/auxiliary/real_gimli.rs +++ b/tests/rustdoc/auxiliary/real_gimli.rs @@ -1,4 +1,4 @@ -// aux-build:realcore.rs +//@ aux-build:realcore.rs #![crate_name = "real_gimli"] #![feature(staged_api, extremely_unstable)] diff --git a/tests/rustdoc/check-source-code-urls-to-def-std.rs b/tests/rustdoc/check-source-code-urls-to-def-std.rs index e12d8445f4fa..fac2a94b8150 100644 --- a/tests/rustdoc/check-source-code-urls-to-def-std.rs +++ b/tests/rustdoc/check-source-code-urls-to-def-std.rs @@ -1,4 +1,4 @@ -// compile-flags: -Zunstable-options --generate-link-to-definition +//@ compile-flags: -Zunstable-options --generate-link-to-definition #![crate_name = "foo"] diff --git a/tests/rustdoc/check-source-code-urls-to-def.rs b/tests/rustdoc/check-source-code-urls-to-def.rs index c31c579030e0..30638992ac71 100644 --- a/tests/rustdoc/check-source-code-urls-to-def.rs +++ b/tests/rustdoc/check-source-code-urls-to-def.rs @@ -1,6 +1,6 @@ -// compile-flags: -Zunstable-options --generate-link-to-definition -// aux-build:source_code.rs -// build-aux-docs +//@ compile-flags: -Zunstable-options --generate-link-to-definition +//@ aux-build:source_code.rs +//@ build-aux-docs #![feature(rustc_attrs)] diff --git a/tests/rustdoc/check.rs b/tests/rustdoc/check.rs index 1fb4b35ddbe8..9ca85a123f76 100644 --- a/tests/rustdoc/check.rs +++ b/tests/rustdoc/check.rs @@ -1,4 +1,4 @@ -// compile-flags: -Z unstable-options --check +//@ compile-flags: -Z unstable-options --check // @!has check/fn.foo.html // @!has check/index.html diff --git a/tests/rustdoc/comment-in-doctest.rs b/tests/rustdoc/comment-in-doctest.rs index 5691d173569a..e580aa2bb72c 100644 --- a/tests/rustdoc/comment-in-doctest.rs +++ b/tests/rustdoc/comment-in-doctest.rs @@ -1,4 +1,4 @@ -// compile-flags:--test +//@ compile-flags:--test // comments, both doc comments and regular ones, used to trick rustdoc's doctest parser into // thinking that everything after it was part of the regular program. combined with the librustc_ast diff --git a/tests/rustdoc/const-generics/auxiliary/extern_crate.rs b/tests/rustdoc/const-generics/auxiliary/extern_crate.rs index 55b632a48f2e..ebd0d7dac32b 100644 --- a/tests/rustdoc/const-generics/auxiliary/extern_crate.rs +++ b/tests/rustdoc/const-generics/auxiliary/extern_crate.rs @@ -1,4 +1,4 @@ -// edition:2018 +//@ edition:2018 pub fn extern_fn() -> impl Iterator { [[0; N]; N].iter().copied() } diff --git a/tests/rustdoc/const-generics/const-generics-docs.rs b/tests/rustdoc/const-generics/const-generics-docs.rs index 70a9518f05b4..4ef1acf45f54 100644 --- a/tests/rustdoc/const-generics/const-generics-docs.rs +++ b/tests/rustdoc/const-generics/const-generics-docs.rs @@ -1,5 +1,5 @@ -// edition:2018 -// aux-build: extern_crate.rs +//@ edition:2018 +//@ aux-build: extern_crate.rs #![crate_name = "foo"] extern crate extern_crate; diff --git a/tests/rustdoc/const-underscore.rs b/tests/rustdoc/const-underscore.rs index 0d4809409f3a..f7f15e548312 100644 --- a/tests/rustdoc/const-underscore.rs +++ b/tests/rustdoc/const-underscore.rs @@ -1,4 +1,4 @@ -// compile-flags: --document-private-items +//@ compile-flags: --document-private-items // @!has const_underscore/constant._.html const _: () = { diff --git a/tests/rustdoc/crate-version-escape.rs b/tests/rustdoc/crate-version-escape.rs index f134d9baa7d5..a8f9e7eee7b8 100644 --- a/tests/rustdoc/crate-version-escape.rs +++ b/tests/rustdoc/crate-version-escape.rs @@ -1,4 +1,4 @@ -// compile-flags: --crate-version= -Z unstable-options +//@ compile-flags: --crate-version= -Z unstable-options #![crate_name = "foo"] diff --git a/tests/rustdoc/crate-version-extra.rs b/tests/rustdoc/crate-version-extra.rs index 72a2c4ba5f72..4e215b86dee7 100644 --- a/tests/rustdoc/crate-version-extra.rs +++ b/tests/rustdoc/crate-version-extra.rs @@ -1,4 +1,4 @@ -// compile-flags: '--crate-version=1.3.37-nightly (203c57dbe 2023-09-17)' +//@ compile-flags: '--crate-version=1.3.37-nightly (203c57dbe 2023-09-17)' #![crate_name="foo"] diff --git a/tests/rustdoc/crate-version.rs b/tests/rustdoc/crate-version.rs index d4be845b71ee..7095bf54c13b 100644 --- a/tests/rustdoc/crate-version.rs +++ b/tests/rustdoc/crate-version.rs @@ -1,3 +1,3 @@ -// compile-flags: --crate-version=1.3.37 +//@ compile-flags: --crate-version=1.3.37 // @has 'crate_version/index.html' '//*[@class="version"]' '1.3.37' diff --git a/tests/rustdoc/cross-crate-hidden-assoc-trait-items.rs b/tests/rustdoc/cross-crate-hidden-assoc-trait-items.rs index d02bc4fe7125..22630705e1e8 100644 --- a/tests/rustdoc/cross-crate-hidden-assoc-trait-items.rs +++ b/tests/rustdoc/cross-crate-hidden-assoc-trait-items.rs @@ -2,8 +2,8 @@ // Hide cross-crate `#[doc(hidden)]` associated items in trait impls. #![crate_name = "dependent"] -// edition:2021 -// aux-crate:dependency=cross-crate-hidden-assoc-trait-items.rs +//@ edition:2021 +//@ aux-crate:dependency=cross-crate-hidden-assoc-trait-items.rs // The trait `Tr` contains 2 hidden and 2 visisible associated items. // Instead of checking for the absence of the hidden items, check for the presence of the diff --git a/tests/rustdoc/cross-crate-hidden-impl-parameter.rs b/tests/rustdoc/cross-crate-hidden-impl-parameter.rs index eb2ced2f7f41..69f9ca132fd1 100644 --- a/tests/rustdoc/cross-crate-hidden-impl-parameter.rs +++ b/tests/rustdoc/cross-crate-hidden-impl-parameter.rs @@ -1,7 +1,7 @@ // Issue #86448: test for cross-crate `doc(hidden)` #![crate_name = "foo"] -// aux-build:cross-crate-hidden-impl-parameter.rs +//@ aux-build:cross-crate-hidden-impl-parameter.rs extern crate cross_crate_hidden_impl_parameter; pub use ::cross_crate_hidden_impl_parameter::{HiddenType, HiddenTrait}; // OK, not re-exported diff --git a/tests/rustdoc/cross-crate-links.rs b/tests/rustdoc/cross-crate-links.rs index 7c736a4cc115..36e8f31dfc67 100644 --- a/tests/rustdoc/cross-crate-links.rs +++ b/tests/rustdoc/cross-crate-links.rs @@ -1,5 +1,5 @@ -// aux-build:all-item-types.rs -// build-aux-docs +//@ aux-build:all-item-types.rs +//@ build-aux-docs #![crate_name = "foo"] diff --git a/tests/rustdoc/cross-crate-primitive-doc.rs b/tests/rustdoc/cross-crate-primitive-doc.rs index 4ba296ee04a1..01a4c4ef8e42 100644 --- a/tests/rustdoc/cross-crate-primitive-doc.rs +++ b/tests/rustdoc/cross-crate-primitive-doc.rs @@ -1,6 +1,6 @@ -// aux-build:primitive-doc.rs -// compile-flags: --extern-html-root-url=primitive_doc=../ -Z unstable-options -// only-linux +//@ aux-build:primitive-doc.rs +//@ compile-flags: --extern-html-root-url=primitive_doc=../ -Z unstable-options +//@ only-linux #![feature(no_core)] #![no_core] diff --git a/tests/rustdoc/decl_macro.rs b/tests/rustdoc/decl_macro.rs index 94ade31b5e5f..116fa15d7493 100644 --- a/tests/rustdoc/decl_macro.rs +++ b/tests/rustdoc/decl_macro.rs @@ -1,4 +1,4 @@ -// compile-flags: --document-private-items +//@ compile-flags: --document-private-items #![feature(decl_macro)] diff --git a/tests/rustdoc/decl_macro_priv.rs b/tests/rustdoc/decl_macro_priv.rs index 4e1279e34d93..2a890e739f2b 100644 --- a/tests/rustdoc/decl_macro_priv.rs +++ b/tests/rustdoc/decl_macro_priv.rs @@ -1,4 +1,4 @@ -// compile-flags: --document-private-items +//@ compile-flags: --document-private-items #![feature(decl_macro)] diff --git a/tests/rustdoc/deduplicate-trait-impl-22025.rs b/tests/rustdoc/deduplicate-trait-impl-22025.rs index 65a556e3a70f..7b1648a56ac1 100644 --- a/tests/rustdoc/deduplicate-trait-impl-22025.rs +++ b/tests/rustdoc/deduplicate-trait-impl-22025.rs @@ -1,5 +1,5 @@ -// aux-build:issue-22025.rs -// ignore-cross-compile +//@ aux-build:issue-22025.rs +//@ ignore-cross-compile // https://github.com/rust-lang/rust/issues/22025 #![crate_name="issue_22025"] diff --git a/tests/rustdoc/default-impl.rs b/tests/rustdoc/default-impl.rs index f11b3b29b937..2ba9c4ab5ad9 100644 --- a/tests/rustdoc/default-impl.rs +++ b/tests/rustdoc/default-impl.rs @@ -1,5 +1,5 @@ -// aux-build:rustdoc-default-impl.rs -// ignore-cross-compile +//@ aux-build:rustdoc-default-impl.rs +//@ ignore-cross-compile extern crate rustdoc_default_impl as foo; diff --git a/tests/rustdoc/default-theme.rs b/tests/rustdoc/default-theme.rs index ecb8f0b3b487..4167086807c2 100644 --- a/tests/rustdoc/default-theme.rs +++ b/tests/rustdoc/default-theme.rs @@ -1,4 +1,4 @@ -// compile-flags: --default-theme ayu +//@ compile-flags: --default-theme ayu // @has default_theme/index.html // @has - '//script[@id="default-settings"]/@data-theme' 'ayu' diff --git a/tests/rustdoc/demo-allocator-54478.rs b/tests/rustdoc/demo-allocator-54478.rs index 39acee36d889..dd98e80f03ad 100644 --- a/tests/rustdoc/demo-allocator-54478.rs +++ b/tests/rustdoc/demo-allocator-54478.rs @@ -15,7 +15,7 @@ // decided to change `rustdoc` to behave more like the compiler's // default setting, by leaving off `-C prefer-dynamic`. -// compile-flags:--test +//@ compile-flags:--test //! This is a doc comment //! diff --git a/tests/rustdoc/deref-methods-19190-inline.rs b/tests/rustdoc/deref-methods-19190-inline.rs index 619b268d68b3..ef31cc70d935 100644 --- a/tests/rustdoc/deref-methods-19190-inline.rs +++ b/tests/rustdoc/deref-methods-19190-inline.rs @@ -1,5 +1,5 @@ -// aux-build:issue-19190-3.rs -// ignore-cross-compile +//@ aux-build:issue-19190-3.rs +//@ ignore-cross-compile // https://github.com/rust-lang/rust/issues/19190 #![crate_name="issue_19190_3"] diff --git a/tests/rustdoc/display-hidden-items.rs b/tests/rustdoc/display-hidden-items.rs index d97d5b4a9688..76124554767f 100644 --- a/tests/rustdoc/display-hidden-items.rs +++ b/tests/rustdoc/display-hidden-items.rs @@ -1,5 +1,5 @@ // Test to ensure that the `--document-hidden-items` option is working as expected. -// compile-flags: -Z unstable-options --document-hidden-items +//@ compile-flags: -Z unstable-options --document-hidden-items // ignore-tidy-linelength #![crate_name = "foo"] diff --git a/tests/rustdoc/doc-cfg-hide.rs b/tests/rustdoc/doc-cfg-hide.rs index 636957fe9980..f80453d50ed0 100644 --- a/tests/rustdoc/doc-cfg-hide.rs +++ b/tests/rustdoc/doc-cfg-hide.rs @@ -5,7 +5,7 @@ // @has 'oud/struct.Solecism.html' // @count - '//*[@class="stab portability"]' 0 -// compile-flags:--cfg feature="solecism" +//@ compile-flags:--cfg feature="solecism" #[cfg(feature = "solecism")] pub struct Solecism; @@ -19,7 +19,7 @@ pub struct Scribacious; // @has 'oud/struct.Hyperdulia.html' // @count - '//*[@class="stab portability"]' 1 // @matches - '//*[@class="stab portability"]' 'crate feature hyperdulia' -// compile-flags:--cfg feature="hyperdulia" +//@ compile-flags:--cfg feature="hyperdulia" #[cfg(feature = "solecism")] #[cfg(feature = "hyperdulia")] pub struct Hyperdulia; @@ -27,6 +27,6 @@ pub struct Hyperdulia; // @has 'oud/struct.Oystercatcher.html' // @count - '//*[@class="stab portability"]' 1 // @matches - '//*[@class="stab portability"]' 'crate feature oystercatcher only' -// compile-flags:--cfg feature="oystercatcher" +//@ compile-flags:--cfg feature="oystercatcher" #[cfg(all(feature = "solecism", feature = "oystercatcher"))] pub struct Oystercatcher; diff --git a/tests/rustdoc/doc-cfg-implicit-gate.rs b/tests/rustdoc/doc-cfg-implicit-gate.rs index 92804d3729bb..15de15c0ce22 100644 --- a/tests/rustdoc/doc-cfg-implicit-gate.rs +++ b/tests/rustdoc/doc-cfg-implicit-gate.rs @@ -1,4 +1,4 @@ -// compile-flags:--cfg feature="worricow" +//@ compile-flags:--cfg feature="worricow" #![crate_name = "xenogenous"] // @has 'xenogenous/struct.Worricow.html' diff --git a/tests/rustdoc/doc-cfg-implicit.rs b/tests/rustdoc/doc-cfg-implicit.rs index 5d17a4ede6ad..a6c0896db317 100644 --- a/tests/rustdoc/doc-cfg-implicit.rs +++ b/tests/rustdoc/doc-cfg-implicit.rs @@ -4,28 +4,28 @@ // @has 'funambulism/struct.Disorbed.html' // @count - '//*[@class="stab portability"]' 1 // @matches - '//*[@class="stab portability"]' 'crate feature disorbed' -// compile-flags:--cfg feature="disorbed" +//@ compile-flags:--cfg feature="disorbed" #[cfg(feature = "disorbed")] pub struct Disorbed; // @has 'funambulism/struct.Aesthesia.html' // @count - '//*[@class="stab portability"]' 1 // @matches - '//*[@class="stab portability"]' 'crate feature aesthesia' -// compile-flags:--cfg feature="aesthesia" +//@ compile-flags:--cfg feature="aesthesia" #[doc(cfg(feature = "aesthesia"))] pub struct Aesthesia; // @has 'funambulism/struct.Pliothermic.html' // @count - '//*[@class="stab portability"]' 1 // @matches - '//*[@class="stab portability"]' 'crate feature pliothermic' -// compile-flags:--cfg feature="epopoeist" +//@ compile-flags:--cfg feature="epopoeist" #[cfg(feature = "epopoeist")] #[doc(cfg(feature = "pliothermic"))] pub struct Pliothermic; // @has 'funambulism/struct.Simillimum.html' // @count - '//*[@class="stab portability"]' 0 -// compile-flags:--cfg feature="simillimum" +//@ compile-flags:--cfg feature="simillimum" #[cfg(feature = "simillimum")] #[doc(cfg(all()))] pub struct Simillimum; diff --git a/tests/rustdoc/doc-cfg-target-feature.rs b/tests/rustdoc/doc-cfg-target-feature.rs index 98d230c978b7..b66e86e36af8 100644 --- a/tests/rustdoc/doc-cfg-target-feature.rs +++ b/tests/rustdoc/doc-cfg-target-feature.rs @@ -1,6 +1,6 @@ -// only-x86_64 -// compile-flags:--test -// should-fail +//@ only-x86_64 +//@ compile-flags:--test +//@ should-fail // #49723: rustdoc didn't add target features when extracting or running doctests diff --git a/tests/rustdoc/doc-hidden-method-13698.rs b/tests/rustdoc/doc-hidden-method-13698.rs index f1bd6e73babd..44bf8bfd8d2f 100644 --- a/tests/rustdoc/doc-hidden-method-13698.rs +++ b/tests/rustdoc/doc-hidden-method-13698.rs @@ -1,5 +1,5 @@ -// aux-build:issue-13698.rs -// ignore-cross-compile +//@ aux-build:issue-13698.rs +//@ ignore-cross-compile // https://github.com/rust-lang/rust/issues/13698 #![crate_name="issue_13698"] diff --git a/tests/rustdoc/doc-test-attr-18199.rs b/tests/rustdoc/doc-test-attr-18199.rs index c9d2235321c8..64016e32eeeb 100644 --- a/tests/rustdoc/doc-test-attr-18199.rs +++ b/tests/rustdoc/doc-test-attr-18199.rs @@ -1,4 +1,4 @@ -// compile-flags:--test +//@ compile-flags:--test // https://github.com/rust-lang/rust/issues/18199 #![doc(test(attr(feature(staged_api))))] diff --git a/tests/rustdoc/doctest/doctest-cfg-feature-30252.rs b/tests/rustdoc/doctest/doctest-cfg-feature-30252.rs index ceb8076fe352..0a2e3f3cf958 100644 --- a/tests/rustdoc/doctest/doctest-cfg-feature-30252.rs +++ b/tests/rustdoc/doctest/doctest-cfg-feature-30252.rs @@ -1,4 +1,4 @@ -// compile-flags:--test --cfg feature="bar" +//@ compile-flags:--test --cfg feature="bar" // https://github.com/rust-lang/rust/issues/30252 #![crate_name="issue_30252"] diff --git a/tests/rustdoc/doctest/doctest-crate-attributes-38129.rs b/tests/rustdoc/doctest/doctest-crate-attributes-38129.rs index 156d50fa52a6..b9c837188325 100644 --- a/tests/rustdoc/doctest/doctest-crate-attributes-38129.rs +++ b/tests/rustdoc/doctest/doctest-crate-attributes-38129.rs @@ -1,4 +1,4 @@ -// compile-flags:--test +//@ compile-flags:--test // This file tests the source-partitioning behavior of rustdoc. // Each test contains some code that should be put into the generated diff --git a/tests/rustdoc/doctest/doctest-hide-empty-line-23106.rs b/tests/rustdoc/doctest/doctest-hide-empty-line-23106.rs index 8e1e2cf098cf..2e8a8f3f1e2b 100644 --- a/tests/rustdoc/doctest/doctest-hide-empty-line-23106.rs +++ b/tests/rustdoc/doctest/doctest-hide-empty-line-23106.rs @@ -1,4 +1,4 @@ -// compile-flags:--test +//@ compile-flags:--test // https://github.com/rust-lang/rust/issues/23106 #![crate_name="issue_23106"] diff --git a/tests/rustdoc/doctest/doctest-include-43153.rs b/tests/rustdoc/doctest/doctest-include-43153.rs index ec21a68c4ee5..0f63c84de39b 100644 --- a/tests/rustdoc/doctest/doctest-include-43153.rs +++ b/tests/rustdoc/doctest/doctest-include-43153.rs @@ -3,7 +3,7 @@ // Test that `include!` in a doc test searches relative to the directory in // which the test is declared. -// compile-flags:--test +//@ compile-flags:--test /// ```rust /// include!("auxiliary/empty.rs"); diff --git a/tests/rustdoc/doctest/doctest-macro-38219.rs b/tests/rustdoc/doctest/doctest-macro-38219.rs index 6c81df110856..574e84523783 100644 --- a/tests/rustdoc/doctest/doctest-macro-38219.rs +++ b/tests/rustdoc/doctest/doctest-macro-38219.rs @@ -1,7 +1,7 @@ // https://github.com/rust-lang/rust/issues/38219 -// compile-flags:--test -// should-fail +//@ compile-flags:--test +//@ should-fail /// ``` /// fail diff --git a/tests/rustdoc/doctest/doctest-manual-crate-name.rs b/tests/rustdoc/doctest/doctest-manual-crate-name.rs index 3a5e3734e140..8d526959fe1e 100644 --- a/tests/rustdoc/doctest/doctest-manual-crate-name.rs +++ b/tests/rustdoc/doctest/doctest-manual-crate-name.rs @@ -1,4 +1,4 @@ -// compile-flags:--test +//@ compile-flags:--test //! ``` //! #![crate_name="asdf"] diff --git a/tests/rustdoc/doctest/doctest-markdown-inline-parse-23744.rs b/tests/rustdoc/doctest/doctest-markdown-inline-parse-23744.rs index 128e2daba071..2ba9176ae88c 100644 --- a/tests/rustdoc/doctest/doctest-markdown-inline-parse-23744.rs +++ b/tests/rustdoc/doctest/doctest-markdown-inline-parse-23744.rs @@ -1,4 +1,4 @@ -// compile-flags:--test +//@ compile-flags:--test // https://github.com/rust-lang/rust/issues/23744 #![crate_name="issue_23744"] diff --git a/tests/rustdoc/doctest/doctest-markdown-trailing-docblock-48377.rs b/tests/rustdoc/doctest/doctest-markdown-trailing-docblock-48377.rs index d481dc0dd701..74c1a9d24597 100644 --- a/tests/rustdoc/doctest/doctest-markdown-trailing-docblock-48377.rs +++ b/tests/rustdoc/doctest/doctest-markdown-trailing-docblock-48377.rs @@ -1,4 +1,4 @@ -// compile-flags:--test +//@ compile-flags:--test // https://github.com/rust-lang/rust/issues/48377 diff --git a/tests/rustdoc/doctest/doctest-multi-line-string-literal-25944.rs b/tests/rustdoc/doctest/doctest-multi-line-string-literal-25944.rs index eec796e4fbf2..2b9c6119c67d 100644 --- a/tests/rustdoc/doctest/doctest-multi-line-string-literal-25944.rs +++ b/tests/rustdoc/doctest/doctest-multi-line-string-literal-25944.rs @@ -1,4 +1,4 @@ -// compile-flags:--test +//@ compile-flags:--test // https://github.com/rust-lang/rust/issues/25944 #![crate_name="issue_25944"] diff --git a/tests/rustdoc/document-hidden-items-15347.rs b/tests/rustdoc/document-hidden-items-15347.rs index d8a760e56660..bf3c73f0ba16 100644 --- a/tests/rustdoc/document-hidden-items-15347.rs +++ b/tests/rustdoc/document-hidden-items-15347.rs @@ -1,4 +1,4 @@ -// compile-flags: -Z unstable-options --document-hidden-items +//@ compile-flags: -Z unstable-options --document-hidden-items // https://github.com/rust-lang/rust/issues/15347 #![crate_name="issue_15347"] diff --git a/tests/rustdoc/duplicate-flags.rs b/tests/rustdoc/duplicate-flags.rs index dde36df2cf50..c0df181397b2 100644 --- a/tests/rustdoc/duplicate-flags.rs +++ b/tests/rustdoc/duplicate-flags.rs @@ -1,4 +1,4 @@ -// compile-flags: --document-private-items --document-private-items +//@ compile-flags: --document-private-items --document-private-items // @has duplicate_flags/struct.Private.html struct Private; diff --git a/tests/rustdoc/edition-doctest.rs b/tests/rustdoc/edition-doctest.rs index 6de25996bedd..f43c074f806b 100644 --- a/tests/rustdoc/edition-doctest.rs +++ b/tests/rustdoc/edition-doctest.rs @@ -1,4 +1,4 @@ -// compile-flags:--test +//@ compile-flags:--test /// ```rust,edition2018 /// #![feature(try_blocks)] diff --git a/tests/rustdoc/edition-flag.rs b/tests/rustdoc/edition-flag.rs index e54c7d2969bf..c57c8d50b235 100644 --- a/tests/rustdoc/edition-flag.rs +++ b/tests/rustdoc/edition-flag.rs @@ -1,5 +1,5 @@ -// compile-flags:--test -// edition:2018 +//@ compile-flags:--test +//@ edition:2018 /// ```rust /// fn main() { diff --git a/tests/rustdoc/elided-lifetime.rs b/tests/rustdoc/elided-lifetime.rs index 006132ef8aa4..4df381a6f68b 100644 --- a/tests/rustdoc/elided-lifetime.rs +++ b/tests/rustdoc/elided-lifetime.rs @@ -1,4 +1,4 @@ -// aux-build:elided-lifetime.rs +//@ aux-build:elided-lifetime.rs // // rust-lang/rust#75225 // diff --git a/tests/rustdoc/empty-impl-block-private-with-doc.rs b/tests/rustdoc/empty-impl-block-private-with-doc.rs index e6cff97b1842..21c860c09234 100644 --- a/tests/rustdoc/empty-impl-block-private-with-doc.rs +++ b/tests/rustdoc/empty-impl-block-private-with-doc.rs @@ -1,4 +1,4 @@ -// compile-flags: --document-private-items +//@ compile-flags: --document-private-items #![feature(inherent_associated_types)] #![allow(incomplete_features)] diff --git a/tests/rustdoc/empty-mod-private.rs b/tests/rustdoc/empty-mod-private.rs index 147e11e5882e..7e78aac17641 100644 --- a/tests/rustdoc/empty-mod-private.rs +++ b/tests/rustdoc/empty-mod-private.rs @@ -1,4 +1,4 @@ -// compile-flags: --document-private-items +//@ compile-flags: --document-private-items // @has 'empty_mod_private/index.html' '//a[@href="foo/index.html"]' 'foo' // @hasraw 'empty_mod_private/sidebar-items.js' 'foo' diff --git a/tests/rustdoc/enum-variant-value.rs b/tests/rustdoc/enum-variant-value.rs index 096f8cd4122f..5767d9e54231 100644 --- a/tests/rustdoc/enum-variant-value.rs +++ b/tests/rustdoc/enum-variant-value.rs @@ -1,7 +1,7 @@ // This test ensures that the variant value is displayed with underscores but without // a type name at the end. -// aux-build:enum-variant.rs +//@ aux-build:enum-variant.rs #![crate_name = "foo"] diff --git a/tests/rustdoc/extern-default-method.rs b/tests/rustdoc/extern-default-method.rs index fc28b230a5f7..058c2200d941 100644 --- a/tests/rustdoc/extern-default-method.rs +++ b/tests/rustdoc/extern-default-method.rs @@ -1,5 +1,5 @@ -// aux-build:rustdoc-extern-default-method.rs -// ignore-cross-compile +//@ aux-build:rustdoc-extern-default-method.rs +//@ ignore-cross-compile // ignore-tidy-linelength extern crate rustdoc_extern_default_method as ext; diff --git a/tests/rustdoc/extern-html-root-url-precedence.rs b/tests/rustdoc/extern-html-root-url-precedence.rs index def6767ea47f..68af5ea5e04c 100644 --- a/tests/rustdoc/extern-html-root-url-precedence.rs +++ b/tests/rustdoc/extern-html-root-url-precedence.rs @@ -1,4 +1,4 @@ -// compile-flags:-Z unstable-options --extern-html-root-url core=https://example.com/core/0.1.0 --extern-html-root-takes-precedence +//@ compile-flags:-Z unstable-options --extern-html-root-url core=https://example.com/core/0.1.0 --extern-html-root-takes-precedence // @has extern_html_root_url_precedence/index.html // --extern-html-root should take precedence if `--takes-precedence` is passed diff --git a/tests/rustdoc/extern-html-root-url.rs b/tests/rustdoc/extern-html-root-url.rs index 17eedcf2ab8d..672c460c20b4 100644 --- a/tests/rustdoc/extern-html-root-url.rs +++ b/tests/rustdoc/extern-html-root-url.rs @@ -1,6 +1,6 @@ -// compile-flags:-Z unstable-options --extern-html-root-url html_root=https://example.com/override --extern-html-root-url no_html_root=https://example.com/override -// aux-build:html_root.rs -// aux-build:no_html_root.rs +//@ compile-flags:-Z unstable-options --extern-html-root-url html_root=https://example.com/override --extern-html-root-url no_html_root=https://example.com/override +//@ aux-build:html_root.rs +//@ aux-build:no_html_root.rs // NOTE: intentionally does not build any auxiliary docs extern crate html_root; diff --git a/tests/rustdoc/extern-impl-trait.rs b/tests/rustdoc/extern-impl-trait.rs index 4d8672305a75..9cc235504e71 100644 --- a/tests/rustdoc/extern-impl-trait.rs +++ b/tests/rustdoc/extern-impl-trait.rs @@ -1,4 +1,4 @@ -// aux-build:extern-impl-trait.rs +//@ aux-build:extern-impl-trait.rs #![crate_name = "foo"] diff --git a/tests/rustdoc/extern-links.rs b/tests/rustdoc/extern-links.rs index 0383ccf7db66..a8c6eb76390f 100644 --- a/tests/rustdoc/extern-links.rs +++ b/tests/rustdoc/extern-links.rs @@ -1,5 +1,5 @@ -// aux-build:extern-links.rs -// ignore-cross-compile +//@ aux-build:extern-links.rs +//@ ignore-cross-compile #![crate_name = "foo"] diff --git a/tests/rustdoc/extern-method.rs b/tests/rustdoc/extern-method.rs index 9cf5fc190af0..3a86ad4feb03 100644 --- a/tests/rustdoc/extern-method.rs +++ b/tests/rustdoc/extern-method.rs @@ -1,5 +1,5 @@ -// aux-build:rustdoc-extern-method.rs -// ignore-cross-compile +//@ aux-build:rustdoc-extern-method.rs +//@ ignore-cross-compile #![feature(unboxed_closures)] diff --git a/tests/rustdoc/external-cross.rs b/tests/rustdoc/external-cross.rs index 3f8e16882911..527c81839b55 100644 --- a/tests/rustdoc/external-cross.rs +++ b/tests/rustdoc/external-cross.rs @@ -1,5 +1,5 @@ -// aux-build:external-cross.rs -// ignore-cross-compile +//@ aux-build:external-cross.rs +//@ ignore-cross-compile #![crate_name="host"] diff --git a/tests/rustdoc/external-macro-src.rs b/tests/rustdoc/external-macro-src.rs index 359551ab78d1..1813ecb423f4 100644 --- a/tests/rustdoc/external-macro-src.rs +++ b/tests/rustdoc/external-macro-src.rs @@ -1,4 +1,4 @@ -// aux-build:external-macro-src.rs +//@ aux-build:external-macro-src.rs #![crate_name = "foo"] diff --git a/tests/rustdoc/ffi.rs b/tests/rustdoc/ffi.rs index 8140dfc723c7..c9dbdbf42a51 100644 --- a/tests/rustdoc/ffi.rs +++ b/tests/rustdoc/ffi.rs @@ -1,5 +1,5 @@ -// aux-build:rustdoc-ffi.rs -// ignore-cross-compile +//@ aux-build:rustdoc-ffi.rs +//@ ignore-cross-compile extern crate rustdoc_ffi as lib; diff --git a/tests/rustdoc/force-target-feature.rs b/tests/rustdoc/force-target-feature.rs index b6c10e8341b4..fa71bbeea274 100644 --- a/tests/rustdoc/force-target-feature.rs +++ b/tests/rustdoc/force-target-feature.rs @@ -1,6 +1,6 @@ -// only-x86_64 -// compile-flags:--test -C target-feature=+avx -// should-fail +//@ only-x86_64 +//@ compile-flags:--test -C target-feature=+avx +//@ should-fail /// (written on a spider's web) Some Struct /// diff --git a/tests/rustdoc/hidden-private.rs b/tests/rustdoc/hidden-private.rs index 834ba5231a1e..5e3c7f3a3e42 100644 --- a/tests/rustdoc/hidden-private.rs +++ b/tests/rustdoc/hidden-private.rs @@ -2,7 +2,7 @@ // It ensures that the items in the `doc(hidden)` const block don't show up in the // generated docs. -// compile-flags: --document-private-items +//@ compile-flags: --document-private-items #![crate_name = "foo"] diff --git a/tests/rustdoc/hidden-trait-methods-with-document-hidden-items.rs b/tests/rustdoc/hidden-trait-methods-with-document-hidden-items.rs index 95b3e9b65230..d2269e3b021d 100644 --- a/tests/rustdoc/hidden-trait-methods-with-document-hidden-items.rs +++ b/tests/rustdoc/hidden-trait-methods-with-document-hidden-items.rs @@ -1,4 +1,4 @@ -// compile-flags: -Z unstable-options --document-hidden-items +//@ compile-flags: -Z unstable-options --document-hidden-items // test for trait methods with `doc(hidden)` with `--document-hidden-items` passed. #![crate_name = "foo"] diff --git a/tests/rustdoc/hide-unstable-trait.rs b/tests/rustdoc/hide-unstable-trait.rs index 0bf7cabc43b2..ebf9efb368b6 100644 --- a/tests/rustdoc/hide-unstable-trait.rs +++ b/tests/rustdoc/hide-unstable-trait.rs @@ -1,4 +1,4 @@ -// aux-build:unstable-trait.rs +//@ aux-build:unstable-trait.rs #![crate_name = "foo"] #![feature(private_trait)] diff --git a/tests/rustdoc/html-no-source.rs b/tests/rustdoc/html-no-source.rs index b91aa41207af..b52792837e5b 100644 --- a/tests/rustdoc/html-no-source.rs +++ b/tests/rustdoc/html-no-source.rs @@ -1,4 +1,4 @@ -// compile-flags: -Zunstable-options --html-no-source +//@ compile-flags: -Zunstable-options --html-no-source // This test ensures that the `--html-no-source` flag disables // the creation of the `src` folder. diff --git a/tests/rustdoc/ice-reexport-crate-root-28927.rs b/tests/rustdoc/ice-reexport-crate-root-28927.rs index 26debfc60e46..b4215f7d1aa9 100644 --- a/tests/rustdoc/ice-reexport-crate-root-28927.rs +++ b/tests/rustdoc/ice-reexport-crate-root-28927.rs @@ -1,6 +1,6 @@ -// aux-build:issue-28927-2.rs -// aux-build:issue-28927-1.rs -// ignore-cross-compile +//@ aux-build:issue-28927-2.rs +//@ aux-build:issue-28927-1.rs +//@ ignore-cross-compile // https://github.com/rust-lang/rust/issues/28927 #![crate_name="issue_28927"] diff --git a/tests/rustdoc/ice-type-error-19181.rs b/tests/rustdoc/ice-type-error-19181.rs index 3ced61366640..02c640476222 100644 --- a/tests/rustdoc/ice-type-error-19181.rs +++ b/tests/rustdoc/ice-type-error-19181.rs @@ -1,4 +1,4 @@ -// compile-flags:--test +//@ compile-flags:--test // https://github.com/rust-lang/rust/issues/19181 // rustdoc should not panic when target crate has compilation errors diff --git a/tests/rustdoc/impl-assoc-type-21092.rs b/tests/rustdoc/impl-assoc-type-21092.rs index f01f098a92f5..2354fb986e7e 100644 --- a/tests/rustdoc/impl-assoc-type-21092.rs +++ b/tests/rustdoc/impl-assoc-type-21092.rs @@ -1,5 +1,5 @@ -// aux-build:issue-21092.rs -// ignore-cross-compile +//@ aux-build:issue-21092.rs +//@ ignore-cross-compile // https://github.com/rust-lang/rust/issues/21092 #![crate_name="issue_21092"] diff --git a/tests/rustdoc/impl-blanket-53689.rs b/tests/rustdoc/impl-blanket-53689.rs index 7c2edd01a609..63bce550b9bc 100644 --- a/tests/rustdoc/impl-blanket-53689.rs +++ b/tests/rustdoc/impl-blanket-53689.rs @@ -1,5 +1,5 @@ // https://github.com/rust-lang/rust/issues/53689 -// aux-build:issue-53689.rs +//@ aux-build:issue-53689.rs #![crate_name = "foo"] diff --git a/tests/rustdoc/impl-parts-crosscrate.rs b/tests/rustdoc/impl-parts-crosscrate.rs index da109ea70900..2cca3a5c37c6 100644 --- a/tests/rustdoc/impl-parts-crosscrate.rs +++ b/tests/rustdoc/impl-parts-crosscrate.rs @@ -1,5 +1,5 @@ -// aux-build:rustdoc-impl-parts-crosscrate.rs -// ignore-cross-compile +//@ aux-build:rustdoc-impl-parts-crosscrate.rs +//@ ignore-cross-compile #![feature(negative_impls)] diff --git a/tests/rustdoc/index-page.rs b/tests/rustdoc/index-page.rs index fc755afda4a9..51354c8b25b9 100644 --- a/tests/rustdoc/index-page.rs +++ b/tests/rustdoc/index-page.rs @@ -1,6 +1,6 @@ -// aux-build:all-item-types.rs -// build-aux-docs -// compile-flags: -Z unstable-options --enable-index-page +//@ aux-build:all-item-types.rs +//@ build-aux-docs +//@ compile-flags: -Z unstable-options --enable-index-page #![crate_name = "foo"] diff --git a/tests/rustdoc/inline-assoc-type-20727-bindings.rs b/tests/rustdoc/inline-assoc-type-20727-bindings.rs index e59dec29d030..d270ccfc3755 100644 --- a/tests/rustdoc/inline-assoc-type-20727-bindings.rs +++ b/tests/rustdoc/inline-assoc-type-20727-bindings.rs @@ -1,5 +1,5 @@ -// aux-build:issue-20727.rs -// ignore-cross-compile +//@ aux-build:issue-20727.rs +//@ ignore-cross-compile // https://github.com/rust-lang/rust/issues/20727 #![crate_name="issue_20727_2"] diff --git a/tests/rustdoc/inline-assoc-type-20727-bounds-deref.rs b/tests/rustdoc/inline-assoc-type-20727-bounds-deref.rs index 005ee3e32941..b8449860531e 100644 --- a/tests/rustdoc/inline-assoc-type-20727-bounds-deref.rs +++ b/tests/rustdoc/inline-assoc-type-20727-bounds-deref.rs @@ -1,5 +1,5 @@ -// aux-build:issue-20727.rs -// ignore-cross-compile +//@ aux-build:issue-20727.rs +//@ ignore-cross-compile // https://github.com/rust-lang/rust/issues/20727 #![crate_name="issue_20727_3"] diff --git a/tests/rustdoc/inline-assoc-type-20727-bounds-index.rs b/tests/rustdoc/inline-assoc-type-20727-bounds-index.rs index 1a3f4cd20c1e..4905d0dc4c5f 100644 --- a/tests/rustdoc/inline-assoc-type-20727-bounds-index.rs +++ b/tests/rustdoc/inline-assoc-type-20727-bounds-index.rs @@ -1,5 +1,5 @@ -// aux-build:issue-20727.rs -// ignore-cross-compile +//@ aux-build:issue-20727.rs +//@ ignore-cross-compile // https://github.com/rust-lang/rust/issues/20727 #![crate_name="issue_20727_4"] diff --git a/tests/rustdoc/inline-assoc-type-20727-bounds.rs b/tests/rustdoc/inline-assoc-type-20727-bounds.rs index 7cbc8d38107d..e6e0490cdd89 100644 --- a/tests/rustdoc/inline-assoc-type-20727-bounds.rs +++ b/tests/rustdoc/inline-assoc-type-20727-bounds.rs @@ -1,5 +1,5 @@ -// aux-build:issue-20727.rs -// ignore-cross-compile +//@ aux-build:issue-20727.rs +//@ ignore-cross-compile // https://github.com/rust-lang/rust/issues/20727 #![crate_name="issue_20727"] diff --git a/tests/rustdoc/inline-default-methods.rs b/tests/rustdoc/inline-default-methods.rs index 7706cb139ac9..a37795673763 100644 --- a/tests/rustdoc/inline-default-methods.rs +++ b/tests/rustdoc/inline-default-methods.rs @@ -1,5 +1,5 @@ -// aux-build:inline-default-methods.rs -// ignore-cross-compile +//@ aux-build:inline-default-methods.rs +//@ ignore-cross-compile extern crate inline_default_methods; diff --git a/tests/rustdoc/inline_cross/add-docs.rs b/tests/rustdoc/inline_cross/add-docs.rs index a1124d2094c0..a7fbe3c6d0e4 100644 --- a/tests/rustdoc/inline_cross/add-docs.rs +++ b/tests/rustdoc/inline_cross/add-docs.rs @@ -1,4 +1,4 @@ -// aux-build:add-docs.rs +//@ aux-build:add-docs.rs extern crate inner; diff --git a/tests/rustdoc/inline_cross/assoc-const-equality.rs b/tests/rustdoc/inline_cross/assoc-const-equality.rs index 1d3ce9e3172f..89ed808de620 100644 --- a/tests/rustdoc/inline_cross/assoc-const-equality.rs +++ b/tests/rustdoc/inline_cross/assoc-const-equality.rs @@ -1,5 +1,5 @@ -// aux-crate:assoc_const_equality=assoc-const-equality.rs -// edition:2021 +//@ aux-crate:assoc_const_equality=assoc-const-equality.rs +//@ edition:2021 #![crate_name = "user"] diff --git a/tests/rustdoc/inline_cross/assoc-items.rs b/tests/rustdoc/inline_cross/assoc-items.rs index 811827a17fee..6b126964a783 100644 --- a/tests/rustdoc/inline_cross/assoc-items.rs +++ b/tests/rustdoc/inline_cross/assoc-items.rs @@ -1,6 +1,6 @@ -// aux-build:assoc-items.rs -// build-aux-docs -// ignore-cross-compile +//@ aux-build:assoc-items.rs +//@ build-aux-docs +//@ ignore-cross-compile #![crate_name = "foo"] diff --git a/tests/rustdoc/inline_cross/assoc_item_trait_bounds.rs b/tests/rustdoc/inline_cross/assoc_item_trait_bounds.rs index 74ceb697af69..c030e3449977 100644 --- a/tests/rustdoc/inline_cross/assoc_item_trait_bounds.rs +++ b/tests/rustdoc/inline_cross/assoc_item_trait_bounds.rs @@ -1,9 +1,9 @@ // Regression test for issues #77763, #84579 and #102142. #![crate_name = "main"] -// aux-build:assoc_item_trait_bounds.rs -// build-aux-docs -// ignore-cross-compile +//@ aux-build:assoc_item_trait_bounds.rs +//@ build-aux-docs +//@ ignore-cross-compile extern crate assoc_item_trait_bounds as aux; // @has main/trait.Main.html diff --git a/tests/rustdoc/inline_cross/async-fn.rs b/tests/rustdoc/inline_cross/async-fn.rs index 95e175aabd07..20fa409a8ddd 100644 --- a/tests/rustdoc/inline_cross/async-fn.rs +++ b/tests/rustdoc/inline_cross/async-fn.rs @@ -2,8 +2,8 @@ // Check that we render the correct return type of free and // associated async functions reexported from external crates. -// aux-crate:async_fn=async-fn.rs -// edition: 2021 +//@ aux-crate:async_fn=async-fn.rs +//@ edition: 2021 #![crate_name = "user"] // @has user/fn.load.html diff --git a/tests/rustdoc/inline_cross/attributes.rs b/tests/rustdoc/inline_cross/attributes.rs index c0b75c48fee9..ac9e6174dc1c 100644 --- a/tests/rustdoc/inline_cross/attributes.rs +++ b/tests/rustdoc/inline_cross/attributes.rs @@ -1,5 +1,5 @@ -// aux-crate:attributes=attributes.rs -// edition:2021 +//@ aux-crate:attributes=attributes.rs +//@ edition:2021 #![crate_name = "user"] // @has 'user/struct.NonExhaustive.html' diff --git a/tests/rustdoc/inline_cross/auxiliary/async-fn.rs b/tests/rustdoc/inline_cross/auxiliary/async-fn.rs index 564ca7d671e2..1a1a5f44af90 100644 --- a/tests/rustdoc/inline_cross/auxiliary/async-fn.rs +++ b/tests/rustdoc/inline_cross/auxiliary/async-fn.rs @@ -1,4 +1,4 @@ -// edition: 2021 +//@ edition: 2021 pub async fn load() -> i32 { 0 diff --git a/tests/rustdoc/inline_cross/auxiliary/impl_trait_aux.rs b/tests/rustdoc/inline_cross/auxiliary/impl_trait_aux.rs index fa61312ebc87..d4ee96113292 100644 --- a/tests/rustdoc/inline_cross/auxiliary/impl_trait_aux.rs +++ b/tests/rustdoc/inline_cross/auxiliary/impl_trait_aux.rs @@ -1,4 +1,4 @@ -// edition:2018 +//@ edition:2018 use std::ops::Deref; diff --git a/tests/rustdoc/inline_cross/auxiliary/issue-21801.rs b/tests/rustdoc/inline_cross/auxiliary/issue-21801.rs index 732612ff0007..51842de12d97 100644 --- a/tests/rustdoc/inline_cross/auxiliary/issue-21801.rs +++ b/tests/rustdoc/inline_cross/auxiliary/issue-21801.rs @@ -1,4 +1,4 @@ -// compile-flags: -Cmetadata=aux +//@ compile-flags: -Cmetadata=aux pub struct Foo; diff --git a/tests/rustdoc/inline_cross/auxiliary/issue-27362-aux.rs b/tests/rustdoc/inline_cross/auxiliary/issue-27362-aux.rs index 077bdc33e66f..29487715df87 100644 --- a/tests/rustdoc/inline_cross/auxiliary/issue-27362-aux.rs +++ b/tests/rustdoc/inline_cross/auxiliary/issue-27362-aux.rs @@ -1,4 +1,4 @@ -// compile-flags: -Cmetadata=aux +//@ compile-flags: -Cmetadata=aux pub const fn foo() {} pub const unsafe fn bar() {} diff --git a/tests/rustdoc/inline_cross/auxiliary/issue-29584.rs b/tests/rustdoc/inline_cross/auxiliary/issue-29584.rs index a9b8796c0fe3..03e26bcf4bf7 100644 --- a/tests/rustdoc/inline_cross/auxiliary/issue-29584.rs +++ b/tests/rustdoc/inline_cross/auxiliary/issue-29584.rs @@ -1,4 +1,4 @@ -// compile-flags: -Cmetadata=aux +//@ compile-flags: -Cmetadata=aux pub struct Foo; diff --git a/tests/rustdoc/inline_cross/auxiliary/issue-46727.rs b/tests/rustdoc/inline_cross/auxiliary/issue-46727.rs index 30dccfa77b5a..acfc418f9f1d 100644 --- a/tests/rustdoc/inline_cross/auxiliary/issue-46727.rs +++ b/tests/rustdoc/inline_cross/auxiliary/issue-46727.rs @@ -1,4 +1,4 @@ -// compile-flags: -Cmetadata=aux +//@ compile-flags: -Cmetadata=aux pub trait Foo {} diff --git a/tests/rustdoc/inline_cross/auxiliary/proc_macro.rs b/tests/rustdoc/inline_cross/auxiliary/proc_macro.rs index d8e5746f3f6f..4cb66580e250 100644 --- a/tests/rustdoc/inline_cross/auxiliary/proc_macro.rs +++ b/tests/rustdoc/inline_cross/auxiliary/proc_macro.rs @@ -1,6 +1,6 @@ -// force-host -// no-prefer-dynamic -// compile-flags: --crate-type proc-macro +//@ force-host +//@ no-prefer-dynamic +//@ compile-flags: --crate-type proc-macro #![crate_type="proc-macro"] #![crate_name="some_macros"] diff --git a/tests/rustdoc/inline_cross/const-effect-param.rs b/tests/rustdoc/inline_cross/const-effect-param.rs index 1d003e28f36d..72c90ab69684 100644 --- a/tests/rustdoc/inline_cross/const-effect-param.rs +++ b/tests/rustdoc/inline_cross/const-effect-param.rs @@ -1,8 +1,8 @@ // Regression test for issue #116629. // Check that we don't render host effect parameters & arguments. -// aux-crate:const_effect_param=const-effect-param.rs -// edition: 2021 +//@ aux-crate:const_effect_param=const-effect-param.rs +//@ edition: 2021 #![crate_name = "user"] // Don't render the host param on `load` and the host arg `host` passed to `Resource`. diff --git a/tests/rustdoc/inline_cross/const-eval-46727.rs b/tests/rustdoc/inline_cross/const-eval-46727.rs index d0ce9c34f51b..213664a90b93 100644 --- a/tests/rustdoc/inline_cross/const-eval-46727.rs +++ b/tests/rustdoc/inline_cross/const-eval-46727.rs @@ -1,7 +1,7 @@ // https://github.com/rust-lang/rust/issues/46727 #![crate_name="foo"] -// aux-build:issue-46727.rs +//@ aux-build:issue-46727.rs extern crate issue_46727; diff --git a/tests/rustdoc/inline_cross/const-fn-27362.rs b/tests/rustdoc/inline_cross/const-fn-27362.rs index 39b904662e06..22b2fa30fecf 100644 --- a/tests/rustdoc/inline_cross/const-fn-27362.rs +++ b/tests/rustdoc/inline_cross/const-fn-27362.rs @@ -1,5 +1,5 @@ -// aux-build:issue-27362-aux.rs -// ignore-cross-compile +//@ aux-build:issue-27362-aux.rs +//@ ignore-cross-compile // https://github.com/rust-lang/rust/issues/27362 #![crate_name="issue_27362"] diff --git a/tests/rustdoc/inline_cross/cross-glob.rs b/tests/rustdoc/inline_cross/cross-glob.rs index 7a519d2d2554..ae36655936c1 100644 --- a/tests/rustdoc/inline_cross/cross-glob.rs +++ b/tests/rustdoc/inline_cross/cross-glob.rs @@ -1,6 +1,6 @@ -// aux-build:cross-glob.rs -// build-aux-docs -// ignore-cross-compile +//@ aux-build:cross-glob.rs +//@ build-aux-docs +//@ ignore-cross-compile extern crate inner; diff --git a/tests/rustdoc/inline_cross/deduplicate-inlined-items-23207.rs b/tests/rustdoc/inline_cross/deduplicate-inlined-items-23207.rs index 4e9596db589e..374b4d28545d 100644 --- a/tests/rustdoc/inline_cross/deduplicate-inlined-items-23207.rs +++ b/tests/rustdoc/inline_cross/deduplicate-inlined-items-23207.rs @@ -1,6 +1,6 @@ -// aux-build:issue-23207-1.rs -// aux-build:issue-23207-2.rs -// ignore-cross-compile +//@ aux-build:issue-23207-1.rs +//@ aux-build:issue-23207-2.rs +//@ ignore-cross-compile // https://github.com/rust-lang/rust/issues/23207 #![crate_name="issue_23207"] diff --git a/tests/rustdoc/inline_cross/default-generic-args.rs b/tests/rustdoc/inline_cross/default-generic-args.rs index 775bf0415328..f006915f153d 100644 --- a/tests/rustdoc/inline_cross/default-generic-args.rs +++ b/tests/rustdoc/inline_cross/default-generic-args.rs @@ -1,6 +1,6 @@ #![crate_name = "user"] -// aux-crate:default_generic_args=default-generic-args.rs -// edition:2021 +//@ aux-crate:default_generic_args=default-generic-args.rs +//@ edition:2021 // @has user/type.BoxedStr.html // @has - '//*[@class="rust item-decl"]//code' "Box" diff --git a/tests/rustdoc/inline_cross/default-trait-method.rs b/tests/rustdoc/inline_cross/default-trait-method.rs index a4ec73a127d4..3d9437350312 100644 --- a/tests/rustdoc/inline_cross/default-trait-method.rs +++ b/tests/rustdoc/inline_cross/default-trait-method.rs @@ -1,4 +1,4 @@ -// aux-build:default-trait-method.rs +//@ aux-build:default-trait-method.rs extern crate foo; diff --git a/tests/rustdoc/inline_cross/doc-hidden-extern-trait-impl-29584.rs b/tests/rustdoc/inline_cross/doc-hidden-extern-trait-impl-29584.rs index b246e94e048d..4643e8f47506 100644 --- a/tests/rustdoc/inline_cross/doc-hidden-extern-trait-impl-29584.rs +++ b/tests/rustdoc/inline_cross/doc-hidden-extern-trait-impl-29584.rs @@ -1,5 +1,5 @@ -// aux-build:issue-29584.rs -// ignore-cross-compile +//@ aux-build:issue-29584.rs +//@ ignore-cross-compile // https://github.com/rust-lang/rust/issues/29584 #![crate_name="issue_29584"] diff --git a/tests/rustdoc/inline_cross/dyn_trait.rs b/tests/rustdoc/inline_cross/dyn_trait.rs index 9871be79ca36..18404556984c 100644 --- a/tests/rustdoc/inline_cross/dyn_trait.rs +++ b/tests/rustdoc/inline_cross/dyn_trait.rs @@ -3,8 +3,8 @@ // In each test case, we include the trailing semicolon to ensure that nothing extra comes // after the type like an unwanted outlives-bound. -// aux-crate:dyn_trait=dyn_trait.rs -// edition:2021 +//@ aux-crate:dyn_trait=dyn_trait.rs +//@ edition:2021 // @has user/type.Ty0.html // @has - '//*[@class="rust item-decl"]//code' "dyn for<'any> FnOnce(&'any str) -> bool;" diff --git a/tests/rustdoc/inline_cross/early-late-bound-lifetime-params.rs b/tests/rustdoc/inline_cross/early-late-bound-lifetime-params.rs index 09cc8a79072b..97dd623bb078 100644 --- a/tests/rustdoc/inline_cross/early-late-bound-lifetime-params.rs +++ b/tests/rustdoc/inline_cross/early-late-bound-lifetime-params.rs @@ -5,8 +5,8 @@ // separately in rustc and therefore rustdoc needs to manually merge them. #![crate_name = "usr"] -// aux-crate:dep=early-late-bound-lifetime-params.rs -// edition:2021 +//@ aux-crate:dep=early-late-bound-lifetime-params.rs +//@ edition:2021 // @has usr/fn.f.html // @has - '//pre[@class="rust item-decl"]' "fn f<'a, 'b, 'c, 'd, T, const N: usize>(_: impl Copy)" diff --git a/tests/rustdoc/inline_cross/fn-type.rs b/tests/rustdoc/inline_cross/fn-type.rs index e65790d3b05a..222557a4663b 100644 --- a/tests/rustdoc/inline_cross/fn-type.rs +++ b/tests/rustdoc/inline_cross/fn-type.rs @@ -2,8 +2,8 @@ // They should be rendered exactly as the user wrote it, i.e., in source order and with unused // parameters present, not stripped. -// aux-crate:fn_type=fn-type.rs -// edition: 2021 +//@ aux-crate:fn_type=fn-type.rs +//@ edition: 2021 #![crate_name = "user"] // @has user/type.F.html diff --git a/tests/rustdoc/inline_cross/generic-const-items.rs b/tests/rustdoc/inline_cross/generic-const-items.rs index 70cf7af888ee..77011a05d2f5 100644 --- a/tests/rustdoc/inline_cross/generic-const-items.rs +++ b/tests/rustdoc/inline_cross/generic-const-items.rs @@ -1,7 +1,7 @@ #![crate_name = "user"] -// aux-crate:generic_const_items=generic-const-items.rs -// edition:2021 +//@ aux-crate:generic_const_items=generic-const-items.rs +//@ edition:2021 // @has 'user/constant.K.html' // @has - '//*[@class="rust item-decl"]//code' \ diff --git a/tests/rustdoc/inline_cross/hidden-use.rs b/tests/rustdoc/inline_cross/hidden-use.rs index 28a4f4bac1a4..f747c94915ce 100644 --- a/tests/rustdoc/inline_cross/hidden-use.rs +++ b/tests/rustdoc/inline_cross/hidden-use.rs @@ -1,6 +1,6 @@ -// aux-build:rustdoc-hidden.rs -// build-aux-docs -// ignore-cross-compile +//@ aux-build:rustdoc-hidden.rs +//@ build-aux-docs +//@ ignore-cross-compile extern crate rustdoc_hidden; diff --git a/tests/rustdoc/inline_cross/impl-inline-without-trait.rs b/tests/rustdoc/inline_cross/impl-inline-without-trait.rs index 9b67022fd4bb..60265b5df8fb 100644 --- a/tests/rustdoc/inline_cross/impl-inline-without-trait.rs +++ b/tests/rustdoc/inline_cross/impl-inline-without-trait.rs @@ -1,6 +1,6 @@ -// aux-build:impl-inline-without-trait.rs -// build-aux-docs -// ignore-cross-compile +//@ aux-build:impl-inline-without-trait.rs +//@ build-aux-docs +//@ ignore-cross-compile #![crate_name = "foo"] diff --git a/tests/rustdoc/inline_cross/impl-sized.rs b/tests/rustdoc/inline_cross/impl-sized.rs index 82bdce474784..b62a1e61e2bb 100644 --- a/tests/rustdoc/inline_cross/impl-sized.rs +++ b/tests/rustdoc/inline_cross/impl-sized.rs @@ -1,7 +1,7 @@ #![crate_name = "user"] -// aux-crate:impl_sized=impl-sized.rs -// edition:2021 +//@ aux-crate:impl_sized=impl-sized.rs +//@ edition:2021 // @has user/fn.sized.html // @has - '//pre[@class="rust item-decl"]' "sized(x: impl Sized) -> impl Sized" diff --git a/tests/rustdoc/inline_cross/impl_trait.rs b/tests/rustdoc/inline_cross/impl_trait.rs index 3a2f5d160045..47e2c9dc76bc 100644 --- a/tests/rustdoc/inline_cross/impl_trait.rs +++ b/tests/rustdoc/inline_cross/impl_trait.rs @@ -1,5 +1,5 @@ -// aux-build:impl_trait_aux.rs -// edition:2018 +//@ aux-build:impl_trait_aux.rs +//@ edition:2018 extern crate impl_trait_aux; diff --git a/tests/rustdoc/inline_cross/implementors-js.rs b/tests/rustdoc/inline_cross/implementors-js.rs index c17d52d0f414..099da54093c0 100644 --- a/tests/rustdoc/inline_cross/implementors-js.rs +++ b/tests/rustdoc/inline_cross/implementors-js.rs @@ -1,6 +1,6 @@ -// aux-build:implementors_inline.rs -// build-aux-docs -// ignore-cross-compile +//@ aux-build:implementors_inline.rs +//@ build-aux-docs +//@ ignore-cross-compile extern crate implementors_inline; diff --git a/tests/rustdoc/inline_cross/inline_hidden.rs b/tests/rustdoc/inline_cross/inline_hidden.rs index dcceaadb9680..ec06f2f0c5d6 100644 --- a/tests/rustdoc/inline_cross/inline_hidden.rs +++ b/tests/rustdoc/inline_cross/inline_hidden.rs @@ -1,6 +1,6 @@ -// aux-build:rustdoc-hidden.rs -// build-aux-docs -// ignore-cross-compile +//@ aux-build:rustdoc-hidden.rs +//@ build-aux-docs +//@ ignore-cross-compile extern crate rustdoc_hidden; diff --git a/tests/rustdoc/inline_cross/issue-24183.rs b/tests/rustdoc/inline_cross/issue-24183.rs index 751a32385e81..cd39cda718b7 100644 --- a/tests/rustdoc/inline_cross/issue-24183.rs +++ b/tests/rustdoc/inline_cross/issue-24183.rs @@ -1,8 +1,8 @@ #![crate_type = "lib"] #![crate_name = "usr"] -// aux-crate:issue_24183=issue-24183.rs -// edition: 2021 +//@ aux-crate:issue_24183=issue-24183.rs +//@ edition: 2021 // @has usr/trait.U.html // @has - '//*[@class="rust item-decl"]' "pub trait U {" diff --git a/tests/rustdoc/inline_cross/issue-28480.rs b/tests/rustdoc/inline_cross/issue-28480.rs index 99f5b9007714..9d221a46d920 100644 --- a/tests/rustdoc/inline_cross/issue-28480.rs +++ b/tests/rustdoc/inline_cross/issue-28480.rs @@ -1,6 +1,6 @@ -// aux-build:rustdoc-hidden-sig.rs -// build-aux-docs -// ignore-cross-compile +//@ aux-build:rustdoc-hidden-sig.rs +//@ build-aux-docs +//@ ignore-cross-compile // @has rustdoc_hidden_sig/struct.Bar.html // @!has - '//a/@title' 'Hidden' diff --git a/tests/rustdoc/inline_cross/issue-31948-1.rs b/tests/rustdoc/inline_cross/issue-31948-1.rs index 571eaf6be967..ee053f40638a 100644 --- a/tests/rustdoc/inline_cross/issue-31948-1.rs +++ b/tests/rustdoc/inline_cross/issue-31948-1.rs @@ -1,6 +1,6 @@ -// aux-build:rustdoc-nonreachable-impls.rs -// build-aux-docs -// ignore-cross-compile +//@ aux-build:rustdoc-nonreachable-impls.rs +//@ build-aux-docs +//@ ignore-cross-compile extern crate rustdoc_nonreachable_impls; diff --git a/tests/rustdoc/inline_cross/issue-31948-2.rs b/tests/rustdoc/inline_cross/issue-31948-2.rs index 7eae21046ccb..5019f0369b78 100644 --- a/tests/rustdoc/inline_cross/issue-31948-2.rs +++ b/tests/rustdoc/inline_cross/issue-31948-2.rs @@ -1,6 +1,6 @@ -// aux-build:rustdoc-nonreachable-impls.rs -// build-aux-docs -// ignore-cross-compile +//@ aux-build:rustdoc-nonreachable-impls.rs +//@ build-aux-docs +//@ ignore-cross-compile extern crate rustdoc_nonreachable_impls; diff --git a/tests/rustdoc/inline_cross/issue-31948.rs b/tests/rustdoc/inline_cross/issue-31948.rs index 9c271bf4ad43..eaed8509520f 100644 --- a/tests/rustdoc/inline_cross/issue-31948.rs +++ b/tests/rustdoc/inline_cross/issue-31948.rs @@ -1,6 +1,6 @@ -// aux-build:rustdoc-nonreachable-impls.rs -// build-aux-docs -// ignore-cross-compile +//@ aux-build:rustdoc-nonreachable-impls.rs +//@ build-aux-docs +//@ ignore-cross-compile extern crate rustdoc_nonreachable_impls; diff --git a/tests/rustdoc/inline_cross/issue-32881.rs b/tests/rustdoc/inline_cross/issue-32881.rs index 183fd15abbe1..93e868b466a0 100644 --- a/tests/rustdoc/inline_cross/issue-32881.rs +++ b/tests/rustdoc/inline_cross/issue-32881.rs @@ -1,6 +1,6 @@ -// aux-build:rustdoc-trait-object-impl.rs -// build-aux-docs -// ignore-cross-compile +//@ aux-build:rustdoc-trait-object-impl.rs +//@ build-aux-docs +//@ ignore-cross-compile extern crate rustdoc_trait_object_impl; diff --git a/tests/rustdoc/inline_cross/issue-33113.rs b/tests/rustdoc/inline_cross/issue-33113.rs index d954707facfe..807bbcbe9b86 100644 --- a/tests/rustdoc/inline_cross/issue-33113.rs +++ b/tests/rustdoc/inline_cross/issue-33113.rs @@ -1,6 +1,6 @@ -// aux-build:issue-33113.rs -// build-aux-docs -// ignore-cross-compile +//@ aux-build:issue-33113.rs +//@ build-aux-docs +//@ ignore-cross-compile extern crate bar; diff --git a/tests/rustdoc/inline_cross/issue-76736-1.rs b/tests/rustdoc/inline_cross/issue-76736-1.rs index 25feae2c8d68..692677a3eee6 100644 --- a/tests/rustdoc/inline_cross/issue-76736-1.rs +++ b/tests/rustdoc/inline_cross/issue-76736-1.rs @@ -1,5 +1,5 @@ -// aux-build:issue-76736-1.rs -// aux-build:issue-76736-2.rs +//@ aux-build:issue-76736-1.rs +//@ aux-build:issue-76736-2.rs #![crate_name = "foo"] diff --git a/tests/rustdoc/inline_cross/issue-76736-2.rs b/tests/rustdoc/inline_cross/issue-76736-2.rs index e43c825d6e14..83529dd1887c 100644 --- a/tests/rustdoc/inline_cross/issue-76736-2.rs +++ b/tests/rustdoc/inline_cross/issue-76736-2.rs @@ -1,5 +1,5 @@ -// aux-build:issue-76736-1.rs -// aux-build:issue-76736-2.rs +//@ aux-build:issue-76736-1.rs +//@ aux-build:issue-76736-2.rs #![crate_name = "foo"] #![feature(rustc_private)] diff --git a/tests/rustdoc/inline_cross/issue-76736-3.rs b/tests/rustdoc/inline_cross/issue-76736-3.rs index 9542f3f3557a..cf75c8d0321b 100644 --- a/tests/rustdoc/inline_cross/issue-76736-3.rs +++ b/tests/rustdoc/inline_cross/issue-76736-3.rs @@ -1,6 +1,6 @@ -// compile-flags: -Zforce-unstable-if-unmarked -// aux-build:issue-76736-1.rs -// aux-build:issue-76736-2.rs +//@ compile-flags: -Zforce-unstable-if-unmarked +//@ aux-build:issue-76736-1.rs +//@ aux-build:issue-76736-2.rs #![crate_name = "foo"] diff --git a/tests/rustdoc/inline_cross/macro-vis.rs b/tests/rustdoc/inline_cross/macro-vis.rs index 9fefd38ad2c1..6b811f1452a0 100644 --- a/tests/rustdoc/inline_cross/macro-vis.rs +++ b/tests/rustdoc/inline_cross/macro-vis.rs @@ -1,6 +1,6 @@ -// aux-build:macro-vis.rs -// build-aux-docs -// ignore-cross-compile +//@ aux-build:macro-vis.rs +//@ build-aux-docs +//@ ignore-cross-compile #[macro_use] extern crate qwop; diff --git a/tests/rustdoc/inline_cross/macros.rs b/tests/rustdoc/inline_cross/macros.rs index a41b9c5b1972..c711216d2b55 100644 --- a/tests/rustdoc/inline_cross/macros.rs +++ b/tests/rustdoc/inline_cross/macros.rs @@ -1,5 +1,5 @@ -// aux-build:macros.rs -// build-aux-docs +//@ aux-build:macros.rs +//@ build-aux-docs #![feature(macro_test)] #![crate_name = "foo"] diff --git a/tests/rustdoc/inline_cross/non_lifetime_binders.rs b/tests/rustdoc/inline_cross/non_lifetime_binders.rs index 9d3085c3ef26..edc48c88d9cb 100644 --- a/tests/rustdoc/inline_cross/non_lifetime_binders.rs +++ b/tests/rustdoc/inline_cross/non_lifetime_binders.rs @@ -1,5 +1,5 @@ -// aux-crate:non_lifetime_binders=non_lifetime_binders.rs -// edition: 2021 +//@ aux-crate:non_lifetime_binders=non_lifetime_binders.rs +//@ edition: 2021 #![crate_name = "user"] // @has user/fn.f.html diff --git a/tests/rustdoc/inline_cross/proc_macro.rs b/tests/rustdoc/inline_cross/proc_macro.rs index a46550865c8b..4d3b0d554ab4 100644 --- a/tests/rustdoc/inline_cross/proc_macro.rs +++ b/tests/rustdoc/inline_cross/proc_macro.rs @@ -1,5 +1,5 @@ -// aux-build:proc_macro.rs -// build-aux-docs +//@ aux-build:proc_macro.rs +//@ build-aux-docs extern crate some_macros; diff --git a/tests/rustdoc/inline_cross/renamed-via-module.rs b/tests/rustdoc/inline_cross/renamed-via-module.rs index cdedbf070798..1f6a9cff8cef 100644 --- a/tests/rustdoc/inline_cross/renamed-via-module.rs +++ b/tests/rustdoc/inline_cross/renamed-via-module.rs @@ -1,6 +1,6 @@ -// aux-build:renamed-via-module.rs -// build-aux-docs -// ignore-cross-compile +//@ aux-build:renamed-via-module.rs +//@ build-aux-docs +//@ ignore-cross-compile #![crate_name = "bar"] diff --git a/tests/rustdoc/inline_cross/repr.rs b/tests/rustdoc/inline_cross/repr.rs index 2f3d8f003884..1d63bd1d7cb4 100644 --- a/tests/rustdoc/inline_cross/repr.rs +++ b/tests/rustdoc/inline_cross/repr.rs @@ -1,7 +1,7 @@ // Regression test for . // This test ensures that the re-exported items still have the `#[repr(...)]` attribute. -// aux-build:repr.rs +//@ aux-build:repr.rs #![crate_name = "foo"] diff --git a/tests/rustdoc/inline_cross/ret-pos-impl-trait-in-trait.rs b/tests/rustdoc/inline_cross/ret-pos-impl-trait-in-trait.rs index 8e9ef9020153..1292e7c74ed7 100644 --- a/tests/rustdoc/inline_cross/ret-pos-impl-trait-in-trait.rs +++ b/tests/rustdoc/inline_cross/ret-pos-impl-trait-in-trait.rs @@ -1,6 +1,6 @@ #![crate_name = "user"] -// aux-crate:rpitit=ret-pos-impl-trait-in-trait.rs -// edition:2021 +//@ aux-crate:rpitit=ret-pos-impl-trait-in-trait.rs +//@ edition:2021 // Test that we can correctly render cross-crate RPITITs. // In particular, check that we don't render the internal associated type generated by diff --git a/tests/rustdoc/inline_cross/sugar-closure-crate-21801.rs b/tests/rustdoc/inline_cross/sugar-closure-crate-21801.rs index bcbb2e9f4088..a00dcaf409bd 100644 --- a/tests/rustdoc/inline_cross/sugar-closure-crate-21801.rs +++ b/tests/rustdoc/inline_cross/sugar-closure-crate-21801.rs @@ -1,5 +1,5 @@ -// aux-build:issue-21801.rs -// ignore-cross-compile +//@ aux-build:issue-21801.rs +//@ ignore-cross-compile // https://github.com/rust-lang/rust/issues/21801 #![crate_name="issue_21801"] diff --git a/tests/rustdoc/inline_cross/trait-vis.rs b/tests/rustdoc/inline_cross/trait-vis.rs index b646babacc5c..fc992ab3110a 100644 --- a/tests/rustdoc/inline_cross/trait-vis.rs +++ b/tests/rustdoc/inline_cross/trait-vis.rs @@ -1,4 +1,4 @@ -// aux-build:trait-vis.rs +//@ aux-build:trait-vis.rs extern crate inner; diff --git a/tests/rustdoc/inline_cross/use_crate.rs b/tests/rustdoc/inline_cross/use_crate.rs index 00e0f041c56f..38cbcfa6b847 100644 --- a/tests/rustdoc/inline_cross/use_crate.rs +++ b/tests/rustdoc/inline_cross/use_crate.rs @@ -1,8 +1,8 @@ -// aux-build:use_crate.rs -// aux-build:use_crate_2.rs -// build-aux-docs -// edition:2018 -// compile-flags:--extern use_crate --extern use_crate_2 +//@ aux-build:use_crate.rs +//@ aux-build:use_crate_2.rs +//@ build-aux-docs +//@ edition:2018 +//@ compile-flags:--extern use_crate --extern use_crate_2 // During the buildup to Rust 2018, rustdoc would eagerly inline `pub use some_crate;` as if it // were a module, so we changed it to make `pub use`ing crate roots remain as a `pub use` statement diff --git a/tests/rustdoc/inline_local/glob-extern-document-private-items.rs b/tests/rustdoc/inline_local/glob-extern-document-private-items.rs index 8e1089d60ec5..9a11f88c81a2 100644 --- a/tests/rustdoc/inline_local/glob-extern-document-private-items.rs +++ b/tests/rustdoc/inline_local/glob-extern-document-private-items.rs @@ -1,4 +1,4 @@ -// compile-flags: --document-private-items +//@ compile-flags: --document-private-items #![crate_name = "foo"] diff --git a/tests/rustdoc/inline_local/glob-private-document-private-items.rs b/tests/rustdoc/inline_local/glob-private-document-private-items.rs index d8cbd42343b9..4ad217d22705 100644 --- a/tests/rustdoc/inline_local/glob-private-document-private-items.rs +++ b/tests/rustdoc/inline_local/glob-private-document-private-items.rs @@ -1,4 +1,4 @@ -// compile-flags: --document-private-items +//@ compile-flags: --document-private-items #![crate_name = "foo"] diff --git a/tests/rustdoc/internal.rs b/tests/rustdoc/internal.rs index 27b0897689e0..4663965f621a 100644 --- a/tests/rustdoc/internal.rs +++ b/tests/rustdoc/internal.rs @@ -1,4 +1,4 @@ -// compile-flags: -Z force-unstable-if-unmarked +//@ compile-flags: -Z force-unstable-if-unmarked // Check that the unstable marker is not added for "rustc_private". diff --git a/tests/rustdoc/intra-doc-crate/self.rs b/tests/rustdoc/intra-doc-crate/self.rs index 8c36a7fa002d..015611610acf 100644 --- a/tests/rustdoc/intra-doc-crate/self.rs +++ b/tests/rustdoc/intra-doc-crate/self.rs @@ -1,5 +1,5 @@ -// aux-build:self.rs -// build-aux-docs +//@ aux-build:self.rs +//@ build-aux-docs extern crate cross_crate_self; diff --git a/tests/rustdoc/intra-doc/auxiliary/extern-builtin-type-impl-dep.rs b/tests/rustdoc/intra-doc/auxiliary/extern-builtin-type-impl-dep.rs index d9a08cb41b82..f0662fd82f19 100644 --- a/tests/rustdoc/intra-doc/auxiliary/extern-builtin-type-impl-dep.rs +++ b/tests/rustdoc/intra-doc/auxiliary/extern-builtin-type-impl-dep.rs @@ -1,4 +1,4 @@ -// no-prefer-dynamic +//@ no-prefer-dynamic #![feature(lang_items, rustc_attrs)] #![crate_type = "rlib"] diff --git a/tests/rustdoc/intra-doc/auxiliary/proc-macro-macro.rs b/tests/rustdoc/intra-doc/auxiliary/proc-macro-macro.rs index 5ba132f25b47..b47e76a33e60 100644 --- a/tests/rustdoc/intra-doc/auxiliary/proc-macro-macro.rs +++ b/tests/rustdoc/intra-doc/auxiliary/proc-macro-macro.rs @@ -1,6 +1,6 @@ -// force-host -// no-prefer-dynamic -// compile-flags: --crate-type proc-macro +//@ force-host +//@ no-prefer-dynamic +//@ compile-flags: --crate-type proc-macro #![crate_type="proc-macro"] diff --git a/tests/rustdoc/intra-doc/cross-crate/additional_doc.rs b/tests/rustdoc/intra-doc/cross-crate/additional_doc.rs index e52fb9b1c9fd..dc928c64f6d6 100644 --- a/tests/rustdoc/intra-doc/cross-crate/additional_doc.rs +++ b/tests/rustdoc/intra-doc/cross-crate/additional_doc.rs @@ -1,5 +1,5 @@ -// aux-build:additional_doc.rs -// build-aux-docs +//@ aux-build:additional_doc.rs +//@ build-aux-docs #![deny(rustdoc::broken_intra_doc_links)] extern crate my_rand; diff --git a/tests/rustdoc/intra-doc/cross-crate/auxiliary/proc_macro.rs b/tests/rustdoc/intra-doc/cross-crate/auxiliary/proc_macro.rs index 0d5a954075df..107c44086b25 100644 --- a/tests/rustdoc/intra-doc/cross-crate/auxiliary/proc_macro.rs +++ b/tests/rustdoc/intra-doc/cross-crate/auxiliary/proc_macro.rs @@ -1,6 +1,6 @@ -// force-host -// no-prefer-dynamic -// compile-flags: --crate-type proc-macro +//@ force-host +//@ no-prefer-dynamic +//@ compile-flags: --crate-type proc-macro #![crate_type="proc-macro"] #![crate_name="proc_macro_inner"] diff --git a/tests/rustdoc/intra-doc/cross-crate/basic.rs b/tests/rustdoc/intra-doc/cross-crate/basic.rs index ad7454918b4e..f17c638b5789 100644 --- a/tests/rustdoc/intra-doc/cross-crate/basic.rs +++ b/tests/rustdoc/intra-doc/cross-crate/basic.rs @@ -1,5 +1,5 @@ -// aux-build:intra-doc-basic.rs -// build-aux-docs +//@ aux-build:intra-doc-basic.rs +//@ build-aux-docs #![deny(rustdoc::broken_intra_doc_links)] // from https://github.com/rust-lang/rust/issues/65983 diff --git a/tests/rustdoc/intra-doc/cross-crate/crate.rs b/tests/rustdoc/intra-doc/cross-crate/crate.rs index edf544708b62..34fff1f1f269 100644 --- a/tests/rustdoc/intra-doc/cross-crate/crate.rs +++ b/tests/rustdoc/intra-doc/cross-crate/crate.rs @@ -1,5 +1,5 @@ -// aux-build:intra-link-cross-crate-crate.rs -// build-aux-docs +//@ aux-build:intra-link-cross-crate-crate.rs +//@ build-aux-docs #![crate_name = "outer"] extern crate inner; // @has outer/fn.f.html '//a[@href="../inner/fn.g.html"]' "crate::g" diff --git a/tests/rustdoc/intra-doc/cross-crate/hidden.rs b/tests/rustdoc/intra-doc/cross-crate/hidden.rs index 4f7d075ba481..026c0fb4fdbc 100644 --- a/tests/rustdoc/intra-doc/cross-crate/hidden.rs +++ b/tests/rustdoc/intra-doc/cross-crate/hidden.rs @@ -1,5 +1,5 @@ -// aux-build:hidden.rs -// build-aux-docs +//@ aux-build:hidden.rs +//@ build-aux-docs #![deny(rustdoc::broken_intra_doc_links)] // tests https://github.com/rust-lang/rust/issues/73363 diff --git a/tests/rustdoc/intra-doc/cross-crate/macro.rs b/tests/rustdoc/intra-doc/cross-crate/macro.rs index 32f0a55d3c6e..cd8f1c3969f6 100644 --- a/tests/rustdoc/intra-doc/cross-crate/macro.rs +++ b/tests/rustdoc/intra-doc/cross-crate/macro.rs @@ -1,6 +1,6 @@ -// aux-build:macro_inner.rs -// aux-build:proc_macro.rs -// build-aux-docs +//@ aux-build:macro_inner.rs +//@ aux-build:proc_macro.rs +//@ build-aux-docs #![deny(rustdoc::broken_intra_doc_links)] extern crate macro_inner; extern crate proc_macro_inner; diff --git a/tests/rustdoc/intra-doc/cross-crate/module.rs b/tests/rustdoc/intra-doc/cross-crate/module.rs index fde9322657d1..2323cc94f8a3 100644 --- a/tests/rustdoc/intra-doc/cross-crate/module.rs +++ b/tests/rustdoc/intra-doc/cross-crate/module.rs @@ -1,6 +1,6 @@ // outer.rs -// aux-build: module.rs -// build-aux-docs +//@ aux-build: module.rs +//@ build-aux-docs #![deny(rustdoc::broken_intra_doc_links)] extern crate module_inner; // @has 'module/bar/index.html' '//a[@href="../../module_inner/trait.SomeTrait.html"]' 'SomeTrait' diff --git a/tests/rustdoc/intra-doc/cross-crate/submodule-inner.rs b/tests/rustdoc/intra-doc/cross-crate/submodule-inner.rs index 577fe78a5089..08996826561a 100644 --- a/tests/rustdoc/intra-doc/cross-crate/submodule-inner.rs +++ b/tests/rustdoc/intra-doc/cross-crate/submodule-inner.rs @@ -1,5 +1,5 @@ -// aux-build:submodule-inner.rs -// build-aux-docs +//@ aux-build:submodule-inner.rs +//@ build-aux-docs #![deny(rustdoc::broken_intra_doc_links)] extern crate a; diff --git a/tests/rustdoc/intra-doc/cross-crate/submodule-outer.rs b/tests/rustdoc/intra-doc/cross-crate/submodule-outer.rs index d0c0b7e85ae2..29b98036a96d 100644 --- a/tests/rustdoc/intra-doc/cross-crate/submodule-outer.rs +++ b/tests/rustdoc/intra-doc/cross-crate/submodule-outer.rs @@ -1,5 +1,5 @@ -// aux-build:submodule-outer.rs -// edition:2018 +//@ aux-build:submodule-outer.rs +//@ edition:2018 #![deny(rustdoc::broken_intra_doc_links)] extern crate bar as bar_; diff --git a/tests/rustdoc/intra-doc/cross-crate/traits.rs b/tests/rustdoc/intra-doc/cross-crate/traits.rs index 7b9554bfdb07..4b1625e5a51c 100644 --- a/tests/rustdoc/intra-doc/cross-crate/traits.rs +++ b/tests/rustdoc/intra-doc/cross-crate/traits.rs @@ -1,5 +1,5 @@ -// aux-build:traits.rs -// build-aux-docs +//@ aux-build:traits.rs +//@ build-aux-docs #![deny(rustdoc::broken_intra_doc_links)] extern crate inner; diff --git a/tests/rustdoc/intra-doc/extern-builtin-type-impl.rs b/tests/rustdoc/intra-doc/extern-builtin-type-impl.rs index 7bb1ded3f3c2..653b3b96892b 100644 --- a/tests/rustdoc/intra-doc/extern-builtin-type-impl.rs +++ b/tests/rustdoc/intra-doc/extern-builtin-type-impl.rs @@ -2,7 +2,7 @@ // comments. The doc link points to an associated item, so we check that traits in scope for that // link are populated. -// aux-build:extern-builtin-type-impl-dep.rs +//@ aux-build:extern-builtin-type-impl-dep.rs #![no_std] diff --git a/tests/rustdoc/intra-doc/extern-crate-only-used-in-link.rs b/tests/rustdoc/intra-doc/extern-crate-only-used-in-link.rs index ad50887e9221..cbe5bf912a57 100644 --- a/tests/rustdoc/intra-doc/extern-crate-only-used-in-link.rs +++ b/tests/rustdoc/intra-doc/extern-crate-only-used-in-link.rs @@ -1,12 +1,12 @@ // This test is just a little cursed. -// aux-build:issue-66159-1.rs -// aux-crate:priv:issue_66159_1=issue-66159-1.rs -// aux-build:empty.rs -// aux-crate:priv:empty=empty.rs -// aux-build:empty2.rs -// aux-crate:priv:empty2=empty2.rs -// build-aux-docs -// compile-flags:-Z unstable-options --edition 2018 +//@ aux-build:issue-66159-1.rs +//@ aux-crate:priv:issue_66159_1=issue-66159-1.rs +//@ aux-build:empty.rs +//@ aux-crate:priv:empty=empty.rs +//@ aux-build:empty2.rs +//@ aux-crate:priv:empty2=empty2.rs +//@ build-aux-docs +//@ compile-flags:-Z unstable-options --edition 2018 // @has extern_crate_only_used_in_link/index.html // @has - '//a[@href="../issue_66159_1/struct.Something.html"]' 'issue_66159_1::Something' diff --git a/tests/rustdoc/intra-doc/extern-crate.rs b/tests/rustdoc/intra-doc/extern-crate.rs index 4e4438dea038..3cfe37a8aca1 100644 --- a/tests/rustdoc/intra-doc/extern-crate.rs +++ b/tests/rustdoc/intra-doc/extern-crate.rs @@ -1,4 +1,4 @@ -// aux-build:intra-link-extern-crate.rs +//@ aux-build:intra-link-extern-crate.rs // When loading `extern crate` statements, we would pull in their docs at the same time, even // though they would never actually get displayed. This tripped intra-doc-link resolution failures, diff --git a/tests/rustdoc/intra-doc/extern-inherent-impl.rs b/tests/rustdoc/intra-doc/extern-inherent-impl.rs index 2e41c2214f4f..ac5ba8ddd058 100644 --- a/tests/rustdoc/intra-doc/extern-inherent-impl.rs +++ b/tests/rustdoc/intra-doc/extern-inherent-impl.rs @@ -1,7 +1,7 @@ // Reexport of a structure with public inherent impls having doc links in their comments. The doc // link points to an associated item, so we check that traits in scope for that link are populated. -// aux-build:extern-inherent-impl-dep.rs +//@ aux-build:extern-inherent-impl-dep.rs extern crate extern_inherent_impl_dep; diff --git a/tests/rustdoc/intra-doc/extern-reference-link.rs b/tests/rustdoc/intra-doc/extern-reference-link.rs index bad6ec755798..f24c7f039974 100644 --- a/tests/rustdoc/intra-doc/extern-reference-link.rs +++ b/tests/rustdoc/intra-doc/extern-reference-link.rs @@ -1,5 +1,5 @@ -// compile-flags: --extern pub_struct -// aux-build:pub-struct.rs +//@ compile-flags: --extern pub_struct +//@ aux-build:pub-struct.rs /// [SomeStruct] /// diff --git a/tests/rustdoc/intra-doc/external-traits.rs b/tests/rustdoc/intra-doc/external-traits.rs index a0a66f242c9f..0945f8b1621d 100644 --- a/tests/rustdoc/intra-doc/external-traits.rs +++ b/tests/rustdoc/intra-doc/external-traits.rs @@ -1,5 +1,5 @@ -// aux-build:intra-links-external-traits.rs -// ignore-cross-compile +//@ aux-build:intra-links-external-traits.rs +//@ ignore-cross-compile #![crate_name = "outer"] #![deny(rustdoc::broken_intra_doc_links)] diff --git a/tests/rustdoc/intra-doc/issue-103463.rs b/tests/rustdoc/intra-doc/issue-103463.rs index 4adf8a9a8a4a..9b5cb67fd32a 100644 --- a/tests/rustdoc/intra-doc/issue-103463.rs +++ b/tests/rustdoc/intra-doc/issue-103463.rs @@ -1,6 +1,6 @@ // The `Trait` is not pulled into the crate resulting in doc links in its methods being resolved. -// aux-build:issue-103463-aux.rs +//@ aux-build:issue-103463-aux.rs extern crate issue_103463_aux; use issue_103463_aux::Trait; diff --git a/tests/rustdoc/intra-doc/issue-104145.rs b/tests/rustdoc/intra-doc/issue-104145.rs index 9ce36740d60d..5690803af5ae 100644 --- a/tests/rustdoc/intra-doc/issue-104145.rs +++ b/tests/rustdoc/intra-doc/issue-104145.rs @@ -1,6 +1,6 @@ // Doc links in `Trait`'s methods are resolved because it has a local impl. -// aux-build:issue-103463-aux.rs +//@ aux-build:issue-103463-aux.rs extern crate issue_103463_aux; use issue_103463_aux::Trait; diff --git a/tests/rustdoc/intra-doc/issue-66159.rs b/tests/rustdoc/intra-doc/issue-66159.rs index 56742b39790a..b3e7f9171ade 100644 --- a/tests/rustdoc/intra-doc/issue-66159.rs +++ b/tests/rustdoc/intra-doc/issue-66159.rs @@ -1,5 +1,5 @@ -// aux-crate:priv:pub_struct=pub-struct.rs -// compile-flags:-Z unstable-options +//@ aux-crate:priv:pub_struct=pub-struct.rs +//@ compile-flags:-Z unstable-options // The issue was an ICE which meant that we never actually generated the docs // so if we have generated the docs, we're okay. diff --git a/tests/rustdoc/intra-doc/prim-methods-external-core.rs b/tests/rustdoc/intra-doc/prim-methods-external-core.rs index c3340af33d5a..76e96d7037f4 100644 --- a/tests/rustdoc/intra-doc/prim-methods-external-core.rs +++ b/tests/rustdoc/intra-doc/prim-methods-external-core.rs @@ -1,7 +1,7 @@ -// aux-build:my-core.rs -// build-aux-docs -// ignore-cross-compile -// only-linux +//@ aux-build:my-core.rs +//@ build-aux-docs +//@ ignore-cross-compile +//@ only-linux #![deny(rustdoc::broken_intra_doc_links)] #![feature(no_core, lang_items)] diff --git a/tests/rustdoc/intra-doc/private.rs b/tests/rustdoc/intra-doc/private.rs index 349091e9300b..d1ad210dc314 100644 --- a/tests/rustdoc/intra-doc/private.rs +++ b/tests/rustdoc/intra-doc/private.rs @@ -1,4 +1,4 @@ -// compile-flags: --document-private-items +//@ compile-flags: --document-private-items // make sure to update `rustdoc-ui/intra-doc/private.rs` if you update this file diff --git a/tests/rustdoc/intra-doc/proc-macro.rs b/tests/rustdoc/intra-doc/proc-macro.rs index 78379a90285f..e7c92259da18 100644 --- a/tests/rustdoc/intra-doc/proc-macro.rs +++ b/tests/rustdoc/intra-doc/proc-macro.rs @@ -1,5 +1,5 @@ -// aux-build:proc-macro-macro.rs -// build-aux-docs +//@ aux-build:proc-macro-macro.rs +//@ build-aux-docs #![deny(rustdoc::broken_intra_doc_links)] extern crate proc_macro_macro; diff --git a/tests/rustdoc/intra-doc/pub-use.rs b/tests/rustdoc/intra-doc/pub-use.rs index 8a998496cf56..f6347ed2eabf 100644 --- a/tests/rustdoc/intra-doc/pub-use.rs +++ b/tests/rustdoc/intra-doc/pub-use.rs @@ -1,4 +1,4 @@ -// aux-build: intra-link-pub-use.rs +//@ aux-build: intra-link-pub-use.rs #![deny(rustdoc::broken_intra_doc_links)] #![crate_name = "outer"] diff --git a/tests/rustdoc/intra-doc/reexport-additional-docs.rs b/tests/rustdoc/intra-doc/reexport-additional-docs.rs index 64683bacd651..7912fd3681e7 100644 --- a/tests/rustdoc/intra-doc/reexport-additional-docs.rs +++ b/tests/rustdoc/intra-doc/reexport-additional-docs.rs @@ -1,5 +1,5 @@ -// aux-build:intra-link-reexport-additional-docs.rs -// build-aux-docs +//@ aux-build:intra-link-reexport-additional-docs.rs +//@ build-aux-docs #![crate_name = "foo"] extern crate inner; diff --git a/tests/rustdoc/invalid.crate.name.rs b/tests/rustdoc/invalid.crate.name.rs index c19713b565af..189a6c921248 100644 --- a/tests/rustdoc/invalid.crate.name.rs +++ b/tests/rustdoc/invalid.crate.name.rs @@ -1,3 +1,3 @@ -// compile-flags: --crate-name foo +//@ compile-flags: --crate-name foo pub fn foo() {} diff --git a/tests/rustdoc/issue-100204-inline-impl-through-glob-import.rs b/tests/rustdoc/issue-100204-inline-impl-through-glob-import.rs index 3e20c5c0741e..95fd3c12d6f4 100644 --- a/tests/rustdoc/issue-100204-inline-impl-through-glob-import.rs +++ b/tests/rustdoc/issue-100204-inline-impl-through-glob-import.rs @@ -1,6 +1,6 @@ -// aux-build:issue-100204-aux.rs -// build-aux-docs -// ignore-cross-compile +//@ aux-build:issue-100204-aux.rs +//@ build-aux-docs +//@ ignore-cross-compile #![crate_name="second"] diff --git a/tests/rustdoc/issue-100241.rs b/tests/rustdoc/issue-100241.rs index 9e9cba13a22f..e4c613dd2791 100644 --- a/tests/rustdoc/issue-100241.rs +++ b/tests/rustdoc/issue-100241.rs @@ -1,7 +1,7 @@ //! See [`S`]. // Check that this isn't an ICE -// should-fail +//@ should-fail mod foo { pub use inner::S; diff --git a/tests/rustdoc/issue-110422-inner-private.rs b/tests/rustdoc/issue-110422-inner-private.rs index 43dc929ab074..ca9ec70aaa48 100644 --- a/tests/rustdoc/issue-110422-inner-private.rs +++ b/tests/rustdoc/issue-110422-inner-private.rs @@ -2,7 +2,7 @@ // This test ensures that inner items (except for implementations and macros) // don't appear in documentation. -// compile-flags: --document-private-items +//@ compile-flags: --document-private-items #![crate_name = "foo"] diff --git a/tests/rustdoc/issue-110629-private-type-cycle.rs b/tests/rustdoc/issue-110629-private-type-cycle.rs index a4efbb098f74..e8847d7f1252 100644 --- a/tests/rustdoc/issue-110629-private-type-cycle.rs +++ b/tests/rustdoc/issue-110629-private-type-cycle.rs @@ -1,4 +1,4 @@ -// compile-flags: --document-private-items +//@ compile-flags: --document-private-items #![feature(type_alias_impl_trait)] diff --git a/tests/rustdoc/issue-113982-doc_auto_cfg-reexport-foreign.rs b/tests/rustdoc/issue-113982-doc_auto_cfg-reexport-foreign.rs index 88b86d15c56a..6d84ceb0165b 100644 --- a/tests/rustdoc/issue-113982-doc_auto_cfg-reexport-foreign.rs +++ b/tests/rustdoc/issue-113982-doc_auto_cfg-reexport-foreign.rs @@ -1,4 +1,4 @@ -// aux-build: issue-113982-doc_auto_cfg-reexport-foreign.rs +//@ aux-build: issue-113982-doc_auto_cfg-reexport-foreign.rs #![feature(no_core, doc_auto_cfg)] #![no_core] diff --git a/tests/rustdoc/issue-57180.rs b/tests/rustdoc/issue-57180.rs index 14bd2b0fec0d..aa6b77583993 100644 --- a/tests/rustdoc/issue-57180.rs +++ b/tests/rustdoc/issue-57180.rs @@ -1,4 +1,4 @@ -// aux-build:issue-57180.rs +//@ aux-build:issue-57180.rs extern crate issue_57180; use issue_57180::Trait; diff --git a/tests/rustdoc/issue-61592.rs b/tests/rustdoc/issue-61592.rs index 4b6c37b94aa7..068310fa6a33 100644 --- a/tests/rustdoc/issue-61592.rs +++ b/tests/rustdoc/issue-61592.rs @@ -1,4 +1,4 @@ -// aux-build:issue-61592.rs +//@ aux-build:issue-61592.rs extern crate foo; diff --git a/tests/rustdoc/issue-67851-both.rs b/tests/rustdoc/issue-67851-both.rs index d69b94317341..ed59652838e1 100644 --- a/tests/rustdoc/issue-67851-both.rs +++ b/tests/rustdoc/issue-67851-both.rs @@ -1,4 +1,4 @@ -// compile-flags: -Zunstable-options --document-private-items --document-hidden-items +//@ compile-flags: -Zunstable-options --document-private-items --document-hidden-items // @has issue_67851_both/struct.Hidden.html #[doc(hidden)] diff --git a/tests/rustdoc/issue-67851-hidden.rs b/tests/rustdoc/issue-67851-hidden.rs index 8a3cafe4c3dc..6d532adc06fd 100644 --- a/tests/rustdoc/issue-67851-hidden.rs +++ b/tests/rustdoc/issue-67851-hidden.rs @@ -1,4 +1,4 @@ -// compile-flags: -Zunstable-options --document-hidden-items +//@ compile-flags: -Zunstable-options --document-hidden-items // @has issue_67851_hidden/struct.Hidden.html #[doc(hidden)] diff --git a/tests/rustdoc/issue-67851-private.rs b/tests/rustdoc/issue-67851-private.rs index 8addc7f3e4b5..ead7ddf397f8 100644 --- a/tests/rustdoc/issue-67851-private.rs +++ b/tests/rustdoc/issue-67851-private.rs @@ -1,4 +1,4 @@ -// compile-flags: --document-private-items +//@ compile-flags: --document-private-items // @!has issue_67851_private/struct.Hidden.html #[doc(hidden)] diff --git a/tests/rustdoc/issue-73061-cross-crate-opaque-assoc-type.rs b/tests/rustdoc/issue-73061-cross-crate-opaque-assoc-type.rs index 2700f2370eec..e16aeac65cc5 100644 --- a/tests/rustdoc/issue-73061-cross-crate-opaque-assoc-type.rs +++ b/tests/rustdoc/issue-73061-cross-crate-opaque-assoc-type.rs @@ -1,6 +1,6 @@ // Regression test for ICE #73061 -// aux-build:issue-73061.rs +//@ aux-build:issue-73061.rs extern crate issue_73061; diff --git a/tests/rustdoc/issue-75588.rs b/tests/rustdoc/issue-75588.rs index 3b11059a755d..4f790994b419 100644 --- a/tests/rustdoc/issue-75588.rs +++ b/tests/rustdoc/issue-75588.rs @@ -1,5 +1,5 @@ -// aux-build:realcore.rs -// aux-build:real_gimli.rs +//@ aux-build:realcore.rs +//@ aux-build:real_gimli.rs // Ensure unstably exported traits have their Implementors sections. diff --git a/tests/rustdoc/issue-81141-private-reexport-in-public-api-2.rs b/tests/rustdoc/issue-81141-private-reexport-in-public-api-2.rs index 4e9d188bbf8d..fba310cec6d6 100644 --- a/tests/rustdoc/issue-81141-private-reexport-in-public-api-2.rs +++ b/tests/rustdoc/issue-81141-private-reexport-in-public-api-2.rs @@ -1,4 +1,4 @@ -// edition:2015 +//@ edition:2015 #![crate_name = "foo"] diff --git a/tests/rustdoc/issue-81141-private-reexport-in-public-api-hidden.rs b/tests/rustdoc/issue-81141-private-reexport-in-public-api-hidden.rs index 5053a328bad8..388f69ba3265 100644 --- a/tests/rustdoc/issue-81141-private-reexport-in-public-api-hidden.rs +++ b/tests/rustdoc/issue-81141-private-reexport-in-public-api-hidden.rs @@ -1,4 +1,4 @@ -// compile-flags: -Z unstable-options --document-hidden-items +//@ compile-flags: -Z unstable-options --document-hidden-items #![crate_name = "foo"] diff --git a/tests/rustdoc/issue-81141-private-reexport-in-public-api-private.rs b/tests/rustdoc/issue-81141-private-reexport-in-public-api-private.rs index 15749674a3db..2633f98c4f30 100644 --- a/tests/rustdoc/issue-81141-private-reexport-in-public-api-private.rs +++ b/tests/rustdoc/issue-81141-private-reexport-in-public-api-private.rs @@ -1,4 +1,4 @@ -// compile-flags: --document-private-items +//@ compile-flags: --document-private-items #![crate_name = "foo"] diff --git a/tests/rustdoc/issue-85454.rs b/tests/rustdoc/issue-85454.rs index 5a49a9d06519..790db0c5dcfe 100644 --- a/tests/rustdoc/issue-85454.rs +++ b/tests/rustdoc/issue-85454.rs @@ -1,5 +1,5 @@ -// aux-build:issue-85454.rs -// build-aux-docs +//@ aux-build:issue-85454.rs +//@ build-aux-docs #![crate_name = "foo"] extern crate issue_85454; diff --git a/tests/rustdoc/issue-86620.rs b/tests/rustdoc/issue-86620.rs index ef15946ec504..a7ac0f1d291b 100644 --- a/tests/rustdoc/issue-86620.rs +++ b/tests/rustdoc/issue-86620.rs @@ -1,4 +1,4 @@ -// aux-build:issue-86620-1.rs +//@ aux-build:issue-86620-1.rs extern crate issue_86620_1; diff --git a/tests/rustdoc/issue-89852.rs b/tests/rustdoc/issue-89852.rs index 4f2da5e07bee..e9b3d80c92ee 100644 --- a/tests/rustdoc/issue-89852.rs +++ b/tests/rustdoc/issue-89852.rs @@ -1,4 +1,4 @@ -// edition:2018 +//@ edition:2018 #![no_core] #![feature(no_core)] diff --git a/tests/rustdoc/issue-95633.rs b/tests/rustdoc/issue-95633.rs index a71d0a037318..5695ef579f2b 100644 --- a/tests/rustdoc/issue-95633.rs +++ b/tests/rustdoc/issue-95633.rs @@ -1,4 +1,4 @@ -// compile-flags: --document-private-items +//@ compile-flags: --document-private-items // This ensures that no ICE is triggered when rustdoc is run on this code. diff --git a/tests/rustdoc/issue-96381.rs b/tests/rustdoc/issue-96381.rs index f0f123f85a03..90875c076057 100644 --- a/tests/rustdoc/issue-96381.rs +++ b/tests/rustdoc/issue-96381.rs @@ -1,4 +1,4 @@ -// should-fail +//@ should-fail #![allow(unused)] diff --git a/tests/rustdoc/issue-98697.rs b/tests/rustdoc/issue-98697.rs index 5d5aee1fe1df..df9f29151113 100644 --- a/tests/rustdoc/issue-98697.rs +++ b/tests/rustdoc/issue-98697.rs @@ -1,5 +1,5 @@ -// aux-build:issue-98697-reexport-with-anonymous-lifetime.rs -// ignore-cross-compile +//@ aux-build:issue-98697-reexport-with-anonymous-lifetime.rs +//@ ignore-cross-compile // When reexporting a function with a HRTB with anonymous lifetimes, // make sure the anonymous lifetimes are not rendered. diff --git a/tests/rustdoc/issue-99221-multiple-macro-rules-w-same-name-submodule.rs b/tests/rustdoc/issue-99221-multiple-macro-rules-w-same-name-submodule.rs index e74881d387dc..d3ccd1c069b6 100644 --- a/tests/rustdoc/issue-99221-multiple-macro-rules-w-same-name-submodule.rs +++ b/tests/rustdoc/issue-99221-multiple-macro-rules-w-same-name-submodule.rs @@ -1,6 +1,6 @@ -// aux-build:issue-99221-aux.rs -// build-aux-docs -// ignore-cross-compile +//@ aux-build:issue-99221-aux.rs +//@ build-aux-docs +//@ ignore-cross-compile #![crate_name = "foo"] diff --git a/tests/rustdoc/issue-99221-multiple-macro-rules-w-same-name.rs b/tests/rustdoc/issue-99221-multiple-macro-rules-w-same-name.rs index 46d59654b99e..f4f62717cea9 100644 --- a/tests/rustdoc/issue-99221-multiple-macro-rules-w-same-name.rs +++ b/tests/rustdoc/issue-99221-multiple-macro-rules-w-same-name.rs @@ -1,6 +1,6 @@ -// aux-build:issue-99221-aux.rs -// build-aux-docs -// ignore-cross-compile +//@ aux-build:issue-99221-aux.rs +//@ build-aux-docs +//@ ignore-cross-compile #![crate_name = "foo"] diff --git a/tests/rustdoc/issue-99221-multiple-structs-w-same-name.rs b/tests/rustdoc/issue-99221-multiple-structs-w-same-name.rs index ba29a77ebdff..4852ee71da7d 100644 --- a/tests/rustdoc/issue-99221-multiple-structs-w-same-name.rs +++ b/tests/rustdoc/issue-99221-multiple-structs-w-same-name.rs @@ -1,6 +1,6 @@ -// aux-build:issue-99221-aux.rs -// build-aux-docs -// ignore-cross-compile +//@ aux-build:issue-99221-aux.rs +//@ build-aux-docs +//@ ignore-cross-compile #![crate_name = "foo"] diff --git a/tests/rustdoc/issue-99734-multiple-foreigns-w-same-name.rs b/tests/rustdoc/issue-99734-multiple-foreigns-w-same-name.rs index b56ec6e11eaf..9c94fdd91600 100644 --- a/tests/rustdoc/issue-99734-multiple-foreigns-w-same-name.rs +++ b/tests/rustdoc/issue-99734-multiple-foreigns-w-same-name.rs @@ -1,6 +1,6 @@ -// aux-build:issue-99734-aux.rs -// build-aux-docs -// ignore-cross-compile +//@ aux-build:issue-99734-aux.rs +//@ build-aux-docs +//@ ignore-cross-compile #![crate_name = "foo"] diff --git a/tests/rustdoc/issue-99734-multiple-mods-w-same-name.rs b/tests/rustdoc/issue-99734-multiple-mods-w-same-name.rs index 8f5d6fa3d56d..41aeb30a461b 100644 --- a/tests/rustdoc/issue-99734-multiple-mods-w-same-name.rs +++ b/tests/rustdoc/issue-99734-multiple-mods-w-same-name.rs @@ -1,6 +1,6 @@ -// aux-build:issue-99734-aux.rs -// build-aux-docs -// ignore-cross-compile +//@ aux-build:issue-99734-aux.rs +//@ build-aux-docs +//@ ignore-cross-compile #![crate_name = "foo"] diff --git a/tests/rustdoc/jump-to-def-doc-links-calls.rs b/tests/rustdoc/jump-to-def-doc-links-calls.rs index 549d068528e2..4101058edbf4 100644 --- a/tests/rustdoc/jump-to-def-doc-links-calls.rs +++ b/tests/rustdoc/jump-to-def-doc-links-calls.rs @@ -1,4 +1,4 @@ -// compile-flags: -Zunstable-options --generate-link-to-definition +//@ compile-flags: -Zunstable-options --generate-link-to-definition #![crate_name = "foo"] diff --git a/tests/rustdoc/jump-to-def-doc-links.rs b/tests/rustdoc/jump-to-def-doc-links.rs index 014d5803299c..1722aa404370 100644 --- a/tests/rustdoc/jump-to-def-doc-links.rs +++ b/tests/rustdoc/jump-to-def-doc-links.rs @@ -1,4 +1,4 @@ -// compile-flags: -Zunstable-options --generate-link-to-definition +//@ compile-flags: -Zunstable-options --generate-link-to-definition #![crate_name = "foo"] diff --git a/tests/rustdoc/jump-to-non-local-method.rs b/tests/rustdoc/jump-to-non-local-method.rs index 7767b92fbe55..bc44d9a97088 100644 --- a/tests/rustdoc/jump-to-non-local-method.rs +++ b/tests/rustdoc/jump-to-non-local-method.rs @@ -1,4 +1,4 @@ -// compile-flags: -Zunstable-options --generate-link-to-definition +//@ compile-flags: -Zunstable-options --generate-link-to-definition #![crate_name = "foo"] diff --git a/tests/rustdoc/link-extern-crate-33178.rs b/tests/rustdoc/link-extern-crate-33178.rs index 6a63712c4a78..d62bab5111f4 100644 --- a/tests/rustdoc/link-extern-crate-33178.rs +++ b/tests/rustdoc/link-extern-crate-33178.rs @@ -1,7 +1,7 @@ -// aux-build:empty.rs -// aux-build:variant-struct.rs -// build-aux-docs -// ignore-cross-compile +//@ aux-build:empty.rs +//@ aux-build:variant-struct.rs +//@ build-aux-docs +//@ ignore-cross-compile // https://github.com/rust-lang/rust/issues/33178 #![crate_name="issue_33178"] diff --git a/tests/rustdoc/link-extern-crate-item-30109.rs b/tests/rustdoc/link-extern-crate-item-30109.rs index c83234352ad3..a57d16da820e 100644 --- a/tests/rustdoc/link-extern-crate-item-30109.rs +++ b/tests/rustdoc/link-extern-crate-item-30109.rs @@ -1,6 +1,6 @@ -// build-aux-docs -// aux-build:issue-30109-1.rs -// ignore-cross-compile +//@ build-aux-docs +//@ aux-build:issue-30109-1.rs +//@ ignore-cross-compile // https://github.com/rust-lang/rust/issues/30109 #![crate_name="issue_30109"] diff --git a/tests/rustdoc/link-extern-crate-title-33178.rs b/tests/rustdoc/link-extern-crate-title-33178.rs index d2f115a386e9..e85ddb2c891c 100644 --- a/tests/rustdoc/link-extern-crate-title-33178.rs +++ b/tests/rustdoc/link-extern-crate-title-33178.rs @@ -1,6 +1,6 @@ -// aux-build:empty.rs -// aux-build:variant-struct.rs -// ignore-cross-compile +//@ aux-build:empty.rs +//@ aux-build:variant-struct.rs +//@ ignore-cross-compile // https://github.com/rust-lang/rust/issues/33178 #![crate_name="issue_33178_1"] diff --git a/tests/rustdoc/macro-document-private-duplicate.rs b/tests/rustdoc/macro-document-private-duplicate.rs index d3cf7e140650..703317be8c93 100644 --- a/tests/rustdoc/macro-document-private-duplicate.rs +++ b/tests/rustdoc/macro-document-private-duplicate.rs @@ -1,4 +1,4 @@ -// ignore-test (fails spuriously, see issue #89228) +//@ ignore-test (fails spuriously, see issue #89228) // FIXME: If two macros in the same module have the same name // (yes, that's a thing), rustdoc lists both of them on the index page, @@ -8,7 +8,7 @@ // // See https://github.com/rust-lang/rust/pull/88019#discussion_r693920453 // -// compile-flags: --document-private-items +//@ compile-flags: --document-private-items // @hasraw macro_document_private_duplicate/index.html 'Doc 1.' // @hasraw macro_document_private_duplicate/macro.a_macro.html 'Doc 1.' diff --git a/tests/rustdoc/macro-document-private.rs b/tests/rustdoc/macro-document-private.rs index d2496913ffcf..2252aa87ebaa 100644 --- a/tests/rustdoc/macro-document-private.rs +++ b/tests/rustdoc/macro-document-private.rs @@ -3,7 +3,7 @@ // // This is a regression test for issue #73754. // -// compile-flags: --document-private-items +//@ compile-flags: --document-private-items #![feature(decl_macro)] diff --git a/tests/rustdoc/macro-in-async-block.rs b/tests/rustdoc/macro-in-async-block.rs index b4aaacf7b3d4..43822fb9c52a 100644 --- a/tests/rustdoc/macro-in-async-block.rs +++ b/tests/rustdoc/macro-in-async-block.rs @@ -1,5 +1,5 @@ // Regression issue for rustdoc ICE encountered in PR #72088. -// edition:2018 +//@ edition:2018 #![feature(decl_macro)] fn main() { diff --git a/tests/rustdoc/macro_pub_in_module.rs b/tests/rustdoc/macro_pub_in_module.rs index 42f760cff6a7..06b7047893bb 100644 --- a/tests/rustdoc/macro_pub_in_module.rs +++ b/tests/rustdoc/macro_pub_in_module.rs @@ -1,6 +1,6 @@ -// aux-build:macro_pub_in_module.rs -// edition:2018 -// build-aux-docs +//@ aux-build:macro_pub_in_module.rs +//@ edition:2018 +//@ build-aux-docs //! See issue #74355 #![feature(decl_macro, no_core, rustc_attrs)] diff --git a/tests/rustdoc/masked.rs b/tests/rustdoc/masked.rs index 875c026fd058..03e5e53f424f 100644 --- a/tests/rustdoc/masked.rs +++ b/tests/rustdoc/masked.rs @@ -1,4 +1,4 @@ -// aux-build:masked.rs +//@ aux-build:masked.rs #![feature(doc_masked)] diff --git a/tests/rustdoc/method-link-foreign-trait-impl-17476.rs b/tests/rustdoc/method-link-foreign-trait-impl-17476.rs index e52ab6f38c2a..5f341e6c21cb 100644 --- a/tests/rustdoc/method-link-foreign-trait-impl-17476.rs +++ b/tests/rustdoc/method-link-foreign-trait-impl-17476.rs @@ -1,5 +1,5 @@ -// aux-build:issue-17476.rs -// ignore-cross-compile +//@ aux-build:issue-17476.rs +//@ ignore-cross-compile // https://github.com/rust-lang/rust/issues/17476 #![crate_name="issue_17476"] diff --git a/tests/rustdoc/mod-stackoverflow.rs b/tests/rustdoc/mod-stackoverflow.rs index 45b1de2162d9..7dbbca13acea 100644 --- a/tests/rustdoc/mod-stackoverflow.rs +++ b/tests/rustdoc/mod-stackoverflow.rs @@ -1,5 +1,5 @@ -// aux-build:mod-stackoverflow.rs -// ignore-cross-compile +//@ aux-build:mod-stackoverflow.rs +//@ ignore-cross-compile extern crate mod_stackoverflow; pub use mod_stackoverflow::tree; diff --git a/tests/rustdoc/no-compiler-reexport.rs b/tests/rustdoc/no-compiler-reexport.rs index d28fdf87b77a..d1567c4fddab 100644 --- a/tests/rustdoc/no-compiler-reexport.rs +++ b/tests/rustdoc/no-compiler-reexport.rs @@ -1,4 +1,4 @@ -// compile-flags: -Z unstable-options --document-hidden-items --document-private-items +//@ compile-flags: -Z unstable-options --document-hidden-items --document-private-items #![crate_name = "foo"] diff --git a/tests/rustdoc/no-run-still-checks-lints.rs b/tests/rustdoc/no-run-still-checks-lints.rs index 9f7d1c8845dc..73e311b72d5e 100644 --- a/tests/rustdoc/no-run-still-checks-lints.rs +++ b/tests/rustdoc/no-run-still-checks-lints.rs @@ -1,5 +1,5 @@ -// compile-flags:--test -// should-fail +//@ compile-flags:--test +//@ should-fail #![doc(test(attr(deny(warnings))))] diff --git a/tests/rustdoc/no-stack-overflow-25295.rs b/tests/rustdoc/no-stack-overflow-25295.rs index dd79f1e4baaa..50bfb8adb614 100644 --- a/tests/rustdoc/no-stack-overflow-25295.rs +++ b/tests/rustdoc/no-stack-overflow-25295.rs @@ -1,5 +1,5 @@ // Ensure this code doesn't stack overflow. -// aux-build:enum-primitive.rs +//@ aux-build:enum-primitive.rs #[macro_use] extern crate enum_primitive; diff --git a/tests/rustdoc/normalize-assoc-item.rs b/tests/rustdoc/normalize-assoc-item.rs index d39e1b15a4cb..d45bb1bff65c 100644 --- a/tests/rustdoc/normalize-assoc-item.rs +++ b/tests/rustdoc/normalize-assoc-item.rs @@ -1,7 +1,7 @@ // ignore-tidy-linelength -// aux-build:normalize-assoc-item.rs -// build-aux-docs -// compile-flags:-Znormalize-docs +//@ aux-build:normalize-assoc-item.rs +//@ build-aux-docs +//@ compile-flags:-Znormalize-docs pub trait Trait { type X; diff --git a/tests/rustdoc/nul-error.rs b/tests/rustdoc/nul-error.rs index 3d30f5f6b77f..e8aa786534b3 100644 --- a/tests/rustdoc/nul-error.rs +++ b/tests/rustdoc/nul-error.rs @@ -1,5 +1,5 @@ -// build-aux-docs -// ignore-cross-compile +//@ build-aux-docs +//@ ignore-cross-compile #![crate_name = "foo"] diff --git a/tests/rustdoc/playground-arg.rs b/tests/rustdoc/playground-arg.rs index 1d7085064e5a..58d87c653b48 100644 --- a/tests/rustdoc/playground-arg.rs +++ b/tests/rustdoc/playground-arg.rs @@ -1,4 +1,4 @@ -// compile-flags: --playground-url=https://example.com/ -Z unstable-options +//@ compile-flags: --playground-url=https://example.com/ -Z unstable-options #![crate_name = "foo"] diff --git a/tests/rustdoc/playground-empty.rs b/tests/rustdoc/playground-empty.rs index 7d8bd3ffe0d6..bfba9ffdbf46 100644 --- a/tests/rustdoc/playground-empty.rs +++ b/tests/rustdoc/playground-empty.rs @@ -2,7 +2,7 @@ #![doc(html_playground_url = "")] -// compile-flags:-Z unstable-options --playground-url https://play.rust-lang.org/ +//@ compile-flags:-Z unstable-options --playground-url https://play.rust-lang.org/ //! module docs //! diff --git a/tests/rustdoc/primitive-raw-pointer-link-15318.rs b/tests/rustdoc/primitive-raw-pointer-link-15318.rs index 77f25ff4cff0..66d84e9aaa34 100644 --- a/tests/rustdoc/primitive-raw-pointer-link-15318.rs +++ b/tests/rustdoc/primitive-raw-pointer-link-15318.rs @@ -1,5 +1,5 @@ -// aux-build:issue-15318.rs -// ignore-cross-compile +//@ aux-build:issue-15318.rs +//@ ignore-cross-compile // https://github.com/rust-lang/rust/issues/15318 #![crate_name="issue_15318"] diff --git a/tests/rustdoc/primitive-raw-pointer-link-no-inlined-15318-2.rs b/tests/rustdoc/primitive-raw-pointer-link-no-inlined-15318-2.rs index 1b35bb185ed4..e6c69c3407e6 100644 --- a/tests/rustdoc/primitive-raw-pointer-link-no-inlined-15318-2.rs +++ b/tests/rustdoc/primitive-raw-pointer-link-no-inlined-15318-2.rs @@ -1,5 +1,5 @@ -// aux-build:issue-15318.rs -// ignore-cross-compile +//@ aux-build:issue-15318.rs +//@ ignore-cross-compile // https://github.com/rust-lang/rust/issues/15318 #![crate_name="issue_15318_2"] diff --git a/tests/rustdoc/primitive-reexport.rs b/tests/rustdoc/primitive-reexport.rs index 10a8a47db524..7dbb7c6db508 100644 --- a/tests/rustdoc/primitive-reexport.rs +++ b/tests/rustdoc/primitive-reexport.rs @@ -1,5 +1,5 @@ -// aux-build: primitive-reexport.rs -// compile-flags:--extern foo --edition 2018 +//@ aux-build: primitive-reexport.rs +//@ compile-flags:--extern foo --edition 2018 #![crate_name = "bar"] diff --git a/tests/rustdoc/primitive-slice-auto-trait.rs b/tests/rustdoc/primitive-slice-auto-trait.rs index ba15a73ca1d1..359a08f6a313 100644 --- a/tests/rustdoc/primitive-slice-auto-trait.rs +++ b/tests/rustdoc/primitive-slice-auto-trait.rs @@ -1,4 +1,4 @@ -// compile-flags: --crate-type lib --edition 2018 +//@ compile-flags: --crate-type lib --edition 2018 #![crate_name = "foo"] #![feature(rustc_attrs)] diff --git a/tests/rustdoc/primitive-tuple-auto-trait.rs b/tests/rustdoc/primitive-tuple-auto-trait.rs index 2b407b586a3d..79737da3a2d0 100644 --- a/tests/rustdoc/primitive-tuple-auto-trait.rs +++ b/tests/rustdoc/primitive-tuple-auto-trait.rs @@ -1,4 +1,4 @@ -// compile-flags: --crate-type lib --edition 2018 +//@ compile-flags: --crate-type lib --edition 2018 #![crate_name = "foo"] #![feature(rustc_attrs)] diff --git a/tests/rustdoc/primitive-tuple-variadic.rs b/tests/rustdoc/primitive-tuple-variadic.rs index 846028bbb190..546cf2ace425 100644 --- a/tests/rustdoc/primitive-tuple-variadic.rs +++ b/tests/rustdoc/primitive-tuple-variadic.rs @@ -1,4 +1,4 @@ -// compile-flags: --crate-type lib --edition 2018 +//@ compile-flags: --crate-type lib --edition 2018 #![crate_name = "foo"] #![feature(rustdoc_internals)] diff --git a/tests/rustdoc/primitive-unit-auto-trait.rs b/tests/rustdoc/primitive-unit-auto-trait.rs index 5a56f1fd83bd..ff86a555cda1 100644 --- a/tests/rustdoc/primitive-unit-auto-trait.rs +++ b/tests/rustdoc/primitive-unit-auto-trait.rs @@ -1,4 +1,4 @@ -// compile-flags: --crate-type lib --edition 2018 +//@ compile-flags: --crate-type lib --edition 2018 #![crate_name = "foo"] #![feature(rustc_attrs)] diff --git a/tests/rustdoc/proc-macro.rs b/tests/rustdoc/proc-macro.rs index 10acb7ac495e..57bf228052ce 100644 --- a/tests/rustdoc/proc-macro.rs +++ b/tests/rustdoc/proc-macro.rs @@ -1,6 +1,6 @@ -// force-host -// no-prefer-dynamic -// compile-flags: --crate-type proc-macro --document-private-items +//@ force-host +//@ no-prefer-dynamic +//@ compile-flags: --crate-type proc-macro --document-private-items #![crate_type="proc-macro"] #![crate_name="some_macros"] diff --git a/tests/rustdoc/process-termination.rs b/tests/rustdoc/process-termination.rs index 32258792b6e8..73a86e57424a 100644 --- a/tests/rustdoc/process-termination.rs +++ b/tests/rustdoc/process-termination.rs @@ -1,4 +1,4 @@ -// compile-flags:--test +//@ compile-flags:--test /// A check of using various process termination strategies /// diff --git a/tests/rustdoc/pub-extern-crate.rs b/tests/rustdoc/pub-extern-crate.rs index 26747a4d1aca..c5be51f35ac5 100644 --- a/tests/rustdoc/pub-extern-crate.rs +++ b/tests/rustdoc/pub-extern-crate.rs @@ -1,4 +1,4 @@ -// aux-build:pub-extern-crate.rs +//@ aux-build:pub-extern-crate.rs // @has pub_extern_crate/index.html // @!has - '//code' 'pub extern crate inner' diff --git a/tests/rustdoc/pub-method.rs b/tests/rustdoc/pub-method.rs index ea4791579cd6..2a77aa753520 100644 --- a/tests/rustdoc/pub-method.rs +++ b/tests/rustdoc/pub-method.rs @@ -1,4 +1,4 @@ -// compile-flags: --document-private-items +//@ compile-flags: --document-private-items #![crate_name = "foo"] diff --git a/tests/rustdoc/pub-use-extern-macros.rs b/tests/rustdoc/pub-use-extern-macros.rs index eefe6b4b0736..d3d667297fbc 100644 --- a/tests/rustdoc/pub-use-extern-macros.rs +++ b/tests/rustdoc/pub-use-extern-macros.rs @@ -1,4 +1,4 @@ -// aux-build:pub-use-extern-macros.rs +//@ aux-build:pub-use-extern-macros.rs extern crate macros; diff --git a/tests/rustdoc/redirect-map-empty.rs b/tests/rustdoc/redirect-map-empty.rs index e9d021e0fa86..12e500e785e0 100644 --- a/tests/rustdoc/redirect-map-empty.rs +++ b/tests/rustdoc/redirect-map-empty.rs @@ -1,4 +1,4 @@ -// compile-flags: -Z unstable-options --generate-redirect-map +//@ compile-flags: -Z unstable-options --generate-redirect-map #![crate_name = "foo"] diff --git a/tests/rustdoc/redirect-map.rs b/tests/rustdoc/redirect-map.rs index b7f16b64e385..3ad252984943 100644 --- a/tests/rustdoc/redirect-map.rs +++ b/tests/rustdoc/redirect-map.rs @@ -1,4 +1,4 @@ -// compile-flags: -Z unstable-options --generate-redirect-map +//@ compile-flags: -Z unstable-options --generate-redirect-map #![crate_name = "foo"] diff --git a/tests/rustdoc/redirect.rs b/tests/rustdoc/redirect.rs index 4fb81c23d39e..dc3a06b94d0c 100644 --- a/tests/rustdoc/redirect.rs +++ b/tests/rustdoc/redirect.rs @@ -1,6 +1,6 @@ -// aux-build:reexp-stripped.rs -// build-aux-docs -// ignore-cross-compile +//@ aux-build:reexp-stripped.rs +//@ build-aux-docs +//@ ignore-cross-compile extern crate reexp_stripped; diff --git a/tests/rustdoc/reexport-check.rs b/tests/rustdoc/reexport-check.rs index 5908d2150f2a..92729b82ae21 100644 --- a/tests/rustdoc/reexport-check.rs +++ b/tests/rustdoc/reexport-check.rs @@ -1,4 +1,4 @@ -// aux-build:reexport-check.rs +//@ aux-build:reexport-check.rs #![crate_name = "foo"] extern crate reexport_check; diff --git a/tests/rustdoc/reexport-dep-foreign-fn.rs b/tests/rustdoc/reexport-dep-foreign-fn.rs index e7f5720d583c..1da3d8044b9d 100644 --- a/tests/rustdoc/reexport-dep-foreign-fn.rs +++ b/tests/rustdoc/reexport-dep-foreign-fn.rs @@ -1,4 +1,4 @@ -// aux-build:all-item-types.rs +//@ aux-build:all-item-types.rs // This test is to ensure there is no problem on handling foreign functions // coming from a dependency. diff --git a/tests/rustdoc/reexport-doc.rs b/tests/rustdoc/reexport-doc.rs index df2c889b4d57..cb1a398b1c38 100644 --- a/tests/rustdoc/reexport-doc.rs +++ b/tests/rustdoc/reexport-doc.rs @@ -1,4 +1,4 @@ -// aux-build:reexport-doc-aux.rs +//@ aux-build:reexport-doc-aux.rs extern crate reexport_doc_aux as dep; diff --git a/tests/rustdoc/reexports-priv.rs b/tests/rustdoc/reexports-priv.rs index 571d7f06fdc6..1eee262d2330 100644 --- a/tests/rustdoc/reexports-priv.rs +++ b/tests/rustdoc/reexports-priv.rs @@ -1,5 +1,5 @@ -// aux-build: reexports.rs -// compile-flags: --document-private-items +//@ aux-build: reexports.rs +//@ compile-flags: --document-private-items #![crate_name = "foo"] diff --git a/tests/rustdoc/reexports.rs b/tests/rustdoc/reexports.rs index 3c51ac395afc..e1da1fd552fc 100644 --- a/tests/rustdoc/reexports.rs +++ b/tests/rustdoc/reexports.rs @@ -1,4 +1,4 @@ -// aux-build: reexports.rs +//@ aux-build: reexports.rs #![crate_name = "foo"] diff --git a/tests/rustdoc/render-enum-variant-structlike-32395.rs b/tests/rustdoc/render-enum-variant-structlike-32395.rs index 2200d8ec6377..dbe40304c17a 100644 --- a/tests/rustdoc/render-enum-variant-structlike-32395.rs +++ b/tests/rustdoc/render-enum-variant-structlike-32395.rs @@ -1,6 +1,6 @@ -// aux-build:variant-struct.rs -// build-aux-docs -// ignore-cross-compile +//@ aux-build:variant-struct.rs +//@ build-aux-docs +//@ ignore-cross-compile // https://github.com/rust-lang/rust/issues/32395 #![crate_name="issue_32395"] diff --git a/tests/rustdoc/rustc-incoherent-impls.rs b/tests/rustdoc/rustc-incoherent-impls.rs index 3fdefbecc546..4f0eca291f79 100644 --- a/tests/rustdoc/rustc-incoherent-impls.rs +++ b/tests/rustdoc/rustc-incoherent-impls.rs @@ -1,5 +1,5 @@ -// aux-build:incoherent-impl-types.rs -// build-aux-docs +//@ aux-build:incoherent-impl-types.rs +//@ build-aux-docs #![crate_name = "foo"] #![feature(rustc_attrs)] diff --git a/tests/rustdoc/rustc-macro-crate.rs b/tests/rustdoc/rustc-macro-crate.rs index dd5edc984daf..f0443364bb2c 100644 --- a/tests/rustdoc/rustc-macro-crate.rs +++ b/tests/rustdoc/rustc-macro-crate.rs @@ -1,6 +1,6 @@ -// force-host -// no-prefer-dynamic -// compile-flags: --crate-type proc-macro +//@ force-host +//@ no-prefer-dynamic +//@ compile-flags: --crate-type proc-macro #![crate_type = "proc-macro"] diff --git a/tests/rustdoc/sanitizer-option.rs b/tests/rustdoc/sanitizer-option.rs index 1abba468febf..2adf1be51fd7 100644 --- a/tests/rustdoc/sanitizer-option.rs +++ b/tests/rustdoc/sanitizer-option.rs @@ -1,6 +1,6 @@ -// needs-sanitizer-support -// needs-sanitizer-address -// compile-flags: --test -Z sanitizer=address +//@ needs-sanitizer-support +//@ needs-sanitizer-address +//@ compile-flags: --test -Z sanitizer=address // // #43031: Verify that rustdoc passes `-Z` options to rustc. Use an extern // function that is provided by the sanitizer runtime, if flag is not passed diff --git a/tests/rustdoc/sort-modules-by-appearance.rs b/tests/rustdoc/sort-modules-by-appearance.rs index b5cc8bc8304e..2d224107d226 100644 --- a/tests/rustdoc/sort-modules-by-appearance.rs +++ b/tests/rustdoc/sort-modules-by-appearance.rs @@ -1,7 +1,7 @@ // Tests the rustdoc --sort-modules-by-appearance option, that allows module declarations to appear // in the order they are declared in the source code, rather than only alphabetically. -// compile-flags: -Z unstable-options --sort-modules-by-appearance +//@ compile-flags: -Z unstable-options --sort-modules-by-appearance pub mod module_b {} diff --git a/tests/rustdoc/src-link-external-macro-26606.rs b/tests/rustdoc/src-link-external-macro-26606.rs index de717a5273bb..a5b34867869b 100644 --- a/tests/rustdoc/src-link-external-macro-26606.rs +++ b/tests/rustdoc/src-link-external-macro-26606.rs @@ -1,6 +1,6 @@ -// aux-build:issue-26606-macro.rs -// ignore-cross-compile -// build-aux-docs +//@ aux-build:issue-26606-macro.rs +//@ ignore-cross-compile +//@ build-aux-docs // https://github.com/rust-lang/rust/issues/26606 #![crate_name="issue_26606"] diff --git a/tests/rustdoc/src-links-external.rs b/tests/rustdoc/src-links-external.rs index 8012e442213b..fd48b964ab91 100644 --- a/tests/rustdoc/src-links-external.rs +++ b/tests/rustdoc/src-links-external.rs @@ -1,6 +1,6 @@ -// aux-build:src-links-external.rs -// build-aux-docs -// ignore-cross-compile +//@ aux-build:src-links-external.rs +//@ build-aux-docs +//@ ignore-cross-compile #![crate_name = "foo"] diff --git a/tests/rustdoc/src-links-implementor-43893.rs b/tests/rustdoc/src-links-implementor-43893.rs index 07e672847ca6..811957c430b4 100644 --- a/tests/rustdoc/src-links-implementor-43893.rs +++ b/tests/rustdoc/src-links-implementor-43893.rs @@ -1,4 +1,4 @@ -// ignore-cross-compile +//@ ignore-cross-compile // https://github.com/rust-lang/rust/issues/43893 diff --git a/tests/rustdoc/src-links-inlined-34274.rs b/tests/rustdoc/src-links-inlined-34274.rs index a3c9bf7e45c5..6d6999cf8664 100644 --- a/tests/rustdoc/src-links-inlined-34274.rs +++ b/tests/rustdoc/src-links-inlined-34274.rs @@ -1,6 +1,6 @@ -// aux-build:issue-34274.rs -// build-aux-docs -// ignore-cross-compile +//@ aux-build:issue-34274.rs +//@ build-aux-docs +//@ ignore-cross-compile // https://github.com/rust-lang/rust/issues/34274 #![crate_name = "foo"] diff --git a/tests/rustdoc/src-mod-path-absolute-26995.rs b/tests/rustdoc/src-mod-path-absolute-26995.rs index b67fd9b26db4..47045503bb94 100644 --- a/tests/rustdoc/src-mod-path-absolute-26995.rs +++ b/tests/rustdoc/src-mod-path-absolute-26995.rs @@ -1,5 +1,5 @@ -// ignore-windows -// compile-flags: --no-defaults +//@ ignore-windows +//@ compile-flags: --no-defaults // https://github.com/rust-lang/rust/issues/26995 #![crate_name="issue_26995"] diff --git a/tests/rustdoc/static-root-path.rs b/tests/rustdoc/static-root-path.rs index 3148ea047b78..e101d152fee7 100644 --- a/tests/rustdoc/static-root-path.rs +++ b/tests/rustdoc/static-root-path.rs @@ -1,4 +1,4 @@ -// compile-flags:-Z unstable-options --static-root-path /cache/ +//@ compile-flags:-Z unstable-options --static-root-path /cache/ // @has static_root_path/struct.SomeStruct.html // @matchesraw - '"/cache/main-' diff --git a/tests/rustdoc/static.rs b/tests/rustdoc/static.rs index 90dafd8b3480..d127f0c58297 100644 --- a/tests/rustdoc/static.rs +++ b/tests/rustdoc/static.rs @@ -1,4 +1,4 @@ -// compile-flags: --document-private-items +//@ compile-flags: --document-private-items #![crate_type = "lib"] diff --git a/tests/rustdoc/strip-priv-imports-pass-27104.rs b/tests/rustdoc/strip-priv-imports-pass-27104.rs index e400a8f50118..b7198e82a032 100644 --- a/tests/rustdoc/strip-priv-imports-pass-27104.rs +++ b/tests/rustdoc/strip-priv-imports-pass-27104.rs @@ -1,6 +1,6 @@ -// compile-flags:--no-defaults --passes strip-priv-imports -// aux-build:empty.rs -// ignore-cross-compile +//@ compile-flags:--no-defaults --passes strip-priv-imports +//@ aux-build:empty.rs +//@ ignore-cross-compile // https://github.com/rust-lang/rust/issues/27104 #![crate_name="issue_27104"] diff --git a/tests/rustdoc/synthetic_auto/no-redundancy.rs b/tests/rustdoc/synthetic_auto/no-redundancy.rs index fed9c9c7ba47..d30b38dd4dc1 100644 --- a/tests/rustdoc/synthetic_auto/no-redundancy.rs +++ b/tests/rustdoc/synthetic_auto/no-redundancy.rs @@ -1,5 +1,5 @@ // FIXME(fmease, #119216): Reenable this test! -// ignore-test +//@ ignore-test pub struct Inner { field: T, diff --git a/tests/rustdoc/test_option_check/bar.rs b/tests/rustdoc/test_option_check/bar.rs index 50a182cf7e04..7c2309a79d4b 100644 --- a/tests/rustdoc/test_option_check/bar.rs +++ b/tests/rustdoc/test_option_check/bar.rs @@ -1,5 +1,5 @@ -// compile-flags: --test -// check-test-line-numbers-match +//@ compile-flags: --test +//@ check-test-line-numbers-match /// This looks like another awesome test! /// diff --git a/tests/rustdoc/test_option_check/test.rs b/tests/rustdoc/test_option_check/test.rs index 964e8e37ed58..af7a5827690f 100644 --- a/tests/rustdoc/test_option_check/test.rs +++ b/tests/rustdoc/test_option_check/test.rs @@ -1,5 +1,5 @@ -// compile-flags: --test -// check-test-line-numbers-match +//@ compile-flags: --test +//@ check-test-line-numbers-match pub mod bar; diff --git a/tests/rustdoc/trait-alias-mention.rs b/tests/rustdoc/trait-alias-mention.rs index 6da0dc68785c..102bdca7d35a 100644 --- a/tests/rustdoc/trait-alias-mention.rs +++ b/tests/rustdoc/trait-alias-mention.rs @@ -1,5 +1,5 @@ -// aux-build:trait-alias-mention.rs -// build-aux-docs +//@ aux-build:trait-alias-mention.rs +//@ build-aux-docs #![crate_name = "foo"] diff --git a/tests/rustdoc/trait-visibility.rs b/tests/rustdoc/trait-visibility.rs index 8ba3ee03a74f..af9750ac8d0f 100644 --- a/tests/rustdoc/trait-visibility.rs +++ b/tests/rustdoc/trait-visibility.rs @@ -1,4 +1,4 @@ -// aux-build:trait-visibility.rs +//@ aux-build:trait-visibility.rs #![crate_name = "foo"] diff --git a/tests/rustdoc/traits-in-bodies-private.rs b/tests/rustdoc/traits-in-bodies-private.rs index 96b7c4f9dc07..5a21b8b26256 100644 --- a/tests/rustdoc/traits-in-bodies-private.rs +++ b/tests/rustdoc/traits-in-bodies-private.rs @@ -1,7 +1,7 @@ // when implementing the fix for traits-in-bodies, there was an ICE when documenting private items // and a trait was defined in non-module scope -// compile-flags:--document-private-items +//@ compile-flags:--document-private-items // @has traits_in_bodies_private/struct.SomeStruct.html // @!has - '//code' 'impl HiddenTrait for SomeStruct' diff --git a/tests/rustdoc/type-alias/cross-crate-115718.rs b/tests/rustdoc/type-alias/cross-crate-115718.rs index 372e62e42133..3d94be5ddbdd 100644 --- a/tests/rustdoc/type-alias/cross-crate-115718.rs +++ b/tests/rustdoc/type-alias/cross-crate-115718.rs @@ -1,4 +1,4 @@ -// aux-build: parent-crate-115718.rs +//@ aux-build: parent-crate-115718.rs // https://github.com/rust-lang/rust/issues/115718 #![crate_name = "foo"] diff --git a/tests/rustdoc/type-layout.rs b/tests/rustdoc/type-layout.rs index bd88e73af5cb..05f8e4dc9e9e 100644 --- a/tests/rustdoc/type-layout.rs +++ b/tests/rustdoc/type-layout.rs @@ -1,4 +1,4 @@ -// compile-flags: --show-type-layout -Z unstable-options +//@ compile-flags: --show-type-layout -Z unstable-options // @hasraw type_layout/struct.Foo.html 'Size: ' // @hasraw - ' bytes' diff --git a/tests/rustdoc/typedef-inner-variants.rs b/tests/rustdoc/typedef-inner-variants.rs index 4d0ff85551ce..d87a1cb6facb 100644 --- a/tests/rustdoc/typedef-inner-variants.rs +++ b/tests/rustdoc/typedef-inner-variants.rs @@ -3,7 +3,7 @@ #![crate_name = "inner_variants"] -// aux-build:cross_crate_generic_typedef.rs +//@ aux-build:cross_crate_generic_typedef.rs extern crate cross_crate_generic_typedef; pub struct Adt; diff --git a/tests/rustdoc/unit-return.rs b/tests/rustdoc/unit-return.rs index 6ddfa0c4d5ca..47a3e6d490be 100644 --- a/tests/rustdoc/unit-return.rs +++ b/tests/rustdoc/unit-return.rs @@ -1,4 +1,4 @@ -// aux-build:unit-return.rs +//@ aux-build:unit-return.rs #![crate_name = "foo"] diff --git a/tests/rustdoc/use-attr.rs b/tests/rustdoc/use-attr.rs index 996b7bba6218..68e44bdfdc40 100644 --- a/tests/rustdoc/use-attr.rs +++ b/tests/rustdoc/use-attr.rs @@ -1,4 +1,4 @@ -// edition:2018 +//@ edition:2018 // ICE when rustdoc encountered a use statement of a non-macro attribute (see #58054) diff --git a/tests/rustdoc/visibility.rs b/tests/rustdoc/visibility.rs index 4f9b06fd7a20..87ac9a9b74d1 100644 --- a/tests/rustdoc/visibility.rs +++ b/tests/rustdoc/visibility.rs @@ -1,4 +1,4 @@ -// compile-flags: --document-private-items +//@ compile-flags: --document-private-items #![crate_name = "foo"] #![feature(inherent_associated_types)] diff --git a/tests/ui-fulldeps/auxiliary/syntax-extension-with-dll-deps-1.rs b/tests/ui-fulldeps/auxiliary/syntax-extension-with-dll-deps-1.rs index 8b00fb81cd25..0fa1da4a70a5 100644 --- a/tests/ui-fulldeps/auxiliary/syntax-extension-with-dll-deps-1.rs +++ b/tests/ui-fulldeps/auxiliary/syntax-extension-with-dll-deps-1.rs @@ -1,4 +1,4 @@ -// force-host +//@ force-host #![crate_type = "dylib"] diff --git a/tests/ui-fulldeps/compiler-calls.rs b/tests/ui-fulldeps/compiler-calls.rs index b6d3b7b040d1..f6c10add2906 100644 --- a/tests/ui-fulldeps/compiler-calls.rs +++ b/tests/ui-fulldeps/compiler-calls.rs @@ -1,8 +1,8 @@ -// run-pass +//@ run-pass // Test that the Callbacks interface to the compiler works. -// ignore-cross-compile -// ignore-remote +//@ ignore-cross-compile +//@ ignore-remote #![feature(rustc_private)] diff --git a/tests/ui-fulldeps/deriving-global.rs b/tests/ui-fulldeps/deriving-global.rs index 9c0fc13a5e2f..7783010be441 100644 --- a/tests/ui-fulldeps/deriving-global.rs +++ b/tests/ui-fulldeps/deriving-global.rs @@ -1,4 +1,4 @@ -// run-pass +//@ run-pass #![feature(rustc_private)] diff --git a/tests/ui-fulldeps/deriving-hygiene.rs b/tests/ui-fulldeps/deriving-hygiene.rs index 48d3355b9d54..a3a6f9e022eb 100644 --- a/tests/ui-fulldeps/deriving-hygiene.rs +++ b/tests/ui-fulldeps/deriving-hygiene.rs @@ -1,4 +1,4 @@ -// run-pass +//@ run-pass #![allow(non_upper_case_globals)] #![feature(rustc_private)] diff --git a/tests/ui-fulldeps/dropck_tarena_sound_drop.rs b/tests/ui-fulldeps/dropck_tarena_sound_drop.rs index ffad80171da7..5f5d60926efd 100644 --- a/tests/ui-fulldeps/dropck_tarena_sound_drop.rs +++ b/tests/ui-fulldeps/dropck_tarena_sound_drop.rs @@ -1,4 +1,4 @@ -// run-pass +//@ run-pass #![allow(unknown_lints)] // Check that an arena (TypedArena) can carry elements whose drop diff --git a/tests/ui-fulldeps/empty-struct-braces-derive.rs b/tests/ui-fulldeps/empty-struct-braces-derive.rs index 3637610af0d9..2a1e7ee0955a 100644 --- a/tests/ui-fulldeps/empty-struct-braces-derive.rs +++ b/tests/ui-fulldeps/empty-struct-braces-derive.rs @@ -1,4 +1,4 @@ -// run-pass +//@ run-pass // `#[derive(Trait)]` works for empty structs/variants with braces or parens. #![feature(rustc_private)] diff --git a/tests/ui-fulldeps/fluent-messages/test.rs b/tests/ui-fulldeps/fluent-messages/test.rs index 89ac48f36db5..2316a5334696 100644 --- a/tests/ui-fulldeps/fluent-messages/test.rs +++ b/tests/ui-fulldeps/fluent-messages/test.rs @@ -1,4 +1,4 @@ -// normalize-stderr-test "could not open Fluent resource:.*" -> "could not open Fluent resource: os-specific message" +//@ normalize-stderr-test "could not open Fluent resource:.*" -> "could not open Fluent resource: os-specific message" #![feature(rustc_private)] #![crate_type = "lib"] diff --git a/tests/ui-fulldeps/hash-stable-is-unstable.rs b/tests/ui-fulldeps/hash-stable-is-unstable.rs index ab18f2c6415e..3f280ec0a60f 100644 --- a/tests/ui-fulldeps/hash-stable-is-unstable.rs +++ b/tests/ui-fulldeps/hash-stable-is-unstable.rs @@ -1,5 +1,5 @@ -// ignore-stage1 -// compile-flags: -Zdeduplicate-diagnostics=yes +//@ ignore-stage1 +//@ compile-flags: -Zdeduplicate-diagnostics=yes extern crate rustc_data_structures; //~^ use of unstable library feature 'rustc_private' //~| NOTE: issue #27812 for more information diff --git a/tests/ui-fulldeps/internal-lints/bad_opt_access.rs b/tests/ui-fulldeps/internal-lints/bad_opt_access.rs index d6bd6945e150..708c3651b87b 100644 --- a/tests/ui-fulldeps/internal-lints/bad_opt_access.rs +++ b/tests/ui-fulldeps/internal-lints/bad_opt_access.rs @@ -1,4 +1,4 @@ -// compile-flags: -Z unstable-options +//@ compile-flags: -Z unstable-options // Test that accessing command line options by field access triggers a lint for those fields // that have wrapper functions which should be used. diff --git a/tests/ui-fulldeps/internal-lints/default_hash_types.rs b/tests/ui-fulldeps/internal-lints/default_hash_types.rs index 795c7d2dcb73..bfafa8c5f27f 100644 --- a/tests/ui-fulldeps/internal-lints/default_hash_types.rs +++ b/tests/ui-fulldeps/internal-lints/default_hash_types.rs @@ -1,4 +1,4 @@ -// compile-flags: -Z unstable-options +//@ compile-flags: -Z unstable-options #![feature(rustc_private)] #![deny(rustc::default_hash_types)] diff --git a/tests/ui-fulldeps/internal-lints/diagnostics.rs b/tests/ui-fulldeps/internal-lints/diagnostics.rs index dcf948d2a88f..42270d2bbdea 100644 --- a/tests/ui-fulldeps/internal-lints/diagnostics.rs +++ b/tests/ui-fulldeps/internal-lints/diagnostics.rs @@ -1,4 +1,4 @@ -// compile-flags: -Z unstable-options +//@ compile-flags: -Z unstable-options #![crate_type = "lib"] #![feature(rustc_attrs)] diff --git a/tests/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.rs b/tests/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.rs index fa6734b6c6c3..c3df917ed12d 100644 --- a/tests/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.rs +++ b/tests/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.rs @@ -1,4 +1,4 @@ -// compile-flags: -Z unstable-options +//@ compile-flags: -Z unstable-options #![feature(rustc_private)] #![deny(rustc::lint_pass_impl_without_macro)] diff --git a/tests/ui-fulldeps/internal-lints/qualified_ty_ty_ctxt.rs b/tests/ui-fulldeps/internal-lints/qualified_ty_ty_ctxt.rs index 32b987338c05..c44870158f89 100644 --- a/tests/ui-fulldeps/internal-lints/qualified_ty_ty_ctxt.rs +++ b/tests/ui-fulldeps/internal-lints/qualified_ty_ty_ctxt.rs @@ -1,4 +1,4 @@ -// compile-flags: -Z unstable-options +//@ compile-flags: -Z unstable-options #![feature(rustc_private)] #![deny(rustc::usage_of_qualified_ty)] diff --git a/tests/ui-fulldeps/internal-lints/query_stability.rs b/tests/ui-fulldeps/internal-lints/query_stability.rs index 627ffa5cbd0f..7b897fabd2d8 100644 --- a/tests/ui-fulldeps/internal-lints/query_stability.rs +++ b/tests/ui-fulldeps/internal-lints/query_stability.rs @@ -1,4 +1,4 @@ -// compile-flags: -Z unstable-options +//@ compile-flags: -Z unstable-options #![feature(rustc_private)] #![deny(rustc::potential_query_instability)] diff --git a/tests/ui-fulldeps/internal-lints/rustc_pass_by_value.rs b/tests/ui-fulldeps/internal-lints/rustc_pass_by_value.rs index 10bab2d889a6..06d2232be517 100644 --- a/tests/ui-fulldeps/internal-lints/rustc_pass_by_value.rs +++ b/tests/ui-fulldeps/internal-lints/rustc_pass_by_value.rs @@ -1,4 +1,4 @@ -// compile-flags: -Z unstable-options +//@ compile-flags: -Z unstable-options #![feature(rustc_attrs)] #![feature(rustc_private)] diff --git a/tests/ui-fulldeps/internal-lints/span_use_eq_ctxt.rs b/tests/ui-fulldeps/internal-lints/span_use_eq_ctxt.rs index 39980ee7c672..369c2dd9c487 100644 --- a/tests/ui-fulldeps/internal-lints/span_use_eq_ctxt.rs +++ b/tests/ui-fulldeps/internal-lints/span_use_eq_ctxt.rs @@ -1,5 +1,5 @@ // Test the `rustc::span_use_eq_ctxt` internal lint -// compile-flags: -Z unstable-options +//@ compile-flags: -Z unstable-options #![feature(rustc_private)] #![deny(rustc::span_use_eq_ctxt)] diff --git a/tests/ui-fulldeps/internal-lints/ty_tykind_usage.rs b/tests/ui-fulldeps/internal-lints/ty_tykind_usage.rs index cce223c77bba..3152bf23ca56 100644 --- a/tests/ui-fulldeps/internal-lints/ty_tykind_usage.rs +++ b/tests/ui-fulldeps/internal-lints/ty_tykind_usage.rs @@ -1,4 +1,4 @@ -// compile-flags: -Z unstable-options +//@ compile-flags: -Z unstable-options #![feature(rustc_private)] diff --git a/tests/ui-fulldeps/lint-pass-macros.rs b/tests/ui-fulldeps/lint-pass-macros.rs index 4c61783418fb..093097fe513d 100644 --- a/tests/ui-fulldeps/lint-pass-macros.rs +++ b/tests/ui-fulldeps/lint-pass-macros.rs @@ -1,5 +1,5 @@ -// compile-flags: -Z unstable-options -// check-pass +//@ compile-flags: -Z unstable-options +//@ check-pass #![feature(rustc_private)] diff --git a/tests/ui-fulldeps/missing-rustc-driver-error.rs b/tests/ui-fulldeps/missing-rustc-driver-error.rs index b627a207c985..adc3e701cc0e 100644 --- a/tests/ui-fulldeps/missing-rustc-driver-error.rs +++ b/tests/ui-fulldeps/missing-rustc-driver-error.rs @@ -1,8 +1,8 @@ // Test that we get the following hint when trying to use a compiler crate without rustc_driver. -// error-pattern: try adding `extern crate rustc_driver;` at the top level of this crate -// compile-flags: --emit link -// normalize-stderr-test ".*crate .* required.*\n\n" -> "" -// normalize-stderr-test: "aborting due to [0-9]+" -> "aborting due to NUMBER" +//@ error-pattern: try adding `extern crate rustc_driver;` at the top level of this crate +//@ compile-flags: --emit link +//@ normalize-stderr-test ".*crate .* required.*\n\n" -> "" +//@ normalize-stderr-test: "aborting due to [0-9]+" -> "aborting due to NUMBER" #![feature(rustc_private)] diff --git a/tests/ui-fulldeps/mod_dir_path_canonicalized.rs b/tests/ui-fulldeps/mod_dir_path_canonicalized.rs index ddc86c1dc312..8ffc4669ee27 100644 --- a/tests/ui-fulldeps/mod_dir_path_canonicalized.rs +++ b/tests/ui-fulldeps/mod_dir_path_canonicalized.rs @@ -1,7 +1,7 @@ -// run-pass +//@ run-pass // Testing that a librustc_ast can parse modules with canonicalized base path -// ignore-cross-compile -// ignore-remote +//@ ignore-cross-compile +//@ ignore-remote // no-remap-src-base: Reading `file!()` (expectedly) fails when enabled. #![feature(rustc_private)] diff --git a/tests/ui-fulldeps/mod_dir_simple/test.rs b/tests/ui-fulldeps/mod_dir_simple/test.rs index 35e26093a2d6..1e9b18150204 100644 --- a/tests/ui-fulldeps/mod_dir_simple/test.rs +++ b/tests/ui-fulldeps/mod_dir_simple/test.rs @@ -1,3 +1,3 @@ -// run-pass +//@ run-pass pub fn foo() -> isize { 10 } diff --git a/tests/ui-fulldeps/pathless-extern-unstable.rs b/tests/ui-fulldeps/pathless-extern-unstable.rs index 719ca3c5a65b..8ef8761d5a28 100644 --- a/tests/ui-fulldeps/pathless-extern-unstable.rs +++ b/tests/ui-fulldeps/pathless-extern-unstable.rs @@ -1,6 +1,6 @@ -// edition:2018 -// ignore-stage1 -// compile-flags:--extern rustc_middle +//@ edition:2018 +//@ ignore-stage1 +//@ compile-flags:--extern rustc_middle // Test that `--extern rustc_middle` fails with `rustc_private`. diff --git a/tests/ui-fulldeps/pprust-expr-roundtrip.rs b/tests/ui-fulldeps/pprust-expr-roundtrip.rs index 24c4543c20cc..e1c326c6a915 100644 --- a/tests/ui-fulldeps/pprust-expr-roundtrip.rs +++ b/tests/ui-fulldeps/pprust-expr-roundtrip.rs @@ -1,5 +1,5 @@ -// run-pass -// ignore-cross-compile +//@ run-pass +//@ ignore-cross-compile // The general idea of this test is to enumerate all "interesting" expressions and check that // `parse(print(e)) == e` for all `e`. Here's what's interesting, for the purposes of this test: diff --git a/tests/ui-fulldeps/regions-mock-tcx.rs b/tests/ui-fulldeps/regions-mock-tcx.rs index 63975ef62c59..970f08377a69 100644 --- a/tests/ui-fulldeps/regions-mock-tcx.rs +++ b/tests/ui-fulldeps/regions-mock-tcx.rs @@ -1,4 +1,4 @@ -// run-pass +//@ run-pass #![allow(dead_code)] #![allow(unused_imports)] diff --git a/tests/ui-fulldeps/rustc_encodable_hygiene.rs b/tests/ui-fulldeps/rustc_encodable_hygiene.rs index 36c684a131e6..4486cb9dc608 100644 --- a/tests/ui-fulldeps/rustc_encodable_hygiene.rs +++ b/tests/ui-fulldeps/rustc_encodable_hygiene.rs @@ -1,4 +1,4 @@ -// check-pass +//@ check-pass #![feature(rustc_private)] diff --git a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.rs b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.rs index 221f26f8edc4..90bea03ffd5e 100644 --- a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.rs +++ b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.rs @@ -1,14 +1,14 @@ -// check-fail +//@ check-fail // Tests that a doc comment will not preclude a field from being considered a diagnostic argument -// normalize-stderr-test "the following other types implement trait `IntoDiagnosticArg`:(?:.*\n){0,9}\s+and \d+ others" -> "normalized in stderr" -// normalize-stderr-test "(COMPILER_DIR/.*\.rs):[0-9]+:[0-9]+" -> "$1:LL:CC" +//@ normalize-stderr-test "the following other types implement trait `IntoDiagnosticArg`:(?:.*\n){0,9}\s+and \d+ others" -> "normalized in stderr" +//@ normalize-stderr-test "(COMPILER_DIR/.*\.rs):[0-9]+:[0-9]+" -> "$1:LL:CC" // The proc_macro2 crate handles spans differently when on beta/stable release rather than nightly, // changing the output of this test. Since Subdiagnostic is strictly internal to the compiler // the test is just ignored on stable and beta: -// ignore-stage1 -// ignore-beta -// ignore-stable +//@ ignore-stage1 +//@ ignore-beta +//@ ignore-stable #![feature(rustc_private)] #![crate_type = "lib"] diff --git a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs index 856f32fafa02..f2f42f054817 100644 --- a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs +++ b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs @@ -1,14 +1,14 @@ -// check-fail +//@ check-fail // Tests error conditions for specifying diagnostics using #[derive(Diagnostic)] -// normalize-stderr-test "the following other types implement trait `IntoDiagnosticArg`:(?:.*\n){0,9}\s+and \d+ others" -> "normalized in stderr" -// normalize-stderr-test "(COMPILER_DIR/.*\.rs):[0-9]+:[0-9]+" -> "$1:LL:CC" +//@ normalize-stderr-test "the following other types implement trait `IntoDiagnosticArg`:(?:.*\n){0,9}\s+and \d+ others" -> "normalized in stderr" +//@ normalize-stderr-test "(COMPILER_DIR/.*\.rs):[0-9]+:[0-9]+" -> "$1:LL:CC" // The proc_macro2 crate handles spans differently when on beta/stable release rather than nightly, // changing the output of this test. Since Diagnostic is strictly internal to the compiler // the test is just ignored on stable and beta: -// ignore-stage1 -// ignore-beta -// ignore-stable +//@ ignore-stage1 +//@ ignore-beta +//@ ignore-stable #![feature(rustc_private)] #![crate_type = "lib"] diff --git a/tests/ui-fulldeps/session-diagnostic/enforce_slug_naming.rs b/tests/ui-fulldeps/session-diagnostic/enforce_slug_naming.rs index 3056ebb7575f..6402b00ef0a9 100644 --- a/tests/ui-fulldeps/session-diagnostic/enforce_slug_naming.rs +++ b/tests/ui-fulldeps/session-diagnostic/enforce_slug_naming.rs @@ -1,4 +1,4 @@ -// rustc-env:CARGO_CRATE_NAME=rustc_dummy +//@ rustc-env:CARGO_CRATE_NAME=rustc_dummy #![feature(rustc_private)] #![crate_type = "lib"] diff --git a/tests/ui-fulldeps/session-diagnostic/invalid-variable.rs b/tests/ui-fulldeps/session-diagnostic/invalid-variable.rs index 2ec07fa14203..ba529e42e786 100644 --- a/tests/ui-fulldeps/session-diagnostic/invalid-variable.rs +++ b/tests/ui-fulldeps/session-diagnostic/invalid-variable.rs @@ -1,5 +1,5 @@ -// run-fail -// compile-flags: --test +//@ run-fail +//@ compile-flags: --test // test that messages referencing non-existent fields cause test failures #![feature(rustc_private)] diff --git a/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs b/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs index 74cf91db7a7c..15e3b212d904 100644 --- a/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs +++ b/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs @@ -1,12 +1,12 @@ -// check-fail +//@ check-fail // Tests error conditions for specifying subdiagnostics using #[derive(Subdiagnostic)] // The proc_macro2 crate handles spans differently when on beta/stable release rather than nightly, // changing the output of this test. Since Subdiagnostic is strictly internal to the compiler // the test is just ignored on stable and beta: -// ignore-stage1 -// ignore-beta -// ignore-stable +//@ ignore-stage1 +//@ ignore-beta +//@ ignore-stable #![feature(rustc_private)] #![crate_type = "lib"] diff --git a/tests/ui-fulldeps/stable-mir/check_abi.rs b/tests/ui-fulldeps/stable-mir/check_abi.rs index 7d7469597afc..c345987955ef 100644 --- a/tests/ui-fulldeps/stable-mir/check_abi.rs +++ b/tests/ui-fulldeps/stable-mir/check_abi.rs @@ -1,10 +1,10 @@ -// run-pass +//@ run-pass //! Test information regarding type layout. -// ignore-stage1 -// ignore-cross-compile -// ignore-remote -// ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837 +//@ 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)] diff --git a/tests/ui-fulldeps/stable-mir/check_allocation.rs b/tests/ui-fulldeps/stable-mir/check_allocation.rs index fb5e13eb13b1..7752ff51ac81 100644 --- a/tests/ui-fulldeps/stable-mir/check_allocation.rs +++ b/tests/ui-fulldeps/stable-mir/check_allocation.rs @@ -1,12 +1,12 @@ -// run-pass +//@ run-pass //! Test that users are able to use stable mir APIs to retrieve information of global allocations //! such as `vtable_allocation`. -// ignore-stage1 -// ignore-cross-compile -// ignore-remote -// ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837 -// edition: 2021 +//@ ignore-stage1 +//@ ignore-cross-compile +//@ ignore-remote +//@ ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837 +//@ edition: 2021 #![feature(rustc_private)] #![feature(assert_matches)] diff --git a/tests/ui-fulldeps/stable-mir/check_defs.rs b/tests/ui-fulldeps/stable-mir/check_defs.rs index 4a124adb2b60..27b9b059c209 100644 --- a/tests/ui-fulldeps/stable-mir/check_defs.rs +++ b/tests/ui-fulldeps/stable-mir/check_defs.rs @@ -1,11 +1,11 @@ -// run-pass +//@ run-pass //! Test that users are able to use stable mir APIs to retrieve information about crate definitions. -// ignore-stage1 -// ignore-cross-compile -// ignore-remote -// ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837 -// edition: 2021 +//@ ignore-stage1 +//@ ignore-cross-compile +//@ ignore-remote +//@ ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837 +//@ edition: 2021 #![feature(rustc_private)] #![feature(assert_matches)] diff --git a/tests/ui-fulldeps/stable-mir/check_foreign.rs b/tests/ui-fulldeps/stable-mir/check_foreign.rs index e6c59354d5e2..06d2af4ac8a3 100644 --- a/tests/ui-fulldeps/stable-mir/check_foreign.rs +++ b/tests/ui-fulldeps/stable-mir/check_foreign.rs @@ -1,11 +1,11 @@ -// run-pass +//@ run-pass //! Test retrieval and kinds of foreign items. -// ignore-stage1 -// ignore-cross-compile -// ignore-remote -// ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837 -// edition: 2021 +//@ ignore-stage1 +//@ ignore-cross-compile +//@ ignore-remote +//@ ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837 +//@ edition: 2021 #![feature(rustc_private)] #![feature(assert_matches)] diff --git a/tests/ui-fulldeps/stable-mir/check_instance.rs b/tests/ui-fulldeps/stable-mir/check_instance.rs index 1e039e5ae514..218c7b3e3863 100644 --- a/tests/ui-fulldeps/stable-mir/check_instance.rs +++ b/tests/ui-fulldeps/stable-mir/check_instance.rs @@ -1,11 +1,11 @@ -// run-pass +//@ run-pass //! Test that users are able to use stable mir APIs to retrieve monomorphized instances -// ignore-stage1 -// ignore-cross-compile -// ignore-remote -// ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837 -// edition: 2021 +//@ ignore-stage1 +//@ ignore-cross-compile +//@ ignore-remote +//@ ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837 +//@ edition: 2021 #![feature(rustc_private)] #![feature(assert_matches)] diff --git a/tests/ui-fulldeps/stable-mir/check_item_kind.rs b/tests/ui-fulldeps/stable-mir/check_item_kind.rs index 0a7f00029f2a..1d5b19304c1f 100644 --- a/tests/ui-fulldeps/stable-mir/check_item_kind.rs +++ b/tests/ui-fulldeps/stable-mir/check_item_kind.rs @@ -1,11 +1,11 @@ -// run-pass +//@ run-pass //! Test that item kind works as expected. -// ignore-stage1 -// ignore-cross-compile -// ignore-remote -// ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837 -// edition: 2021 +//@ ignore-stage1 +//@ ignore-cross-compile +//@ ignore-remote +//@ ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837 +//@ edition: 2021 #![feature(rustc_private)] #![feature(assert_matches)] diff --git a/tests/ui-fulldeps/stable-mir/check_trait_queries.rs b/tests/ui-fulldeps/stable-mir/check_trait_queries.rs index c9fbe15ffb03..5098547c2c8d 100644 --- a/tests/ui-fulldeps/stable-mir/check_trait_queries.rs +++ b/tests/ui-fulldeps/stable-mir/check_trait_queries.rs @@ -1,11 +1,11 @@ -// run-pass +//@ run-pass //! Test that users are able to retrieve information about trait declarations and implementations. -// ignore-stage1 -// ignore-cross-compile -// ignore-remote -// ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837 -// edition: 2021 +//@ ignore-stage1 +//@ ignore-cross-compile +//@ ignore-remote +//@ ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837 +//@ edition: 2021 #![feature(rustc_private)] #![feature(assert_matches)] diff --git a/tests/ui-fulldeps/stable-mir/check_ty_fold.rs b/tests/ui-fulldeps/stable-mir/check_ty_fold.rs index 14cbf9e9f81f..0b8cfcf27fd9 100644 --- a/tests/ui-fulldeps/stable-mir/check_ty_fold.rs +++ b/tests/ui-fulldeps/stable-mir/check_ty_fold.rs @@ -1,12 +1,12 @@ -// run-pass +//@ run-pass //! Test that users are able to use stable mir APIs to retrieve monomorphized types, and that //! we have an error handling for trying to instantiate types with incorrect arguments. -// ignore-stage1 -// ignore-cross-compile -// ignore-remote -// ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837 -// edition: 2021 +//@ ignore-stage1 +//@ ignore-cross-compile +//@ ignore-remote +//@ ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837 +//@ edition: 2021 #![feature(rustc_private)] #![feature(assert_matches)] diff --git a/tests/ui-fulldeps/stable-mir/compilation-result.rs b/tests/ui-fulldeps/stable-mir/compilation-result.rs index cd61d599eb43..286bbd7c5947 100644 --- a/tests/ui-fulldeps/stable-mir/compilation-result.rs +++ b/tests/ui-fulldeps/stable-mir/compilation-result.rs @@ -1,11 +1,11 @@ -// run-pass +//@ run-pass // Test StableMIR behavior when different results are given -// ignore-stage1 -// ignore-cross-compile -// ignore-remote -// ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837 -// edition: 2021 +//@ ignore-stage1 +//@ ignore-cross-compile +//@ ignore-remote +//@ ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837 +//@ edition: 2021 #![feature(rustc_private)] #![feature(assert_matches)] diff --git a/tests/ui-fulldeps/stable-mir/crate-info.rs b/tests/ui-fulldeps/stable-mir/crate-info.rs index 8258883436f2..4c9a8a665b84 100644 --- a/tests/ui-fulldeps/stable-mir/crate-info.rs +++ b/tests/ui-fulldeps/stable-mir/crate-info.rs @@ -1,11 +1,11 @@ -// run-pass +//@ run-pass // Test that users are able to use stable mir APIs to retrieve information of the current crate -// ignore-stage1 -// ignore-cross-compile -// ignore-remote -// ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837 -// edition: 2021 +//@ ignore-stage1 +//@ ignore-cross-compile +//@ ignore-remote +//@ ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837 +//@ edition: 2021 #![feature(rustc_private)] #![feature(assert_matches)] diff --git a/tests/ui-fulldeps/stable-mir/projections.rs b/tests/ui-fulldeps/stable-mir/projections.rs index 40f2d901a2b2..d68e7d37950f 100644 --- a/tests/ui-fulldeps/stable-mir/projections.rs +++ b/tests/ui-fulldeps/stable-mir/projections.rs @@ -1,11 +1,11 @@ -// run-pass +//@ run-pass // Tests the Stable MIR projections API -// ignore-stage1 -// ignore-cross-compile -// ignore-remote -// ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837 -// edition: 2021 +//@ ignore-stage1 +//@ ignore-cross-compile +//@ ignore-remote +//@ ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837 +//@ edition: 2021 #![feature(rustc_private)] #![feature(assert_matches)] diff --git a/tests/ui-fulldeps/stable-mir/smir_internal.rs b/tests/ui-fulldeps/stable-mir/smir_internal.rs index e23b0f6820a7..07f404fd471c 100644 --- a/tests/ui-fulldeps/stable-mir/smir_internal.rs +++ b/tests/ui-fulldeps/stable-mir/smir_internal.rs @@ -1,12 +1,12 @@ -// run-pass +//@ run-pass //! Test that users are able to use retrieve internal constructs from stable ones to help with //! the migration. -// ignore-stage1 -// ignore-cross-compile -// ignore-remote -// ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837 -// edition: 2021 +//@ ignore-stage1 +//@ ignore-cross-compile +//@ ignore-remote +//@ ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837 +//@ edition: 2021 #![feature(rustc_private)] #![feature(assert_matches)] diff --git a/tests/ui-fulldeps/stable-mir/smir_visitor.rs b/tests/ui-fulldeps/stable-mir/smir_visitor.rs index d7739770b706..ac428c80e0f1 100644 --- a/tests/ui-fulldeps/stable-mir/smir_visitor.rs +++ b/tests/ui-fulldeps/stable-mir/smir_visitor.rs @@ -1,11 +1,11 @@ -// run-pass +//@ run-pass //! Sanity check Stable MIR Visitor -// ignore-stage1 -// ignore-cross-compile -// ignore-remote -// ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837 -// edition: 2021 +//@ ignore-stage1 +//@ ignore-cross-compile +//@ ignore-remote +//@ ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837 +//@ edition: 2021 #![feature(rustc_private)] #![feature(assert_matches)] diff --git a/tests/ui/associated-item/associated-item-enum.stderr b/tests/ui/associated-item/associated-item-enum.stderr index ebf3c5499a68..3b00588f1d1a 100644 --- a/tests/ui/associated-item/associated-item-enum.stderr +++ b/tests/ui/associated-item/associated-item-enum.stderr @@ -5,10 +5,12 @@ LL | enum Enum { Variant } | --------- variant or associated item `mispellable` not found for this enum ... LL | Enum::mispellable(); - | ^^^^^^^^^^^ - | | - | variant or associated item not found in `Enum` - | help: there is an associated function with a similar name: `misspellable` + | ^^^^^^^^^^^ variant or associated item not found in `Enum` + | +help: there is an associated function `misspellable` with a similar name + | +LL | Enum::misspellable(); + | ~~~~~~~~~~~~ error[E0599]: no variant or associated item named `mispellable_trait` found for enum `Enum` in the current scope --> $DIR/associated-item-enum.rs:18:11 @@ -17,10 +19,12 @@ LL | enum Enum { Variant } | --------- variant or associated item `mispellable_trait` not found for this enum ... LL | Enum::mispellable_trait(); - | ^^^^^^^^^^^^^^^^^ - | | - | variant or associated item not found in `Enum` - | help: there is an associated function with a similar name: `misspellable` + | ^^^^^^^^^^^^^^^^^ variant or associated item not found in `Enum` + | +help: there is an associated function `misspellable_trait` with a similar name + | +LL | Enum::misspellable_trait(); + | ~~~~~~~~~~~~~~~~~~ error[E0599]: no variant or associated item named `MISPELLABLE` found for enum `Enum` in the current scope --> $DIR/associated-item-enum.rs:19:11 @@ -29,10 +33,12 @@ LL | enum Enum { Variant } | --------- variant or associated item `MISPELLABLE` not found for this enum ... LL | Enum::MISPELLABLE; - | ^^^^^^^^^^^ - | | - | variant or associated item not found in `Enum` - | help: there is an associated constant with a similar name: `MISSPELLABLE` + | ^^^^^^^^^^^ variant or associated item not found in `Enum` + | +help: there is an associated constant `MISSPELLABLE` with a similar name + | +LL | Enum::MISSPELLABLE; + | ~~~~~~~~~~~~ error: aborting due to 3 previous errors diff --git a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr index b7336485eb84..3d82f572a1a6 100644 --- a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr +++ b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr @@ -30,7 +30,7 @@ LL | match fut.as_mut().poll(ctx) { = note: the method is available for `Pin<&mut impl Future>` here | = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `Future` which provides `poll` is implemented but not in scope; perhaps you want to import it | LL + use std::future::Future; | diff --git a/tests/ui/atomic-from-mut-not-available.stderr b/tests/ui/atomic-from-mut-not-available.stderr index a3edf1893560..a4514524f48f 100644 --- a/tests/ui/atomic-from-mut-not-available.stderr +++ b/tests/ui/atomic-from-mut-not-available.stderr @@ -7,6 +7,10 @@ LL | core::sync::atomic::AtomicU64::from_mut(&mut 0u64); note: if you're trying to build a new `AtomicU64`, consider using `AtomicU64::new` which returns `AtomicU64` --> $SRC_DIR/core/src/sync/atomic.rs:LL:COL = note: this error originates in the macro `atomic_int` (in Nightly builds, run with -Z macro-backtrace for more info) +help: there is an associated function `from` with a similar name + | +LL | core::sync::atomic::AtomicU64::from(&mut 0u64); + | ~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/attributes/rustc_confusables.rs b/tests/ui/attributes/rustc_confusables.rs index a88432ead753..93d9a7d572c7 100644 --- a/tests/ui/attributes/rustc_confusables.rs +++ b/tests/ui/attributes/rustc_confusables.rs @@ -11,7 +11,7 @@ fn main() { let x = BTreeSet {}; x.inser(); //~^ ERROR no method named - //~| HELP there is a method with a similar name + //~| HELP there is a method `insert` with a similar name x.foo(); //~^ ERROR no method named x.push(); @@ -21,7 +21,7 @@ fn main() { //~^ ERROR no method named x.pulled(); //~^ ERROR no method named - //~| HELP there is a method with a similar name + //~| HELP you might have meant to use `pull` } struct Bar; diff --git a/tests/ui/attributes/rustc_confusables.stderr b/tests/ui/attributes/rustc_confusables.stderr index 9fd4470cdbb9..9e37d5f50837 100644 --- a/tests/ui/attributes/rustc_confusables.stderr +++ b/tests/ui/attributes/rustc_confusables.stderr @@ -31,7 +31,12 @@ error[E0599]: no method named `inser` found for struct `rustc_confusables_across --> $DIR/rustc_confusables.rs:12:7 | LL | x.inser(); - | ^^^^^ help: there is a method with a similar name: `insert` + | ^^^^^ + | +help: there is a method `insert` with a similar name + | +LL | x.insert(); + | ~~~~~~ error[E0599]: no method named `foo` found for struct `rustc_confusables_across_crate::BTreeSet` in the current scope --> $DIR/rustc_confusables.rs:15:7 @@ -60,7 +65,12 @@ error[E0599]: no method named `pulled` found for struct `rustc_confusables_acros --> $DIR/rustc_confusables.rs:22:7 | LL | x.pulled(); - | ^^^^^^ help: there is a method with a similar name: `pull` + | ^^^^^^ + | +help: you might have meant to use `pull` + | +LL | x.pull(); + | ~~~~ error: aborting due to 9 previous errors diff --git a/tests/ui/attributes/rustc_confusables_std_cases.rs b/tests/ui/attributes/rustc_confusables_std_cases.rs new file mode 100644 index 000000000000..d9121695950b --- /dev/null +++ b/tests/ui/attributes/rustc_confusables_std_cases.rs @@ -0,0 +1,26 @@ +use std::collections::BTreeSet; +use std::collections::VecDeque; + +fn main() { + let mut x = BTreeSet::new(); + x.push(1); //~ ERROR E0599 + //~^ HELP you might have meant to use `insert` + let mut x = Vec::new(); + x.push_back(1); //~ ERROR E0599 + //~^ HELP you might have meant to use `push` + let mut x = VecDeque::new(); + x.push(1); //~ ERROR E0599 + //~^ HELP you might have meant to use `push_back` + let mut x = vec![1, 2, 3]; + x.length(); //~ ERROR E0599 + //~^ HELP you might have meant to use `len` + x.size(); //~ ERROR E0599 + //~^ HELP you might have meant to use `len` + //~| HELP there is a method `resize` with a similar name + x.append(42); //~ ERROR E0308 + //~^ HELP you might have meant to use `push` + String::new().push(""); //~ ERROR E0308 + //~^ HELP you might have meant to use `push_str` + String::new().append(""); //~ ERROR E0599 + //~^ HELP you might have meant to use `push_str` +} diff --git a/tests/ui/attributes/rustc_confusables_std_cases.stderr b/tests/ui/attributes/rustc_confusables_std_cases.stderr new file mode 100644 index 000000000000..45d571f435cb --- /dev/null +++ b/tests/ui/attributes/rustc_confusables_std_cases.stderr @@ -0,0 +1,104 @@ +error[E0599]: no method named `push` found for struct `BTreeSet` in the current scope + --> $DIR/rustc_confusables_std_cases.rs:6:7 + | +LL | x.push(1); + | ^^^^ method not found in `BTreeSet<_>` + | +help: you might have meant to use `insert` + | +LL | x.insert(1); + | ~~~~~~ + +error[E0599]: no method named `push_back` found for struct `Vec<_>` in the current scope + --> $DIR/rustc_confusables_std_cases.rs:9:7 + | +LL | x.push_back(1); + | ^^^^^^^^^ method not found in `Vec<_>` + | +help: you might have meant to use `push` + | +LL | x.push(1); + | ~~~~ + +error[E0599]: no method named `push` found for struct `VecDeque` in the current scope + --> $DIR/rustc_confusables_std_cases.rs:12:7 + | +LL | x.push(1); + | ^^^^ method not found in `VecDeque<_>` + | +help: you might have meant to use `push_back` + | +LL | x.push_back(1); + | ~~~~~~~~~ + +error[E0599]: no method named `length` found for struct `Vec<{integer}>` in the current scope + --> $DIR/rustc_confusables_std_cases.rs:15:7 + | +LL | x.length(); + | ^^^^^^ + | +help: you might have meant to use `len` + | +LL | x.len(); + | ~~~ + +error[E0599]: no method named `size` found for struct `Vec<{integer}>` in the current scope + --> $DIR/rustc_confusables_std_cases.rs:17:7 + | +LL | x.size(); + | ^^^^ + | +help: there is a method `resize` with a similar name, but with different arguments + --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL +help: you might have meant to use `len` + | +LL | x.len(); + | ~~~ + +error[E0308]: mismatched types + --> $DIR/rustc_confusables_std_cases.rs:20:14 + | +LL | x.append(42); + | ------ ^^ expected `&mut Vec<{integer}>`, found integer + | | + | arguments to this method are incorrect + | + = note: expected mutable reference `&mut Vec<{integer}>` + found type `{integer}` +note: method defined here + --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL +help: you might have meant to use `push` + | +LL | x.push(42); + | ~~~~ + +error[E0308]: mismatched types + --> $DIR/rustc_confusables_std_cases.rs:22:24 + | +LL | String::new().push(""); + | ---- ^^ expected `char`, found `&str` + | | + | arguments to this method are incorrect + | +note: method defined here + --> $SRC_DIR/alloc/src/string.rs:LL:COL +help: you might have meant to use `push_str` + | +LL | String::new().push_str(""); + | ~~~~~~~~ + +error[E0599]: no method named `append` found for struct `String` in the current scope + --> $DIR/rustc_confusables_std_cases.rs:24:19 + | +LL | String::new().append(""); + | ^^^^^^ method not found in `String` + | +help: you might have meant to use `push_str` + | +LL | String::new().push_str(""); + | ~~~~~~~~ + +error: aborting due to 8 previous errors + +Some errors have detailed explanations: E0308, E0599. +For more information about an error, try `rustc --explain E0308`. diff --git a/tests/ui/auto-ref-slice-plus-ref.stderr b/tests/ui/auto-ref-slice-plus-ref.stderr index e2883050720d..806c1ee064ff 100644 --- a/tests/ui/auto-ref-slice-plus-ref.stderr +++ b/tests/ui/auto-ref-slice-plus-ref.stderr @@ -2,7 +2,7 @@ error[E0599]: no method named `test_mut` found for struct `Vec<{integer}>` in th --> $DIR/auto-ref-slice-plus-ref.rs:7:7 | LL | a.test_mut(); - | ^^^^^^^^ help: there is a method with a similar name: `get_mut` + | ^^^^^^^^ | = help: items from traits can only be used if the trait is implemented and in scope note: `MyIter` defines an item `test_mut`, perhaps you need to implement it @@ -10,6 +10,8 @@ note: `MyIter` defines an item `test_mut`, perhaps you need to implement it | LL | trait MyIter { | ^^^^^^^^^^^^ +help: there is a method `get_mut` with a similar name, but with different arguments + --> $SRC_DIR/core/src/slice/mod.rs:LL:COL error[E0599]: no method named `test` found for struct `Vec<{integer}>` in the current scope --> $DIR/auto-ref-slice-plus-ref.rs:8:7 diff --git a/tests/ui/block-result/issue-3563.stderr b/tests/ui/block-result/issue-3563.stderr index c473a84413eb..22606a52f851 100644 --- a/tests/ui/block-result/issue-3563.stderr +++ b/tests/ui/block-result/issue-3563.stderr @@ -2,7 +2,12 @@ error[E0599]: no method named `b` found for reference `&Self` in the current sco --> $DIR/issue-3563.rs:3:17 | LL | || self.b() - | ^ help: there is a method with a similar name: `a` + | ^ + | +help: there is a method `a` with a similar name + | +LL | || self.a() + | ~ error: aborting due to 1 previous error diff --git a/tests/ui/closures/2229_closure_analysis/run_pass/multivariant.min_exhaustive_patterns.stderr b/tests/ui/closures/2229_closure_analysis/run_pass/multivariant.min_exhaustive_patterns.stderr deleted file mode 100644 index b54341f82c79..000000000000 --- a/tests/ui/closures/2229_closure_analysis/run_pass/multivariant.min_exhaustive_patterns.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `min_exhaustive_patterns` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/multivariant.rs:7:46 - | -LL | #![cfg_attr(min_exhaustive_patterns, feature(min_exhaustive_patterns))] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #119612 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/closures/2229_closure_analysis/run_pass/multivariant.rs b/tests/ui/closures/2229_closure_analysis/run_pass/multivariant.rs index 9b3f6d046b4c..52ed008137fc 100644 --- a/tests/ui/closures/2229_closure_analysis/run_pass/multivariant.rs +++ b/tests/ui/closures/2229_closure_analysis/run_pass/multivariant.rs @@ -5,7 +5,6 @@ //@ run-pass #![cfg_attr(exhaustive_patterns, feature(exhaustive_patterns))] #![cfg_attr(min_exhaustive_patterns, feature(min_exhaustive_patterns))] -//[min_exhaustive_patterns]~^ WARN the feature `min_exhaustive_patterns` is incomplete #![feature(never_type)] pub fn main() { diff --git a/tests/ui/coherence/coherence_inherent.stderr b/tests/ui/coherence/coherence_inherent.stderr index da8c03847eda..17b49279de7b 100644 --- a/tests/ui/coherence/coherence_inherent.stderr +++ b/tests/ui/coherence/coherence_inherent.stderr @@ -5,7 +5,7 @@ LL | s.the_fn(); | ^^^^^^ method not found in `&TheStruct` | = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `TheTrait` which provides `the_fn` is implemented but not in scope; perhaps you want to import it | LL + use Lib::TheTrait; | diff --git a/tests/ui/coherence/coherence_inherent_cc.stderr b/tests/ui/coherence/coherence_inherent_cc.stderr index d34f6fa213be..b3c1125d63e3 100644 --- a/tests/ui/coherence/coherence_inherent_cc.stderr +++ b/tests/ui/coherence/coherence_inherent_cc.stderr @@ -5,7 +5,7 @@ LL | s.the_fn(); | ^^^^^^ method not found in `&TheStruct` | = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `TheTrait` which provides `the_fn` is implemented but not in scope; perhaps you want to import it | LL + use coherence_inherent_cc_lib::TheTrait; | diff --git a/tests/ui/confuse-field-and-method/issue-33784.stderr b/tests/ui/confuse-field-and-method/issue-33784.stderr index aaf953a66d52..8acd1f8ff1ee 100644 --- a/tests/ui/confuse-field-and-method/issue-33784.stderr +++ b/tests/ui/confuse-field-and-method/issue-33784.stderr @@ -8,6 +8,10 @@ help: to call the function stored in `closure`, surround the field access with p | LL | (p.closure)(); | + + +help: there is a method `clone` with a similar name + | +LL | p.clone(); + | ~~~~~ error[E0599]: no method named `fn_ptr` found for reference `&&Obj<{closure@$DIR/issue-33784.rs:25:43: 25:45}>` in the current scope --> $DIR/issue-33784.rs:29:7 diff --git a/tests/ui/const-generics/occurs-check/unused-substs-2.rs b/tests/ui/const-generics/occurs-check/unused-substs-2.rs index 84e24d1a3f5f..5bdd3e39806e 100644 --- a/tests/ui/const-generics/occurs-check/unused-substs-2.rs +++ b/tests/ui/const-generics/occurs-check/unused-substs-2.rs @@ -20,9 +20,10 @@ impl Bind for Foo<{ 6 + 1 }> { fn main() { let (mut t, foo) = Foo::bind(); + //~^ ERROR mismatched types + //~| NOTE cyclic type + // `t` is `ty::Infer(TyVar(?1t))` // `foo` contains `ty::Infer(TyVar(?1t))` in its substs t = foo; - //~^ ERROR mismatched types - //~| NOTE cyclic type } diff --git a/tests/ui/const-generics/occurs-check/unused-substs-2.stderr b/tests/ui/const-generics/occurs-check/unused-substs-2.stderr index 4b1b9f20559e..a2c4dec47243 100644 --- a/tests/ui/const-generics/occurs-check/unused-substs-2.stderr +++ b/tests/ui/const-generics/occurs-check/unused-substs-2.stderr @@ -1,8 +1,8 @@ error[E0308]: mismatched types - --> $DIR/unused-substs-2.rs:25:9 + --> $DIR/unused-substs-2.rs:22:24 | -LL | t = foo; - | ^^^ cyclic type of infinite size +LL | let (mut t, foo) = Foo::bind(); + | ^^^^^^^^^^^ cyclic type of infinite size error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/occurs-check/unused-substs-5.stderr b/tests/ui/const-generics/occurs-check/unused-substs-5.stderr index 1b3a54923284..46230d455b27 100644 --- a/tests/ui/const-generics/occurs-check/unused-substs-5.stderr +++ b/tests/ui/const-generics/occurs-check/unused-substs-5.stderr @@ -1,10 +1,8 @@ error[E0308]: mismatched types - --> $DIR/unused-substs-5.rs:15:9 + --> $DIR/unused-substs-5.rs:15:19 | LL | x = q::<_, N>(x); - | ^^^^^^^^^^^^- help: try using a conversion method: `.to_vec()` - | | - | cyclic type of infinite size + | ^ cyclic type of infinite size error: aborting due to 1 previous error diff --git a/tests/ui/consts/promote-not.rs b/tests/ui/consts/promote-not.rs index 907617052f11..47a06e8a72b7 100644 --- a/tests/ui/consts/promote-not.rs +++ b/tests/ui/consts/promote-not.rs @@ -49,6 +49,10 @@ fn main() { // No promotion of fallible operations. let _val: &'static _ = &(1/0); //~ ERROR temporary value dropped while borrowed let _val: &'static _ = &(1/(1-1)); //~ ERROR temporary value dropped while borrowed + let _val: &'static _ = &((1+1)/(1-1)); //~ ERROR temporary value dropped while borrowed + let _val: &'static _ = &(i32::MIN/-1); //~ ERROR temporary value dropped while borrowed + let _val: &'static _ = &(i32::MIN/(0-1)); //~ ERROR temporary value dropped while borrowed + let _val: &'static _ = &(-128i8/-1); //~ ERROR temporary value dropped while borrowed let _val: &'static _ = &(1%0); //~ ERROR temporary value dropped while borrowed let _val: &'static _ = &(1%(1-1)); //~ ERROR temporary value dropped while borrowed let _val: &'static _ = &([1,2,3][4]+1); //~ ERROR temporary value dropped while borrowed diff --git a/tests/ui/consts/promote-not.stderr b/tests/ui/consts/promote-not.stderr index 524d69817217..67ac5922efd9 100644 --- a/tests/ui/consts/promote-not.stderr +++ b/tests/ui/consts/promote-not.stderr @@ -105,6 +105,50 @@ LL | } error[E0716]: temporary value dropped while borrowed --> $DIR/promote-not.rs:52:29 | +LL | let _val: &'static _ = &((1+1)/(1-1)); + | ---------- ^^^^^^^^^^^^^ creates a temporary value which is freed while still in use + | | + | type annotation requires that borrow lasts for `'static` +... +LL | } + | - temporary value is freed at the end of this statement + +error[E0716]: temporary value dropped while borrowed + --> $DIR/promote-not.rs:53:29 + | +LL | let _val: &'static _ = &(i32::MIN/-1); + | ---------- ^^^^^^^^^^^^^ creates a temporary value which is freed while still in use + | | + | type annotation requires that borrow lasts for `'static` +... +LL | } + | - temporary value is freed at the end of this statement + +error[E0716]: temporary value dropped while borrowed + --> $DIR/promote-not.rs:54:29 + | +LL | let _val: &'static _ = &(i32::MIN/(0-1)); + | ---------- ^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use + | | + | type annotation requires that borrow lasts for `'static` +... +LL | } + | - temporary value is freed at the end of this statement + +error[E0716]: temporary value dropped while borrowed + --> $DIR/promote-not.rs:55:29 + | +LL | let _val: &'static _ = &(-128i8/-1); + | ---------- ^^^^^^^^^^^ creates a temporary value which is freed while still in use + | | + | type annotation requires that borrow lasts for `'static` +... +LL | } + | - temporary value is freed at the end of this statement + +error[E0716]: temporary value dropped while borrowed + --> $DIR/promote-not.rs:56:29 + | LL | let _val: &'static _ = &(1%0); | ---------- ^^^^^ creates a temporary value which is freed while still in use | | @@ -114,7 +158,7 @@ LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed - --> $DIR/promote-not.rs:53:29 + --> $DIR/promote-not.rs:57:29 | LL | let _val: &'static _ = &(1%(1-1)); | ---------- ^^^^^^^^^ creates a temporary value which is freed while still in use @@ -125,7 +169,7 @@ LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed - --> $DIR/promote-not.rs:54:29 + --> $DIR/promote-not.rs:58:29 | LL | let _val: &'static _ = &([1,2,3][4]+1); | ---------- ^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use @@ -136,7 +180,7 @@ LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed - --> $DIR/promote-not.rs:57:29 + --> $DIR/promote-not.rs:61:29 | LL | let _val: &'static _ = &TEST_DROP; | ---------- ^^^^^^^^^ creates a temporary value which is freed while still in use @@ -147,7 +191,7 @@ LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed - --> $DIR/promote-not.rs:59:29 + --> $DIR/promote-not.rs:63:29 | LL | let _val: &'static _ = &&TEST_DROP; | ---------- ^^^^^^^^^^ creates a temporary value which is freed while still in use @@ -158,7 +202,7 @@ LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed - --> $DIR/promote-not.rs:59:30 + --> $DIR/promote-not.rs:63:30 | LL | let _val: &'static _ = &&TEST_DROP; | ---------- ^^^^^^^^^ creates a temporary value which is freed while still in use @@ -169,7 +213,7 @@ LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed - --> $DIR/promote-not.rs:62:29 + --> $DIR/promote-not.rs:66:29 | LL | let _val: &'static _ = &(&TEST_DROP,); | ---------- ^^^^^^^^^^^^^ creates a temporary value which is freed while still in use @@ -180,7 +224,7 @@ LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed - --> $DIR/promote-not.rs:62:31 + --> $DIR/promote-not.rs:66:31 | LL | let _val: &'static _ = &(&TEST_DROP,); | ---------- ^^^^^^^^^ creates a temporary value which is freed while still in use @@ -191,7 +235,7 @@ LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed - --> $DIR/promote-not.rs:65:29 + --> $DIR/promote-not.rs:69:29 | LL | let _val: &'static _ = &[&TEST_DROP; 1]; | ---------- ^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use @@ -202,7 +246,7 @@ LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed - --> $DIR/promote-not.rs:65:31 + --> $DIR/promote-not.rs:69:31 | LL | let _val: &'static _ = &[&TEST_DROP; 1]; | ---------- ^^^^^^^^^ - temporary value is freed at the end of this statement @@ -210,6 +254,6 @@ LL | let _val: &'static _ = &[&TEST_DROP; 1]; | | creates a temporary value which is freed while still in use | type annotation requires that borrow lasts for `'static` -error: aborting due to 20 previous errors +error: aborting due to 24 previous errors For more information about this error, try `rustc --explain E0716`. diff --git a/tests/ui/consts/promotion.rs b/tests/ui/consts/promotion.rs index 211dcf8a4e8f..b18495a4a6bf 100644 --- a/tests/ui/consts/promotion.rs +++ b/tests/ui/consts/promotion.rs @@ -28,8 +28,11 @@ fn main() { // make sure that this does not cause trouble despite overflowing assert_static(&(0-1)); - // div-by-non-0 is okay + // div-by-non-0 (and also not MIN/-1) is okay assert_static(&(1/1)); + assert_static(&(0/1)); + assert_static(&(1/-1)); + assert_static(&(i32::MIN/1)); assert_static(&(1%1)); // in-bounds array access is okay diff --git a/tests/ui/for/issue-20605.next.stderr b/tests/ui/for/issue-20605.next.stderr index 3d753b9c8b88..a44faa5491d3 100644 --- a/tests/ui/for/issue-20605.next.stderr +++ b/tests/ui/for/issue-20605.next.stderr @@ -4,30 +4,12 @@ error[E0277]: the trait bound `dyn Iterator: IntoIterator` is LL | for item in *things { *item = 0 } | ^^^^^^^ the trait `IntoIterator` is not implemented for `dyn Iterator` -error[E0277]: the size for values of type ` as IntoIterator>::IntoIter` cannot be known at compilation time - --> $DIR/issue-20605.rs:5:17 - | -LL | for item in *things { *item = 0 } - | ^^^^^^^ doesn't have a size known at compile-time - | - = help: the trait `Sized` is not implemented for ` as IntoIterator>::IntoIter` - = note: all local variables must have a statically known size - = help: unsized locals are gated as an unstable feature - error: the type ` as IntoIterator>::IntoIter` is not well-formed --> $DIR/issue-20605.rs:5:17 | LL | for item in *things { *item = 0 } | ^^^^^^^ -error[E0277]: ` as IntoIterator>::IntoIter` is not an iterator - --> $DIR/issue-20605.rs:5:17 - | -LL | for item in *things { *item = 0 } - | ^^^^^^^ ` as IntoIterator>::IntoIter` is not an iterator - | - = help: the trait `Iterator` is not implemented for ` as IntoIterator>::IntoIter` - error: the type `&mut as IntoIterator>::IntoIter` is not well-formed --> $DIR/issue-20605.rs:5:17 | @@ -40,33 +22,13 @@ error: the type `Option<< as IntoIterator>::Into LL | for item in *things { *item = 0 } | ^^^^^^^ -error[E0277]: the size for values of type `< as IntoIterator>::IntoIter as Iterator>::Item` cannot be known at compilation time - --> $DIR/issue-20605.rs:5:5 - | -LL | for item in *things { *item = 0 } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time - | - = help: the trait `Sized` is not implemented for `< as IntoIterator>::IntoIter as Iterator>::Item` -note: required by a bound in `None` - --> $SRC_DIR/core/src/option.rs:LL:COL - -error[E0277]: the size for values of type `< as IntoIterator>::IntoIter as Iterator>::Item` cannot be known at compilation time - --> $DIR/issue-20605.rs:5:9 - | -LL | for item in *things { *item = 0 } - | ^^^^ doesn't have a size known at compile-time - | - = help: the trait `Sized` is not implemented for `< as IntoIterator>::IntoIter as Iterator>::Item` - = note: all local variables must have a statically known size - = help: unsized locals are gated as an unstable feature - -error[E0614]: type `< as IntoIterator>::IntoIter as Iterator>::Item` cannot be dereferenced +error[E0614]: type ` as IntoIterator>::Item` cannot be dereferenced --> $DIR/issue-20605.rs:5:27 | LL | for item in *things { *item = 0 } | ^^^^^ -error: aborting due to 9 previous errors +error: aborting due to 5 previous errors Some errors have detailed explanations: E0277, E0614. For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/for/issue-20605.rs b/tests/ui/for/issue-20605.rs index 77d7039fa15e..4a9f62b6612a 100644 --- a/tests/ui/for/issue-20605.rs +++ b/tests/ui/for/issue-20605.rs @@ -5,14 +5,11 @@ fn changer<'a>(mut things: Box>) { for item in *things { *item = 0 } //[current]~^ ERROR the size for values of type //[next]~^^ ERROR the trait bound `dyn Iterator: IntoIterator` is not satisfied - //[next]~| ERROR the size for values of type ` as IntoIterator>::IntoIter` cannot be known at compilation time //[next]~| ERROR the type ` as IntoIterator>::IntoIter` is not well-formed - //[next]~| ERROR ` as IntoIterator>::IntoIter` is not an iterator //[next]~| ERROR the type `&mut as IntoIterator>::IntoIter` is not well-formed - //[next]~| ERROR the size for values of type `< as IntoIterator>::IntoIter as Iterator>::Item` cannot be known at compilation time //[next]~| ERROR the type `Option<< as IntoIterator>::IntoIter as Iterator>::Item>` is not well-formed - //[next]~| ERROR the size for values of type `< as IntoIterator>::IntoIter as Iterator>::Item` cannot be known at compilation time - //[next]~| ERROR type `< as IntoIterator>::IntoIter as Iterator>::Item` cannot be dereferenced + //[next]~| ERROR type ` as IntoIterator>::Item` cannot be dereferenced + // FIXME(-Znext-solver): these error messages are horrible and have to be // improved before we stabilize the new solver. } diff --git a/tests/ui/generic-associated-types/issue-90014-tait2.stderr b/tests/ui/generic-associated-types/issue-90014-tait2.stderr index ed0b2085c885..58390032d92d 100644 --- a/tests/ui/generic-associated-types/issue-90014-tait2.stderr +++ b/tests/ui/generic-associated-types/issue-90014-tait2.stderr @@ -1,4 +1,11 @@ error[E0792]: expected generic lifetime parameter, found `'a` + --> $DIR/issue-90014-tait2.rs:27:9 + | +LL | type Fut<'a> = impl Future; + | -- this generic parameter must be used with a generic lifetime parameter +... +LL | Box::new((async { () },)) + | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/hygiene/no_implicit_prelude.stderr b/tests/ui/hygiene/no_implicit_prelude.stderr index 96187b1c5016..5de6e3db327b 100644 --- a/tests/ui/hygiene/no_implicit_prelude.stderr +++ b/tests/ui/hygiene/no_implicit_prelude.stderr @@ -20,11 +20,13 @@ LL | fn f() { ::bar::m!(); } | ----------- in this macro invocation ... LL | ().clone() - | ^^^^^ method not found in `()` + | ^^^^^ | = help: items from traits can only be used if the trait is in scope +help: there is a method `clone_from` with a similar name, but with different arguments + --> $SRC_DIR/core/src/clone.rs:LL:COL = note: this error originates in the macro `::bar::m` (in Nightly builds, run with -Z macro-backtrace for more info) -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `Clone` which provides `clone` is implemented but not in scope; perhaps you want to import it | LL + use std::clone::Clone; | diff --git a/tests/ui/hygiene/trait_items.stderr b/tests/ui/hygiene/trait_items.stderr index 016ee8f71f98..0e276bf69d6e 100644 --- a/tests/ui/hygiene/trait_items.stderr +++ b/tests/ui/hygiene/trait_items.stderr @@ -12,7 +12,7 @@ LL | pub macro m() { ().f() } | = help: items from traits can only be used if the trait is in scope = note: this error originates in the macro `::baz::m` (in Nightly builds, run with -Z macro-backtrace for more info) -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `T` which provides `f` is implemented but not in scope; perhaps you want to import it | LL + use foo::T; | diff --git a/tests/ui/impl-trait/in-trait/async-and-ret-ref.stderr b/tests/ui/impl-trait/in-trait/async-and-ret-ref.stderr index 79a86b0a3aed..15aa3cf54bbe 100644 --- a/tests/ui/impl-trait/in-trait/async-and-ret-ref.stderr +++ b/tests/ui/impl-trait/in-trait/async-and-ret-ref.stderr @@ -6,8 +6,6 @@ LL | async fn foo() -> &'static impl T; | | | the associated type `::{opaque#0}` must be valid for the static lifetime... | ...so that the reference type `&'static impl T` does not outlive the data it points at - | - = help: consider adding an explicit lifetime bound `::{opaque#0}: 'static`... error: aborting due to 1 previous error diff --git a/tests/ui/impl-trait/in-trait/missing-static-bound-from-impl.rs b/tests/ui/impl-trait/in-trait/missing-static-bound-from-impl.rs new file mode 100644 index 000000000000..a36799c3ebd4 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/missing-static-bound-from-impl.rs @@ -0,0 +1,16 @@ +trait Original { + fn f() -> impl Fn(); +} + +trait Erased { + fn f(&self) -> Box; +} + +impl Erased for T { + fn f(&self) -> Box { + Box::new(::f()) + //~^ ERROR the associated type `::{opaque#0}` may not live long enough + } +} + +fn main () {} diff --git a/tests/ui/impl-trait/in-trait/missing-static-bound-from-impl.stderr b/tests/ui/impl-trait/in-trait/missing-static-bound-from-impl.stderr new file mode 100644 index 000000000000..5ec0ee38347a --- /dev/null +++ b/tests/ui/impl-trait/in-trait/missing-static-bound-from-impl.stderr @@ -0,0 +1,12 @@ +error[E0310]: the associated type `::{opaque#0}` may not live long enough + --> $DIR/missing-static-bound-from-impl.rs:11:9 + | +LL | Box::new(::f()) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | the associated type `::{opaque#0}` must be valid for the static lifetime... + | ...so that the type `impl Fn()` will meet its required lifetime bounds + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0310`. diff --git a/tests/ui/impl-trait/in-trait/span-bug-issue-121457.rs b/tests/ui/impl-trait/in-trait/span-bug-issue-121457.rs new file mode 100644 index 000000000000..10167ee93526 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/span-bug-issue-121457.rs @@ -0,0 +1,18 @@ +pub trait Iterable { + type Item<'a> + where + Self: 'a; + + fn iter(&self) -> impl Iterator; +} + +impl<'a, I: 'a + Iterable> Iterable for &'a I { + type Item = u32; + //~^ ERROR lifetime parameters or bounds on type `Item` do not match the trait declaration + + fn iter(&self) -> impl for<'missing> Iterator> {} + //~^ ERROR binding for associated type `Item` references lifetime `'missing` + //~| ERROR `()` is not an iterator +} + +fn main() {} diff --git a/tests/ui/impl-trait/in-trait/span-bug-issue-121457.stderr b/tests/ui/impl-trait/in-trait/span-bug-issue-121457.stderr new file mode 100644 index 000000000000..96c3644f8934 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/span-bug-issue-121457.stderr @@ -0,0 +1,30 @@ +error[E0582]: binding for associated type `Item` references lifetime `'missing`, which does not appear in the trait input types + --> $DIR/span-bug-issue-121457.rs:13:51 + | +LL | fn iter(&self) -> impl for<'missing> Iterator> {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0195]: lifetime parameters or bounds on type `Item` do not match the trait declaration + --> $DIR/span-bug-issue-121457.rs:10:14 + | +LL | type Item<'a> + | ---- lifetimes in impl do not match this type in trait +LL | where +LL | Self: 'a; + | -- this bound might be missing in the impl +... +LL | type Item = u32; + | ^ lifetimes do not match type in trait + +error[E0277]: `()` is not an iterator + --> $DIR/span-bug-issue-121457.rs:13:23 + | +LL | fn iter(&self) -> impl for<'missing> Iterator> {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `()` is not an iterator + | + = help: the trait `Iterator` is not implemented for `()` + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0195, E0277, E0582. +For more information about an error, try `rustc --explain E0195`. diff --git a/tests/ui/impl-trait/issues/issue-62742.rs b/tests/ui/impl-trait/issues/issue-62742.rs index 041bd0e3855e..11a75737e554 100644 --- a/tests/ui/impl-trait/issues/issue-62742.rs +++ b/tests/ui/impl-trait/issues/issue-62742.rs @@ -3,6 +3,7 @@ use std::marker::PhantomData; fn _alias_check() { WrongImpl::foo(0i32); //~^ ERROR the trait bound `RawImpl<_>: Raw<_>` is not satisfied + //~| ERROR the trait bound `RawImpl<_>: Raw<_>` is not satisfied WrongImpl::<()>::foo(0i32); //~^ ERROR the trait bound `RawImpl<()>: Raw<()>` is not satisfied //~| ERROR trait bounds were not satisfied diff --git a/tests/ui/impl-trait/issues/issue-62742.stderr b/tests/ui/impl-trait/issues/issue-62742.stderr index 8d969e8e0f3d..9ec581c231b7 100644 --- a/tests/ui/impl-trait/issues/issue-62742.stderr +++ b/tests/ui/impl-trait/issues/issue-62742.stderr @@ -1,3 +1,18 @@ +error[E0277]: the trait bound `RawImpl<_>: Raw<_>` is not satisfied + --> $DIR/issue-62742.rs:4:5 + | +LL | WrongImpl::foo(0i32); + | ^^^^^^^^^^^^^^^^^^^^ the trait `Raw<_>` is not implemented for `RawImpl<_>` + | + = help: the trait `Raw<[_]>` is implemented for `RawImpl<_>` +note: required by a bound in `SafeImpl::::foo` + --> $DIR/issue-62742.rs:29:20 + | +LL | impl> SafeImpl { + | ^^^^^^ required by this bound in `SafeImpl::::foo` +LL | pub fn foo(value: A::Value) {} + | --- required by a bound in this associated function + error[E0277]: the trait bound `RawImpl<_>: Raw<_>` is not satisfied --> $DIR/issue-62742.rs:4:5 | @@ -6,13 +21,13 @@ LL | WrongImpl::foo(0i32); | = help: the trait `Raw<[_]>` is implemented for `RawImpl<_>` note: required by a bound in `SafeImpl` - --> $DIR/issue-62742.rs:26:35 + --> $DIR/issue-62742.rs:27:35 | LL | pub struct SafeImpl>(PhantomData<(A, T)>); | ^^^^^^ required by this bound in `SafeImpl` error[E0599]: the function or associated item `foo` exists for struct `SafeImpl<(), RawImpl<()>>`, but its trait bounds were not satisfied - --> $DIR/issue-62742.rs:6:22 + --> $DIR/issue-62742.rs:7:22 | LL | WrongImpl::<()>::foo(0i32); | ^^^ function or associated item cannot be called on `SafeImpl<(), RawImpl<()>>` due to unsatisfied trait bounds @@ -24,20 +39,20 @@ LL | pub struct SafeImpl>(PhantomData<(A, T)>); | ----------------------------------------- function or associated item `foo` not found for this struct | note: trait bound `RawImpl<()>: Raw<()>` was not satisfied - --> $DIR/issue-62742.rs:28:20 + --> $DIR/issue-62742.rs:29:20 | LL | impl> SafeImpl { | ^^^^^^ -------------- | | | unsatisfied trait bound introduced here note: the trait `Raw` must be implemented - --> $DIR/issue-62742.rs:12:1 + --> $DIR/issue-62742.rs:13:1 | LL | pub trait Raw { | ^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `RawImpl<()>: Raw<()>` is not satisfied - --> $DIR/issue-62742.rs:6:5 + --> $DIR/issue-62742.rs:7:5 | LL | WrongImpl::<()>::foo(0i32); | ^^^^^^^^^^^^^^^ the trait `Raw<()>` is not implemented for `RawImpl<()>` @@ -45,12 +60,12 @@ LL | WrongImpl::<()>::foo(0i32); = help: the trait `Raw<[()]>` is implemented for `RawImpl<()>` = help: for that trait implementation, expected `[()]`, found `()` note: required by a bound in `SafeImpl` - --> $DIR/issue-62742.rs:26:35 + --> $DIR/issue-62742.rs:27:35 | LL | pub struct SafeImpl>(PhantomData<(A, T)>); | ^^^^^^ required by this bound in `SafeImpl` -error: aborting due to 3 previous errors +error: aborting due to 4 previous errors Some errors have detailed explanations: E0277, E0599. For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/impl-trait/issues/issue-84073.rs b/tests/ui/impl-trait/issues/issue-84073.rs index 49a34ccfa3b4..85d9d461fd9a 100644 --- a/tests/ui/impl-trait/issues/issue-84073.rs +++ b/tests/ui/impl-trait/issues/issue-84073.rs @@ -29,5 +29,5 @@ where } fn main() { - Race::new(|race| race.when()); //~ ERROR type annotations needed + Race::new(|race| race.when()); //~ ERROR overflow assigning `_` to `Option<_>` } diff --git a/tests/ui/impl-trait/issues/issue-84073.stderr b/tests/ui/impl-trait/issues/issue-84073.stderr index d03e458aeb82..ab119a8a4f45 100644 --- a/tests/ui/impl-trait/issues/issue-84073.stderr +++ b/tests/ui/impl-trait/issues/issue-84073.stderr @@ -1,14 +1,9 @@ -error[E0282]: type annotations needed for `RaceBuilder>` - --> $DIR/issue-84073.rs:32:16 +error[E0275]: overflow assigning `_` to `Option<_>` + --> $DIR/issue-84073.rs:32:22 | LL | Race::new(|race| race.when()); - | ^^^^ ---- type must be known at this point - | -help: consider giving this closure parameter an explicit type, where the type for type parameter `T` is specified - | -LL | Race::new(|race: RaceBuilder>| race.when()); - | ++++++++++++++++++++++++++ + | ^^^^ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0282`. +For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/impl-trait/no-method-suggested-traits.stderr b/tests/ui/impl-trait/no-method-suggested-traits.stderr index 160cc044078e..7a4dc366618e 100644 --- a/tests/ui/impl-trait/no-method-suggested-traits.stderr +++ b/tests/ui/impl-trait/no-method-suggested-traits.stderr @@ -2,10 +2,10 @@ error[E0599]: no method named `method` found for type `u32` in the current scope --> $DIR/no-method-suggested-traits.rs:23:10 | LL | 1u32.method(); - | ^^^^^^ method not found in `u32` + | ^^^^^^ | = help: items from traits can only be used if the trait is in scope -help: the following traits are implemented but not in scope; perhaps add a `use` for one of them: +help: the following traits which provide `method` are implemented but not in scope; perhaps you want to import one of them | LL + use foo::Bar; | @@ -15,15 +15,19 @@ LL + use no_method_suggested_traits::foo::PubPub; | LL + use no_method_suggested_traits::qux::PrivPub; | +help: there is a method `method2` with a similar name + | +LL | 1u32.method2(); + | ~~~~~~~ error[E0599]: no method named `method` found for struct `Rc<&mut Box<&u32>>` in the current scope --> $DIR/no-method-suggested-traits.rs:26:44 | LL | std::rc::Rc::new(&mut Box::new(&1u32)).method(); - | ^^^^^^ method not found in `Rc<&mut Box<&u32>>` + | ^^^^^^ | = help: items from traits can only be used if the trait is in scope -help: the following traits are implemented but not in scope; perhaps add a `use` for one of them: +help: the following traits which provide `method` are implemented but not in scope; perhaps you want to import one of them | LL + use foo::Bar; | @@ -33,6 +37,10 @@ LL + use no_method_suggested_traits::foo::PubPub; | LL + use no_method_suggested_traits::qux::PrivPub; | +help: there is a method `method2` with a similar name + | +LL | std::rc::Rc::new(&mut Box::new(&1u32)).method2(); + | ~~~~~~~ error[E0599]: no method named `method` found for type `char` in the current scope --> $DIR/no-method-suggested-traits.rs:30:9 @@ -41,31 +49,39 @@ LL | fn method(&self) {} | ------ the method is available for `char` here ... LL | 'a'.method(); - | ^^^^^^ method not found in `char` + | ^^^^^^ | = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `Bar` which provides `method` is implemented but not in scope; perhaps you want to import it | LL + use foo::Bar; | +help: there is a method `method2` with a similar name + | +LL | 'a'.method2(); + | ~~~~~~~ error[E0599]: no method named `method` found for struct `Rc<&mut Box<&char>>` in the current scope --> $DIR/no-method-suggested-traits.rs:32:43 | LL | std::rc::Rc::new(&mut Box::new(&'a')).method(); - | ^^^^^^ method not found in `Rc<&mut Box<&char>>` + | ^^^^^^ | = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `Bar` which provides `method` is implemented but not in scope; perhaps you want to import it | LL + use foo::Bar; | +help: there is a method `method2` with a similar name + | +LL | std::rc::Rc::new(&mut Box::new(&'a')).method2(); + | ~~~~~~~ error[E0599]: no method named `method` found for type `i32` in the current scope --> $DIR/no-method-suggested-traits.rs:35:10 | LL | 1i32.method(); - | ^^^^^^ method not found in `i32` + | ^^^^^^ | ::: $DIR/auxiliary/no_method_suggested_traits.rs:8:12 | @@ -73,22 +89,30 @@ LL | fn method(&self) {} | ------ the method is available for `i32` here | = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `PubPub` which provides `method` is implemented but not in scope; perhaps you want to import it | LL + use no_method_suggested_traits::foo::PubPub; | +help: there is a method `method3` with a similar name + | +LL | 1i32.method3(); + | ~~~~~~~ error[E0599]: no method named `method` found for struct `Rc<&mut Box<&i32>>` in the current scope --> $DIR/no-method-suggested-traits.rs:37:44 | LL | std::rc::Rc::new(&mut Box::new(&1i32)).method(); - | ^^^^^^ method not found in `Rc<&mut Box<&i32>>` + | ^^^^^^ | = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `PubPub` which provides `method` is implemented but not in scope; perhaps you want to import it | LL + use no_method_suggested_traits::foo::PubPub; | +help: there is a method `method3` with a similar name + | +LL | std::rc::Rc::new(&mut Box::new(&1i32)).method3(); + | ~~~~~~~ error[E0599]: no method named `method` found for struct `Foo` in the current scope --> $DIR/no-method-suggested-traits.rs:40:9 diff --git a/tests/ui/impl-trait/where-allowed.stderr b/tests/ui/impl-trait/where-allowed.stderr index f203f4cabc84..c4bdd484fdbd 100644 --- a/tests/ui/impl-trait/where-allowed.stderr +++ b/tests/ui/impl-trait/where-allowed.stderr @@ -395,6 +395,8 @@ error[E0599]: no function or associated item named `into_vec` found for slice `[ LL | vec![vec![0; 10], vec![12; 7], vec![8; 3]] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `[_]` | +help: there is an associated function `to_vec` with a similar name + --> $SRC_DIR/alloc/src/slice.rs:LL:COL = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0053]: method `in_trait_impl_return` has an incompatible type for trait diff --git a/tests/ui/imports/overlapping_pub_trait.rs b/tests/ui/imports/overlapping_pub_trait.rs index cde9f7d8edb6..9a56b96adbfa 100644 --- a/tests/ui/imports/overlapping_pub_trait.rs +++ b/tests/ui/imports/overlapping_pub_trait.rs @@ -4,7 +4,7 @@ * This crate declares two public paths, `m::Tr` and `prelude::_`. Make sure we prefer the former. */ extern crate overlapping_pub_trait_source; -//~^ HELP the following trait is implemented but not in scope; perhaps add a `use` for it: +//~^ HELP trait `Tr` which provides `method` is implemented but not in scope; perhaps you want to import it //~| SUGGESTION overlapping_pub_trait_source::m::Tr fn main() { diff --git a/tests/ui/imports/overlapping_pub_trait.stderr b/tests/ui/imports/overlapping_pub_trait.stderr index a82a4101ce0b..51a8bec85b7d 100644 --- a/tests/ui/imports/overlapping_pub_trait.stderr +++ b/tests/ui/imports/overlapping_pub_trait.stderr @@ -10,7 +10,7 @@ LL | pub trait Tr { fn method(&self); } | ------ the method is available for `S` here | = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `Tr` which provides `method` is implemented but not in scope; perhaps you want to import it | LL + use overlapping_pub_trait_source::m::Tr; | diff --git a/tests/ui/imports/unnamed_pub_trait.rs b/tests/ui/imports/unnamed_pub_trait.rs index 09a01643c5e0..1527dfef1476 100644 --- a/tests/ui/imports/unnamed_pub_trait.rs +++ b/tests/ui/imports/unnamed_pub_trait.rs @@ -5,7 +5,7 @@ * importing it by name, and instead we suggest importing it by glob. */ extern crate unnamed_pub_trait_source; -//~^ HELP the following trait is implemented but not in scope; perhaps add a `use` for it: +//~^ HELP trait `Tr` which provides `method` is implemented but not in scope; perhaps you want to import it //~| SUGGESTION unnamed_pub_trait_source::prelude::*; // trait Tr fn main() { diff --git a/tests/ui/imports/unnamed_pub_trait.stderr b/tests/ui/imports/unnamed_pub_trait.stderr index 41772b8e694d..7d6b7742981c 100644 --- a/tests/ui/imports/unnamed_pub_trait.stderr +++ b/tests/ui/imports/unnamed_pub_trait.stderr @@ -10,7 +10,7 @@ LL | pub trait Tr { fn method(&self); } | ------ the method is available for `S` here | = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `Tr` which provides `method` is implemented but not in scope; perhaps you want to import it | LL + use unnamed_pub_trait_source::prelude::*; // trait Tr | diff --git a/tests/ui/infinite/infinite-autoderef.rs b/tests/ui/infinite/infinite-autoderef.rs index d6956e694570..ef6ba8ac87b7 100644 --- a/tests/ui/infinite/infinite-autoderef.rs +++ b/tests/ui/infinite/infinite-autoderef.rs @@ -1,6 +1,3 @@ -//@ error-pattern: reached the recursion limit while auto-dereferencing -//@ compile-flags: -Zdeduplicate-diagnostics=yes - use std::ops::Deref; struct Foo; @@ -17,6 +14,7 @@ pub fn main() { let mut x; loop { x = Box::new(x); + //~^ ERROR overflow assigning `Box<_>` to `_` x.foo; x.bar(); } diff --git a/tests/ui/infinite/infinite-autoderef.stderr b/tests/ui/infinite/infinite-autoderef.stderr index 51b61e3a66bb..7d09af9a7d4a 100644 --- a/tests/ui/infinite/infinite-autoderef.stderr +++ b/tests/ui/infinite/infinite-autoderef.stderr @@ -1,54 +1,9 @@ -error[E0308]: mismatched types - --> $DIR/infinite-autoderef.rs:19:13 +error[E0275]: overflow assigning `Box<_>` to `_` + --> $DIR/infinite-autoderef.rs:16:13 | LL | x = Box::new(x); - | ^^^^^^^^^^^ cyclic type of infinite size - | -help: consider unboxing the value - | -LL | x = *Box::new(x); - | + + | ^^^^^^^^^^^ -error[E0055]: reached the recursion limit while auto-dereferencing `Foo` - --> $DIR/infinite-autoderef.rs:24:5 - | -LL | Foo.foo; - | ^^^^^^^ deref recursion limit reached - | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`infinite_autoderef`) +error: aborting due to 1 previous error -error[E0055]: reached the recursion limit while auto-dereferencing `Foo` - --> $DIR/infinite-autoderef.rs:24:9 - | -LL | Foo.foo; - | ^^^ deref recursion limit reached - | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`infinite_autoderef`) - -error[E0609]: no field `foo` on type `Foo` - --> $DIR/infinite-autoderef.rs:24:9 - | -LL | Foo.foo; - | ^^^ unknown field - -error[E0055]: reached the recursion limit while auto-dereferencing `Foo` - --> $DIR/infinite-autoderef.rs:25:9 - | -LL | Foo.bar(); - | ^^^ deref recursion limit reached - | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`infinite_autoderef`) - -error[E0599]: no method named `bar` found for struct `Foo` in the current scope - --> $DIR/infinite-autoderef.rs:25:9 - | -LL | struct Foo; - | ---------- method `bar` not found for this struct -... -LL | Foo.bar(); - | ^^^ method not found in `Foo` - -error: aborting due to 6 previous errors - -Some errors have detailed explanations: E0055, E0308, E0599, E0609. -For more information about an error, try `rustc --explain E0055`. +For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/infinite/infinite-type-alias-mutual-recursion.feature.stderr b/tests/ui/infinite/infinite-type-alias-mutual-recursion.feature.stderr index 8b8fc46dfc5b..3dec2c3084f1 100644 --- a/tests/ui/infinite/infinite-type-alias-mutual-recursion.feature.stderr +++ b/tests/ui/infinite/infinite-type-alias-mutual-recursion.feature.stderr @@ -1,4 +1,4 @@ -error[E0275]: overflow evaluating the requirement `X2` +error[E0275]: overflow normalizing the type alias `X2` --> $DIR/infinite-type-alias-mutual-recursion.rs:6:11 | LL | type X1 = X2; @@ -6,7 +6,7 @@ LL | type X1 = X2; | = note: in case this is a recursive type alias, consider using a struct, enum, or union instead -error[E0275]: overflow evaluating the requirement `X3` +error[E0275]: overflow normalizing the type alias `X3` --> $DIR/infinite-type-alias-mutual-recursion.rs:9:11 | LL | type X2 = X3; @@ -14,7 +14,7 @@ LL | type X2 = X3; | = note: in case this is a recursive type alias, consider using a struct, enum, or union instead -error[E0275]: overflow evaluating the requirement `X1` +error[E0275]: overflow normalizing the type alias `X1` --> $DIR/infinite-type-alias-mutual-recursion.rs:11:11 | LL | type X3 = X1; diff --git a/tests/ui/infinite/infinite-type-alias-mutual-recursion.rs b/tests/ui/infinite/infinite-type-alias-mutual-recursion.rs index 91cfe89e28a4..cf9ea0db4cbe 100644 --- a/tests/ui/infinite/infinite-type-alias-mutual-recursion.rs +++ b/tests/ui/infinite/infinite-type-alias-mutual-recursion.rs @@ -5,10 +5,10 @@ type X1 = X2; //[gated]~^ ERROR cycle detected when expanding type alias `X1` -//[feature]~^^ ERROR: overflow evaluating the requirement `X2` +//[feature]~^^ ERROR: overflow normalizing the type alias `X2` type X2 = X3; -//[feature]~^ ERROR: overflow evaluating the requirement `X3` +//[feature]~^ ERROR: overflow normalizing the type alias `X3` type X3 = X1; -//[feature]~^ ERROR: overflow evaluating the requirement `X1` +//[feature]~^ ERROR: overflow normalizing the type alias `X1` fn main() {} diff --git a/tests/ui/infinite/infinite-vec-type-recursion.feature.stderr b/tests/ui/infinite/infinite-vec-type-recursion.feature.stderr index 3aac0d7d1db7..5c8d50341c16 100644 --- a/tests/ui/infinite/infinite-vec-type-recursion.feature.stderr +++ b/tests/ui/infinite/infinite-vec-type-recursion.feature.stderr @@ -1,4 +1,4 @@ -error[E0275]: overflow evaluating the requirement `X` +error[E0275]: overflow normalizing the type alias `X` --> $DIR/infinite-vec-type-recursion.rs:6:10 | LL | type X = Vec; diff --git a/tests/ui/infinite/infinite-vec-type-recursion.rs b/tests/ui/infinite/infinite-vec-type-recursion.rs index ff270f3bf8cc..c051d11d376c 100644 --- a/tests/ui/infinite/infinite-vec-type-recursion.rs +++ b/tests/ui/infinite/infinite-vec-type-recursion.rs @@ -5,7 +5,7 @@ type X = Vec; //[gated]~^ ERROR cycle detected -//[feature]~^^ ERROR: overflow evaluating the requirement `X` +//[feature]~^^ ERROR: overflow normalizing the type alias `X` #[rustfmt::skip] fn main() { let b: X = Vec::new(); } diff --git a/tests/ui/issues/issue-10465.stderr b/tests/ui/issues/issue-10465.stderr index c6bc0786af1e..0f46ebe505aa 100644 --- a/tests/ui/issues/issue-10465.stderr +++ b/tests/ui/issues/issue-10465.stderr @@ -5,7 +5,7 @@ LL | b.foo(); | ^^^ method not found in `&B` | = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `A` which provides `foo` is implemented but not in scope; perhaps you want to import it | LL + use a::A; | diff --git a/tests/ui/issues/issue-28344.stderr b/tests/ui/issues/issue-28344.stderr index 8b427b692a79..ddc1027c16b8 100644 --- a/tests/ui/issues/issue-28344.stderr +++ b/tests/ui/issues/issue-28344.stderr @@ -22,10 +22,10 @@ error[E0599]: no function or associated item named `bitor` found for trait objec --> $DIR/issue-28344.rs:4:25 | LL | let x: u8 = BitXor::bitor(0 as u8, 0 as u8); - | ^^^^^ - | | - | function or associated item not found in `dyn BitXor<_>` - | help: there is a method with a similar name: `bitxor` + | ^^^^^ function or associated item not found in `dyn BitXor<_>` + | +help: there is a method `bitxor` with a similar name, but with different arguments + --> $SRC_DIR/core/src/ops/bit.rs:LL:COL warning: trait objects without an explicit `dyn` are deprecated --> $DIR/issue-28344.rs:10:13 @@ -50,10 +50,10 @@ error[E0599]: no function or associated item named `bitor` found for trait objec --> $DIR/issue-28344.rs:10:21 | LL | let g = BitXor::bitor; - | ^^^^^ - | | - | function or associated item not found in `dyn BitXor<_>` - | help: there is a method with a similar name: `bitxor` + | ^^^^^ function or associated item not found in `dyn BitXor<_>` + | +help: there is a method `bitxor` with a similar name, but with different arguments + --> $SRC_DIR/core/src/ops/bit.rs:LL:COL error: aborting due to 4 previous errors; 2 warnings emitted diff --git a/tests/ui/issues/issue-39175.stderr b/tests/ui/issues/issue-39175.stderr index 1bc11dab327a..bbe8badb6523 100644 --- a/tests/ui/issues/issue-39175.stderr +++ b/tests/ui/issues/issue-39175.stderr @@ -2,10 +2,12 @@ error[E0599]: no method named `exec` found for mutable reference `&mut Command` --> $DIR/issue-39175.rs:14:39 | LL | Command::new("echo").arg("hello").exec(); - | ^^^^ method not found in `&mut Command` + | ^^^^ | = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: there is a method `pre_exec` with a similar name, but with different arguments + --> $SRC_DIR/std/src/os/unix/process.rs:LL:COL +help: trait `CommandExt` which provides `exec` is implemented but not in scope; perhaps you want to import it | LL + use std::os::unix::process::CommandExt; | diff --git a/tests/ui/issues/issue-56175.stderr b/tests/ui/issues/issue-56175.stderr index 1ddee1f4895b..6ed35c3a3d3a 100644 --- a/tests/ui/issues/issue-56175.stderr +++ b/tests/ui/issues/issue-56175.stderr @@ -2,7 +2,7 @@ error[E0599]: no method named `trait_method` found for struct `FooStruct` in the --> $DIR/issue-56175.rs:5:33 | LL | reexported_trait::FooStruct.trait_method(); - | ^^^^^^^^^^^^ method not found in `FooStruct` + | ^^^^^^^^^^^^ | ::: $DIR/auxiliary/reexported-trait.rs:3:12 | @@ -10,16 +10,20 @@ LL | fn trait_method(&self) { | ------------ the method is available for `FooStruct` here | = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `Trait` which provides `trait_method` is implemented but not in scope; perhaps you want to import it | LL + use reexported_trait::Trait; | +help: there is a method `trait_method_b` with a similar name + | +LL | reexported_trait::FooStruct.trait_method_b(); + | ~~~~~~~~~~~~~~ error[E0599]: no method named `trait_method_b` found for struct `FooStruct` in the current scope --> $DIR/issue-56175.rs:7:33 | LL | reexported_trait::FooStruct.trait_method_b(); - | ^^^^^^^^^^^^^^ method not found in `FooStruct` + | ^^^^^^^^^^^^^^ | ::: $DIR/auxiliary/reexported-trait.rs:7:12 | @@ -27,10 +31,14 @@ LL | fn trait_method_b(&self) { | -------------- the method is available for `FooStruct` here | = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `TraitB` which provides `trait_method_b` is implemented but not in scope; perhaps you want to import it | LL + use reexported_trait::TraitBRename; | +help: there is a method `trait_method` with a similar name + | +LL | reexported_trait::FooStruct.trait_method(); + | ~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/issues/issue-59494.rs b/tests/ui/issues/issue-59494.rs index 8dcdd88c618c..b4d50bd4ce79 100644 --- a/tests/ui/issues/issue-59494.rs +++ b/tests/ui/issues/issue-59494.rs @@ -18,6 +18,6 @@ fn main() { let f = |(_, _)| {}; let g = |(a, _)| a; let t7 = |env| |a| |b| t7p(f, g)(((env, a), b)); + //~^ ERROR mismatched types let t8 = t8n(t7, t7p(f, g)); - //~^ ERROR: expected a `Fn(_)` closure, found `impl Fn(((_, _), _))` [E0277] } diff --git a/tests/ui/issues/issue-59494.stderr b/tests/ui/issues/issue-59494.stderr index 960de1be299e..33d3e48c1aac 100644 --- a/tests/ui/issues/issue-59494.stderr +++ b/tests/ui/issues/issue-59494.stderr @@ -1,18 +1,9 @@ -error[E0277]: expected a `Fn(_)` closure, found `impl Fn(((_, _), _))` - --> $DIR/issue-59494.rs:21:22 +error[E0308]: mismatched types + --> $DIR/issue-59494.rs:20:40 | -LL | let t8 = t8n(t7, t7p(f, g)); - | --- ^^^^^^^^^ expected an `Fn(_)` closure, found `impl Fn(((_, _), _))` - | | - | required by a bound introduced by this call - | - = help: the trait `Fn<(_,)>` is not implemented for `impl Fn(((_, _), _))` -note: required by a bound in `t8n` - --> $DIR/issue-59494.rs:5:45 - | -LL | fn t8n(f: impl Fn(A) -> B, g: impl Fn(A) -> C) -> impl Fn(A) -> (B, C) - | ^^^^^^^^^^ required by this bound in `t8n` +LL | let t7 = |env| |a| |b| t7p(f, g)(((env, a), b)); + | ^^^ cyclic type of infinite size error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0277`. +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/lazy-type-alias/inherent-impls-overflow.classic.stderr b/tests/ui/lazy-type-alias/inherent-impls-overflow.classic.stderr index 1cace470627e..2f00a877142c 100644 --- a/tests/ui/lazy-type-alias/inherent-impls-overflow.classic.stderr +++ b/tests/ui/lazy-type-alias/inherent-impls-overflow.classic.stderr @@ -1,4 +1,4 @@ -error[E0275]: overflow evaluating the requirement `Loop` +error[E0275]: overflow normalizing the type alias `Loop` --> $DIR/inherent-impls-overflow.rs:7:13 | LL | type Loop = Loop; @@ -6,7 +6,7 @@ LL | type Loop = Loop; | = note: in case this is a recursive type alias, consider using a struct, enum, or union instead -error[E0275]: overflow evaluating the requirement `Loop` +error[E0275]: overflow normalizing the type alias `Loop` --> $DIR/inherent-impls-overflow.rs:9:1 | LL | impl Loop {} @@ -14,24 +14,24 @@ LL | impl Loop {} | = note: in case this is a recursive type alias, consider using a struct, enum, or union instead -error[E0275]: overflow evaluating the requirement `Poly0<((((((...,),),),),),)>` - --> $DIR/inherent-impls-overflow.rs:11:17 +error[E0275]: overflow normalizing the type alias `Poly0<(((((((...,),),),),),),)>` + --> $DIR/inherent-impls-overflow.rs:13:17 | LL | type Poly0 = Poly1<(T,)>; | ^^^^^^^^^^^ | = note: in case this is a recursive type alias, consider using a struct, enum, or union instead -error[E0275]: overflow evaluating the requirement `Poly1<((((((...,),),),),),)>` - --> $DIR/inherent-impls-overflow.rs:14:17 +error[E0275]: overflow normalizing the type alias `Poly1<(((((((...,),),),),),),)>` + --> $DIR/inherent-impls-overflow.rs:16:17 | LL | type Poly1 = Poly0<(T,)>; | ^^^^^^^^^^^ | = note: in case this is a recursive type alias, consider using a struct, enum, or union instead -error[E0275]: overflow evaluating the requirement `Poly1<((((((...,),),),),),)>` - --> $DIR/inherent-impls-overflow.rs:18:1 +error[E0275]: overflow normalizing the type alias `Poly1<(((((((...,),),),),),),)>` + --> $DIR/inherent-impls-overflow.rs:20:1 | LL | impl Poly0<()> {} | ^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/lazy-type-alias/inherent-impls-overflow.next.stderr b/tests/ui/lazy-type-alias/inherent-impls-overflow.next.stderr index 1a6259b5cf90..85e8061f173a 100644 --- a/tests/ui/lazy-type-alias/inherent-impls-overflow.next.stderr +++ b/tests/ui/lazy-type-alias/inherent-impls-overflow.next.stderr @@ -7,7 +7,7 @@ LL | impl Loop {} = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`inherent_impls_overflow`) error[E0392]: type parameter `T` is never used - --> $DIR/inherent-impls-overflow.rs:11:12 + --> $DIR/inherent-impls-overflow.rs:13:12 | LL | type Poly0 = Poly1<(T,)>; | ^ unused type parameter @@ -16,7 +16,7 @@ LL | type Poly0 = Poly1<(T,)>; = help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead error[E0392]: type parameter `T` is never used - --> $DIR/inherent-impls-overflow.rs:14:12 + --> $DIR/inherent-impls-overflow.rs:16:12 | LL | type Poly1 = Poly0<(T,)>; | ^ unused type parameter @@ -25,7 +25,7 @@ LL | type Poly1 = Poly0<(T,)>; = help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead error[E0275]: overflow evaluating the requirement `Poly0<()> == _` - --> $DIR/inherent-impls-overflow.rs:18:6 + --> $DIR/inherent-impls-overflow.rs:20:6 | LL | impl Poly0<()> {} | ^^^^^^^^^ diff --git a/tests/ui/lazy-type-alias/inherent-impls-overflow.rs b/tests/ui/lazy-type-alias/inherent-impls-overflow.rs index b260dedeb074..dbf5c3743e88 100644 --- a/tests/ui/lazy-type-alias/inherent-impls-overflow.rs +++ b/tests/ui/lazy-type-alias/inherent-impls-overflow.rs @@ -4,17 +4,21 @@ #![feature(lazy_type_alias)] #![allow(incomplete_features)] -type Loop = Loop; //[classic]~ ERROR overflow evaluating the requirement +type Loop = Loop; //[classic]~ ERROR overflow normalizing the type alias `Loop` -impl Loop {} //~ ERROR overflow evaluating the requirement +impl Loop {} +//[classic]~^ ERROR overflow normalizing the type alias `Loop` +//[next]~^^ ERROR overflow evaluating the requirement `Loop == _` type Poly0 = Poly1<(T,)>; -//[classic]~^ ERROR overflow evaluating the requirement +//[classic]~^ ERROR overflow normalizing the type alias `Poly0<(((((((...,),),),),),),)>` //[next]~^^ ERROR type parameter `T` is never used type Poly1 = Poly0<(T,)>; -//[classic]~^ ERROR overflow evaluating the requirement +//[classic]~^ ERROR overflow normalizing the type alias `Poly1<(((((((...,),),),),),),)>` //[next]~^^ ERROR type parameter `T` is never used -impl Poly0<()> {} //~ ERROR overflow evaluating the requirement +impl Poly0<()> {} +//[classic]~^ ERROR overflow normalizing the type alias `Poly1<(((((((...,),),),),),),)>` +//[next]~^^ ERROR overflow evaluating the requirement `Poly0<()> == _` fn main() {} diff --git a/tests/ui/lint/lint-overflowing-ops.noopt.stderr b/tests/ui/lint/lint-overflowing-ops.noopt.stderr index 93fc19ce79e4..1b7b73cec38d 100644 --- a/tests/ui/lint/lint-overflowing-ops.noopt.stderr +++ b/tests/ui/lint/lint-overflowing-ops.noopt.stderr @@ -1,5 +1,5 @@ error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:26:14 + --> $DIR/lint-overflowing-ops.rs:28:14 | LL | let _n = 1u8 << 8; | ^^^^^^^^ attempt to shift left by `8_i32`, which would overflow @@ -11,427 +11,445 @@ LL | #![deny(arithmetic_overflow)] | ^^^^^^^^^^^^^^^^^^^ error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:212:15 - | -LL | let _n = &(usize::MAX * 5); - | ^^^^^^^^^^^^^^^^ attempt to compute `usize::MAX * 5_usize`, which would overflow - -error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:209:15 + --> $DIR/lint-overflowing-ops.rs:226:15 | LL | let _n = &(isize::MAX * 5); | ^^^^^^^^^^^^^^^^ attempt to compute `isize::MAX * 5_isize`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:206:15 + --> $DIR/lint-overflowing-ops.rs:223:15 | LL | let _n = &(i128::MAX * 5); | ^^^^^^^^^^^^^^^ attempt to compute `i128::MAX * 5_i128`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:203:15 + --> $DIR/lint-overflowing-ops.rs:220:15 | LL | let _n = &(i64::MAX * 5); | ^^^^^^^^^^^^^^ attempt to compute `i64::MAX * 5_i64`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:200:15 + --> $DIR/lint-overflowing-ops.rs:217:15 | LL | let _n = &(i32::MAX * 5); | ^^^^^^^^^^^^^^ attempt to compute `i32::MAX * 5_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:197:15 + --> $DIR/lint-overflowing-ops.rs:214:15 | LL | let _n = &(i16::MAX * 5); | ^^^^^^^^^^^^^^ attempt to compute `i16::MAX * 5_i16`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:194:15 + --> $DIR/lint-overflowing-ops.rs:211:15 | LL | let _n = &(i8::MAX * i8::MAX); | ^^^^^^^^^^^^^^^^^^^ attempt to compute `i8::MAX * i8::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:191:15 + --> $DIR/lint-overflowing-ops.rs:208:15 + | +LL | let _n = &(usize::MAX * 5); + | ^^^^^^^^^^^^^^^^ attempt to compute `usize::MAX * 5_usize`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:205:15 | LL | let _n = &(u128::MAX * 5); | ^^^^^^^^^^^^^^^ attempt to compute `u128::MAX * 5_u128`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:188:15 + --> $DIR/lint-overflowing-ops.rs:202:15 | LL | let _n = &(u64::MAX * 5); | ^^^^^^^^^^^^^^ attempt to compute `u64::MAX * 5_u64`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:185:15 + --> $DIR/lint-overflowing-ops.rs:199:15 | LL | let _n = &(u32::MAX * 5); | ^^^^^^^^^^^^^^ attempt to compute `u32::MAX * 5_u32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:182:15 + --> $DIR/lint-overflowing-ops.rs:196:15 | LL | let _n = &(u16::MAX * 5); | ^^^^^^^^^^^^^^ attempt to compute `u16::MAX * 5_u16`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:179:15 + --> $DIR/lint-overflowing-ops.rs:193:15 | LL | let _n = &(u8::MAX * 5); | ^^^^^^^^^^^^^ attempt to compute `u8::MAX * 5_u8`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:174:15 + --> $DIR/lint-overflowing-ops.rs:188:15 + | +LL | let _n = &(-i8::MIN); + | ^^^^^^^^^^ attempt to negate `i8::MIN`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:185:15 | LL | let _n = &(1usize - 5); | ^^^^^^^^^^^^ attempt to compute `1_usize - 5_usize`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:171:15 + --> $DIR/lint-overflowing-ops.rs:182:15 | LL | let _n = &(-5isize - isize::MAX); | ^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `-5_isize - isize::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:168:15 + --> $DIR/lint-overflowing-ops.rs:179:15 | LL | let _n = &(-5i128 - i128::MAX); | ^^^^^^^^^^^^^^^^^^^^ attempt to compute `-5_i128 - i128::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:165:15 + --> $DIR/lint-overflowing-ops.rs:176:15 | LL | let _n = &(-5i64 - i64::MAX); | ^^^^^^^^^^^^^^^^^^ attempt to compute `-5_i64 - i64::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:162:15 + --> $DIR/lint-overflowing-ops.rs:173:15 | LL | let _n = &(-5i32 - i32::MAX); | ^^^^^^^^^^^^^^^^^^ attempt to compute `-5_i32 - i32::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:159:15 + --> $DIR/lint-overflowing-ops.rs:170:15 | LL | let _n = &(-5i16 - i16::MAX); | ^^^^^^^^^^^^^^^^^^ attempt to compute `-5_i16 - i16::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:156:15 + --> $DIR/lint-overflowing-ops.rs:167:15 | LL | let _n = &(-5i8 - i8::MAX); | ^^^^^^^^^^^^^^^^ attempt to compute `-5_i8 - i8::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:153:15 + --> $DIR/lint-overflowing-ops.rs:164:15 | LL | let _n = &(1u128 - 5); | ^^^^^^^^^^^ attempt to compute `1_u128 - 5_u128`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:150:15 + --> $DIR/lint-overflowing-ops.rs:161:15 | LL | let _n = &(1u64 - 5); | ^^^^^^^^^^ attempt to compute `1_u64 - 5_u64`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:147:15 + --> $DIR/lint-overflowing-ops.rs:158:15 | LL | let _n = &(1u32 - 5); | ^^^^^^^^^^ attempt to compute `1_u32 - 5_u32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:144:15 + --> $DIR/lint-overflowing-ops.rs:155:15 | LL | let _n = &(1u16 - 5); | ^^^^^^^^^^ attempt to compute `1_u16 - 5_u16`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:141:15 + --> $DIR/lint-overflowing-ops.rs:152:15 | LL | let _n = &(1u8 - 5); | ^^^^^^^^^ attempt to compute `1_u8 - 5_u8`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:136:15 + --> $DIR/lint-overflowing-ops.rs:147:15 | LL | let _n = &(1usize + usize::MAX); | ^^^^^^^^^^^^^^^^^^^^^ attempt to compute `1_usize + usize::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:133:15 + --> $DIR/lint-overflowing-ops.rs:144:15 | LL | let _n = &(1isize + isize::MAX); | ^^^^^^^^^^^^^^^^^^^^^ attempt to compute `1_isize + isize::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:130:15 + --> $DIR/lint-overflowing-ops.rs:141:15 | LL | let _n = &(1i128 + i128::MAX); | ^^^^^^^^^^^^^^^^^^^ attempt to compute `1_i128 + i128::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:127:15 + --> $DIR/lint-overflowing-ops.rs:138:15 | LL | let _n = &(1i64 + i64::MAX); | ^^^^^^^^^^^^^^^^^ attempt to compute `1_i64 + i64::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:124:15 + --> $DIR/lint-overflowing-ops.rs:135:15 | LL | let _n = &(1i32 + i32::MAX); | ^^^^^^^^^^^^^^^^^ attempt to compute `1_i32 + i32::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:121:15 + --> $DIR/lint-overflowing-ops.rs:132:15 | LL | let _n = &(1i16 + i16::MAX); | ^^^^^^^^^^^^^^^^^ attempt to compute `1_i16 + i16::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:118:15 + --> $DIR/lint-overflowing-ops.rs:129:15 | LL | let _n = &(1i8 + i8::MAX); | ^^^^^^^^^^^^^^^ attempt to compute `1_i8 + i8::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:115:15 + --> $DIR/lint-overflowing-ops.rs:126:15 | LL | let _n = &(1u128 + u128::MAX); | ^^^^^^^^^^^^^^^^^^^ attempt to compute `1_u128 + u128::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:112:15 + --> $DIR/lint-overflowing-ops.rs:123:15 | LL | let _n = &(1u64 + u64::MAX); | ^^^^^^^^^^^^^^^^^ attempt to compute `1_u64 + u64::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:109:15 + --> $DIR/lint-overflowing-ops.rs:120:15 | LL | let _n = &(1u32 + u32::MAX); | ^^^^^^^^^^^^^^^^^ attempt to compute `1_u32 + u32::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:106:15 + --> $DIR/lint-overflowing-ops.rs:117:15 | LL | let _n = &(1u16 + u16::MAX); | ^^^^^^^^^^^^^^^^^ attempt to compute `1_u16 + u16::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:103:15 + --> $DIR/lint-overflowing-ops.rs:114:15 | LL | let _n = &(1u8 + u8::MAX); | ^^^^^^^^^^^^^^^ attempt to compute `1_u8 + u8::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:98:15 + --> $DIR/lint-overflowing-ops.rs:110:15 + | +LL | let _n = &(1i64 >> [64][0]); + | ^^^^^^^^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:107:15 | LL | let _n = &(1_usize >> BITS); | ^^^^^^^^^^^^^^^^^ attempt to shift right by `%BITS%`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:95:15 + --> $DIR/lint-overflowing-ops.rs:104:15 | LL | let _n = &(1_isize >> BITS); | ^^^^^^^^^^^^^^^^^ attempt to shift right by `%BITS%`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:92:15 + --> $DIR/lint-overflowing-ops.rs:101:15 | LL | let _n = &(1i128 >> 128); | ^^^^^^^^^^^^^^ attempt to shift right by `128_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:89:15 + --> $DIR/lint-overflowing-ops.rs:98:15 | LL | let _n = &(1i64 >> 64); | ^^^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:86:15 + --> $DIR/lint-overflowing-ops.rs:95:15 | LL | let _n = &(1i32 >> 32); | ^^^^^^^^^^^^ attempt to shift right by `32_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:83:15 + --> $DIR/lint-overflowing-ops.rs:92:15 | LL | let _n = &(1i16 >> 16); | ^^^^^^^^^^^^ attempt to shift right by `16_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:80:15 + --> $DIR/lint-overflowing-ops.rs:89:15 | LL | let _n = &(1i8 >> 8); | ^^^^^^^^^^ attempt to shift right by `8_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:77:15 + --> $DIR/lint-overflowing-ops.rs:86:15 | LL | let _n = &(1u128 >> 128); | ^^^^^^^^^^^^^^ attempt to shift right by `128_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:74:15 + --> $DIR/lint-overflowing-ops.rs:83:15 | LL | let _n = &(1u64 >> 64); | ^^^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:71:15 + --> $DIR/lint-overflowing-ops.rs:80:15 | LL | let _n = &(1u32 >> 32); | ^^^^^^^^^^^^ attempt to shift right by `32_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:68:15 + --> $DIR/lint-overflowing-ops.rs:77:15 | LL | let _n = &(1u16 >> 16); | ^^^^^^^^^^^^ attempt to shift right by `16_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:65:15 + --> $DIR/lint-overflowing-ops.rs:74:15 | LL | let _n = &(1u8 >> 8); | ^^^^^^^^^^ attempt to shift right by `8_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:60:15 + --> $DIR/lint-overflowing-ops.rs:65:15 + | +LL | let _n = &(1 << -1); + | ^^^^^^^^^ attempt to shift left by `-1_i32`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:62:15 | LL | let _n = &(1_usize << BITS); | ^^^^^^^^^^^^^^^^^ attempt to shift left by `%BITS%`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:57:15 + --> $DIR/lint-overflowing-ops.rs:59:15 | LL | let _n = &(1_isize << BITS); | ^^^^^^^^^^^^^^^^^ attempt to shift left by `%BITS%`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:54:15 + --> $DIR/lint-overflowing-ops.rs:56:15 | LL | let _n = &(1i128 << 128); | ^^^^^^^^^^^^^^ attempt to shift left by `128_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:51:15 + --> $DIR/lint-overflowing-ops.rs:53:15 | LL | let _n = &(1i64 << 64); | ^^^^^^^^^^^^ attempt to shift left by `64_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:48:15 + --> $DIR/lint-overflowing-ops.rs:50:15 | LL | let _n = &(1i32 << 32); | ^^^^^^^^^^^^ attempt to shift left by `32_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:45:15 + --> $DIR/lint-overflowing-ops.rs:47:15 | LL | let _n = &(1i16 << 16); | ^^^^^^^^^^^^ attempt to shift left by `16_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:42:15 + --> $DIR/lint-overflowing-ops.rs:44:15 | LL | let _n = &(1i8 << 8); | ^^^^^^^^^^ attempt to shift left by `8_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:39:15 + --> $DIR/lint-overflowing-ops.rs:41:15 | LL | let _n = &(1u128 << 128); | ^^^^^^^^^^^^^^ attempt to shift left by `128_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:36:15 + --> $DIR/lint-overflowing-ops.rs:38:15 | LL | let _n = &(1u64 << 64); | ^^^^^^^^^^^^ attempt to shift left by `64_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:33:15 + --> $DIR/lint-overflowing-ops.rs:35:15 | LL | let _n = &(1u32 << 32); | ^^^^^^^^^^^^ attempt to shift left by `32_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:30:15 + --> $DIR/lint-overflowing-ops.rs:32:15 | LL | let _n = &(1u16 << 16); | ^^^^^^^^^^^^ attempt to shift left by `16_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:27:15 + --> $DIR/lint-overflowing-ops.rs:29:15 | LL | let _n = &(1u8 << 8); | ^^^^^^^^^^ attempt to shift left by `8_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:29:14 + --> $DIR/lint-overflowing-ops.rs:31:14 | LL | let _n = 1u16 << 16; | ^^^^^^^^^^ attempt to shift left by `16_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:32:14 + --> $DIR/lint-overflowing-ops.rs:34:14 | LL | let _n = 1u32 << 32; | ^^^^^^^^^^ attempt to shift left by `32_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:35:14 + --> $DIR/lint-overflowing-ops.rs:37:14 | LL | let _n = 1u64 << 64; | ^^^^^^^^^^ attempt to shift left by `64_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:38:14 + --> $DIR/lint-overflowing-ops.rs:40:14 | LL | let _n = 1u128 << 128; | ^^^^^^^^^^^^ attempt to shift left by `128_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:41:14 + --> $DIR/lint-overflowing-ops.rs:43:14 | LL | let _n = 1i8 << 8; | ^^^^^^^^ attempt to shift left by `8_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:44:14 + --> $DIR/lint-overflowing-ops.rs:46:14 | LL | let _n = 1i16 << 16; | ^^^^^^^^^^ attempt to shift left by `16_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:47:14 + --> $DIR/lint-overflowing-ops.rs:49:14 | LL | let _n = 1i32 << 32; | ^^^^^^^^^^ attempt to shift left by `32_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:50:14 + --> $DIR/lint-overflowing-ops.rs:52:14 | LL | let _n = 1i64 << 64; | ^^^^^^^^^^ attempt to shift left by `64_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:53:14 + --> $DIR/lint-overflowing-ops.rs:55:14 | LL | let _n = 1i128 << 128; | ^^^^^^^^^^^^ attempt to shift left by `128_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:56:14 + --> $DIR/lint-overflowing-ops.rs:58:14 | LL | let _n = 1_isize << BITS; | ^^^^^^^^^^^^^^^ attempt to shift left by `%BITS%`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:59:14 + --> $DIR/lint-overflowing-ops.rs:61:14 | LL | let _n = 1_usize << BITS; | ^^^^^^^^^^^^^^^ attempt to shift left by `%BITS%`, which would overflow @@ -439,293 +457,329 @@ LL | let _n = 1_usize << BITS; error: this arithmetic operation will overflow --> $DIR/lint-overflowing-ops.rs:64:14 | +LL | let _n = 1 << -1; + | ^^^^^^^ attempt to shift left by `-1_i32`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:69:14 + | +LL | let _n = -1_i64 >> 64; + | ^^^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:70:14 + | +LL | let _n = -1_i32 >> 32; + | ^^^^^^^^^^^^ attempt to shift right by `32_i32`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:71:14 + | +LL | let _n = -1_i32 >> -1; + | ^^^^^^^^^^^^ attempt to shift right by `-1_i32`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:73:14 + | LL | let _n = 1u8 >> 8; | ^^^^^^^^ attempt to shift right by `8_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:67:14 + --> $DIR/lint-overflowing-ops.rs:76:14 | LL | let _n = 1u16 >> 16; | ^^^^^^^^^^ attempt to shift right by `16_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:70:14 + --> $DIR/lint-overflowing-ops.rs:79:14 | LL | let _n = 1u32 >> 32; | ^^^^^^^^^^ attempt to shift right by `32_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:73:14 + --> $DIR/lint-overflowing-ops.rs:82:14 | LL | let _n = 1u64 >> 64; | ^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:76:14 + --> $DIR/lint-overflowing-ops.rs:85:14 | LL | let _n = 1u128 >> 128; | ^^^^^^^^^^^^ attempt to shift right by `128_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:79:14 + --> $DIR/lint-overflowing-ops.rs:88:14 | LL | let _n = 1i8 >> 8; | ^^^^^^^^ attempt to shift right by `8_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:82:14 + --> $DIR/lint-overflowing-ops.rs:91:14 | LL | let _n = 1i16 >> 16; | ^^^^^^^^^^ attempt to shift right by `16_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:85:14 + --> $DIR/lint-overflowing-ops.rs:94:14 | LL | let _n = 1i32 >> 32; | ^^^^^^^^^^ attempt to shift right by `32_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:88:14 + --> $DIR/lint-overflowing-ops.rs:97:14 | LL | let _n = 1i64 >> 64; | ^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:91:14 + --> $DIR/lint-overflowing-ops.rs:100:14 | LL | let _n = 1i128 >> 128; | ^^^^^^^^^^^^ attempt to shift right by `128_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:94:14 + --> $DIR/lint-overflowing-ops.rs:103:14 | LL | let _n = 1_isize >> BITS; | ^^^^^^^^^^^^^^^ attempt to shift right by `%BITS%`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:97:14 + --> $DIR/lint-overflowing-ops.rs:106:14 | LL | let _n = 1_usize >> BITS; | ^^^^^^^^^^^^^^^ attempt to shift right by `%BITS%`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:102:14 + --> $DIR/lint-overflowing-ops.rs:109:14 + | +LL | let _n = 1i64 >> [64][0]; + | ^^^^^^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:113:14 | LL | let _n = 1u8 + u8::MAX; | ^^^^^^^^^^^^^ attempt to compute `1_u8 + u8::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:105:14 + --> $DIR/lint-overflowing-ops.rs:116:14 | LL | let _n = 1u16 + u16::MAX; | ^^^^^^^^^^^^^^^ attempt to compute `1_u16 + u16::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:108:14 + --> $DIR/lint-overflowing-ops.rs:119:14 | LL | let _n = 1u32 + u32::MAX; | ^^^^^^^^^^^^^^^ attempt to compute `1_u32 + u32::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:111:14 + --> $DIR/lint-overflowing-ops.rs:122:14 | LL | let _n = 1u64 + u64::MAX; | ^^^^^^^^^^^^^^^ attempt to compute `1_u64 + u64::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:114:14 + --> $DIR/lint-overflowing-ops.rs:125:14 | LL | let _n = 1u128 + u128::MAX; | ^^^^^^^^^^^^^^^^^ attempt to compute `1_u128 + u128::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:117:14 + --> $DIR/lint-overflowing-ops.rs:128:14 | LL | let _n = 1i8 + i8::MAX; | ^^^^^^^^^^^^^ attempt to compute `1_i8 + i8::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:120:14 + --> $DIR/lint-overflowing-ops.rs:131:14 | LL | let _n = 1i16 + i16::MAX; | ^^^^^^^^^^^^^^^ attempt to compute `1_i16 + i16::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:123:14 + --> $DIR/lint-overflowing-ops.rs:134:14 | LL | let _n = 1i32 + i32::MAX; | ^^^^^^^^^^^^^^^ attempt to compute `1_i32 + i32::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:126:14 + --> $DIR/lint-overflowing-ops.rs:137:14 | LL | let _n = 1i64 + i64::MAX; | ^^^^^^^^^^^^^^^ attempt to compute `1_i64 + i64::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:129:14 + --> $DIR/lint-overflowing-ops.rs:140:14 | LL | let _n = 1i128 + i128::MAX; | ^^^^^^^^^^^^^^^^^ attempt to compute `1_i128 + i128::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:132:14 + --> $DIR/lint-overflowing-ops.rs:143:14 | LL | let _n = 1isize + isize::MAX; | ^^^^^^^^^^^^^^^^^^^ attempt to compute `1_isize + isize::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:135:14 + --> $DIR/lint-overflowing-ops.rs:146:14 | LL | let _n = 1usize + usize::MAX; | ^^^^^^^^^^^^^^^^^^^ attempt to compute `1_usize + usize::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:140:14 + --> $DIR/lint-overflowing-ops.rs:151:14 | LL | let _n = 1u8 - 5; | ^^^^^^^ attempt to compute `1_u8 - 5_u8`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:143:14 + --> $DIR/lint-overflowing-ops.rs:154:14 | LL | let _n = 1u16 - 5; | ^^^^^^^^ attempt to compute `1_u16 - 5_u16`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:146:14 + --> $DIR/lint-overflowing-ops.rs:157:14 | LL | let _n = 1u32 - 5; | ^^^^^^^^ attempt to compute `1_u32 - 5_u32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:149:14 + --> $DIR/lint-overflowing-ops.rs:160:14 | LL | let _n = 1u64 - 5 ; | ^^^^^^^^ attempt to compute `1_u64 - 5_u64`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:152:14 + --> $DIR/lint-overflowing-ops.rs:163:14 | LL | let _n = 1u128 - 5 ; | ^^^^^^^^^ attempt to compute `1_u128 - 5_u128`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:155:14 + --> $DIR/lint-overflowing-ops.rs:166:14 | LL | let _n = -5i8 - i8::MAX; | ^^^^^^^^^^^^^^ attempt to compute `-5_i8 - i8::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:158:14 + --> $DIR/lint-overflowing-ops.rs:169:14 | LL | let _n = -5i16 - i16::MAX; | ^^^^^^^^^^^^^^^^ attempt to compute `-5_i16 - i16::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:161:14 + --> $DIR/lint-overflowing-ops.rs:172:14 | LL | let _n = -5i32 - i32::MAX; | ^^^^^^^^^^^^^^^^ attempt to compute `-5_i32 - i32::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:164:14 + --> $DIR/lint-overflowing-ops.rs:175:14 | LL | let _n = -5i64 - i64::MAX; | ^^^^^^^^^^^^^^^^ attempt to compute `-5_i64 - i64::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:167:14 + --> $DIR/lint-overflowing-ops.rs:178:14 | LL | let _n = -5i128 - i128::MAX; | ^^^^^^^^^^^^^^^^^^ attempt to compute `-5_i128 - i128::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:170:14 + --> $DIR/lint-overflowing-ops.rs:181:14 | LL | let _n = -5isize - isize::MAX; | ^^^^^^^^^^^^^^^^^^^^ attempt to compute `-5_isize - isize::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:173:14 + --> $DIR/lint-overflowing-ops.rs:184:14 | LL | let _n = 1usize - 5; | ^^^^^^^^^^ attempt to compute `1_usize - 5_usize`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:178:14 + --> $DIR/lint-overflowing-ops.rs:187:14 + | +LL | let _n = -i8::MIN; + | ^^^^^^^^ attempt to negate `i8::MIN`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:192:14 | LL | let _n = u8::MAX * 5; | ^^^^^^^^^^^ attempt to compute `u8::MAX * 5_u8`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:181:14 + --> $DIR/lint-overflowing-ops.rs:195:14 | LL | let _n = u16::MAX * 5; | ^^^^^^^^^^^^ attempt to compute `u16::MAX * 5_u16`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:184:14 + --> $DIR/lint-overflowing-ops.rs:198:14 | LL | let _n = u32::MAX * 5; | ^^^^^^^^^^^^ attempt to compute `u32::MAX * 5_u32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:187:14 + --> $DIR/lint-overflowing-ops.rs:201:14 | LL | let _n = u64::MAX * 5; | ^^^^^^^^^^^^ attempt to compute `u64::MAX * 5_u64`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:190:14 + --> $DIR/lint-overflowing-ops.rs:204:14 | LL | let _n = u128::MAX * 5; | ^^^^^^^^^^^^^ attempt to compute `u128::MAX * 5_u128`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:193:14 + --> $DIR/lint-overflowing-ops.rs:207:14 + | +LL | let _n = usize::MAX * 5; + | ^^^^^^^^^^^^^^ attempt to compute `usize::MAX * 5_usize`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:210:14 | LL | let _n = i8::MAX * i8::MAX; | ^^^^^^^^^^^^^^^^^ attempt to compute `i8::MAX * i8::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:196:14 + --> $DIR/lint-overflowing-ops.rs:213:14 | LL | let _n = i16::MAX * 5; | ^^^^^^^^^^^^ attempt to compute `i16::MAX * 5_i16`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:199:14 + --> $DIR/lint-overflowing-ops.rs:216:14 | LL | let _n = i32::MAX * 5; | ^^^^^^^^^^^^ attempt to compute `i32::MAX * 5_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:202:14 + --> $DIR/lint-overflowing-ops.rs:219:14 | LL | let _n = i64::MAX * 5; | ^^^^^^^^^^^^ attempt to compute `i64::MAX * 5_i64`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:205:14 + --> $DIR/lint-overflowing-ops.rs:222:14 | LL | let _n = i128::MAX * 5; | ^^^^^^^^^^^^^ attempt to compute `i128::MAX * 5_i128`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:208:14 + --> $DIR/lint-overflowing-ops.rs:225:14 | LL | let _n = isize::MAX * 5; | ^^^^^^^^^^^^^^ attempt to compute `isize::MAX * 5_isize`, which would overflow -error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:211:14 - | -LL | let _n = usize::MAX * 5; - | ^^^^^^^^^^^^^^ attempt to compute `usize::MAX * 5_usize`, which would overflow - error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:216:14 + --> $DIR/lint-overflowing-ops.rs:230:14 | LL | let _n = 1u8 / 0; | ^^^^^^^ attempt to divide `1_u8` by zero @@ -733,298 +787,442 @@ LL | let _n = 1u8 / 0; = note: `#[deny(unconditional_panic)]` on by default error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:217:15 + --> $DIR/lint-overflowing-ops.rs:231:15 | LL | let _n = &(1u8 / 0); | ^^^^^^^^^ attempt to divide `1_u8` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:219:14 + --> $DIR/lint-overflowing-ops.rs:233:14 | LL | let _n = 1u16 / 0; | ^^^^^^^^ attempt to divide `1_u16` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:220:15 + --> $DIR/lint-overflowing-ops.rs:234:15 | LL | let _n = &(1u16 / 0); | ^^^^^^^^^^ attempt to divide `1_u16` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:222:14 + --> $DIR/lint-overflowing-ops.rs:236:14 | LL | let _n = 1u32 / 0; | ^^^^^^^^ attempt to divide `1_u32` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:223:15 + --> $DIR/lint-overflowing-ops.rs:237:15 | LL | let _n = &(1u32 / 0); | ^^^^^^^^^^ attempt to divide `1_u32` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:225:14 + --> $DIR/lint-overflowing-ops.rs:239:14 | LL | let _n = 1u64 / 0; | ^^^^^^^^ attempt to divide `1_u64` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:226:15 + --> $DIR/lint-overflowing-ops.rs:240:15 | LL | let _n = &(1u64 / 0); | ^^^^^^^^^^ attempt to divide `1_u64` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:228:14 + --> $DIR/lint-overflowing-ops.rs:242:14 | LL | let _n = 1u128 / 0; | ^^^^^^^^^ attempt to divide `1_u128` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:229:15 + --> $DIR/lint-overflowing-ops.rs:243:15 | LL | let _n = &(1u128 / 0); | ^^^^^^^^^^^ attempt to divide `1_u128` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:231:14 - | -LL | let _n = 1i8 / 0; - | ^^^^^^^ attempt to divide `1_i8` by zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:232:15 - | -LL | let _n = &(1i8 / 0); - | ^^^^^^^^^ attempt to divide `1_i8` by zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:234:14 - | -LL | let _n = 1i16 / 0; - | ^^^^^^^^ attempt to divide `1_i16` by zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:235:15 - | -LL | let _n = &(1i16 / 0); - | ^^^^^^^^^^ attempt to divide `1_i16` by zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:237:14 - | -LL | let _n = 1i32 / 0; - | ^^^^^^^^ attempt to divide `1_i32` by zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:238:15 - | -LL | let _n = &(1i32 / 0); - | ^^^^^^^^^^ attempt to divide `1_i32` by zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:240:14 - | -LL | let _n = 1i64 / 0; - | ^^^^^^^^ attempt to divide `1_i64` by zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:241:15 - | -LL | let _n = &(1i64 / 0); - | ^^^^^^^^^^ attempt to divide `1_i64` by zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:243:14 - | -LL | let _n = 1i128 / 0; - | ^^^^^^^^^ attempt to divide `1_i128` by zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:244:15 - | -LL | let _n = &(1i128 / 0); - | ^^^^^^^^^^^ attempt to divide `1_i128` by zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:246:14 - | -LL | let _n = 1isize / 0; - | ^^^^^^^^^^ attempt to divide `1_isize` by zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:247:15 - | -LL | let _n = &(1isize / 0); - | ^^^^^^^^^^^^ attempt to divide `1_isize` by zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:249:14 + --> $DIR/lint-overflowing-ops.rs:245:14 | LL | let _n = 1usize / 0; | ^^^^^^^^^^ attempt to divide `1_usize` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:250:15 + --> $DIR/lint-overflowing-ops.rs:246:15 | LL | let _n = &(1usize / 0); | ^^^^^^^^^^^^ attempt to divide `1_usize` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:254:14 + --> $DIR/lint-overflowing-ops.rs:248:14 + | +LL | let _n = 1i8 / 0; + | ^^^^^^^ attempt to divide `1_i8` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:249:15 + | +LL | let _n = &(1i8 / 0); + | ^^^^^^^^^ attempt to divide `1_i8` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:250:14 + | +LL | let _n = i8::MIN / -1; + | ^^^^^^^^^^^^ attempt to compute `i8::MIN / -1_i8`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:251:15 + | +LL | let _n = &(i8::MIN / -1); + | ^^^^^^^^^^^^^^ attempt to compute `i8::MIN / -1_i8`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:253:14 + | +LL | let _n = 1i16 / 0; + | ^^^^^^^^ attempt to divide `1_i16` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:254:15 + | +LL | let _n = &(1i16 / 0); + | ^^^^^^^^^^ attempt to divide `1_i16` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:255:14 + | +LL | let _n = i16::MIN / -1; + | ^^^^^^^^^^^^^ attempt to compute `i16::MIN / -1_i16`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:256:15 + | +LL | let _n = &(i16::MIN / -1); + | ^^^^^^^^^^^^^^^ attempt to compute `i16::MIN / -1_i16`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:258:14 + | +LL | let _n = 1i32 / 0; + | ^^^^^^^^ attempt to divide `1_i32` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:259:15 + | +LL | let _n = &(1i32 / 0); + | ^^^^^^^^^^ attempt to divide `1_i32` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:260:14 + | +LL | let _n = i32::MIN / -1; + | ^^^^^^^^^^^^^ attempt to compute `i32::MIN / -1_i32`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:261:15 + | +LL | let _n = &(i32::MIN / -1); + | ^^^^^^^^^^^^^^^ attempt to compute `i32::MIN / -1_i32`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:263:14 + | +LL | let _n = 1i64 / 0; + | ^^^^^^^^ attempt to divide `1_i64` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:264:15 + | +LL | let _n = &(1i64 / 0); + | ^^^^^^^^^^ attempt to divide `1_i64` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:265:14 + | +LL | let _n = i64::MIN / -1; + | ^^^^^^^^^^^^^ attempt to compute `i64::MIN / -1_i64`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:266:15 + | +LL | let _n = &(i64::MIN / -1); + | ^^^^^^^^^^^^^^^ attempt to compute `i64::MIN / -1_i64`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:268:14 + | +LL | let _n = 1i128 / 0; + | ^^^^^^^^^ attempt to divide `1_i128` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:269:15 + | +LL | let _n = &(1i128 / 0); + | ^^^^^^^^^^^ attempt to divide `1_i128` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:270:14 + | +LL | let _n = i128::MIN / -1; + | ^^^^^^^^^^^^^^ attempt to compute `i128::MIN / -1_i128`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:271:15 + | +LL | let _n = &(i128::MIN / -1); + | ^^^^^^^^^^^^^^^^ attempt to compute `i128::MIN / -1_i128`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:273:14 + | +LL | let _n = 1isize / 0; + | ^^^^^^^^^^ attempt to divide `1_isize` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:274:15 + | +LL | let _n = &(1isize / 0); + | ^^^^^^^^^^^^ attempt to divide `1_isize` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:275:14 + | +LL | let _n = isize::MIN / -1; + | ^^^^^^^^^^^^^^^ attempt to compute `isize::MIN / -1_isize`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:276:15 + | +LL | let _n = &(isize::MIN / -1); + | ^^^^^^^^^^^^^^^^^ attempt to compute `isize::MIN / -1_isize`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:280:14 | LL | let _n = 1u8 % 0; | ^^^^^^^ attempt to calculate the remainder of `1_u8` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:255:15 + --> $DIR/lint-overflowing-ops.rs:281:15 | LL | let _n = &(1u8 % 0); | ^^^^^^^^^ attempt to calculate the remainder of `1_u8` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:257:14 + --> $DIR/lint-overflowing-ops.rs:283:14 | LL | let _n = 1u16 % 0; | ^^^^^^^^ attempt to calculate the remainder of `1_u16` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:258:15 + --> $DIR/lint-overflowing-ops.rs:284:15 | LL | let _n = &(1u16 % 0); | ^^^^^^^^^^ attempt to calculate the remainder of `1_u16` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:260:14 + --> $DIR/lint-overflowing-ops.rs:286:14 | LL | let _n = 1u32 % 0; | ^^^^^^^^ attempt to calculate the remainder of `1_u32` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:261:15 + --> $DIR/lint-overflowing-ops.rs:287:15 | LL | let _n = &(1u32 % 0); | ^^^^^^^^^^ attempt to calculate the remainder of `1_u32` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:263:14 + --> $DIR/lint-overflowing-ops.rs:289:14 | LL | let _n = 1u64 % 0; | ^^^^^^^^ attempt to calculate the remainder of `1_u64` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:264:15 + --> $DIR/lint-overflowing-ops.rs:290:15 | LL | let _n = &(1u64 % 0); | ^^^^^^^^^^ attempt to calculate the remainder of `1_u64` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:266:14 + --> $DIR/lint-overflowing-ops.rs:292:14 | LL | let _n = 1u128 % 0; | ^^^^^^^^^ attempt to calculate the remainder of `1_u128` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:267:15 + --> $DIR/lint-overflowing-ops.rs:293:15 | LL | let _n = &(1u128 % 0); | ^^^^^^^^^^^ attempt to calculate the remainder of `1_u128` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:269:14 - | -LL | let _n = 1i8 % 0; - | ^^^^^^^ attempt to calculate the remainder of `1_i8` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:270:15 - | -LL | let _n = &(1i8 % 0); - | ^^^^^^^^^ attempt to calculate the remainder of `1_i8` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:272:14 - | -LL | let _n = 1i16 % 0; - | ^^^^^^^^ attempt to calculate the remainder of `1_i16` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:273:15 - | -LL | let _n = &(1i16 % 0); - | ^^^^^^^^^^ attempt to calculate the remainder of `1_i16` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:275:14 - | -LL | let _n = 1i32 % 0; - | ^^^^^^^^ attempt to calculate the remainder of `1_i32` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:276:15 - | -LL | let _n = &(1i32 % 0); - | ^^^^^^^^^^ attempt to calculate the remainder of `1_i32` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:278:14 - | -LL | let _n = 1i64 % 0; - | ^^^^^^^^ attempt to calculate the remainder of `1_i64` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:279:15 - | -LL | let _n = &(1i64 % 0); - | ^^^^^^^^^^ attempt to calculate the remainder of `1_i64` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:281:14 - | -LL | let _n = 1i128 % 0; - | ^^^^^^^^^ attempt to calculate the remainder of `1_i128` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:282:15 - | -LL | let _n = &(1i128 % 0); - | ^^^^^^^^^^^ attempt to calculate the remainder of `1_i128` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:284:14 - | -LL | let _n = 1isize % 0; - | ^^^^^^^^^^ attempt to calculate the remainder of `1_isize` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:285:15 - | -LL | let _n = &(1isize % 0); - | ^^^^^^^^^^^^ attempt to calculate the remainder of `1_isize` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:287:14 + --> $DIR/lint-overflowing-ops.rs:295:14 | LL | let _n = 1usize % 0; | ^^^^^^^^^^ attempt to calculate the remainder of `1_usize` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:288:15 + --> $DIR/lint-overflowing-ops.rs:296:15 | LL | let _n = &(1usize % 0); | ^^^^^^^^^^^^ attempt to calculate the remainder of `1_usize` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:292:14 + --> $DIR/lint-overflowing-ops.rs:298:14 + | +LL | let _n = 1i8 % 0; + | ^^^^^^^ attempt to calculate the remainder of `1_i8` with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:299:15 + | +LL | let _n = &(1i8 % 0); + | ^^^^^^^^^ attempt to calculate the remainder of `1_i8` with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:300:14 + | +LL | let _n = i8::MIN % -1; + | ^^^^^^^^^^^^ attempt to compute `i8::MIN % -1_i8`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:301:15 + | +LL | let _n = &(i8::MIN % -1); + | ^^^^^^^^^^^^^^ attempt to compute `i8::MIN % -1_i8`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:303:14 + | +LL | let _n = 1i16 % 0; + | ^^^^^^^^ attempt to calculate the remainder of `1_i16` with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:304:15 + | +LL | let _n = &(1i16 % 0); + | ^^^^^^^^^^ attempt to calculate the remainder of `1_i16` with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:305:14 + | +LL | let _n = i16::MIN % -1; + | ^^^^^^^^^^^^^ attempt to compute `i16::MIN % -1_i16`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:306:15 + | +LL | let _n = &(i16::MIN % -1); + | ^^^^^^^^^^^^^^^ attempt to compute `i16::MIN % -1_i16`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:308:14 + | +LL | let _n = 1i32 % 0; + | ^^^^^^^^ attempt to calculate the remainder of `1_i32` with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:309:15 + | +LL | let _n = &(1i32 % 0); + | ^^^^^^^^^^ attempt to calculate the remainder of `1_i32` with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:310:14 + | +LL | let _n = i32::MIN % -1; + | ^^^^^^^^^^^^^ attempt to compute `i32::MIN % -1_i32`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:311:15 + | +LL | let _n = &(i32::MIN % -1); + | ^^^^^^^^^^^^^^^ attempt to compute `i32::MIN % -1_i32`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:313:14 + | +LL | let _n = 1i64 % 0; + | ^^^^^^^^ attempt to calculate the remainder of `1_i64` with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:314:15 + | +LL | let _n = &(1i64 % 0); + | ^^^^^^^^^^ attempt to calculate the remainder of `1_i64` with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:315:14 + | +LL | let _n = i64::MIN % -1; + | ^^^^^^^^^^^^^ attempt to compute `i64::MIN % -1_i64`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:316:15 + | +LL | let _n = &(i64::MIN % -1); + | ^^^^^^^^^^^^^^^ attempt to compute `i64::MIN % -1_i64`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:318:14 + | +LL | let _n = 1i128 % 0; + | ^^^^^^^^^ attempt to calculate the remainder of `1_i128` with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:319:15 + | +LL | let _n = &(1i128 % 0); + | ^^^^^^^^^^^ attempt to calculate the remainder of `1_i128` with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:320:14 + | +LL | let _n = i128::MIN % -1; + | ^^^^^^^^^^^^^^ attempt to compute `i128::MIN % -1_i128`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:321:15 + | +LL | let _n = &(i128::MIN % -1); + | ^^^^^^^^^^^^^^^^ attempt to compute `i128::MIN % -1_i128`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:323:14 + | +LL | let _n = 1isize % 0; + | ^^^^^^^^^^ attempt to calculate the remainder of `1_isize` with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:324:15 + | +LL | let _n = &(1isize % 0); + | ^^^^^^^^^^^^ attempt to calculate the remainder of `1_isize` with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:325:14 + | +LL | let _n = isize::MIN % -1; + | ^^^^^^^^^^^^^^^ attempt to compute `isize::MIN % -1_isize`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:326:15 + | +LL | let _n = &(isize::MIN % -1); + | ^^^^^^^^^^^^^^^^^ attempt to compute `isize::MIN % -1_isize`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:329:14 | LL | let _n = [1, 2, 3][4]; | ^^^^^^^^^^^^ index out of bounds: the length is 3 but the index is 4 error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:293:15 + --> $DIR/lint-overflowing-ops.rs:330:15 | LL | let _n = &([1, 2, 3][4]); | ^^^^^^^^^^^^^^ index out of bounds: the length is 3 but the index is 4 -error: aborting due to 170 previous errors +error: aborting due to 203 previous errors diff --git a/tests/ui/lint/lint-overflowing-ops.opt.stderr b/tests/ui/lint/lint-overflowing-ops.opt.stderr index 93fc19ce79e4..1b7b73cec38d 100644 --- a/tests/ui/lint/lint-overflowing-ops.opt.stderr +++ b/tests/ui/lint/lint-overflowing-ops.opt.stderr @@ -1,5 +1,5 @@ error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:26:14 + --> $DIR/lint-overflowing-ops.rs:28:14 | LL | let _n = 1u8 << 8; | ^^^^^^^^ attempt to shift left by `8_i32`, which would overflow @@ -11,427 +11,445 @@ LL | #![deny(arithmetic_overflow)] | ^^^^^^^^^^^^^^^^^^^ error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:212:15 - | -LL | let _n = &(usize::MAX * 5); - | ^^^^^^^^^^^^^^^^ attempt to compute `usize::MAX * 5_usize`, which would overflow - -error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:209:15 + --> $DIR/lint-overflowing-ops.rs:226:15 | LL | let _n = &(isize::MAX * 5); | ^^^^^^^^^^^^^^^^ attempt to compute `isize::MAX * 5_isize`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:206:15 + --> $DIR/lint-overflowing-ops.rs:223:15 | LL | let _n = &(i128::MAX * 5); | ^^^^^^^^^^^^^^^ attempt to compute `i128::MAX * 5_i128`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:203:15 + --> $DIR/lint-overflowing-ops.rs:220:15 | LL | let _n = &(i64::MAX * 5); | ^^^^^^^^^^^^^^ attempt to compute `i64::MAX * 5_i64`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:200:15 + --> $DIR/lint-overflowing-ops.rs:217:15 | LL | let _n = &(i32::MAX * 5); | ^^^^^^^^^^^^^^ attempt to compute `i32::MAX * 5_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:197:15 + --> $DIR/lint-overflowing-ops.rs:214:15 | LL | let _n = &(i16::MAX * 5); | ^^^^^^^^^^^^^^ attempt to compute `i16::MAX * 5_i16`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:194:15 + --> $DIR/lint-overflowing-ops.rs:211:15 | LL | let _n = &(i8::MAX * i8::MAX); | ^^^^^^^^^^^^^^^^^^^ attempt to compute `i8::MAX * i8::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:191:15 + --> $DIR/lint-overflowing-ops.rs:208:15 + | +LL | let _n = &(usize::MAX * 5); + | ^^^^^^^^^^^^^^^^ attempt to compute `usize::MAX * 5_usize`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:205:15 | LL | let _n = &(u128::MAX * 5); | ^^^^^^^^^^^^^^^ attempt to compute `u128::MAX * 5_u128`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:188:15 + --> $DIR/lint-overflowing-ops.rs:202:15 | LL | let _n = &(u64::MAX * 5); | ^^^^^^^^^^^^^^ attempt to compute `u64::MAX * 5_u64`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:185:15 + --> $DIR/lint-overflowing-ops.rs:199:15 | LL | let _n = &(u32::MAX * 5); | ^^^^^^^^^^^^^^ attempt to compute `u32::MAX * 5_u32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:182:15 + --> $DIR/lint-overflowing-ops.rs:196:15 | LL | let _n = &(u16::MAX * 5); | ^^^^^^^^^^^^^^ attempt to compute `u16::MAX * 5_u16`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:179:15 + --> $DIR/lint-overflowing-ops.rs:193:15 | LL | let _n = &(u8::MAX * 5); | ^^^^^^^^^^^^^ attempt to compute `u8::MAX * 5_u8`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:174:15 + --> $DIR/lint-overflowing-ops.rs:188:15 + | +LL | let _n = &(-i8::MIN); + | ^^^^^^^^^^ attempt to negate `i8::MIN`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:185:15 | LL | let _n = &(1usize - 5); | ^^^^^^^^^^^^ attempt to compute `1_usize - 5_usize`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:171:15 + --> $DIR/lint-overflowing-ops.rs:182:15 | LL | let _n = &(-5isize - isize::MAX); | ^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `-5_isize - isize::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:168:15 + --> $DIR/lint-overflowing-ops.rs:179:15 | LL | let _n = &(-5i128 - i128::MAX); | ^^^^^^^^^^^^^^^^^^^^ attempt to compute `-5_i128 - i128::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:165:15 + --> $DIR/lint-overflowing-ops.rs:176:15 | LL | let _n = &(-5i64 - i64::MAX); | ^^^^^^^^^^^^^^^^^^ attempt to compute `-5_i64 - i64::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:162:15 + --> $DIR/lint-overflowing-ops.rs:173:15 | LL | let _n = &(-5i32 - i32::MAX); | ^^^^^^^^^^^^^^^^^^ attempt to compute `-5_i32 - i32::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:159:15 + --> $DIR/lint-overflowing-ops.rs:170:15 | LL | let _n = &(-5i16 - i16::MAX); | ^^^^^^^^^^^^^^^^^^ attempt to compute `-5_i16 - i16::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:156:15 + --> $DIR/lint-overflowing-ops.rs:167:15 | LL | let _n = &(-5i8 - i8::MAX); | ^^^^^^^^^^^^^^^^ attempt to compute `-5_i8 - i8::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:153:15 + --> $DIR/lint-overflowing-ops.rs:164:15 | LL | let _n = &(1u128 - 5); | ^^^^^^^^^^^ attempt to compute `1_u128 - 5_u128`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:150:15 + --> $DIR/lint-overflowing-ops.rs:161:15 | LL | let _n = &(1u64 - 5); | ^^^^^^^^^^ attempt to compute `1_u64 - 5_u64`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:147:15 + --> $DIR/lint-overflowing-ops.rs:158:15 | LL | let _n = &(1u32 - 5); | ^^^^^^^^^^ attempt to compute `1_u32 - 5_u32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:144:15 + --> $DIR/lint-overflowing-ops.rs:155:15 | LL | let _n = &(1u16 - 5); | ^^^^^^^^^^ attempt to compute `1_u16 - 5_u16`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:141:15 + --> $DIR/lint-overflowing-ops.rs:152:15 | LL | let _n = &(1u8 - 5); | ^^^^^^^^^ attempt to compute `1_u8 - 5_u8`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:136:15 + --> $DIR/lint-overflowing-ops.rs:147:15 | LL | let _n = &(1usize + usize::MAX); | ^^^^^^^^^^^^^^^^^^^^^ attempt to compute `1_usize + usize::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:133:15 + --> $DIR/lint-overflowing-ops.rs:144:15 | LL | let _n = &(1isize + isize::MAX); | ^^^^^^^^^^^^^^^^^^^^^ attempt to compute `1_isize + isize::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:130:15 + --> $DIR/lint-overflowing-ops.rs:141:15 | LL | let _n = &(1i128 + i128::MAX); | ^^^^^^^^^^^^^^^^^^^ attempt to compute `1_i128 + i128::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:127:15 + --> $DIR/lint-overflowing-ops.rs:138:15 | LL | let _n = &(1i64 + i64::MAX); | ^^^^^^^^^^^^^^^^^ attempt to compute `1_i64 + i64::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:124:15 + --> $DIR/lint-overflowing-ops.rs:135:15 | LL | let _n = &(1i32 + i32::MAX); | ^^^^^^^^^^^^^^^^^ attempt to compute `1_i32 + i32::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:121:15 + --> $DIR/lint-overflowing-ops.rs:132:15 | LL | let _n = &(1i16 + i16::MAX); | ^^^^^^^^^^^^^^^^^ attempt to compute `1_i16 + i16::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:118:15 + --> $DIR/lint-overflowing-ops.rs:129:15 | LL | let _n = &(1i8 + i8::MAX); | ^^^^^^^^^^^^^^^ attempt to compute `1_i8 + i8::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:115:15 + --> $DIR/lint-overflowing-ops.rs:126:15 | LL | let _n = &(1u128 + u128::MAX); | ^^^^^^^^^^^^^^^^^^^ attempt to compute `1_u128 + u128::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:112:15 + --> $DIR/lint-overflowing-ops.rs:123:15 | LL | let _n = &(1u64 + u64::MAX); | ^^^^^^^^^^^^^^^^^ attempt to compute `1_u64 + u64::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:109:15 + --> $DIR/lint-overflowing-ops.rs:120:15 | LL | let _n = &(1u32 + u32::MAX); | ^^^^^^^^^^^^^^^^^ attempt to compute `1_u32 + u32::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:106:15 + --> $DIR/lint-overflowing-ops.rs:117:15 | LL | let _n = &(1u16 + u16::MAX); | ^^^^^^^^^^^^^^^^^ attempt to compute `1_u16 + u16::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:103:15 + --> $DIR/lint-overflowing-ops.rs:114:15 | LL | let _n = &(1u8 + u8::MAX); | ^^^^^^^^^^^^^^^ attempt to compute `1_u8 + u8::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:98:15 + --> $DIR/lint-overflowing-ops.rs:110:15 + | +LL | let _n = &(1i64 >> [64][0]); + | ^^^^^^^^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:107:15 | LL | let _n = &(1_usize >> BITS); | ^^^^^^^^^^^^^^^^^ attempt to shift right by `%BITS%`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:95:15 + --> $DIR/lint-overflowing-ops.rs:104:15 | LL | let _n = &(1_isize >> BITS); | ^^^^^^^^^^^^^^^^^ attempt to shift right by `%BITS%`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:92:15 + --> $DIR/lint-overflowing-ops.rs:101:15 | LL | let _n = &(1i128 >> 128); | ^^^^^^^^^^^^^^ attempt to shift right by `128_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:89:15 + --> $DIR/lint-overflowing-ops.rs:98:15 | LL | let _n = &(1i64 >> 64); | ^^^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:86:15 + --> $DIR/lint-overflowing-ops.rs:95:15 | LL | let _n = &(1i32 >> 32); | ^^^^^^^^^^^^ attempt to shift right by `32_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:83:15 + --> $DIR/lint-overflowing-ops.rs:92:15 | LL | let _n = &(1i16 >> 16); | ^^^^^^^^^^^^ attempt to shift right by `16_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:80:15 + --> $DIR/lint-overflowing-ops.rs:89:15 | LL | let _n = &(1i8 >> 8); | ^^^^^^^^^^ attempt to shift right by `8_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:77:15 + --> $DIR/lint-overflowing-ops.rs:86:15 | LL | let _n = &(1u128 >> 128); | ^^^^^^^^^^^^^^ attempt to shift right by `128_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:74:15 + --> $DIR/lint-overflowing-ops.rs:83:15 | LL | let _n = &(1u64 >> 64); | ^^^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:71:15 + --> $DIR/lint-overflowing-ops.rs:80:15 | LL | let _n = &(1u32 >> 32); | ^^^^^^^^^^^^ attempt to shift right by `32_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:68:15 + --> $DIR/lint-overflowing-ops.rs:77:15 | LL | let _n = &(1u16 >> 16); | ^^^^^^^^^^^^ attempt to shift right by `16_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:65:15 + --> $DIR/lint-overflowing-ops.rs:74:15 | LL | let _n = &(1u8 >> 8); | ^^^^^^^^^^ attempt to shift right by `8_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:60:15 + --> $DIR/lint-overflowing-ops.rs:65:15 + | +LL | let _n = &(1 << -1); + | ^^^^^^^^^ attempt to shift left by `-1_i32`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:62:15 | LL | let _n = &(1_usize << BITS); | ^^^^^^^^^^^^^^^^^ attempt to shift left by `%BITS%`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:57:15 + --> $DIR/lint-overflowing-ops.rs:59:15 | LL | let _n = &(1_isize << BITS); | ^^^^^^^^^^^^^^^^^ attempt to shift left by `%BITS%`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:54:15 + --> $DIR/lint-overflowing-ops.rs:56:15 | LL | let _n = &(1i128 << 128); | ^^^^^^^^^^^^^^ attempt to shift left by `128_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:51:15 + --> $DIR/lint-overflowing-ops.rs:53:15 | LL | let _n = &(1i64 << 64); | ^^^^^^^^^^^^ attempt to shift left by `64_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:48:15 + --> $DIR/lint-overflowing-ops.rs:50:15 | LL | let _n = &(1i32 << 32); | ^^^^^^^^^^^^ attempt to shift left by `32_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:45:15 + --> $DIR/lint-overflowing-ops.rs:47:15 | LL | let _n = &(1i16 << 16); | ^^^^^^^^^^^^ attempt to shift left by `16_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:42:15 + --> $DIR/lint-overflowing-ops.rs:44:15 | LL | let _n = &(1i8 << 8); | ^^^^^^^^^^ attempt to shift left by `8_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:39:15 + --> $DIR/lint-overflowing-ops.rs:41:15 | LL | let _n = &(1u128 << 128); | ^^^^^^^^^^^^^^ attempt to shift left by `128_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:36:15 + --> $DIR/lint-overflowing-ops.rs:38:15 | LL | let _n = &(1u64 << 64); | ^^^^^^^^^^^^ attempt to shift left by `64_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:33:15 + --> $DIR/lint-overflowing-ops.rs:35:15 | LL | let _n = &(1u32 << 32); | ^^^^^^^^^^^^ attempt to shift left by `32_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:30:15 + --> $DIR/lint-overflowing-ops.rs:32:15 | LL | let _n = &(1u16 << 16); | ^^^^^^^^^^^^ attempt to shift left by `16_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:27:15 + --> $DIR/lint-overflowing-ops.rs:29:15 | LL | let _n = &(1u8 << 8); | ^^^^^^^^^^ attempt to shift left by `8_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:29:14 + --> $DIR/lint-overflowing-ops.rs:31:14 | LL | let _n = 1u16 << 16; | ^^^^^^^^^^ attempt to shift left by `16_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:32:14 + --> $DIR/lint-overflowing-ops.rs:34:14 | LL | let _n = 1u32 << 32; | ^^^^^^^^^^ attempt to shift left by `32_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:35:14 + --> $DIR/lint-overflowing-ops.rs:37:14 | LL | let _n = 1u64 << 64; | ^^^^^^^^^^ attempt to shift left by `64_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:38:14 + --> $DIR/lint-overflowing-ops.rs:40:14 | LL | let _n = 1u128 << 128; | ^^^^^^^^^^^^ attempt to shift left by `128_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:41:14 + --> $DIR/lint-overflowing-ops.rs:43:14 | LL | let _n = 1i8 << 8; | ^^^^^^^^ attempt to shift left by `8_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:44:14 + --> $DIR/lint-overflowing-ops.rs:46:14 | LL | let _n = 1i16 << 16; | ^^^^^^^^^^ attempt to shift left by `16_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:47:14 + --> $DIR/lint-overflowing-ops.rs:49:14 | LL | let _n = 1i32 << 32; | ^^^^^^^^^^ attempt to shift left by `32_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:50:14 + --> $DIR/lint-overflowing-ops.rs:52:14 | LL | let _n = 1i64 << 64; | ^^^^^^^^^^ attempt to shift left by `64_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:53:14 + --> $DIR/lint-overflowing-ops.rs:55:14 | LL | let _n = 1i128 << 128; | ^^^^^^^^^^^^ attempt to shift left by `128_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:56:14 + --> $DIR/lint-overflowing-ops.rs:58:14 | LL | let _n = 1_isize << BITS; | ^^^^^^^^^^^^^^^ attempt to shift left by `%BITS%`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:59:14 + --> $DIR/lint-overflowing-ops.rs:61:14 | LL | let _n = 1_usize << BITS; | ^^^^^^^^^^^^^^^ attempt to shift left by `%BITS%`, which would overflow @@ -439,293 +457,329 @@ LL | let _n = 1_usize << BITS; error: this arithmetic operation will overflow --> $DIR/lint-overflowing-ops.rs:64:14 | +LL | let _n = 1 << -1; + | ^^^^^^^ attempt to shift left by `-1_i32`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:69:14 + | +LL | let _n = -1_i64 >> 64; + | ^^^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:70:14 + | +LL | let _n = -1_i32 >> 32; + | ^^^^^^^^^^^^ attempt to shift right by `32_i32`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:71:14 + | +LL | let _n = -1_i32 >> -1; + | ^^^^^^^^^^^^ attempt to shift right by `-1_i32`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:73:14 + | LL | let _n = 1u8 >> 8; | ^^^^^^^^ attempt to shift right by `8_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:67:14 + --> $DIR/lint-overflowing-ops.rs:76:14 | LL | let _n = 1u16 >> 16; | ^^^^^^^^^^ attempt to shift right by `16_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:70:14 + --> $DIR/lint-overflowing-ops.rs:79:14 | LL | let _n = 1u32 >> 32; | ^^^^^^^^^^ attempt to shift right by `32_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:73:14 + --> $DIR/lint-overflowing-ops.rs:82:14 | LL | let _n = 1u64 >> 64; | ^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:76:14 + --> $DIR/lint-overflowing-ops.rs:85:14 | LL | let _n = 1u128 >> 128; | ^^^^^^^^^^^^ attempt to shift right by `128_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:79:14 + --> $DIR/lint-overflowing-ops.rs:88:14 | LL | let _n = 1i8 >> 8; | ^^^^^^^^ attempt to shift right by `8_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:82:14 + --> $DIR/lint-overflowing-ops.rs:91:14 | LL | let _n = 1i16 >> 16; | ^^^^^^^^^^ attempt to shift right by `16_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:85:14 + --> $DIR/lint-overflowing-ops.rs:94:14 | LL | let _n = 1i32 >> 32; | ^^^^^^^^^^ attempt to shift right by `32_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:88:14 + --> $DIR/lint-overflowing-ops.rs:97:14 | LL | let _n = 1i64 >> 64; | ^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:91:14 + --> $DIR/lint-overflowing-ops.rs:100:14 | LL | let _n = 1i128 >> 128; | ^^^^^^^^^^^^ attempt to shift right by `128_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:94:14 + --> $DIR/lint-overflowing-ops.rs:103:14 | LL | let _n = 1_isize >> BITS; | ^^^^^^^^^^^^^^^ attempt to shift right by `%BITS%`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:97:14 + --> $DIR/lint-overflowing-ops.rs:106:14 | LL | let _n = 1_usize >> BITS; | ^^^^^^^^^^^^^^^ attempt to shift right by `%BITS%`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:102:14 + --> $DIR/lint-overflowing-ops.rs:109:14 + | +LL | let _n = 1i64 >> [64][0]; + | ^^^^^^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:113:14 | LL | let _n = 1u8 + u8::MAX; | ^^^^^^^^^^^^^ attempt to compute `1_u8 + u8::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:105:14 + --> $DIR/lint-overflowing-ops.rs:116:14 | LL | let _n = 1u16 + u16::MAX; | ^^^^^^^^^^^^^^^ attempt to compute `1_u16 + u16::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:108:14 + --> $DIR/lint-overflowing-ops.rs:119:14 | LL | let _n = 1u32 + u32::MAX; | ^^^^^^^^^^^^^^^ attempt to compute `1_u32 + u32::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:111:14 + --> $DIR/lint-overflowing-ops.rs:122:14 | LL | let _n = 1u64 + u64::MAX; | ^^^^^^^^^^^^^^^ attempt to compute `1_u64 + u64::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:114:14 + --> $DIR/lint-overflowing-ops.rs:125:14 | LL | let _n = 1u128 + u128::MAX; | ^^^^^^^^^^^^^^^^^ attempt to compute `1_u128 + u128::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:117:14 + --> $DIR/lint-overflowing-ops.rs:128:14 | LL | let _n = 1i8 + i8::MAX; | ^^^^^^^^^^^^^ attempt to compute `1_i8 + i8::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:120:14 + --> $DIR/lint-overflowing-ops.rs:131:14 | LL | let _n = 1i16 + i16::MAX; | ^^^^^^^^^^^^^^^ attempt to compute `1_i16 + i16::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:123:14 + --> $DIR/lint-overflowing-ops.rs:134:14 | LL | let _n = 1i32 + i32::MAX; | ^^^^^^^^^^^^^^^ attempt to compute `1_i32 + i32::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:126:14 + --> $DIR/lint-overflowing-ops.rs:137:14 | LL | let _n = 1i64 + i64::MAX; | ^^^^^^^^^^^^^^^ attempt to compute `1_i64 + i64::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:129:14 + --> $DIR/lint-overflowing-ops.rs:140:14 | LL | let _n = 1i128 + i128::MAX; | ^^^^^^^^^^^^^^^^^ attempt to compute `1_i128 + i128::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:132:14 + --> $DIR/lint-overflowing-ops.rs:143:14 | LL | let _n = 1isize + isize::MAX; | ^^^^^^^^^^^^^^^^^^^ attempt to compute `1_isize + isize::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:135:14 + --> $DIR/lint-overflowing-ops.rs:146:14 | LL | let _n = 1usize + usize::MAX; | ^^^^^^^^^^^^^^^^^^^ attempt to compute `1_usize + usize::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:140:14 + --> $DIR/lint-overflowing-ops.rs:151:14 | LL | let _n = 1u8 - 5; | ^^^^^^^ attempt to compute `1_u8 - 5_u8`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:143:14 + --> $DIR/lint-overflowing-ops.rs:154:14 | LL | let _n = 1u16 - 5; | ^^^^^^^^ attempt to compute `1_u16 - 5_u16`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:146:14 + --> $DIR/lint-overflowing-ops.rs:157:14 | LL | let _n = 1u32 - 5; | ^^^^^^^^ attempt to compute `1_u32 - 5_u32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:149:14 + --> $DIR/lint-overflowing-ops.rs:160:14 | LL | let _n = 1u64 - 5 ; | ^^^^^^^^ attempt to compute `1_u64 - 5_u64`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:152:14 + --> $DIR/lint-overflowing-ops.rs:163:14 | LL | let _n = 1u128 - 5 ; | ^^^^^^^^^ attempt to compute `1_u128 - 5_u128`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:155:14 + --> $DIR/lint-overflowing-ops.rs:166:14 | LL | let _n = -5i8 - i8::MAX; | ^^^^^^^^^^^^^^ attempt to compute `-5_i8 - i8::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:158:14 + --> $DIR/lint-overflowing-ops.rs:169:14 | LL | let _n = -5i16 - i16::MAX; | ^^^^^^^^^^^^^^^^ attempt to compute `-5_i16 - i16::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:161:14 + --> $DIR/lint-overflowing-ops.rs:172:14 | LL | let _n = -5i32 - i32::MAX; | ^^^^^^^^^^^^^^^^ attempt to compute `-5_i32 - i32::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:164:14 + --> $DIR/lint-overflowing-ops.rs:175:14 | LL | let _n = -5i64 - i64::MAX; | ^^^^^^^^^^^^^^^^ attempt to compute `-5_i64 - i64::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:167:14 + --> $DIR/lint-overflowing-ops.rs:178:14 | LL | let _n = -5i128 - i128::MAX; | ^^^^^^^^^^^^^^^^^^ attempt to compute `-5_i128 - i128::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:170:14 + --> $DIR/lint-overflowing-ops.rs:181:14 | LL | let _n = -5isize - isize::MAX; | ^^^^^^^^^^^^^^^^^^^^ attempt to compute `-5_isize - isize::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:173:14 + --> $DIR/lint-overflowing-ops.rs:184:14 | LL | let _n = 1usize - 5; | ^^^^^^^^^^ attempt to compute `1_usize - 5_usize`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:178:14 + --> $DIR/lint-overflowing-ops.rs:187:14 + | +LL | let _n = -i8::MIN; + | ^^^^^^^^ attempt to negate `i8::MIN`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:192:14 | LL | let _n = u8::MAX * 5; | ^^^^^^^^^^^ attempt to compute `u8::MAX * 5_u8`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:181:14 + --> $DIR/lint-overflowing-ops.rs:195:14 | LL | let _n = u16::MAX * 5; | ^^^^^^^^^^^^ attempt to compute `u16::MAX * 5_u16`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:184:14 + --> $DIR/lint-overflowing-ops.rs:198:14 | LL | let _n = u32::MAX * 5; | ^^^^^^^^^^^^ attempt to compute `u32::MAX * 5_u32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:187:14 + --> $DIR/lint-overflowing-ops.rs:201:14 | LL | let _n = u64::MAX * 5; | ^^^^^^^^^^^^ attempt to compute `u64::MAX * 5_u64`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:190:14 + --> $DIR/lint-overflowing-ops.rs:204:14 | LL | let _n = u128::MAX * 5; | ^^^^^^^^^^^^^ attempt to compute `u128::MAX * 5_u128`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:193:14 + --> $DIR/lint-overflowing-ops.rs:207:14 + | +LL | let _n = usize::MAX * 5; + | ^^^^^^^^^^^^^^ attempt to compute `usize::MAX * 5_usize`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:210:14 | LL | let _n = i8::MAX * i8::MAX; | ^^^^^^^^^^^^^^^^^ attempt to compute `i8::MAX * i8::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:196:14 + --> $DIR/lint-overflowing-ops.rs:213:14 | LL | let _n = i16::MAX * 5; | ^^^^^^^^^^^^ attempt to compute `i16::MAX * 5_i16`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:199:14 + --> $DIR/lint-overflowing-ops.rs:216:14 | LL | let _n = i32::MAX * 5; | ^^^^^^^^^^^^ attempt to compute `i32::MAX * 5_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:202:14 + --> $DIR/lint-overflowing-ops.rs:219:14 | LL | let _n = i64::MAX * 5; | ^^^^^^^^^^^^ attempt to compute `i64::MAX * 5_i64`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:205:14 + --> $DIR/lint-overflowing-ops.rs:222:14 | LL | let _n = i128::MAX * 5; | ^^^^^^^^^^^^^ attempt to compute `i128::MAX * 5_i128`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:208:14 + --> $DIR/lint-overflowing-ops.rs:225:14 | LL | let _n = isize::MAX * 5; | ^^^^^^^^^^^^^^ attempt to compute `isize::MAX * 5_isize`, which would overflow -error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:211:14 - | -LL | let _n = usize::MAX * 5; - | ^^^^^^^^^^^^^^ attempt to compute `usize::MAX * 5_usize`, which would overflow - error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:216:14 + --> $DIR/lint-overflowing-ops.rs:230:14 | LL | let _n = 1u8 / 0; | ^^^^^^^ attempt to divide `1_u8` by zero @@ -733,298 +787,442 @@ LL | let _n = 1u8 / 0; = note: `#[deny(unconditional_panic)]` on by default error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:217:15 + --> $DIR/lint-overflowing-ops.rs:231:15 | LL | let _n = &(1u8 / 0); | ^^^^^^^^^ attempt to divide `1_u8` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:219:14 + --> $DIR/lint-overflowing-ops.rs:233:14 | LL | let _n = 1u16 / 0; | ^^^^^^^^ attempt to divide `1_u16` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:220:15 + --> $DIR/lint-overflowing-ops.rs:234:15 | LL | let _n = &(1u16 / 0); | ^^^^^^^^^^ attempt to divide `1_u16` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:222:14 + --> $DIR/lint-overflowing-ops.rs:236:14 | LL | let _n = 1u32 / 0; | ^^^^^^^^ attempt to divide `1_u32` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:223:15 + --> $DIR/lint-overflowing-ops.rs:237:15 | LL | let _n = &(1u32 / 0); | ^^^^^^^^^^ attempt to divide `1_u32` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:225:14 + --> $DIR/lint-overflowing-ops.rs:239:14 | LL | let _n = 1u64 / 0; | ^^^^^^^^ attempt to divide `1_u64` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:226:15 + --> $DIR/lint-overflowing-ops.rs:240:15 | LL | let _n = &(1u64 / 0); | ^^^^^^^^^^ attempt to divide `1_u64` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:228:14 + --> $DIR/lint-overflowing-ops.rs:242:14 | LL | let _n = 1u128 / 0; | ^^^^^^^^^ attempt to divide `1_u128` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:229:15 + --> $DIR/lint-overflowing-ops.rs:243:15 | LL | let _n = &(1u128 / 0); | ^^^^^^^^^^^ attempt to divide `1_u128` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:231:14 - | -LL | let _n = 1i8 / 0; - | ^^^^^^^ attempt to divide `1_i8` by zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:232:15 - | -LL | let _n = &(1i8 / 0); - | ^^^^^^^^^ attempt to divide `1_i8` by zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:234:14 - | -LL | let _n = 1i16 / 0; - | ^^^^^^^^ attempt to divide `1_i16` by zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:235:15 - | -LL | let _n = &(1i16 / 0); - | ^^^^^^^^^^ attempt to divide `1_i16` by zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:237:14 - | -LL | let _n = 1i32 / 0; - | ^^^^^^^^ attempt to divide `1_i32` by zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:238:15 - | -LL | let _n = &(1i32 / 0); - | ^^^^^^^^^^ attempt to divide `1_i32` by zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:240:14 - | -LL | let _n = 1i64 / 0; - | ^^^^^^^^ attempt to divide `1_i64` by zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:241:15 - | -LL | let _n = &(1i64 / 0); - | ^^^^^^^^^^ attempt to divide `1_i64` by zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:243:14 - | -LL | let _n = 1i128 / 0; - | ^^^^^^^^^ attempt to divide `1_i128` by zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:244:15 - | -LL | let _n = &(1i128 / 0); - | ^^^^^^^^^^^ attempt to divide `1_i128` by zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:246:14 - | -LL | let _n = 1isize / 0; - | ^^^^^^^^^^ attempt to divide `1_isize` by zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:247:15 - | -LL | let _n = &(1isize / 0); - | ^^^^^^^^^^^^ attempt to divide `1_isize` by zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:249:14 + --> $DIR/lint-overflowing-ops.rs:245:14 | LL | let _n = 1usize / 0; | ^^^^^^^^^^ attempt to divide `1_usize` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:250:15 + --> $DIR/lint-overflowing-ops.rs:246:15 | LL | let _n = &(1usize / 0); | ^^^^^^^^^^^^ attempt to divide `1_usize` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:254:14 + --> $DIR/lint-overflowing-ops.rs:248:14 + | +LL | let _n = 1i8 / 0; + | ^^^^^^^ attempt to divide `1_i8` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:249:15 + | +LL | let _n = &(1i8 / 0); + | ^^^^^^^^^ attempt to divide `1_i8` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:250:14 + | +LL | let _n = i8::MIN / -1; + | ^^^^^^^^^^^^ attempt to compute `i8::MIN / -1_i8`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:251:15 + | +LL | let _n = &(i8::MIN / -1); + | ^^^^^^^^^^^^^^ attempt to compute `i8::MIN / -1_i8`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:253:14 + | +LL | let _n = 1i16 / 0; + | ^^^^^^^^ attempt to divide `1_i16` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:254:15 + | +LL | let _n = &(1i16 / 0); + | ^^^^^^^^^^ attempt to divide `1_i16` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:255:14 + | +LL | let _n = i16::MIN / -1; + | ^^^^^^^^^^^^^ attempt to compute `i16::MIN / -1_i16`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:256:15 + | +LL | let _n = &(i16::MIN / -1); + | ^^^^^^^^^^^^^^^ attempt to compute `i16::MIN / -1_i16`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:258:14 + | +LL | let _n = 1i32 / 0; + | ^^^^^^^^ attempt to divide `1_i32` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:259:15 + | +LL | let _n = &(1i32 / 0); + | ^^^^^^^^^^ attempt to divide `1_i32` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:260:14 + | +LL | let _n = i32::MIN / -1; + | ^^^^^^^^^^^^^ attempt to compute `i32::MIN / -1_i32`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:261:15 + | +LL | let _n = &(i32::MIN / -1); + | ^^^^^^^^^^^^^^^ attempt to compute `i32::MIN / -1_i32`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:263:14 + | +LL | let _n = 1i64 / 0; + | ^^^^^^^^ attempt to divide `1_i64` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:264:15 + | +LL | let _n = &(1i64 / 0); + | ^^^^^^^^^^ attempt to divide `1_i64` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:265:14 + | +LL | let _n = i64::MIN / -1; + | ^^^^^^^^^^^^^ attempt to compute `i64::MIN / -1_i64`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:266:15 + | +LL | let _n = &(i64::MIN / -1); + | ^^^^^^^^^^^^^^^ attempt to compute `i64::MIN / -1_i64`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:268:14 + | +LL | let _n = 1i128 / 0; + | ^^^^^^^^^ attempt to divide `1_i128` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:269:15 + | +LL | let _n = &(1i128 / 0); + | ^^^^^^^^^^^ attempt to divide `1_i128` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:270:14 + | +LL | let _n = i128::MIN / -1; + | ^^^^^^^^^^^^^^ attempt to compute `i128::MIN / -1_i128`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:271:15 + | +LL | let _n = &(i128::MIN / -1); + | ^^^^^^^^^^^^^^^^ attempt to compute `i128::MIN / -1_i128`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:273:14 + | +LL | let _n = 1isize / 0; + | ^^^^^^^^^^ attempt to divide `1_isize` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:274:15 + | +LL | let _n = &(1isize / 0); + | ^^^^^^^^^^^^ attempt to divide `1_isize` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:275:14 + | +LL | let _n = isize::MIN / -1; + | ^^^^^^^^^^^^^^^ attempt to compute `isize::MIN / -1_isize`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:276:15 + | +LL | let _n = &(isize::MIN / -1); + | ^^^^^^^^^^^^^^^^^ attempt to compute `isize::MIN / -1_isize`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:280:14 | LL | let _n = 1u8 % 0; | ^^^^^^^ attempt to calculate the remainder of `1_u8` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:255:15 + --> $DIR/lint-overflowing-ops.rs:281:15 | LL | let _n = &(1u8 % 0); | ^^^^^^^^^ attempt to calculate the remainder of `1_u8` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:257:14 + --> $DIR/lint-overflowing-ops.rs:283:14 | LL | let _n = 1u16 % 0; | ^^^^^^^^ attempt to calculate the remainder of `1_u16` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:258:15 + --> $DIR/lint-overflowing-ops.rs:284:15 | LL | let _n = &(1u16 % 0); | ^^^^^^^^^^ attempt to calculate the remainder of `1_u16` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:260:14 + --> $DIR/lint-overflowing-ops.rs:286:14 | LL | let _n = 1u32 % 0; | ^^^^^^^^ attempt to calculate the remainder of `1_u32` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:261:15 + --> $DIR/lint-overflowing-ops.rs:287:15 | LL | let _n = &(1u32 % 0); | ^^^^^^^^^^ attempt to calculate the remainder of `1_u32` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:263:14 + --> $DIR/lint-overflowing-ops.rs:289:14 | LL | let _n = 1u64 % 0; | ^^^^^^^^ attempt to calculate the remainder of `1_u64` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:264:15 + --> $DIR/lint-overflowing-ops.rs:290:15 | LL | let _n = &(1u64 % 0); | ^^^^^^^^^^ attempt to calculate the remainder of `1_u64` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:266:14 + --> $DIR/lint-overflowing-ops.rs:292:14 | LL | let _n = 1u128 % 0; | ^^^^^^^^^ attempt to calculate the remainder of `1_u128` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:267:15 + --> $DIR/lint-overflowing-ops.rs:293:15 | LL | let _n = &(1u128 % 0); | ^^^^^^^^^^^ attempt to calculate the remainder of `1_u128` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:269:14 - | -LL | let _n = 1i8 % 0; - | ^^^^^^^ attempt to calculate the remainder of `1_i8` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:270:15 - | -LL | let _n = &(1i8 % 0); - | ^^^^^^^^^ attempt to calculate the remainder of `1_i8` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:272:14 - | -LL | let _n = 1i16 % 0; - | ^^^^^^^^ attempt to calculate the remainder of `1_i16` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:273:15 - | -LL | let _n = &(1i16 % 0); - | ^^^^^^^^^^ attempt to calculate the remainder of `1_i16` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:275:14 - | -LL | let _n = 1i32 % 0; - | ^^^^^^^^ attempt to calculate the remainder of `1_i32` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:276:15 - | -LL | let _n = &(1i32 % 0); - | ^^^^^^^^^^ attempt to calculate the remainder of `1_i32` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:278:14 - | -LL | let _n = 1i64 % 0; - | ^^^^^^^^ attempt to calculate the remainder of `1_i64` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:279:15 - | -LL | let _n = &(1i64 % 0); - | ^^^^^^^^^^ attempt to calculate the remainder of `1_i64` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:281:14 - | -LL | let _n = 1i128 % 0; - | ^^^^^^^^^ attempt to calculate the remainder of `1_i128` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:282:15 - | -LL | let _n = &(1i128 % 0); - | ^^^^^^^^^^^ attempt to calculate the remainder of `1_i128` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:284:14 - | -LL | let _n = 1isize % 0; - | ^^^^^^^^^^ attempt to calculate the remainder of `1_isize` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:285:15 - | -LL | let _n = &(1isize % 0); - | ^^^^^^^^^^^^ attempt to calculate the remainder of `1_isize` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:287:14 + --> $DIR/lint-overflowing-ops.rs:295:14 | LL | let _n = 1usize % 0; | ^^^^^^^^^^ attempt to calculate the remainder of `1_usize` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:288:15 + --> $DIR/lint-overflowing-ops.rs:296:15 | LL | let _n = &(1usize % 0); | ^^^^^^^^^^^^ attempt to calculate the remainder of `1_usize` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:292:14 + --> $DIR/lint-overflowing-ops.rs:298:14 + | +LL | let _n = 1i8 % 0; + | ^^^^^^^ attempt to calculate the remainder of `1_i8` with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:299:15 + | +LL | let _n = &(1i8 % 0); + | ^^^^^^^^^ attempt to calculate the remainder of `1_i8` with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:300:14 + | +LL | let _n = i8::MIN % -1; + | ^^^^^^^^^^^^ attempt to compute `i8::MIN % -1_i8`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:301:15 + | +LL | let _n = &(i8::MIN % -1); + | ^^^^^^^^^^^^^^ attempt to compute `i8::MIN % -1_i8`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:303:14 + | +LL | let _n = 1i16 % 0; + | ^^^^^^^^ attempt to calculate the remainder of `1_i16` with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:304:15 + | +LL | let _n = &(1i16 % 0); + | ^^^^^^^^^^ attempt to calculate the remainder of `1_i16` with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:305:14 + | +LL | let _n = i16::MIN % -1; + | ^^^^^^^^^^^^^ attempt to compute `i16::MIN % -1_i16`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:306:15 + | +LL | let _n = &(i16::MIN % -1); + | ^^^^^^^^^^^^^^^ attempt to compute `i16::MIN % -1_i16`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:308:14 + | +LL | let _n = 1i32 % 0; + | ^^^^^^^^ attempt to calculate the remainder of `1_i32` with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:309:15 + | +LL | let _n = &(1i32 % 0); + | ^^^^^^^^^^ attempt to calculate the remainder of `1_i32` with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:310:14 + | +LL | let _n = i32::MIN % -1; + | ^^^^^^^^^^^^^ attempt to compute `i32::MIN % -1_i32`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:311:15 + | +LL | let _n = &(i32::MIN % -1); + | ^^^^^^^^^^^^^^^ attempt to compute `i32::MIN % -1_i32`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:313:14 + | +LL | let _n = 1i64 % 0; + | ^^^^^^^^ attempt to calculate the remainder of `1_i64` with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:314:15 + | +LL | let _n = &(1i64 % 0); + | ^^^^^^^^^^ attempt to calculate the remainder of `1_i64` with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:315:14 + | +LL | let _n = i64::MIN % -1; + | ^^^^^^^^^^^^^ attempt to compute `i64::MIN % -1_i64`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:316:15 + | +LL | let _n = &(i64::MIN % -1); + | ^^^^^^^^^^^^^^^ attempt to compute `i64::MIN % -1_i64`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:318:14 + | +LL | let _n = 1i128 % 0; + | ^^^^^^^^^ attempt to calculate the remainder of `1_i128` with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:319:15 + | +LL | let _n = &(1i128 % 0); + | ^^^^^^^^^^^ attempt to calculate the remainder of `1_i128` with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:320:14 + | +LL | let _n = i128::MIN % -1; + | ^^^^^^^^^^^^^^ attempt to compute `i128::MIN % -1_i128`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:321:15 + | +LL | let _n = &(i128::MIN % -1); + | ^^^^^^^^^^^^^^^^ attempt to compute `i128::MIN % -1_i128`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:323:14 + | +LL | let _n = 1isize % 0; + | ^^^^^^^^^^ attempt to calculate the remainder of `1_isize` with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:324:15 + | +LL | let _n = &(1isize % 0); + | ^^^^^^^^^^^^ attempt to calculate the remainder of `1_isize` with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:325:14 + | +LL | let _n = isize::MIN % -1; + | ^^^^^^^^^^^^^^^ attempt to compute `isize::MIN % -1_isize`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:326:15 + | +LL | let _n = &(isize::MIN % -1); + | ^^^^^^^^^^^^^^^^^ attempt to compute `isize::MIN % -1_isize`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:329:14 | LL | let _n = [1, 2, 3][4]; | ^^^^^^^^^^^^ index out of bounds: the length is 3 but the index is 4 error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:293:15 + --> $DIR/lint-overflowing-ops.rs:330:15 | LL | let _n = &([1, 2, 3][4]); | ^^^^^^^^^^^^^^ index out of bounds: the length is 3 but the index is 4 -error: aborting due to 170 previous errors +error: aborting due to 203 previous errors diff --git a/tests/ui/lint/lint-overflowing-ops.opt_with_overflow_checks.stderr b/tests/ui/lint/lint-overflowing-ops.opt_with_overflow_checks.stderr index 93fc19ce79e4..1b7b73cec38d 100644 --- a/tests/ui/lint/lint-overflowing-ops.opt_with_overflow_checks.stderr +++ b/tests/ui/lint/lint-overflowing-ops.opt_with_overflow_checks.stderr @@ -1,5 +1,5 @@ error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:26:14 + --> $DIR/lint-overflowing-ops.rs:28:14 | LL | let _n = 1u8 << 8; | ^^^^^^^^ attempt to shift left by `8_i32`, which would overflow @@ -11,427 +11,445 @@ LL | #![deny(arithmetic_overflow)] | ^^^^^^^^^^^^^^^^^^^ error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:212:15 - | -LL | let _n = &(usize::MAX * 5); - | ^^^^^^^^^^^^^^^^ attempt to compute `usize::MAX * 5_usize`, which would overflow - -error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:209:15 + --> $DIR/lint-overflowing-ops.rs:226:15 | LL | let _n = &(isize::MAX * 5); | ^^^^^^^^^^^^^^^^ attempt to compute `isize::MAX * 5_isize`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:206:15 + --> $DIR/lint-overflowing-ops.rs:223:15 | LL | let _n = &(i128::MAX * 5); | ^^^^^^^^^^^^^^^ attempt to compute `i128::MAX * 5_i128`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:203:15 + --> $DIR/lint-overflowing-ops.rs:220:15 | LL | let _n = &(i64::MAX * 5); | ^^^^^^^^^^^^^^ attempt to compute `i64::MAX * 5_i64`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:200:15 + --> $DIR/lint-overflowing-ops.rs:217:15 | LL | let _n = &(i32::MAX * 5); | ^^^^^^^^^^^^^^ attempt to compute `i32::MAX * 5_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:197:15 + --> $DIR/lint-overflowing-ops.rs:214:15 | LL | let _n = &(i16::MAX * 5); | ^^^^^^^^^^^^^^ attempt to compute `i16::MAX * 5_i16`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:194:15 + --> $DIR/lint-overflowing-ops.rs:211:15 | LL | let _n = &(i8::MAX * i8::MAX); | ^^^^^^^^^^^^^^^^^^^ attempt to compute `i8::MAX * i8::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:191:15 + --> $DIR/lint-overflowing-ops.rs:208:15 + | +LL | let _n = &(usize::MAX * 5); + | ^^^^^^^^^^^^^^^^ attempt to compute `usize::MAX * 5_usize`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:205:15 | LL | let _n = &(u128::MAX * 5); | ^^^^^^^^^^^^^^^ attempt to compute `u128::MAX * 5_u128`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:188:15 + --> $DIR/lint-overflowing-ops.rs:202:15 | LL | let _n = &(u64::MAX * 5); | ^^^^^^^^^^^^^^ attempt to compute `u64::MAX * 5_u64`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:185:15 + --> $DIR/lint-overflowing-ops.rs:199:15 | LL | let _n = &(u32::MAX * 5); | ^^^^^^^^^^^^^^ attempt to compute `u32::MAX * 5_u32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:182:15 + --> $DIR/lint-overflowing-ops.rs:196:15 | LL | let _n = &(u16::MAX * 5); | ^^^^^^^^^^^^^^ attempt to compute `u16::MAX * 5_u16`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:179:15 + --> $DIR/lint-overflowing-ops.rs:193:15 | LL | let _n = &(u8::MAX * 5); | ^^^^^^^^^^^^^ attempt to compute `u8::MAX * 5_u8`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:174:15 + --> $DIR/lint-overflowing-ops.rs:188:15 + | +LL | let _n = &(-i8::MIN); + | ^^^^^^^^^^ attempt to negate `i8::MIN`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:185:15 | LL | let _n = &(1usize - 5); | ^^^^^^^^^^^^ attempt to compute `1_usize - 5_usize`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:171:15 + --> $DIR/lint-overflowing-ops.rs:182:15 | LL | let _n = &(-5isize - isize::MAX); | ^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `-5_isize - isize::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:168:15 + --> $DIR/lint-overflowing-ops.rs:179:15 | LL | let _n = &(-5i128 - i128::MAX); | ^^^^^^^^^^^^^^^^^^^^ attempt to compute `-5_i128 - i128::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:165:15 + --> $DIR/lint-overflowing-ops.rs:176:15 | LL | let _n = &(-5i64 - i64::MAX); | ^^^^^^^^^^^^^^^^^^ attempt to compute `-5_i64 - i64::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:162:15 + --> $DIR/lint-overflowing-ops.rs:173:15 | LL | let _n = &(-5i32 - i32::MAX); | ^^^^^^^^^^^^^^^^^^ attempt to compute `-5_i32 - i32::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:159:15 + --> $DIR/lint-overflowing-ops.rs:170:15 | LL | let _n = &(-5i16 - i16::MAX); | ^^^^^^^^^^^^^^^^^^ attempt to compute `-5_i16 - i16::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:156:15 + --> $DIR/lint-overflowing-ops.rs:167:15 | LL | let _n = &(-5i8 - i8::MAX); | ^^^^^^^^^^^^^^^^ attempt to compute `-5_i8 - i8::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:153:15 + --> $DIR/lint-overflowing-ops.rs:164:15 | LL | let _n = &(1u128 - 5); | ^^^^^^^^^^^ attempt to compute `1_u128 - 5_u128`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:150:15 + --> $DIR/lint-overflowing-ops.rs:161:15 | LL | let _n = &(1u64 - 5); | ^^^^^^^^^^ attempt to compute `1_u64 - 5_u64`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:147:15 + --> $DIR/lint-overflowing-ops.rs:158:15 | LL | let _n = &(1u32 - 5); | ^^^^^^^^^^ attempt to compute `1_u32 - 5_u32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:144:15 + --> $DIR/lint-overflowing-ops.rs:155:15 | LL | let _n = &(1u16 - 5); | ^^^^^^^^^^ attempt to compute `1_u16 - 5_u16`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:141:15 + --> $DIR/lint-overflowing-ops.rs:152:15 | LL | let _n = &(1u8 - 5); | ^^^^^^^^^ attempt to compute `1_u8 - 5_u8`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:136:15 + --> $DIR/lint-overflowing-ops.rs:147:15 | LL | let _n = &(1usize + usize::MAX); | ^^^^^^^^^^^^^^^^^^^^^ attempt to compute `1_usize + usize::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:133:15 + --> $DIR/lint-overflowing-ops.rs:144:15 | LL | let _n = &(1isize + isize::MAX); | ^^^^^^^^^^^^^^^^^^^^^ attempt to compute `1_isize + isize::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:130:15 + --> $DIR/lint-overflowing-ops.rs:141:15 | LL | let _n = &(1i128 + i128::MAX); | ^^^^^^^^^^^^^^^^^^^ attempt to compute `1_i128 + i128::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:127:15 + --> $DIR/lint-overflowing-ops.rs:138:15 | LL | let _n = &(1i64 + i64::MAX); | ^^^^^^^^^^^^^^^^^ attempt to compute `1_i64 + i64::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:124:15 + --> $DIR/lint-overflowing-ops.rs:135:15 | LL | let _n = &(1i32 + i32::MAX); | ^^^^^^^^^^^^^^^^^ attempt to compute `1_i32 + i32::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:121:15 + --> $DIR/lint-overflowing-ops.rs:132:15 | LL | let _n = &(1i16 + i16::MAX); | ^^^^^^^^^^^^^^^^^ attempt to compute `1_i16 + i16::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:118:15 + --> $DIR/lint-overflowing-ops.rs:129:15 | LL | let _n = &(1i8 + i8::MAX); | ^^^^^^^^^^^^^^^ attempt to compute `1_i8 + i8::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:115:15 + --> $DIR/lint-overflowing-ops.rs:126:15 | LL | let _n = &(1u128 + u128::MAX); | ^^^^^^^^^^^^^^^^^^^ attempt to compute `1_u128 + u128::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:112:15 + --> $DIR/lint-overflowing-ops.rs:123:15 | LL | let _n = &(1u64 + u64::MAX); | ^^^^^^^^^^^^^^^^^ attempt to compute `1_u64 + u64::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:109:15 + --> $DIR/lint-overflowing-ops.rs:120:15 | LL | let _n = &(1u32 + u32::MAX); | ^^^^^^^^^^^^^^^^^ attempt to compute `1_u32 + u32::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:106:15 + --> $DIR/lint-overflowing-ops.rs:117:15 | LL | let _n = &(1u16 + u16::MAX); | ^^^^^^^^^^^^^^^^^ attempt to compute `1_u16 + u16::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:103:15 + --> $DIR/lint-overflowing-ops.rs:114:15 | LL | let _n = &(1u8 + u8::MAX); | ^^^^^^^^^^^^^^^ attempt to compute `1_u8 + u8::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:98:15 + --> $DIR/lint-overflowing-ops.rs:110:15 + | +LL | let _n = &(1i64 >> [64][0]); + | ^^^^^^^^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:107:15 | LL | let _n = &(1_usize >> BITS); | ^^^^^^^^^^^^^^^^^ attempt to shift right by `%BITS%`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:95:15 + --> $DIR/lint-overflowing-ops.rs:104:15 | LL | let _n = &(1_isize >> BITS); | ^^^^^^^^^^^^^^^^^ attempt to shift right by `%BITS%`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:92:15 + --> $DIR/lint-overflowing-ops.rs:101:15 | LL | let _n = &(1i128 >> 128); | ^^^^^^^^^^^^^^ attempt to shift right by `128_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:89:15 + --> $DIR/lint-overflowing-ops.rs:98:15 | LL | let _n = &(1i64 >> 64); | ^^^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:86:15 + --> $DIR/lint-overflowing-ops.rs:95:15 | LL | let _n = &(1i32 >> 32); | ^^^^^^^^^^^^ attempt to shift right by `32_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:83:15 + --> $DIR/lint-overflowing-ops.rs:92:15 | LL | let _n = &(1i16 >> 16); | ^^^^^^^^^^^^ attempt to shift right by `16_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:80:15 + --> $DIR/lint-overflowing-ops.rs:89:15 | LL | let _n = &(1i8 >> 8); | ^^^^^^^^^^ attempt to shift right by `8_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:77:15 + --> $DIR/lint-overflowing-ops.rs:86:15 | LL | let _n = &(1u128 >> 128); | ^^^^^^^^^^^^^^ attempt to shift right by `128_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:74:15 + --> $DIR/lint-overflowing-ops.rs:83:15 | LL | let _n = &(1u64 >> 64); | ^^^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:71:15 + --> $DIR/lint-overflowing-ops.rs:80:15 | LL | let _n = &(1u32 >> 32); | ^^^^^^^^^^^^ attempt to shift right by `32_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:68:15 + --> $DIR/lint-overflowing-ops.rs:77:15 | LL | let _n = &(1u16 >> 16); | ^^^^^^^^^^^^ attempt to shift right by `16_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:65:15 + --> $DIR/lint-overflowing-ops.rs:74:15 | LL | let _n = &(1u8 >> 8); | ^^^^^^^^^^ attempt to shift right by `8_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:60:15 + --> $DIR/lint-overflowing-ops.rs:65:15 + | +LL | let _n = &(1 << -1); + | ^^^^^^^^^ attempt to shift left by `-1_i32`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:62:15 | LL | let _n = &(1_usize << BITS); | ^^^^^^^^^^^^^^^^^ attempt to shift left by `%BITS%`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:57:15 + --> $DIR/lint-overflowing-ops.rs:59:15 | LL | let _n = &(1_isize << BITS); | ^^^^^^^^^^^^^^^^^ attempt to shift left by `%BITS%`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:54:15 + --> $DIR/lint-overflowing-ops.rs:56:15 | LL | let _n = &(1i128 << 128); | ^^^^^^^^^^^^^^ attempt to shift left by `128_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:51:15 + --> $DIR/lint-overflowing-ops.rs:53:15 | LL | let _n = &(1i64 << 64); | ^^^^^^^^^^^^ attempt to shift left by `64_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:48:15 + --> $DIR/lint-overflowing-ops.rs:50:15 | LL | let _n = &(1i32 << 32); | ^^^^^^^^^^^^ attempt to shift left by `32_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:45:15 + --> $DIR/lint-overflowing-ops.rs:47:15 | LL | let _n = &(1i16 << 16); | ^^^^^^^^^^^^ attempt to shift left by `16_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:42:15 + --> $DIR/lint-overflowing-ops.rs:44:15 | LL | let _n = &(1i8 << 8); | ^^^^^^^^^^ attempt to shift left by `8_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:39:15 + --> $DIR/lint-overflowing-ops.rs:41:15 | LL | let _n = &(1u128 << 128); | ^^^^^^^^^^^^^^ attempt to shift left by `128_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:36:15 + --> $DIR/lint-overflowing-ops.rs:38:15 | LL | let _n = &(1u64 << 64); | ^^^^^^^^^^^^ attempt to shift left by `64_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:33:15 + --> $DIR/lint-overflowing-ops.rs:35:15 | LL | let _n = &(1u32 << 32); | ^^^^^^^^^^^^ attempt to shift left by `32_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:30:15 + --> $DIR/lint-overflowing-ops.rs:32:15 | LL | let _n = &(1u16 << 16); | ^^^^^^^^^^^^ attempt to shift left by `16_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:27:15 + --> $DIR/lint-overflowing-ops.rs:29:15 | LL | let _n = &(1u8 << 8); | ^^^^^^^^^^ attempt to shift left by `8_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:29:14 + --> $DIR/lint-overflowing-ops.rs:31:14 | LL | let _n = 1u16 << 16; | ^^^^^^^^^^ attempt to shift left by `16_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:32:14 + --> $DIR/lint-overflowing-ops.rs:34:14 | LL | let _n = 1u32 << 32; | ^^^^^^^^^^ attempt to shift left by `32_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:35:14 + --> $DIR/lint-overflowing-ops.rs:37:14 | LL | let _n = 1u64 << 64; | ^^^^^^^^^^ attempt to shift left by `64_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:38:14 + --> $DIR/lint-overflowing-ops.rs:40:14 | LL | let _n = 1u128 << 128; | ^^^^^^^^^^^^ attempt to shift left by `128_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:41:14 + --> $DIR/lint-overflowing-ops.rs:43:14 | LL | let _n = 1i8 << 8; | ^^^^^^^^ attempt to shift left by `8_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:44:14 + --> $DIR/lint-overflowing-ops.rs:46:14 | LL | let _n = 1i16 << 16; | ^^^^^^^^^^ attempt to shift left by `16_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:47:14 + --> $DIR/lint-overflowing-ops.rs:49:14 | LL | let _n = 1i32 << 32; | ^^^^^^^^^^ attempt to shift left by `32_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:50:14 + --> $DIR/lint-overflowing-ops.rs:52:14 | LL | let _n = 1i64 << 64; | ^^^^^^^^^^ attempt to shift left by `64_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:53:14 + --> $DIR/lint-overflowing-ops.rs:55:14 | LL | let _n = 1i128 << 128; | ^^^^^^^^^^^^ attempt to shift left by `128_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:56:14 + --> $DIR/lint-overflowing-ops.rs:58:14 | LL | let _n = 1_isize << BITS; | ^^^^^^^^^^^^^^^ attempt to shift left by `%BITS%`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:59:14 + --> $DIR/lint-overflowing-ops.rs:61:14 | LL | let _n = 1_usize << BITS; | ^^^^^^^^^^^^^^^ attempt to shift left by `%BITS%`, which would overflow @@ -439,293 +457,329 @@ LL | let _n = 1_usize << BITS; error: this arithmetic operation will overflow --> $DIR/lint-overflowing-ops.rs:64:14 | +LL | let _n = 1 << -1; + | ^^^^^^^ attempt to shift left by `-1_i32`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:69:14 + | +LL | let _n = -1_i64 >> 64; + | ^^^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:70:14 + | +LL | let _n = -1_i32 >> 32; + | ^^^^^^^^^^^^ attempt to shift right by `32_i32`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:71:14 + | +LL | let _n = -1_i32 >> -1; + | ^^^^^^^^^^^^ attempt to shift right by `-1_i32`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:73:14 + | LL | let _n = 1u8 >> 8; | ^^^^^^^^ attempt to shift right by `8_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:67:14 + --> $DIR/lint-overflowing-ops.rs:76:14 | LL | let _n = 1u16 >> 16; | ^^^^^^^^^^ attempt to shift right by `16_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:70:14 + --> $DIR/lint-overflowing-ops.rs:79:14 | LL | let _n = 1u32 >> 32; | ^^^^^^^^^^ attempt to shift right by `32_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:73:14 + --> $DIR/lint-overflowing-ops.rs:82:14 | LL | let _n = 1u64 >> 64; | ^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:76:14 + --> $DIR/lint-overflowing-ops.rs:85:14 | LL | let _n = 1u128 >> 128; | ^^^^^^^^^^^^ attempt to shift right by `128_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:79:14 + --> $DIR/lint-overflowing-ops.rs:88:14 | LL | let _n = 1i8 >> 8; | ^^^^^^^^ attempt to shift right by `8_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:82:14 + --> $DIR/lint-overflowing-ops.rs:91:14 | LL | let _n = 1i16 >> 16; | ^^^^^^^^^^ attempt to shift right by `16_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:85:14 + --> $DIR/lint-overflowing-ops.rs:94:14 | LL | let _n = 1i32 >> 32; | ^^^^^^^^^^ attempt to shift right by `32_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:88:14 + --> $DIR/lint-overflowing-ops.rs:97:14 | LL | let _n = 1i64 >> 64; | ^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:91:14 + --> $DIR/lint-overflowing-ops.rs:100:14 | LL | let _n = 1i128 >> 128; | ^^^^^^^^^^^^ attempt to shift right by `128_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:94:14 + --> $DIR/lint-overflowing-ops.rs:103:14 | LL | let _n = 1_isize >> BITS; | ^^^^^^^^^^^^^^^ attempt to shift right by `%BITS%`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:97:14 + --> $DIR/lint-overflowing-ops.rs:106:14 | LL | let _n = 1_usize >> BITS; | ^^^^^^^^^^^^^^^ attempt to shift right by `%BITS%`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:102:14 + --> $DIR/lint-overflowing-ops.rs:109:14 + | +LL | let _n = 1i64 >> [64][0]; + | ^^^^^^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:113:14 | LL | let _n = 1u8 + u8::MAX; | ^^^^^^^^^^^^^ attempt to compute `1_u8 + u8::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:105:14 + --> $DIR/lint-overflowing-ops.rs:116:14 | LL | let _n = 1u16 + u16::MAX; | ^^^^^^^^^^^^^^^ attempt to compute `1_u16 + u16::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:108:14 + --> $DIR/lint-overflowing-ops.rs:119:14 | LL | let _n = 1u32 + u32::MAX; | ^^^^^^^^^^^^^^^ attempt to compute `1_u32 + u32::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:111:14 + --> $DIR/lint-overflowing-ops.rs:122:14 | LL | let _n = 1u64 + u64::MAX; | ^^^^^^^^^^^^^^^ attempt to compute `1_u64 + u64::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:114:14 + --> $DIR/lint-overflowing-ops.rs:125:14 | LL | let _n = 1u128 + u128::MAX; | ^^^^^^^^^^^^^^^^^ attempt to compute `1_u128 + u128::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:117:14 + --> $DIR/lint-overflowing-ops.rs:128:14 | LL | let _n = 1i8 + i8::MAX; | ^^^^^^^^^^^^^ attempt to compute `1_i8 + i8::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:120:14 + --> $DIR/lint-overflowing-ops.rs:131:14 | LL | let _n = 1i16 + i16::MAX; | ^^^^^^^^^^^^^^^ attempt to compute `1_i16 + i16::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:123:14 + --> $DIR/lint-overflowing-ops.rs:134:14 | LL | let _n = 1i32 + i32::MAX; | ^^^^^^^^^^^^^^^ attempt to compute `1_i32 + i32::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:126:14 + --> $DIR/lint-overflowing-ops.rs:137:14 | LL | let _n = 1i64 + i64::MAX; | ^^^^^^^^^^^^^^^ attempt to compute `1_i64 + i64::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:129:14 + --> $DIR/lint-overflowing-ops.rs:140:14 | LL | let _n = 1i128 + i128::MAX; | ^^^^^^^^^^^^^^^^^ attempt to compute `1_i128 + i128::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:132:14 + --> $DIR/lint-overflowing-ops.rs:143:14 | LL | let _n = 1isize + isize::MAX; | ^^^^^^^^^^^^^^^^^^^ attempt to compute `1_isize + isize::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:135:14 + --> $DIR/lint-overflowing-ops.rs:146:14 | LL | let _n = 1usize + usize::MAX; | ^^^^^^^^^^^^^^^^^^^ attempt to compute `1_usize + usize::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:140:14 + --> $DIR/lint-overflowing-ops.rs:151:14 | LL | let _n = 1u8 - 5; | ^^^^^^^ attempt to compute `1_u8 - 5_u8`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:143:14 + --> $DIR/lint-overflowing-ops.rs:154:14 | LL | let _n = 1u16 - 5; | ^^^^^^^^ attempt to compute `1_u16 - 5_u16`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:146:14 + --> $DIR/lint-overflowing-ops.rs:157:14 | LL | let _n = 1u32 - 5; | ^^^^^^^^ attempt to compute `1_u32 - 5_u32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:149:14 + --> $DIR/lint-overflowing-ops.rs:160:14 | LL | let _n = 1u64 - 5 ; | ^^^^^^^^ attempt to compute `1_u64 - 5_u64`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:152:14 + --> $DIR/lint-overflowing-ops.rs:163:14 | LL | let _n = 1u128 - 5 ; | ^^^^^^^^^ attempt to compute `1_u128 - 5_u128`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:155:14 + --> $DIR/lint-overflowing-ops.rs:166:14 | LL | let _n = -5i8 - i8::MAX; | ^^^^^^^^^^^^^^ attempt to compute `-5_i8 - i8::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:158:14 + --> $DIR/lint-overflowing-ops.rs:169:14 | LL | let _n = -5i16 - i16::MAX; | ^^^^^^^^^^^^^^^^ attempt to compute `-5_i16 - i16::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:161:14 + --> $DIR/lint-overflowing-ops.rs:172:14 | LL | let _n = -5i32 - i32::MAX; | ^^^^^^^^^^^^^^^^ attempt to compute `-5_i32 - i32::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:164:14 + --> $DIR/lint-overflowing-ops.rs:175:14 | LL | let _n = -5i64 - i64::MAX; | ^^^^^^^^^^^^^^^^ attempt to compute `-5_i64 - i64::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:167:14 + --> $DIR/lint-overflowing-ops.rs:178:14 | LL | let _n = -5i128 - i128::MAX; | ^^^^^^^^^^^^^^^^^^ attempt to compute `-5_i128 - i128::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:170:14 + --> $DIR/lint-overflowing-ops.rs:181:14 | LL | let _n = -5isize - isize::MAX; | ^^^^^^^^^^^^^^^^^^^^ attempt to compute `-5_isize - isize::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:173:14 + --> $DIR/lint-overflowing-ops.rs:184:14 | LL | let _n = 1usize - 5; | ^^^^^^^^^^ attempt to compute `1_usize - 5_usize`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:178:14 + --> $DIR/lint-overflowing-ops.rs:187:14 + | +LL | let _n = -i8::MIN; + | ^^^^^^^^ attempt to negate `i8::MIN`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:192:14 | LL | let _n = u8::MAX * 5; | ^^^^^^^^^^^ attempt to compute `u8::MAX * 5_u8`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:181:14 + --> $DIR/lint-overflowing-ops.rs:195:14 | LL | let _n = u16::MAX * 5; | ^^^^^^^^^^^^ attempt to compute `u16::MAX * 5_u16`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:184:14 + --> $DIR/lint-overflowing-ops.rs:198:14 | LL | let _n = u32::MAX * 5; | ^^^^^^^^^^^^ attempt to compute `u32::MAX * 5_u32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:187:14 + --> $DIR/lint-overflowing-ops.rs:201:14 | LL | let _n = u64::MAX * 5; | ^^^^^^^^^^^^ attempt to compute `u64::MAX * 5_u64`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:190:14 + --> $DIR/lint-overflowing-ops.rs:204:14 | LL | let _n = u128::MAX * 5; | ^^^^^^^^^^^^^ attempt to compute `u128::MAX * 5_u128`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:193:14 + --> $DIR/lint-overflowing-ops.rs:207:14 + | +LL | let _n = usize::MAX * 5; + | ^^^^^^^^^^^^^^ attempt to compute `usize::MAX * 5_usize`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:210:14 | LL | let _n = i8::MAX * i8::MAX; | ^^^^^^^^^^^^^^^^^ attempt to compute `i8::MAX * i8::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:196:14 + --> $DIR/lint-overflowing-ops.rs:213:14 | LL | let _n = i16::MAX * 5; | ^^^^^^^^^^^^ attempt to compute `i16::MAX * 5_i16`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:199:14 + --> $DIR/lint-overflowing-ops.rs:216:14 | LL | let _n = i32::MAX * 5; | ^^^^^^^^^^^^ attempt to compute `i32::MAX * 5_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:202:14 + --> $DIR/lint-overflowing-ops.rs:219:14 | LL | let _n = i64::MAX * 5; | ^^^^^^^^^^^^ attempt to compute `i64::MAX * 5_i64`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:205:14 + --> $DIR/lint-overflowing-ops.rs:222:14 | LL | let _n = i128::MAX * 5; | ^^^^^^^^^^^^^ attempt to compute `i128::MAX * 5_i128`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:208:14 + --> $DIR/lint-overflowing-ops.rs:225:14 | LL | let _n = isize::MAX * 5; | ^^^^^^^^^^^^^^ attempt to compute `isize::MAX * 5_isize`, which would overflow -error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:211:14 - | -LL | let _n = usize::MAX * 5; - | ^^^^^^^^^^^^^^ attempt to compute `usize::MAX * 5_usize`, which would overflow - error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:216:14 + --> $DIR/lint-overflowing-ops.rs:230:14 | LL | let _n = 1u8 / 0; | ^^^^^^^ attempt to divide `1_u8` by zero @@ -733,298 +787,442 @@ LL | let _n = 1u8 / 0; = note: `#[deny(unconditional_panic)]` on by default error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:217:15 + --> $DIR/lint-overflowing-ops.rs:231:15 | LL | let _n = &(1u8 / 0); | ^^^^^^^^^ attempt to divide `1_u8` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:219:14 + --> $DIR/lint-overflowing-ops.rs:233:14 | LL | let _n = 1u16 / 0; | ^^^^^^^^ attempt to divide `1_u16` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:220:15 + --> $DIR/lint-overflowing-ops.rs:234:15 | LL | let _n = &(1u16 / 0); | ^^^^^^^^^^ attempt to divide `1_u16` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:222:14 + --> $DIR/lint-overflowing-ops.rs:236:14 | LL | let _n = 1u32 / 0; | ^^^^^^^^ attempt to divide `1_u32` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:223:15 + --> $DIR/lint-overflowing-ops.rs:237:15 | LL | let _n = &(1u32 / 0); | ^^^^^^^^^^ attempt to divide `1_u32` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:225:14 + --> $DIR/lint-overflowing-ops.rs:239:14 | LL | let _n = 1u64 / 0; | ^^^^^^^^ attempt to divide `1_u64` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:226:15 + --> $DIR/lint-overflowing-ops.rs:240:15 | LL | let _n = &(1u64 / 0); | ^^^^^^^^^^ attempt to divide `1_u64` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:228:14 + --> $DIR/lint-overflowing-ops.rs:242:14 | LL | let _n = 1u128 / 0; | ^^^^^^^^^ attempt to divide `1_u128` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:229:15 + --> $DIR/lint-overflowing-ops.rs:243:15 | LL | let _n = &(1u128 / 0); | ^^^^^^^^^^^ attempt to divide `1_u128` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:231:14 - | -LL | let _n = 1i8 / 0; - | ^^^^^^^ attempt to divide `1_i8` by zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:232:15 - | -LL | let _n = &(1i8 / 0); - | ^^^^^^^^^ attempt to divide `1_i8` by zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:234:14 - | -LL | let _n = 1i16 / 0; - | ^^^^^^^^ attempt to divide `1_i16` by zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:235:15 - | -LL | let _n = &(1i16 / 0); - | ^^^^^^^^^^ attempt to divide `1_i16` by zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:237:14 - | -LL | let _n = 1i32 / 0; - | ^^^^^^^^ attempt to divide `1_i32` by zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:238:15 - | -LL | let _n = &(1i32 / 0); - | ^^^^^^^^^^ attempt to divide `1_i32` by zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:240:14 - | -LL | let _n = 1i64 / 0; - | ^^^^^^^^ attempt to divide `1_i64` by zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:241:15 - | -LL | let _n = &(1i64 / 0); - | ^^^^^^^^^^ attempt to divide `1_i64` by zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:243:14 - | -LL | let _n = 1i128 / 0; - | ^^^^^^^^^ attempt to divide `1_i128` by zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:244:15 - | -LL | let _n = &(1i128 / 0); - | ^^^^^^^^^^^ attempt to divide `1_i128` by zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:246:14 - | -LL | let _n = 1isize / 0; - | ^^^^^^^^^^ attempt to divide `1_isize` by zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:247:15 - | -LL | let _n = &(1isize / 0); - | ^^^^^^^^^^^^ attempt to divide `1_isize` by zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:249:14 + --> $DIR/lint-overflowing-ops.rs:245:14 | LL | let _n = 1usize / 0; | ^^^^^^^^^^ attempt to divide `1_usize` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:250:15 + --> $DIR/lint-overflowing-ops.rs:246:15 | LL | let _n = &(1usize / 0); | ^^^^^^^^^^^^ attempt to divide `1_usize` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:254:14 + --> $DIR/lint-overflowing-ops.rs:248:14 + | +LL | let _n = 1i8 / 0; + | ^^^^^^^ attempt to divide `1_i8` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:249:15 + | +LL | let _n = &(1i8 / 0); + | ^^^^^^^^^ attempt to divide `1_i8` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:250:14 + | +LL | let _n = i8::MIN / -1; + | ^^^^^^^^^^^^ attempt to compute `i8::MIN / -1_i8`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:251:15 + | +LL | let _n = &(i8::MIN / -1); + | ^^^^^^^^^^^^^^ attempt to compute `i8::MIN / -1_i8`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:253:14 + | +LL | let _n = 1i16 / 0; + | ^^^^^^^^ attempt to divide `1_i16` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:254:15 + | +LL | let _n = &(1i16 / 0); + | ^^^^^^^^^^ attempt to divide `1_i16` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:255:14 + | +LL | let _n = i16::MIN / -1; + | ^^^^^^^^^^^^^ attempt to compute `i16::MIN / -1_i16`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:256:15 + | +LL | let _n = &(i16::MIN / -1); + | ^^^^^^^^^^^^^^^ attempt to compute `i16::MIN / -1_i16`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:258:14 + | +LL | let _n = 1i32 / 0; + | ^^^^^^^^ attempt to divide `1_i32` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:259:15 + | +LL | let _n = &(1i32 / 0); + | ^^^^^^^^^^ attempt to divide `1_i32` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:260:14 + | +LL | let _n = i32::MIN / -1; + | ^^^^^^^^^^^^^ attempt to compute `i32::MIN / -1_i32`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:261:15 + | +LL | let _n = &(i32::MIN / -1); + | ^^^^^^^^^^^^^^^ attempt to compute `i32::MIN / -1_i32`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:263:14 + | +LL | let _n = 1i64 / 0; + | ^^^^^^^^ attempt to divide `1_i64` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:264:15 + | +LL | let _n = &(1i64 / 0); + | ^^^^^^^^^^ attempt to divide `1_i64` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:265:14 + | +LL | let _n = i64::MIN / -1; + | ^^^^^^^^^^^^^ attempt to compute `i64::MIN / -1_i64`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:266:15 + | +LL | let _n = &(i64::MIN / -1); + | ^^^^^^^^^^^^^^^ attempt to compute `i64::MIN / -1_i64`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:268:14 + | +LL | let _n = 1i128 / 0; + | ^^^^^^^^^ attempt to divide `1_i128` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:269:15 + | +LL | let _n = &(1i128 / 0); + | ^^^^^^^^^^^ attempt to divide `1_i128` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:270:14 + | +LL | let _n = i128::MIN / -1; + | ^^^^^^^^^^^^^^ attempt to compute `i128::MIN / -1_i128`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:271:15 + | +LL | let _n = &(i128::MIN / -1); + | ^^^^^^^^^^^^^^^^ attempt to compute `i128::MIN / -1_i128`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:273:14 + | +LL | let _n = 1isize / 0; + | ^^^^^^^^^^ attempt to divide `1_isize` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:274:15 + | +LL | let _n = &(1isize / 0); + | ^^^^^^^^^^^^ attempt to divide `1_isize` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:275:14 + | +LL | let _n = isize::MIN / -1; + | ^^^^^^^^^^^^^^^ attempt to compute `isize::MIN / -1_isize`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:276:15 + | +LL | let _n = &(isize::MIN / -1); + | ^^^^^^^^^^^^^^^^^ attempt to compute `isize::MIN / -1_isize`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:280:14 | LL | let _n = 1u8 % 0; | ^^^^^^^ attempt to calculate the remainder of `1_u8` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:255:15 + --> $DIR/lint-overflowing-ops.rs:281:15 | LL | let _n = &(1u8 % 0); | ^^^^^^^^^ attempt to calculate the remainder of `1_u8` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:257:14 + --> $DIR/lint-overflowing-ops.rs:283:14 | LL | let _n = 1u16 % 0; | ^^^^^^^^ attempt to calculate the remainder of `1_u16` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:258:15 + --> $DIR/lint-overflowing-ops.rs:284:15 | LL | let _n = &(1u16 % 0); | ^^^^^^^^^^ attempt to calculate the remainder of `1_u16` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:260:14 + --> $DIR/lint-overflowing-ops.rs:286:14 | LL | let _n = 1u32 % 0; | ^^^^^^^^ attempt to calculate the remainder of `1_u32` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:261:15 + --> $DIR/lint-overflowing-ops.rs:287:15 | LL | let _n = &(1u32 % 0); | ^^^^^^^^^^ attempt to calculate the remainder of `1_u32` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:263:14 + --> $DIR/lint-overflowing-ops.rs:289:14 | LL | let _n = 1u64 % 0; | ^^^^^^^^ attempt to calculate the remainder of `1_u64` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:264:15 + --> $DIR/lint-overflowing-ops.rs:290:15 | LL | let _n = &(1u64 % 0); | ^^^^^^^^^^ attempt to calculate the remainder of `1_u64` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:266:14 + --> $DIR/lint-overflowing-ops.rs:292:14 | LL | let _n = 1u128 % 0; | ^^^^^^^^^ attempt to calculate the remainder of `1_u128` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:267:15 + --> $DIR/lint-overflowing-ops.rs:293:15 | LL | let _n = &(1u128 % 0); | ^^^^^^^^^^^ attempt to calculate the remainder of `1_u128` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:269:14 - | -LL | let _n = 1i8 % 0; - | ^^^^^^^ attempt to calculate the remainder of `1_i8` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:270:15 - | -LL | let _n = &(1i8 % 0); - | ^^^^^^^^^ attempt to calculate the remainder of `1_i8` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:272:14 - | -LL | let _n = 1i16 % 0; - | ^^^^^^^^ attempt to calculate the remainder of `1_i16` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:273:15 - | -LL | let _n = &(1i16 % 0); - | ^^^^^^^^^^ attempt to calculate the remainder of `1_i16` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:275:14 - | -LL | let _n = 1i32 % 0; - | ^^^^^^^^ attempt to calculate the remainder of `1_i32` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:276:15 - | -LL | let _n = &(1i32 % 0); - | ^^^^^^^^^^ attempt to calculate the remainder of `1_i32` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:278:14 - | -LL | let _n = 1i64 % 0; - | ^^^^^^^^ attempt to calculate the remainder of `1_i64` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:279:15 - | -LL | let _n = &(1i64 % 0); - | ^^^^^^^^^^ attempt to calculate the remainder of `1_i64` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:281:14 - | -LL | let _n = 1i128 % 0; - | ^^^^^^^^^ attempt to calculate the remainder of `1_i128` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:282:15 - | -LL | let _n = &(1i128 % 0); - | ^^^^^^^^^^^ attempt to calculate the remainder of `1_i128` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:284:14 - | -LL | let _n = 1isize % 0; - | ^^^^^^^^^^ attempt to calculate the remainder of `1_isize` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:285:15 - | -LL | let _n = &(1isize % 0); - | ^^^^^^^^^^^^ attempt to calculate the remainder of `1_isize` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:287:14 + --> $DIR/lint-overflowing-ops.rs:295:14 | LL | let _n = 1usize % 0; | ^^^^^^^^^^ attempt to calculate the remainder of `1_usize` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:288:15 + --> $DIR/lint-overflowing-ops.rs:296:15 | LL | let _n = &(1usize % 0); | ^^^^^^^^^^^^ attempt to calculate the remainder of `1_usize` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:292:14 + --> $DIR/lint-overflowing-ops.rs:298:14 + | +LL | let _n = 1i8 % 0; + | ^^^^^^^ attempt to calculate the remainder of `1_i8` with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:299:15 + | +LL | let _n = &(1i8 % 0); + | ^^^^^^^^^ attempt to calculate the remainder of `1_i8` with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:300:14 + | +LL | let _n = i8::MIN % -1; + | ^^^^^^^^^^^^ attempt to compute `i8::MIN % -1_i8`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:301:15 + | +LL | let _n = &(i8::MIN % -1); + | ^^^^^^^^^^^^^^ attempt to compute `i8::MIN % -1_i8`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:303:14 + | +LL | let _n = 1i16 % 0; + | ^^^^^^^^ attempt to calculate the remainder of `1_i16` with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:304:15 + | +LL | let _n = &(1i16 % 0); + | ^^^^^^^^^^ attempt to calculate the remainder of `1_i16` with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:305:14 + | +LL | let _n = i16::MIN % -1; + | ^^^^^^^^^^^^^ attempt to compute `i16::MIN % -1_i16`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:306:15 + | +LL | let _n = &(i16::MIN % -1); + | ^^^^^^^^^^^^^^^ attempt to compute `i16::MIN % -1_i16`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:308:14 + | +LL | let _n = 1i32 % 0; + | ^^^^^^^^ attempt to calculate the remainder of `1_i32` with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:309:15 + | +LL | let _n = &(1i32 % 0); + | ^^^^^^^^^^ attempt to calculate the remainder of `1_i32` with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:310:14 + | +LL | let _n = i32::MIN % -1; + | ^^^^^^^^^^^^^ attempt to compute `i32::MIN % -1_i32`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:311:15 + | +LL | let _n = &(i32::MIN % -1); + | ^^^^^^^^^^^^^^^ attempt to compute `i32::MIN % -1_i32`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:313:14 + | +LL | let _n = 1i64 % 0; + | ^^^^^^^^ attempt to calculate the remainder of `1_i64` with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:314:15 + | +LL | let _n = &(1i64 % 0); + | ^^^^^^^^^^ attempt to calculate the remainder of `1_i64` with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:315:14 + | +LL | let _n = i64::MIN % -1; + | ^^^^^^^^^^^^^ attempt to compute `i64::MIN % -1_i64`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:316:15 + | +LL | let _n = &(i64::MIN % -1); + | ^^^^^^^^^^^^^^^ attempt to compute `i64::MIN % -1_i64`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:318:14 + | +LL | let _n = 1i128 % 0; + | ^^^^^^^^^ attempt to calculate the remainder of `1_i128` with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:319:15 + | +LL | let _n = &(1i128 % 0); + | ^^^^^^^^^^^ attempt to calculate the remainder of `1_i128` with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:320:14 + | +LL | let _n = i128::MIN % -1; + | ^^^^^^^^^^^^^^ attempt to compute `i128::MIN % -1_i128`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:321:15 + | +LL | let _n = &(i128::MIN % -1); + | ^^^^^^^^^^^^^^^^ attempt to compute `i128::MIN % -1_i128`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:323:14 + | +LL | let _n = 1isize % 0; + | ^^^^^^^^^^ attempt to calculate the remainder of `1_isize` with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:324:15 + | +LL | let _n = &(1isize % 0); + | ^^^^^^^^^^^^ attempt to calculate the remainder of `1_isize` with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:325:14 + | +LL | let _n = isize::MIN % -1; + | ^^^^^^^^^^^^^^^ attempt to compute `isize::MIN % -1_isize`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:326:15 + | +LL | let _n = &(isize::MIN % -1); + | ^^^^^^^^^^^^^^^^^ attempt to compute `isize::MIN % -1_isize`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:329:14 | LL | let _n = [1, 2, 3][4]; | ^^^^^^^^^^^^ index out of bounds: the length is 3 but the index is 4 error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:293:15 + --> $DIR/lint-overflowing-ops.rs:330:15 | LL | let _n = &([1, 2, 3][4]); | ^^^^^^^^^^^^^^ index out of bounds: the length is 3 but the index is 4 -error: aborting due to 170 previous errors +error: aborting due to 203 previous errors diff --git a/tests/ui/lint/lint-overflowing-ops.rs b/tests/ui/lint/lint-overflowing-ops.rs index e64c210badef..3aadf7732437 100644 --- a/tests/ui/lint/lint-overflowing-ops.rs +++ b/tests/ui/lint/lint-overflowing-ops.rs @@ -21,6 +21,8 @@ const BITS: usize = 32; #[cfg(target_pointer_width = "64")] const BITS: usize = 64; +use std::thread; + fn main() { // Shift left let _n = 1u8 << 8; //~ ERROR: arithmetic operation will overflow @@ -59,8 +61,15 @@ fn main() { let _n = 1_usize << BITS; //~ ERROR: arithmetic operation will overflow let _n = &(1_usize << BITS); //~ ERROR: arithmetic operation will overflow + let _n = 1 << -1; //~ ERROR: arithmetic operation will overflow + let _n = &(1 << -1); //~ ERROR: arithmetic operation will overflow // Shift right + + let _n = -1_i64 >> 64; //~ ERROR: arithmetic operation will overflow + let _n = -1_i32 >> 32; //~ ERROR: arithmetic operation will overflow + let _n = -1_i32 >> -1; //~ ERROR: arithmetic operation will overflow + let _n = 1u8 >> 8; //~ ERROR: arithmetic operation will overflow let _n = &(1u8 >> 8); //~ ERROR: arithmetic operation will overflow @@ -97,6 +106,8 @@ fn main() { let _n = 1_usize >> BITS; //~ ERROR: arithmetic operation will overflow let _n = &(1_usize >> BITS); //~ ERROR: arithmetic operation will overflow + let _n = 1i64 >> [64][0]; //~ ERROR: arithmetic operation will overflow + let _n = &(1i64 >> [64][0]); //~ ERROR: arithmetic operation will overflow // Addition let _n = 1u8 + u8::MAX; //~ ERROR: arithmetic operation will overflow @@ -173,6 +184,9 @@ fn main() { let _n = 1usize - 5; //~ ERROR: arithmetic operation will overflow let _n = &(1usize - 5); //~ ERROR: arithmetic operation will overflow + let _n = -i8::MIN; //~ ERROR this arithmetic operation will overflow + let _n = &(-i8::MIN); //~ ERROR this arithmetic operation will overflow + // Multiplication let _n = u8::MAX * 5; //~ ERROR: arithmetic operation will overflow @@ -190,6 +204,9 @@ fn main() { let _n = u128::MAX * 5; //~ ERROR: arithmetic operation will overflow let _n = &(u128::MAX * 5); //~ ERROR: arithmetic operation will overflow + let _n = usize::MAX * 5; //~ ERROR: arithmetic operation will overflow + let _n = &(usize::MAX * 5); //~ ERROR: arithmetic operation will overflow + let _n = i8::MAX * i8::MAX; //~ ERROR: arithmetic operation will overflow let _n = &(i8::MAX * i8::MAX); //~ ERROR: arithmetic operation will overflow @@ -208,9 +225,6 @@ fn main() { let _n = isize::MAX * 5; //~ ERROR: arithmetic operation will overflow let _n = &(isize::MAX * 5); //~ ERROR: arithmetic operation will overflow - let _n = usize::MAX * 5; //~ ERROR: arithmetic operation will overflow - let _n = &(usize::MAX * 5); //~ ERROR: arithmetic operation will overflow - // Division let _n = 1u8 / 0; //~ ERROR: this operation will panic at runtime @@ -228,26 +242,38 @@ fn main() { let _n = 1u128 / 0; //~ ERROR: this operation will panic at runtime let _n = &(1u128 / 0); //~ ERROR: this operation will panic at runtime + let _n = 1usize / 0; //~ ERROR: this operation will panic at runtime + let _n = &(1usize / 0); //~ ERROR: this operation will panic at runtime + let _n = 1i8 / 0; //~ ERROR: this operation will panic at runtime let _n = &(1i8 / 0); //~ ERROR: this operation will panic at runtime + let _n = i8::MIN / -1; //~ ERROR: this operation will panic at runtime + let _n = &(i8::MIN / -1); //~ ERROR: this operation will panic at runtime let _n = 1i16 / 0; //~ ERROR: this operation will panic at runtime let _n = &(1i16 / 0); //~ ERROR: this operation will panic at runtime + let _n = i16::MIN / -1; //~ ERROR: this operation will panic at runtime + let _n = &(i16::MIN / -1); //~ ERROR: this operation will panic at runtime let _n = 1i32 / 0; //~ ERROR: this operation will panic at runtime let _n = &(1i32 / 0); //~ ERROR: this operation will panic at runtime + let _n = i32::MIN / -1; //~ ERROR: this operation will panic at runtime + let _n = &(i32::MIN / -1); //~ ERROR: this operation will panic at runtime let _n = 1i64 / 0; //~ ERROR: this operation will panic at runtime let _n = &(1i64 / 0); //~ ERROR: this operation will panic at runtime + let _n = i64::MIN / -1; //~ ERROR: this operation will panic at runtime + let _n = &(i64::MIN / -1); //~ ERROR: this operation will panic at runtime let _n = 1i128 / 0; //~ ERROR: this operation will panic at runtime let _n = &(1i128 / 0); //~ ERROR: this operation will panic at runtime + let _n = i128::MIN / -1; //~ ERROR: this operation will panic at runtime + let _n = &(i128::MIN / -1); //~ ERROR: this operation will panic at runtime let _n = 1isize / 0; //~ ERROR: this operation will panic at runtime let _n = &(1isize / 0); //~ ERROR: this operation will panic at runtime - - let _n = 1usize / 0; //~ ERROR: this operation will panic at runtime - let _n = &(1usize / 0); //~ ERROR: this operation will panic at runtime + let _n = isize::MIN / -1; //~ ERROR: this operation will panic at runtime + let _n = &(isize::MIN / -1); //~ ERROR: this operation will panic at runtime // Modulus @@ -266,27 +292,38 @@ fn main() { let _n = 1u128 % 0; //~ ERROR: this operation will panic at runtime let _n = &(1u128 % 0); //~ ERROR: this operation will panic at runtime - let _n = 1i8 % 0; //~ ERROR: this operation will panic at runtime - let _n = &(1i8 % 0); //~ ERROR: this operation will panic at runtime - - let _n = 1i16 % 0; //~ ERROR: this operation will panic at runtime - let _n = &(1i16 % 0); //~ ERROR: this operation will panic at runtime - - let _n = 1i32 % 0; //~ ERROR: this operation will panic at runtime - let _n = &(1i32 % 0); //~ ERROR: this operation will panic at runtime - - let _n = 1i64 % 0; //~ ERROR: this operation will panic at runtime - let _n = &(1i64 % 0); //~ ERROR: this operation will panic at runtime - - let _n = 1i128 % 0; //~ ERROR: this operation will panic at runtime - let _n = &(1i128 % 0); //~ ERROR: this operation will panic at runtime - - let _n = 1isize % 0; //~ ERROR: this operation will panic at runtime - let _n = &(1isize % 0); //~ ERROR: this operation will panic at runtime - let _n = 1usize % 0; //~ ERROR: this operation will panic at runtime let _n = &(1usize % 0); //~ ERROR: this operation will panic at runtime + let _n = 1i8 % 0; //~ ERROR: this operation will panic at runtime + let _n = &(1i8 % 0); //~ ERROR: this operation will panic at runtime + let _n = i8::MIN % -1; //~ ERROR: this operation will panic at runtime + let _n = &(i8::MIN % -1); //~ ERROR: this operation will panic at runtime + + let _n = 1i16 % 0; //~ ERROR: this operation will panic at runtime + let _n = &(1i16 % 0); //~ ERROR: this operation will panic at runtime + let _n = i16::MIN % -1; //~ ERROR: this operation will panic at runtime + let _n = &(i16::MIN % -1); //~ ERROR: this operation will panic at runtime + + let _n = 1i32 % 0; //~ ERROR: this operation will panic at runtime + let _n = &(1i32 % 0); //~ ERROR: this operation will panic at runtime + let _n = i32::MIN % -1; //~ ERROR: this operation will panic at runtime + let _n = &(i32::MIN % -1); //~ ERROR: this operation will panic at runtime + + let _n = 1i64 % 0; //~ ERROR: this operation will panic at runtime + let _n = &(1i64 % 0); //~ ERROR: this operation will panic at runtime + let _n = i64::MIN % -1; //~ ERROR: this operation will panic at runtime + let _n = &(i64::MIN % -1); //~ ERROR: this operation will panic at runtime + + let _n = 1i128 % 0; //~ ERROR: this operation will panic at runtime + let _n = &(1i128 % 0); //~ ERROR: this operation will panic at runtime + let _n = i128::MIN % -1; //~ ERROR: this operation will panic at runtime + let _n = &(i128::MIN % -1); //~ ERROR: this operation will panic at runtime + + let _n = 1isize % 0; //~ ERROR: this operation will panic at runtime + let _n = &(1isize % 0); //~ ERROR: this operation will panic at runtime + let _n = isize::MIN % -1; //~ ERROR: this operation will panic at runtime + let _n = &(isize::MIN % -1); //~ ERROR: this operation will panic at runtime // Out of bounds access let _n = [1, 2, 3][4]; //~ ERROR: this operation will panic at runtime diff --git a/tests/ui/lint/noop-method-call.fixed b/tests/ui/lint/noop-method-call.fixed deleted file mode 100644 index 279dc8a3cd0c..000000000000 --- a/tests/ui/lint/noop-method-call.fixed +++ /dev/null @@ -1,64 +0,0 @@ -//@ check-pass -//@ run-rustfix - -#![feature(rustc_attrs)] -#![allow(unused)] - -use std::borrow::Borrow; -use std::ops::Deref; - -struct PlainType(T); - -#[derive(Clone)] -struct CloneType(T); - -fn check(mut encoded: &[u8]) { - let _ = &mut encoded; - //~^ WARN call to `.clone()` on a reference in this situation does nothing - let _ = &encoded; - //~^ WARN call to `.clone()` on a reference in this situation does nothing -} - -fn main() { - let non_clone_type_ref = &PlainType(1u32); - let non_clone_type_ref_clone: &PlainType = non_clone_type_ref; - //~^ WARN call to `.clone()` on a reference in this situation does nothing - - let clone_type_ref = &CloneType(1u32); - let clone_type_ref_clone: CloneType = clone_type_ref.clone(); - - - let non_deref_type = &PlainType(1u32); - let non_deref_type_deref: &PlainType = non_deref_type; - //~^ WARN call to `.deref()` on a reference in this situation does nothing - - let non_borrow_type = &PlainType(1u32); - let non_borrow_type_borrow: &PlainType = non_borrow_type; - //~^ WARN call to `.borrow()` on a reference in this situation does nothing - - // Borrowing a &&T does not warn since it has collapsed the double reference - let non_borrow_type = &&PlainType(1u32); - let non_borrow_type_borrow: &PlainType = non_borrow_type.borrow(); -} - -fn generic(non_clone_type: &PlainType) { - non_clone_type; - //~^ WARN call to `.clone()` on a reference in this situation does nothing -} - -fn non_generic(non_clone_type: &PlainType) { - non_clone_type; - //~^ WARN call to `.clone()` on a reference in this situation does nothing -} - -struct DiagnosticClone; -impl Clone for DiagnosticClone { - #[rustc_diagnostic_item = "other_clone"] - fn clone(&self) -> Self { - DiagnosticClone - } -} - -fn with_other_diagnostic_item(x: DiagnosticClone) { - x.clone(); -} diff --git a/tests/ui/lint/noop-method-call.rs b/tests/ui/lint/noop-method-call.rs index 447a4c62410b..8db5c889d1c3 100644 --- a/tests/ui/lint/noop-method-call.rs +++ b/tests/ui/lint/noop-method-call.rs @@ -1,5 +1,4 @@ //@ check-pass -//@ run-rustfix #![feature(rustc_attrs)] #![allow(unused)] diff --git a/tests/ui/lint/noop-method-call.stderr b/tests/ui/lint/noop-method-call.stderr index d04f44022eef..8823644ac2d5 100644 --- a/tests/ui/lint/noop-method-call.stderr +++ b/tests/ui/lint/noop-method-call.stderr @@ -1,5 +1,5 @@ warning: call to `.clone()` on a reference in this situation does nothing - --> $DIR/noop-method-call.rs:16:25 + --> $DIR/noop-method-call.rs:15:25 | LL | let _ = &mut encoded.clone(); | ^^^^^^^^ help: remove this redundant call @@ -8,7 +8,7 @@ LL | let _ = &mut encoded.clone(); = note: `#[warn(noop_method_call)]` on by default warning: call to `.clone()` on a reference in this situation does nothing - --> $DIR/noop-method-call.rs:18:21 + --> $DIR/noop-method-call.rs:17:21 | LL | let _ = &encoded.clone(); | ^^^^^^^^ help: remove this redundant call @@ -16,44 +16,94 @@ LL | let _ = &encoded.clone(); = note: the type `[u8]` does not implement `Clone`, so calling `clone` on `&[u8]` copies the reference, which does not do anything and can be removed warning: call to `.clone()` on a reference in this situation does nothing - --> $DIR/noop-method-call.rs:24:71 + --> $DIR/noop-method-call.rs:23:71 | LL | let non_clone_type_ref_clone: &PlainType = non_clone_type_ref.clone(); - | ^^^^^^^^ help: remove this redundant call + | ^^^^^^^^ | = note: the type `PlainType` does not implement `Clone`, so calling `clone` on `&PlainType` copies the reference, which does not do anything and can be removed +help: remove this redundant call + | +LL - let non_clone_type_ref_clone: &PlainType = non_clone_type_ref.clone(); +LL + let non_clone_type_ref_clone: &PlainType = non_clone_type_ref; + | +help: if you meant to clone `PlainType`, implement `Clone` for it + | +LL + #[derive(Clone)] +LL | struct PlainType(T); + | warning: call to `.deref()` on a reference in this situation does nothing - --> $DIR/noop-method-call.rs:32:63 + --> $DIR/noop-method-call.rs:31:63 | LL | let non_deref_type_deref: &PlainType = non_deref_type.deref(); - | ^^^^^^^^ help: remove this redundant call + | ^^^^^^^^ | = note: the type `PlainType` does not implement `Deref`, so calling `deref` on `&PlainType` copies the reference, which does not do anything and can be removed +help: remove this redundant call + | +LL - let non_deref_type_deref: &PlainType = non_deref_type.deref(); +LL + let non_deref_type_deref: &PlainType = non_deref_type; + | +help: if you meant to clone `PlainType`, implement `Clone` for it + | +LL + #[derive(Clone)] +LL | struct PlainType(T); + | warning: call to `.borrow()` on a reference in this situation does nothing - --> $DIR/noop-method-call.rs:36:66 + --> $DIR/noop-method-call.rs:35:66 | LL | let non_borrow_type_borrow: &PlainType = non_borrow_type.borrow(); - | ^^^^^^^^^ help: remove this redundant call + | ^^^^^^^^^ | = note: the type `PlainType` does not implement `Borrow`, so calling `borrow` on `&PlainType` copies the reference, which does not do anything and can be removed +help: remove this redundant call + | +LL - let non_borrow_type_borrow: &PlainType = non_borrow_type.borrow(); +LL + let non_borrow_type_borrow: &PlainType = non_borrow_type; + | +help: if you meant to clone `PlainType`, implement `Clone` for it + | +LL + #[derive(Clone)] +LL | struct PlainType(T); + | warning: call to `.clone()` on a reference in this situation does nothing - --> $DIR/noop-method-call.rs:45:19 + --> $DIR/noop-method-call.rs:44:19 | LL | non_clone_type.clone(); - | ^^^^^^^^ help: remove this redundant call + | ^^^^^^^^ | = note: the type `PlainType` does not implement `Clone`, so calling `clone` on `&PlainType` copies the reference, which does not do anything and can be removed +help: remove this redundant call + | +LL - non_clone_type.clone(); +LL + non_clone_type; + | +help: if you meant to clone `PlainType`, implement `Clone` for it + | +LL + #[derive(Clone)] +LL | struct PlainType(T); + | warning: call to `.clone()` on a reference in this situation does nothing - --> $DIR/noop-method-call.rs:50:19 + --> $DIR/noop-method-call.rs:49:19 | LL | non_clone_type.clone(); - | ^^^^^^^^ help: remove this redundant call + | ^^^^^^^^ | = note: the type `PlainType` does not implement `Clone`, so calling `clone` on `&PlainType` copies the reference, which does not do anything and can be removed +help: remove this redundant call + | +LL - non_clone_type.clone(); +LL + non_clone_type; + | +help: if you meant to clone `PlainType`, implement `Clone` for it + | +LL + #[derive(Clone)] +LL | struct PlainType(T); + | warning: 7 warnings emitted diff --git a/tests/ui/lowering/span-bug-issue-121431.rs b/tests/ui/lowering/span-bug-issue-121431.rs new file mode 100644 index 000000000000..b855577bcfbf --- /dev/null +++ b/tests/ui/lowering/span-bug-issue-121431.rs @@ -0,0 +1,4 @@ +fn bug() -> impl CallbackMarker< Item = [(); { |_: &mut ()| 3; 4 }] > {} +//~^ ERROR cannot find trait `CallbackMarker` in this scope + +fn main() {} diff --git a/tests/ui/lowering/span-bug-issue-121431.stderr b/tests/ui/lowering/span-bug-issue-121431.stderr new file mode 100644 index 000000000000..595500b58064 --- /dev/null +++ b/tests/ui/lowering/span-bug-issue-121431.stderr @@ -0,0 +1,9 @@ +error[E0405]: cannot find trait `CallbackMarker` in this scope + --> $DIR/span-bug-issue-121431.rs:1:21 + | +LL | fn bug() -> impl CallbackMarker< Item = [(); { |_: &mut ()| 3; 4 }] > {} + | ^^^^^^^^^^^^^^ not found in this scope + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0405`. diff --git a/tests/ui/lto/issue-11154.stderr b/tests/ui/lto/issue-11154.stderr index 4d52f6c0f3d7..9f5d7518982d 100644 --- a/tests/ui/lto/issue-11154.stderr +++ b/tests/ui/lto/issue-11154.stderr @@ -1,6 +1,6 @@ error: cannot prefer dynamic linking when performing LTO - -note: only 'staticlib', 'bin', and 'cdylib' outputs are supported with LTO + | + = note: only 'staticlib', 'bin', and 'cdylib' outputs are supported with LTO error: aborting due to 1 previous error diff --git a/tests/ui/methods/issues/issue-105732.stderr b/tests/ui/methods/issues/issue-105732.stderr index 19ccd2de685a..a4924b3e663b 100644 --- a/tests/ui/methods/issues/issue-105732.stderr +++ b/tests/ui/methods/issues/issue-105732.stderr @@ -10,7 +10,12 @@ error[E0599]: no method named `g` found for reference `&Self` in the current sco --> $DIR/issue-105732.rs:10:14 | LL | self.g(); - | ^ help: there is a method with a similar name: `f` + | ^ + | +help: there is a method `f` with a similar name + | +LL | self.f(); + | ~ error: aborting due to 2 previous errors diff --git a/tests/ui/methods/method-not-found-but-doc-alias.stderr b/tests/ui/methods/method-not-found-but-doc-alias.stderr index 9746c404013d..c49ffa8971f7 100644 --- a/tests/ui/methods/method-not-found-but-doc-alias.stderr +++ b/tests/ui/methods/method-not-found-but-doc-alias.stderr @@ -5,7 +5,12 @@ LL | struct Foo; | ---------- method `quux` not found for this struct ... LL | Foo.quux(); - | ^^^^ help: there is a method with a similar name: `bar` + | ^^^^ + | +help: there is a method `bar` with a similar name + | +LL | Foo.bar(); + | ~~~ error: aborting due to 1 previous error diff --git a/tests/ui/never_type/span-bug-issue-121445.rs b/tests/ui/never_type/span-bug-issue-121445.rs new file mode 100644 index 000000000000..2fe22529c4e9 --- /dev/null +++ b/tests/ui/never_type/span-bug-issue-121445.rs @@ -0,0 +1,15 @@ +#![feature(never_type)] + +fn test2() { + let x: !; + let c2 = SingleVariant::Points(0) + | match x { //~ ERROR no implementation for `SingleVariant | ()` + _ => (), + }; +} + +enum SingleVariant { + Points(u32), +} + +fn main() {} diff --git a/tests/ui/never_type/span-bug-issue-121445.stderr b/tests/ui/never_type/span-bug-issue-121445.stderr new file mode 100644 index 000000000000..b211afa236fe --- /dev/null +++ b/tests/ui/never_type/span-bug-issue-121445.stderr @@ -0,0 +1,22 @@ +error[E0369]: no implementation for `SingleVariant | ()` + --> $DIR/span-bug-issue-121445.rs:6:9 + | +LL | let c2 = SingleVariant::Points(0) + | ------------------------ SingleVariant +LL | | match x { + | _________^_- +LL | | _ => (), +LL | | }; + | |_________- () + | +note: an implementation of `BitOr<()>` might be missing for `SingleVariant` + --> $DIR/span-bug-issue-121445.rs:11:1 + | +LL | enum SingleVariant { + | ^^^^^^^^^^^^^^^^^^ must implement `BitOr<()>` +note: the trait `BitOr` must be implemented + --> $SRC_DIR/core/src/ops/bit.rs:LL:COL + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0369`. diff --git a/tests/ui/numbers-arithmetic/issue-8460-const.noopt.stderr b/tests/ui/numbers-arithmetic/issue-8460-const.noopt.stderr deleted file mode 100644 index 2fba94d07401..000000000000 --- a/tests/ui/numbers-arithmetic/issue-8460-const.noopt.stderr +++ /dev/null @@ -1,148 +0,0 @@ -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:11:36 - | -LL | assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^^^^ attempt to compute `isize::MIN / -1_isize`, which would overflow - | - = note: `#[deny(unconditional_panic)]` on by default - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:13:36 - | -LL | assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^ attempt to compute `i8::MIN / -1_i8`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:15:36 - | -LL | assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute `i16::MIN / -1_i16`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:17:36 - | -LL | assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute `i32::MIN / -1_i32`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:19:36 - | -LL | assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute `i64::MIN / -1_i64`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:21:36 - | -LL | assert!(thread::spawn(move|| { i128::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^^^ attempt to compute `i128::MIN / -1_i128`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:23:36 - | -LL | assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err()); - | ^^^^^^^^^^ attempt to divide `1_isize` by zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:25:36 - | -LL | assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err()); - | ^^^^^^^ attempt to divide `1_i8` by zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:27:36 - | -LL | assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err()); - | ^^^^^^^^ attempt to divide `1_i16` by zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:29:36 - | -LL | assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err()); - | ^^^^^^^^ attempt to divide `1_i32` by zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:31:36 - | -LL | assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err()); - | ^^^^^^^^ attempt to divide `1_i64` by zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:33:36 - | -LL | assert!(thread::spawn(move|| { 1i128 / 0; }).join().is_err()); - | ^^^^^^^^^ attempt to divide `1_i128` by zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:35:36 - | -LL | assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^^^^ attempt to compute `isize::MIN % -1_isize`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:37:36 - | -LL | assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^ attempt to compute `i8::MIN % -1_i8`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:39:36 - | -LL | assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute `i16::MIN % -1_i16`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:41:36 - | -LL | assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute `i32::MIN % -1_i32`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:43:36 - | -LL | assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute `i64::MIN % -1_i64`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:45:36 - | -LL | assert!(thread::spawn(move|| { i128::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^^^ attempt to compute `i128::MIN % -1_i128`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:47:36 - | -LL | assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err()); - | ^^^^^^^^^^ attempt to calculate the remainder of `1_isize` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:49:36 - | -LL | assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err()); - | ^^^^^^^ attempt to calculate the remainder of `1_i8` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:51:36 - | -LL | assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err()); - | ^^^^^^^^ attempt to calculate the remainder of `1_i16` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:53:36 - | -LL | assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err()); - | ^^^^^^^^ attempt to calculate the remainder of `1_i32` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:55:36 - | -LL | assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err()); - | ^^^^^^^^ attempt to calculate the remainder of `1_i64` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:57:36 - | -LL | assert!(thread::spawn(move|| { 1i128 % 0; }).join().is_err()); - | ^^^^^^^^^ attempt to calculate the remainder of `1_i128` with a divisor of zero - -error: aborting due to 24 previous errors - diff --git a/tests/ui/numbers-arithmetic/issue-8460-const.opt.stderr b/tests/ui/numbers-arithmetic/issue-8460-const.opt.stderr deleted file mode 100644 index 2fba94d07401..000000000000 --- a/tests/ui/numbers-arithmetic/issue-8460-const.opt.stderr +++ /dev/null @@ -1,148 +0,0 @@ -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:11:36 - | -LL | assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^^^^ attempt to compute `isize::MIN / -1_isize`, which would overflow - | - = note: `#[deny(unconditional_panic)]` on by default - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:13:36 - | -LL | assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^ attempt to compute `i8::MIN / -1_i8`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:15:36 - | -LL | assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute `i16::MIN / -1_i16`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:17:36 - | -LL | assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute `i32::MIN / -1_i32`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:19:36 - | -LL | assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute `i64::MIN / -1_i64`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:21:36 - | -LL | assert!(thread::spawn(move|| { i128::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^^^ attempt to compute `i128::MIN / -1_i128`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:23:36 - | -LL | assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err()); - | ^^^^^^^^^^ attempt to divide `1_isize` by zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:25:36 - | -LL | assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err()); - | ^^^^^^^ attempt to divide `1_i8` by zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:27:36 - | -LL | assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err()); - | ^^^^^^^^ attempt to divide `1_i16` by zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:29:36 - | -LL | assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err()); - | ^^^^^^^^ attempt to divide `1_i32` by zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:31:36 - | -LL | assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err()); - | ^^^^^^^^ attempt to divide `1_i64` by zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:33:36 - | -LL | assert!(thread::spawn(move|| { 1i128 / 0; }).join().is_err()); - | ^^^^^^^^^ attempt to divide `1_i128` by zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:35:36 - | -LL | assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^^^^ attempt to compute `isize::MIN % -1_isize`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:37:36 - | -LL | assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^ attempt to compute `i8::MIN % -1_i8`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:39:36 - | -LL | assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute `i16::MIN % -1_i16`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:41:36 - | -LL | assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute `i32::MIN % -1_i32`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:43:36 - | -LL | assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute `i64::MIN % -1_i64`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:45:36 - | -LL | assert!(thread::spawn(move|| { i128::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^^^ attempt to compute `i128::MIN % -1_i128`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:47:36 - | -LL | assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err()); - | ^^^^^^^^^^ attempt to calculate the remainder of `1_isize` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:49:36 - | -LL | assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err()); - | ^^^^^^^ attempt to calculate the remainder of `1_i8` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:51:36 - | -LL | assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err()); - | ^^^^^^^^ attempt to calculate the remainder of `1_i16` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:53:36 - | -LL | assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err()); - | ^^^^^^^^ attempt to calculate the remainder of `1_i32` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:55:36 - | -LL | assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err()); - | ^^^^^^^^ attempt to calculate the remainder of `1_i64` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:57:36 - | -LL | assert!(thread::spawn(move|| { 1i128 % 0; }).join().is_err()); - | ^^^^^^^^^ attempt to calculate the remainder of `1_i128` with a divisor of zero - -error: aborting due to 24 previous errors - diff --git a/tests/ui/numbers-arithmetic/issue-8460-const.opt_with_overflow_checks.stderr b/tests/ui/numbers-arithmetic/issue-8460-const.opt_with_overflow_checks.stderr deleted file mode 100644 index 2fba94d07401..000000000000 --- a/tests/ui/numbers-arithmetic/issue-8460-const.opt_with_overflow_checks.stderr +++ /dev/null @@ -1,148 +0,0 @@ -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:11:36 - | -LL | assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^^^^ attempt to compute `isize::MIN / -1_isize`, which would overflow - | - = note: `#[deny(unconditional_panic)]` on by default - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:13:36 - | -LL | assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^ attempt to compute `i8::MIN / -1_i8`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:15:36 - | -LL | assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute `i16::MIN / -1_i16`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:17:36 - | -LL | assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute `i32::MIN / -1_i32`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:19:36 - | -LL | assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute `i64::MIN / -1_i64`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:21:36 - | -LL | assert!(thread::spawn(move|| { i128::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^^^ attempt to compute `i128::MIN / -1_i128`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:23:36 - | -LL | assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err()); - | ^^^^^^^^^^ attempt to divide `1_isize` by zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:25:36 - | -LL | assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err()); - | ^^^^^^^ attempt to divide `1_i8` by zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:27:36 - | -LL | assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err()); - | ^^^^^^^^ attempt to divide `1_i16` by zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:29:36 - | -LL | assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err()); - | ^^^^^^^^ attempt to divide `1_i32` by zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:31:36 - | -LL | assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err()); - | ^^^^^^^^ attempt to divide `1_i64` by zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:33:36 - | -LL | assert!(thread::spawn(move|| { 1i128 / 0; }).join().is_err()); - | ^^^^^^^^^ attempt to divide `1_i128` by zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:35:36 - | -LL | assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^^^^ attempt to compute `isize::MIN % -1_isize`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:37:36 - | -LL | assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^ attempt to compute `i8::MIN % -1_i8`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:39:36 - | -LL | assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute `i16::MIN % -1_i16`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:41:36 - | -LL | assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute `i32::MIN % -1_i32`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:43:36 - | -LL | assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute `i64::MIN % -1_i64`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:45:36 - | -LL | assert!(thread::spawn(move|| { i128::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^^^ attempt to compute `i128::MIN % -1_i128`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:47:36 - | -LL | assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err()); - | ^^^^^^^^^^ attempt to calculate the remainder of `1_isize` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:49:36 - | -LL | assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err()); - | ^^^^^^^ attempt to calculate the remainder of `1_i8` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:51:36 - | -LL | assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err()); - | ^^^^^^^^ attempt to calculate the remainder of `1_i16` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:53:36 - | -LL | assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err()); - | ^^^^^^^^ attempt to calculate the remainder of `1_i32` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:55:36 - | -LL | assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err()); - | ^^^^^^^^ attempt to calculate the remainder of `1_i64` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:57:36 - | -LL | assert!(thread::spawn(move|| { 1i128 % 0; }).join().is_err()); - | ^^^^^^^^^ attempt to calculate the remainder of `1_i128` with a divisor of zero - -error: aborting due to 24 previous errors - diff --git a/tests/ui/numbers-arithmetic/issue-8460-const.rs b/tests/ui/numbers-arithmetic/issue-8460-const.rs deleted file mode 100644 index 223c05d72d60..000000000000 --- a/tests/ui/numbers-arithmetic/issue-8460-const.rs +++ /dev/null @@ -1,59 +0,0 @@ -//@ revisions: noopt opt opt_with_overflow_checks -//@[noopt]compile-flags: -C opt-level=0 -//@[opt]compile-flags: -O -//@[opt_with_overflow_checks]compile-flags: -C overflow-checks=on -O - -//@ build-fail - -use std::thread; - -fn main() { - assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err()); - //~^ ERROR operation will panic - assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err()); - //~^ ERROR operation will panic - assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err()); - //~^ ERROR operation will panic - assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err()); - //~^ ERROR operation will panic - assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err()); - //~^ ERROR operation will panic - assert!(thread::spawn(move|| { i128::MIN / -1; }).join().is_err()); - //~^ ERROR operation will panic - assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err()); - //~^ ERROR operation will panic - assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err()); - //~^ ERROR operation will panic - assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err()); - //~^ ERROR operation will panic - assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err()); - //~^ ERROR operation will panic - assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err()); - //~^ ERROR operation will panic - assert!(thread::spawn(move|| { 1i128 / 0; }).join().is_err()); - //~^ ERROR operation will panic - assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err()); - //~^ ERROR operation will panic - assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err()); - //~^ ERROR operation will panic - assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err()); - //~^ ERROR operation will panic - assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err()); - //~^ ERROR operation will panic - assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err()); - //~^ ERROR operation will panic - assert!(thread::spawn(move|| { i128::MIN % -1; }).join().is_err()); - //~^ ERROR operation will panic - assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err()); - //~^ ERROR operation will panic - assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err()); - //~^ ERROR operation will panic - assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err()); - //~^ ERROR operation will panic - assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err()); - //~^ ERROR operation will panic - assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err()); - //~^ ERROR operation will panic - assert!(thread::spawn(move|| { 1i128 % 0; }).join().is_err()); - //~^ ERROR operation will panic -} diff --git a/tests/ui/numbers-arithmetic/overflowing-lsh-1.rs b/tests/ui/numbers-arithmetic/overflowing-lsh-1.rs deleted file mode 100644 index 0d300709be21..000000000000 --- a/tests/ui/numbers-arithmetic/overflowing-lsh-1.rs +++ /dev/null @@ -1,9 +0,0 @@ -//@ build-fail -//@ compile-flags: -C debug-assertions - -#![deny(arithmetic_overflow)] - -fn main() { - let _x = 1_i32 << 32; - //~^ ERROR: this arithmetic operation will overflow -} diff --git a/tests/ui/numbers-arithmetic/overflowing-lsh-1.stderr b/tests/ui/numbers-arithmetic/overflowing-lsh-1.stderr deleted file mode 100644 index 5d2c4a6c8e27..000000000000 --- a/tests/ui/numbers-arithmetic/overflowing-lsh-1.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error: this arithmetic operation will overflow - --> $DIR/overflowing-lsh-1.rs:7:14 - | -LL | let _x = 1_i32 << 32; - | ^^^^^^^^^^^ attempt to shift left by `32_i32`, which would overflow - | -note: the lint level is defined here - --> $DIR/overflowing-lsh-1.rs:4:9 - | -LL | #![deny(arithmetic_overflow)] - | ^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 1 previous error - diff --git a/tests/ui/numbers-arithmetic/overflowing-lsh-2.rs b/tests/ui/numbers-arithmetic/overflowing-lsh-2.rs deleted file mode 100644 index 6d7be30d3027..000000000000 --- a/tests/ui/numbers-arithmetic/overflowing-lsh-2.rs +++ /dev/null @@ -1,9 +0,0 @@ -//@ build-fail -//@ compile-flags: -C debug-assertions - -#![deny(arithmetic_overflow)] - -fn main() { - let _x = 1 << -1; - //~^ ERROR: this arithmetic operation will overflow -} diff --git a/tests/ui/numbers-arithmetic/overflowing-lsh-2.stderr b/tests/ui/numbers-arithmetic/overflowing-lsh-2.stderr deleted file mode 100644 index 8ac72aefe0dc..000000000000 --- a/tests/ui/numbers-arithmetic/overflowing-lsh-2.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error: this arithmetic operation will overflow - --> $DIR/overflowing-lsh-2.rs:7:14 - | -LL | let _x = 1 << -1; - | ^^^^^^^ attempt to shift left by `-1_i32`, which would overflow - | -note: the lint level is defined here - --> $DIR/overflowing-lsh-2.rs:4:9 - | -LL | #![deny(arithmetic_overflow)] - | ^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 1 previous error - diff --git a/tests/ui/numbers-arithmetic/overflowing-lsh-3.rs b/tests/ui/numbers-arithmetic/overflowing-lsh-3.rs deleted file mode 100644 index 65f536f627d4..000000000000 --- a/tests/ui/numbers-arithmetic/overflowing-lsh-3.rs +++ /dev/null @@ -1,9 +0,0 @@ -//@ build-fail -//@ compile-flags: -C debug-assertions - -#![deny(arithmetic_overflow)] - -fn main() { - let _x = 1_u64 << 64; - //~^ ERROR: this arithmetic operation will overflow -} diff --git a/tests/ui/numbers-arithmetic/overflowing-lsh-3.stderr b/tests/ui/numbers-arithmetic/overflowing-lsh-3.stderr deleted file mode 100644 index 43d541b03043..000000000000 --- a/tests/ui/numbers-arithmetic/overflowing-lsh-3.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error: this arithmetic operation will overflow - --> $DIR/overflowing-lsh-3.rs:7:14 - | -LL | let _x = 1_u64 << 64; - | ^^^^^^^^^^^ attempt to shift left by `64_i32`, which would overflow - | -note: the lint level is defined here - --> $DIR/overflowing-lsh-3.rs:4:9 - | -LL | #![deny(arithmetic_overflow)] - | ^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 1 previous error - diff --git a/tests/ui/numbers-arithmetic/overflowing-neg.rs b/tests/ui/numbers-arithmetic/overflowing-neg.rs deleted file mode 100644 index ab49662b98f9..000000000000 --- a/tests/ui/numbers-arithmetic/overflowing-neg.rs +++ /dev/null @@ -1,10 +0,0 @@ -//@ run-fail -//@ error-pattern:attempt to negate with overflow -//@ ignore-emscripten no processes -//@ compile-flags: -C debug-assertions - -#![allow(arithmetic_overflow)] - -fn main() { - let _x = -i8::MIN; -} diff --git a/tests/ui/numbers-arithmetic/overflowing-rsh-1.rs b/tests/ui/numbers-arithmetic/overflowing-rsh-1.rs deleted file mode 100644 index 20971e4807e1..000000000000 --- a/tests/ui/numbers-arithmetic/overflowing-rsh-1.rs +++ /dev/null @@ -1,9 +0,0 @@ -//@ build-fail -//@ compile-flags: -C debug-assertions - -#![deny(arithmetic_overflow)] - -fn main() { - let _x = -1_i32 >> 32; - //~^ ERROR: this arithmetic operation will overflow -} diff --git a/tests/ui/numbers-arithmetic/overflowing-rsh-1.stderr b/tests/ui/numbers-arithmetic/overflowing-rsh-1.stderr deleted file mode 100644 index 62763e9e1df8..000000000000 --- a/tests/ui/numbers-arithmetic/overflowing-rsh-1.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error: this arithmetic operation will overflow - --> $DIR/overflowing-rsh-1.rs:7:14 - | -LL | let _x = -1_i32 >> 32; - | ^^^^^^^^^^^^ attempt to shift right by `32_i32`, which would overflow - | -note: the lint level is defined here - --> $DIR/overflowing-rsh-1.rs:4:9 - | -LL | #![deny(arithmetic_overflow)] - | ^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 1 previous error - diff --git a/tests/ui/numbers-arithmetic/overflowing-rsh-2.rs b/tests/ui/numbers-arithmetic/overflowing-rsh-2.rs deleted file mode 100644 index c9829ad27938..000000000000 --- a/tests/ui/numbers-arithmetic/overflowing-rsh-2.rs +++ /dev/null @@ -1,9 +0,0 @@ -//@ build-fail -//@ compile-flags: -C debug-assertions - -#![deny(arithmetic_overflow)] - -fn main() { - let _x = -1_i32 >> -1; - //~^ ERROR: this arithmetic operation will overflow -} diff --git a/tests/ui/numbers-arithmetic/overflowing-rsh-2.stderr b/tests/ui/numbers-arithmetic/overflowing-rsh-2.stderr deleted file mode 100644 index 519e62fef7d8..000000000000 --- a/tests/ui/numbers-arithmetic/overflowing-rsh-2.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error: this arithmetic operation will overflow - --> $DIR/overflowing-rsh-2.rs:7:14 - | -LL | let _x = -1_i32 >> -1; - | ^^^^^^^^^^^^ attempt to shift right by `-1_i32`, which would overflow - | -note: the lint level is defined here - --> $DIR/overflowing-rsh-2.rs:4:9 - | -LL | #![deny(arithmetic_overflow)] - | ^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 1 previous error - diff --git a/tests/ui/numbers-arithmetic/overflowing-rsh-3.rs b/tests/ui/numbers-arithmetic/overflowing-rsh-3.rs deleted file mode 100644 index e2de731e9abd..000000000000 --- a/tests/ui/numbers-arithmetic/overflowing-rsh-3.rs +++ /dev/null @@ -1,9 +0,0 @@ -//@ build-fail -//@ compile-flags: -C debug-assertions - -#![deny(arithmetic_overflow)] - -fn main() { - let _x = -1_i64 >> 64; - //~^ ERROR: this arithmetic operation will overflow -} diff --git a/tests/ui/numbers-arithmetic/overflowing-rsh-3.stderr b/tests/ui/numbers-arithmetic/overflowing-rsh-3.stderr deleted file mode 100644 index de24ea1fcde9..000000000000 --- a/tests/ui/numbers-arithmetic/overflowing-rsh-3.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error: this arithmetic operation will overflow - --> $DIR/overflowing-rsh-3.rs:7:14 - | -LL | let _x = -1_i64 >> 64; - | ^^^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow - | -note: the lint level is defined here - --> $DIR/overflowing-rsh-3.rs:4:9 - | -LL | #![deny(arithmetic_overflow)] - | ^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 1 previous error - diff --git a/tests/ui/numbers-arithmetic/overflowing-rsh-5.rs b/tests/ui/numbers-arithmetic/overflowing-rsh-5.rs deleted file mode 100644 index 8088ee58ea82..000000000000 --- a/tests/ui/numbers-arithmetic/overflowing-rsh-5.rs +++ /dev/null @@ -1,9 +0,0 @@ -//@ build-fail -//@ compile-flags: -C debug-assertions - -#![deny(arithmetic_overflow)] - -fn main() { - let _n = 1i64 >> [64][0]; - //~^ ERROR: this arithmetic operation will overflow -} diff --git a/tests/ui/numbers-arithmetic/overflowing-rsh-5.stderr b/tests/ui/numbers-arithmetic/overflowing-rsh-5.stderr deleted file mode 100644 index e9a1572d3cc9..000000000000 --- a/tests/ui/numbers-arithmetic/overflowing-rsh-5.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error: this arithmetic operation will overflow - --> $DIR/overflowing-rsh-5.rs:7:14 - | -LL | let _n = 1i64 >> [64][0]; - | ^^^^^^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow - | -note: the lint level is defined here - --> $DIR/overflowing-rsh-5.rs:4:9 - | -LL | #![deny(arithmetic_overflow)] - | ^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 1 previous error - diff --git a/tests/ui/object-pointer-types.stderr b/tests/ui/object-pointer-types.stderr index 2c8df3b616fb..7d915ebdab65 100644 --- a/tests/ui/object-pointer-types.stderr +++ b/tests/ui/object-pointer-types.stderr @@ -5,7 +5,12 @@ LL | fn owned(self: Box); | --------- the method might not be found because of this arbitrary self type ... LL | x.owned(); - | ^^^^^ method not found in `&dyn Foo` + | ^^^^^ + | +help: there is a method `to_owned` with a similar name + | +LL | x.to_owned(); + | ~~~~~~~~ error[E0599]: no method named `owned` found for mutable reference `&mut dyn Foo` in the current scope --> $DIR/object-pointer-types.rs:17:7 diff --git a/tests/ui/occurs-check-2.rs b/tests/ui/occurs-check-2.rs index f36682a3dd82..1ec460a87352 100644 --- a/tests/ui/occurs-check-2.rs +++ b/tests/ui/occurs-check-2.rs @@ -5,6 +5,5 @@ fn main() { g = f; f = Box::new(g); - //~^ ERROR mismatched types - //~| cyclic type of infinite size + //~^ ERROR overflow assigning `Box<_>` to `_` } diff --git a/tests/ui/occurs-check-2.stderr b/tests/ui/occurs-check-2.stderr index 7b6fb9fafa20..54307a6c5474 100644 --- a/tests/ui/occurs-check-2.stderr +++ b/tests/ui/occurs-check-2.stderr @@ -1,14 +1,9 @@ -error[E0308]: mismatched types +error[E0275]: overflow assigning `Box<_>` to `_` --> $DIR/occurs-check-2.rs:7:9 | LL | f = Box::new(g); - | ^^^^^^^^^^^ cyclic type of infinite size - | -help: consider unboxing the value - | -LL | f = *Box::new(g); - | + + | ^^^^^^^^^^^ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0308`. +For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/occurs-check-3.rs b/tests/ui/occurs-check-3.rs index 9c04204010b7..377a043daf3f 100644 --- a/tests/ui/occurs-check-3.rs +++ b/tests/ui/occurs-check-3.rs @@ -1,5 +1,11 @@ // From Issue #778 enum Clam { A(T) } -fn main() { let c; c = Clam::A(c); match c { Clam::A::(_) => { } } } -//~^ ERROR mismatched types +fn main() { + let c; + c = Clam::A(c); + //~^ ERROR overflow assigning `Clam<_>` to `_` + match c { + Clam::A::(_) => { } + } +} diff --git a/tests/ui/occurs-check-3.stderr b/tests/ui/occurs-check-3.stderr index 675133b6d50b..77b67ec1a62c 100644 --- a/tests/ui/occurs-check-3.stderr +++ b/tests/ui/occurs-check-3.stderr @@ -1,9 +1,9 @@ -error[E0308]: mismatched types - --> $DIR/occurs-check-3.rs:4:24 +error[E0275]: overflow assigning `Clam<_>` to `_` + --> $DIR/occurs-check-3.rs:6:9 | -LL | fn main() { let c; c = Clam::A(c); match c { Clam::A::(_) => { } } } - | ^^^^^^^^^^ cyclic type of infinite size +LL | c = Clam::A(c); + | ^^^^^^^^^^ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0308`. +For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/occurs-check.rs b/tests/ui/occurs-check.rs index aec52d839766..638b9b6d7e4c 100644 --- a/tests/ui/occurs-check.rs +++ b/tests/ui/occurs-check.rs @@ -1,8 +1,5 @@ fn main() { - let f; - f = Box::new(f); - //~^ ERROR mismatched types - //~| cyclic type of infinite size + //~^ ERROR overflow assigning `Box<_>` to `_` } diff --git a/tests/ui/occurs-check.stderr b/tests/ui/occurs-check.stderr index 1cb6b32cb233..30468d68cbd0 100644 --- a/tests/ui/occurs-check.stderr +++ b/tests/ui/occurs-check.stderr @@ -1,14 +1,9 @@ -error[E0308]: mismatched types - --> $DIR/occurs-check.rs:5:9 +error[E0275]: overflow assigning `Box<_>` to `_` + --> $DIR/occurs-check.rs:3:9 | LL | f = Box::new(f); - | ^^^^^^^^^^^ cyclic type of infinite size - | -help: consider unboxing the value - | -LL | f = *Box::new(f); - | + + | ^^^^^^^^^^^ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0308`. +For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/parser/emoji-identifiers.stderr b/tests/ui/parser/emoji-identifiers.stderr index 1fc561d32c63..536afc53f0ce 100644 --- a/tests/ui/parser/emoji-identifiers.stderr +++ b/tests/ui/parser/emoji-identifiers.stderr @@ -71,16 +71,17 @@ LL | struct 👀; | --------- function or associated item `full_of✨` not found for this struct ... LL | 👀::full_of✨() - | ^^^^^^^^^ - | | - | function or associated item not found in `👀` - | help: there is an associated function with a similar name: `full_of_✨` + | ^^^^^^^^^ function or associated item not found in `👀` | note: if you're trying to build a new `👀`, consider using `👀::full_of_✨` which returns `👀` --> $DIR/emoji-identifiers.rs:4:5 | LL | fn full_of_✨() -> 👀 { | ^^^^^^^^^^^^^^^^^^^^^ +help: there is an associated function `full_of_✨` with a similar name + | +LL | 👀::full_of_✨() + | ~~~~~~~~~~ error[E0425]: cannot find function `i_like_to_😄_a_lot` in this scope --> $DIR/emoji-identifiers.rs:13:13 diff --git a/tests/ui/pattern/usefulness/always-inhabited-union-ref.exhaustive_patterns.stderr b/tests/ui/pattern/usefulness/always-inhabited-union-ref.exhaustive_patterns.stderr index 553daff2d969..d6304a0b997d 100644 --- a/tests/ui/pattern/usefulness/always-inhabited-union-ref.exhaustive_patterns.stderr +++ b/tests/ui/pattern/usefulness/always-inhabited-union-ref.exhaustive_patterns.stderr @@ -1,5 +1,5 @@ error[E0004]: non-exhaustive patterns: type `&!` is non-empty - --> $DIR/always-inhabited-union-ref.rs:26:11 + --> $DIR/always-inhabited-union-ref.rs:25:11 | LL | match uninhab_ref() { | ^^^^^^^^^^^^^ @@ -14,13 +14,13 @@ LL + } | error[E0004]: non-exhaustive patterns: type `Foo` is non-empty - --> $DIR/always-inhabited-union-ref.rs:30:11 + --> $DIR/always-inhabited-union-ref.rs:29:11 | LL | match uninhab_union() { | ^^^^^^^^^^^^^^^ | note: `Foo` defined here - --> $DIR/always-inhabited-union-ref.rs:13:11 + --> $DIR/always-inhabited-union-ref.rs:12:11 | LL | pub union Foo { | ^^^ diff --git a/tests/ui/pattern/usefulness/always-inhabited-union-ref.min_exhaustive_patterns.stderr b/tests/ui/pattern/usefulness/always-inhabited-union-ref.min_exhaustive_patterns.stderr index a1d8002c6489..d6304a0b997d 100644 --- a/tests/ui/pattern/usefulness/always-inhabited-union-ref.min_exhaustive_patterns.stderr +++ b/tests/ui/pattern/usefulness/always-inhabited-union-ref.min_exhaustive_patterns.stderr @@ -1,14 +1,5 @@ -warning: the feature `min_exhaustive_patterns` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/always-inhabited-union-ref.rs:7:46 - | -LL | #![cfg_attr(min_exhaustive_patterns, feature(min_exhaustive_patterns))] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #119612 for more information - = note: `#[warn(incomplete_features)]` on by default - error[E0004]: non-exhaustive patterns: type `&!` is non-empty - --> $DIR/always-inhabited-union-ref.rs:26:11 + --> $DIR/always-inhabited-union-ref.rs:25:11 | LL | match uninhab_ref() { | ^^^^^^^^^^^^^ @@ -23,13 +14,13 @@ LL + } | error[E0004]: non-exhaustive patterns: type `Foo` is non-empty - --> $DIR/always-inhabited-union-ref.rs:30:11 + --> $DIR/always-inhabited-union-ref.rs:29:11 | LL | match uninhab_union() { | ^^^^^^^^^^^^^^^ | note: `Foo` defined here - --> $DIR/always-inhabited-union-ref.rs:13:11 + --> $DIR/always-inhabited-union-ref.rs:12:11 | LL | pub union Foo { | ^^^ @@ -41,6 +32,6 @@ LL + _ => todo!(), LL + } | -error: aborting due to 2 previous errors; 1 warning emitted +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0004`. diff --git a/tests/ui/pattern/usefulness/always-inhabited-union-ref.rs b/tests/ui/pattern/usefulness/always-inhabited-union-ref.rs index c951cb567fcb..5088098d0ae3 100644 --- a/tests/ui/pattern/usefulness/always-inhabited-union-ref.rs +++ b/tests/ui/pattern/usefulness/always-inhabited-union-ref.rs @@ -5,7 +5,6 @@ #![cfg_attr(exhaustive_patterns, feature(exhaustive_patterns))] #![cfg_attr(min_exhaustive_patterns, feature(min_exhaustive_patterns))] -//[min_exhaustive_patterns]~^ WARN the feature `min_exhaustive_patterns` is incomplete #![feature(never_type)] #![allow(dead_code)] #![allow(unreachable_code)] diff --git a/tests/ui/pattern/usefulness/empty-types.exhaustive_patterns.stderr b/tests/ui/pattern/usefulness/empty-types.exhaustive_patterns.stderr index 0c55164a780b..98c66c9dd071 100644 --- a/tests/ui/pattern/usefulness/empty-types.exhaustive_patterns.stderr +++ b/tests/ui/pattern/usefulness/empty-types.exhaustive_patterns.stderr @@ -1,23 +1,23 @@ error: unreachable pattern - --> $DIR/empty-types.rs:50:9 + --> $DIR/empty-types.rs:49:9 | LL | _ => {} | ^ | note: the lint level is defined here - --> $DIR/empty-types.rs:16:9 + --> $DIR/empty-types.rs:15:9 | LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ error: unreachable pattern - --> $DIR/empty-types.rs:53:9 + --> $DIR/empty-types.rs:52:9 | LL | _x => {} | ^^ error[E0004]: non-exhaustive patterns: type `&!` is non-empty - --> $DIR/empty-types.rs:57:11 + --> $DIR/empty-types.rs:56:11 | LL | match ref_never {} | ^^^^^^^^^ @@ -32,31 +32,31 @@ LL + } | error: unreachable pattern - --> $DIR/empty-types.rs:72:9 + --> $DIR/empty-types.rs:71:9 | LL | (_, _) => {} | ^^^^^^ error: unreachable pattern - --> $DIR/empty-types.rs:79:9 + --> $DIR/empty-types.rs:78:9 | LL | _ => {} | ^ error: unreachable pattern - --> $DIR/empty-types.rs:82:9 + --> $DIR/empty-types.rs:81:9 | LL | (_, _) => {} | ^^^^^^ error: unreachable pattern - --> $DIR/empty-types.rs:86:9 + --> $DIR/empty-types.rs:85:9 | LL | _ => {} | ^ error[E0004]: non-exhaustive patterns: `Ok(_)` not covered - --> $DIR/empty-types.rs:90:11 + --> $DIR/empty-types.rs:89:11 | LL | match res_u32_never {} | ^^^^^^^^^^^^^ pattern `Ok(_)` not covered @@ -75,19 +75,19 @@ LL + } | error: unreachable pattern - --> $DIR/empty-types.rs:98:9 + --> $DIR/empty-types.rs:97:9 | LL | Err(_) => {} | ^^^^^^ error: unreachable pattern - --> $DIR/empty-types.rs:103:9 + --> $DIR/empty-types.rs:102:9 | LL | Err(_) => {} | ^^^^^^ error[E0004]: non-exhaustive patterns: `Ok(1_u32..=u32::MAX)` not covered - --> $DIR/empty-types.rs:100:11 + --> $DIR/empty-types.rs:99:11 | LL | match res_u32_never { | ^^^^^^^^^^^^^ pattern `Ok(1_u32..=u32::MAX)` not covered @@ -105,7 +105,7 @@ LL ~ Ok(1_u32..=u32::MAX) => todo!() | error[E0005]: refutable pattern in local binding - --> $DIR/empty-types.rs:107:9 + --> $DIR/empty-types.rs:106:9 | LL | let Ok(_x) = res_u32_never.as_ref(); | ^^^^^^ pattern `Err(_)` not covered @@ -119,13 +119,19 @@ LL | let Ok(_x) = res_u32_never.as_ref() else { todo!() }; | ++++++++++++++++ error: unreachable pattern - --> $DIR/empty-types.rs:118:9 + --> $DIR/empty-types.rs:117:9 | LL | _ => {} | ^ error: unreachable pattern - --> $DIR/empty-types.rs:122:9 + --> $DIR/empty-types.rs:121:9 + | +LL | Ok(_) => {} + | ^^^^^ + +error: unreachable pattern + --> $DIR/empty-types.rs:124:9 | LL | Ok(_) => {} | ^^^^^ @@ -133,107 +139,101 @@ LL | Ok(_) => {} error: unreachable pattern --> $DIR/empty-types.rs:125:9 | -LL | Ok(_) => {} - | ^^^^^ - -error: unreachable pattern - --> $DIR/empty-types.rs:126:9 - | LL | _ => {} | ^ error: unreachable pattern - --> $DIR/empty-types.rs:129:9 + --> $DIR/empty-types.rs:128:9 | LL | Ok(_) => {} | ^^^^^ error: unreachable pattern - --> $DIR/empty-types.rs:130:9 + --> $DIR/empty-types.rs:129:9 | LL | Err(_) => {} | ^^^^^^ error: unreachable pattern - --> $DIR/empty-types.rs:139:13 + --> $DIR/empty-types.rs:138:13 | LL | _ => {} | ^ error: unreachable pattern - --> $DIR/empty-types.rs:142:13 + --> $DIR/empty-types.rs:141:13 | LL | _ if false => {} | ^ error: unreachable pattern - --> $DIR/empty-types.rs:151:13 + --> $DIR/empty-types.rs:150:13 | LL | Some(_) => {} | ^^^^^^^ error: unreachable pattern - --> $DIR/empty-types.rs:155:13 + --> $DIR/empty-types.rs:154:13 | LL | _ => {} | ^ error: unreachable pattern - --> $DIR/empty-types.rs:207:13 + --> $DIR/empty-types.rs:206:13 | LL | _ => {} | ^ error: unreachable pattern - --> $DIR/empty-types.rs:212:13 + --> $DIR/empty-types.rs:211:13 | LL | _ => {} | ^ error: unreachable pattern - --> $DIR/empty-types.rs:217:13 + --> $DIR/empty-types.rs:216:13 | LL | _ => {} | ^ error: unreachable pattern - --> $DIR/empty-types.rs:222:13 + --> $DIR/empty-types.rs:221:13 | LL | _ => {} | ^ error: unreachable pattern - --> $DIR/empty-types.rs:228:13 + --> $DIR/empty-types.rs:227:13 | LL | _ => {} | ^ error: unreachable pattern - --> $DIR/empty-types.rs:287:9 + --> $DIR/empty-types.rs:286:9 | LL | _ => {} | ^ error: unreachable pattern - --> $DIR/empty-types.rs:290:9 + --> $DIR/empty-types.rs:289:9 | LL | (_, _) => {} | ^^^^^^ error: unreachable pattern - --> $DIR/empty-types.rs:293:9 + --> $DIR/empty-types.rs:292:9 | LL | Ok(_) => {} | ^^^^^ error: unreachable pattern - --> $DIR/empty-types.rs:294:9 + --> $DIR/empty-types.rs:293:9 | LL | Err(_) => {} | ^^^^^^ error[E0004]: non-exhaustive patterns: type `&[!]` is non-empty - --> $DIR/empty-types.rs:326:11 + --> $DIR/empty-types.rs:325:11 | LL | match slice_never {} | ^^^^^^^^^^^ @@ -247,7 +247,7 @@ LL + } | error[E0004]: non-exhaustive patterns: `&[]` not covered - --> $DIR/empty-types.rs:337:11 + --> $DIR/empty-types.rs:336:11 | LL | match slice_never { | ^^^^^^^^^^^ pattern `&[]` not covered @@ -260,7 +260,7 @@ LL + &[] => todo!() | error[E0004]: non-exhaustive patterns: `&[]` not covered - --> $DIR/empty-types.rs:350:11 + --> $DIR/empty-types.rs:349:11 | LL | match slice_never { | ^^^^^^^^^^^ pattern `&[]` not covered @@ -274,7 +274,7 @@ LL + &[] => todo!() | error[E0004]: non-exhaustive patterns: type `[!]` is non-empty - --> $DIR/empty-types.rs:356:11 + --> $DIR/empty-types.rs:355:11 | LL | match *slice_never {} | ^^^^^^^^^^^^ @@ -288,25 +288,25 @@ LL + } | error: unreachable pattern - --> $DIR/empty-types.rs:366:9 + --> $DIR/empty-types.rs:365:9 | LL | _ => {} | ^ error: unreachable pattern - --> $DIR/empty-types.rs:369:9 + --> $DIR/empty-types.rs:368:9 | LL | [_, _, _] => {} | ^^^^^^^^^ error: unreachable pattern - --> $DIR/empty-types.rs:372:9 + --> $DIR/empty-types.rs:371:9 | LL | [_, ..] => {} | ^^^^^^^ error[E0004]: non-exhaustive patterns: type `[!; 0]` is non-empty - --> $DIR/empty-types.rs:386:11 + --> $DIR/empty-types.rs:385:11 | LL | match array_0_never {} | ^^^^^^^^^^^^^ @@ -320,13 +320,13 @@ LL + } | error: unreachable pattern - --> $DIR/empty-types.rs:393:9 + --> $DIR/empty-types.rs:392:9 | LL | _ => {} | ^ error[E0004]: non-exhaustive patterns: `[]` not covered - --> $DIR/empty-types.rs:395:11 + --> $DIR/empty-types.rs:394:11 | LL | match array_0_never { | ^^^^^^^^^^^^^ pattern `[]` not covered @@ -340,49 +340,49 @@ LL + [] => todo!() | error: unreachable pattern - --> $DIR/empty-types.rs:414:9 + --> $DIR/empty-types.rs:413:9 | LL | Some(_) => {} | ^^^^^^^ error: unreachable pattern - --> $DIR/empty-types.rs:419:9 + --> $DIR/empty-types.rs:418:9 | LL | Some(_a) => {} | ^^^^^^^^ error: unreachable pattern - --> $DIR/empty-types.rs:424:9 + --> $DIR/empty-types.rs:423:9 | LL | _ => {} | ^ error: unreachable pattern - --> $DIR/empty-types.rs:429:9 + --> $DIR/empty-types.rs:428:9 | LL | _a => {} | ^^ error: unreachable pattern - --> $DIR/empty-types.rs:601:9 + --> $DIR/empty-types.rs:600:9 | LL | _ => {} | ^ error: unreachable pattern - --> $DIR/empty-types.rs:604:9 + --> $DIR/empty-types.rs:603:9 | LL | _x => {} | ^^ error: unreachable pattern - --> $DIR/empty-types.rs:607:9 + --> $DIR/empty-types.rs:606:9 | LL | _ if false => {} | ^ error: unreachable pattern - --> $DIR/empty-types.rs:610:9 + --> $DIR/empty-types.rs:609:9 | LL | _x if false => {} | ^^ diff --git a/tests/ui/pattern/usefulness/empty-types.min_exh_pats.stderr b/tests/ui/pattern/usefulness/empty-types.min_exh_pats.stderr index ed5d125e6840..d5121e7043c7 100644 --- a/tests/ui/pattern/usefulness/empty-types.min_exh_pats.stderr +++ b/tests/ui/pattern/usefulness/empty-types.min_exh_pats.stderr @@ -1,32 +1,23 @@ -warning: the feature `min_exhaustive_patterns` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/empty-types.rs:13:35 - | -LL | #![cfg_attr(min_exh_pats, feature(min_exhaustive_patterns))] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #119612 for more information - = note: `#[warn(incomplete_features)]` on by default - error: unreachable pattern - --> $DIR/empty-types.rs:50:9 + --> $DIR/empty-types.rs:49:9 | LL | _ => {} | ^ | note: the lint level is defined here - --> $DIR/empty-types.rs:16:9 + --> $DIR/empty-types.rs:15:9 | LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ error: unreachable pattern - --> $DIR/empty-types.rs:53:9 + --> $DIR/empty-types.rs:52:9 | LL | _x => {} | ^^ error[E0004]: non-exhaustive patterns: type `&!` is non-empty - --> $DIR/empty-types.rs:57:11 + --> $DIR/empty-types.rs:56:11 | LL | match ref_never {} | ^^^^^^^^^ @@ -41,31 +32,31 @@ LL + } | error: unreachable pattern - --> $DIR/empty-types.rs:72:9 + --> $DIR/empty-types.rs:71:9 | LL | (_, _) => {} | ^^^^^^ error: unreachable pattern - --> $DIR/empty-types.rs:79:9 + --> $DIR/empty-types.rs:78:9 | LL | _ => {} | ^ error: unreachable pattern - --> $DIR/empty-types.rs:82:9 + --> $DIR/empty-types.rs:81:9 | LL | (_, _) => {} | ^^^^^^ error: unreachable pattern - --> $DIR/empty-types.rs:86:9 + --> $DIR/empty-types.rs:85:9 | LL | _ => {} | ^ error[E0004]: non-exhaustive patterns: `Ok(_)` not covered - --> $DIR/empty-types.rs:90:11 + --> $DIR/empty-types.rs:89:11 | LL | match res_u32_never {} | ^^^^^^^^^^^^^ pattern `Ok(_)` not covered @@ -84,19 +75,19 @@ LL + } | error: unreachable pattern - --> $DIR/empty-types.rs:98:9 + --> $DIR/empty-types.rs:97:9 | LL | Err(_) => {} | ^^^^^^ error: unreachable pattern - --> $DIR/empty-types.rs:103:9 + --> $DIR/empty-types.rs:102:9 | LL | Err(_) => {} | ^^^^^^ error[E0004]: non-exhaustive patterns: `Ok(1_u32..=u32::MAX)` not covered - --> $DIR/empty-types.rs:100:11 + --> $DIR/empty-types.rs:99:11 | LL | match res_u32_never { | ^^^^^^^^^^^^^ pattern `Ok(1_u32..=u32::MAX)` not covered @@ -114,7 +105,7 @@ LL ~ Ok(1_u32..=u32::MAX) => todo!() | error[E0005]: refutable pattern in local binding - --> $DIR/empty-types.rs:107:9 + --> $DIR/empty-types.rs:106:9 | LL | let Ok(_x) = res_u32_never.as_ref(); | ^^^^^^ pattern `Err(_)` not covered @@ -128,7 +119,7 @@ LL | let Ok(_x) = res_u32_never.as_ref() else { todo!() }; | ++++++++++++++++ error[E0005]: refutable pattern in local binding - --> $DIR/empty-types.rs:111:9 + --> $DIR/empty-types.rs:110:9 | LL | let Ok(_x) = &res_u32_never; | ^^^^^^ pattern `&Err(_)` not covered @@ -142,13 +133,19 @@ LL | let Ok(_x) = &res_u32_never else { todo!() }; | ++++++++++++++++ error: unreachable pattern - --> $DIR/empty-types.rs:118:9 + --> $DIR/empty-types.rs:117:9 | LL | _ => {} | ^ error: unreachable pattern - --> $DIR/empty-types.rs:122:9 + --> $DIR/empty-types.rs:121:9 + | +LL | Ok(_) => {} + | ^^^^^ + +error: unreachable pattern + --> $DIR/empty-types.rs:124:9 | LL | Ok(_) => {} | ^^^^^ @@ -156,53 +153,47 @@ LL | Ok(_) => {} error: unreachable pattern --> $DIR/empty-types.rs:125:9 | -LL | Ok(_) => {} - | ^^^^^ - -error: unreachable pattern - --> $DIR/empty-types.rs:126:9 - | LL | _ => {} | ^ error: unreachable pattern - --> $DIR/empty-types.rs:129:9 + --> $DIR/empty-types.rs:128:9 | LL | Ok(_) => {} | ^^^^^ error: unreachable pattern - --> $DIR/empty-types.rs:130:9 + --> $DIR/empty-types.rs:129:9 | LL | Err(_) => {} | ^^^^^^ error: unreachable pattern - --> $DIR/empty-types.rs:139:13 + --> $DIR/empty-types.rs:138:13 | LL | _ => {} | ^ error: unreachable pattern - --> $DIR/empty-types.rs:142:13 + --> $DIR/empty-types.rs:141:13 | LL | _ if false => {} | ^ error: unreachable pattern - --> $DIR/empty-types.rs:151:13 + --> $DIR/empty-types.rs:150:13 | LL | Some(_) => {} | ^^^^^^^ error: unreachable pattern - --> $DIR/empty-types.rs:155:13 + --> $DIR/empty-types.rs:154:13 | LL | _ => {} | ^ error[E0004]: non-exhaustive patterns: `Some(_)` not covered - --> $DIR/empty-types.rs:164:15 + --> $DIR/empty-types.rs:163:15 | LL | match *ref_opt_void { | ^^^^^^^^^^^^^ pattern `Some(_)` not covered @@ -220,61 +211,61 @@ LL + Some(_) => todo!() | error: unreachable pattern - --> $DIR/empty-types.rs:207:13 + --> $DIR/empty-types.rs:206:13 | LL | _ => {} | ^ error: unreachable pattern - --> $DIR/empty-types.rs:212:13 + --> $DIR/empty-types.rs:211:13 | LL | _ => {} | ^ error: unreachable pattern - --> $DIR/empty-types.rs:217:13 + --> $DIR/empty-types.rs:216:13 | LL | _ => {} | ^ error: unreachable pattern - --> $DIR/empty-types.rs:222:13 + --> $DIR/empty-types.rs:221:13 | LL | _ => {} | ^ error: unreachable pattern - --> $DIR/empty-types.rs:228:13 + --> $DIR/empty-types.rs:227:13 | LL | _ => {} | ^ error: unreachable pattern - --> $DIR/empty-types.rs:287:9 + --> $DIR/empty-types.rs:286:9 | LL | _ => {} | ^ error: unreachable pattern - --> $DIR/empty-types.rs:290:9 + --> $DIR/empty-types.rs:289:9 | LL | (_, _) => {} | ^^^^^^ error: unreachable pattern - --> $DIR/empty-types.rs:293:9 + --> $DIR/empty-types.rs:292:9 | LL | Ok(_) => {} | ^^^^^ error: unreachable pattern - --> $DIR/empty-types.rs:294:9 + --> $DIR/empty-types.rs:293:9 | LL | Err(_) => {} | ^^^^^^ error[E0004]: non-exhaustive patterns: type `(u32, !)` is non-empty - --> $DIR/empty-types.rs:315:11 + --> $DIR/empty-types.rs:314:11 | LL | match *x {} | ^^ @@ -288,7 +279,7 @@ LL ~ } | error[E0004]: non-exhaustive patterns: type `(!, !)` is non-empty - --> $DIR/empty-types.rs:317:11 + --> $DIR/empty-types.rs:316:11 | LL | match *x {} | ^^ @@ -302,7 +293,7 @@ LL ~ } | error[E0004]: non-exhaustive patterns: `Ok(_)` and `Err(_)` not covered - --> $DIR/empty-types.rs:319:11 + --> $DIR/empty-types.rs:318:11 | LL | match *x {} | ^^ patterns `Ok(_)` and `Err(_)` not covered @@ -324,7 +315,7 @@ LL ~ } | error[E0004]: non-exhaustive patterns: type `[!; 3]` is non-empty - --> $DIR/empty-types.rs:321:11 + --> $DIR/empty-types.rs:320:11 | LL | match *x {} | ^^ @@ -338,7 +329,7 @@ LL ~ } | error[E0004]: non-exhaustive patterns: type `&[!]` is non-empty - --> $DIR/empty-types.rs:326:11 + --> $DIR/empty-types.rs:325:11 | LL | match slice_never {} | ^^^^^^^^^^^ @@ -352,7 +343,7 @@ LL + } | error[E0004]: non-exhaustive patterns: `&[_, ..]` not covered - --> $DIR/empty-types.rs:328:11 + --> $DIR/empty-types.rs:327:11 | LL | match slice_never { | ^^^^^^^^^^^ pattern `&[_, ..]` not covered @@ -365,7 +356,7 @@ LL + &[_, ..] => todo!() | error[E0004]: non-exhaustive patterns: `&[]`, `&[_]` and `&[_, _]` not covered - --> $DIR/empty-types.rs:337:11 + --> $DIR/empty-types.rs:336:11 | LL | match slice_never { | ^^^^^^^^^^^ patterns `&[]`, `&[_]` and `&[_, _]` not covered @@ -378,7 +369,7 @@ LL + &[] | &[_] | &[_, _] => todo!() | error[E0004]: non-exhaustive patterns: `&[]` and `&[_, ..]` not covered - --> $DIR/empty-types.rs:350:11 + --> $DIR/empty-types.rs:349:11 | LL | match slice_never { | ^^^^^^^^^^^ patterns `&[]` and `&[_, ..]` not covered @@ -392,7 +383,7 @@ LL + &[] | &[_, ..] => todo!() | error[E0004]: non-exhaustive patterns: type `[!]` is non-empty - --> $DIR/empty-types.rs:356:11 + --> $DIR/empty-types.rs:355:11 | LL | match *slice_never {} | ^^^^^^^^^^^^ @@ -406,25 +397,25 @@ LL + } | error: unreachable pattern - --> $DIR/empty-types.rs:366:9 + --> $DIR/empty-types.rs:365:9 | LL | _ => {} | ^ error: unreachable pattern - --> $DIR/empty-types.rs:369:9 + --> $DIR/empty-types.rs:368:9 | LL | [_, _, _] => {} | ^^^^^^^^^ error: unreachable pattern - --> $DIR/empty-types.rs:372:9 + --> $DIR/empty-types.rs:371:9 | LL | [_, ..] => {} | ^^^^^^^ error[E0004]: non-exhaustive patterns: type `[!; 0]` is non-empty - --> $DIR/empty-types.rs:386:11 + --> $DIR/empty-types.rs:385:11 | LL | match array_0_never {} | ^^^^^^^^^^^^^ @@ -438,13 +429,13 @@ LL + } | error: unreachable pattern - --> $DIR/empty-types.rs:393:9 + --> $DIR/empty-types.rs:392:9 | LL | _ => {} | ^ error[E0004]: non-exhaustive patterns: `[]` not covered - --> $DIR/empty-types.rs:395:11 + --> $DIR/empty-types.rs:394:11 | LL | match array_0_never { | ^^^^^^^^^^^^^ pattern `[]` not covered @@ -458,31 +449,31 @@ LL + [] => todo!() | error: unreachable pattern - --> $DIR/empty-types.rs:414:9 + --> $DIR/empty-types.rs:413:9 | LL | Some(_) => {} | ^^^^^^^ error: unreachable pattern - --> $DIR/empty-types.rs:419:9 + --> $DIR/empty-types.rs:418:9 | LL | Some(_a) => {} | ^^^^^^^^ error: unreachable pattern - --> $DIR/empty-types.rs:424:9 + --> $DIR/empty-types.rs:423:9 | LL | _ => {} | ^ error: unreachable pattern - --> $DIR/empty-types.rs:429:9 + --> $DIR/empty-types.rs:428:9 | LL | _a => {} | ^^ error[E0004]: non-exhaustive patterns: `&Some(_)` not covered - --> $DIR/empty-types.rs:449:11 + --> $DIR/empty-types.rs:448:11 | LL | match ref_opt_never { | ^^^^^^^^^^^^^ pattern `&Some(_)` not covered @@ -500,7 +491,7 @@ LL + &Some(_) => todo!() | error[E0004]: non-exhaustive patterns: `Some(_)` not covered - --> $DIR/empty-types.rs:490:11 + --> $DIR/empty-types.rs:489:11 | LL | match *ref_opt_never { | ^^^^^^^^^^^^^^ pattern `Some(_)` not covered @@ -518,7 +509,7 @@ LL + Some(_) => todo!() | error[E0004]: non-exhaustive patterns: `Err(_)` not covered - --> $DIR/empty-types.rs:538:11 + --> $DIR/empty-types.rs:537:11 | LL | match *ref_res_never { | ^^^^^^^^^^^^^^ pattern `Err(_)` not covered @@ -536,7 +527,7 @@ LL + Err(_) => todo!() | error[E0004]: non-exhaustive patterns: `Err(_)` not covered - --> $DIR/empty-types.rs:549:11 + --> $DIR/empty-types.rs:548:11 | LL | match *ref_res_never { | ^^^^^^^^^^^^^^ pattern `Err(_)` not covered @@ -554,7 +545,7 @@ LL + Err(_) => todo!() | error[E0004]: non-exhaustive patterns: type `(u32, !)` is non-empty - --> $DIR/empty-types.rs:568:11 + --> $DIR/empty-types.rs:567:11 | LL | match *ref_tuple_half_never {} | ^^^^^^^^^^^^^^^^^^^^^ @@ -568,31 +559,31 @@ LL + } | error: unreachable pattern - --> $DIR/empty-types.rs:601:9 + --> $DIR/empty-types.rs:600:9 | LL | _ => {} | ^ error: unreachable pattern - --> $DIR/empty-types.rs:604:9 + --> $DIR/empty-types.rs:603:9 | LL | _x => {} | ^^ error: unreachable pattern - --> $DIR/empty-types.rs:607:9 + --> $DIR/empty-types.rs:606:9 | LL | _ if false => {} | ^ error: unreachable pattern - --> $DIR/empty-types.rs:610:9 + --> $DIR/empty-types.rs:609:9 | LL | _x if false => {} | ^^ error[E0004]: non-exhaustive patterns: `&_` not covered - --> $DIR/empty-types.rs:635:11 + --> $DIR/empty-types.rs:634:11 | LL | match ref_never { | ^^^^^^^^^ pattern `&_` not covered @@ -607,7 +598,7 @@ LL + &_ => todo!() | error[E0004]: non-exhaustive patterns: `Some(_)` not covered - --> $DIR/empty-types.rs:663:11 + --> $DIR/empty-types.rs:662:11 | LL | match *x { | ^^ pattern `Some(_)` not covered @@ -624,7 +615,7 @@ LL ~ None => {}, LL + Some(_) => todo!() | -error: aborting due to 63 previous errors; 1 warning emitted +error: aborting due to 63 previous errors Some errors have detailed explanations: E0004, E0005. For more information about an error, try `rustc --explain E0004`. diff --git a/tests/ui/pattern/usefulness/empty-types.normal.stderr b/tests/ui/pattern/usefulness/empty-types.normal.stderr index 2fdb51677dac..dc01ac4ddcea 100644 --- a/tests/ui/pattern/usefulness/empty-types.normal.stderr +++ b/tests/ui/pattern/usefulness/empty-types.normal.stderr @@ -1,23 +1,23 @@ error: unreachable pattern - --> $DIR/empty-types.rs:50:9 + --> $DIR/empty-types.rs:49:9 | LL | _ => {} | ^ | note: the lint level is defined here - --> $DIR/empty-types.rs:16:9 + --> $DIR/empty-types.rs:15:9 | LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ error: unreachable pattern - --> $DIR/empty-types.rs:53:9 + --> $DIR/empty-types.rs:52:9 | LL | _x => {} | ^^ error[E0004]: non-exhaustive patterns: type `&!` is non-empty - --> $DIR/empty-types.rs:57:11 + --> $DIR/empty-types.rs:56:11 | LL | match ref_never {} | ^^^^^^^^^ @@ -32,7 +32,7 @@ LL + } | error[E0004]: non-exhaustive patterns: type `(u32, !)` is non-empty - --> $DIR/empty-types.rs:69:11 + --> $DIR/empty-types.rs:68:11 | LL | match tuple_half_never {} | ^^^^^^^^^^^^^^^^ @@ -46,7 +46,7 @@ LL + } | error[E0004]: non-exhaustive patterns: type `(!, !)` is non-empty - --> $DIR/empty-types.rs:76:11 + --> $DIR/empty-types.rs:75:11 | LL | match tuple_never {} | ^^^^^^^^^^^ @@ -60,13 +60,13 @@ LL + } | error: unreachable pattern - --> $DIR/empty-types.rs:86:9 + --> $DIR/empty-types.rs:85:9 | LL | _ => {} | ^ error[E0004]: non-exhaustive patterns: `Ok(_)` and `Err(_)` not covered - --> $DIR/empty-types.rs:90:11 + --> $DIR/empty-types.rs:89:11 | LL | match res_u32_never {} | ^^^^^^^^^^^^^ patterns `Ok(_)` and `Err(_)` not covered @@ -88,7 +88,7 @@ LL + } | error[E0004]: non-exhaustive patterns: `Err(_)` not covered - --> $DIR/empty-types.rs:92:11 + --> $DIR/empty-types.rs:91:11 | LL | match res_u32_never { | ^^^^^^^^^^^^^ pattern `Err(_)` not covered @@ -106,7 +106,7 @@ LL + Err(_) => todo!() | error[E0004]: non-exhaustive patterns: `Ok(1_u32..=u32::MAX)` not covered - --> $DIR/empty-types.rs:100:11 + --> $DIR/empty-types.rs:99:11 | LL | match res_u32_never { | ^^^^^^^^^^^^^ pattern `Ok(1_u32..=u32::MAX)` not covered @@ -124,7 +124,7 @@ LL ~ Ok(1_u32..=u32::MAX) => todo!() | error[E0005]: refutable pattern in local binding - --> $DIR/empty-types.rs:105:9 + --> $DIR/empty-types.rs:104:9 | LL | let Ok(_x) = res_u32_never; | ^^^^^^ pattern `Err(_)` not covered @@ -138,7 +138,7 @@ LL | let Ok(_x) = res_u32_never else { todo!() }; | ++++++++++++++++ error[E0005]: refutable pattern in local binding - --> $DIR/empty-types.rs:107:9 + --> $DIR/empty-types.rs:106:9 | LL | let Ok(_x) = res_u32_never.as_ref(); | ^^^^^^ pattern `Err(_)` not covered @@ -152,7 +152,7 @@ LL | let Ok(_x) = res_u32_never.as_ref() else { todo!() }; | ++++++++++++++++ error[E0005]: refutable pattern in local binding - --> $DIR/empty-types.rs:111:9 + --> $DIR/empty-types.rs:110:9 | LL | let Ok(_x) = &res_u32_never; | ^^^^^^ pattern `&Err(_)` not covered @@ -166,7 +166,7 @@ LL | let Ok(_x) = &res_u32_never else { todo!() }; | ++++++++++++++++ error[E0004]: non-exhaustive patterns: `Ok(_)` and `Err(_)` not covered - --> $DIR/empty-types.rs:115:11 + --> $DIR/empty-types.rs:114:11 | LL | match result_never {} | ^^^^^^^^^^^^ patterns `Ok(_)` and `Err(_)` not covered @@ -188,7 +188,7 @@ LL + } | error[E0004]: non-exhaustive patterns: `Err(_)` not covered - --> $DIR/empty-types.rs:120:11 + --> $DIR/empty-types.rs:119:11 | LL | match result_never { | ^^^^^^^^^^^^ pattern `Err(_)` not covered @@ -205,19 +205,19 @@ LL | Ok(_) => {}, Err(_) => todo!() | +++++++++++++++++++ error: unreachable pattern - --> $DIR/empty-types.rs:139:13 + --> $DIR/empty-types.rs:138:13 | LL | _ => {} | ^ error: unreachable pattern - --> $DIR/empty-types.rs:142:13 + --> $DIR/empty-types.rs:141:13 | LL | _ if false => {} | ^ error[E0004]: non-exhaustive patterns: `Some(_)` not covered - --> $DIR/empty-types.rs:145:15 + --> $DIR/empty-types.rs:144:15 | LL | match opt_void { | ^^^^^^^^ pattern `Some(_)` not covered @@ -235,7 +235,7 @@ LL + Some(_) => todo!() | error[E0004]: non-exhaustive patterns: `Some(_)` not covered - --> $DIR/empty-types.rs:164:15 + --> $DIR/empty-types.rs:163:15 | LL | match *ref_opt_void { | ^^^^^^^^^^^^^ pattern `Some(_)` not covered @@ -253,43 +253,43 @@ LL + Some(_) => todo!() | error: unreachable pattern - --> $DIR/empty-types.rs:207:13 + --> $DIR/empty-types.rs:206:13 | LL | _ => {} | ^ error: unreachable pattern - --> $DIR/empty-types.rs:212:13 + --> $DIR/empty-types.rs:211:13 | LL | _ => {} | ^ error: unreachable pattern - --> $DIR/empty-types.rs:217:13 + --> $DIR/empty-types.rs:216:13 | LL | _ => {} | ^ error: unreachable pattern - --> $DIR/empty-types.rs:222:13 + --> $DIR/empty-types.rs:221:13 | LL | _ => {} | ^ error: unreachable pattern - --> $DIR/empty-types.rs:228:13 + --> $DIR/empty-types.rs:227:13 | LL | _ => {} | ^ error: unreachable pattern - --> $DIR/empty-types.rs:287:9 + --> $DIR/empty-types.rs:286:9 | LL | _ => {} | ^ error[E0004]: non-exhaustive patterns: type `(u32, !)` is non-empty - --> $DIR/empty-types.rs:315:11 + --> $DIR/empty-types.rs:314:11 | LL | match *x {} | ^^ @@ -303,7 +303,7 @@ LL ~ } | error[E0004]: non-exhaustive patterns: type `(!, !)` is non-empty - --> $DIR/empty-types.rs:317:11 + --> $DIR/empty-types.rs:316:11 | LL | match *x {} | ^^ @@ -317,7 +317,7 @@ LL ~ } | error[E0004]: non-exhaustive patterns: `Ok(_)` and `Err(_)` not covered - --> $DIR/empty-types.rs:319:11 + --> $DIR/empty-types.rs:318:11 | LL | match *x {} | ^^ patterns `Ok(_)` and `Err(_)` not covered @@ -339,7 +339,7 @@ LL ~ } | error[E0004]: non-exhaustive patterns: type `[!; 3]` is non-empty - --> $DIR/empty-types.rs:321:11 + --> $DIR/empty-types.rs:320:11 | LL | match *x {} | ^^ @@ -353,7 +353,7 @@ LL ~ } | error[E0004]: non-exhaustive patterns: type `&[!]` is non-empty - --> $DIR/empty-types.rs:326:11 + --> $DIR/empty-types.rs:325:11 | LL | match slice_never {} | ^^^^^^^^^^^ @@ -367,7 +367,7 @@ LL + } | error[E0004]: non-exhaustive patterns: `&[_, ..]` not covered - --> $DIR/empty-types.rs:328:11 + --> $DIR/empty-types.rs:327:11 | LL | match slice_never { | ^^^^^^^^^^^ pattern `&[_, ..]` not covered @@ -380,7 +380,7 @@ LL + &[_, ..] => todo!() | error[E0004]: non-exhaustive patterns: `&[]`, `&[_]` and `&[_, _]` not covered - --> $DIR/empty-types.rs:337:11 + --> $DIR/empty-types.rs:336:11 | LL | match slice_never { | ^^^^^^^^^^^ patterns `&[]`, `&[_]` and `&[_, _]` not covered @@ -393,7 +393,7 @@ LL + &[] | &[_] | &[_, _] => todo!() | error[E0004]: non-exhaustive patterns: `&[]` and `&[_, ..]` not covered - --> $DIR/empty-types.rs:350:11 + --> $DIR/empty-types.rs:349:11 | LL | match slice_never { | ^^^^^^^^^^^ patterns `&[]` and `&[_, ..]` not covered @@ -407,7 +407,7 @@ LL + &[] | &[_, ..] => todo!() | error[E0004]: non-exhaustive patterns: type `[!]` is non-empty - --> $DIR/empty-types.rs:356:11 + --> $DIR/empty-types.rs:355:11 | LL | match *slice_never {} | ^^^^^^^^^^^^ @@ -421,7 +421,7 @@ LL + } | error[E0004]: non-exhaustive patterns: type `[!; 3]` is non-empty - --> $DIR/empty-types.rs:363:11 + --> $DIR/empty-types.rs:362:11 | LL | match array_3_never {} | ^^^^^^^^^^^^^ @@ -435,7 +435,7 @@ LL + } | error[E0004]: non-exhaustive patterns: type `[!; 0]` is non-empty - --> $DIR/empty-types.rs:386:11 + --> $DIR/empty-types.rs:385:11 | LL | match array_0_never {} | ^^^^^^^^^^^^^ @@ -449,13 +449,13 @@ LL + } | error: unreachable pattern - --> $DIR/empty-types.rs:393:9 + --> $DIR/empty-types.rs:392:9 | LL | _ => {} | ^ error[E0004]: non-exhaustive patterns: `[]` not covered - --> $DIR/empty-types.rs:395:11 + --> $DIR/empty-types.rs:394:11 | LL | match array_0_never { | ^^^^^^^^^^^^^ pattern `[]` not covered @@ -469,7 +469,7 @@ LL + [] => todo!() | error[E0004]: non-exhaustive patterns: `&Some(_)` not covered - --> $DIR/empty-types.rs:449:11 + --> $DIR/empty-types.rs:448:11 | LL | match ref_opt_never { | ^^^^^^^^^^^^^ pattern `&Some(_)` not covered @@ -487,7 +487,7 @@ LL + &Some(_) => todo!() | error[E0004]: non-exhaustive patterns: `Some(_)` not covered - --> $DIR/empty-types.rs:490:11 + --> $DIR/empty-types.rs:489:11 | LL | match *ref_opt_never { | ^^^^^^^^^^^^^^ pattern `Some(_)` not covered @@ -505,7 +505,7 @@ LL + Some(_) => todo!() | error[E0004]: non-exhaustive patterns: `Err(_)` not covered - --> $DIR/empty-types.rs:538:11 + --> $DIR/empty-types.rs:537:11 | LL | match *ref_res_never { | ^^^^^^^^^^^^^^ pattern `Err(_)` not covered @@ -523,7 +523,7 @@ LL + Err(_) => todo!() | error[E0004]: non-exhaustive patterns: `Err(_)` not covered - --> $DIR/empty-types.rs:549:11 + --> $DIR/empty-types.rs:548:11 | LL | match *ref_res_never { | ^^^^^^^^^^^^^^ pattern `Err(_)` not covered @@ -541,7 +541,7 @@ LL + Err(_) => todo!() | error[E0004]: non-exhaustive patterns: type `(u32, !)` is non-empty - --> $DIR/empty-types.rs:568:11 + --> $DIR/empty-types.rs:567:11 | LL | match *ref_tuple_half_never {} | ^^^^^^^^^^^^^^^^^^^^^ @@ -555,31 +555,31 @@ LL + } | error: unreachable pattern - --> $DIR/empty-types.rs:601:9 + --> $DIR/empty-types.rs:600:9 | LL | _ => {} | ^ error: unreachable pattern - --> $DIR/empty-types.rs:604:9 + --> $DIR/empty-types.rs:603:9 | LL | _x => {} | ^^ error: unreachable pattern - --> $DIR/empty-types.rs:607:9 + --> $DIR/empty-types.rs:606:9 | LL | _ if false => {} | ^ error: unreachable pattern - --> $DIR/empty-types.rs:610:9 + --> $DIR/empty-types.rs:609:9 | LL | _x if false => {} | ^^ error[E0004]: non-exhaustive patterns: `&_` not covered - --> $DIR/empty-types.rs:635:11 + --> $DIR/empty-types.rs:634:11 | LL | match ref_never { | ^^^^^^^^^ pattern `&_` not covered @@ -594,7 +594,7 @@ LL + &_ => todo!() | error[E0004]: non-exhaustive patterns: `Some(_)` not covered - --> $DIR/empty-types.rs:663:11 + --> $DIR/empty-types.rs:662:11 | LL | match *x { | ^^ pattern `Some(_)` not covered diff --git a/tests/ui/pattern/usefulness/empty-types.rs b/tests/ui/pattern/usefulness/empty-types.rs index 170a663e754b..06651613010d 100644 --- a/tests/ui/pattern/usefulness/empty-types.rs +++ b/tests/ui/pattern/usefulness/empty-types.rs @@ -11,7 +11,6 @@ #![feature(never_type_fallback)] #![cfg_attr(exhaustive_patterns, feature(exhaustive_patterns))] #![cfg_attr(min_exh_pats, feature(min_exhaustive_patterns))] -//[min_exh_pats]~^ WARN the feature `min_exhaustive_patterns` is incomplete #![allow(dead_code, unreachable_code)] #![deny(unreachable_patterns)] diff --git a/tests/ui/pattern/usefulness/impl-trait.rs b/tests/ui/pattern/usefulness/impl-trait.rs index ceb97315e9dd..1fec9a2633ee 100644 --- a/tests/ui/pattern/usefulness/impl-trait.rs +++ b/tests/ui/pattern/usefulness/impl-trait.rs @@ -1,5 +1,5 @@ #![feature(never_type)] -#![feature(exhaustive_patterns)] +#![feature(min_exhaustive_patterns)] #![feature(type_alias_impl_trait)] #![feature(non_exhaustive_omitted_patterns_lint)] #![deny(unreachable_patterns)] diff --git a/tests/ui/pattern/usefulness/match-privately-empty.exhaustive_patterns.stderr b/tests/ui/pattern/usefulness/match-privately-empty.exhaustive_patterns.stderr index 708a1511244c..261a4b3353f2 100644 --- a/tests/ui/pattern/usefulness/match-privately-empty.exhaustive_patterns.stderr +++ b/tests/ui/pattern/usefulness/match-privately-empty.exhaustive_patterns.stderr @@ -1,5 +1,5 @@ error[E0004]: non-exhaustive patterns: `Some(Private { misc: true, .. })` not covered - --> $DIR/match-privately-empty.rs:16:11 + --> $DIR/match-privately-empty.rs:15:11 | LL | match private::DATA { | ^^^^^^^^^^^^^ pattern `Some(Private { misc: true, .. })` not covered diff --git a/tests/ui/pattern/usefulness/match-privately-empty.min_exhaustive_patterns.stderr b/tests/ui/pattern/usefulness/match-privately-empty.min_exhaustive_patterns.stderr index a6ce02c0c3c6..261a4b3353f2 100644 --- a/tests/ui/pattern/usefulness/match-privately-empty.min_exhaustive_patterns.stderr +++ b/tests/ui/pattern/usefulness/match-privately-empty.min_exhaustive_patterns.stderr @@ -1,14 +1,5 @@ -warning: the feature `min_exhaustive_patterns` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/match-privately-empty.rs:3:46 - | -LL | #![cfg_attr(min_exhaustive_patterns, feature(min_exhaustive_patterns))] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #119612 for more information - = note: `#[warn(incomplete_features)]` on by default - error[E0004]: non-exhaustive patterns: `Some(Private { misc: true, .. })` not covered - --> $DIR/match-privately-empty.rs:16:11 + --> $DIR/match-privately-empty.rs:15:11 | LL | match private::DATA { | ^^^^^^^^^^^^^ pattern `Some(Private { misc: true, .. })` not covered @@ -25,6 +16,6 @@ LL ~ Some(private::Private { misc: false, .. }) => {}, LL + Some(Private { misc: true, .. }) => todo!() | -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0004`. diff --git a/tests/ui/pattern/usefulness/match-privately-empty.rs b/tests/ui/pattern/usefulness/match-privately-empty.rs index 95b18e774fbd..7e1d0dc48f2c 100644 --- a/tests/ui/pattern/usefulness/match-privately-empty.rs +++ b/tests/ui/pattern/usefulness/match-privately-empty.rs @@ -1,7 +1,6 @@ //@ revisions: min_exhaustive_patterns exhaustive_patterns #![cfg_attr(exhaustive_patterns, feature(exhaustive_patterns))] #![cfg_attr(min_exhaustive_patterns, feature(min_exhaustive_patterns))] -//[min_exhaustive_patterns]~^ WARN the feature `min_exhaustive_patterns` is incomplete #![feature(never_type)] mod private { diff --git a/tests/ui/pattern/usefulness/slice_of_empty.exhaustive_patterns.stderr b/tests/ui/pattern/usefulness/slice_of_empty.exhaustive_patterns.stderr index 9770f680b2da..e5e581447e66 100644 --- a/tests/ui/pattern/usefulness/slice_of_empty.exhaustive_patterns.stderr +++ b/tests/ui/pattern/usefulness/slice_of_empty.exhaustive_patterns.stderr @@ -1,5 +1,5 @@ error[E0004]: non-exhaustive patterns: `&[]` not covered - --> $DIR/slice_of_empty.rs:22:11 + --> $DIR/slice_of_empty.rs:21:11 | LL | match nevers { | ^^^^^^ pattern `&[]` not covered diff --git a/tests/ui/pattern/usefulness/slice_of_empty.min_exhaustive_patterns.stderr b/tests/ui/pattern/usefulness/slice_of_empty.min_exhaustive_patterns.stderr index 3b9e71f50d5f..a1239466c9c2 100644 --- a/tests/ui/pattern/usefulness/slice_of_empty.min_exhaustive_patterns.stderr +++ b/tests/ui/pattern/usefulness/slice_of_empty.min_exhaustive_patterns.stderr @@ -1,14 +1,5 @@ -warning: the feature `min_exhaustive_patterns` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/slice_of_empty.rs:3:46 - | -LL | #![cfg_attr(min_exhaustive_patterns, feature(min_exhaustive_patterns))] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #119612 for more information - = note: `#[warn(incomplete_features)]` on by default - error[E0004]: non-exhaustive patterns: `&[_, ..]` not covered - --> $DIR/slice_of_empty.rs:11:11 + --> $DIR/slice_of_empty.rs:10:11 | LL | match nevers { | ^^^^^^ pattern `&[_, ..]` not covered @@ -21,7 +12,7 @@ LL ~ &[_, ..] => todo!(), | error[E0004]: non-exhaustive patterns: `&[]` and `&[_, _, ..]` not covered - --> $DIR/slice_of_empty.rs:22:11 + --> $DIR/slice_of_empty.rs:21:11 | LL | match nevers { | ^^^^^^ patterns `&[]` and `&[_, _, ..]` not covered @@ -33,6 +24,6 @@ LL ~ &[_] => (), LL ~ &[] | &[_, _, ..] => todo!(), | -error: aborting due to 2 previous errors; 1 warning emitted +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0004`. diff --git a/tests/ui/pattern/usefulness/slice_of_empty.rs b/tests/ui/pattern/usefulness/slice_of_empty.rs index 589c7767ad24..785fccaabf7e 100644 --- a/tests/ui/pattern/usefulness/slice_of_empty.rs +++ b/tests/ui/pattern/usefulness/slice_of_empty.rs @@ -1,7 +1,6 @@ //@ revisions: min_exhaustive_patterns exhaustive_patterns #![cfg_attr(exhaustive_patterns, feature(exhaustive_patterns))] #![cfg_attr(min_exhaustive_patterns, feature(min_exhaustive_patterns))] -//[min_exhaustive_patterns]~^ WARN the feature `min_exhaustive_patterns` is incomplete #![feature(never_type)] #![deny(unreachable_patterns)] diff --git a/tests/ui/pattern/usefulness/uninhabited.rs b/tests/ui/pattern/usefulness/uninhabited.rs index ff7aeb263e4d..72e602ee8d2d 100644 --- a/tests/ui/pattern/usefulness/uninhabited.rs +++ b/tests/ui/pattern/usefulness/uninhabited.rs @@ -5,7 +5,7 @@ // `Ty::is_inhabited_from` function. #![feature(never_type)] #![feature(never_type_fallback)] -#![feature(exhaustive_patterns)] +#![feature(min_exhaustive_patterns)] #![deny(unreachable_patterns)] macro_rules! assert_empty { diff --git a/tests/ui/privacy/unreachable-issue-121455.rs b/tests/ui/privacy/unreachable-issue-121455.rs new file mode 100644 index 000000000000..5da30d6ed639 --- /dev/null +++ b/tests/ui/privacy/unreachable-issue-121455.rs @@ -0,0 +1,6 @@ +fn test(s: &Self::Id) { +//~^ ERROR failed to resolve: `Self` is only available in impls, traits, and type definitions + match &s[0..3] {} +} + +fn main() {} diff --git a/tests/ui/privacy/unreachable-issue-121455.stderr b/tests/ui/privacy/unreachable-issue-121455.stderr new file mode 100644 index 000000000000..864e950a98eb --- /dev/null +++ b/tests/ui/privacy/unreachable-issue-121455.stderr @@ -0,0 +1,9 @@ +error[E0433]: failed to resolve: `Self` is only available in impls, traits, and type definitions + --> $DIR/unreachable-issue-121455.rs:1:13 + | +LL | fn test(s: &Self::Id) { + | ^^^^ `Self` is only available in impls, traits, and type definitions + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0433`. diff --git a/tests/ui/reachable/unreachable-loop-patterns.rs b/tests/ui/reachable/unreachable-loop-patterns.rs index e9cef5f47d4a..4294a18ba440 100644 --- a/tests/ui/reachable/unreachable-loop-patterns.rs +++ b/tests/ui/reachable/unreachable-loop-patterns.rs @@ -1,5 +1,5 @@ #![feature(never_type, never_type_fallback)] -#![feature(exhaustive_patterns)] +#![feature(min_exhaustive_patterns)] #![allow(unreachable_code)] #![deny(unreachable_patterns)] diff --git a/tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr b/tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr index 89b69e140996..f4fb7fd955f2 100644 --- a/tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr +++ b/tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr @@ -14,10 +14,12 @@ LL | struct Struct; | ------------- function or associated item `fob` not found for this struct ... LL | Struct::fob(); - | ^^^ - | | - | function or associated item not found in `Struct` - | help: there is an associated function with a similar name: `foo` + | ^^^ function or associated item not found in `Struct` + | +help: there is an associated function `foo` with a similar name + | +LL | Struct::foo(); + | ~~~ error[E0433]: failed to resolve: use of undeclared type `Struc` --> $DIR/typo-suggestion-mistyped-in-path.rs:27:5 diff --git a/tests/ui/rfcs/impl-trait/higher-ranked-regions-diag.rs b/tests/ui/rfcs/impl-trait/higher-ranked-regions-diag.rs new file mode 100644 index 000000000000..02ed08bd6567 --- /dev/null +++ b/tests/ui/rfcs/impl-trait/higher-ranked-regions-diag.rs @@ -0,0 +1,23 @@ +// Regression test for #97099. +// This was an ICE because `impl Sized` captures the lifetime 'a. + +trait Trait { + type Assoc; +} + +struct Foo; + +impl<'a> Trait<&'a ()> for Foo { + type Assoc = (); +} + +fn foo() -> impl for<'a> Trait<&'a ()> { + Foo +} + +fn bar() -> impl for<'a> Trait<&'a (), Assoc = impl Sized> { + foo() + //~^ ERROR hidden type for `impl Sized` captures lifetime that does not appear in bounds +} + +fn main() {} diff --git a/tests/ui/rfcs/impl-trait/higher-ranked-regions-diag.stderr b/tests/ui/rfcs/impl-trait/higher-ranked-regions-diag.stderr new file mode 100644 index 000000000000..c177c3bbf00b --- /dev/null +++ b/tests/ui/rfcs/impl-trait/higher-ranked-regions-diag.stderr @@ -0,0 +1,13 @@ +error[E0700]: hidden type for `impl Sized` captures lifetime that does not appear in bounds + --> $DIR/higher-ranked-regions-diag.rs:19:5 + | +LL | fn bar() -> impl for<'a> Trait<&'a (), Assoc = impl Sized> { + | -- ---------- opaque type defined here + | | + | hidden type ` Trait<&'a ()> as Trait<&'a ()>>::Assoc` captures the lifetime `'a` as defined here +LL | foo() + | ^^^^^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0700`. diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/indirect_match_with_exhaustive_patterns.rs b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/indirect_match_with_exhaustive_patterns.rs index b4c26ed910a5..c40a2676e84c 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/indirect_match_with_exhaustive_patterns.rs +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/indirect_match_with_exhaustive_patterns.rs @@ -1,6 +1,6 @@ //@ aux-build:uninhabited.rs #![deny(unreachable_patterns)] -#![feature(exhaustive_patterns)] +#![feature(min_exhaustive_patterns)] #![feature(never_type)] extern crate uninhabited; diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/indirect_match_with_exhaustive_patterns_same_crate.rs b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/indirect_match_with_exhaustive_patterns_same_crate.rs index 246443f029fa..efaec0ebdbe3 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/indirect_match_with_exhaustive_patterns_same_crate.rs +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/indirect_match_with_exhaustive_patterns_same_crate.rs @@ -1,7 +1,7 @@ //@ check-pass #![deny(unreachable_patterns)] -#![feature(exhaustive_patterns)] +#![feature(min_exhaustive_patterns)] #![feature(never_type)] #[non_exhaustive] diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.rs b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.rs index 22cffc537bd5..69b15fca0b72 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.rs +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.rs @@ -1,6 +1,6 @@ //@ aux-build:uninhabited.rs #![deny(unreachable_patterns)] -#![feature(exhaustive_patterns)] +#![feature(min_exhaustive_patterns)] #![feature(never_type)] extern crate uninhabited; diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns_same_crate.rs b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns_same_crate.rs index ac346bc83614..bbc5d03d6126 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns_same_crate.rs +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns_same_crate.rs @@ -1,7 +1,7 @@ //@ check-pass #![deny(unreachable_patterns)] -#![feature(exhaustive_patterns)] +#![feature(min_exhaustive_patterns)] #![feature(never_type)] #[non_exhaustive] diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/patterns.rs b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/patterns.rs index 21aa562365af..0007614988cd 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/patterns.rs +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/patterns.rs @@ -1,7 +1,7 @@ //@ aux-build:uninhabited.rs //@ build-pass (FIXME(62277): could be check-pass?) #![deny(unreachable_patterns)] -#![feature(exhaustive_patterns)] +#![feature(min_exhaustive_patterns)] extern crate uninhabited; diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/patterns_same_crate.rs b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/patterns_same_crate.rs index ffc496a975ec..898be87cccab 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/patterns_same_crate.rs +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/patterns_same_crate.rs @@ -1,5 +1,5 @@ #![deny(unreachable_patterns)] -#![feature(exhaustive_patterns)] +#![feature(min_exhaustive_patterns)] #![feature(never_type)] #[non_exhaustive] diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/span-bug-issue-121418.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/span-bug-issue-121418.rs new file mode 100644 index 000000000000..97e89f96fe1b --- /dev/null +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/span-bug-issue-121418.rs @@ -0,0 +1,13 @@ +#![feature(const_trait_impl)] +#![feature(effects)] + +struct S; +trait T {} + +impl const dyn T { + //~^ ERROR inherent impls cannot be `const` + //~| ERROR the const parameter `host` is not constrained by the impl trait, self type, or + pub const fn new() -> std::sync::Mutex {} +} + +fn main() {} diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/span-bug-issue-121418.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/span-bug-issue-121418.stderr new file mode 100644 index 000000000000..11577d9ec1d0 --- /dev/null +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/span-bug-issue-121418.stderr @@ -0,0 +1,22 @@ +error: inherent impls cannot be `const` + --> $DIR/span-bug-issue-121418.rs:7:12 + | +LL | impl const dyn T { + | ----- ^^^^^ inherent impl for this type + | | + | `const` because of this + | + = note: only trait implementations may be annotated with `const` + +error[E0207]: the const parameter `host` is not constrained by the impl trait, self type, or predicates + --> $DIR/span-bug-issue-121418.rs:7:6 + | +LL | impl const dyn T { + | ^^^^^ unconstrained const parameter + | + = note: expressions using a const parameter must map each value to a distinct output value + = note: proving the result of expressions other than the parameter are unique is not supported + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0207`. diff --git a/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-basic.rs b/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-basic.rs new file mode 100644 index 000000000000..34b94f2e1c78 --- /dev/null +++ b/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-basic.rs @@ -0,0 +1,80 @@ +// Basic tests for opaque type inference under for<_> binders. + +#![feature(type_alias_impl_trait)] + +trait Trait<'a> { + type Ty; +} +impl<'a, T> Trait<'a> for T { + type Ty = &'a (); +} + +mod basic_pass { + use super::*; + type Opq<'a> = impl Sized + 'a; + fn test() -> impl for<'a> Trait<'a, Ty = Opq<'a>> {} + //~^ ERROR: expected generic lifetime parameter, found `'a` +} + +mod capture_rpit { + use super::*; + fn test() -> impl for<'a> Trait<'a, Ty = impl Sized> {} + //~^ ERROR hidden type for `impl Sized` captures lifetime that does not appear in bounds +} + +mod capture_tait { + use super::*; + type Opq0 = impl Sized; + type Opq1<'a> = impl for<'b> Trait<'b, Ty = Opq0>; + type Opq2 = impl for<'a> Trait<'a, Ty = Opq1<'a>>; + fn test() -> Opq2 {} + //~^ ERROR hidden type for `capture_tait::Opq0` captures lifetime that does not appear in bounds +} + +mod capture_tait_complex_pass { + use super::*; + type Opq0<'a> = impl Sized; + type Opq1<'a> = impl for<'b> Trait<'b, Ty = Opq0<'b>>; // <- Note 'b + type Opq2 = impl for<'a> Trait<'a, Ty = Opq1<'a>>; + fn test() -> Opq2 {} + //~^ ERROR: expected generic lifetime parameter, found `'a` +} + +// Same as the above, but make sure that different placeholder regions are not equal. +mod capture_tait_complex_fail { + use super::*; + type Opq0<'a> = impl Sized; + type Opq1<'a> = impl for<'b> Trait<'b, Ty = Opq0<'a>>; // <- Note 'a + type Opq2 = impl for<'a> Trait<'a, Ty = Opq1<'a>>; + fn test() -> Opq2 {} + //~^ ERROR hidden type for `capture_tait_complex_fail::Opq0<'a>` captures lifetime that does not appear in bounds +} + +// non-defining use because 'static is used. +mod constrain_fail0 { + use super::*; + type Opq0<'a, 'b> = impl Sized; + fn test() -> impl for<'a> Trait<'a, Ty = Opq0<'a, 'static>> {} + //~^ ERROR non-defining opaque type use in defining scope + //~| ERROR: expected generic lifetime parameter, found `'a` +} + +// non-defining use because generic lifetime is used multiple times. +mod constrain_fail { + use super::*; + type Opq0<'a, 'b> = impl Sized; + fn test() -> impl for<'a> Trait<'a, Ty = Opq0<'a, 'a>> {} + //~^ ERROR non-defining opaque type use in defining scope + //~| ERROR: expected generic lifetime parameter, found `'a` +} + +mod constrain_pass { + use super::*; + type Opq0<'a, 'b> = impl Sized; + type Opq1<'a> = impl for<'b> Trait<'b, Ty = Opq0<'a, 'b>>; + type Opq2 = impl for<'a> Trait<'a, Ty = Opq1<'a>>; + fn test() -> Opq2 {} + //~^ ERROR: expected generic lifetime parameter, found `'a` +} + +fn main() {} diff --git a/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-basic.stderr b/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-basic.stderr new file mode 100644 index 000000000000..fb1e4cca3f40 --- /dev/null +++ b/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-basic.stderr @@ -0,0 +1,101 @@ +error[E0792]: expected generic lifetime parameter, found `'a` + --> $DIR/higher-ranked-regions-basic.rs:15:55 + | +LL | type Opq<'a> = impl Sized + 'a; + | -- this generic parameter must be used with a generic lifetime parameter +LL | fn test() -> impl for<'a> Trait<'a, Ty = Opq<'a>> {} + | ^^ + +error[E0700]: hidden type for `impl Sized` captures lifetime that does not appear in bounds + --> $DIR/higher-ranked-regions-basic.rs:21:58 + | +LL | fn test() -> impl for<'a> Trait<'a, Ty = impl Sized> {} + | -- ---------- ^^ + | | | + | | opaque type defined here + | hidden type `&'a ()` captures the lifetime `'a` as defined here + +error[E0700]: hidden type for `capture_tait::Opq0` captures lifetime that does not appear in bounds + --> $DIR/higher-ranked-regions-basic.rs:30:23 + | +LL | type Opq0 = impl Sized; + | ---------- opaque type defined here +LL | type Opq1<'a> = impl for<'b> Trait<'b, Ty = Opq0>; + | -- hidden type `&'b ()` captures the lifetime `'b` as defined here +LL | type Opq2 = impl for<'a> Trait<'a, Ty = Opq1<'a>>; +LL | fn test() -> Opq2 {} + | ^^ + +error[E0792]: expected generic lifetime parameter, found `'a` + --> $DIR/higher-ranked-regions-basic.rs:39:23 + | +LL | type Opq1<'a> = impl for<'b> Trait<'b, Ty = Opq0<'b>>; // <- Note 'b + | -- this generic parameter must be used with a generic lifetime parameter +LL | type Opq2 = impl for<'a> Trait<'a, Ty = Opq1<'a>>; +LL | fn test() -> Opq2 {} + | ^^ + +error[E0700]: hidden type for `capture_tait_complex_fail::Opq0<'a>` captures lifetime that does not appear in bounds + --> $DIR/higher-ranked-regions-basic.rs:49:23 + | +LL | type Opq0<'a> = impl Sized; + | ---------- opaque type defined here +LL | type Opq1<'a> = impl for<'b> Trait<'b, Ty = Opq0<'a>>; // <- Note 'a + | -- hidden type `&'b ()` captures the lifetime `'b` as defined here +LL | type Opq2 = impl for<'a> Trait<'a, Ty = Opq1<'a>>; +LL | fn test() -> Opq2 {} + | ^^ + +error[E0792]: non-defining opaque type use in defining scope + --> $DIR/higher-ranked-regions-basic.rs:57:41 + | +LL | fn test() -> impl for<'a> Trait<'a, Ty = Opq0<'a, 'static>> {} + | ^^^^^^^^^^^^^^^^^^^^^^ argument `'static` is not a generic parameter + | +note: for this opaque type + --> $DIR/higher-ranked-regions-basic.rs:56:25 + | +LL | type Opq0<'a, 'b> = impl Sized; + | ^^^^^^^^^^ + +error[E0792]: expected generic lifetime parameter, found `'a` + --> $DIR/higher-ranked-regions-basic.rs:57:65 + | +LL | type Opq0<'a, 'b> = impl Sized; + | -- this generic parameter must be used with a generic lifetime parameter +LL | fn test() -> impl for<'a> Trait<'a, Ty = Opq0<'a, 'static>> {} + | ^^ + +error: non-defining opaque type use in defining scope + --> $DIR/higher-ranked-regions-basic.rs:66:41 + | +LL | fn test() -> impl for<'a> Trait<'a, Ty = Opq0<'a, 'a>> {} + | ^^^^^^^^^^^^^^^^^ generic argument `'a` used twice + | +note: for this opaque type + --> $DIR/higher-ranked-regions-basic.rs:65:25 + | +LL | type Opq0<'a, 'b> = impl Sized; + | ^^^^^^^^^^ + +error[E0792]: expected generic lifetime parameter, found `'a` + --> $DIR/higher-ranked-regions-basic.rs:66:60 + | +LL | type Opq0<'a, 'b> = impl Sized; + | -- this generic parameter must be used with a generic lifetime parameter +LL | fn test() -> impl for<'a> Trait<'a, Ty = Opq0<'a, 'a>> {} + | ^^ + +error[E0792]: expected generic lifetime parameter, found `'a` + --> $DIR/higher-ranked-regions-basic.rs:76:23 + | +LL | type Opq1<'a> = impl for<'b> Trait<'b, Ty = Opq0<'a, 'b>>; + | -- this generic parameter must be used with a generic lifetime parameter +LL | type Opq2 = impl for<'a> Trait<'a, Ty = Opq1<'a>>; +LL | fn test() -> Opq2 {} + | ^^ + +error: aborting due to 10 previous errors + +Some errors have detailed explanations: E0700, E0792. +For more information about an error, try `rustc --explain E0700`. diff --git a/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-gat.rs b/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-gat.rs new file mode 100644 index 000000000000..db5e5e05e54b --- /dev/null +++ b/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-gat.rs @@ -0,0 +1,20 @@ +// Regression test for #97098. + +#![feature(type_alias_impl_trait)] + +pub trait Trait { + type Assoc<'a>; +} + +pub type Foo = impl for<'a> Trait = FooAssoc<'a>>; +pub type FooAssoc<'a> = impl Sized; + +struct Struct; +impl Trait for Struct { + type Assoc<'a> = &'a u32; +} + +const FOO: Foo = Struct; +//~^ ERROR: expected generic lifetime parameter, found `'a` + +fn main() {} diff --git a/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-gat.stderr b/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-gat.stderr new file mode 100644 index 000000000000..9b361445f1ec --- /dev/null +++ b/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-gat.stderr @@ -0,0 +1,12 @@ +error[E0792]: expected generic lifetime parameter, found `'a` + --> $DIR/higher-ranked-regions-gat.rs:17:18 + | +LL | pub type FooAssoc<'a> = impl Sized; + | -- this generic parameter must be used with a generic lifetime parameter +... +LL | const FOO: Foo = Struct; + | ^^^^^^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0792`. diff --git a/tests/ui/rust-2018/trait-import-suggestions.stderr b/tests/ui/rust-2018/trait-import-suggestions.stderr index 325c5976e7c8..852628885794 100644 --- a/tests/ui/rust-2018/trait-import-suggestions.stderr +++ b/tests/ui/rust-2018/trait-import-suggestions.stderr @@ -5,13 +5,17 @@ LL | fn foobar(&self) { } | ------ the method is available for `u32` here ... LL | x.foobar(); - | ^^^^^^ method not found in `u32` + | ^^^^^^ | = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `Foobar` which provides `foobar` is implemented but not in scope; perhaps you want to import it | LL + use crate::foo::foobar::Foobar; | +help: there is a method `bar` with a similar name + | +LL | x.bar(); + | ~~~ error[E0599]: no method named `bar` found for type `u32` in the current scope --> $DIR/trait-import-suggestions.rs:28:7 @@ -20,19 +24,28 @@ LL | fn bar(&self) { } | --- the method is available for `u32` here ... LL | x.bar(); - | ^^^ method not found in `u32` + | ^^^ | = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `Bar` which provides `bar` is implemented but not in scope; perhaps you want to import it | LL + use crate::foo::Bar; | +help: there is a method `foobar` with a similar name + | +LL | x.foobar(); + | ~~~~~~ error[E0599]: no method named `baz` found for type `u32` in the current scope --> $DIR/trait-import-suggestions.rs:29:7 | LL | x.baz(); - | ^^^ method not found in `u32` + | ^^^ + | +help: there is a method `bar` with a similar name + | +LL | x.bar(); + | ~~~ error[E0599]: no function or associated item named `from_str` found for type `u32` in the current scope --> $DIR/trait-import-suggestions.rs:30:18 @@ -41,14 +54,14 @@ LL | let y = u32::from_str("33"); | ^^^^^^^^ function or associated item not found in `u32` | = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `FromStr` which provides `from_str` is implemented but not in scope; perhaps you want to import it | LL + use std::str::FromStr; | -help: there is an associated function with a similar name +help: there is an associated function `from` with a similar name | -LL | let y = u32::from_str_radix("33"); - | ~~~~~~~~~~~~~~ +LL | let y = u32::from("33"); + | ~~~~ error: aborting due to 4 previous errors diff --git a/tests/ui/rust-2018/uniform-paths/issue-87932.stderr b/tests/ui/rust-2018/uniform-paths/issue-87932.stderr index 4a874a834bb7..3e6fc3ff2a56 100644 --- a/tests/ui/rust-2018/uniform-paths/issue-87932.stderr +++ b/tests/ui/rust-2018/uniform-paths/issue-87932.stderr @@ -8,7 +8,7 @@ LL | A::deserialize(); | ^^^^^^^^^^^ function or associated item not found in `A` | = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `Deserialize` which provides `deserialize` is implemented but not in scope; perhaps you want to import it | LL + use ::deserialize::_a::Deserialize; | diff --git a/tests/ui/rust-2021/future-prelude-collision-shadow.stderr b/tests/ui/rust-2021/future-prelude-collision-shadow.stderr index d2b2e5b2fd77..d9c0fa47eca0 100644 --- a/tests/ui/rust-2021/future-prelude-collision-shadow.stderr +++ b/tests/ui/rust-2021/future-prelude-collision-shadow.stderr @@ -2,16 +2,20 @@ error[E0599]: no method named `try_into` found for type `u8` in the current scop --> $DIR/future-prelude-collision-shadow.rs:27:26 | LL | let _: u32 = 3u8.try_into().unwrap(); - | ^^^^^^^^ method not found in `u8` + | ^^^^^^^^ | = help: items from traits can only be used if the trait is in scope = note: 'std::convert::TryInto' is included in the prelude starting in Edition 2021 -help: the following traits are implemented but not in scope; perhaps add a `use` for one of them: +help: the following traits which provide `try_into` are implemented but not in scope; perhaps you want to import one of them | LL + use crate::m::TryIntoU32; | LL + use std::convert::TryInto; | +help: there is a method `into` with a similar name + | +LL | let _: u32 = 3u8.into().unwrap(); + | ~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/self/arbitrary_self_type_mut_difference.stderr b/tests/ui/self/arbitrary_self_type_mut_difference.stderr index a56d58694aa3..ffc61ee0d783 100644 --- a/tests/ui/self/arbitrary_self_type_mut_difference.stderr +++ b/tests/ui/self/arbitrary_self_type_mut_difference.stderr @@ -2,25 +2,33 @@ error[E0599]: no method named `x` found for struct `Pin<&S>` in the current scop --> $DIR/arbitrary_self_type_mut_difference.rs:11:18 | LL | Pin::new(&S).x(); - | ^ help: there is a method with a similar name: `y` + | ^ | note: method is available for `Pin<&mut S>` --> $DIR/arbitrary_self_type_mut_difference.rs:6:5 | LL | fn x(self: Pin<&mut Self>) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: there is a method `y` with a similar name + | +LL | Pin::new(&S).y(); + | ~ error[E0599]: no method named `y` found for struct `Pin<&mut S>` in the current scope --> $DIR/arbitrary_self_type_mut_difference.rs:12:22 | LL | Pin::new(&mut S).y(); - | ^ help: there is a method with a similar name: `x` + | ^ | note: method is available for `Pin<&S>` --> $DIR/arbitrary_self_type_mut_difference.rs:7:5 | LL | fn y(self: Pin<&Self>) {} | ^^^^^^^^^^^^^^^^^^^^^^ +help: there is a method `x` with a similar name + | +LL | Pin::new(&mut S).x(); + | ~ error: aborting due to 2 previous errors diff --git a/tests/ui/shadowed/shadowed-trait-methods.stderr b/tests/ui/shadowed/shadowed-trait-methods.stderr index 0bcf32790bcc..2c990fababf9 100644 --- a/tests/ui/shadowed/shadowed-trait-methods.stderr +++ b/tests/ui/shadowed/shadowed-trait-methods.stderr @@ -8,7 +8,7 @@ LL | ().f() | ^ method not found in `()` | = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `T` which provides `f` is implemented but not in scope; perhaps you want to import it | LL + use foo::T; | diff --git a/tests/ui/simd/array-trait.rs b/tests/ui/simd/array-trait.rs index bf1e219460f4..55fec7a3948b 100644 --- a/tests/ui/simd/array-trait.rs +++ b/tests/ui/simd/array-trait.rs @@ -33,12 +33,7 @@ extern "platform-intrinsic" { pub fn main() { let mut t = T::([0; 4]); unsafe { - for i in 0_i32..4 { - t = simd_insert(t, i as u32, i); - } - for i in 0_i32..4 { - assert_eq!(i, simd_extract(t, i as u32)); - //~^ ERROR: use of moved value: `t` - } + t = simd_insert(t, 3, 3); + assert_eq!(3, simd_extract(t, 3)); } } diff --git a/tests/ui/simd/array-trait.stderr b/tests/ui/simd/array-trait.stderr index bbaead569dfc..16ff732396dd 100644 --- a/tests/ui/simd/array-trait.stderr +++ b/tests/ui/simd/array-trait.stderr @@ -23,18 +23,6 @@ LL | pub struct T([S::Lane; S::SIZE]); = help: try adding a `where` bound using this expression: `where [(); S::SIZE]:` = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0382]: use of moved value: `t` - --> $DIR/array-trait.rs:40:40 - | -LL | let mut t = T::([0; 4]); - | ----- move occurs because `t` has type `T`, which does not implement the `Copy` trait -... -LL | for i in 0_i32..4 { - | ----------------- inside of this loop -LL | assert_eq!(i, simd_extract(t, i as u32)); - | ^ value moved here, in previous iteration of loop +error: aborting due to 3 previous errors -error: aborting due to 4 previous errors - -Some errors have detailed explanations: E0077, E0382. -For more information about an error, try `rustc --explain E0077`. +For more information about this error, try `rustc --explain E0077`. diff --git a/tests/ui/simd/array-type.rs b/tests/ui/simd/array-type.rs index c9f5ed0d0313..0864c3e7418d 100644 --- a/tests/ui/simd/array-type.rs +++ b/tests/ui/simd/array-type.rs @@ -22,21 +22,13 @@ pub fn main() { let mut s = S([0; 4]); unsafe { - for i in 0_i32..4 { - s = simd_insert(s, i as u32, i); - } - for i in 0_i32..4 { - assert_eq!(i, simd_extract(s, i as u32)); - } + s = simd_insert(s, 3, 3); + assert_eq!(3, simd_extract(s, 3)); } let mut t = T::<4>([0; 4]); unsafe { - for i in 0_i32..4 { - t = simd_insert(t, i as u32, i); - } - for i in 0_i32..4 { - assert_eq!(i, simd_extract(t, i as u32)); - } + t = simd_insert(t, 3, 3); + assert_eq!(3, simd_extract(t, 3)); } } diff --git a/tests/ui/simd/intrinsic/generic-reduction-pass.rs b/tests/ui/simd/intrinsic/generic-reduction-pass.rs index 4928ea7bac73..cf4669cd61f5 100644 --- a/tests/ui/simd/intrinsic/generic-reduction-pass.rs +++ b/tests/ui/simd/intrinsic/generic-reduction-pass.rs @@ -31,8 +31,6 @@ extern "platform-intrinsic" { fn simd_reduce_mul_ordered(x: T, acc: U) -> U; fn simd_reduce_min(x: T) -> U; fn simd_reduce_max(x: T) -> U; - fn simd_reduce_min_nanless(x: T) -> U; - fn simd_reduce_max_nanless(x: T) -> U; fn simd_reduce_and(x: T) -> U; fn simd_reduce_or(x: T) -> U; fn simd_reduce_xor(x: T) -> U; @@ -127,10 +125,6 @@ fn main() { assert_eq!(r, -2_f32); let r: f32 = simd_reduce_max(x); assert_eq!(r, 4_f32); - let r: f32 = simd_reduce_min_nanless(x); - assert_eq!(r, -2_f32); - let r: f32 = simd_reduce_max_nanless(x); - assert_eq!(r, 4_f32); } unsafe { diff --git a/tests/ui/simd/shuffle-not-out-of-bounds.rs b/tests/ui/simd/not-out-of-bounds.rs similarity index 88% rename from tests/ui/simd/shuffle-not-out-of-bounds.rs rename to tests/ui/simd/not-out-of-bounds.rs index 158e9956435d..36d7a5865bc5 100644 --- a/tests/ui/simd/shuffle-not-out-of-bounds.rs +++ b/tests/ui/simd/not-out-of-bounds.rs @@ -1,6 +1,6 @@ //@ build-fail #![allow(non_camel_case_types)] -#![feature(repr_simd, platform_intrinsics)] +#![feature(repr_simd, core_intrinsics)] // Test for #73542 to verify out-of-bounds shuffle vectors do not compile. @@ -28,9 +28,7 @@ struct u8x32([u8; 32]); #[derive(Copy, Clone)] struct u8x64([u8; 64]); -extern "platform-intrinsic" { - pub fn simd_shuffle(x: T, y: T, idx: I) -> U; -} +use std::intrinsics::simd::*; // Test vectors by lane size. Since LLVM does not distinguish between a shuffle // over two f32s and a shuffle over two u64s, or any other such combination, @@ -70,13 +68,16 @@ fn main() { test_shuffle_lanes!(32, u8x32, simd_shuffle); test_shuffle_lanes!(64, u8x64, simd_shuffle); - extern "platform-intrinsic" { - fn simd_shuffle(a: T, b: T, i: I) -> U; - } let v = u8x2([0, 0]); const I: [u32; 2] = [4, 4]; unsafe { let _: u8x2 = simd_shuffle(v, v, I); //~^ ERROR invalid monomorphization of `simd_shuffle` intrinsic } + + // also check insert/extract + unsafe { + simd_insert(v, 2, 0); //~ ERROR invalid monomorphization of `simd_insert` intrinsic + let _val: u8 = simd_extract(v, 2); //~ ERROR invalid monomorphization of `simd_extract` intrinsic + } } diff --git a/tests/ui/simd/shuffle-not-out-of-bounds.stderr b/tests/ui/simd/not-out-of-bounds.stderr similarity index 71% rename from tests/ui/simd/shuffle-not-out-of-bounds.stderr rename to tests/ui/simd/not-out-of-bounds.stderr index 59e5ab858664..5682935c1f1a 100644 --- a/tests/ui/simd/shuffle-not-out-of-bounds.stderr +++ b/tests/ui/simd/not-out-of-bounds.stderr @@ -1,5 +1,5 @@ -error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: shuffle index #0 is out of bounds (limit 4) - --> $DIR/shuffle-not-out-of-bounds.rs:51:21 +error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: SIMD index #0 is out of bounds (limit 4) + --> $DIR/not-out-of-bounds.rs:49:21 | LL | $y(vec1, vec2, ARR) | ^^^^^^^^^^^^^^^^^^^ @@ -9,8 +9,8 @@ LL | test_shuffle_lanes!(2, u8x2, simd_shuffle); | = note: this error originates in the macro `test_shuffle_lanes` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: shuffle index #0 is out of bounds (limit 8) - --> $DIR/shuffle-not-out-of-bounds.rs:51:21 +error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: SIMD index #0 is out of bounds (limit 8) + --> $DIR/not-out-of-bounds.rs:49:21 | LL | $y(vec1, vec2, ARR) | ^^^^^^^^^^^^^^^^^^^ @@ -20,8 +20,8 @@ LL | test_shuffle_lanes!(4, u8x4, simd_shuffle); | = note: this error originates in the macro `test_shuffle_lanes` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: shuffle index #0 is out of bounds (limit 16) - --> $DIR/shuffle-not-out-of-bounds.rs:51:21 +error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: SIMD index #0 is out of bounds (limit 16) + --> $DIR/not-out-of-bounds.rs:49:21 | LL | $y(vec1, vec2, ARR) | ^^^^^^^^^^^^^^^^^^^ @@ -31,8 +31,8 @@ LL | test_shuffle_lanes!(8, u8x8, simd_shuffle); | = note: this error originates in the macro `test_shuffle_lanes` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: shuffle index #0 is out of bounds (limit 32) - --> $DIR/shuffle-not-out-of-bounds.rs:51:21 +error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: SIMD index #0 is out of bounds (limit 32) + --> $DIR/not-out-of-bounds.rs:49:21 | LL | $y(vec1, vec2, ARR) | ^^^^^^^^^^^^^^^^^^^ @@ -42,8 +42,8 @@ LL | test_shuffle_lanes!(16, u8x16, simd_shuffle); | = note: this error originates in the macro `test_shuffle_lanes` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: shuffle index #0 is out of bounds (limit 64) - --> $DIR/shuffle-not-out-of-bounds.rs:51:21 +error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: SIMD index #0 is out of bounds (limit 64) + --> $DIR/not-out-of-bounds.rs:49:21 | LL | $y(vec1, vec2, ARR) | ^^^^^^^^^^^^^^^^^^^ @@ -53,8 +53,8 @@ LL | test_shuffle_lanes!(32, u8x32, simd_shuffle); | = note: this error originates in the macro `test_shuffle_lanes` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: shuffle index #0 is out of bounds (limit 128) - --> $DIR/shuffle-not-out-of-bounds.rs:51:21 +error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: SIMD index #0 is out of bounds (limit 128) + --> $DIR/not-out-of-bounds.rs:49:21 | LL | $y(vec1, vec2, ARR) | ^^^^^^^^^^^^^^^^^^^ @@ -64,12 +64,24 @@ LL | test_shuffle_lanes!(64, u8x64, simd_shuffle); | = note: this error originates in the macro `test_shuffle_lanes` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: shuffle index #0 is out of bounds (limit 4) - --> $DIR/shuffle-not-out-of-bounds.rs:79:23 +error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: SIMD index #0 is out of bounds (limit 4) + --> $DIR/not-out-of-bounds.rs:74:23 | LL | let _: u8x2 = simd_shuffle(v, v, I); | ^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 7 previous errors +error[E0511]: invalid monomorphization of `simd_insert` intrinsic: expected inserted type `u8` (element of input `u8x2`), found `i32` + --> $DIR/not-out-of-bounds.rs:80:9 + | +LL | simd_insert(v, 2, 0); + | ^^^^^^^^^^^^^^^^^^^^ + +error[E0511]: invalid monomorphization of `simd_extract` intrinsic: SIMD index #1 is out of bounds (limit 2) + --> $DIR/not-out-of-bounds.rs:81:24 + | +LL | let _val: u8 = simd_extract(v, 2); + | ^^^^^^^^^^^^^^^^^^ + +error: aborting due to 9 previous errors For more information about this error, try `rustc --explain E0511`. diff --git a/tests/ui/span/coerce-suggestions.rs b/tests/ui/span/coerce-suggestions.rs index 7920ae0b26cc..13331a016fcf 100644 --- a/tests/ui/span/coerce-suggestions.rs +++ b/tests/ui/span/coerce-suggestions.rs @@ -13,10 +13,6 @@ fn main() { //~^ ERROR E0308 test2(&y); //~^ ERROR E0308 - let f; - f = Box::new(f); - //~^ ERROR E0308 - let s = &mut String::new(); s = format!("foo"); //~^ ERROR E0308 diff --git a/tests/ui/span/coerce-suggestions.stderr b/tests/ui/span/coerce-suggestions.stderr index ff840b781f07..77b01ee08b79 100644 --- a/tests/ui/span/coerce-suggestions.stderr +++ b/tests/ui/span/coerce-suggestions.stderr @@ -54,22 +54,11 @@ LL | fn test2(_x: &mut i32) {} error[E0308]: mismatched types --> $DIR/coerce-suggestions.rs:17:9 | -LL | f = Box::new(f); - | ^^^^^^^^^^^ cyclic type of infinite size - | -help: consider unboxing the value - | -LL | f = *Box::new(f); - | + - -error[E0308]: mismatched types - --> $DIR/coerce-suggestions.rs:21:9 - | LL | s = format!("foo"); | ^^^^^^^^^^^^^^ expected `&mut String`, found `String` | = note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to 6 previous errors +error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/suggestions/dont-suggest-pin-array-dot-set.stderr b/tests/ui/suggestions/dont-suggest-pin-array-dot-set.stderr index 8f738465d38d..b1a618e7176e 100644 --- a/tests/ui/suggestions/dont-suggest-pin-array-dot-set.stderr +++ b/tests/ui/suggestions/dont-suggest-pin-array-dot-set.stderr @@ -2,7 +2,10 @@ error[E0599]: no method named `set` found for array `[u8; 1]` in the current sco --> $DIR/dont-suggest-pin-array-dot-set.rs:14:7 | LL | a.set(0, 3); - | ^^^ help: there is a method with a similar name: `get` + | ^^^ + | +help: there is a method `get` with a similar name, but with different arguments + --> $SRC_DIR/core/src/slice/mod.rs:LL:COL error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/dont-wrap-ambiguous-receivers.rs b/tests/ui/suggestions/dont-wrap-ambiguous-receivers.rs index baa2128eb8e3..06aed9ac98f4 100644 --- a/tests/ui/suggestions/dont-wrap-ambiguous-receivers.rs +++ b/tests/ui/suggestions/dont-wrap-ambiguous-receivers.rs @@ -1,5 +1,5 @@ mod banana { - //~^ HELP the following traits are implemented but not in scope + //~^ HELP the following traits which provide `pick` are implemented but not in scope pub struct Chaenomeles; pub trait Apple { diff --git a/tests/ui/suggestions/dont-wrap-ambiguous-receivers.stderr b/tests/ui/suggestions/dont-wrap-ambiguous-receivers.stderr index 974aedd13cf5..41ca7d0f8ea3 100644 --- a/tests/ui/suggestions/dont-wrap-ambiguous-receivers.stderr +++ b/tests/ui/suggestions/dont-wrap-ambiguous-receivers.stderr @@ -8,7 +8,7 @@ LL | banana::Chaenomeles.pick() | ^^^^ method not found in `Chaenomeles` | = help: items from traits can only be used if the trait is in scope -help: the following traits are implemented but not in scope; perhaps add a `use` for one of them: +help: the following traits which provide `pick` are implemented but not in scope; perhaps you want to import one of them | LL + use banana::Apple; | diff --git a/tests/ui/suggestions/import-trait-for-method-call.stderr b/tests/ui/suggestions/import-trait-for-method-call.stderr index 3f54daf136f6..58b07fe7a42c 100644 --- a/tests/ui/suggestions/import-trait-for-method-call.stderr +++ b/tests/ui/suggestions/import-trait-for-method-call.stderr @@ -8,7 +8,7 @@ LL | h.finish() = note: the method is available for `DefaultHasher` here | = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `Hasher` which provides `finish` is implemented but not in scope; perhaps you want to import it | LL + use std::hash::Hasher; | diff --git a/tests/ui/suggestions/issue-109291.stderr b/tests/ui/suggestions/issue-109291.stderr index c787be4de7c5..a173bbbb4900 100644 --- a/tests/ui/suggestions/issue-109291.stderr +++ b/tests/ui/suggestions/issue-109291.stderr @@ -2,10 +2,7 @@ error[E0599]: no function or associated item named `forced_capture` found for st --> $DIR/issue-109291.rs:2:65 | LL | println!("Custom backtrace: {}", std::backtrace::Backtrace::forced_capture()); - | ^^^^^^^^^^^^^^ - | | - | function or associated item not found in `Backtrace` - | help: there is an associated function with a similar name: `force_capture` + | ^^^^^^^^^^^^^^ function or associated item not found in `Backtrace` | note: if you're trying to build a new `Backtrace` consider using one of the following associated functions: Backtrace::capture @@ -13,6 +10,10 @@ note: if you're trying to build a new `Backtrace` consider using one of the foll Backtrace::disabled Backtrace::create --> $SRC_DIR/std/src/backtrace.rs:LL:COL +help: there is an associated function `force_capture` with a similar name + | +LL | println!("Custom backtrace: {}", std::backtrace::Backtrace::force_capture()); + | ~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/suggest-methods.rs b/tests/ui/suggestions/suggest-methods.rs index f40b9ed99b82..f80957954472 100644 --- a/tests/ui/suggestions/suggest-methods.rs +++ b/tests/ui/suggestions/suggest-methods.rs @@ -7,6 +7,7 @@ impl Foo { trait FooT { fn bag(&self); + //~^ HELP there is a method } impl FooT for Foo { @@ -19,12 +20,14 @@ fn main() { let s = "foo".to_string(); let _ = s.is_emtpy(); //~ ERROR no method named + //~^ HELP there is a method // Generates a warning for `count_zeros()`. `count_ones()` is also a close // match, but the former is closer. let _ = 63u32.count_eos(); //~ ERROR no method named + //~^ HELP there is a method - // Does not generate a warning let _ = 63u32.count_o(); //~ ERROR no method named + //~^ HELP there is a method } diff --git a/tests/ui/suggestions/suggest-methods.stderr b/tests/ui/suggestions/suggest-methods.stderr index 03cb9c779228..5bacad8c6e89 100644 --- a/tests/ui/suggestions/suggest-methods.stderr +++ b/tests/ui/suggestions/suggest-methods.stderr @@ -1,29 +1,50 @@ error[E0599]: no method named `bat` found for struct `Foo` in the current scope - --> $DIR/suggest-methods.rs:18:7 + --> $DIR/suggest-methods.rs:19:7 | LL | struct Foo; | ---------- method `bat` not found for this struct ... LL | f.bat(1.0); - | ^^^ help: there is a method with a similar name: `bar` + | ^^^ + | +help: there is a method `bag` with a similar name, but with different arguments + --> $DIR/suggest-methods.rs:9:5 + | +LL | fn bag(&self); + | ^^^^^^^^^^^^^^ error[E0599]: no method named `is_emtpy` found for struct `String` in the current scope - --> $DIR/suggest-methods.rs:21:15 + --> $DIR/suggest-methods.rs:22:15 | LL | let _ = s.is_emtpy(); - | ^^^^^^^^ help: there is a method with a similar name: `is_empty` + | ^^^^^^^^ + | +help: there is a method `is_empty` with a similar name + | +LL | let _ = s.is_empty(); + | ~~~~~~~~ error[E0599]: no method named `count_eos` found for type `u32` in the current scope - --> $DIR/suggest-methods.rs:25:19 + --> $DIR/suggest-methods.rs:27:19 | LL | let _ = 63u32.count_eos(); - | ^^^^^^^^^ help: there is a method with a similar name: `count_zeros` + | ^^^^^^^^^ + | +help: there is a method `count_zeros` with a similar name + | +LL | let _ = 63u32.count_zeros(); + | ~~~~~~~~~~~ error[E0599]: no method named `count_o` found for type `u32` in the current scope - --> $DIR/suggest-methods.rs:28:19 + --> $DIR/suggest-methods.rs:30:19 | LL | let _ = 63u32.count_o(); - | ^^^^^^^ help: there is a method with a similar name: `count_ones` + | ^^^^^^^ + | +help: there is a method `count_ones` with a similar name + | +LL | let _ = 63u32.count_ones(); + | ~~~~~~~~~~ error: aborting due to 4 previous errors diff --git a/tests/ui/suggestions/suggest-tryinto-edition-change.rs b/tests/ui/suggestions/suggest-tryinto-edition-change.rs index c4a24ffee93c..373217748745 100644 --- a/tests/ui/suggestions/suggest-tryinto-edition-change.rs +++ b/tests/ui/suggestions/suggest-tryinto-edition-change.rs @@ -5,7 +5,6 @@ fn test() { let _i: i16 = 0_i32.try_into().unwrap(); //~^ ERROR no method named `try_into` found for type `i32` in the current scope - //~| NOTE method not found in `i32` //~| NOTE 'std::convert::TryInto' is included in the prelude starting in Edition 2021 let _i: i16 = TryFrom::try_from(0_i32).unwrap(); diff --git a/tests/ui/suggestions/suggest-tryinto-edition-change.stderr b/tests/ui/suggestions/suggest-tryinto-edition-change.stderr index 057e37dbe109..db7c40101cdc 100644 --- a/tests/ui/suggestions/suggest-tryinto-edition-change.stderr +++ b/tests/ui/suggestions/suggest-tryinto-edition-change.stderr @@ -1,5 +1,5 @@ error[E0433]: failed to resolve: use of undeclared type `TryFrom` - --> $DIR/suggest-tryinto-edition-change.rs:11:19 + --> $DIR/suggest-tryinto-edition-change.rs:10:19 | LL | let _i: i16 = TryFrom::try_from(0_i32).unwrap(); | ^^^^^^^ use of undeclared type `TryFrom` @@ -14,7 +14,7 @@ LL + use std::convert::TryFrom; | error[E0433]: failed to resolve: use of undeclared type `TryInto` - --> $DIR/suggest-tryinto-edition-change.rs:17:19 + --> $DIR/suggest-tryinto-edition-change.rs:16:19 | LL | let _i: i16 = TryInto::try_into(0_i32).unwrap(); | ^^^^^^^ use of undeclared type `TryInto` @@ -29,7 +29,7 @@ LL + use std::convert::TryInto; | error[E0433]: failed to resolve: use of undeclared type `FromIterator` - --> $DIR/suggest-tryinto-edition-change.rs:23:22 + --> $DIR/suggest-tryinto-edition-change.rs:22:22 | LL | let _v: Vec<_> = FromIterator::from_iter(&[1]); | ^^^^^^^^^^^^ use of undeclared type `FromIterator` @@ -51,17 +51,21 @@ error[E0599]: no method named `try_into` found for type `i32` in the current sco --> $DIR/suggest-tryinto-edition-change.rs:6:25 | LL | let _i: i16 = 0_i32.try_into().unwrap(); - | ^^^^^^^^ method not found in `i32` + | ^^^^^^^^ --> $SRC_DIR/core/src/convert/mod.rs:LL:COL | = note: the method is available for `i32` here | = help: items from traits can only be used if the trait is in scope = note: 'std::convert::TryInto' is included in the prelude starting in Edition 2021 -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `TryInto` which provides `try_into` is implemented but not in scope; perhaps you want to import it | LL + use std::convert::TryInto; | +help: there is a method `into` with a similar name + | +LL | let _i: i16 = 0_i32.into().unwrap(); + | ~~~~ error: aborting due to 4 previous errors diff --git a/tests/ui/suggestions/use-placement-typeck.stderr b/tests/ui/suggestions/use-placement-typeck.stderr index d8f2d58a2487..dc2bd96bb21e 100644 --- a/tests/ui/suggestions/use-placement-typeck.stderr +++ b/tests/ui/suggestions/use-placement-typeck.stderr @@ -11,7 +11,7 @@ LL | pub struct S; | ------------ method `abc` not found for this struct | = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `Foo` which provides `abc` is implemented but not in scope; perhaps you want to import it | LL + use m::Foo; | diff --git a/tests/ui/traits/issue-117794.stderr b/tests/ui/traits/issue-117794.stderr index af63b47f07d9..66561ffa4ce4 100644 --- a/tests/ui/traits/issue-117794.stderr +++ b/tests/ui/traits/issue-117794.stderr @@ -2,7 +2,13 @@ error[E0599]: no method named `b` found for reference `&Self` in the current sco --> $DIR/issue-117794.rs:5:14 | LL | self.b(|| 0) - | ^ help: there is a method with a similar name: `a` + | ^ + | +help: there is a method `a` with a similar name, but with different arguments + --> $DIR/issue-117794.rs:4:5 + | +LL | fn a(&self) -> impl Foo { + | ^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/traits/item-privacy.stderr b/tests/ui/traits/item-privacy.stderr index 244cc2fc592a..d08bb4745bf5 100644 --- a/tests/ui/traits/item-privacy.stderr +++ b/tests/ui/traits/item-privacy.stderr @@ -5,13 +5,17 @@ LL | struct S; | -------- method `a` not found for this struct ... LL | S.a(); - | ^ method not found in `S` + | ^ | = help: items from traits can only be used if the trait is implemented and in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `A` which provides `a` is implemented but not in scope; perhaps you want to import it | LL + use method::A; | +help: there is a method `b` with a similar name + | +LL | S.b(); + | ~ error[E0599]: no method named `b` found for struct `S` in the current scope --> $DIR/item-privacy.rs:68:7 @@ -23,13 +27,17 @@ LL | fn b(&self) { } | - the method is available for `S` here ... LL | S.b(); - | ^ method not found in `S` + | ^ | = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `B` which provides `b` is implemented but not in scope; perhaps you want to import it | LL + use method::B; | +help: there is a method `c` with a similar name + | +LL | S.c(); + | ~ error[E0624]: method `a` is private --> $DIR/item-privacy.rs:72:7 @@ -50,7 +58,12 @@ LL | S::a(&S); | ^ function or associated item not found in `S` | = help: items from traits can only be used if the trait is implemented and in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: there is an associated constant `B` with a similar name + --> $DIR/item-privacy.rs:29:9 + | +LL | const B: u8 = 0; + | ^^^^^^^^^^^ +help: trait `A` which provides `a` is implemented but not in scope; perhaps you want to import it | LL + use method::A; | @@ -65,7 +78,12 @@ LL | S::b(&S); | ^ function or associated item not found in `S` | = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: there is an associated constant `B` with a similar name + --> $DIR/item-privacy.rs:29:9 + | +LL | const B: u8 = 0; + | ^^^^^^^^^^^ +help: trait `B` which provides `b` is implemented but not in scope; perhaps you want to import it | LL + use method::B; | @@ -89,10 +107,14 @@ LL | S::A; | ^ associated item not found in `S` | = help: items from traits can only be used if the trait is implemented and in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `A` which provides `A` is implemented but not in scope; perhaps you want to import it | LL + use assoc_const::A; | +help: there is an associated constant `B` with a similar name + | +LL | S::B; + | ~ error[E0599]: no associated item named `B` found for struct `S` in the current scope --> $DIR/item-privacy.rs:98:8 @@ -104,10 +126,14 @@ LL | S::B; | ^ associated item not found in `S` | = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `B` which provides `B` is implemented but not in scope; perhaps you want to import it | LL + use assoc_const::B; | +help: there is a method `b` with a similar name + | +LL | S::b; + | ~ error[E0624]: associated constant `A` is private --> $DIR/item-privacy.rs:101:14 diff --git a/tests/ui/traits/method-private.stderr b/tests/ui/traits/method-private.stderr index d19f0bc086b2..274767331bd9 100644 --- a/tests/ui/traits/method-private.stderr +++ b/tests/ui/traits/method-private.stderr @@ -8,7 +8,7 @@ LL | foo.method(); | ^^^^^^ private method | = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `Bar` which provides `method` is implemented but not in scope; perhaps you want to import it | LL + use inner::Bar; | diff --git a/tests/ui/traits/next-solver/object-unsafety.rs b/tests/ui/traits/next-solver/object-unsafety.rs index c9b3b1566a4b..4222607b5bfe 100644 --- a/tests/ui/traits/next-solver/object-unsafety.rs +++ b/tests/ui/traits/next-solver/object-unsafety.rs @@ -14,7 +14,6 @@ pub fn copy_any(t: &T) -> T { //~| ERROR the trait bound `dyn Setup: Setup` is not satisfied //~| ERROR mismatched types //~| ERROR the type ` as Setup>::From` is not well-formed - //~| ERROR the size for values of type ` as Setup>::From` cannot be known at compilation time // FIXME(-Znext-solver): These error messages are horrible and some of them // are even simple fallout from previous error. diff --git a/tests/ui/traits/next-solver/object-unsafety.stderr b/tests/ui/traits/next-solver/object-unsafety.stderr index eedca879b0c8..a9cbb721511c 100644 --- a/tests/ui/traits/next-solver/object-unsafety.stderr +++ b/tests/ui/traits/next-solver/object-unsafety.stderr @@ -42,20 +42,7 @@ error: the type ` as Setup>::From` is not well-formed LL | copy::>(t) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0277]: the size for values of type ` as Setup>::From` cannot be known at compilation time - --> $DIR/object-unsafety.rs:12:5 - | -LL | copy::>(t) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time - | - = help: the trait `Sized` is not implemented for ` as Setup>::From` - = note: the return type of a function must have a statically known size -help: consider further restricting the associated type - | -LL | pub fn copy_any(t: &T) -> T where as Setup>::From: Sized { - | +++++++++++++++++++++++++++++++++++++++++++++++++ - -error: aborting due to 5 previous errors +error: aborting due to 4 previous errors Some errors have detailed explanations: E0277, E0308. For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/span-bug-issue-121414.rs b/tests/ui/traits/span-bug-issue-121414.rs new file mode 100644 index 000000000000..6fbe2c179c65 --- /dev/null +++ b/tests/ui/traits/span-bug-issue-121414.rs @@ -0,0 +1,15 @@ +trait Bar { + type Type; +} +struct Foo<'a>(&'a ()); +impl<'a> Bar for Foo<'f> { //~ ERROR undeclared lifetime + type Type = u32; +} + +fn test() //~ ERROR implementation of `Bar` is not general enough +where + for<'a> as Bar>::Type: Sized, +{ +} + +fn main() {} diff --git a/tests/ui/traits/span-bug-issue-121414.stderr b/tests/ui/traits/span-bug-issue-121414.stderr new file mode 100644 index 000000000000..3c97f64e781e --- /dev/null +++ b/tests/ui/traits/span-bug-issue-121414.stderr @@ -0,0 +1,20 @@ +error[E0261]: use of undeclared lifetime name `'f` + --> $DIR/span-bug-issue-121414.rs:5:22 + | +LL | impl<'a> Bar for Foo<'f> { + | - ^^ undeclared lifetime + | | + | help: consider introducing lifetime `'f` here: `'f,` + +error: implementation of `Bar` is not general enough + --> $DIR/span-bug-issue-121414.rs:9:4 + | +LL | fn test() + | ^^^^ implementation of `Bar` is not general enough + | + = note: `Bar` would have to be implemented for the type `Foo<'0>`, for any lifetime `'0`... + = note: ...but `Bar` is actually implemented for the type `Foo<'1>`, for some specific lifetime `'1` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0261`. diff --git a/tests/ui/traits/subtype-recursion-limit.rs b/tests/ui/traits/subtype-recursion-limit.rs index 5804748844e5..e4b08a7ec677 100644 --- a/tests/ui/traits/subtype-recursion-limit.rs +++ b/tests/ui/traits/subtype-recursion-limit.rs @@ -10,7 +10,7 @@ fn main() { let x = return; let y = return; let mut w = (x, y); - //~^ ERROR overflow evaluating the requirement + //~^ ERROR overflow assigning `_` to `*const _` // Avoid creating lifetimes, `Sized` bounds or function calls. let a = (ptr::addr_of!(y), ptr::addr_of!(x)); w = a; diff --git a/tests/ui/traits/subtype-recursion-limit.stderr b/tests/ui/traits/subtype-recursion-limit.stderr index 5310f822cc33..e3587de8613d 100644 --- a/tests/ui/traits/subtype-recursion-limit.stderr +++ b/tests/ui/traits/subtype-recursion-limit.stderr @@ -1,4 +1,4 @@ -error[E0275]: overflow evaluating the requirement `_ <: *const _` +error[E0275]: overflow assigning `_` to `*const _` --> $DIR/subtype-recursion-limit.rs:12:17 | LL | let mut w = (x, y); diff --git a/tests/ui/traits/trait-upcasting/subtrait-method.stderr b/tests/ui/traits/trait-upcasting/subtrait-method.stderr index 918159e845b9..0408be6986bd 100644 --- a/tests/ui/traits/trait-upcasting/subtrait-method.stderr +++ b/tests/ui/traits/trait-upcasting/subtrait-method.stderr @@ -2,7 +2,7 @@ error[E0599]: no method named `c` found for reference `&dyn Bar` in the current --> $DIR/subtrait-method.rs:55:9 | LL | bar.c(); - | ^ help: there is a method with a similar name: `a` + | ^ | = help: items from traits can only be used if the trait is implemented and in scope note: `Baz` defines an item `c`, perhaps you need to implement it @@ -10,12 +10,16 @@ note: `Baz` defines an item `c`, perhaps you need to implement it | LL | trait Baz: Bar { | ^^^^^^^^^^^^^^ +help: there is a method `a` with a similar name + | +LL | bar.a(); + | ~ error[E0599]: no method named `b` found for reference `&dyn Foo` in the current scope --> $DIR/subtrait-method.rs:59:9 | LL | foo.b(); - | ^ help: there is a method with a similar name: `a` + | ^ | = help: items from traits can only be used if the trait is implemented and in scope note: `Bar` defines an item `b`, perhaps you need to implement it @@ -23,12 +27,16 @@ note: `Bar` defines an item `b`, perhaps you need to implement it | LL | trait Bar: Foo { | ^^^^^^^^^^^^^^ +help: there is a method `a` with a similar name + | +LL | foo.a(); + | ~ error[E0599]: no method named `c` found for reference `&dyn Foo` in the current scope --> $DIR/subtrait-method.rs:61:9 | LL | foo.c(); - | ^ help: there is a method with a similar name: `a` + | ^ | = help: items from traits can only be used if the trait is implemented and in scope note: `Baz` defines an item `c`, perhaps you need to implement it @@ -36,12 +44,16 @@ note: `Baz` defines an item `c`, perhaps you need to implement it | LL | trait Baz: Bar { | ^^^^^^^^^^^^^^ +help: there is a method `a` with a similar name + | +LL | foo.a(); + | ~ error[E0599]: no method named `b` found for reference `&dyn Foo` in the current scope --> $DIR/subtrait-method.rs:65:9 | LL | foo.b(); - | ^ help: there is a method with a similar name: `a` + | ^ | = help: items from traits can only be used if the trait is implemented and in scope note: `Bar` defines an item `b`, perhaps you need to implement it @@ -49,12 +61,16 @@ note: `Bar` defines an item `b`, perhaps you need to implement it | LL | trait Bar: Foo { | ^^^^^^^^^^^^^^ +help: there is a method `a` with a similar name + | +LL | foo.a(); + | ~ error[E0599]: no method named `c` found for reference `&dyn Foo` in the current scope --> $DIR/subtrait-method.rs:67:9 | LL | foo.c(); - | ^ help: there is a method with a similar name: `a` + | ^ | = help: items from traits can only be used if the trait is implemented and in scope note: `Baz` defines an item `c`, perhaps you need to implement it @@ -62,6 +78,10 @@ note: `Baz` defines an item `c`, perhaps you need to implement it | LL | trait Baz: Bar { | ^^^^^^^^^^^^^^ +help: there is a method `a` with a similar name + | +LL | foo.a(); + | ~ error: aborting due to 5 previous errors diff --git a/tests/ui/traits/well-formed-recursion-limit.rs b/tests/ui/traits/well-formed-recursion-limit.rs index 056cf947d4b5..770b2222580c 100644 --- a/tests/ui/traits/well-formed-recursion-limit.rs +++ b/tests/ui/traits/well-formed-recursion-limit.rs @@ -13,8 +13,8 @@ pub fn iso_un_option(i: ISO, Option>) -> IS //~^ ERROR no field `ab` on type //~| ERROR no field `ba` on type let left = move |o_a| match o_a { - //~^ ERROR overflow evaluating the requirement - None => panic!("absured"), + //~^ ERROR overflow assigning `_` to `Option<_>` + None => panic!("absurd"), Some(a) => a, }; let right = move |o_b| match o_b { diff --git a/tests/ui/traits/well-formed-recursion-limit.stderr b/tests/ui/traits/well-formed-recursion-limit.stderr index 6f5fda02315c..e0270ecabbd8 100644 --- a/tests/ui/traits/well-formed-recursion-limit.stderr +++ b/tests/ui/traits/well-formed-recursion-limit.stderr @@ -10,7 +10,7 @@ error[E0609]: no field `ba` on type `(Box<(dyn Fn(Option
) -> Option + 'sta LL | let (ab, ba) = (i.ab, i.ba); | ^^ unknown field -error[E0275]: overflow evaluating the requirement `_ <: Option<_>` +error[E0275]: overflow assigning `_` to `Option<_>` --> $DIR/well-formed-recursion-limit.rs:15:33 | LL | let left = move |o_a| match o_a { diff --git a/tests/ui/type-alias-impl-trait/hkl_forbidden.rs b/tests/ui/type-alias-impl-trait/hkl_forbidden.rs new file mode 100644 index 000000000000..c6d1202ef85f --- /dev/null +++ b/tests/ui/type-alias-impl-trait/hkl_forbidden.rs @@ -0,0 +1,39 @@ +#![feature(type_alias_impl_trait)] + +fn id(s: &str) -> &str { + s +} + +type Opaque<'a> = impl Sized + 'a; + +fn test(s: &str) -> (impl Fn(&str) -> Opaque<'_>, impl Fn(&str) -> Opaque<'_>) { + (id, id) //~ ERROR expected generic lifetime parameter, found `'_` +} + +fn id2<'a, 'b>(s: (&'a str, &'b str)) -> (&'a str, &'b str) { + s +} + +type Opaque2<'a> = impl Sized + 'a; + +fn test2() -> impl for<'a, 'b> Fn((&'a str, &'b str)) -> (Opaque2<'a>, Opaque2<'b>) { + id2 //~ ERROR expected generic lifetime parameter, found `'a` +} + +type Opaque3<'a> = impl Sized + 'a; + +fn test3(s: &str) -> (impl Fn(&str) -> Opaque3<'_>, Opaque3<'_>) { + (id, s) //~ ERROR expected generic lifetime parameter, found `'_` +} + +type Opaque4<'a> = impl Sized + 'a; +fn test4(s: &str) -> (Opaque4<'_>, impl Fn(&str) -> Opaque4<'_>) { + (s, id) //~ ERROR expected generic lifetime parameter, found `'_` +} + +type Inner<'a> = impl Sized; +fn outer_impl() -> impl for<'a> Fn(&'a ()) -> Inner<'a> { + |x| x //~ ERROR expected generic lifetime parameter, found `'a` +} + +fn main() {} diff --git a/tests/ui/type-alias-impl-trait/hkl_forbidden.stderr b/tests/ui/type-alias-impl-trait/hkl_forbidden.stderr new file mode 100644 index 000000000000..d49be73d94e7 --- /dev/null +++ b/tests/ui/type-alias-impl-trait/hkl_forbidden.stderr @@ -0,0 +1,48 @@ +error[E0792]: expected generic lifetime parameter, found `'_` + --> $DIR/hkl_forbidden.rs:10:5 + | +LL | type Opaque<'a> = impl Sized + 'a; + | -- this generic parameter must be used with a generic lifetime parameter +... +LL | (id, id) + | ^^^^^^^^ + +error[E0792]: expected generic lifetime parameter, found `'a` + --> $DIR/hkl_forbidden.rs:20:5 + | +LL | type Opaque2<'a> = impl Sized + 'a; + | -- this generic parameter must be used with a generic lifetime parameter +... +LL | id2 + | ^^^ + +error[E0792]: expected generic lifetime parameter, found `'_` + --> $DIR/hkl_forbidden.rs:26:5 + | +LL | type Opaque3<'a> = impl Sized + 'a; + | -- this generic parameter must be used with a generic lifetime parameter +... +LL | (id, s) + | ^^^^^^^ + +error[E0792]: expected generic lifetime parameter, found `'_` + --> $DIR/hkl_forbidden.rs:31:5 + | +LL | type Opaque4<'a> = impl Sized + 'a; + | -- this generic parameter must be used with a generic lifetime parameter +LL | fn test4(s: &str) -> (Opaque4<'_>, impl Fn(&str) -> Opaque4<'_>) { +LL | (s, id) + | ^^^^^^^ + +error[E0792]: expected generic lifetime parameter, found `'a` + --> $DIR/hkl_forbidden.rs:36:5 + | +LL | type Inner<'a> = impl Sized; + | -- this generic parameter must be used with a generic lifetime parameter +LL | fn outer_impl() -> impl for<'a> Fn(&'a ()) -> Inner<'a> { +LL | |x| x + | ^^^^^ + +error: aborting due to 5 previous errors + +For more information about this error, try `rustc --explain E0792`. diff --git a/tests/ui/type-alias-impl-trait/hkl_forbidden2.rs b/tests/ui/type-alias-impl-trait/hkl_forbidden2.rs new file mode 100644 index 000000000000..3d583d4413d9 --- /dev/null +++ b/tests/ui/type-alias-impl-trait/hkl_forbidden2.rs @@ -0,0 +1,18 @@ +#![feature(type_alias_impl_trait)] + +type Opaque<'a> = impl Sized + 'a; + +trait Trait<'a> { + type Assoc; +} + +impl<'a> Trait<'a> for () { + type Assoc = (); +} + +fn test() -> &'static dyn for<'a> Trait<'a, Assoc = Opaque<'a>> { + &() + //~^ ERROR: expected generic lifetime parameter, found `'a` +} + +fn main() {} diff --git a/tests/ui/type-alias-impl-trait/hkl_forbidden2.stderr b/tests/ui/type-alias-impl-trait/hkl_forbidden2.stderr new file mode 100644 index 000000000000..0a9a9d6bcf4e --- /dev/null +++ b/tests/ui/type-alias-impl-trait/hkl_forbidden2.stderr @@ -0,0 +1,12 @@ +error[E0792]: expected generic lifetime parameter, found `'a` + --> $DIR/hkl_forbidden2.rs:14:5 + | +LL | type Opaque<'a> = impl Sized + 'a; + | -- this generic parameter must be used with a generic lifetime parameter +... +LL | &() + | ^^^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0792`. diff --git a/tests/ui/type-alias-impl-trait/hkl_forbidden3.rs b/tests/ui/type-alias-impl-trait/hkl_forbidden3.rs new file mode 100644 index 000000000000..a4148599f77a --- /dev/null +++ b/tests/ui/type-alias-impl-trait/hkl_forbidden3.rs @@ -0,0 +1,13 @@ +#![feature(type_alias_impl_trait)] + +type Opaque<'a> = impl Sized + 'a; + +fn foo<'a>(x: &'a ()) -> &'a () { + x +} + +fn test() -> for<'a> fn(&'a ()) -> Opaque<'a> { + foo //~ ERROR: mismatched types +} + +fn main() {} diff --git a/tests/ui/type-alias-impl-trait/hkl_forbidden3.stderr b/tests/ui/type-alias-impl-trait/hkl_forbidden3.stderr new file mode 100644 index 000000000000..d262177a86bc --- /dev/null +++ b/tests/ui/type-alias-impl-trait/hkl_forbidden3.stderr @@ -0,0 +1,15 @@ +error[E0308]: mismatched types + --> $DIR/hkl_forbidden3.rs:10:5 + | +LL | type Opaque<'a> = impl Sized + 'a; + | --------------- the expected opaque type +... +LL | foo + | ^^^ one type is more general than the other + | + = note: expected fn pointer `for<'a> fn(&'a ()) -> Opaque<'a>` + found fn pointer `for<'a> fn(&'a ()) -> &'a ()` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/typeck/issue-43189.stderr b/tests/ui/typeck/issue-43189.stderr index 2e12651699d4..8432cbeca2a4 100644 --- a/tests/ui/typeck/issue-43189.stderr +++ b/tests/ui/typeck/issue-43189.stderr @@ -10,7 +10,7 @@ LL | fn a(&self) {} | - the method is available for `()` here | = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `A` which provides `a` is implemented but not in scope; perhaps you want to import it | LL + use xcrate_issue_43189_b::xcrate_issue_43189_a::A; | diff --git a/tests/ui/typeck/span-bug-issue-121410.rs b/tests/ui/typeck/span-bug-issue-121410.rs new file mode 100644 index 000000000000..324b398d74f7 --- /dev/null +++ b/tests/ui/typeck/span-bug-issue-121410.rs @@ -0,0 +1,15 @@ +fn test_missing_unsafe_warning_on_repr_packed() { + struct Foo { + x: String, + } + + let foo = Foo { x: String::new() }; + + let c = || { + let (_, t2) = foo.x; //~ ERROR mismatched types + }; + + c(); +} + +fn main() {} diff --git a/tests/ui/typeck/span-bug-issue-121410.stderr b/tests/ui/typeck/span-bug-issue-121410.stderr new file mode 100644 index 000000000000..f745ac51a5e3 --- /dev/null +++ b/tests/ui/typeck/span-bug-issue-121410.stderr @@ -0,0 +1,14 @@ +error[E0308]: mismatched types + --> $DIR/span-bug-issue-121410.rs:9:13 + | +LL | let (_, t2) = foo.x; + | ^^^^^^^ ----- this expression has type `String` + | | + | expected `String`, found `(_, _)` + | + = note: expected struct `String` + found tuple `(_, _)` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/ufcs/bad-builder.stderr b/tests/ui/ufcs/bad-builder.stderr index 7fa47c82de2f..e1c5e45b3ebb 100644 --- a/tests/ui/ufcs/bad-builder.stderr +++ b/tests/ui/ufcs/bad-builder.stderr @@ -2,10 +2,7 @@ error[E0599]: no function or associated item named `mew` found for struct `Vec $DIR/bad-builder.rs:2:15 | LL | Vec::::mew() - | ^^^ - | | - | function or associated item not found in `Vec` - | help: there is an associated function with a similar name: `new` + | ^^^ function or associated item not found in `Vec` | note: if you're trying to build a new `Vec` consider using one of the following associated functions: Vec::::new @@ -14,6 +11,10 @@ note: if you're trying to build a new `Vec` consider using one of the followi Vec::::new_in and 2 others --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL +help: there is an associated function `new` with a similar name + | +LL | Vec::::new() + | ~~~ error: aborting due to 1 previous error diff --git a/tests/ui/underscore-imports/shadow.stderr b/tests/ui/underscore-imports/shadow.stderr index da2631638928..4743d14dfb9e 100644 --- a/tests/ui/underscore-imports/shadow.stderr +++ b/tests/ui/underscore-imports/shadow.stderr @@ -5,7 +5,7 @@ LL | x.deref(); | ^^^^^ method not found in `&()` | = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `Deref` which provides `deref` is implemented but not in scope; perhaps you want to import it | LL + use std::ops::Deref; | diff --git a/tests/ui/uninhabited/exhaustive-wo-nevertype-issue-51221.rs b/tests/ui/uninhabited/exhaustive-wo-nevertype-issue-51221.rs index e392d74ea0ff..3130fb3fe9e6 100644 --- a/tests/ui/uninhabited/exhaustive-wo-nevertype-issue-51221.rs +++ b/tests/ui/uninhabited/exhaustive-wo-nevertype-issue-51221.rs @@ -1,6 +1,6 @@ //@ check-pass -#![feature(exhaustive_patterns)] +#![feature(min_exhaustive_patterns)] enum Void {} fn main() { diff --git a/tests/ui/uninhabited/uninhabited-irrefutable.exhaustive_patterns.stderr b/tests/ui/uninhabited/uninhabited-irrefutable.exhaustive_patterns.stderr index c9131a8372ab..bc1a9fa41915 100644 --- a/tests/ui/uninhabited/uninhabited-irrefutable.exhaustive_patterns.stderr +++ b/tests/ui/uninhabited/uninhabited-irrefutable.exhaustive_patterns.stderr @@ -1,5 +1,5 @@ error[E0005]: refutable pattern in local binding - --> $DIR/uninhabited-irrefutable.rs:32:9 + --> $DIR/uninhabited-irrefutable.rs:31:9 | LL | let Foo::D(_y, _z) = x; | ^^^^^^^^^^^^^^ pattern `Foo::A(_)` not covered @@ -7,7 +7,7 @@ LL | let Foo::D(_y, _z) = x; = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html note: `Foo` defined here - --> $DIR/uninhabited-irrefutable.rs:21:6 + --> $DIR/uninhabited-irrefutable.rs:20:6 | LL | enum Foo { | ^^^ diff --git a/tests/ui/uninhabited/uninhabited-irrefutable.min_exhaustive_patterns.stderr b/tests/ui/uninhabited/uninhabited-irrefutable.min_exhaustive_patterns.stderr index c9131a8372ab..bc1a9fa41915 100644 --- a/tests/ui/uninhabited/uninhabited-irrefutable.min_exhaustive_patterns.stderr +++ b/tests/ui/uninhabited/uninhabited-irrefutable.min_exhaustive_patterns.stderr @@ -1,5 +1,5 @@ error[E0005]: refutable pattern in local binding - --> $DIR/uninhabited-irrefutable.rs:32:9 + --> $DIR/uninhabited-irrefutable.rs:31:9 | LL | let Foo::D(_y, _z) = x; | ^^^^^^^^^^^^^^ pattern `Foo::A(_)` not covered @@ -7,7 +7,7 @@ LL | let Foo::D(_y, _z) = x; = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html note: `Foo` defined here - --> $DIR/uninhabited-irrefutable.rs:21:6 + --> $DIR/uninhabited-irrefutable.rs:20:6 | LL | enum Foo { | ^^^ diff --git a/tests/ui/uninhabited/uninhabited-irrefutable.rs b/tests/ui/uninhabited/uninhabited-irrefutable.rs index 67622a842a5c..c1f4e5f8e27f 100644 --- a/tests/ui/uninhabited/uninhabited-irrefutable.rs +++ b/tests/ui/uninhabited/uninhabited-irrefutable.rs @@ -1,7 +1,6 @@ //@ revisions: min_exhaustive_patterns exhaustive_patterns #![cfg_attr(exhaustive_patterns, feature(exhaustive_patterns))] #![cfg_attr(min_exhaustive_patterns, feature(min_exhaustive_patterns))] -#![cfg_attr(min_exhaustive_patterns, allow(incomplete_features))] #![feature(never_type)] mod foo { diff --git a/tests/ui/uninhabited/uninhabited-patterns.rs b/tests/ui/uninhabited/uninhabited-patterns.rs index 4e90691e5c80..ae12c0fc4af6 100644 --- a/tests/ui/uninhabited/uninhabited-patterns.rs +++ b/tests/ui/uninhabited/uninhabited-patterns.rs @@ -1,6 +1,6 @@ #![feature(box_patterns)] #![feature(never_type)] -#![feature(exhaustive_patterns)] +#![feature(min_exhaustive_patterns)] #![deny(unreachable_patterns)] mod foo { diff --git a/tests/ui/union/unnamed-fields/anon-struct-in-enum-issue-121446.rs b/tests/ui/union/unnamed-fields/anon-struct-in-enum-issue-121446.rs new file mode 100644 index 000000000000..00f9bfd5cdff --- /dev/null +++ b/tests/ui/union/unnamed-fields/anon-struct-in-enum-issue-121446.rs @@ -0,0 +1,11 @@ +#![crate_type = "lib"] +#![feature(unnamed_fields)] +#![allow(unused, incomplete_features)] + +enum K { + M { + _ : struct { field: u8 }, + //~^ error: unnamed fields are not allowed outside of structs or unions + //~| error: anonymous structs are not allowed outside of unnamed struct or union fields + } +} diff --git a/tests/ui/union/unnamed-fields/anon-struct-in-enum-issue-121446.stderr b/tests/ui/union/unnamed-fields/anon-struct-in-enum-issue-121446.stderr new file mode 100644 index 000000000000..43843141e2e7 --- /dev/null +++ b/tests/ui/union/unnamed-fields/anon-struct-in-enum-issue-121446.stderr @@ -0,0 +1,16 @@ +error: unnamed fields are not allowed outside of structs or unions + --> $DIR/anon-struct-in-enum-issue-121446.rs:7:9 + | +LL | _ : struct { field: u8 }, + | -^^^^^^^^^^^^^^^^^^^^^^^ + | | + | unnamed field declared here + +error: anonymous structs are not allowed outside of unnamed struct or union fields + --> $DIR/anon-struct-in-enum-issue-121446.rs:7:13 + | +LL | _ : struct { field: u8 }, + | ^^^^^^^^^^^^^^^^^^^^ anonymous struct declared here + +error: aborting due to 2 previous errors +