diff --git a/compiler/rustc_codegen_ssa/src/back/symbol_export.rs b/compiler/rustc_codegen_ssa/src/back/symbol_export.rs index 11bd47a8f0c79..3b550f9b65de3 100644 --- a/compiler/rustc_codegen_ssa/src/back/symbol_export.rs +++ b/compiler/rustc_codegen_ssa/src/back/symbol_export.rs @@ -42,10 +42,6 @@ pub fn crates_export_threshold(crate_types: &[CrateType]) -> SymbolExportLevel { fn reachable_non_generics_provider(tcx: TyCtxt<'_>, cnum: CrateNum) -> DefIdMap { assert_eq!(cnum, LOCAL_CRATE); - if !tcx.sess.opts.output_types.should_codegen() { - return Default::default(); - } - // Check to see if this crate is a "special runtime crate". These // crates, implementation details of the standard library, typically // have a bunch of `pub extern` and `#[no_mangle]` functions as the @@ -172,10 +168,6 @@ fn exported_symbols_provider_local( ) -> &[(ExportedSymbol<'_>, SymbolExportInfo)] { assert_eq!(cnum, LOCAL_CRATE); - if !tcx.sess.opts.output_types.should_codegen() { - return &[]; - } - // FIXME: Sorting this is unnecessary since we are sorting later anyway. // Can we skip the later sorting? let mut symbols: Vec<_> = tcx.with_stable_hashing_context(|hcx| { @@ -289,7 +281,10 @@ fn exported_symbols_provider_local( )); } - if tcx.sess.opts.share_generics() && tcx.local_crate_exports_generics() { + if tcx.sess.opts.share_generics() + && tcx.local_crate_exports_generics() + && tcx.sess.opts.output_types.should_codegen() + { use rustc_middle::mir::mono::{Linkage, MonoItem, Visibility}; use rustc_middle::ty::InstanceDef; diff --git a/compiler/rustc_driver_impl/src/lib.rs b/compiler/rustc_driver_impl/src/lib.rs index 1a4fe07b47656..b01bdefa158f4 100644 --- a/compiler/rustc_driver_impl/src/lib.rs +++ b/compiler/rustc_driver_impl/src/lib.rs @@ -342,6 +342,10 @@ fn run_compiler( queries.global_ctxt()?.enter(|tcx| tcx.analysis(()))?; + if !sess.opts.output_types.should_codegen() && sess.compile_status().is_ok() { + queries.global_ctxt()?.enter(|tcx| tcx.collect_crate_mono_items_for_check(())); + } + if callbacks.after_analysis(compiler, queries) == Compilation::Stop { return early_exit(); } diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs index 1ccad25fe0843..1a5416c120b3d 100644 --- a/compiler/rustc_middle/src/query/mod.rs +++ b/compiler/rustc_middle/src/query/mod.rs @@ -1857,6 +1857,11 @@ rustc_queries! { desc { "collect_and_partition_mono_items" } } + query collect_crate_mono_items_for_check(_: ()) { + eval_always + desc { "monomorphize the crate graph" } + } + query is_codegened_item(def_id: DefId) -> bool { desc { |tcx| "determining whether `{}` needs codegen", tcx.def_path_str(def_id) } } diff --git a/compiler/rustc_monomorphize/src/collector.rs b/compiler/rustc_monomorphize/src/collector.rs index 55a9f912e0858..95670b3ed25ff 100644 --- a/compiler/rustc_monomorphize/src/collector.rs +++ b/compiler/rustc_monomorphize/src/collector.rs @@ -203,9 +203,14 @@ use crate::errors::{ EncounteredErrorWhileInstantiating, LargeAssignmentsLint, RecursionLimit, TypeLengthLimit, }; -#[derive(PartialEq)] +#[derive(Debug, Copy, Clone)] pub enum MonoItemCollectionMode { - Eager, + Eager { + /// Whether to use optimized mir for collection or just analyis MIR. + /// By default uses optimized mir, but for `cargo check` we use unoptimized mir, + /// as that is faster. + optimized_mir: bool, + }, Lazy, } @@ -351,6 +356,7 @@ pub fn collect_crate_mono_items( &mut recursion_depths, recursion_limit, inlining_map, + mode, ); }); }); @@ -408,6 +414,7 @@ fn collect_items_rec<'tcx>( recursion_depths: &mut DefIdMap, recursion_limit: Limit, inlining_map: MTRef<'_, MTLock>>, + mode: MonoItemCollectionMode, ) { if !visited.lock_mut().insert(starting_point.node) { // We've been here already, no need to search again. @@ -476,7 +483,7 @@ fn collect_items_rec<'tcx>( check_type_length_limit(tcx, instance); rustc_data_structures::stack::ensure_sufficient_stack(|| { - collect_neighbours(tcx, instance, &mut neighbors); + collect_neighbours(tcx, instance, &mut neighbors, mode); }); } MonoItem::GlobalAsm(item_id) => { @@ -532,7 +539,15 @@ fn collect_items_rec<'tcx>( inlining_map.lock_mut().record_accesses(starting_point.node, &neighbors.items); for (neighbour, _) in neighbors.items { - collect_items_rec(tcx, neighbour, visited, recursion_depths, recursion_limit, inlining_map); + collect_items_rec( + tcx, + neighbour, + visited, + recursion_depths, + recursion_limit, + inlining_map, + mode, + ); } if let Some((def_id, depth)) = recursion_depth_reset { @@ -1191,7 +1206,7 @@ impl<'v> RootCollector<'_, 'v> { fn process_item(&mut self, id: hir::ItemId) { match self.tcx.def_kind(id.owner_id) { DefKind::Enum | DefKind::Struct | DefKind::Union => { - if self.mode == MonoItemCollectionMode::Eager + if let MonoItemCollectionMode::Eager { .. } = self.mode && self.tcx.generics_of(id.owner_id).count() == 0 { debug!("RootCollector: ADT drop-glue for `{id:?}`",); @@ -1224,7 +1239,7 @@ impl<'v> RootCollector<'_, 'v> { } } DefKind::Impl { .. } => { - if self.mode == MonoItemCollectionMode::Eager { + if let MonoItemCollectionMode::Eager { .. } = self.mode { create_mono_items_for_default_impls(self.tcx, id, self.output); } } @@ -1244,7 +1259,7 @@ impl<'v> RootCollector<'_, 'v> { fn is_root(&self, def_id: LocalDefId) -> bool { !item_requires_monomorphization(self.tcx, def_id) && match self.mode { - MonoItemCollectionMode::Eager => true, + MonoItemCollectionMode::Eager { .. } => true, MonoItemCollectionMode::Lazy => { self.entry_fn.and_then(|(id, _)| id.as_local()) == Some(def_id) || self.tcx.is_reachable_non_generic(def_id) @@ -1396,9 +1411,27 @@ fn collect_neighbours<'tcx>( tcx: TyCtxt<'tcx>, instance: Instance<'tcx>, output: &mut MonoItems<'tcx>, + mode: MonoItemCollectionMode, ) { - let body = tcx.instance_mir(instance.def); - MirNeighborCollector { tcx, body: &body, output, instance }.visit_body(&body); + let mut collect = |body: &mir::Body<'tcx>| { + MirNeighborCollector { tcx, body: &body, output, instance }.visit_body(body) + }; + if let MonoItemCollectionMode::Eager { optimized_mir: false } = mode { + if let ty::InstanceDef::Item(def) = instance.def { + let def_kind = tcx.def_kind(def.did); + match def_kind { + // Generators get their optimized_mir taken (and thus drop elab mir stolen) in order + // to compute their Send/Sync bounds. + DefKind::Generator | + DefKind::Ctor(..) => {}, + _ => if let Some(def) = def.as_local() && !tcx.sess.opts.unstable_opts.polymorphize { + collect(&*tcx.mir_drops_elaborated_and_const_checked(def).borrow()); + return; + }, + } + } + } + collect(tcx.instance_mir(instance.def)); } #[instrument(skip(tcx, output), level = "debug")] diff --git a/compiler/rustc_monomorphize/src/lib.rs b/compiler/rustc_monomorphize/src/lib.rs index f88155e4fc792..f76c48590200e 100644 --- a/compiler/rustc_monomorphize/src/lib.rs +++ b/compiler/rustc_monomorphize/src/lib.rs @@ -1,4 +1,5 @@ #![feature(array_windows)] +#![feature(let_chains)] #![recursion_limit = "256"] #![allow(rustc::potential_query_instability)] #![deny(rustc::untranslatable_diagnostic)] diff --git a/compiler/rustc_monomorphize/src/partitioning/mod.rs b/compiler/rustc_monomorphize/src/partitioning/mod.rs index 524c51d88d755..ab68b46d1591d 100644 --- a/compiler/rustc_monomorphize/src/partitioning/mod.rs +++ b/compiler/rustc_monomorphize/src/partitioning/mod.rs @@ -347,13 +347,20 @@ where } } +fn collect_crate_mono_items_for_check(tcx: TyCtxt<'_>, (): ()) { + collector::collect_crate_mono_items( + tcx, + MonoItemCollectionMode::Eager { optimized_mir: false }, + ); +} + fn collect_and_partition_mono_items(tcx: TyCtxt<'_>, (): ()) -> (&DefIdSet, &[CodegenUnit<'_>]) { let collection_mode = match tcx.sess.opts.unstable_opts.print_mono_items { Some(ref s) => { let mode = s.to_lowercase(); let mode = mode.trim(); if mode == "eager" { - MonoItemCollectionMode::Eager + MonoItemCollectionMode::Eager { optimized_mir: true } } else { if mode != "lazy" { tcx.sess.emit_warning(UnknownCguCollectionMode { mode }); @@ -364,7 +371,7 @@ fn collect_and_partition_mono_items(tcx: TyCtxt<'_>, (): ()) -> (&DefIdSet, &[Co } None => { if tcx.sess.link_dead_code() { - MonoItemCollectionMode::Eager + MonoItemCollectionMode::Eager { optimized_mir: true } } else { MonoItemCollectionMode::Lazy } @@ -582,6 +589,7 @@ fn codegened_and_inlined_items(tcx: TyCtxt<'_>, (): ()) -> &DefIdSet { pub fn provide(providers: &mut Providers) { providers.collect_and_partition_mono_items = collect_and_partition_mono_items; + providers.collect_crate_mono_items_for_check = collect_crate_mono_items_for_check; providers.codegened_and_inlined_items = codegened_and_inlined_items; providers.is_codegened_item = |tcx, def_id| { diff --git a/tests/ui/associated-consts/defaults-cyclic-fail.rs b/tests/ui/associated-consts/defaults-cyclic-fail.rs index a1c6840a0f1b3..939e1222b03a7 100644 --- a/tests/ui/associated-consts/defaults-cyclic-fail.rs +++ b/tests/ui/associated-consts/defaults-cyclic-fail.rs @@ -1,5 +1,3 @@ -// build-fail - // Cyclic assoc. const defaults don't error unless *used* trait Tr { const A: u8 = Self::B; diff --git a/tests/ui/associated-consts/defaults-cyclic-fail.stderr b/tests/ui/associated-consts/defaults-cyclic-fail.stderr index a1483911b297d..9276f1541330b 100644 --- a/tests/ui/associated-consts/defaults-cyclic-fail.stderr +++ b/tests/ui/associated-consts/defaults-cyclic-fail.stderr @@ -1,17 +1,17 @@ error[E0391]: cycle detected when const-evaluating + checking `Tr::A` - --> $DIR/defaults-cyclic-fail.rs:5:19 + --> $DIR/defaults-cyclic-fail.rs:3:19 | LL | const A: u8 = Self::B; | ^^^^^^^ | note: ...which requires const-evaluating + checking `Tr::B`... - --> $DIR/defaults-cyclic-fail.rs:8:19 + --> $DIR/defaults-cyclic-fail.rs:6:19 | LL | const B: u8 = Self::A; | ^^^^^^^ = note: ...which again requires const-evaluating + checking `Tr::A`, completing the cycle note: cycle used when const-evaluating + checking `main::promoted[1]` - --> $DIR/defaults-cyclic-fail.rs:16:16 + --> $DIR/defaults-cyclic-fail.rs:14:16 | LL | assert_eq!(<() as Tr>::A, 0); | ^^^^^^^^^^^^^ diff --git a/tests/ui/associated-consts/defaults-not-assumed-fail.rs b/tests/ui/associated-consts/defaults-not-assumed-fail.rs index 495dfb338ae31..79db01376eee7 100644 --- a/tests/ui/associated-consts/defaults-not-assumed-fail.rs +++ b/tests/ui/associated-consts/defaults-not-assumed-fail.rs @@ -1,5 +1,3 @@ -// build-fail - trait Tr { const A: u8 = 255; diff --git a/tests/ui/associated-consts/defaults-not-assumed-fail.stderr b/tests/ui/associated-consts/defaults-not-assumed-fail.stderr index fb7159e40c996..037db1a3a77a9 100644 --- a/tests/ui/associated-consts/defaults-not-assumed-fail.stderr +++ b/tests/ui/associated-consts/defaults-not-assumed-fail.stderr @@ -1,17 +1,17 @@ error[E0080]: evaluation of `<() as Tr>::B` failed - --> $DIR/defaults-not-assumed-fail.rs:8:19 + --> $DIR/defaults-not-assumed-fail.rs:6:19 | LL | const B: u8 = Self::A + 1; | ^^^^^^^^^^^ attempt to compute `u8::MAX + 1_u8`, which would overflow note: erroneous constant used - --> $DIR/defaults-not-assumed-fail.rs:33:16 + --> $DIR/defaults-not-assumed-fail.rs:31:16 | LL | assert_eq!(<() as Tr>::B, 0); // causes the error above | ^^^^^^^^^^^^^ note: erroneous constant used - --> $DIR/defaults-not-assumed-fail.rs:33:5 + --> $DIR/defaults-not-assumed-fail.rs:31:5 | LL | assert_eq!(<() as Tr>::B, 0); // causes the error above | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -19,15 +19,7 @@ LL | assert_eq!(<() as Tr>::B, 0); // causes the error above = note: this note originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) note: erroneous constant used - --> $DIR/defaults-not-assumed-fail.rs:33:5 - | -LL | assert_eq!(<() as Tr>::B, 0); // causes the error above - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: this note originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) - -note: erroneous constant used - --> $DIR/defaults-not-assumed-fail.rs:33:5 + --> $DIR/defaults-not-assumed-fail.rs:31:5 | LL | assert_eq!(<() as Tr>::B, 0); // causes the error above | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/async-await/large_moves.attribute.stderr b/tests/ui/async-await/large_moves.attribute.stderr index 0c5452475a657..da34f44b2d680 100644 --- a/tests/ui/async-await/large_moves.attribute.stderr +++ b/tests/ui/async-await/large_moves.attribute.stderr @@ -1,5 +1,5 @@ error: moving 10024 bytes - --> $DIR/large_moves.rs:13:13 + --> $DIR/large_moves.rs:12:13 | LL | let x = async { | _____________^ @@ -18,7 +18,7 @@ LL | #![deny(large_assignments)] | ^^^^^^^^^^^^^^^^^ error: moving 10024 bytes - --> $DIR/large_moves.rs:19:14 + --> $DIR/large_moves.rs:18:14 | LL | let z = (x, 42); | ^ value moved from here @@ -26,7 +26,7 @@ LL | let z = (x, 42); = note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]` error: moving 10024 bytes - --> $DIR/large_moves.rs:19:13 + --> $DIR/large_moves.rs:18:13 | LL | let z = (x, 42); | ^^^^^^^ value moved from here @@ -34,7 +34,7 @@ LL | let z = (x, 42); = note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]` error: moving 10024 bytes - --> $DIR/large_moves.rs:21:13 + --> $DIR/large_moves.rs:20:13 | LL | let a = z.0; | ^^^ value moved from here diff --git a/tests/ui/async-await/large_moves.option.stderr b/tests/ui/async-await/large_moves.option.stderr index 0c5452475a657..da34f44b2d680 100644 --- a/tests/ui/async-await/large_moves.option.stderr +++ b/tests/ui/async-await/large_moves.option.stderr @@ -1,5 +1,5 @@ error: moving 10024 bytes - --> $DIR/large_moves.rs:13:13 + --> $DIR/large_moves.rs:12:13 | LL | let x = async { | _____________^ @@ -18,7 +18,7 @@ LL | #![deny(large_assignments)] | ^^^^^^^^^^^^^^^^^ error: moving 10024 bytes - --> $DIR/large_moves.rs:19:14 + --> $DIR/large_moves.rs:18:14 | LL | let z = (x, 42); | ^ value moved from here @@ -26,7 +26,7 @@ LL | let z = (x, 42); = note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]` error: moving 10024 bytes - --> $DIR/large_moves.rs:19:13 + --> $DIR/large_moves.rs:18:13 | LL | let z = (x, 42); | ^^^^^^^ value moved from here @@ -34,7 +34,7 @@ LL | let z = (x, 42); = note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]` error: moving 10024 bytes - --> $DIR/large_moves.rs:21:13 + --> $DIR/large_moves.rs:20:13 | LL | let a = z.0; | ^^^ value moved from here diff --git a/tests/ui/async-await/large_moves.rs b/tests/ui/async-await/large_moves.rs index d43d0eec0cabc..1d5219929f4ca 100644 --- a/tests/ui/async-await/large_moves.rs +++ b/tests/ui/async-await/large_moves.rs @@ -1,7 +1,6 @@ #![deny(large_assignments)] #![feature(large_assignments)] #![cfg_attr(attribute, move_size_limit = "1000")] -// build-fail // only-x86_64 // revisions: attribute option // [option]compile-flags: -Zmove-size-limit=1000 diff --git a/tests/ui/async-await/mutually-recursive-async-impl-trait-type.stderr b/tests/ui/async-await/mutually-recursive-async-impl-trait-type.stderr deleted file mode 100644 index 8a7317bb95a70..0000000000000 --- a/tests/ui/async-await/mutually-recursive-async-impl-trait-type.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0733]: recursion in an `async fn` requires boxing - --> $DIR/mutually-recursive-async-impl-trait-type.rs:9:18 - | -LL | async fn rec_1() { - | ^ recursive `async fn` - | - = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future` - = note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion - -error[E0733]: recursion in an `async fn` requires boxing - --> $DIR/mutually-recursive-async-impl-trait-type.rs:13:18 - | -LL | async fn rec_2() { - | ^ recursive `async fn` - | - = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future` - = note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0733`. diff --git a/tests/ui/async-await/recursive-async-impl-trait-type.stderr b/tests/ui/async-await/recursive-async-impl-trait-type.stderr deleted file mode 100644 index 7e63a8da55255..0000000000000 --- a/tests/ui/async-await/recursive-async-impl-trait-type.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0733]: recursion in an `async fn` requires boxing - --> $DIR/recursive-async-impl-trait-type.rs:8:40 - | -LL | async fn recursive_async_function() -> () { - | ^^ recursive `async fn` - | - = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future` - = note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0733`. diff --git a/tests/ui/consts/assoc_const_generic_impl.rs b/tests/ui/consts/assoc_const_generic_impl.rs index 3475c862bfc2d..26525e900965f 100644 --- a/tests/ui/consts/assoc_const_generic_impl.rs +++ b/tests/ui/consts/assoc_const_generic_impl.rs @@ -1,12 +1,10 @@ -// build-fail - trait ZeroSized: Sized { const I_AM_ZERO_SIZED: (); fn requires_zero_size(self); } impl ZeroSized for T { - const I_AM_ZERO_SIZED: () = [()][std::mem::size_of::()]; //~ ERROR evaluation of `::I_AM_ZERO_SIZED` failed + const I_AM_ZERO_SIZED: () = [()][std::mem::size_of::()]; //~ ERROR evaluation of `::I_AM_ZERO_SIZED` failed fn requires_zero_size(self) { let () = Self::I_AM_ZERO_SIZED; println!("requires_zero_size called"); diff --git a/tests/ui/consts/assoc_const_generic_impl.stderr b/tests/ui/consts/assoc_const_generic_impl.stderr index 854b9ce5b223b..b6ab1f57348df 100644 --- a/tests/ui/consts/assoc_const_generic_impl.stderr +++ b/tests/ui/consts/assoc_const_generic_impl.stderr @@ -1,11 +1,11 @@ error[E0080]: evaluation of `::I_AM_ZERO_SIZED` failed - --> $DIR/assoc_const_generic_impl.rs:9:34 + --> $DIR/assoc_const_generic_impl.rs:7:33 | -LL | const I_AM_ZERO_SIZED: () = [()][std::mem::size_of::()]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ index out of bounds: the length is 1 but the index is 4 +LL | const I_AM_ZERO_SIZED: () = [()][std::mem::size_of::()]; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ index out of bounds: the length is 1 but the index is 4 note: the above error was encountered while instantiating `fn ::requires_zero_size` - --> $DIR/assoc_const_generic_impl.rs:18:5 + --> $DIR/assoc_const_generic_impl.rs:16:5 | LL | 42_u32.requires_zero_size(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/consts/const-err-late.rs b/tests/ui/consts/const-err-late.rs index d2476e4934656..61a3a217a0151 100644 --- a/tests/ui/consts/const-err-late.rs +++ b/tests/ui/consts/const-err-late.rs @@ -1,4 +1,3 @@ -// build-fail // compile-flags: -C overflow-checks=on #![allow(arithmetic_overflow, unconditional_panic)] diff --git a/tests/ui/consts/const-err-late.stderr b/tests/ui/consts/const-err-late.stderr index cb0cab2444bf7..3394810ba537d 100644 --- a/tests/ui/consts/const-err-late.stderr +++ b/tests/ui/consts/const-err-late.stderr @@ -1,39 +1,33 @@ error[E0080]: evaluation of `S::::FOO` failed - --> $DIR/const-err-late.rs:13:21 + --> $DIR/const-err-late.rs:12:21 | LL | const FOO: u8 = [5u8][1]; | ^^^^^^^^ index out of bounds: the length is 1 but the index is 1 note: erroneous constant used - --> $DIR/const-err-late.rs:19:16 + --> $DIR/const-err-late.rs:18:16 | LL | black_box((S::::FOO, S::::FOO)); | ^^^^^^^^^^^^^ note: erroneous constant used - --> $DIR/const-err-late.rs:19:16 + --> $DIR/const-err-late.rs:18:16 | LL | black_box((S::::FOO, S::::FOO)); | ^^^^^^^^^^^^^ error[E0080]: evaluation of `S::::FOO` failed - --> $DIR/const-err-late.rs:13:21 + --> $DIR/const-err-late.rs:12:21 | LL | const FOO: u8 = [5u8][1]; | ^^^^^^^^ index out of bounds: the length is 1 but the index is 1 note: erroneous constant used - --> $DIR/const-err-late.rs:19:31 + --> $DIR/const-err-late.rs:18:31 | LL | black_box((S::::FOO, S::::FOO)); | ^^^^^^^^^^^^^ -note: erroneous constant used - --> $DIR/const-err-late.rs:19:16 - | -LL | black_box((S::::FOO, S::::FOO)); - | ^^^^^^^^^^^^^ - error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/consts/const-err2.noopt.stderr b/tests/ui/consts/const-err2.noopt.stderr index 8b1688c4a8989..1ded24dbf8ad1 100644 --- a/tests/ui/consts/const-err2.noopt.stderr +++ b/tests/ui/consts/const-err2.noopt.stderr @@ -1,5 +1,5 @@ error: this arithmetic operation will overflow - --> $DIR/const-err2.rs:19:13 + --> $DIR/const-err2.rs:17:13 | LL | let a = -i8::MIN; | ^^^^^^^^ attempt to negate `i8::MIN`, which would overflow @@ -7,37 +7,37 @@ LL | let a = -i8::MIN; = note: `#[deny(arithmetic_overflow)]` on by default error: this arithmetic operation will overflow - --> $DIR/const-err2.rs:21:18 + --> $DIR/const-err2.rs:19:18 | LL | let a_i128 = -i128::MIN; | ^^^^^^^^^^ attempt to negate `i128::MIN`, which would overflow error: this arithmetic operation will overflow - --> $DIR/const-err2.rs:23:13 + --> $DIR/const-err2.rs:21:13 | LL | let b = 200u8 + 200u8 + 200u8; | ^^^^^^^^^^^^^ attempt to compute `200_u8 + 200_u8`, which would overflow error: this arithmetic operation will overflow - --> $DIR/const-err2.rs:25:18 + --> $DIR/const-err2.rs:23:18 | LL | let b_i128 = i128::MIN - i128::MAX; | ^^^^^^^^^^^^^^^^^^^^^ attempt to compute `i128::MIN - i128::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/const-err2.rs:27:13 + --> $DIR/const-err2.rs:25:13 | LL | let c = 200u8 * 4; | ^^^^^^^^^ attempt to compute `200_u8 * 4_u8`, which would overflow error: this arithmetic operation will overflow - --> $DIR/const-err2.rs:29:13 + --> $DIR/const-err2.rs:27:13 | LL | let d = 42u8 - (42u8 + 1); | ^^^^^^^^^^^^^^^^^ attempt to compute `42_u8 - 43_u8`, which would overflow error: this operation will panic at runtime - --> $DIR/const-err2.rs:31:14 + --> $DIR/const-err2.rs:29:14 | LL | let _e = [5u8][1]; | ^^^^^^^^ index out of bounds: the length is 1 but the index is 1 diff --git a/tests/ui/consts/const-err2.opt.stderr b/tests/ui/consts/const-err2.opt.stderr index 8b1688c4a8989..1ded24dbf8ad1 100644 --- a/tests/ui/consts/const-err2.opt.stderr +++ b/tests/ui/consts/const-err2.opt.stderr @@ -1,5 +1,5 @@ error: this arithmetic operation will overflow - --> $DIR/const-err2.rs:19:13 + --> $DIR/const-err2.rs:17:13 | LL | let a = -i8::MIN; | ^^^^^^^^ attempt to negate `i8::MIN`, which would overflow @@ -7,37 +7,37 @@ LL | let a = -i8::MIN; = note: `#[deny(arithmetic_overflow)]` on by default error: this arithmetic operation will overflow - --> $DIR/const-err2.rs:21:18 + --> $DIR/const-err2.rs:19:18 | LL | let a_i128 = -i128::MIN; | ^^^^^^^^^^ attempt to negate `i128::MIN`, which would overflow error: this arithmetic operation will overflow - --> $DIR/const-err2.rs:23:13 + --> $DIR/const-err2.rs:21:13 | LL | let b = 200u8 + 200u8 + 200u8; | ^^^^^^^^^^^^^ attempt to compute `200_u8 + 200_u8`, which would overflow error: this arithmetic operation will overflow - --> $DIR/const-err2.rs:25:18 + --> $DIR/const-err2.rs:23:18 | LL | let b_i128 = i128::MIN - i128::MAX; | ^^^^^^^^^^^^^^^^^^^^^ attempt to compute `i128::MIN - i128::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/const-err2.rs:27:13 + --> $DIR/const-err2.rs:25:13 | LL | let c = 200u8 * 4; | ^^^^^^^^^ attempt to compute `200_u8 * 4_u8`, which would overflow error: this arithmetic operation will overflow - --> $DIR/const-err2.rs:29:13 + --> $DIR/const-err2.rs:27:13 | LL | let d = 42u8 - (42u8 + 1); | ^^^^^^^^^^^^^^^^^ attempt to compute `42_u8 - 43_u8`, which would overflow error: this operation will panic at runtime - --> $DIR/const-err2.rs:31:14 + --> $DIR/const-err2.rs:29:14 | LL | let _e = [5u8][1]; | ^^^^^^^^ index out of bounds: the length is 1 but the index is 1 diff --git a/tests/ui/consts/const-err2.opt_with_overflow_checks.stderr b/tests/ui/consts/const-err2.opt_with_overflow_checks.stderr index 8b1688c4a8989..1ded24dbf8ad1 100644 --- a/tests/ui/consts/const-err2.opt_with_overflow_checks.stderr +++ b/tests/ui/consts/const-err2.opt_with_overflow_checks.stderr @@ -1,5 +1,5 @@ error: this arithmetic operation will overflow - --> $DIR/const-err2.rs:19:13 + --> $DIR/const-err2.rs:17:13 | LL | let a = -i8::MIN; | ^^^^^^^^ attempt to negate `i8::MIN`, which would overflow @@ -7,37 +7,37 @@ LL | let a = -i8::MIN; = note: `#[deny(arithmetic_overflow)]` on by default error: this arithmetic operation will overflow - --> $DIR/const-err2.rs:21:18 + --> $DIR/const-err2.rs:19:18 | LL | let a_i128 = -i128::MIN; | ^^^^^^^^^^ attempt to negate `i128::MIN`, which would overflow error: this arithmetic operation will overflow - --> $DIR/const-err2.rs:23:13 + --> $DIR/const-err2.rs:21:13 | LL | let b = 200u8 + 200u8 + 200u8; | ^^^^^^^^^^^^^ attempt to compute `200_u8 + 200_u8`, which would overflow error: this arithmetic operation will overflow - --> $DIR/const-err2.rs:25:18 + --> $DIR/const-err2.rs:23:18 | LL | let b_i128 = i128::MIN - i128::MAX; | ^^^^^^^^^^^^^^^^^^^^^ attempt to compute `i128::MIN - i128::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/const-err2.rs:27:13 + --> $DIR/const-err2.rs:25:13 | LL | let c = 200u8 * 4; | ^^^^^^^^^ attempt to compute `200_u8 * 4_u8`, which would overflow error: this arithmetic operation will overflow - --> $DIR/const-err2.rs:29:13 + --> $DIR/const-err2.rs:27:13 | LL | let d = 42u8 - (42u8 + 1); | ^^^^^^^^^^^^^^^^^ attempt to compute `42_u8 - 43_u8`, which would overflow error: this operation will panic at runtime - --> $DIR/const-err2.rs:31:14 + --> $DIR/const-err2.rs:29:14 | LL | let _e = [5u8][1]; | ^^^^^^^^ index out of bounds: the length is 1 but the index is 1 diff --git a/tests/ui/consts/const-err2.rs b/tests/ui/consts/const-err2.rs index db49ec25aaaeb..3673d6dab925c 100644 --- a/tests/ui/consts/const-err2.rs +++ b/tests/ui/consts/const-err2.rs @@ -7,8 +7,6 @@ //[opt]compile-flags: -O //[opt_with_overflow_checks]compile-flags: -C overflow-checks=on -O -// build-fail - #![feature(rustc_attrs)] fn black_box(_: T) { diff --git a/tests/ui/consts/const-eval/index-out-of-bounds-never-type.rs b/tests/ui/consts/const-eval/index-out-of-bounds-never-type.rs index bc2ea3f18faf2..64a2d047f13a8 100644 --- a/tests/ui/consts/const-eval/index-out-of-bounds-never-type.rs +++ b/tests/ui/consts/const-eval/index-out-of-bounds-never-type.rs @@ -1,5 +1,3 @@ -// build-fail - // Regression test for #66975 #![warn(unconditional_panic)] #![feature(never_type)] @@ -7,9 +5,10 @@ struct PrintName(T); impl PrintName { - const VOID: ! = { let x = 0 * std::mem::size_of::(); [][x] }; - //~^ ERROR evaluation of `PrintName::<()>::VOID` failed - + const VOID: ! = { + let x = 0 * std::mem::size_of::(); + [][x] //~ ERROR evaluation of `PrintName::<()>::VOID` failed + }; } fn f() { diff --git a/tests/ui/consts/const-eval/index-out-of-bounds-never-type.stderr b/tests/ui/consts/const-eval/index-out-of-bounds-never-type.stderr index 8bcd030059819..81f926b437dd8 100644 --- a/tests/ui/consts/const-eval/index-out-of-bounds-never-type.stderr +++ b/tests/ui/consts/const-eval/index-out-of-bounds-never-type.stderr @@ -1,11 +1,11 @@ error[E0080]: evaluation of `PrintName::<()>::VOID` failed - --> $DIR/index-out-of-bounds-never-type.rs:10:61 + --> $DIR/index-out-of-bounds-never-type.rs:10:9 | -LL | const VOID: ! = { let x = 0 * std::mem::size_of::(); [][x] }; - | ^^^^^ index out of bounds: the length is 0 but the index is 0 +LL | [][x] + | ^^^^^ index out of bounds: the length is 0 but the index is 0 note: the above error was encountered while instantiating `fn f::<()>` - --> $DIR/index-out-of-bounds-never-type.rs:20:5 + --> $DIR/index-out-of-bounds-never-type.rs:19:5 | LL | f::<()>(); | ^^^^^^^^^ diff --git a/tests/ui/consts/const-eval/index_out_of_bounds_propagated.rs b/tests/ui/consts/const-eval/index_out_of_bounds_propagated.rs index 608e6e112a10b..f30ad6bb6375a 100644 --- a/tests/ui/consts/const-eval/index_out_of_bounds_propagated.rs +++ b/tests/ui/consts/const-eval/index_out_of_bounds_propagated.rs @@ -1,5 +1,3 @@ -// build-fail - fn main() { let array = [std::env::args().len()]; array[1]; //~ ERROR operation will panic diff --git a/tests/ui/consts/const-eval/index_out_of_bounds_propagated.stderr b/tests/ui/consts/const-eval/index_out_of_bounds_propagated.stderr index d247d691dbb1b..ce54d4e6fa804 100644 --- a/tests/ui/consts/const-eval/index_out_of_bounds_propagated.stderr +++ b/tests/ui/consts/const-eval/index_out_of_bounds_propagated.stderr @@ -1,5 +1,5 @@ error: this operation will panic at runtime - --> $DIR/index_out_of_bounds_propagated.rs:5:5 + --> $DIR/index_out_of_bounds_propagated.rs:3:5 | LL | array[1]; | ^^^^^^^^ index out of bounds: the length is 1 but the index is 1 diff --git a/tests/ui/consts/const-eval/issue-44578.rs b/tests/ui/consts/const-eval/issue-44578.rs index e4dcc62302caa..65c95ad65e3a4 100644 --- a/tests/ui/consts/const-eval/issue-44578.rs +++ b/tests/ui/consts/const-eval/issue-44578.rs @@ -1,5 +1,3 @@ -// build-fail - trait Foo { const AMT: usize; } diff --git a/tests/ui/consts/const-eval/issue-44578.stderr b/tests/ui/consts/const-eval/issue-44578.stderr index 0cbf5448000ae..cc964703b63c0 100644 --- a/tests/ui/consts/const-eval/issue-44578.stderr +++ b/tests/ui/consts/const-eval/issue-44578.stderr @@ -1,17 +1,17 @@ error[E0080]: evaluation of ` as Foo>::AMT` failed - --> $DIR/issue-44578.rs:13:24 + --> $DIR/issue-44578.rs:11:24 | LL | const AMT: usize = [A::AMT][(A::AMT > B::AMT) as usize]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ index out of bounds: the length is 1 but the index is 1 note: erroneous constant used - --> $DIR/issue-44578.rs:25:20 + --> $DIR/issue-44578.rs:23:20 | LL | println!("{}", as Foo>::AMT); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ note: erroneous constant used - --> $DIR/issue-44578.rs:25:20 + --> $DIR/issue-44578.rs:23:20 | LL | println!("{}", as Foo>::AMT); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -19,15 +19,7 @@ LL | println!("{}", as Foo>::AMT); = note: this note originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) note: erroneous constant used - --> $DIR/issue-44578.rs:25:20 - | -LL | println!("{}", as Foo>::AMT); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: this note originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) - -note: erroneous constant used - --> $DIR/issue-44578.rs:25:20 + --> $DIR/issue-44578.rs:23:20 | LL | println!("{}", as Foo>::AMT); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/consts/const-eval/issue-50814-2.rs b/tests/ui/consts/const-eval/issue-50814-2.rs index 53eb7b149f931..9acca24f6b056 100644 --- a/tests/ui/consts/const-eval/issue-50814-2.rs +++ b/tests/ui/consts/const-eval/issue-50814-2.rs @@ -1,5 +1,3 @@ -// build-fail - trait C { const BOO: usize; } diff --git a/tests/ui/consts/const-eval/issue-50814-2.stderr b/tests/ui/consts/const-eval/issue-50814-2.stderr index 956f7aec9da8f..b3389465aab42 100644 --- a/tests/ui/consts/const-eval/issue-50814-2.stderr +++ b/tests/ui/consts/const-eval/issue-50814-2.stderr @@ -1,17 +1,17 @@ error[E0080]: evaluation of ` as Foo<()>>::BAR` failed - --> $DIR/issue-50814-2.rs:14:24 + --> $DIR/issue-50814-2.rs:12:24 | LL | const BAR: usize = [5, 6, 7][T::BOO]; | ^^^^^^^^^^^^^^^^^ index out of bounds: the length is 3 but the index is 42 note: erroneous constant used - --> $DIR/issue-50814-2.rs:18:6 + --> $DIR/issue-50814-2.rs:16:6 | LL | & as Foo>::BAR | ^^^^^^^^^^^^^^^^^^^^^ note: the above error was encountered while instantiating `fn foo::<()>` - --> $DIR/issue-50814-2.rs:30:22 + --> $DIR/issue-50814-2.rs:28:22 | LL | println!("{:x}", foo::<()>() as *const usize as usize); | ^^^^^^^^^^^ diff --git a/tests/ui/consts/const-eval/issue-50814.rs b/tests/ui/consts/const-eval/issue-50814.rs index 374ed1d93df94..3ee15131019de 100644 --- a/tests/ui/consts/const-eval/issue-50814.rs +++ b/tests/ui/consts/const-eval/issue-50814.rs @@ -1,5 +1,3 @@ -// build-fail - trait Unsigned { const MAX: u8; } diff --git a/tests/ui/consts/const-eval/issue-50814.stderr b/tests/ui/consts/const-eval/issue-50814.stderr index 05b6271f4e4d5..40ed3e10ff63b 100644 --- a/tests/ui/consts/const-eval/issue-50814.stderr +++ b/tests/ui/consts/const-eval/issue-50814.stderr @@ -1,17 +1,17 @@ error[E0080]: evaluation of ` as Unsigned>::MAX` failed - --> $DIR/issue-50814.rs:15:21 + --> $DIR/issue-50814.rs:13:21 | LL | const MAX: u8 = A::MAX + B::MAX; | ^^^^^^^^^^^^^^^ attempt to compute `u8::MAX + u8::MAX`, which would overflow note: erroneous constant used - --> $DIR/issue-50814.rs:20:6 + --> $DIR/issue-50814.rs:18:6 | LL | &Sum::::MAX | ^^^^^^^^^^^^^^^^^^ note: the above error was encountered while instantiating `fn foo::` - --> $DIR/issue-50814.rs:25:5 + --> $DIR/issue-50814.rs:23:5 | LL | foo(0); | ^^^^^^ diff --git a/tests/ui/consts/const-eval/issue-85155.rs b/tests/ui/consts/const-eval/issue-85155.rs index c3216d53d0554..aded2d167a014 100644 --- a/tests/ui/consts/const-eval/issue-85155.rs +++ b/tests/ui/consts/const-eval/issue-85155.rs @@ -9,8 +9,6 @@ // depending on the const argument value, like the `stdarch` intrinsics would. // // aux-build: post_monomorphization_error.rs -// build-fail: this is a post-monomorphization error, it passes check runs and requires building -// to actually fail. extern crate post_monomorphization_error; diff --git a/tests/ui/consts/const-eval/issue-85155.stderr b/tests/ui/consts/const-eval/issue-85155.stderr index 3d2c76b7ed040..5ebb9d68ce57c 100644 --- a/tests/ui/consts/const-eval/issue-85155.stderr +++ b/tests/ui/consts/const-eval/issue-85155.stderr @@ -5,7 +5,7 @@ LL | let _ = 1 / ((IMM >= MIN && IMM <= MAX) as usize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to divide `1_usize` by zero note: the above error was encountered while instantiating `fn post_monomorphization_error::stdarch_intrinsic::<2>` - --> $DIR/issue-85155.rs:19:5 + --> $DIR/issue-85155.rs:17:5 | LL | post_monomorphization_error::stdarch_intrinsic::<2>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/consts/const-eval/panic-assoc-never-type.rs b/tests/ui/consts/const-eval/panic-assoc-never-type.rs index 28edf51440233..54c27543de296 100644 --- a/tests/ui/consts/const-eval/panic-assoc-never-type.rs +++ b/tests/ui/consts/const-eval/panic-assoc-never-type.rs @@ -1,5 +1,3 @@ -// build-fail - // Regression test for #66975 #![feature(never_type)] diff --git a/tests/ui/consts/const-eval/panic-assoc-never-type.stderr b/tests/ui/consts/const-eval/panic-assoc-never-type.stderr index 7c36a3a426e9e..b5537335e7ba0 100644 --- a/tests/ui/consts/const-eval/panic-assoc-never-type.stderr +++ b/tests/ui/consts/const-eval/panic-assoc-never-type.stderr @@ -1,19 +1,19 @@ error[E0080]: evaluation of constant value failed - --> $DIR/panic-assoc-never-type.rs:9:21 + --> $DIR/panic-assoc-never-type.rs:7:21 | LL | const VOID: ! = panic!(); - | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/panic-assoc-never-type.rs:9:21 + | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/panic-assoc-never-type.rs:7:21 | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) note: erroneous constant used - --> $DIR/panic-assoc-never-type.rs:14:13 + --> $DIR/panic-assoc-never-type.rs:12:13 | LL | let _ = PrintName::VOID; | ^^^^^^^^^^^^^^^ note: erroneous constant used - --> $DIR/panic-assoc-never-type.rs:14:13 + --> $DIR/panic-assoc-never-type.rs:12:13 | LL | let _ = PrintName::VOID; | ^^^^^^^^^^^^^^^ diff --git a/tests/ui/consts/const-prop-ice.rs b/tests/ui/consts/const-prop-ice.rs index 5bffe0206294d..1a904c6048815 100644 --- a/tests/ui/consts/const-prop-ice.rs +++ b/tests/ui/consts/const-prop-ice.rs @@ -1,5 +1,3 @@ -// build-fail - fn main() { [0; 3][3u64 as usize]; //~ ERROR this operation will panic at runtime } diff --git a/tests/ui/consts/const-prop-ice.stderr b/tests/ui/consts/const-prop-ice.stderr index 3bcf2b2de7bd7..cf23ad5eba2cd 100644 --- a/tests/ui/consts/const-prop-ice.stderr +++ b/tests/ui/consts/const-prop-ice.stderr @@ -1,5 +1,5 @@ error: this operation will panic at runtime - --> $DIR/const-prop-ice.rs:4:5 + --> $DIR/const-prop-ice.rs:2:5 | LL | [0; 3][3u64 as usize]; | ^^^^^^^^^^^^^^^^^^^^^ index out of bounds: the length is 3 but the index is 3 diff --git a/tests/ui/consts/const-prop-ice2.rs b/tests/ui/consts/const-prop-ice2.rs index d533e394c06fb..dc4f379873335 100644 --- a/tests/ui/consts/const-prop-ice2.rs +++ b/tests/ui/consts/const-prop-ice2.rs @@ -1,7 +1,7 @@ -// build-fail - fn main() { - enum Enum { One=1 } - let xs=[0;1 as usize]; + enum Enum { + One = 1, + } + let xs = [0; 1 as usize]; println!("{}", xs[Enum::One as usize]); //~ ERROR this operation will panic at runtime } diff --git a/tests/ui/consts/invalid-union.64bit.stderr b/tests/ui/consts/invalid-union.64bit.stderr index 07f36ee283264..84229e3688c83 100644 --- a/tests/ui/consts/invalid-union.64bit.stderr +++ b/tests/ui/consts/invalid-union.64bit.stderr @@ -1,5 +1,5 @@ error[E0080]: it is undefined behavior to use this value - --> $DIR/invalid-union.rs:41:1 + --> $DIR/invalid-union.rs:40:1 | LL | fn main() { | ^^^^^^^^^ constructing invalid value at ..y..0: encountered `UnsafeCell` in a `const` diff --git a/tests/ui/consts/invalid-union.rs b/tests/ui/consts/invalid-union.rs index 28706b4a923e7..6738d5457e858 100644 --- a/tests/ui/consts/invalid-union.rs +++ b/tests/ui/consts/invalid-union.rs @@ -6,7 +6,6 @@ // If for some reason this approach no longer works, it is should be fine to // remove the test case. // -// build-fail // stderr-per-bitwidth #![feature(const_mut_refs)] @@ -22,7 +21,7 @@ struct S { #[repr(u32)] enum E { A, - B(U) + B(U), } union U { @@ -38,7 +37,8 @@ const C: S = { s }; -fn main() { //~ ERROR it is undefined behavior to use this value +fn main() { + //~^ ERROR it is undefined behavior to use this value // FIXME the span here is wrong, sould be pointing at the line below, not above. let _: &'static _ = &C; } diff --git a/tests/ui/consts/issue-54348.rs b/tests/ui/consts/issue-54348.rs index 5c38d7c42f6b2..0c2edfb0db6b1 100644 --- a/tests/ui/consts/issue-54348.rs +++ b/tests/ui/consts/issue-54348.rs @@ -1,5 +1,3 @@ -// build-fail - fn main() { [1][0u64 as usize]; [1][1.5 as usize]; //~ ERROR operation will panic diff --git a/tests/ui/consts/issue-54348.stderr b/tests/ui/consts/issue-54348.stderr index eb85f349843c4..50f606eb98fd5 100644 --- a/tests/ui/consts/issue-54348.stderr +++ b/tests/ui/consts/issue-54348.stderr @@ -1,5 +1,5 @@ error: this operation will panic at runtime - --> $DIR/issue-54348.rs:5:5 + --> $DIR/issue-54348.rs:3:5 | LL | [1][1.5 as usize]; | ^^^^^^^^^^^^^^^^^ index out of bounds: the length is 1 but the index is 1 @@ -7,7 +7,7 @@ LL | [1][1.5 as usize]; = note: `#[deny(unconditional_panic)]` on by default error: this operation will panic at runtime - --> $DIR/issue-54348.rs:6:5 + --> $DIR/issue-54348.rs:4:5 | LL | [1][1u64 as usize]; | ^^^^^^^^^^^^^^^^^^ index out of bounds: the length is 1 but the index is 1 diff --git a/tests/ui/consts/miri_unleashed/assoc_const.rs b/tests/ui/consts/miri_unleashed/assoc_const.rs index 7bb0c1b772ad1..d22bf3fd3d826 100644 --- a/tests/ui/consts/miri_unleashed/assoc_const.rs +++ b/tests/ui/consts/miri_unleashed/assoc_const.rs @@ -1,4 +1,3 @@ -// build-fail // compile-flags: -Zunleash-the-miri-inside-of-you // a test demonstrating why we do need to run static const qualification on associated constants diff --git a/tests/ui/consts/miri_unleashed/assoc_const.stderr b/tests/ui/consts/miri_unleashed/assoc_const.stderr index e1da43c3aea41..f66416afe67fa 100644 --- a/tests/ui/consts/miri_unleashed/assoc_const.stderr +++ b/tests/ui/consts/miri_unleashed/assoc_const.stderr @@ -8,25 +8,19 @@ note: inside `std::ptr::drop_in_place::> - shim(Some(Vec))` note: inside `std::ptr::drop_in_place::<(Vec, u32)> - shim(Some((Vec, u32)))` --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL note: inside `, String>>::F` - --> $DIR/assoc_const.rs:12:31 + --> $DIR/assoc_const.rs:11:31 | LL | const F: u32 = (U::X, 42).1; | ^ note: erroneous constant used - --> $DIR/assoc_const.rs:29:13 + --> $DIR/assoc_const.rs:28:13 | LL | let y = , String>>::F; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: erroneous constant used - --> $DIR/assoc_const.rs:29:13 - | -LL | let y = , String>>::F; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -note: erroneous constant used - --> $DIR/assoc_const.rs:29:13 + --> $DIR/assoc_const.rs:28:13 | LL | let y = , String>>::F; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -34,7 +28,7 @@ LL | let y = , String>>::F; warning: skipping const checks | help: skipping check that does not even have a feature gate - --> $DIR/assoc_const.rs:12:20 + --> $DIR/assoc_const.rs:11:20 | LL | const F: u32 = (U::X, 42).1; | ^^^^^^^^^^ diff --git a/tests/ui/consts/miri_unleashed/assoc_const_2.rs b/tests/ui/consts/miri_unleashed/assoc_const_2.rs index aad5b34606ee3..8e0ac6277f8f9 100644 --- a/tests/ui/consts/miri_unleashed/assoc_const_2.rs +++ b/tests/ui/consts/miri_unleashed/assoc_const_2.rs @@ -1,5 +1,3 @@ -// build-fail - // a test demonstrating that const qualification cannot prevent monomorphization time errors trait Foo { diff --git a/tests/ui/consts/miri_unleashed/assoc_const_2.stderr b/tests/ui/consts/miri_unleashed/assoc_const_2.stderr index fc4b18056da5b..5f6a138d225d9 100644 --- a/tests/ui/consts/miri_unleashed/assoc_const_2.stderr +++ b/tests/ui/consts/miri_unleashed/assoc_const_2.stderr @@ -1,23 +1,17 @@ error[E0080]: evaluation of `>::F` failed - --> $DIR/assoc_const_2.rs:10:20 + --> $DIR/assoc_const_2.rs:8:20 | LL | const F: u32 = 100 / U::X; | ^^^^^^^^^^ attempt to divide `100_u32` by zero note: erroneous constant used - --> $DIR/assoc_const_2.rs:27:13 + --> $DIR/assoc_const_2.rs:25:13 | LL | let y = >::F; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ note: erroneous constant used - --> $DIR/assoc_const_2.rs:27:13 - | -LL | let y = >::F; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - -note: erroneous constant used - --> $DIR/assoc_const_2.rs:27:13 + --> $DIR/assoc_const_2.rs:25:13 | LL | let y = >::F; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/consts/uninhabited-const-issue-61744.rs b/tests/ui/consts/uninhabited-const-issue-61744.rs index ca6449cce30d5..8ffca758e49db 100644 --- a/tests/ui/consts/uninhabited-const-issue-61744.rs +++ b/tests/ui/consts/uninhabited-const-issue-61744.rs @@ -1,5 +1,3 @@ -// build-fail - pub const unsafe fn fake_type() -> T { hint_unreachable() //~ ERROR evaluation of `::CONSTANT` failed } diff --git a/tests/ui/consts/uninhabited-const-issue-61744.stderr b/tests/ui/consts/uninhabited-const-issue-61744.stderr index 3a94e19313f6c..e7ed09a79e3fd 100644 --- a/tests/ui/consts/uninhabited-const-issue-61744.stderr +++ b/tests/ui/consts/uninhabited-const-issue-61744.stderr @@ -1,664 +1,658 @@ error[E0080]: evaluation of `::CONSTANT` failed - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ reached the configured maximum number of stack frames | note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `hint_unreachable` - --> $DIR/uninhabited-const-issue-61744.rs:8:5 + --> $DIR/uninhabited-const-issue-61744.rs:6:5 | LL | fake_type() | ^^^^^^^^^^^ note: inside `fake_type::` - --> $DIR/uninhabited-const-issue-61744.rs:4:5 + --> $DIR/uninhabited-const-issue-61744.rs:2:5 | LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ note: inside `::CONSTANT` - --> $DIR/uninhabited-const-issue-61744.rs:12:36 + --> $DIR/uninhabited-const-issue-61744.rs:10:36 | LL | const CONSTANT: i32 = unsafe { fake_type() }; | ^^^^^^^^^^^ note: erroneous constant used - --> $DIR/uninhabited-const-issue-61744.rs:18:10 + --> $DIR/uninhabited-const-issue-61744.rs:16:10 | LL | dbg!(i32::CONSTANT); | ^^^^^^^^^^^^^ note: erroneous constant used - --> $DIR/uninhabited-const-issue-61744.rs:18:10 - | -LL | dbg!(i32::CONSTANT); - | ^^^^^^^^^^^^^ - -note: erroneous constant used - --> $DIR/uninhabited-const-issue-61744.rs:18:10 + --> $DIR/uninhabited-const-issue-61744.rs:16:10 | LL | dbg!(i32::CONSTANT); | ^^^^^^^^^^^^^ diff --git a/tests/ui/deriving/deriving-with-helper.rs b/tests/ui/deriving/deriving-with-helper.rs index 1c30b0b6fba75..6c54a78707c9c 100644 --- a/tests/ui/deriving/deriving-with-helper.rs +++ b/tests/ui/deriving/deriving-with-helper.rs @@ -5,7 +5,6 @@ #![feature(lang_items)] #![feature(no_core)] #![feature(rustc_attrs)] - #![no_core] #[rustc_builtin_macro] @@ -26,6 +25,15 @@ mod default { } } +#[lang = "drop_in_place"] +#[allow(unconditional_recursion)] +pub unsafe fn drop_in_place(to_drop: *mut T) { + drop_in_place(to_drop); +} + +#[lang = "copy"] +trait Copy {} + #[lang = "sized"] trait Sized {} diff --git a/tests/ui/duplicate/dupe-symbols-6.rs b/tests/ui/duplicate/dupe-symbols-6.rs index 018f4bb7f07bf..19315acd4876b 100644 --- a/tests/ui/duplicate/dupe-symbols-6.rs +++ b/tests/ui/duplicate/dupe-symbols-6.rs @@ -1,11 +1,11 @@ // build-fail -#![crate_type="rlib"] +#![crate_type = "rlib"] #![allow(warnings)] -#[export_name="fail"] +#[export_name = "fail"] static HELLO: u8 = 0; -#[export_name="fail"] +#[export_name = "fail"] static HELLO_TWICE: u16 = 0; //~^ symbol `fail` is already defined diff --git a/tests/ui/dyn-star/align.normal.stderr b/tests/ui/dyn-star/align.normal.stderr index 53c2cbeac3269..2bd9b129bff4d 100644 --- a/tests/ui/dyn-star/align.normal.stderr +++ b/tests/ui/dyn-star/align.normal.stderr @@ -1,11 +1,30 @@ warning: the feature `dyn_star` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/align.rs:4:12 + --> $DIR/align.rs:9:12 | LL | #![feature(dyn_star)] | ^^^^^^^^ | - = note: see issue #102425 for more information - = note: `#[warn(incomplete_features)]` on by default + = + = -warning: 1 warning emitted +error: internal compiler error: $COMPILER_DIR/rustc_const_eval/src/interpret/operand.rs:389:13: primitive read not possible for type: AlignedUsize + --> $DIR/align.rs:21:13 + | +LL | let x = AlignedUsize(12) as dyn* Debug; + | ^^^^^^^^^^^^^^^^ + + +stack backtrace: + + + + + + + +query stack during panic: +#0 [mir_drops_elaborated_and_const_checked] elaborating drops for `main` +#1 [collect_crate_mono_items_for_check] monomorphize the crate graph +end of query stack +error: aborting due to previous error; 1 warning emitted diff --git a/tests/ui/dyn-star/align.over_aligned.stderr b/tests/ui/dyn-star/align.over_aligned.stderr index 0365d87a6f82a..dc7d2a57f80c1 100644 --- a/tests/ui/dyn-star/align.over_aligned.stderr +++ b/tests/ui/dyn-star/align.over_aligned.stderr @@ -1,5 +1,5 @@ warning: the feature `dyn_star` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/align.rs:4:12 + --> $DIR/align.rs:9:12 | LL | #![feature(dyn_star)] | ^^^^^^^^ @@ -8,7 +8,7 @@ LL | #![feature(dyn_star)] = note: `#[warn(incomplete_features)]` on by default error[E0277]: `AlignedUsize` needs to have the same alignment and size as a pointer - --> $DIR/align.rs:15:13 + --> $DIR/align.rs:21:13 | LL | let x = AlignedUsize(12) as dyn* Debug; | ^^^^^^^^^^^^^^^^ `AlignedUsize` needs to be a pointer-like type diff --git a/tests/ui/dyn-star/align.rs b/tests/ui/dyn-star/align.rs index 6679997a94029..c5cf7f9244dfc 100644 --- a/tests/ui/dyn-star/align.rs +++ b/tests/ui/dyn-star/align.rs @@ -1,17 +1,24 @@ // revisions: normal over_aligned -//[normal] check-pass +//[normal] failure-status: 101 +//[normal] unset-rustc-env:RUST_BACKTRACE +//[normal] normalize-stderr-test "note: .*" -> "" +//[normal] normalize-stderr-test "thread 'rustc' .*" -> "" +//[normal] normalize-stderr-test " +[0-9]+:.*\n" -> "" +//[normal] normalize-stderr-test " +at .*\n" -> "" #![feature(dyn_star)] //~^ WARN the feature `dyn_star` is incomplete and may not be safe to use and/or cause compiler crashes use std::fmt::Debug; -#[cfg_attr(over_aligned, repr(C, align(1024)))] +#[cfg_attr(over_aligned, repr(C, align(1024)))] #[cfg_attr(not(over_aligned), repr(C))] #[derive(Debug)] struct AlignedUsize(usize); +#[rustfmt::skip] fn main() { let x = AlignedUsize(12) as dyn* Debug; //[over_aligned]~^ ERROR `AlignedUsize` needs to have the same alignment and size as a pointer + //[normal]~^^ ERROR primitive read not possible for type: AlignedUsize } diff --git a/tests/ui/dyn-star/dyn-async-trait.rs b/tests/ui/dyn-star/dyn-async-trait.rs index 9b27133b4936d..9f6e6b028f2e1 100644 --- a/tests/ui/dyn-star/dyn-async-trait.rs +++ b/tests/ui/dyn-star/dyn-async-trait.rs @@ -1,4 +1,3 @@ -// check-pass // edition: 2021 // This test case is meant to demonstrate how close we can get to async @@ -10,7 +9,8 @@ use std::future::Future; trait DynAsyncCounter { - fn increment<'a>(&'a mut self) -> dyn* Future + 'a; + fn increment<'a>(&'a mut self) -> Future + 'a; + //~^ ERROR: trait objects must include the `dyn` keyword } struct MyCounter { @@ -18,7 +18,8 @@ struct MyCounter { } impl DynAsyncCounter for MyCounter { - fn increment<'a>(&'a mut self) -> dyn* Future + 'a { + fn increment<'a>(&'a mut self) -> Future + 'a { + //~^ ERROR: trait objects must include the `dyn` keyword Box::pin(async { self.count += 1; self.count diff --git a/tests/ui/dyn-star/dyn-async-trait.stderr b/tests/ui/dyn-star/dyn-async-trait.stderr new file mode 100644 index 0000000000000..7b5dbd5826414 --- /dev/null +++ b/tests/ui/dyn-star/dyn-async-trait.stderr @@ -0,0 +1,25 @@ +error[E0782]: trait objects must include the `dyn` keyword + --> $DIR/dyn-async-trait.rs:12:39 + | +LL | fn increment<'a>(&'a mut self) -> Future + 'a; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: add `dyn` keyword before this trait + | +LL | fn increment<'a>(&'a mut self) -> dyn Future + 'a; + | +++ + +error[E0782]: trait objects must include the `dyn` keyword + --> $DIR/dyn-async-trait.rs:21:39 + | +LL | fn increment<'a>(&'a mut self) -> Future + 'a { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: add `dyn` keyword before this trait + | +LL | fn increment<'a>(&'a mut self) -> dyn Future + 'a { + | +++ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0782`. diff --git a/tests/ui/generator/auto-trait-regions.stderr b/tests/ui/generator/auto-trait-regions.stderr deleted file mode 100644 index 165748d44305a..0000000000000 --- a/tests/ui/generator/auto-trait-regions.stderr +++ /dev/null @@ -1,47 +0,0 @@ -error[E0716]: temporary value dropped while borrowed - --> $DIR/auto-trait-regions.rs:48:24 - | -LL | let a = A(&mut true, &mut true, No); - | ^^^^ - temporary value is freed at the end of this statement - | | - | creates a temporary value which is freed while still in use -... -LL | assert_foo(a); - | - borrow later used here - | - = note: consider using a `let` binding to create a longer lived value - -error[E0716]: temporary value dropped while borrowed - --> $DIR/auto-trait-regions.rs:48:35 - | -LL | let a = A(&mut true, &mut true, No); - | ^^^^ - temporary value is freed at the end of this statement - | | - | creates a temporary value which is freed while still in use -... -LL | assert_foo(a); - | - borrow later used here - | - = note: consider using a `let` binding to create a longer lived value - -error: implementation of `Foo` is not general enough - --> $DIR/auto-trait-regions.rs:34:5 - | -LL | assert_foo(gen); - | ^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough - | - = note: `&'0 OnlyFooIfStaticRef` must implement `Foo`, for any lifetime `'0`... - = note: ...but `Foo` is actually implemented for the type `&'static OnlyFooIfStaticRef` - -error: implementation of `Foo` is not general enough - --> $DIR/auto-trait-regions.rs:54:5 - | -LL | assert_foo(gen); - | ^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough - | - = note: `Foo` would have to be implemented for the type `A<'0, '1>`, for any two lifetimes `'0` and `'1`... - = note: ...but `Foo` is actually implemented for the type `A<'_, '2>`, for some specific lifetime `'2` - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0716`. diff --git a/tests/ui/generator/metadata-sufficient-for-layout.rs b/tests/ui/generator/metadata-sufficient-for-layout.rs index d0e648ee775fa..1a70a0ad38021 100644 --- a/tests/ui/generator/metadata-sufficient-for-layout.rs +++ b/tests/ui/generator/metadata-sufficient-for-layout.rs @@ -4,8 +4,9 @@ // Regression test for #80998. // // aux-build:metadata-sufficient-for-layout.rs +// check-pass -#![feature(type_alias_impl_trait, rustc_attrs)] +#![feature(type_alias_impl_trait)] #![feature(generator_trait)] extern crate metadata_sufficient_for_layout; @@ -21,5 +22,4 @@ fn f() -> F { metadata_sufficient_for_layout::g() } -#[rustc_error] -fn main() {} //~ ERROR +fn main() {} diff --git a/tests/ui/generator/metadata-sufficient-for-layout.stderr b/tests/ui/generator/metadata-sufficient-for-layout.stderr deleted file mode 100644 index 3488b04f2267e..0000000000000 --- a/tests/ui/generator/metadata-sufficient-for-layout.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: fatal error triggered by #[rustc_error] - --> $DIR/metadata-sufficient-for-layout.rs:25:1 - | -LL | fn main() {} - | ^^^^^^^^^ - -error: aborting due to previous error - diff --git a/tests/ui/generics/post_monomorphization_error_backtrace.rs b/tests/ui/generics/post_monomorphization_error_backtrace.rs index 1fd9b6b3b9dba..76e0ead69cc9f 100644 --- a/tests/ui/generics/post_monomorphization_error_backtrace.rs +++ b/tests/ui/generics/post_monomorphization_error_backtrace.rs @@ -1,5 +1,3 @@ -// build-fail - fn assert_zst() { struct F(T); impl F { @@ -20,7 +18,6 @@ fn foo() { //~| NOTE: the above error was encountered while instantiating `fn assert_zst::` } - fn bar() { foo::() } diff --git a/tests/ui/generics/post_monomorphization_error_backtrace.stderr b/tests/ui/generics/post_monomorphization_error_backtrace.stderr index 0d707d83d2660..6d6d69cba222f 100644 --- a/tests/ui/generics/post_monomorphization_error_backtrace.stderr +++ b/tests/ui/generics/post_monomorphization_error_backtrace.stderr @@ -1,27 +1,27 @@ error[E0080]: evaluation of `assert_zst::F::::V` failed - --> $DIR/post_monomorphization_error_backtrace.rs:6:23 + --> $DIR/post_monomorphization_error_backtrace.rs:4:23 | LL | const V: () = assert!(std::mem::size_of::() == 0); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'assertion failed: std::mem::size_of::() == 0', $DIR/post_monomorphization_error_backtrace.rs:6:23 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'assertion failed: std::mem::size_of::() == 0', $DIR/post_monomorphization_error_backtrace.rs:4:23 | = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info) note: the above error was encountered while instantiating `fn assert_zst::` - --> $DIR/post_monomorphization_error_backtrace.rs:18:5 + --> $DIR/post_monomorphization_error_backtrace.rs:16:5 | LL | assert_zst::() | ^^^^^^^^^^^^^^^^^ error[E0080]: evaluation of `assert_zst::F::::V` failed - --> $DIR/post_monomorphization_error_backtrace.rs:6:23 + --> $DIR/post_monomorphization_error_backtrace.rs:4:23 | LL | const V: () = assert!(std::mem::size_of::() == 0); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'assertion failed: std::mem::size_of::() == 0', $DIR/post_monomorphization_error_backtrace.rs:6:23 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'assertion failed: std::mem::size_of::() == 0', $DIR/post_monomorphization_error_backtrace.rs:4:23 | = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info) note: the above error was encountered while instantiating `fn assert_zst::` - --> $DIR/post_monomorphization_error_backtrace.rs:18:5 + --> $DIR/post_monomorphization_error_backtrace.rs:16:5 | LL | assert_zst::() | ^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/infinite/infinite-instantiation.rs b/tests/ui/infinite/infinite-instantiation.rs index 9b9f332ca86de..9cc3f143a55ce 100644 --- a/tests/ui/infinite/infinite-instantiation.rs +++ b/tests/ui/infinite/infinite-instantiation.rs @@ -1,4 +1,3 @@ -// build-fail // normalize-stderr-test: ".nll/" -> "/" trait ToOpt: Sized { @@ -11,13 +10,13 @@ impl ToOpt for usize { } } -impl ToOpt for Option { +impl ToOpt for Option { fn to_option(&self) -> Option> { Some((*self).clone()) } } -fn function(counter: usize, t: T) { +fn function(counter: usize, t: T) { if counter > 0 { function(counter - 1, t.to_option()); //~^ ERROR reached the recursion limit while instantiating `function::>>>>>` - --> $DIR/infinite-instantiation.rs:22:9 + --> $DIR/infinite-instantiation.rs:21:9 | LL | function(counter - 1, t.to_option()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: `function` defined here - --> $DIR/infinite-instantiation.rs:20:1 + --> $DIR/infinite-instantiation.rs:19:1 | -LL | fn function(counter: usize, t: T) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn function(counter: usize, t: T) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: the full type name has been written to '$TEST_BUILD_DIR/infinite/infinite-instantiation/infinite-instantiation.long-type.txt' error: aborting due to previous error diff --git a/tests/ui/inline-const/const-expr-generic-err.rs b/tests/ui/inline-const/const-expr-generic-err.rs index 4e8879af54aff..ece57b87670a6 100644 --- a/tests/ui/inline-const/const-expr-generic-err.rs +++ b/tests/ui/inline-const/const-expr-generic-err.rs @@ -1,8 +1,9 @@ -// build-fail #![feature(inline_const)] fn foo() { - const { assert!(std::mem::size_of::() == 0); } //~ ERROR E0080 + const { + assert!(std::mem::size_of::() == 0); //~ ERROR E0080 + } } fn bar() -> usize { diff --git a/tests/ui/inline-const/const-expr-generic-err.stderr b/tests/ui/inline-const/const-expr-generic-err.stderr index fc0b6cc445164..0bf7449894546 100644 --- a/tests/ui/inline-const/const-expr-generic-err.stderr +++ b/tests/ui/inline-const/const-expr-generic-err.stderr @@ -1,25 +1,25 @@ error[E0080]: evaluation of `foo::::{constant#0}` failed - --> $DIR/const-expr-generic-err.rs:5:13 + --> $DIR/const-expr-generic-err.rs:5:9 | -LL | const { assert!(std::mem::size_of::() == 0); } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'assertion failed: std::mem::size_of::() == 0', $DIR/const-expr-generic-err.rs:5:13 +LL | assert!(std::mem::size_of::() == 0); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'assertion failed: std::mem::size_of::() == 0', $DIR/const-expr-generic-err.rs:5:9 | = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info) note: the above error was encountered while instantiating `fn foo::` - --> $DIR/const-expr-generic-err.rs:13:5 + --> $DIR/const-expr-generic-err.rs:14:5 | LL | foo::(); | ^^^^^^^^^^^^ error[E0080]: evaluation of `bar::<0>::{constant#0}` failed - --> $DIR/const-expr-generic-err.rs:9:13 + --> $DIR/const-expr-generic-err.rs:10:13 | LL | const { N - 1 } | ^^^^^ attempt to compute `0_usize - 1_usize`, which would overflow note: the above error was encountered while instantiating `fn bar::<0>` - --> $DIR/const-expr-generic-err.rs:14:5 + --> $DIR/const-expr-generic-err.rs:15:5 | LL | bar::<0>(); | ^^^^^^^^^^ diff --git a/tests/ui/issues/issue-22638.rs b/tests/ui/issues/issue-22638.rs index 198ceccc2c33c..ad827d46d7154 100644 --- a/tests/ui/issues/issue-22638.rs +++ b/tests/ui/issues/issue-22638.rs @@ -1,15 +1,13 @@ -// build-fail // normalize-stderr-test: "<\[closure@.+`" -> "$$CLOSURE`" // normalize-stderr-test: ".nll/" -> "/" #![allow(unused)] - #![recursion_limit = "20"] #![type_length_limit = "20000000"] #![crate_type = "rlib"] #[derive(Clone)] -struct A (B); +struct A(B); impl A { pub fn matches(&self, f: &F) { @@ -27,28 +25,24 @@ enum B { impl B { pub fn matches(&self, f: &F) { match self { - &B::Variant2(ref factor) => { - factor.matches(&|| ()) - } - _ => unreachable!("") + &B::Variant2(ref factor) => factor.matches(&|| ()), + _ => unreachable!(""), } } } #[derive(Clone)] -struct C (D); +struct C(D); impl C { pub fn matches(&self, f: &F) { let &C(ref base) = self; - base.matches(&|| { - C(base.clone()).matches(f) - }) + base.matches(&|| C(base.clone()).matches(f)) } } #[derive(Clone)] -struct D (Box); +struct D(Box); impl D { pub fn matches(&self, f: &F) { diff --git a/tests/ui/issues/issue-22638.stderr b/tests/ui/issues/issue-22638.stderr index 1caa4221f2501..9fd503f0bce02 100644 --- a/tests/ui/issues/issue-22638.stderr +++ b/tests/ui/issues/issue-22638.stderr @@ -1,11 +1,11 @@ error: reached the recursion limit while instantiating `A::matches::$CLOSURE` - --> $DIR/issue-22638.rs:56:9 + --> $DIR/issue-22638.rs:50:9 | LL | a.matches(f) | ^^^^^^^^^^^^ | note: `A::matches` defined here - --> $DIR/issue-22638.rs:15:5 + --> $DIR/issue-22638.rs:13:5 | LL | pub fn matches(&self, f: &F) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/issues/issue-37311-type-length-limit/issue-37311.rs b/tests/ui/issues/issue-37311-type-length-limit/issue-37311.rs index 50d1f166c9865..ea6e97af1d51f 100644 --- a/tests/ui/issues/issue-37311-type-length-limit/issue-37311.rs +++ b/tests/ui/issues/issue-37311-type-length-limit/issue-37311.rs @@ -1,11 +1,12 @@ -// build-fail // normalize-stderr-test: ".nll/" -> "/" trait Mirror { type Image; } -impl Mirror for T { type Image = T; } +impl Mirror for T { + type Image = T; +} trait Foo { fn recurse(&self); diff --git a/tests/ui/issues/issue-37311-type-length-limit/issue-37311.stderr b/tests/ui/issues/issue-37311-type-length-limit/issue-37311.stderr index 5b8299fe839d7..87832dd29b284 100644 --- a/tests/ui/issues/issue-37311-type-length-limit/issue-37311.stderr +++ b/tests/ui/issues/issue-37311-type-length-limit/issue-37311.stderr @@ -1,11 +1,11 @@ error: reached the recursion limit while instantiating `<(&(&(..., ...), ...), ...) as Foo>::recurse` - --> $DIR/issue-37311.rs:17:9 + --> $DIR/issue-37311.rs:18:9 | LL | (self, self).recurse(); | ^^^^^^^^^^^^^^^^^^^^^^ | note: `::recurse` defined here - --> $DIR/issue-37311.rs:16:5 + --> $DIR/issue-37311.rs:17:5 | LL | fn recurse(&self) { | ^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/issues/issue-67552.rs b/tests/ui/issues/issue-67552.rs index ec1997ccd5d66..2a8d619ed9bd8 100644 --- a/tests/ui/issues/issue-67552.rs +++ b/tests/ui/issues/issue-67552.rs @@ -1,4 +1,3 @@ -// build-fail // compile-flags: -Copt-level=0 // normalize-stderr-test: ".nll/" -> "/" diff --git a/tests/ui/issues/issue-67552.stderr b/tests/ui/issues/issue-67552.stderr index 4746f918bf8dd..b42667fbee5ff 100644 --- a/tests/ui/issues/issue-67552.stderr +++ b/tests/ui/issues/issue-67552.stderr @@ -1,11 +1,11 @@ error: reached the recursion limit while instantiating `rec::<&mut &mut &mut &mut &mut ...>` - --> $DIR/issue-67552.rs:29:9 + --> $DIR/issue-67552.rs:28:9 | LL | rec(identity(&mut it)) | ^^^^^^^^^^^^^^^^^^^^^^ | note: `rec` defined here - --> $DIR/issue-67552.rs:22:1 + --> $DIR/issue-67552.rs:21:1 | LL | / fn rec(mut it: T) LL | | where diff --git a/tests/ui/issues/issue-8727.rs b/tests/ui/issues/issue-8727.rs index a9b8126618fe5..ad1ea000beb57 100644 --- a/tests/ui/issues/issue-8727.rs +++ b/tests/ui/issues/issue-8727.rs @@ -1,16 +1,15 @@ // Verify the compiler fails with an error on infinite function // recursions. -// build-fail // normalize-stderr-test: ".nll/" -> "/" -fn generic() { //~ WARN function cannot return without recursing +fn generic() { + //~^ WARN function cannot return without recursing generic::>(); } //~^^ ERROR reached the recursion limit while instantiating `generic:: at least once to trigger instantiation. generic::(); } diff --git a/tests/ui/issues/issue-8727.stderr b/tests/ui/issues/issue-8727.stderr index 22332b357231b..2c707062b72b7 100644 --- a/tests/ui/issues/issue-8727.stderr +++ b/tests/ui/issues/issue-8727.stderr @@ -1,8 +1,9 @@ warning: function cannot return without recursing - --> $DIR/issue-8727.rs:7:1 + --> $DIR/issue-8727.rs:6:1 | LL | fn generic() { | ^^^^^^^^^^^^^^^ cannot return without recursing +LL | LL | generic::>(); | ---------------------- recursive call site | @@ -16,7 +17,7 @@ LL | generic::>(); | ^^^^^^^^^^^^^^^^^^^^^^ | note: `generic` defined here - --> $DIR/issue-8727.rs:7:1 + --> $DIR/issue-8727.rs:6:1 | LL | fn generic() { | ^^^^^^^^^^^^^^^ diff --git a/tests/ui/lang-items/required-lang-item.rs b/tests/ui/lang-items/required-lang-item.rs index 3b17c5b72551d..c4f47f7af801e 100644 --- a/tests/ui/lang-items/required-lang-item.rs +++ b/tests/ui/lang-items/required-lang-item.rs @@ -1,10 +1,10 @@ -// build-fail - #![feature(lang_items, no_core)] #![no_core] -#[lang="copy"] pub trait Copy { } -#[lang="sized"] pub trait Sized { } +#[lang = "copy"] +pub trait Copy {} +#[lang = "sized"] +pub trait Sized {} // error-pattern:requires `start` lang_item diff --git a/tests/ui/limits/issue-55878.rs b/tests/ui/limits/issue-55878.rs index c1c54646db871..fee664caa1783 100644 --- a/tests/ui/limits/issue-55878.rs +++ b/tests/ui/limits/issue-55878.rs @@ -1,4 +1,3 @@ -// build-fail // normalize-stderr-64bit "18446744073709551615" -> "SIZE" // normalize-stderr-32bit "4294967295" -> "SIZE" diff --git a/tests/ui/limits/issue-55878.stderr b/tests/ui/limits/issue-55878.stderr index 99f1fdf755aa2..c4f3e7a998427 100644 --- a/tests/ui/limits/issue-55878.stderr +++ b/tests/ui/limits/issue-55878.stderr @@ -4,13 +4,13 @@ error[E0080]: values of the type `[u8; usize::MAX]` are too big for the current note: inside `std::mem::size_of::<[u8; usize::MAX]>` --> $SRC_DIR/core/src/mem/mod.rs:LL:COL note: inside `main` - --> $DIR/issue-55878.rs:7:26 + --> $DIR/issue-55878.rs:6:26 | LL | println!("Size: {}", std::mem::size_of::<[u8; u64::MAX as usize]>()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: erroneous constant used - --> $DIR/issue-55878.rs:7:26 + --> $DIR/issue-55878.rs:6:26 | LL | println!("Size: {}", std::mem::size_of::<[u8; u64::MAX as usize]>()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -18,15 +18,7 @@ LL | println!("Size: {}", std::mem::size_of::<[u8; u64::MAX as usize]>()); = note: this note originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) note: erroneous constant used - --> $DIR/issue-55878.rs:7:26 - | -LL | println!("Size: {}", std::mem::size_of::<[u8; u64::MAX as usize]>()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: this note originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) - -note: erroneous constant used - --> $DIR/issue-55878.rs:7:26 + --> $DIR/issue-55878.rs:6:26 | LL | println!("Size: {}", std::mem::size_of::<[u8; u64::MAX as usize]>()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/mir/mir_detects_invalid_ops.rs b/tests/ui/mir/mir_detects_invalid_ops.rs index 136c03cd9f1bc..ca0fc7cf7582b 100644 --- a/tests/ui/mir/mir_detects_invalid_ops.rs +++ b/tests/ui/mir/mir_detects_invalid_ops.rs @@ -1,5 +1,3 @@ -// build-fail - fn main() { divide_by_zero(); mod_by_zero(); diff --git a/tests/ui/mir/mir_detects_invalid_ops.stderr b/tests/ui/mir/mir_detects_invalid_ops.stderr index 0fe56f4172515..ee1946247fc24 100644 --- a/tests/ui/mir/mir_detects_invalid_ops.stderr +++ b/tests/ui/mir/mir_detects_invalid_ops.stderr @@ -1,5 +1,5 @@ error: this operation will panic at runtime - --> $DIR/mir_detects_invalid_ops.rs:11:14 + --> $DIR/mir_detects_invalid_ops.rs:9:14 | LL | let _z = 1 / y; | ^^^^^ attempt to divide `1_i32` by zero @@ -7,7 +7,7 @@ LL | let _z = 1 / y; = note: `#[deny(unconditional_panic)]` on by default error: this operation will panic at runtime - --> $DIR/mir_detects_invalid_ops.rs:16:14 + --> $DIR/mir_detects_invalid_ops.rs:14:14 | LL | let _z = 1 % y; | ^^^^^ attempt to calculate the remainder of `1_i32` with a divisor of zero diff --git a/tests/ui/numbers-arithmetic/issue-8460-const.noopt.stderr b/tests/ui/numbers-arithmetic/issue-8460-const.noopt.stderr index c4abcb784119e..bc050e1549edf 100644 --- a/tests/ui/numbers-arithmetic/issue-8460-const.noopt.stderr +++ b/tests/ui/numbers-arithmetic/issue-8460-const.noopt.stderr @@ -1,148 +1,148 @@ error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:11:36 + --> $DIR/issue-8460-const.rs:11:13 | -LL | assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^^^^ attempt to compute `isize::MIN / -1_isize`, which would overflow +LL | isize::MIN / -1; + | ^^^^^^^^^^^^^^^ 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 + --> $DIR/issue-8460-const.rs:18:13 | -LL | assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^ attempt to compute `i8::MIN / -1_i8`, which would overflow +LL | i8::MIN / -1; + | ^^^^^^^^^^^^ attempt to compute `i8::MIN / -1_i8`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:15:36 + --> $DIR/issue-8460-const.rs:25:13 | -LL | assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute `i16::MIN / -1_i16`, which would overflow +LL | i16::MIN / -1; + | ^^^^^^^^^^^^^ attempt to compute `i16::MIN / -1_i16`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:17:36 + --> $DIR/issue-8460-const.rs:32:13 | -LL | assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute `i32::MIN / -1_i32`, which would overflow +LL | i32::MIN / -1; + | ^^^^^^^^^^^^^ attempt to compute `i32::MIN / -1_i32`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:19:36 + --> $DIR/issue-8460-const.rs:39:13 | -LL | assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute `i64::MIN / -1_i64`, which would overflow +LL | i64::MIN / -1; + | ^^^^^^^^^^^^^ attempt to compute `i64::MIN / -1_i64`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:21:36 + --> $DIR/issue-8460-const.rs:46:13 | -LL | assert!(thread::spawn(move|| { i128::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^^^ attempt to compute `i128::MIN / -1_i128`, which would overflow +LL | i128::MIN / -1; + | ^^^^^^^^^^^^^^ attempt to compute `i128::MIN / -1_i128`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:23:36 + --> $DIR/issue-8460-const.rs:53:13 | -LL | assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err()); - | ^^^^^^^^^^ attempt to divide `1_isize` by zero +LL | 1isize / 0; + | ^^^^^^^^^^ attempt to divide `1_isize` by zero error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:25:36 + --> $DIR/issue-8460-const.rs:60:13 | -LL | assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err()); - | ^^^^^^^ attempt to divide `1_i8` by zero +LL | 1i8 / 0; + | ^^^^^^^ attempt to divide `1_i8` by zero error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:27:36 + --> $DIR/issue-8460-const.rs:67:13 | -LL | assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err()); - | ^^^^^^^^ attempt to divide `1_i16` by zero +LL | 1i16 / 0; + | ^^^^^^^^ attempt to divide `1_i16` by zero error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:29:36 + --> $DIR/issue-8460-const.rs:74:13 | -LL | assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err()); - | ^^^^^^^^ attempt to divide `1_i32` by zero +LL | 1i32 / 0; + | ^^^^^^^^ attempt to divide `1_i32` by zero error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:31:36 + --> $DIR/issue-8460-const.rs:81:13 | -LL | assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err()); - | ^^^^^^^^ attempt to divide `1_i64` by zero +LL | 1i64 / 0; + | ^^^^^^^^ attempt to divide `1_i64` by zero error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:33:36 + --> $DIR/issue-8460-const.rs:88:13 | -LL | assert!(thread::spawn(move|| { 1i128 / 0; }).join().is_err()); - | ^^^^^^^^^ attempt to divide `1_i128` by zero +LL | 1i128 / 0; + | ^^^^^^^^^ attempt to divide `1_i128` by zero error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:35:36 + --> $DIR/issue-8460-const.rs:95:13 | -LL | assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^^^^ attempt to compute the remainder of `isize::MIN % -1_isize`, which would overflow +LL | isize::MIN % -1; + | ^^^^^^^^^^^^^^^ attempt to compute the remainder of `isize::MIN % -1_isize`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:37:36 + --> $DIR/issue-8460-const.rs:102:13 | -LL | assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^ attempt to compute the remainder of `i8::MIN % -1_i8`, which would overflow +LL | i8::MIN % -1; + | ^^^^^^^^^^^^ attempt to compute the remainder of `i8::MIN % -1_i8`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:39:36 + --> $DIR/issue-8460-const.rs:109:13 | -LL | assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute the remainder of `i16::MIN % -1_i16`, which would overflow +LL | i16::MIN % -1; + | ^^^^^^^^^^^^^ attempt to compute the remainder of `i16::MIN % -1_i16`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:41:36 + --> $DIR/issue-8460-const.rs:116:13 | -LL | assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute the remainder of `i32::MIN % -1_i32`, which would overflow +LL | i32::MIN % -1; + | ^^^^^^^^^^^^^ attempt to compute the remainder of `i32::MIN % -1_i32`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:43:36 + --> $DIR/issue-8460-const.rs:123:13 | -LL | assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute the remainder of `i64::MIN % -1_i64`, which would overflow +LL | i64::MIN % -1; + | ^^^^^^^^^^^^^ attempt to compute the remainder of `i64::MIN % -1_i64`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:45:36 + --> $DIR/issue-8460-const.rs:130:13 | -LL | assert!(thread::spawn(move|| { i128::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^^^ attempt to compute the remainder of `i128::MIN % -1_i128`, which would overflow +LL | i128::MIN % -1; + | ^^^^^^^^^^^^^^ attempt to compute the remainder of `i128::MIN % -1_i128`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:47:36 + --> $DIR/issue-8460-const.rs:137:13 | -LL | assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err()); - | ^^^^^^^^^^ attempt to calculate the remainder of `1_isize` with a divisor of zero +LL | 1isize % 0; + | ^^^^^^^^^^ 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 + --> $DIR/issue-8460-const.rs:144:13 | -LL | assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err()); - | ^^^^^^^ attempt to calculate the remainder of `1_i8` with a divisor of zero +LL | 1i8 % 0; + | ^^^^^^^ 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 + --> $DIR/issue-8460-const.rs:151:13 | -LL | assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err()); - | ^^^^^^^^ attempt to calculate the remainder of `1_i16` with a divisor of zero +LL | 1i16 % 0; + | ^^^^^^^^ 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 + --> $DIR/issue-8460-const.rs:158:13 | -LL | assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err()); - | ^^^^^^^^ attempt to calculate the remainder of `1_i32` with a divisor of zero +LL | 1i32 % 0; + | ^^^^^^^^ 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 + --> $DIR/issue-8460-const.rs:165:13 | -LL | assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err()); - | ^^^^^^^^ attempt to calculate the remainder of `1_i64` with a divisor of zero +LL | 1i64 % 0; + | ^^^^^^^^ 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 + --> $DIR/issue-8460-const.rs:172:13 | -LL | assert!(thread::spawn(move|| { 1i128 % 0; }).join().is_err()); - | ^^^^^^^^^ attempt to calculate the remainder of `1_i128` with a divisor of zero +LL | 1i128 % 0; + | ^^^^^^^^^ 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 index c4abcb784119e..bc050e1549edf 100644 --- a/tests/ui/numbers-arithmetic/issue-8460-const.opt.stderr +++ b/tests/ui/numbers-arithmetic/issue-8460-const.opt.stderr @@ -1,148 +1,148 @@ error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:11:36 + --> $DIR/issue-8460-const.rs:11:13 | -LL | assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^^^^ attempt to compute `isize::MIN / -1_isize`, which would overflow +LL | isize::MIN / -1; + | ^^^^^^^^^^^^^^^ 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 + --> $DIR/issue-8460-const.rs:18:13 | -LL | assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^ attempt to compute `i8::MIN / -1_i8`, which would overflow +LL | i8::MIN / -1; + | ^^^^^^^^^^^^ attempt to compute `i8::MIN / -1_i8`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:15:36 + --> $DIR/issue-8460-const.rs:25:13 | -LL | assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute `i16::MIN / -1_i16`, which would overflow +LL | i16::MIN / -1; + | ^^^^^^^^^^^^^ attempt to compute `i16::MIN / -1_i16`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:17:36 + --> $DIR/issue-8460-const.rs:32:13 | -LL | assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute `i32::MIN / -1_i32`, which would overflow +LL | i32::MIN / -1; + | ^^^^^^^^^^^^^ attempt to compute `i32::MIN / -1_i32`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:19:36 + --> $DIR/issue-8460-const.rs:39:13 | -LL | assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute `i64::MIN / -1_i64`, which would overflow +LL | i64::MIN / -1; + | ^^^^^^^^^^^^^ attempt to compute `i64::MIN / -1_i64`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:21:36 + --> $DIR/issue-8460-const.rs:46:13 | -LL | assert!(thread::spawn(move|| { i128::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^^^ attempt to compute `i128::MIN / -1_i128`, which would overflow +LL | i128::MIN / -1; + | ^^^^^^^^^^^^^^ attempt to compute `i128::MIN / -1_i128`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:23:36 + --> $DIR/issue-8460-const.rs:53:13 | -LL | assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err()); - | ^^^^^^^^^^ attempt to divide `1_isize` by zero +LL | 1isize / 0; + | ^^^^^^^^^^ attempt to divide `1_isize` by zero error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:25:36 + --> $DIR/issue-8460-const.rs:60:13 | -LL | assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err()); - | ^^^^^^^ attempt to divide `1_i8` by zero +LL | 1i8 / 0; + | ^^^^^^^ attempt to divide `1_i8` by zero error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:27:36 + --> $DIR/issue-8460-const.rs:67:13 | -LL | assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err()); - | ^^^^^^^^ attempt to divide `1_i16` by zero +LL | 1i16 / 0; + | ^^^^^^^^ attempt to divide `1_i16` by zero error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:29:36 + --> $DIR/issue-8460-const.rs:74:13 | -LL | assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err()); - | ^^^^^^^^ attempt to divide `1_i32` by zero +LL | 1i32 / 0; + | ^^^^^^^^ attempt to divide `1_i32` by zero error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:31:36 + --> $DIR/issue-8460-const.rs:81:13 | -LL | assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err()); - | ^^^^^^^^ attempt to divide `1_i64` by zero +LL | 1i64 / 0; + | ^^^^^^^^ attempt to divide `1_i64` by zero error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:33:36 + --> $DIR/issue-8460-const.rs:88:13 | -LL | assert!(thread::spawn(move|| { 1i128 / 0; }).join().is_err()); - | ^^^^^^^^^ attempt to divide `1_i128` by zero +LL | 1i128 / 0; + | ^^^^^^^^^ attempt to divide `1_i128` by zero error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:35:36 + --> $DIR/issue-8460-const.rs:95:13 | -LL | assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^^^^ attempt to compute the remainder of `isize::MIN % -1_isize`, which would overflow +LL | isize::MIN % -1; + | ^^^^^^^^^^^^^^^ attempt to compute the remainder of `isize::MIN % -1_isize`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:37:36 + --> $DIR/issue-8460-const.rs:102:13 | -LL | assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^ attempt to compute the remainder of `i8::MIN % -1_i8`, which would overflow +LL | i8::MIN % -1; + | ^^^^^^^^^^^^ attempt to compute the remainder of `i8::MIN % -1_i8`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:39:36 + --> $DIR/issue-8460-const.rs:109:13 | -LL | assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute the remainder of `i16::MIN % -1_i16`, which would overflow +LL | i16::MIN % -1; + | ^^^^^^^^^^^^^ attempt to compute the remainder of `i16::MIN % -1_i16`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:41:36 + --> $DIR/issue-8460-const.rs:116:13 | -LL | assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute the remainder of `i32::MIN % -1_i32`, which would overflow +LL | i32::MIN % -1; + | ^^^^^^^^^^^^^ attempt to compute the remainder of `i32::MIN % -1_i32`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:43:36 + --> $DIR/issue-8460-const.rs:123:13 | -LL | assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute the remainder of `i64::MIN % -1_i64`, which would overflow +LL | i64::MIN % -1; + | ^^^^^^^^^^^^^ attempt to compute the remainder of `i64::MIN % -1_i64`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:45:36 + --> $DIR/issue-8460-const.rs:130:13 | -LL | assert!(thread::spawn(move|| { i128::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^^^ attempt to compute the remainder of `i128::MIN % -1_i128`, which would overflow +LL | i128::MIN % -1; + | ^^^^^^^^^^^^^^ attempt to compute the remainder of `i128::MIN % -1_i128`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:47:36 + --> $DIR/issue-8460-const.rs:137:13 | -LL | assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err()); - | ^^^^^^^^^^ attempt to calculate the remainder of `1_isize` with a divisor of zero +LL | 1isize % 0; + | ^^^^^^^^^^ 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 + --> $DIR/issue-8460-const.rs:144:13 | -LL | assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err()); - | ^^^^^^^ attempt to calculate the remainder of `1_i8` with a divisor of zero +LL | 1i8 % 0; + | ^^^^^^^ 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 + --> $DIR/issue-8460-const.rs:151:13 | -LL | assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err()); - | ^^^^^^^^ attempt to calculate the remainder of `1_i16` with a divisor of zero +LL | 1i16 % 0; + | ^^^^^^^^ 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 + --> $DIR/issue-8460-const.rs:158:13 | -LL | assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err()); - | ^^^^^^^^ attempt to calculate the remainder of `1_i32` with a divisor of zero +LL | 1i32 % 0; + | ^^^^^^^^ 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 + --> $DIR/issue-8460-const.rs:165:13 | -LL | assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err()); - | ^^^^^^^^ attempt to calculate the remainder of `1_i64` with a divisor of zero +LL | 1i64 % 0; + | ^^^^^^^^ 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 + --> $DIR/issue-8460-const.rs:172:13 | -LL | assert!(thread::spawn(move|| { 1i128 % 0; }).join().is_err()); - | ^^^^^^^^^ attempt to calculate the remainder of `1_i128` with a divisor of zero +LL | 1i128 % 0; + | ^^^^^^^^^ 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 index c4abcb784119e..bc050e1549edf 100644 --- 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 @@ -1,148 +1,148 @@ error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:11:36 + --> $DIR/issue-8460-const.rs:11:13 | -LL | assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^^^^ attempt to compute `isize::MIN / -1_isize`, which would overflow +LL | isize::MIN / -1; + | ^^^^^^^^^^^^^^^ 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 + --> $DIR/issue-8460-const.rs:18:13 | -LL | assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^ attempt to compute `i8::MIN / -1_i8`, which would overflow +LL | i8::MIN / -1; + | ^^^^^^^^^^^^ attempt to compute `i8::MIN / -1_i8`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:15:36 + --> $DIR/issue-8460-const.rs:25:13 | -LL | assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute `i16::MIN / -1_i16`, which would overflow +LL | i16::MIN / -1; + | ^^^^^^^^^^^^^ attempt to compute `i16::MIN / -1_i16`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:17:36 + --> $DIR/issue-8460-const.rs:32:13 | -LL | assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute `i32::MIN / -1_i32`, which would overflow +LL | i32::MIN / -1; + | ^^^^^^^^^^^^^ attempt to compute `i32::MIN / -1_i32`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:19:36 + --> $DIR/issue-8460-const.rs:39:13 | -LL | assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute `i64::MIN / -1_i64`, which would overflow +LL | i64::MIN / -1; + | ^^^^^^^^^^^^^ attempt to compute `i64::MIN / -1_i64`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:21:36 + --> $DIR/issue-8460-const.rs:46:13 | -LL | assert!(thread::spawn(move|| { i128::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^^^ attempt to compute `i128::MIN / -1_i128`, which would overflow +LL | i128::MIN / -1; + | ^^^^^^^^^^^^^^ attempt to compute `i128::MIN / -1_i128`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:23:36 + --> $DIR/issue-8460-const.rs:53:13 | -LL | assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err()); - | ^^^^^^^^^^ attempt to divide `1_isize` by zero +LL | 1isize / 0; + | ^^^^^^^^^^ attempt to divide `1_isize` by zero error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:25:36 + --> $DIR/issue-8460-const.rs:60:13 | -LL | assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err()); - | ^^^^^^^ attempt to divide `1_i8` by zero +LL | 1i8 / 0; + | ^^^^^^^ attempt to divide `1_i8` by zero error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:27:36 + --> $DIR/issue-8460-const.rs:67:13 | -LL | assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err()); - | ^^^^^^^^ attempt to divide `1_i16` by zero +LL | 1i16 / 0; + | ^^^^^^^^ attempt to divide `1_i16` by zero error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:29:36 + --> $DIR/issue-8460-const.rs:74:13 | -LL | assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err()); - | ^^^^^^^^ attempt to divide `1_i32` by zero +LL | 1i32 / 0; + | ^^^^^^^^ attempt to divide `1_i32` by zero error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:31:36 + --> $DIR/issue-8460-const.rs:81:13 | -LL | assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err()); - | ^^^^^^^^ attempt to divide `1_i64` by zero +LL | 1i64 / 0; + | ^^^^^^^^ attempt to divide `1_i64` by zero error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:33:36 + --> $DIR/issue-8460-const.rs:88:13 | -LL | assert!(thread::spawn(move|| { 1i128 / 0; }).join().is_err()); - | ^^^^^^^^^ attempt to divide `1_i128` by zero +LL | 1i128 / 0; + | ^^^^^^^^^ attempt to divide `1_i128` by zero error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:35:36 + --> $DIR/issue-8460-const.rs:95:13 | -LL | assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^^^^ attempt to compute the remainder of `isize::MIN % -1_isize`, which would overflow +LL | isize::MIN % -1; + | ^^^^^^^^^^^^^^^ attempt to compute the remainder of `isize::MIN % -1_isize`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:37:36 + --> $DIR/issue-8460-const.rs:102:13 | -LL | assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^ attempt to compute the remainder of `i8::MIN % -1_i8`, which would overflow +LL | i8::MIN % -1; + | ^^^^^^^^^^^^ attempt to compute the remainder of `i8::MIN % -1_i8`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:39:36 + --> $DIR/issue-8460-const.rs:109:13 | -LL | assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute the remainder of `i16::MIN % -1_i16`, which would overflow +LL | i16::MIN % -1; + | ^^^^^^^^^^^^^ attempt to compute the remainder of `i16::MIN % -1_i16`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:41:36 + --> $DIR/issue-8460-const.rs:116:13 | -LL | assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute the remainder of `i32::MIN % -1_i32`, which would overflow +LL | i32::MIN % -1; + | ^^^^^^^^^^^^^ attempt to compute the remainder of `i32::MIN % -1_i32`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:43:36 + --> $DIR/issue-8460-const.rs:123:13 | -LL | assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute the remainder of `i64::MIN % -1_i64`, which would overflow +LL | i64::MIN % -1; + | ^^^^^^^^^^^^^ attempt to compute the remainder of `i64::MIN % -1_i64`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:45:36 + --> $DIR/issue-8460-const.rs:130:13 | -LL | assert!(thread::spawn(move|| { i128::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^^^ attempt to compute the remainder of `i128::MIN % -1_i128`, which would overflow +LL | i128::MIN % -1; + | ^^^^^^^^^^^^^^ attempt to compute the remainder of `i128::MIN % -1_i128`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:47:36 + --> $DIR/issue-8460-const.rs:137:13 | -LL | assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err()); - | ^^^^^^^^^^ attempt to calculate the remainder of `1_isize` with a divisor of zero +LL | 1isize % 0; + | ^^^^^^^^^^ 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 + --> $DIR/issue-8460-const.rs:144:13 | -LL | assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err()); - | ^^^^^^^ attempt to calculate the remainder of `1_i8` with a divisor of zero +LL | 1i8 % 0; + | ^^^^^^^ 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 + --> $DIR/issue-8460-const.rs:151:13 | -LL | assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err()); - | ^^^^^^^^ attempt to calculate the remainder of `1_i16` with a divisor of zero +LL | 1i16 % 0; + | ^^^^^^^^ 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 + --> $DIR/issue-8460-const.rs:158:13 | -LL | assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err()); - | ^^^^^^^^ attempt to calculate the remainder of `1_i32` with a divisor of zero +LL | 1i32 % 0; + | ^^^^^^^^ 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 + --> $DIR/issue-8460-const.rs:165:13 | -LL | assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err()); - | ^^^^^^^^ attempt to calculate the remainder of `1_i64` with a divisor of zero +LL | 1i64 % 0; + | ^^^^^^^^ 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 + --> $DIR/issue-8460-const.rs:172:13 | -LL | assert!(thread::spawn(move|| { 1i128 % 0; }).join().is_err()); - | ^^^^^^^^^ attempt to calculate the remainder of `1_i128` with a divisor of zero +LL | 1i128 % 0; + | ^^^^^^^^^ 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 index 02e7567dafabb..250e3cf934a3b 100644 --- a/tests/ui/numbers-arithmetic/issue-8460-const.rs +++ b/tests/ui/numbers-arithmetic/issue-8460-const.rs @@ -3,57 +3,175 @@ //[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 + assert!( + thread::spawn(move || { + isize::MIN / -1; //~ ERROR operation will panic + }) + .join() + .is_err() + ); + assert!( + thread::spawn(move || { + i8::MIN / -1; //~ ERROR operation will panic + }) + .join() + .is_err() + ); + assert!( + thread::spawn(move || { + i16::MIN / -1; //~ ERROR operation will panic + }) + .join() + .is_err() + ); + assert!( + thread::spawn(move || { + i32::MIN / -1; //~ ERROR operation will panic + }) + .join() + .is_err() + ); + assert!( + thread::spawn(move || { + i64::MIN / -1; //~ ERROR operation will panic + }) + .join() + .is_err() + ); + assert!( + thread::spawn(move || { + i128::MIN / -1; //~ ERROR operation will panic + }) + .join() + .is_err() + ); + assert!( + thread::spawn(move || { + 1isize / 0; //~ ERROR operation will panic + }) + .join() + .is_err() + ); + assert!( + thread::spawn(move || { + 1i8 / 0; //~ ERROR operation will panic + }) + .join() + .is_err() + ); + assert!( + thread::spawn(move || { + 1i16 / 0; //~ ERROR operation will panic + }) + .join() + .is_err() + ); + assert!( + thread::spawn(move || { + 1i32 / 0; //~ ERROR operation will panic + }) + .join() + .is_err() + ); + assert!( + thread::spawn(move || { + 1i64 / 0; //~ ERROR operation will panic + }) + .join() + .is_err() + ); + assert!( + thread::spawn(move || { + 1i128 / 0; //~ ERROR operation will panic + }) + .join() + .is_err() + ); + assert!( + thread::spawn(move || { + isize::MIN % -1; //~ ERROR operation will panic + }) + .join() + .is_err() + ); + assert!( + thread::spawn(move || { + i8::MIN % -1; //~ ERROR operation will panic + }) + .join() + .is_err() + ); + assert!( + thread::spawn(move || { + i16::MIN % -1; //~ ERROR operation will panic + }) + .join() + .is_err() + ); + assert!( + thread::spawn(move || { + i32::MIN % -1; //~ ERROR operation will panic + }) + .join() + .is_err() + ); + assert!( + thread::spawn(move || { + i64::MIN % -1; //~ ERROR operation will panic + }) + .join() + .is_err() + ); + assert!( + thread::spawn(move || { + i128::MIN % -1; //~ ERROR operation will panic + }) + .join() + .is_err() + ); + assert!( + thread::spawn(move || { + 1isize % 0; //~ ERROR operation will panic + }) + .join() + .is_err() + ); + assert!( + thread::spawn(move || { + 1i8 % 0; //~ ERROR operation will panic + }) + .join() + .is_err() + ); + assert!( + thread::spawn(move || { + 1i16 % 0; //~ ERROR operation will panic + }) + .join() + .is_err() + ); + assert!( + thread::spawn(move || { + 1i32 % 0; //~ ERROR operation will panic + }) + .join() + .is_err() + ); + assert!( + thread::spawn(move || { + 1i64 % 0; //~ ERROR operation will panic + }) + .join() + .is_err() + ); + assert!( + thread::spawn(move || { + 1i128 % 0; //~ ERROR operation will panic + }) + .join() + .is_err() + ); } diff --git a/tests/ui/numbers-arithmetic/overflowing-lsh-1.rs b/tests/ui/numbers-arithmetic/overflowing-lsh-1.rs index 7f8b0c877600f..68df950674ec0 100644 --- a/tests/ui/numbers-arithmetic/overflowing-lsh-1.rs +++ b/tests/ui/numbers-arithmetic/overflowing-lsh-1.rs @@ -1,4 +1,3 @@ -// build-fail // compile-flags: -C debug-assertions #![deny(arithmetic_overflow)] diff --git a/tests/ui/numbers-arithmetic/overflowing-lsh-1.stderr b/tests/ui/numbers-arithmetic/overflowing-lsh-1.stderr index 434c9d5b43daf..60573a33ff472 100644 --- a/tests/ui/numbers-arithmetic/overflowing-lsh-1.stderr +++ b/tests/ui/numbers-arithmetic/overflowing-lsh-1.stderr @@ -1,11 +1,11 @@ error: this arithmetic operation will overflow - --> $DIR/overflowing-lsh-1.rs:7:14 + --> $DIR/overflowing-lsh-1.rs:6: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 + --> $DIR/overflowing-lsh-1.rs:3:9 | LL | #![deny(arithmetic_overflow)] | ^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/numbers-arithmetic/overflowing-lsh-2.rs b/tests/ui/numbers-arithmetic/overflowing-lsh-2.rs index 76718ecd1fa7a..7ae3d66ee6405 100644 --- a/tests/ui/numbers-arithmetic/overflowing-lsh-2.rs +++ b/tests/ui/numbers-arithmetic/overflowing-lsh-2.rs @@ -1,4 +1,3 @@ -// build-fail // compile-flags: -C debug-assertions #![deny(arithmetic_overflow)] diff --git a/tests/ui/numbers-arithmetic/overflowing-lsh-2.stderr b/tests/ui/numbers-arithmetic/overflowing-lsh-2.stderr index c3b44e5a04375..93b263c1ecb55 100644 --- a/tests/ui/numbers-arithmetic/overflowing-lsh-2.stderr +++ b/tests/ui/numbers-arithmetic/overflowing-lsh-2.stderr @@ -1,11 +1,11 @@ error: this arithmetic operation will overflow - --> $DIR/overflowing-lsh-2.rs:7:14 + --> $DIR/overflowing-lsh-2.rs:6: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 + --> $DIR/overflowing-lsh-2.rs:3:9 | LL | #![deny(arithmetic_overflow)] | ^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/numbers-arithmetic/overflowing-lsh-3.rs b/tests/ui/numbers-arithmetic/overflowing-lsh-3.rs index b2bdd09bffb91..100f28173a8be 100644 --- a/tests/ui/numbers-arithmetic/overflowing-lsh-3.rs +++ b/tests/ui/numbers-arithmetic/overflowing-lsh-3.rs @@ -1,4 +1,3 @@ -// build-fail // compile-flags: -C debug-assertions #![deny(arithmetic_overflow)] diff --git a/tests/ui/numbers-arithmetic/overflowing-lsh-3.stderr b/tests/ui/numbers-arithmetic/overflowing-lsh-3.stderr index 9d6479bd7c7c6..42e32c9223c39 100644 --- a/tests/ui/numbers-arithmetic/overflowing-lsh-3.stderr +++ b/tests/ui/numbers-arithmetic/overflowing-lsh-3.stderr @@ -1,11 +1,11 @@ error: this arithmetic operation will overflow - --> $DIR/overflowing-lsh-3.rs:7:14 + --> $DIR/overflowing-lsh-3.rs:6: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 + --> $DIR/overflowing-lsh-3.rs:3:9 | LL | #![deny(arithmetic_overflow)] | ^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/numbers-arithmetic/overflowing-lsh-4.rs b/tests/ui/numbers-arithmetic/overflowing-lsh-4.rs index 1042bfcb34d3d..ec5f47dded15c 100644 --- a/tests/ui/numbers-arithmetic/overflowing-lsh-4.rs +++ b/tests/ui/numbers-arithmetic/overflowing-lsh-4.rs @@ -1,4 +1,3 @@ -// build-fail // compile-flags: -C debug-assertions // This function is checking that our automatic truncation does not diff --git a/tests/ui/numbers-arithmetic/overflowing-lsh-4.stderr b/tests/ui/numbers-arithmetic/overflowing-lsh-4.stderr index 2bb5b6a6d6e09..e97ad5d3f386a 100644 --- a/tests/ui/numbers-arithmetic/overflowing-lsh-4.stderr +++ b/tests/ui/numbers-arithmetic/overflowing-lsh-4.stderr @@ -1,11 +1,11 @@ error: this arithmetic operation will overflow - --> $DIR/overflowing-lsh-4.rs:11:13 + --> $DIR/overflowing-lsh-4.rs:10:13 | LL | let x = 1_i8 << 17; | ^^^^^^^^^^ attempt to shift left by `17_i32`, which would overflow | note: the lint level is defined here - --> $DIR/overflowing-lsh-4.rs:7:9 + --> $DIR/overflowing-lsh-4.rs:6:9 | LL | #![deny(arithmetic_overflow)] | ^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/numbers-arithmetic/overflowing-rsh-1.rs b/tests/ui/numbers-arithmetic/overflowing-rsh-1.rs index 80593c8656f51..6c67677ee0c6f 100644 --- a/tests/ui/numbers-arithmetic/overflowing-rsh-1.rs +++ b/tests/ui/numbers-arithmetic/overflowing-rsh-1.rs @@ -1,4 +1,3 @@ -// build-fail // compile-flags: -C debug-assertions #![deny(arithmetic_overflow)] diff --git a/tests/ui/numbers-arithmetic/overflowing-rsh-1.stderr b/tests/ui/numbers-arithmetic/overflowing-rsh-1.stderr index b2b3114d1b4cf..456e132aaf5b5 100644 --- a/tests/ui/numbers-arithmetic/overflowing-rsh-1.stderr +++ b/tests/ui/numbers-arithmetic/overflowing-rsh-1.stderr @@ -1,11 +1,11 @@ error: this arithmetic operation will overflow - --> $DIR/overflowing-rsh-1.rs:7:14 + --> $DIR/overflowing-rsh-1.rs:6: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 + --> $DIR/overflowing-rsh-1.rs:3:9 | LL | #![deny(arithmetic_overflow)] | ^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/numbers-arithmetic/overflowing-rsh-2.rs b/tests/ui/numbers-arithmetic/overflowing-rsh-2.rs index 917352bfce417..a046caee9d641 100644 --- a/tests/ui/numbers-arithmetic/overflowing-rsh-2.rs +++ b/tests/ui/numbers-arithmetic/overflowing-rsh-2.rs @@ -1,4 +1,3 @@ -// build-fail // compile-flags: -C debug-assertions #![deny(arithmetic_overflow)] diff --git a/tests/ui/numbers-arithmetic/overflowing-rsh-2.stderr b/tests/ui/numbers-arithmetic/overflowing-rsh-2.stderr index ad18c3bb7f459..8a65c4d11ec2a 100644 --- a/tests/ui/numbers-arithmetic/overflowing-rsh-2.stderr +++ b/tests/ui/numbers-arithmetic/overflowing-rsh-2.stderr @@ -1,11 +1,11 @@ error: this arithmetic operation will overflow - --> $DIR/overflowing-rsh-2.rs:7:14 + --> $DIR/overflowing-rsh-2.rs:6: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 + --> $DIR/overflowing-rsh-2.rs:3:9 | LL | #![deny(arithmetic_overflow)] | ^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/numbers-arithmetic/overflowing-rsh-3.rs b/tests/ui/numbers-arithmetic/overflowing-rsh-3.rs index 1e052990a7630..c5cdcaaa23c56 100644 --- a/tests/ui/numbers-arithmetic/overflowing-rsh-3.rs +++ b/tests/ui/numbers-arithmetic/overflowing-rsh-3.rs @@ -1,4 +1,3 @@ -// build-fail // compile-flags: -C debug-assertions #![deny(arithmetic_overflow)] diff --git a/tests/ui/numbers-arithmetic/overflowing-rsh-3.stderr b/tests/ui/numbers-arithmetic/overflowing-rsh-3.stderr index 37d02e09dec34..dd46f73ce3037 100644 --- a/tests/ui/numbers-arithmetic/overflowing-rsh-3.stderr +++ b/tests/ui/numbers-arithmetic/overflowing-rsh-3.stderr @@ -1,11 +1,11 @@ error: this arithmetic operation will overflow - --> $DIR/overflowing-rsh-3.rs:7:14 + --> $DIR/overflowing-rsh-3.rs:6: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 + --> $DIR/overflowing-rsh-3.rs:3:9 | LL | #![deny(arithmetic_overflow)] | ^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/numbers-arithmetic/overflowing-rsh-4.rs b/tests/ui/numbers-arithmetic/overflowing-rsh-4.rs index be918becd3a3a..6b62a37b21ad4 100644 --- a/tests/ui/numbers-arithmetic/overflowing-rsh-4.rs +++ b/tests/ui/numbers-arithmetic/overflowing-rsh-4.rs @@ -1,4 +1,3 @@ -// build-fail // compile-flags: -C debug-assertions // This function is checking that our (type-based) automatic diff --git a/tests/ui/numbers-arithmetic/overflowing-rsh-4.stderr b/tests/ui/numbers-arithmetic/overflowing-rsh-4.stderr index 692602c07198b..add21ae2fa1a7 100644 --- a/tests/ui/numbers-arithmetic/overflowing-rsh-4.stderr +++ b/tests/ui/numbers-arithmetic/overflowing-rsh-4.stderr @@ -1,11 +1,11 @@ error: this arithmetic operation will overflow - --> $DIR/overflowing-rsh-4.rs:11:13 + --> $DIR/overflowing-rsh-4.rs:10:13 | LL | let x = 2_i8 >> 17; | ^^^^^^^^^^ attempt to shift right by `17_i32`, which would overflow | note: the lint level is defined here - --> $DIR/overflowing-rsh-4.rs:7:9 + --> $DIR/overflowing-rsh-4.rs:6:9 | LL | #![deny(arithmetic_overflow)] | ^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/numbers-arithmetic/overflowing-rsh-5.rs b/tests/ui/numbers-arithmetic/overflowing-rsh-5.rs index f75e779ed158c..e675c7e87cadc 100644 --- a/tests/ui/numbers-arithmetic/overflowing-rsh-5.rs +++ b/tests/ui/numbers-arithmetic/overflowing-rsh-5.rs @@ -1,4 +1,3 @@ -// build-fail // compile-flags: -C debug-assertions #![deny(arithmetic_overflow)] diff --git a/tests/ui/numbers-arithmetic/overflowing-rsh-5.stderr b/tests/ui/numbers-arithmetic/overflowing-rsh-5.stderr index e3b5859df90fa..eeffd837ba9e2 100644 --- a/tests/ui/numbers-arithmetic/overflowing-rsh-5.stderr +++ b/tests/ui/numbers-arithmetic/overflowing-rsh-5.stderr @@ -1,11 +1,11 @@ error: this arithmetic operation will overflow - --> $DIR/overflowing-rsh-5.rs:7:14 + --> $DIR/overflowing-rsh-5.rs:6: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 + --> $DIR/overflowing-rsh-5.rs:3:9 | LL | #![deny(arithmetic_overflow)] | ^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/numbers-arithmetic/overflowing-rsh-6.rs b/tests/ui/numbers-arithmetic/overflowing-rsh-6.rs index f75e779ed158c..e675c7e87cadc 100644 --- a/tests/ui/numbers-arithmetic/overflowing-rsh-6.rs +++ b/tests/ui/numbers-arithmetic/overflowing-rsh-6.rs @@ -1,4 +1,3 @@ -// build-fail // compile-flags: -C debug-assertions #![deny(arithmetic_overflow)] diff --git a/tests/ui/numbers-arithmetic/overflowing-rsh-6.stderr b/tests/ui/numbers-arithmetic/overflowing-rsh-6.stderr index a3475c04c28cd..cbcd50ff18abb 100644 --- a/tests/ui/numbers-arithmetic/overflowing-rsh-6.stderr +++ b/tests/ui/numbers-arithmetic/overflowing-rsh-6.stderr @@ -1,11 +1,11 @@ error: this arithmetic operation will overflow - --> $DIR/overflowing-rsh-6.rs:7:14 + --> $DIR/overflowing-rsh-6.rs:6: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-6.rs:4:9 + --> $DIR/overflowing-rsh-6.rs:3:9 | LL | #![deny(arithmetic_overflow)] | ^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/polymorphization/const_parameters/closures.rs b/tests/ui/polymorphization/const_parameters/closures.rs index 2f41beeb9691a..5fc9830a6a3cf 100644 --- a/tests/ui/polymorphization/const_parameters/closures.rs +++ b/tests/ui/polymorphization/const_parameters/closures.rs @@ -1,4 +1,3 @@ -// build-fail // compile-flags:-Zpolymorphize=on #![feature(generic_const_exprs, rustc_attrs)] //~^ WARN the feature `generic_const_exprs` is incomplete diff --git a/tests/ui/polymorphization/const_parameters/closures.stderr b/tests/ui/polymorphization/const_parameters/closures.stderr index 4e927f7732fa1..0fc68285978db 100644 --- a/tests/ui/polymorphization/const_parameters/closures.stderr +++ b/tests/ui/polymorphization/const_parameters/closures.stderr @@ -1,5 +1,5 @@ warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/closures.rs:3:12 + --> $DIR/closures.rs:2:12 | LL | #![feature(generic_const_exprs, rustc_attrs)] | ^^^^^^^^^^^^^^^^^^^ @@ -8,7 +8,7 @@ LL | #![feature(generic_const_exprs, rustc_attrs)] = note: `#[warn(incomplete_features)]` on by default error: item has unused generic parameters - --> $DIR/closures.rs:19:19 + --> $DIR/closures.rs:18:19 | LL | pub fn unused() -> usize { | -------------- generic parameter `T` is unused @@ -17,13 +17,13 @@ LL | let add_one = |x: usize| x + 1; | ^^^^^^^^^^ error: item has unused generic parameters - --> $DIR/closures.rs:17:8 + --> $DIR/closures.rs:16:8 | LL | pub fn unused() -> usize { | ^^^^^^ -------------- generic parameter `T` is unused error: item has unused generic parameters - --> $DIR/closures.rs:28:19 + --> $DIR/closures.rs:27:19 | LL | pub fn used_parent() -> usize { | -------------- generic parameter `T` is unused @@ -32,7 +32,7 @@ LL | let add_one = |x: usize| x + 1; | ^^^^^^^^^^ error: item has unused generic parameters - --> $DIR/closures.rs:48:13 + --> $DIR/closures.rs:47:13 | LL | pub fn unused_upvar() -> usize { | -------------- generic parameter `T` is unused diff --git a/tests/ui/polymorphization/const_parameters/functions.rs b/tests/ui/polymorphization/const_parameters/functions.rs index cbc1b63fbc4e6..a0d6ea85624e5 100644 --- a/tests/ui/polymorphization/const_parameters/functions.rs +++ b/tests/ui/polymorphization/const_parameters/functions.rs @@ -1,4 +1,3 @@ -// build-fail // compile-flags:-Zpolymorphize=on #![feature(generic_const_exprs, rustc_attrs)] //~^ WARN the feature `generic_const_exprs` is incomplete diff --git a/tests/ui/polymorphization/const_parameters/functions.stderr b/tests/ui/polymorphization/const_parameters/functions.stderr index 9d0922ac7ca03..638cdce83691c 100644 --- a/tests/ui/polymorphization/const_parameters/functions.stderr +++ b/tests/ui/polymorphization/const_parameters/functions.stderr @@ -1,5 +1,5 @@ warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/functions.rs:3:12 + --> $DIR/functions.rs:2:12 | LL | #![feature(generic_const_exprs, rustc_attrs)] | ^^^^^^^^^^^^^^^^^^^ @@ -8,7 +8,7 @@ LL | #![feature(generic_const_exprs, rustc_attrs)] = note: `#[warn(incomplete_features)]` on by default error: item has unused generic parameters - --> $DIR/functions.rs:15:8 + --> $DIR/functions.rs:14:8 | LL | pub fn unused() { | ^^^^^^ -------------- generic parameter `T` is unused diff --git a/tests/ui/polymorphization/generators.rs b/tests/ui/polymorphization/generators.rs index 779bac0ace29b..b18595ebc9d07 100644 --- a/tests/ui/polymorphization/generators.rs +++ b/tests/ui/polymorphization/generators.rs @@ -1,4 +1,3 @@ -// build-fail // compile-flags:-Zpolymorphize=on -Zinline-mir=off #![feature(generic_const_exprs, generators, generator_trait, rustc_attrs)] //~^ WARN the feature `generic_const_exprs` is incomplete diff --git a/tests/ui/polymorphization/generators.stderr b/tests/ui/polymorphization/generators.stderr index 84888f6fb2f56..89af35898d114 100644 --- a/tests/ui/polymorphization/generators.stderr +++ b/tests/ui/polymorphization/generators.stderr @@ -1,5 +1,5 @@ warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/generators.rs:3:12 + --> $DIR/generators.rs:2:12 | LL | #![feature(generic_const_exprs, generators, generator_trait, rustc_attrs)] | ^^^^^^^^^^^^^^^^^^^ @@ -8,29 +8,29 @@ LL | #![feature(generic_const_exprs, generators, generator_trait, rustc_attrs)] = note: `#[warn(incomplete_features)]` on by default error: item has unused generic parameters - --> $DIR/generators.rs:35:5 + --> $DIR/generators.rs:34:5 | LL | pub fn unused_type() -> impl Generator<(), Yield = u32, Return = u32> + Unpin { | - generic parameter `T` is unused LL | || { | ^^ -note: the above error was encountered while instantiating `fn finish::<[generator@$DIR/generators.rs:35:5: 35:7], u32, u32>` - --> $DIR/generators.rs:86:5 +note: the above error was encountered while instantiating `fn finish::<[generator@$DIR/generators.rs:34:5: 34:7], u32, u32>` + --> $DIR/generators.rs:85:5 | LL | finish(unused_type::()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: item has unused generic parameters - --> $DIR/generators.rs:60:5 + --> $DIR/generators.rs:59:5 | LL | pub fn unused_const() -> impl Generator<(), Yield = u32, Return = u32> + Unpin { | ------------ generic parameter `T` is unused LL | || { | ^^ -note: the above error was encountered while instantiating `fn finish::<[generator@$DIR/generators.rs:60:5: 60:7], u32, u32>` - --> $DIR/generators.rs:89:5 +note: the above error was encountered while instantiating `fn finish::<[generator@$DIR/generators.rs:59:5: 59:7], u32, u32>` + --> $DIR/generators.rs:88:5 | LL | finish(unused_const::<1u32>()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/polymorphization/lifetimes.rs b/tests/ui/polymorphization/lifetimes.rs index f26df45230a5c..1d26cca09af2b 100644 --- a/tests/ui/polymorphization/lifetimes.rs +++ b/tests/ui/polymorphization/lifetimes.rs @@ -1,4 +1,3 @@ -// build-fail // compile-flags:-Zpolymorphize=on #![feature(rustc_attrs)] diff --git a/tests/ui/polymorphization/lifetimes.stderr b/tests/ui/polymorphization/lifetimes.stderr index 4773dd4fa2ef1..99f9902bb8e59 100644 --- a/tests/ui/polymorphization/lifetimes.stderr +++ b/tests/ui/polymorphization/lifetimes.stderr @@ -1,11 +1,11 @@ error: item has unused generic parameters - --> $DIR/lifetimes.rs:10:8 + --> $DIR/lifetimes.rs:9:8 | LL | pub fn unused<'a, T>(_: &'a u32) { | ^^^^^^ - generic parameter `T` is unused error: item has unused generic parameters - --> $DIR/lifetimes.rs:17:19 + --> $DIR/lifetimes.rs:16:19 | LL | pub fn used<'a, T: Default>(_: &'a u32) -> u32 { | - generic parameter `T` is unused diff --git a/tests/ui/polymorphization/predicates.rs b/tests/ui/polymorphization/predicates.rs index 6a5fc2e33de63..56e6bc7d1d82c 100644 --- a/tests/ui/polymorphization/predicates.rs +++ b/tests/ui/polymorphization/predicates.rs @@ -1,4 +1,3 @@ -// build-fail // compile-flags: -Copt-level=0 -Zpolymorphize=on #![feature(rustc_attrs)] diff --git a/tests/ui/polymorphization/predicates.stderr b/tests/ui/polymorphization/predicates.stderr index 80bb2af25cc21..cd9c1b884f6b5 100644 --- a/tests/ui/polymorphization/predicates.stderr +++ b/tests/ui/polymorphization/predicates.stderr @@ -1,17 +1,17 @@ error: item has unused generic parameters - --> $DIR/predicates.rs:15:4 + --> $DIR/predicates.rs:14:4 | LL | fn foo(_: I) | ^^^ - generic parameter `T` is unused error: item has unused generic parameters - --> $DIR/predicates.rs:24:4 + --> $DIR/predicates.rs:23:4 | LL | fn baz(_: I) | ^^^ - generic parameter `T` is unused error: item has unused generic parameters - --> $DIR/predicates.rs:45:19 + --> $DIR/predicates.rs:44:19 | LL | impl<'a, I, T: 'a, E> Iterator for Foo<'a, I, E> | - - generic parameter `E` is unused @@ -22,7 +22,7 @@ LL | self.find(|_| true) | ^^^ error: item has unused generic parameters - --> $DIR/predicates.rs:59:4 + --> $DIR/predicates.rs:58:4 | LL | fn quux() -> usize | ^^^^ - - generic parameter `B` is unused @@ -30,19 +30,19 @@ LL | fn quux() -> usize | generic parameter `A` is unused error: item has unused generic parameters - --> $DIR/predicates.rs:76:4 + --> $DIR/predicates.rs:75:4 | LL | fn foobar() -> usize | ^^^^^^ - generic parameter `F` is unused error: item has unused generic parameters - --> $DIR/predicates.rs:10:4 + --> $DIR/predicates.rs:9:4 | LL | fn bar() { | ^^^ - generic parameter `I` is unused note: the above error was encountered while instantiating `fn foo::, T>` - --> $DIR/predicates.rs:86:5 + --> $DIR/predicates.rs:85:5 | LL | foo(x.iter()); | ^^^^^^^^^^^^^ diff --git a/tests/ui/polymorphization/promoted-function-2.rs b/tests/ui/polymorphization/promoted-function-2.rs index d2d0f33681244..a798c9ab5644f 100644 --- a/tests/ui/polymorphization/promoted-function-2.rs +++ b/tests/ui/polymorphization/promoted-function-2.rs @@ -1,4 +1,3 @@ -// build-fail // compile-flags:-Zpolymorphize=on #![crate_type = "lib"] #![feature(generic_const_exprs, rustc_attrs)] diff --git a/tests/ui/polymorphization/promoted-function-2.stderr b/tests/ui/polymorphization/promoted-function-2.stderr index 547569df7dcef..02733e89242b3 100644 --- a/tests/ui/polymorphization/promoted-function-2.stderr +++ b/tests/ui/polymorphization/promoted-function-2.stderr @@ -1,5 +1,5 @@ warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/promoted-function-2.rs:4:12 + --> $DIR/promoted-function-2.rs:3:12 | LL | #![feature(generic_const_exprs, rustc_attrs)] | ^^^^^^^^^^^^^^^^^^^ @@ -8,7 +8,7 @@ LL | #![feature(generic_const_exprs, rustc_attrs)] = note: `#[warn(incomplete_features)]` on by default error: item has unused generic parameters - --> $DIR/promoted-function-2.rs:8:4 + --> $DIR/promoted-function-2.rs:7:4 | LL | fn test() { | ^^^^ - generic parameter `T` is unused diff --git a/tests/ui/polymorphization/type_parameters/closures.rs b/tests/ui/polymorphization/type_parameters/closures.rs index 07ab1355a47cf..b6e02408c3d4a 100644 --- a/tests/ui/polymorphization/type_parameters/closures.rs +++ b/tests/ui/polymorphization/type_parameters/closures.rs @@ -1,4 +1,3 @@ -// build-fail // compile-flags:-Zpolymorphize=on #![feature(stmt_expr_attributes, rustc_attrs)] diff --git a/tests/ui/polymorphization/type_parameters/closures.stderr b/tests/ui/polymorphization/type_parameters/closures.stderr index 94a4a08bd2fc2..46f7be4b5a01d 100644 --- a/tests/ui/polymorphization/type_parameters/closures.stderr +++ b/tests/ui/polymorphization/type_parameters/closures.stderr @@ -1,5 +1,5 @@ error: item has unused generic parameters - --> $DIR/closures.rs:19:19 + --> $DIR/closures.rs:18:19 | LL | pub fn unused() -> u32 { | - generic parameter `T` is unused @@ -8,13 +8,13 @@ LL | let add_one = |x: u32| x + 1; | ^^^^^^^^ error: item has unused generic parameters - --> $DIR/closures.rs:16:8 + --> $DIR/closures.rs:15:8 | LL | pub fn unused() -> u32 { | ^^^^^^ - generic parameter `T` is unused error: item has unused generic parameters - --> $DIR/closures.rs:28:19 + --> $DIR/closures.rs:27:19 | LL | pub fn used_parent() -> u32 { | - generic parameter `T` is unused @@ -23,7 +23,7 @@ LL | let add_one = |x: u32| x + 1; | ^^^^^^^^ error: item has unused generic parameters - --> $DIR/closures.rs:94:23 + --> $DIR/closures.rs:93:23 | LL | impl Foo { | - generic parameter `F` is unused @@ -35,7 +35,7 @@ LL | let add_one = |x: u32| x + 1; | ^^^^^^^^ error: item has unused generic parameters - --> $DIR/closures.rs:92:12 + --> $DIR/closures.rs:91:12 | LL | impl Foo { | - generic parameter `F` is unused @@ -44,7 +44,7 @@ LL | pub fn unused_all() -> u32 { | ^^^^^^^^^^ - generic parameter `G` is unused error: item has unused generic parameters - --> $DIR/closures.rs:128:23 + --> $DIR/closures.rs:127:23 | LL | pub fn used_impl() -> u32 { | - generic parameter `G` is unused @@ -53,13 +53,13 @@ LL | let add_one = |x: u32| { | ^^^^^^^^ error: item has unused generic parameters - --> $DIR/closures.rs:126:12 + --> $DIR/closures.rs:125:12 | LL | pub fn used_impl() -> u32 { | ^^^^^^^^^ - generic parameter `G` is unused error: item has unused generic parameters - --> $DIR/closures.rs:115:23 + --> $DIR/closures.rs:114:23 | LL | impl Foo { | - generic parameter `F` is unused @@ -68,7 +68,7 @@ LL | let add_one = |x: u32| { | ^^^^^^^^ error: item has unused generic parameters - --> $DIR/closures.rs:113:12 + --> $DIR/closures.rs:112:12 | LL | impl Foo { | - generic parameter `F` is unused diff --git a/tests/ui/polymorphization/type_parameters/functions.rs b/tests/ui/polymorphization/type_parameters/functions.rs index aad957e1dd362..6894248199a40 100644 --- a/tests/ui/polymorphization/type_parameters/functions.rs +++ b/tests/ui/polymorphization/type_parameters/functions.rs @@ -1,4 +1,3 @@ -// build-fail // compile-flags:-Zpolymorphize=on #![feature(rustc_attrs)] diff --git a/tests/ui/polymorphization/type_parameters/functions.stderr b/tests/ui/polymorphization/type_parameters/functions.stderr index d629ff7bb4d3a..be4c6576e9645 100644 --- a/tests/ui/polymorphization/type_parameters/functions.stderr +++ b/tests/ui/polymorphization/type_parameters/functions.stderr @@ -1,11 +1,11 @@ error: item has unused generic parameters - --> $DIR/functions.rs:14:8 + --> $DIR/functions.rs:13:8 | LL | pub fn unused() { | ^^^^^^ - generic parameter `T` is unused error: item has unused generic parameters - --> $DIR/functions.rs:45:12 + --> $DIR/functions.rs:44:12 | LL | impl Foo { | - generic parameter `F` is unused @@ -14,7 +14,7 @@ LL | pub fn unused_impl() { | ^^^^^^^^^^^ error: item has unused generic parameters - --> $DIR/functions.rs:51:12 + --> $DIR/functions.rs:50:12 | LL | impl Foo { | - generic parameter `F` is unused @@ -23,7 +23,7 @@ LL | pub fn unused_both() { | ^^^^^^^^^^^ - generic parameter `G` is unused error: item has unused generic parameters - --> $DIR/functions.rs:63:12 + --> $DIR/functions.rs:62:12 | LL | impl Foo { | - generic parameter `F` is unused diff --git a/tests/ui/polymorphization/unsized_cast.rs b/tests/ui/polymorphization/unsized_cast.rs index b803fec2ccfdb..2e7a3ae69901c 100644 --- a/tests/ui/polymorphization/unsized_cast.rs +++ b/tests/ui/polymorphization/unsized_cast.rs @@ -1,4 +1,3 @@ -// build-fail // compile-flags:-Zpolymorphize=on #![feature(fn_traits, rustc_attrs, unboxed_closures)] diff --git a/tests/ui/polymorphization/unsized_cast.stderr b/tests/ui/polymorphization/unsized_cast.stderr index 27f88d2817464..c4ad94ec604a5 100644 --- a/tests/ui/polymorphization/unsized_cast.stderr +++ b/tests/ui/polymorphization/unsized_cast.stderr @@ -1,5 +1,5 @@ error: item has unused generic parameters - --> $DIR/unsized_cast.rs:11:18 + --> $DIR/unsized_cast.rs:10:18 | LL | fn foo() { | - generic parameter `T` is unused @@ -8,7 +8,7 @@ LL | (|| Box::new(|| {}) as Box)(); | ^^ error: item has unused generic parameters - --> $DIR/unsized_cast.rs:11:6 + --> $DIR/unsized_cast.rs:10:6 | LL | fn foo() { | - generic parameter `T` is unused @@ -17,7 +17,7 @@ LL | (|| Box::new(|| {}) as Box)(); | ^^ error: item has unused generic parameters - --> $DIR/unsized_cast.rs:22:15 + --> $DIR/unsized_cast.rs:21:15 | LL | fn foo2() { | - generic parameter `T` is unused @@ -26,7 +26,7 @@ LL | call(&|| {}, ()); | ^^ error: item has unused generic parameters - --> $DIR/unsized_cast.rs:19:6 + --> $DIR/unsized_cast.rs:18:6 | LL | fn foo2() { | - generic parameter `T` is unused diff --git a/tests/ui/query-system/query_depth.rs b/tests/ui/query-system/query_depth.rs index e600c1c08e5cf..e98bb6c0e4573 100644 --- a/tests/ui/query-system/query_depth.rs +++ b/tests/ui/query-system/query_depth.rs @@ -1,5 +1,3 @@ -// build-fail - #![recursion_limit = "64"] type Byte = Option>>> >>>>; fn main() { -//~^ ERROR: queries overflow the depth limit! + //~^ ERROR: queries overflow the depth limit! println!("{}", std::mem::size_of::()); } diff --git a/tests/ui/query-system/query_depth.stderr b/tests/ui/query-system/query_depth.stderr index 43a18b4e07455..abbab56d26681 100644 --- a/tests/ui/query-system/query_depth.stderr +++ b/tests/ui/query-system/query_depth.stderr @@ -1,5 +1,5 @@ error: queries overflow the depth limit! - --> $DIR/query_depth.rs:28:1 + --> $DIR/query_depth.rs:26:1 | LL | fn main() { | ^^^^^^^^^ diff --git a/tests/ui/recursion/issue-83150.rs b/tests/ui/recursion/issue-83150.rs index 38353d161c133..1d0d025087e94 100644 --- a/tests/ui/recursion/issue-83150.rs +++ b/tests/ui/recursion/issue-83150.rs @@ -1,13 +1,13 @@ -// build-fail // compile-flags: -Copt-level=0 // normalize-stderr-test: "long-type-\d+" -> "long-type-hash" -//~^^^ ERROR overflow evaluating the requirement +//~^^ ERROR overflow evaluating the requirement fn main() { let mut iter = 0u8..1; func(&mut iter) } -fn func>(iter: &mut T) { //~ WARN function cannot return without recursing +fn func>(iter: &mut T) { + //~^ WARN function cannot return without recursing func(&mut iter.map(|x| x + 1)) } diff --git a/tests/ui/recursion/issue-83150.stderr b/tests/ui/recursion/issue-83150.stderr index 64683ae3a6ebd..0d1d2eceed605 100644 --- a/tests/ui/recursion/issue-83150.stderr +++ b/tests/ui/recursion/issue-83150.stderr @@ -1,8 +1,9 @@ warning: function cannot return without recursing - --> $DIR/issue-83150.rs:11:1 + --> $DIR/issue-83150.rs:10:1 | LL | fn func>(iter: &mut T) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing +LL | LL | func(&mut iter.map(|x| x + 1)) | ------------------------------ recursive call site | diff --git a/tests/ui/recursion/issue-95134.rs b/tests/ui/recursion/issue-95134.rs index fdc4d53698143..e4e7d71978b62 100644 --- a/tests/ui/recursion/issue-95134.rs +++ b/tests/ui/recursion/issue-95134.rs @@ -1,4 +1,3 @@ -// build-fail // known-bug: #95134 // compile-flags: -Copt-level=0 // failure-status: 101 diff --git a/tests/ui/recursion/recursion.rs b/tests/ui/recursion/recursion.rs index b3ba0ec3a2a01..08217bc4e7c29 100644 --- a/tests/ui/recursion/recursion.rs +++ b/tests/ui/recursion/recursion.rs @@ -1,25 +1,39 @@ -// build-fail // compile-flags:-C overflow-checks=off // normalize-stderr-test: ".nll/" -> "/" -enum Nil {NilValue} -struct Cons {head:isize, tail:T} -trait Dot {fn dot(&self, other:Self) -> isize;} +enum Nil { + NilValue, +} +struct Cons { + head: isize, + tail: T, +} +trait Dot { + fn dot(&self, other: Self) -> isize; +} impl Dot for Nil { - fn dot(&self, _:Nil) -> isize {0} + fn dot(&self, _: Nil) -> isize { + 0 + } } -impl Dot for Cons { - fn dot(&self, other:Cons) -> isize { - self.head * other.head + self.tail.dot(other.tail) - } +impl Dot for Cons { + fn dot(&self, other: Cons) -> isize { + self.head * other.head + self.tail.dot(other.tail) + } } -fn test (n:isize, i:isize, first:T, second:T) ->isize { - match n { 0 => {first.dot(second)} - _ => {test (n-1, i+1, Cons {head:2*i+1, tail:first}, Cons{head:i*i, tail:second})} - //~^ ERROR recursion limit - } +fn test(n: isize, i: isize, first: T, second: T) -> isize { + match n { + 0 => first.dot(second), + _ => test( + //~^ ERROR recursion limit + n - 1, + i + 1, + Cons { head: 2 * i + 1, tail: first }, + Cons { head: i * i, tail: second }, + ), + } } pub fn main() { - let n = test(1, 0, Nil::NilValue, Nil::NilValue); - println!("{}", n); + let n = test(1, 0, Nil::NilValue, Nil::NilValue); + println!("{}", n); } diff --git a/tests/ui/recursion/recursion.stderr b/tests/ui/recursion/recursion.stderr index cf08095372b07..2db5e44953615 100644 --- a/tests/ui/recursion/recursion.stderr +++ b/tests/ui/recursion/recursion.stderr @@ -1,14 +1,21 @@ error: reached the recursion limit while instantiating `test::>>>>>` - --> $DIR/recursion.rs:18:11 + --> $DIR/recursion.rs:27:14 | -LL | _ => {test (n-1, i+1, Cons {head:2*i+1, tail:first}, Cons{head:i*i, tail:second})} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | _ => test( + | ______________^ +LL | | +LL | | n - 1, +LL | | i + 1, +LL | | Cons { head: 2 * i + 1, tail: first }, +LL | | Cons { head: i * i, tail: second }, +LL | | ), + | |_________^ | note: `test` defined here - --> $DIR/recursion.rs:16:1 + --> $DIR/recursion.rs:24:1 | -LL | fn test (n:isize, i:isize, first:T, second:T) ->isize { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn test(n: isize, i: isize, first: T, second: T) -> isize { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: the full type name has been written to '$TEST_BUILD_DIR/recursion/recursion/recursion.long-type.txt' error: aborting due to previous error diff --git a/tests/ui/recursion_limit/zero-overflow.rs b/tests/ui/recursion_limit/zero-overflow.rs index 77bd818567608..c220e0ae90e2f 100644 --- a/tests/ui/recursion_limit/zero-overflow.rs +++ b/tests/ui/recursion_limit/zero-overflow.rs @@ -1,6 +1,5 @@ //~ ERROR overflow evaluating the requirement `&mut Self: DispatchFromDyn<&mut RustaceansAreAwesome> //~| HELP consider increasing the recursion limit -// build-fail #![recursion_limit = "0"] diff --git a/tests/ui/simd/type-generic-monomorphisation-empty.rs b/tests/ui/simd/type-generic-monomorphisation-empty.rs index 2bf6641e9c91c..fc0428ac787db 100644 --- a/tests/ui/simd/type-generic-monomorphisation-empty.rs +++ b/tests/ui/simd/type-generic-monomorphisation-empty.rs @@ -1,5 +1,3 @@ -// build-fail - #![feature(repr_simd, platform_intrinsics)] // error-pattern:monomorphising SIMD type `Simd<0>` of zero length diff --git a/tests/ui/simd/type-generic-monomorphisation-non-primitive.rs b/tests/ui/simd/type-generic-monomorphisation-non-primitive.rs index 0bc73b155801e..1bc048f9c964e 100644 --- a/tests/ui/simd/type-generic-monomorphisation-non-primitive.rs +++ b/tests/ui/simd/type-generic-monomorphisation-non-primitive.rs @@ -1,5 +1,3 @@ -// build-fail - #![feature(repr_simd)] struct E; diff --git a/tests/ui/simd/type-generic-monomorphisation-oversized.rs b/tests/ui/simd/type-generic-monomorphisation-oversized.rs index a7dc482f3cb1d..f02936b59e43f 100644 --- a/tests/ui/simd/type-generic-monomorphisation-oversized.rs +++ b/tests/ui/simd/type-generic-monomorphisation-oversized.rs @@ -1,5 +1,3 @@ -// build-fail - #![feature(repr_simd, platform_intrinsics)] // error-pattern:monomorphising SIMD type `Simd<65536>` of length greater than 32768 diff --git a/tests/ui/simd/type-generic-monomorphisation-wide-ptr.rs b/tests/ui/simd/type-generic-monomorphisation-wide-ptr.rs index 3e02b08ce5da2..a356856da5656 100644 --- a/tests/ui/simd/type-generic-monomorphisation-wide-ptr.rs +++ b/tests/ui/simd/type-generic-monomorphisation-wide-ptr.rs @@ -1,5 +1,3 @@ -// build-fail - #![feature(repr_simd)] // error-pattern:monomorphising SIMD type `S<[*mut [u8]; 4]>` with a non-primitive-scalar (integer/float/pointer) element type `*mut [u8]` diff --git a/tests/ui/simd/type-generic-monomorphisation.rs b/tests/ui/simd/type-generic-monomorphisation.rs index 12f9d65d77af0..e29fdfcfe6822 100644 --- a/tests/ui/simd/type-generic-monomorphisation.rs +++ b/tests/ui/simd/type-generic-monomorphisation.rs @@ -1,8 +1,5 @@ -// build-fail - #![feature(repr_simd, platform_intrinsics)] - // error-pattern:monomorphising SIMD type `Simd2` with a non-primitive-scalar (integer/float/pointer) element type `X` struct X(Vec); diff --git a/tests/ui/simd/type-wide-ptr.rs b/tests/ui/simd/type-wide-ptr.rs index 88f62a07ea0d8..07a94d9a72eb6 100644 --- a/tests/ui/simd/type-wide-ptr.rs +++ b/tests/ui/simd/type-wide-ptr.rs @@ -1,5 +1,3 @@ -// build-fail - #![feature(repr_simd)] // error-pattern:monomorphising SIMD type `S` with a non-primitive-scalar (integer/float/pointer) element type `*mut [u8]` diff --git a/tests/ui/sized/recursive-type-2.rs b/tests/ui/sized/recursive-type-2.rs index 7d95417a6ffd9..09b0dfb144494 100644 --- a/tests/ui/sized/recursive-type-2.rs +++ b/tests/ui/sized/recursive-type-2.rs @@ -1,7 +1,8 @@ -// build-fail -//~^ ERROR cycle detected when computing layout of `Foo<()>` +//~ ERROR cycle detected when computing layout of `Foo<()>` -trait A { type Assoc: ?Sized; } +trait A { + type Assoc: ?Sized; +} impl A for () { type Assoc = Foo<()>; diff --git a/tests/ui/sized/recursive-type-2.stderr b/tests/ui/sized/recursive-type-2.stderr index d0e6e9db07e9b..867b2e99b642f 100644 --- a/tests/ui/sized/recursive-type-2.stderr +++ b/tests/ui/sized/recursive-type-2.stderr @@ -3,7 +3,7 @@ error[E0391]: cycle detected when computing layout of `Foo<()>` = note: ...which requires computing layout of `<() as A>::Assoc`... = note: ...which again requires computing layout of `Foo<()>`, completing the cycle note: cycle used when elaborating drops for `main` - --> $DIR/recursive-type-2.rs:11:1 + --> $DIR/recursive-type-2.rs:12:1 | LL | fn main() { | ^^^^^^^^^ diff --git a/tests/ui/specialization/issue-38091-2.rs b/tests/ui/specialization/issue-38091-2.rs index 9ed0b240d0a0f..36cd9ef147a0d 100644 --- a/tests/ui/specialization/issue-38091-2.rs +++ b/tests/ui/specialization/issue-38091-2.rs @@ -1,5 +1,4 @@ -// build-fail -//~^ ERROR overflow evaluating the requirement `i32: Check` +//~ ERROR overflow evaluating the requirement `i32: Check` #![feature(specialization)] //~^ WARN the feature `specialization` is incomplete diff --git a/tests/ui/specialization/issue-38091-2.stderr b/tests/ui/specialization/issue-38091-2.stderr index 5a05f9c270ab9..ceca80f38d570 100644 --- a/tests/ui/specialization/issue-38091-2.stderr +++ b/tests/ui/specialization/issue-38091-2.stderr @@ -1,5 +1,5 @@ warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/issue-38091-2.rs:4:12 + --> $DIR/issue-38091-2.rs:3:12 | LL | #![feature(specialization)] | ^^^^^^^^^^^^^^ @@ -11,7 +11,7 @@ LL | #![feature(specialization)] error[E0275]: overflow evaluating the requirement `i32: Check` | note: required for `i32` to implement `Iterate<'_>` - --> $DIR/issue-38091-2.rs:11:13 + --> $DIR/issue-38091-2.rs:10:13 | LL | impl<'a, T> Iterate<'a> for T | ^^^^^^^^^^^ ^ diff --git a/tests/ui/traits/issue-91949-hangs-on-recursion.rs b/tests/ui/traits/issue-91949-hangs-on-recursion.rs index 6474b2b38e1c0..846cb29b5d804 100644 --- a/tests/ui/traits/issue-91949-hangs-on-recursion.rs +++ b/tests/ui/traits/issue-91949-hangs-on-recursion.rs @@ -1,4 +1,3 @@ -// build-fail // compile-flags: -Zinline-mir=no // error-pattern: overflow evaluating the requirement `(): Sized` // error-pattern: function cannot return without recursing diff --git a/tests/ui/traits/issue-91949-hangs-on-recursion.stderr b/tests/ui/traits/issue-91949-hangs-on-recursion.stderr index 1f18c5daf66e3..3c6335e4f0989 100644 --- a/tests/ui/traits/issue-91949-hangs-on-recursion.stderr +++ b/tests/ui/traits/issue-91949-hangs-on-recursion.stderr @@ -1,5 +1,5 @@ warning: function cannot return without recursing - --> $DIR/issue-91949-hangs-on-recursion.rs:23:1 + --> $DIR/issue-91949-hangs-on-recursion.rs:22:1 | LL | / fn recurse(elements: T) -> Vec LL | | where diff --git a/tests/ui/traits/vtable/vtable-diamond.rs b/tests/ui/traits/vtable/vtable-diamond.rs index dc3c17ac3144b..e2a72d2b31bed 100644 --- a/tests/ui/traits/vtable/vtable-diamond.rs +++ b/tests/ui/traits/vtable/vtable-diamond.rs @@ -1,4 +1,3 @@ -// build-fail #![feature(rustc_attrs)] #[rustc_dump_vtable] diff --git a/tests/ui/traits/vtable/vtable-diamond.stderr b/tests/ui/traits/vtable/vtable-diamond.stderr index f3718c5d852f0..8b7ce298c06d3 100644 --- a/tests/ui/traits/vtable/vtable-diamond.stderr +++ b/tests/ui/traits/vtable/vtable-diamond.stderr @@ -8,7 +8,7 @@ error: vtable entries for ``: [ TraitVPtr(), Method(::foo_d), ] - --> $DIR/vtable-diamond.rs:21:1 + --> $DIR/vtable-diamond.rs:20:1 | LL | trait D: B + C { | ^^^^^^^^^^^^^^ @@ -20,7 +20,7 @@ error: vtable entries for ``: [ Method(::foo_a), Method(::foo_c), ] - --> $DIR/vtable-diamond.rs:15:1 + --> $DIR/vtable-diamond.rs:14:1 | LL | trait C: A { | ^^^^^^^^^^ diff --git a/tests/ui/traits/vtable/vtable-multi-level.rs b/tests/ui/traits/vtable/vtable-multi-level.rs index ebd55bcf39b17..e75702186f5eb 100644 --- a/tests/ui/traits/vtable/vtable-multi-level.rs +++ b/tests/ui/traits/vtable/vtable-multi-level.rs @@ -1,4 +1,3 @@ -// build-fail #![feature(rustc_attrs)] // O --> G --> C --> A @@ -119,9 +118,9 @@ impl O for S {} macro_rules! monomorphize_vtable { ($trait:ident) => {{ - fn foo(_ : &dyn $trait) {} + fn foo(_: &dyn $trait) {} foo(&S); - }} + }}; } fn main() { diff --git a/tests/ui/traits/vtable/vtable-multi-level.stderr b/tests/ui/traits/vtable/vtable-multi-level.stderr index c4389e23fc10f..c9e07a30039c4 100644 --- a/tests/ui/traits/vtable/vtable-multi-level.stderr +++ b/tests/ui/traits/vtable/vtable-multi-level.stderr @@ -29,7 +29,7 @@ error: vtable entries for ``: [ TraitVPtr(), Method(::foo_o), ] - --> $DIR/vtable-multi-level.rs:97:1 + --> $DIR/vtable-multi-level.rs:96:1 | LL | trait O: G + N { | ^^^^^^^^^^^^^^ @@ -40,7 +40,7 @@ error: vtable entries for ``: [ MetadataAlign, Method(::foo_a), ] - --> $DIR/vtable-multi-level.rs:14:1 + --> $DIR/vtable-multi-level.rs:13:1 | LL | trait A { | ^^^^^^^ @@ -51,7 +51,7 @@ error: vtable entries for ``: [ MetadataAlign, Method(::foo_b), ] - --> $DIR/vtable-multi-level.rs:20:1 + --> $DIR/vtable-multi-level.rs:19:1 | LL | trait B { | ^^^^^^^ @@ -65,7 +65,7 @@ error: vtable entries for ``: [ TraitVPtr(), Method(::foo_c), ] - --> $DIR/vtable-multi-level.rs:26:1 + --> $DIR/vtable-multi-level.rs:25:1 | LL | trait C: A + B { | ^^^^^^^^^^^^^^ @@ -76,7 +76,7 @@ error: vtable entries for ``: [ MetadataAlign, Method(::foo_d), ] - --> $DIR/vtable-multi-level.rs:32:1 + --> $DIR/vtable-multi-level.rs:31:1 | LL | trait D { | ^^^^^^^ @@ -87,7 +87,7 @@ error: vtable entries for ``: [ MetadataAlign, Method(::foo_e), ] - --> $DIR/vtable-multi-level.rs:38:1 + --> $DIR/vtable-multi-level.rs:37:1 | LL | trait E { | ^^^^^^^ @@ -101,7 +101,7 @@ error: vtable entries for ``: [ TraitVPtr(), Method(::foo_f), ] - --> $DIR/vtable-multi-level.rs:44:1 + --> $DIR/vtable-multi-level.rs:43:1 | LL | trait F: D + E { | ^^^^^^^^^^^^^^ @@ -112,7 +112,7 @@ error: vtable entries for ``: [ MetadataAlign, Method(::foo_h), ] - --> $DIR/vtable-multi-level.rs:55:1 + --> $DIR/vtable-multi-level.rs:54:1 | LL | trait H { | ^^^^^^^ @@ -123,7 +123,7 @@ error: vtable entries for ``: [ MetadataAlign, Method(::foo_i), ] - --> $DIR/vtable-multi-level.rs:61:1 + --> $DIR/vtable-multi-level.rs:60:1 | LL | trait I { | ^^^^^^^ @@ -137,7 +137,7 @@ error: vtable entries for ``: [ TraitVPtr(), Method(::foo_j), ] - --> $DIR/vtable-multi-level.rs:67:1 + --> $DIR/vtable-multi-level.rs:66:1 | LL | trait J: H + I { | ^^^^^^^^^^^^^^ @@ -148,7 +148,7 @@ error: vtable entries for ``: [ MetadataAlign, Method(::foo_k), ] - --> $DIR/vtable-multi-level.rs:73:1 + --> $DIR/vtable-multi-level.rs:72:1 | LL | trait K { | ^^^^^^^ @@ -159,7 +159,7 @@ error: vtable entries for ``: [ MetadataAlign, Method(::foo_l), ] - --> $DIR/vtable-multi-level.rs:79:1 + --> $DIR/vtable-multi-level.rs:78:1 | LL | trait L { | ^^^^^^^ @@ -173,7 +173,7 @@ error: vtable entries for ``: [ TraitVPtr(), Method(::foo_m), ] - --> $DIR/vtable-multi-level.rs:85:1 + --> $DIR/vtable-multi-level.rs:84:1 | LL | trait M: K + L { | ^^^^^^^^^^^^^^ @@ -194,7 +194,7 @@ error: vtable entries for ``: [ TraitVPtr(), Method(::foo_n), ] - --> $DIR/vtable-multi-level.rs:91:1 + --> $DIR/vtable-multi-level.rs:90:1 | LL | trait N: J + M { | ^^^^^^^^^^^^^^ diff --git a/tests/ui/traits/vtable/vtable-multiple.rs b/tests/ui/traits/vtable/vtable-multiple.rs index 7a0111c5ef251..38d4a43c51ce3 100644 --- a/tests/ui/traits/vtable/vtable-multiple.rs +++ b/tests/ui/traits/vtable/vtable-multiple.rs @@ -1,4 +1,3 @@ -// build-fail #![feature(rustc_attrs)] #[rustc_dump_vtable] diff --git a/tests/ui/traits/vtable/vtable-multiple.stderr b/tests/ui/traits/vtable/vtable-multiple.stderr index 0dcd84433090c..967d7056acd98 100644 --- a/tests/ui/traits/vtable/vtable-multiple.stderr +++ b/tests/ui/traits/vtable/vtable-multiple.stderr @@ -7,7 +7,7 @@ error: vtable entries for ``: [ TraitVPtr(), Method(::foo_c), ] - --> $DIR/vtable-multiple.rs:16:1 + --> $DIR/vtable-multiple.rs:15:1 | LL | trait C: A + B { | ^^^^^^^^^^^^^^ @@ -18,7 +18,7 @@ error: vtable entries for ``: [ MetadataAlign, Method(::foo_b), ] - --> $DIR/vtable-multiple.rs:10:1 + --> $DIR/vtable-multiple.rs:9:1 | LL | trait B { | ^^^^^^^ diff --git a/tests/ui/traits/vtable/vtable-non-object-safe.rs b/tests/ui/traits/vtable/vtable-non-object-safe.rs index 7661bb574613b..87abc778ed1cb 100644 --- a/tests/ui/traits/vtable/vtable-non-object-safe.rs +++ b/tests/ui/traits/vtable/vtable-non-object-safe.rs @@ -1,4 +1,3 @@ -// build-fail #![feature(rustc_attrs)] // Ensure that non-object-safe methods in Iterator does not generate @@ -10,8 +9,7 @@ trait A: Iterator {} impl A for T where T: Iterator {} -fn foo(_a: &mut dyn A) { -} +fn foo(_a: &mut dyn A) {} fn main() { foo(&mut vec![0, 1, 2, 3].into_iter()); diff --git a/tests/ui/traits/vtable/vtable-non-object-safe.stderr b/tests/ui/traits/vtable/vtable-non-object-safe.stderr index 9345c2711978a..e52684949394e 100644 --- a/tests/ui/traits/vtable/vtable-non-object-safe.stderr +++ b/tests/ui/traits/vtable/vtable-non-object-safe.stderr @@ -7,7 +7,7 @@ error: vtable entries for ` as A>`: [ Method( as Iterator>::advance_by), Method( as Iterator>::nth), ] - --> $DIR/vtable-non-object-safe.rs:8:1 + --> $DIR/vtable-non-object-safe.rs:7:1 | LL | trait A: Iterator {} | ^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/traits/vtable/vtable-vacant.rs b/tests/ui/traits/vtable/vtable-vacant.rs index a64796358345f..d6cc284c866a2 100644 --- a/tests/ui/traits/vtable/vtable-vacant.rs +++ b/tests/ui/traits/vtable/vtable-vacant.rs @@ -1,4 +1,3 @@ -// build-fail #![feature(rustc_attrs)] #![feature(negative_impls)] #![allow(where_clauses_object_safety)] @@ -8,14 +7,22 @@ #[rustc_dump_vtable] trait A { fn foo_a1(&self) {} - fn foo_a2(&self) where Self: Send {} + fn foo_a2(&self) + where + Self: Send, + { + } } #[rustc_dump_vtable] trait B: A { //~^ error vtable fn foo_b1(&self) {} - fn foo_b2(&self) where Self: Send {} + fn foo_b2(&self) + where + Self: Send, + { + } } struct S; diff --git a/tests/ui/traits/vtable/vtable-vacant.stderr b/tests/ui/traits/vtable/vtable-vacant.stderr index 5346a70271635..a4d3ad3582d45 100644 --- a/tests/ui/traits/vtable/vtable-vacant.stderr +++ b/tests/ui/traits/vtable/vtable-vacant.stderr @@ -7,7 +7,7 @@ error: vtable entries for ``: [ Method(::foo_b1), Vacant, ] - --> $DIR/vtable-vacant.rs:15:1 + --> $DIR/vtable-vacant.rs:18:1 | LL | trait B: A { | ^^^^^^^^^^ diff --git a/tests/ui/type_length_limit.rs b/tests/ui/type_length_limit.rs index b3c12747414ed..1091a3124bfe8 100644 --- a/tests/ui/type_length_limit.rs +++ b/tests/ui/type_length_limit.rs @@ -1,4 +1,3 @@ -// build-fail // error-pattern: reached the type-length limit while instantiating // compile-flags: -Copt-level=0 // normalize-stderr-test: ".nll/" -> "/" @@ -7,12 +6,12 @@ // The exact type depends on optimizations, so disable them. #![allow(dead_code)] -#![type_length_limit="8"] +#![type_length_limit = "8"] macro_rules! link { ($id:ident, $t:ty) => { pub type $id = ($t, $t, $t); - } + }; } link! { A1, B1 } @@ -27,7 +26,7 @@ link! { D, E } link! { E, F } link! { F, G, Option> } -pub struct G(std::marker::PhantomData::<(T, K)>); +pub struct G(std::marker::PhantomData<(T, K)>); fn main() { drop::>(None);