From 17e934a1918de32f20ab798c455b9234ea9397cf Mon Sep 17 00:00:00 2001 From: Waffle Lapkin Date: Fri, 15 Aug 2025 00:37:33 +0200 Subject: [PATCH 01/18] Set never type fallback to always be `!` --- .../src/collect/type_of/opaque.rs | 4 +--- compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs | 14 ++------------ 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/compiler/rustc_hir_analysis/src/collect/type_of/opaque.rs b/compiler/rustc_hir_analysis/src/collect/type_of/opaque.rs index b31da6b387299..d5ae926d4e314 100644 --- a/compiler/rustc_hir_analysis/src/collect/type_of/opaque.rs +++ b/compiler/rustc_hir_analysis/src/collect/type_of/opaque.rs @@ -263,9 +263,7 @@ pub(super) fn find_opaque_ty_constraints_for_rpit<'tcx>( // resolves to itself. We interpret this as the // no values of the hidden type ever being constructed, // so we can just make the hidden type be `!`. - // For backwards compatibility reasons, we fall back to - // `()` until we the diverging default is changed. - EarlyBinder::bind(tcx.types.unit) + EarlyBinder::bind(tcx.types.never) } } DefiningScopeKind::MirBorrowck => match tcx.mir_borrowck(owner_def_id) { diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs index 873e95f13bb97..7167a3c1a883e 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs @@ -491,24 +491,14 @@ impl<'tcx> LoweredTy<'tcx> { } fn never_type_behavior(tcx: TyCtxt<'_>) -> (DivergingFallbackBehavior, DivergingBlockBehavior) { + // FIXME(waffle): rip out the whole system which allows you to choose never type fallback let (fallback, block) = parse_never_type_options_attr(tcx); - let fallback = fallback.unwrap_or_else(|| default_fallback(tcx)); + let fallback = fallback.unwrap_or_else(|| DivergingFallbackBehavior::ToNever); let block = block.unwrap_or_default(); (fallback, block) } -/// Returns the default fallback which is used when there is no explicit override via `#![never_type_options(...)]`. -fn default_fallback(tcx: TyCtxt<'_>) -> DivergingFallbackBehavior { - // Edition 2024: fallback to `!` - if tcx.sess.edition().at_least_rust_2024() { - return DivergingFallbackBehavior::ToNever; - } - - // Otherwise: fallback to `()` - DivergingFallbackBehavior::ToUnit -} - fn parse_never_type_options_attr( tcx: TyCtxt<'_>, ) -> (Option, Option) { From 85a10be9bd999697f891a37c8eeda27b3ae6743f Mon Sep 17 00:00:00 2001 From: Waffle Lapkin Date: Fri, 15 Aug 2025 02:23:51 +0200 Subject: [PATCH 02/18] stabilize the never type (`!`) --- compiler/rustc_ast_passes/src/feature_gate.rs | 12 ------------ compiler/rustc_feature/src/accepted.rs | 2 ++ compiler/rustc_feature/src/unstable.rs | 2 -- library/core/src/clone.rs | 2 +- library/core/src/cmp.rs | 8 ++++---- library/core/src/error.rs | 2 +- library/core/src/fmt/mod.rs | 4 ++-- library/core/src/marker.rs | 2 +- library/core/src/num/error.rs | 2 +- library/core/src/primitive_docs.rs | 2 +- 10 files changed, 13 insertions(+), 25 deletions(-) diff --git a/compiler/rustc_ast_passes/src/feature_gate.rs b/compiler/rustc_ast_passes/src/feature_gate.rs index 1b615b611258f..e9fd41cabfb0c 100644 --- a/compiler/rustc_ast_passes/src/feature_gate.rs +++ b/compiler/rustc_ast_passes/src/feature_gate.rs @@ -288,9 +288,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { // Function pointers cannot be `const` self.check_late_bound_lifetime_defs(&fn_ptr_ty.generic_params); } - ast::TyKind::Never => { - gate!(self, never_type, ty.span, "the `!` type is experimental"); - } ast::TyKind::Pat(..) => { gate!(self, pattern_types, ty.span, "pattern types are unstable"); } @@ -318,15 +315,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { } fn visit_generic_args(&mut self, args: &'a ast::GenericArgs) { - // This check needs to happen here because the never type can be returned from a function, - // but cannot be used in any other context. If this check was in `visit_fn_ret_ty`, it - // include both functions and generics like `impl Fn() -> !`. - if let ast::GenericArgs::Parenthesized(generic_args) = args - && let ast::FnRetTy::Ty(ref ty) = generic_args.output - && matches!(ty.kind, ast::TyKind::Never) - { - gate!(self, never_type, ty.span, "the `!` type is experimental"); - } visit::walk_generic_args(self, args); } diff --git a/compiler/rustc_feature/src/accepted.rs b/compiler/rustc_feature/src/accepted.rs index 54a935d13c8c1..227db5eb3f387 100644 --- a/compiler/rustc_feature/src/accepted.rs +++ b/compiler/rustc_feature/src/accepted.rs @@ -326,6 +326,8 @@ declare_features! ( (accepted, native_link_modifiers_verbatim, "1.67.0", Some(81490)), /// Allows specifying the whole-archive link modifier (accepted, native_link_modifiers_whole_archive, "1.61.0", Some(81490)), + /// Allows the `!` type. + (accepted, never_type, "CURRENT_RUSTC_VERSION", Some(35121)), /// Allows using non lexical lifetimes (RFC 2094). (accepted, nll, "1.63.0", Some(43234)), /// Allows using `#![no_std]`. diff --git a/compiler/rustc_feature/src/unstable.rs b/compiler/rustc_feature/src/unstable.rs index 859a1ad391cb9..1ddc7aa4c7583 100644 --- a/compiler/rustc_feature/src/unstable.rs +++ b/compiler/rustc_feature/src/unstable.rs @@ -612,8 +612,6 @@ declare_features! ( (unstable, negative_impls, "1.44.0", Some(68318)), /// Allows the `!` pattern. (incomplete, never_patterns, "1.76.0", Some(118155)), - /// Allows the `!` type. Does not imply 'exhaustive_patterns' (below) any more. - (unstable, never_type, "1.13.0", Some(35121)), /// Switch `..` syntax to use the new (`Copy + IntoIterator`) range types. (unstable, new_range, "1.86.0", Some(123741)), /// Allows `#![no_core]`. diff --git a/library/core/src/clone.rs b/library/core/src/clone.rs index 85b09ee06f1fd..5b1d11eb28567 100644 --- a/library/core/src/clone.rs +++ b/library/core/src/clone.rs @@ -631,7 +631,7 @@ mod impls { bool char } - #[unstable(feature = "never_type", issue = "35121")] + #[stable(feature = "never_type", since = "CURRENT_RUSTC_VERSION")] #[rustc_const_unstable(feature = "const_clone", issue = "142757")] impl const Clone for ! { #[inline] diff --git a/library/core/src/cmp.rs b/library/core/src/cmp.rs index 2051a806af642..e963c4898ece4 100644 --- a/library/core/src/cmp.rs +++ b/library/core/src/cmp.rs @@ -2078,7 +2078,7 @@ mod impls { ord_impl! { char usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 } - #[unstable(feature = "never_type", issue = "35121")] + #[stable(feature = "never_type", since = "CURRENT_RUSTC_VERSION")] #[rustc_const_unstable(feature = "const_cmp", issue = "143800")] impl const PartialEq for ! { #[inline] @@ -2087,11 +2087,11 @@ mod impls { } } - #[unstable(feature = "never_type", issue = "35121")] + #[stable(feature = "never_type", since = "CURRENT_RUSTC_VERSION")] #[rustc_const_unstable(feature = "const_cmp", issue = "143800")] impl const Eq for ! {} - #[unstable(feature = "never_type", issue = "35121")] + #[stable(feature = "never_type", since = "CURRENT_RUSTC_VERSION")] #[rustc_const_unstable(feature = "const_cmp", issue = "143800")] impl const PartialOrd for ! { #[inline] @@ -2100,7 +2100,7 @@ mod impls { } } - #[unstable(feature = "never_type", issue = "35121")] + #[stable(feature = "never_type", since = "CURRENT_RUSTC_VERSION")] #[rustc_const_unstable(feature = "const_cmp", issue = "143800")] impl const Ord for ! { #[inline] diff --git a/library/core/src/error.rs b/library/core/src/error.rs index 011d6ac4a1c78..8c9b3e14eb2fa 100644 --- a/library/core/src/error.rs +++ b/library/core/src/error.rs @@ -268,7 +268,7 @@ mod private { pub struct Internal; } -#[unstable(feature = "never_type", issue = "35121")] +#[stable(feature = "never_type", since = "CURRENT_RUSTC_VERSION")] impl Error for ! {} // Copied from `any.rs`. diff --git a/library/core/src/fmt/mod.rs b/library/core/src/fmt/mod.rs index 9e5f693246f33..cfded5faaebda 100644 --- a/library/core/src/fmt/mod.rs +++ b/library/core/src/fmt/mod.rs @@ -2881,7 +2881,7 @@ macro_rules! fmt_refs { fmt_refs! { Debug, Display, Octal, Binary, LowerHex, UpperHex, LowerExp, UpperExp } -#[unstable(feature = "never_type", issue = "35121")] +#[stable(feature = "never_type", since = "CURRENT_RUSTC_VERSION")] impl Debug for ! { #[inline] fn fmt(&self, _: &mut Formatter<'_>) -> Result { @@ -2889,7 +2889,7 @@ impl Debug for ! { } } -#[unstable(feature = "never_type", issue = "35121")] +#[stable(feature = "never_type", since = "CURRENT_RUSTC_VERSION")] impl Display for ! { #[inline] fn fmt(&self, _: &mut Formatter<'_>) -> Result { diff --git a/library/core/src/marker.rs b/library/core/src/marker.rs index e0f8e10484732..7e4b2c9295e56 100644 --- a/library/core/src/marker.rs +++ b/library/core/src/marker.rs @@ -480,7 +480,7 @@ marker_impls! { } -#[unstable(feature = "never_type", issue = "35121")] +#[stable(feature = "never_type", since = "CURRENT_RUSTC_VERSION")] impl Copy for ! {} /// Shared references can be copied, but mutable references *cannot*! diff --git a/library/core/src/num/error.rs b/library/core/src/num/error.rs index 8a353dc0fbe99..66b92a31bc048 100644 --- a/library/core/src/num/error.rs +++ b/library/core/src/num/error.rs @@ -27,7 +27,7 @@ impl const From for TryFromIntError { } } -#[unstable(feature = "never_type", issue = "35121")] +#[stable(feature = "never_type", since = "CURRENT_RUSTC_VERSION")] #[rustc_const_unstable(feature = "const_convert", issue = "143773")] impl const From for TryFromIntError { #[inline] diff --git a/library/core/src/primitive_docs.rs b/library/core/src/primitive_docs.rs index 3a4e1e657a3da..db61aba59277d 100644 --- a/library/core/src/primitive_docs.rs +++ b/library/core/src/primitive_docs.rs @@ -311,7 +311,7 @@ mod prim_bool {} /// [`()`]: prim@unit /// [2024 edition]: /// -#[unstable(feature = "never_type", issue = "35121")] +#[stable(feature = "never_type", since = "CURRENT_RUSTC_VERSION")] mod prim_never {} // Required to make auto trait impls render. From 25141754893c59b399cb0468cd0f9b8a70858fa8 Mon Sep 17 00:00:00 2001 From: Waffle Lapkin Date: Fri, 15 Aug 2025 02:32:46 +0200 Subject: [PATCH 03/18] fixup clippy::empty_enums --- src/tools/clippy/clippy_lints/src/empty_enums.rs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/tools/clippy/clippy_lints/src/empty_enums.rs b/src/tools/clippy/clippy_lints/src/empty_enums.rs index f96854411fe6f..80e5ca2382d1c 100644 --- a/src/tools/clippy/clippy_lints/src/empty_enums.rs +++ b/src/tools/clippy/clippy_lints/src/empty_enums.rs @@ -9,9 +9,6 @@ declare_clippy_lint! { /// Checks for `enum`s with no variants, which therefore are uninhabited types /// (cannot be instantiated). /// - /// As of this writing, the `never_type` is still a nightly-only experimental API. - /// Therefore, this lint is only triggered if `#![feature(never_type)]` is enabled. - /// /// ### Why is this bad? /// * If you only want a type which can’t be instantiated, you should use [`!`] /// (the primitive type "never"), because [`!`] has more extensive compiler support @@ -36,8 +33,6 @@ declare_clippy_lint! { /// /// Use instead: /// ```no_run - /// #![feature(never_type)] - /// /// /// Use the `!` type directly... /// type CannotExist = !; /// @@ -61,8 +56,6 @@ impl LateLintPass<'_> for EmptyEnums { fn check_item(&mut self, cx: &LateContext<'_>, item: &Item<'_>) { if let ItemKind::Enum(.., def) = item.kind && def.variants.is_empty() - // Only suggest the `never_type` if the feature is enabled - && cx.tcx.features().never_type() && !span_contains_cfg(cx, item.span) { span_lint_and_help( From 59e95e24e212f99c888128eac2df25a36bf3016c Mon Sep 17 00:00:00 2001 From: Waffle Lapkin Date: Fri, 15 Aug 2025 02:32:46 +0200 Subject: [PATCH 04/18] remove `#![feature(never_type)]` from the compiler --- compiler/rustc_arena/src/lib.rs | 2 +- compiler/rustc_ast_ir/src/lib.rs | 2 +- compiler/rustc_borrowck/src/lib.rs | 2 +- compiler/rustc_const_eval/src/lib.rs | 2 +- compiler/rustc_data_structures/src/lib.rs | 2 +- compiler/rustc_error_codes/src/error_codes/E0725.md | 5 +++-- compiler/rustc_errors/src/lib.rs | 2 +- compiler/rustc_hir/src/lib.rs | 2 +- compiler/rustc_hir_analysis/src/lib.rs | 2 +- compiler/rustc_hir_typeck/src/lib.rs | 2 +- compiler/rustc_macros/src/lib.rs | 2 +- compiler/rustc_metadata/src/lib.rs | 2 +- compiler/rustc_middle/src/lib.rs | 2 +- compiler/rustc_middle/src/ty/inhabitedness/mod.rs | 4 ++-- compiler/rustc_mir_dataflow/src/lib.rs | 2 +- compiler/rustc_pattern_analysis/src/constructor.rs | 3 +-- compiler/rustc_resolve/src/late.rs | 4 ++-- compiler/rustc_serialize/src/lib.rs | 2 +- compiler/rustc_trait_selection/src/lib.rs | 2 +- compiler/rustc_transmute/src/lib.rs | 2 +- compiler/rustc_ty_utils/src/lib.rs | 2 +- 21 files changed, 25 insertions(+), 25 deletions(-) diff --git a/compiler/rustc_arena/src/lib.rs b/compiler/rustc_arena/src/lib.rs index 97dd21db07e7d..6744ddb7849c6 100644 --- a/compiler/rustc_arena/src/lib.rs +++ b/compiler/rustc_arena/src/lib.rs @@ -10,12 +10,12 @@ // tidy-alphabetical-start #![allow(clippy::mut_from_ref)] // Arena allocators are one place where this pattern is fine. #![allow(internal_features)] +#![cfg_attr(bootstrap, feature(never_type))] #![cfg_attr(test, feature(test))] #![deny(unsafe_op_in_unsafe_fn)] #![doc(test(no_crate_inject, attr(deny(warnings), allow(internal_features))))] #![feature(decl_macro)] #![feature(dropck_eyepatch)] -#![feature(never_type)] #![feature(rustc_attrs)] #![feature(unwrap_infallible)] // tidy-alphabetical-end diff --git a/compiler/rustc_ast_ir/src/lib.rs b/compiler/rustc_ast_ir/src/lib.rs index fb00f5d9b6236..037468bd84d58 100644 --- a/compiler/rustc_ast_ir/src/lib.rs +++ b/compiler/rustc_ast_ir/src/lib.rs @@ -6,8 +6,8 @@ //! `rustc_type_ir` for a single import. // tidy-alphabetical-start +#![cfg_attr(all(feature = "nightly", bootstrap), feature(never_type))] #![cfg_attr(feature = "nightly", allow(internal_features))] -#![cfg_attr(feature = "nightly", feature(never_type))] #![cfg_attr(feature = "nightly", feature(rustc_attrs))] // tidy-alphabetical-end diff --git a/compiler/rustc_borrowck/src/lib.rs b/compiler/rustc_borrowck/src/lib.rs index 114f9d864e735..a41ead41d865d 100644 --- a/compiler/rustc_borrowck/src/lib.rs +++ b/compiler/rustc_borrowck/src/lib.rs @@ -2,11 +2,11 @@ // tidy-alphabetical-start #![allow(internal_features)] +#![cfg_attr(bootstrap, feature(never_type))] #![feature(box_patterns)] #![feature(default_field_values)] #![feature(file_buffered)] #![feature(negative_impls)] -#![feature(never_type)] #![feature(rustc_attrs)] #![feature(stmt_expr_attributes)] #![feature(try_blocks)] diff --git a/compiler/rustc_const_eval/src/lib.rs b/compiler/rustc_const_eval/src/lib.rs index 33da1c5ecf738..cd43aaeef85d3 100644 --- a/compiler/rustc_const_eval/src/lib.rs +++ b/compiler/rustc_const_eval/src/lib.rs @@ -1,8 +1,8 @@ // tidy-alphabetical-start +#![cfg_attr(bootstrap, feature(never_type))] #![feature(array_try_map)] #![feature(box_patterns)] #![feature(decl_macro)] -#![feature(never_type)] #![feature(slice_ptr_get)] #![feature(trait_alias)] #![feature(unqualified_local_imports)] diff --git a/compiler/rustc_data_structures/src/lib.rs b/compiler/rustc_data_structures/src/lib.rs index de086085c4cb2..37448f6cd73e3 100644 --- a/compiler/rustc_data_structures/src/lib.rs +++ b/compiler/rustc_data_structures/src/lib.rs @@ -10,6 +10,7 @@ #![allow(internal_features)] #![allow(rustc::default_hash_types)] #![allow(rustc::potential_query_instability)] +#![cfg_attr(bootstrap, feature(never_type))] #![cfg_attr(test, feature(test))] #![deny(unsafe_op_in_unsafe_fn)] #![feature(allocator_api)] @@ -24,7 +25,6 @@ #![feature(map_try_insert)] #![feature(min_specialization)] #![feature(negative_impls)] -#![feature(never_type)] #![feature(pattern_type_macro)] #![feature(pattern_types)] #![feature(ptr_alignment_type)] diff --git a/compiler/rustc_error_codes/src/error_codes/E0725.md b/compiler/rustc_error_codes/src/error_codes/E0725.md index 9bd321e5f82d6..20019bf59c36a 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0725.md +++ b/compiler/rustc_error_codes/src/error_codes/E0725.md @@ -4,8 +4,9 @@ command line flags. Erroneous code example: ```ignore (can't specify compiler flags from doctests) -#![feature(never_type)] // error: the feature `never_type` is not in - // the list of allowed features +#![feature(extern_item_impls)] +//~^ error: the feature `extern_item_impls` +// is not in the list of allowed features ``` Delete the offending feature attribute, or add it to the list of allowed diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index d17a4d6de42f5..920dcd3a20e52 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -5,11 +5,11 @@ // tidy-alphabetical-start #![allow(internal_features)] #![allow(rustc::direct_use_of_rustc_type_ir)] +#![cfg_attr(bootstrap, feature(never_type))] #![feature(associated_type_defaults)] #![feature(default_field_values)] #![feature(macro_metavar_expr_concat)] #![feature(negative_impls)] -#![feature(never_type)] #![feature(rustc_attrs)] // tidy-alphabetical-end diff --git a/compiler/rustc_hir/src/lib.rs b/compiler/rustc_hir/src/lib.rs index c2d9f879cd601..2a7500629243c 100644 --- a/compiler/rustc_hir/src/lib.rs +++ b/compiler/rustc_hir/src/lib.rs @@ -3,13 +3,13 @@ //! [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/hir.html // tidy-alphabetical-start +#![cfg_attr(bootstrap, feature(never_type))] #![feature(associated_type_defaults)] #![feature(closure_track_caller)] #![feature(const_default)] #![feature(const_trait_impl)] #![feature(derive_const)] #![feature(exhaustive_patterns)] -#![feature(never_type)] #![feature(variant_count)] #![recursion_limit = "256"] // tidy-alphabetical-end diff --git a/compiler/rustc_hir_analysis/src/lib.rs b/compiler/rustc_hir_analysis/src/lib.rs index 937bcee01161e..48a469e8e0aa6 100644 --- a/compiler/rustc_hir_analysis/src/lib.rs +++ b/compiler/rustc_hir_analysis/src/lib.rs @@ -56,10 +56,10 @@ This API is completely unstable and subject to change. */ // tidy-alphabetical-start +#![cfg_attr(bootstrap, feature(never_type))] #![feature(default_field_values)] #![feature(gen_blocks)] #![feature(iter_intersperse)] -#![feature(never_type)] #![feature(slice_partition_dedup)] #![feature(try_blocks)] #![feature(unwrap_infallible)] diff --git a/compiler/rustc_hir_typeck/src/lib.rs b/compiler/rustc_hir_typeck/src/lib.rs index fe8a9a9fb4f73..54cf04601637a 100644 --- a/compiler/rustc_hir_typeck/src/lib.rs +++ b/compiler/rustc_hir_typeck/src/lib.rs @@ -1,8 +1,8 @@ // tidy-alphabetical-start +#![cfg_attr(bootstrap, feature(never_type))] #![feature(box_patterns)] #![feature(iter_intersperse)] #![feature(iter_order_by)] -#![feature(never_type)] #![feature(trim_prefix_suffix)] // tidy-alphabetical-end diff --git a/compiler/rustc_macros/src/lib.rs b/compiler/rustc_macros/src/lib.rs index 44969908b3f41..1e259fe1d1e39 100644 --- a/compiler/rustc_macros/src/lib.rs +++ b/compiler/rustc_macros/src/lib.rs @@ -1,6 +1,6 @@ // tidy-alphabetical-start #![allow(rustc::default_hash_types)] -#![feature(never_type)] +#![cfg_attr(bootstrap, feature(never_type))] #![feature(proc_macro_diagnostic)] #![feature(proc_macro_tracked_env)] // tidy-alphabetical-end diff --git a/compiler/rustc_metadata/src/lib.rs b/compiler/rustc_metadata/src/lib.rs index 1dff5740ab3bc..e60473f339870 100644 --- a/compiler/rustc_metadata/src/lib.rs +++ b/compiler/rustc_metadata/src/lib.rs @@ -1,11 +1,11 @@ // tidy-alphabetical-start #![allow(internal_features)] +#![cfg_attr(bootstrap, feature(never_type))] #![feature(error_iter)] #![feature(file_buffered)] #![feature(gen_blocks)] #![feature(macro_metavar_expr)] #![feature(min_specialization)] -#![feature(never_type)] #![feature(proc_macro_internals)] #![feature(result_option_map_or_default)] #![feature(strip_circumfix)] diff --git a/compiler/rustc_middle/src/lib.rs b/compiler/rustc_middle/src/lib.rs index c8702c42c47f6..7560f1825c8a7 100644 --- a/compiler/rustc_middle/src/lib.rs +++ b/compiler/rustc_middle/src/lib.rs @@ -27,6 +27,7 @@ // tidy-alphabetical-start #![allow(internal_features)] #![allow(rustc::direct_use_of_rustc_type_ir)] +#![cfg_attr(bootstrap, feature(never_type))] #![cfg_attr(doc, feature(intra_doc_pointers))] #![feature(allocator_api)] #![feature(associated_type_defaults)] @@ -44,7 +45,6 @@ #![feature(gen_blocks)] #![feature(min_specialization)] #![feature(negative_impls)] -#![feature(never_type)] #![feature(ptr_alignment_type)] #![feature(range_bounds_is_empty)] #![feature(rustc_attrs)] diff --git a/compiler/rustc_middle/src/ty/inhabitedness/mod.rs b/compiler/rustc_middle/src/ty/inhabitedness/mod.rs index 5bb11c9175029..55861303e4bc2 100644 --- a/compiler/rustc_middle/src/ty/inhabitedness/mod.rs +++ b/compiler/rustc_middle/src/ty/inhabitedness/mod.rs @@ -5,7 +5,7 @@ //! //! # Example //! ```rust -//! #![feature(never_type)] +#![cfg_attr(bootstrap, doc = "#![feature(never_type)]")] //! mod a { //! pub mod b { //! pub struct SecretlyUninhabited { @@ -135,7 +135,7 @@ impl<'tcx> Ty<'tcx> { /// /// # Example /// ``` - /// #![feature(never_type)] + #[cfg_attr(bootstrap, doc = "#![feature(never_type)]")] /// # fn main() {} /// enum Void {} /// mod a { diff --git a/compiler/rustc_mir_dataflow/src/lib.rs b/compiler/rustc_mir_dataflow/src/lib.rs index c5026c1c92aa6..5f7d799def7fc 100644 --- a/compiler/rustc_mir_dataflow/src/lib.rs +++ b/compiler/rustc_mir_dataflow/src/lib.rs @@ -1,9 +1,9 @@ // tidy-alphabetical-start +#![cfg_attr(bootstrap, feature(never_type))] #![feature(associated_type_defaults)] #![feature(box_patterns)] #![feature(exact_size_is_empty)] #![feature(file_buffered)] -#![feature(never_type)] #![feature(try_blocks)] // tidy-alphabetical-end diff --git a/compiler/rustc_pattern_analysis/src/constructor.rs b/compiler/rustc_pattern_analysis/src/constructor.rs index 12f653a13371d..b6af2eb447533 100644 --- a/compiler/rustc_pattern_analysis/src/constructor.rs +++ b/compiler/rustc_pattern_analysis/src/constructor.rs @@ -94,7 +94,6 @@ //! constructors of a type. For example, all the following is ok: //! //! ```rust,ignore(example) -//! # #![feature(never_type)] //! # #![feature(exhaustive_patterns)] //! fn foo(x: Option) { //! match x { @@ -114,8 +113,8 @@ //! Moreover, take the following: //! //! ```rust -//! # #![feature(never_type)] //! # #![feature(exhaustive_patterns)] +#![cfg_attr(bootstrap, doc = "#![feature(never_type)]")] //! # let x = None::; //! match x { //! None => {} diff --git a/compiler/rustc_resolve/src/late.rs b/compiler/rustc_resolve/src/late.rs index b3a6fe95e5fa6..30ff495ef42da 100644 --- a/compiler/rustc_resolve/src/late.rs +++ b/compiler/rustc_resolve/src/late.rs @@ -3900,8 +3900,8 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { /// A never pattern by definition indicates an unreachable case. For example, matching on /// `Result` could look like: /// ```rust - /// # #![feature(never_type)] /// # #![feature(never_patterns)] + #[cfg_attr(bootstrap, doc = "#![feature(never_type)]")] /// # fn bar(_x: u32) {} /// let foo: Result = Ok(0); /// match foo { @@ -3966,8 +3966,8 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { /// A never pattern by definition indicates an unreachable case. For example, destructuring a /// `Result` could look like: /// ```rust - /// # #![feature(never_type)] /// # #![feature(never_patterns)] + #[cfg_attr(bootstrap, doc = "#![feature(never_type)]")] /// # fn foo() -> Result { Ok(true) } /// let (Ok(x) | Err(&!)) = foo(); /// # let _ = x; diff --git a/compiler/rustc_serialize/src/lib.rs b/compiler/rustc_serialize/src/lib.rs index f4c7e5519536b..57cdb274be6f8 100644 --- a/compiler/rustc_serialize/src/lib.rs +++ b/compiler/rustc_serialize/src/lib.rs @@ -3,10 +3,10 @@ // tidy-alphabetical-start #![allow(internal_features)] #![allow(rustc::internal)] +#![cfg_attr(bootstrap, feature(never_type))] #![doc(test(attr(allow(unused_variables), deny(warnings), allow(internal_features))))] #![feature(core_intrinsics)] #![feature(min_specialization)] -#![feature(never_type)] #![feature(sized_hierarchy)] // tidy-alphabetical-end diff --git a/compiler/rustc_trait_selection/src/lib.rs b/compiler/rustc_trait_selection/src/lib.rs index f0c67e4b4f89c..a23bbe3535424 100644 --- a/compiler/rustc_trait_selection/src/lib.rs +++ b/compiler/rustc_trait_selection/src/lib.rs @@ -11,13 +11,13 @@ //! This API is completely unstable and subject to change. // tidy-alphabetical-start +#![cfg_attr(bootstrap, feature(never_type))] #![feature(associated_type_defaults)] #![feature(box_patterns)] #![feature(default_field_values)] #![feature(hash_set_entry)] #![feature(iter_intersperse)] #![feature(iterator_try_reduce)] -#![feature(never_type)] #![feature(strip_circumfix)] #![feature(try_blocks)] #![feature(unwrap_infallible)] diff --git a/compiler/rustc_transmute/src/lib.rs b/compiler/rustc_transmute/src/lib.rs index 732881f12d2cb..3f4d1967faef6 100644 --- a/compiler/rustc_transmute/src/lib.rs +++ b/compiler/rustc_transmute/src/lib.rs @@ -1,6 +1,6 @@ // tidy-alphabetical-start +#![cfg_attr(bootstrap, feature(never_type))] #![cfg_attr(test, feature(test))] -#![feature(never_type)] // tidy-alphabetical-end pub(crate) use rustc_data_structures::fx::{FxIndexMap as Map, FxIndexSet as Set}; diff --git a/compiler/rustc_ty_utils/src/lib.rs b/compiler/rustc_ty_utils/src/lib.rs index 5f42a134ec9af..3d2e7759b3a6a 100644 --- a/compiler/rustc_ty_utils/src/lib.rs +++ b/compiler/rustc_ty_utils/src/lib.rs @@ -5,10 +5,10 @@ //! This API is completely unstable and subject to change. // tidy-alphabetical-start +#![cfg_attr(bootstrap, feature(never_type))] #![feature(associated_type_defaults)] #![feature(box_patterns)] #![feature(iterator_try_collect)] -#![feature(never_type)] // tidy-alphabetical-end use rustc_middle::query::Providers; From ff4f9faf6ee9b034dad8f14a0a1ebf07a1b70c25 Mon Sep 17 00:00:00 2001 From: Waffle Lapkin Date: Fri, 15 Aug 2025 02:32:46 +0200 Subject: [PATCH 05/18] remove `#![feature(never_type)]` from tests --- tests/codegen-llvm/enum/enum-debug-niche-2.rs | 1 - tests/mir-opt/building/eq_never_type.rs | 1 - tests/mir-opt/gvn_uninhabited.rs | 2 - tests/mir-opt/issue_72181_1.rs | 1 - tests/mir-opt/remove_never_const.rs | 2 - tests/mir-opt/ssa_unreachable_116212.rs | 2 - tests/mir-opt/uninhabited_enum.rs | 1 - tests/mir-opt/uninhabited_not_read.rs | 2 - tests/pretty/never-pattern.pp | 1 - tests/pretty/never-pattern.rs | 1 - .../intra-doc/prim-associated-traits.rs | 1 - tests/rustdoc-js/hof.rs | 2 - tests/rustdoc-js/never-search.rs | 2 - .../rustdoc-json/primitives/primitive_type.rs | 2 - tests/ui/asm/aarch64/type-check-2-2.rs | 2 +- tests/ui/asm/aarch64/type-check-2.rs | 2 +- tests/ui/asm/noreturn.rs | 1 - tests/ui/asm/x86_64/type-check-5.rs | 2 - tests/ui/binding/empty-types-in-patterns.rs | 10 +- tests/ui/borrowck/assign-never-type.rs | 4 +- tests/ui/borrowck/suggest-assign-rvalue.rs | 1 - .../match/pattern-matching-should-fail.rs | 2 - .../migrations/mir_calls_to_shims.fixed | 1 - .../migrations/mir_calls_to_shims.rs | 1 - .../only-inhabited-variant.rs | 1 - .../coercion/coerce-issue-49593-box-never.rs | 2 - tests/ui/coercion/coerce-to-bang-cast.rs | 2 - .../min_const_generics/complex-types.rs | 2 - tests/ui/consts/assert-type-intrinsics.rs | 1 - .../index-out-of-bounds-never-type.rs | 1 - .../const-eval/panic-assoc-never-type.rs | 1 - .../ui/consts/const-eval/panic-never-type.rs | 1 - tests/ui/consts/const-eval/raw-bytes.rs | 2 +- tests/ui/consts/const-eval/ub-enum.rs | 1 - tests/ui/consts/const-eval/ub-uninhabit.rs | 1 - tests/ui/consts/const-variant-count.rs | 1 - .../consts/extra-const-ub/detect-extra-ub.rs | 1 - .../let-irrefutable-pattern-ice-120337.rs | 1 - tests/ui/consts/validate_never_arrays.rs | 1 - tests/ui/coroutine/issue-93161.rs | 2 - tests/ui/coroutine/uninhabited-field.rs | 1 - .../feature-gate-exhaustive-patterns.rs | 2 - .../feature-gates/feature-gate-never_type.rs | 71 --------- .../feature-gate-never_type.stderr | 103 ------------ .../for-loop-while/break-while-condition.rs | 17 +- tests/ui/for-loop-while/loop-break-value.rs | 21 +-- .../intrinsics/panic-uninitialized-zeroed.rs | 146 +++++++++--------- tests/ui/layout/debug.rs | 2 +- tests/ui/layout/enum-scalar-pair-int-ptr.rs | 1 - tests/ui/layout/enum.rs | 13 +- tests/ui/layout/hexagon-enum.rs | 2 +- tests/ui/layout/struct.rs | 1 - tests/ui/layout/thumb-enum.rs | 2 +- tests/ui/lifetimes/issue-54378.rs | 2 - tests/ui/lint/invalid_value.rs | 2 +- .../unused-language-features.rs | 5 +- tests/ui/lint/unused/must-use-ops.rs | 1 - .../must_use-result-unit-uninhabited.rs | 1 - tests/ui/lint/unused/must_use-unit.rs | 1 - .../loops/loop-break-never-type-mismatch.rs | 2 - tests/ui/loops/loop-break-value.rs | 2 - tests/ui/mir/enum/wrap_break.rs | 1 - tests/ui/mir/mir_calls_to_shims.rs | 1 - tests/ui/never_type/basic/adjust_never.rs | 2 - tests/ui/never_type/basic/auto-traits.rs | 1 - .../basic/call-fn-never-arg-wrong-type.rs | 2 - .../ui/never_type/basic/call-fn-never-arg.rs | 1 - tests/ui/never_type/basic/cast-never.rs | 2 - tests/ui/never_type/basic/impl-for-never.rs | 3 - .../basic/never-assign-wrong-type.rs | 2 - .../never_type/basic/never-associated-type.rs | 2 - tests/ui/never_type/basic/never-result.rs | 1 - tests/ui/never_type/basic/never-type-arg.rs | 2 - .../ui/never_type/basic/never-type-rvalues.rs | 1 - .../never_type/basic/never_transmute_never.rs | 1 - tests/ui/never_type/diverging-place-match.rs | 2 - tests/ui/never_type/empty-never-array.rs | 2 - tests/ui/never_type/exhaustive_patterns.rs | 2 - .../try-block-never-type-fallback.rs | 1 - .../never_type/never-from-impl-is-reserved.rs | 2 - tests/ui/never_type/regress/eq-never-types.rs | 2 - .../never-as-spec-default-associated-type.rs | 2 +- .../never_type/regress/never-in-range-pat.rs | 2 - .../regress/span-bug-issue-121445.rs | 2 - .../usefulness/always-inhabited-union-ref.rs | 1 - .../usefulness/empty-match-check-notes.rs | 1 - tests/ui/pattern/usefulness/empty-match.rs | 1 - tests/ui/pattern/usefulness/empty-types.rs | 1 - .../usefulness/explain-unreachable-pats.rs | 1 - tests/ui/pattern/usefulness/impl-trait.rs | 1 - .../usefulness/match-privately-empty.rs | 1 - tests/ui/pattern/usefulness/slice_of_empty.rs | 1 - tests/ui/pattern/usefulness/uninhabited.rs | 1 - tests/ui/print_type_sizes/uninhabited.rs | 2 - .../raw-ref-op/never-place-isnt-diverging.rs | 2 - tests/ui/reachable/expr_add.rs | 1 - tests/ui/reachable/expr_assign.rs | 1 - tests/ui/reachable/expr_call.rs | 1 - tests/ui/reachable/expr_method.rs | 1 - tests/ui/reachable/expr_type.rs | 2 +- tests/ui/reachable/expr_unary.rs | 1 - tests/ui/reachable/nested_type_ascription.rs | 1 - tests/ui/reachable/never-assign-dead-code.rs | 1 - .../ui/reachable/type_ascribe_never_field.rs | 1 - tests/ui/reachable/unreachable-try-pattern.rs | 2 +- tests/ui/reachable/unwarned-match-on-never.rs | 2 - ...ICE-133063-never-arm-no-otherwise-block.rs | 1 - .../ICE-133117-duplicate-never-arm.rs | 1 - .../never-pattern-is-a-read.rs | 3 +- .../uninhabited/auxiliary/uninhabited.rs | 1 - .../uninhabited/coercions.rs | 1 - .../uninhabited/coercions_same_crate.rs | 2 - .../uninhabited/indirect_match.rs | 1 - .../uninhabited/indirect_match_same_crate.rs | 1 - ...indirect_match_with_exhaustive_patterns.rs | 1 - ...tch_with_exhaustive_patterns_same_crate.rs | 1 - .../issue-65157-repeated-match-arm.rs | 1 - .../uninhabited/match.rs | 1 - .../uninhabited/match_same_crate.rs | 1 - .../match_with_exhaustive_patterns.rs | 1 - ...tch_with_exhaustive_patterns_same_crate.rs | 1 - .../uninhabited/patterns_same_crate.rs | 1 - .../illformed-element-type.rs | 1 - tests/ui/statics/uninhabited-static.rs | 2 - tests/ui/structs-enums/type-sizes.rs | 1 - tests/ui/symbol-names/types.rs | 1 - tests/ui/traits/const-traits/const-drop.rs | 1 - .../typeck/resolve-before-checking-never.rs | 2 - tests/ui/transmutability/char.rs | 1 - tests/ui/uninhabited/projection.rs | 2 +- .../ui/uninhabited/uninhabited-irrefutable.rs | 1 - tests/ui/uninhabited/uninhabited-patterns.rs | 1 - .../uninhabited/uninhabited-unstable-field.rs | 1 - tests/ui/unpretty/exhaustive.expanded.stdout | 1 - tests/ui/unpretty/exhaustive.rs | 1 - 135 files changed, 113 insertions(+), 454 deletions(-) delete mode 100644 tests/ui/feature-gates/feature-gate-never_type.rs delete mode 100644 tests/ui/feature-gates/feature-gate-never_type.stderr diff --git a/tests/codegen-llvm/enum/enum-debug-niche-2.rs b/tests/codegen-llvm/enum/enum-debug-niche-2.rs index 80a4081f15b10..fd9c18583f375 100644 --- a/tests/codegen-llvm/enum/enum-debug-niche-2.rs +++ b/tests/codegen-llvm/enum/enum-debug-niche-2.rs @@ -7,7 +7,6 @@ // CHECK: {{.*}}DICompositeType{{.*}}tag: DW_TAG_variant_part,{{.*}}size: 32,{{.*}} // CHECK: {{.*}}DIDerivedType{{.*}}tag: DW_TAG_member,{{.*}}name: "Placeholder",{{.*}}extraData: i32 -1{{[,)].*}} // CHECK: {{.*}}DIDerivedType{{.*}}tag: DW_TAG_member,{{.*}}name: "Error",{{.*}}extraData: i32 0{{[,)].*}} -#![feature(never_type)] #[derive(Copy, Clone)] pub struct Entity { diff --git a/tests/mir-opt/building/eq_never_type.rs b/tests/mir-opt/building/eq_never_type.rs index 486e2f9fb8dfa..b5037a1eed15b 100644 --- a/tests/mir-opt/building/eq_never_type.rs +++ b/tests/mir-opt/building/eq_never_type.rs @@ -1,6 +1,5 @@ //@ compile-flags: -Zmir-opt-level=0 // skip-filecheck -#![feature(never_type)] #![allow(unreachable_code)] // EMIT_MIR eq_never_type._f.built.after.mir diff --git a/tests/mir-opt/gvn_uninhabited.rs b/tests/mir-opt/gvn_uninhabited.rs index 015949c5d20b9..f3a4157628e63 100644 --- a/tests/mir-opt/gvn_uninhabited.rs +++ b/tests/mir-opt/gvn_uninhabited.rs @@ -3,8 +3,6 @@ // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // skip-filecheck -#![feature(never_type)] - #[derive(Copy, Clone)] pub enum E { A(!, u32), diff --git a/tests/mir-opt/issue_72181_1.rs b/tests/mir-opt/issue_72181_1.rs index 5c8346166aec0..6dbb61444b388 100644 --- a/tests/mir-opt/issue_72181_1.rs +++ b/tests/mir-opt/issue_72181_1.rs @@ -2,7 +2,6 @@ //@ compile-flags: -Z mir-opt-level=1 // Regression test for #72181, this ICE requires `-Z mir-opt-level=1` flags. -#![feature(never_type)] #![allow(unused, invalid_value)] enum Void {} diff --git a/tests/mir-opt/remove_never_const.rs b/tests/mir-opt/remove_never_const.rs index 81562058d808f..e9ea5ea3dc715 100644 --- a/tests/mir-opt/remove_never_const.rs +++ b/tests/mir-opt/remove_never_const.rs @@ -3,8 +3,6 @@ // consts in codegen. We also have tests for this that catches the error, see // tests/ui/consts/const-eval/index-out-of-bounds-never-type.rs. -#![feature(never_type)] - struct PrintName(T); impl PrintName { diff --git a/tests/mir-opt/ssa_unreachable_116212.rs b/tests/mir-opt/ssa_unreachable_116212.rs index 9f1cf223e2635..0a4d6d45777d6 100644 --- a/tests/mir-opt/ssa_unreachable_116212.rs +++ b/tests/mir-opt/ssa_unreachable_116212.rs @@ -1,8 +1,6 @@ // skip-filecheck // Regression test for issue #116212. -#![feature(never_type)] - use std::mem::MaybeUninit; struct Foo { diff --git a/tests/mir-opt/uninhabited_enum.rs b/tests/mir-opt/uninhabited_enum.rs index 124693c0fe2cc..2409703f7bd52 100644 --- a/tests/mir-opt/uninhabited_enum.rs +++ b/tests/mir-opt/uninhabited_enum.rs @@ -2,7 +2,6 @@ // // check that we mark blocks with `!` locals as unreachable. // (and currently don't do the same for other uninhabited types) -#![feature(never_type)] #[derive(Copy, Clone)] pub enum Void {} diff --git a/tests/mir-opt/uninhabited_not_read.rs b/tests/mir-opt/uninhabited_not_read.rs index 4c80f5e55c684..cfb2079108894 100644 --- a/tests/mir-opt/uninhabited_not_read.rs +++ b/tests/mir-opt/uninhabited_not_read.rs @@ -5,8 +5,6 @@ // This would introduce a `! -> ()` coercion which would // be UB if we didn't disallow this explicitly. -#![feature(never_type)] - // EMIT_MIR uninhabited_not_read.main.SimplifyLocals-final.after.mir fn main() { // With a type annotation diff --git a/tests/pretty/never-pattern.pp b/tests/pretty/never-pattern.pp index bb95a1ed442a4..133a636ecdc40 100644 --- a/tests/pretty/never-pattern.pp +++ b/tests/pretty/never-pattern.pp @@ -6,7 +6,6 @@ #![allow(incomplete_features)] #![feature(never_patterns)] -#![feature(never_type)] extern crate std; #[prelude_import] use ::std::prelude::rust_2015::*; diff --git a/tests/pretty/never-pattern.rs b/tests/pretty/never-pattern.rs index fe170bafc666a..ea9aaaa10514f 100644 --- a/tests/pretty/never-pattern.rs +++ b/tests/pretty/never-pattern.rs @@ -4,7 +4,6 @@ #![allow(incomplete_features)] #![feature(never_patterns)] -#![feature(never_type)] fn f(x: Result) { _ = match x { diff --git a/tests/rustdoc-html/intra-doc/prim-associated-traits.rs b/tests/rustdoc-html/intra-doc/prim-associated-traits.rs index 41a3931222fc1..12fe8b9d41bfd 100644 --- a/tests/rustdoc-html/intra-doc/prim-associated-traits.rs +++ b/tests/rustdoc-html/intra-doc/prim-associated-traits.rs @@ -1,4 +1,3 @@ -#![feature(never_type)] use std::str::FromStr; //@ has 'prim_associated_traits/struct.Number.html' '//a[@href="{{channel}}/std/primitive.f64.html#method.from_str"]' 'f64::from_str()' diff --git a/tests/rustdoc-js/hof.rs b/tests/rustdoc-js/hof.rs index e4d550250e8ad..375d12e1adf78 100644 --- a/tests/rustdoc-js/hof.rs +++ b/tests/rustdoc-js/hof.rs @@ -1,5 +1,3 @@ -#![feature(never_type)] - pub struct First(T); pub struct Second(T); pub struct Third(T); diff --git a/tests/rustdoc-js/never-search.rs b/tests/rustdoc-js/never-search.rs index 800f9ead8b35f..57175bc1a2a6d 100644 --- a/tests/rustdoc-js/never-search.rs +++ b/tests/rustdoc-js/never-search.rs @@ -1,5 +1,3 @@ -#![feature(never_type)] - #[allow(nonstandard_style)] pub struct never; diff --git a/tests/rustdoc-json/primitives/primitive_type.rs b/tests/rustdoc-json/primitives/primitive_type.rs index a0d34218b805d..ff9bdc0c173bf 100644 --- a/tests/rustdoc-json/primitives/primitive_type.rs +++ b/tests/rustdoc-json/primitives/primitive_type.rs @@ -1,5 +1,3 @@ -#![feature(never_type)] - //@ is "$.index[?(@.name=='PrimNever')].visibility" \"public\" //@ is "$.index[?(@.name=='PrimNever')].inner.type_alias.type.primitive" \"never\" pub type PrimNever = !; diff --git a/tests/ui/asm/aarch64/type-check-2-2.rs b/tests/ui/asm/aarch64/type-check-2-2.rs index 4b8ee1d922986..d729212c4d06a 100644 --- a/tests/ui/asm/aarch64/type-check-2-2.rs +++ b/tests/ui/asm/aarch64/type-check-2-2.rs @@ -1,6 +1,6 @@ //@ only-aarch64 -#![feature(repr_simd, never_type)] +#![feature(repr_simd)] use std::arch::{asm, global_asm}; diff --git a/tests/ui/asm/aarch64/type-check-2.rs b/tests/ui/asm/aarch64/type-check-2.rs index ad223b799b786..0faa6d904a5ce 100644 --- a/tests/ui/asm/aarch64/type-check-2.rs +++ b/tests/ui/asm/aarch64/type-check-2.rs @@ -1,6 +1,6 @@ //@ only-aarch64 -#![feature(repr_simd, never_type)] +#![feature(repr_simd)] use std::arch::{asm, global_asm}; diff --git a/tests/ui/asm/noreturn.rs b/tests/ui/asm/noreturn.rs index 5351d4bc47332..59794275d02bd 100644 --- a/tests/ui/asm/noreturn.rs +++ b/tests/ui/asm/noreturn.rs @@ -2,7 +2,6 @@ //@ check-pass //@ reference: asm.options.supported-options.noreturn -#![feature(never_type)] #![crate_type = "rlib"] use std::arch::asm; diff --git a/tests/ui/asm/x86_64/type-check-5.rs b/tests/ui/asm/x86_64/type-check-5.rs index 81e096a72300a..f181fe44a3f12 100644 --- a/tests/ui/asm/x86_64/type-check-5.rs +++ b/tests/ui/asm/x86_64/type-check-5.rs @@ -1,7 +1,5 @@ //@ only-x86_64 -#![feature(never_type)] - use std::arch::asm; fn main() { diff --git a/tests/ui/binding/empty-types-in-patterns.rs b/tests/ui/binding/empty-types-in-patterns.rs index c6765a1cecef5..06cfec20e1553 100644 --- a/tests/ui/binding/empty-types-in-patterns.rs +++ b/tests/ui/binding/empty-types-in-patterns.rs @@ -1,9 +1,7 @@ //@ run-pass //@ edition: 2024 -#![feature(never_type)] #![feature(exhaustive_patterns)] - #![allow(unreachable_patterns)] #![allow(unreachable_code)] #![allow(unused_variables)] @@ -25,13 +23,13 @@ fn foo(z: !) { fn bar(nevers: &[!]) { match nevers { - &[] => (), + &[] => (), }; match nevers { - &[] => (), - &[_] => (), - &[_, _, _, ..] => (), + &[] => (), + &[_] => (), + &[_, _, _, ..] => (), }; } diff --git a/tests/ui/borrowck/assign-never-type.rs b/tests/ui/borrowck/assign-never-type.rs index 17993bfc08f47..ee4ab9b4b8aaf 100644 --- a/tests/ui/borrowck/assign-never-type.rs +++ b/tests/ui/borrowck/assign-never-type.rs @@ -2,13 +2,11 @@ //@ check-pass -#![feature(never_type)] - pub fn main() { loop { match None { None => return, Some(val) => val, }; - }; + } } diff --git a/tests/ui/borrowck/suggest-assign-rvalue.rs b/tests/ui/borrowck/suggest-assign-rvalue.rs index aaca9d47f0aee..66acbf7235b7f 100644 --- a/tests/ui/borrowck/suggest-assign-rvalue.rs +++ b/tests/ui/borrowck/suggest-assign-rvalue.rs @@ -1,5 +1,4 @@ #![allow(dead_code)] -#![feature(never_type)] #[derive(Debug, Default)] struct Demo {} diff --git a/tests/ui/closures/2229_closure_analysis/match/pattern-matching-should-fail.rs b/tests/ui/closures/2229_closure_analysis/match/pattern-matching-should-fail.rs index 377b1ab10c4b2..592ca5a6a4a8b 100644 --- a/tests/ui/closures/2229_closure_analysis/match/pattern-matching-should-fail.rs +++ b/tests/ui/closures/2229_closure_analysis/match/pattern-matching-should-fail.rs @@ -1,7 +1,5 @@ //@ edition:2021 -#![feature(never_type)] - // Should fake read the discriminant and throw an error fn test1() { let x: !; diff --git a/tests/ui/closures/2229_closure_analysis/migrations/mir_calls_to_shims.fixed b/tests/ui/closures/2229_closure_analysis/migrations/mir_calls_to_shims.fixed index 6b73969d1e9ce..a27ea41a6bc74 100644 --- a/tests/ui/closures/2229_closure_analysis/migrations/mir_calls_to_shims.fixed +++ b/tests/ui/closures/2229_closure_analysis/migrations/mir_calls_to_shims.fixed @@ -5,7 +5,6 @@ #![deny(rust_2021_incompatible_closure_captures)] //~^ NOTE: the lint level is defined here #![feature(fn_traits)] -#![feature(never_type)] use std::panic; diff --git a/tests/ui/closures/2229_closure_analysis/migrations/mir_calls_to_shims.rs b/tests/ui/closures/2229_closure_analysis/migrations/mir_calls_to_shims.rs index 9fdbf7c20a80e..609727e975c94 100644 --- a/tests/ui/closures/2229_closure_analysis/migrations/mir_calls_to_shims.rs +++ b/tests/ui/closures/2229_closure_analysis/migrations/mir_calls_to_shims.rs @@ -5,7 +5,6 @@ #![deny(rust_2021_incompatible_closure_captures)] //~^ NOTE: the lint level is defined here #![feature(fn_traits)] -#![feature(never_type)] use std::panic; diff --git a/tests/ui/closures/2229_closure_analysis/only-inhabited-variant.rs b/tests/ui/closures/2229_closure_analysis/only-inhabited-variant.rs index 4638387347269..bea32133653a9 100644 --- a/tests/ui/closures/2229_closure_analysis/only-inhabited-variant.rs +++ b/tests/ui/closures/2229_closure_analysis/only-inhabited-variant.rs @@ -5,7 +5,6 @@ //@ revisions: normal exhaustive_patterns //@ edition:2021 #![cfg_attr(exhaustive_patterns, feature(exhaustive_patterns))] -#![feature(never_type)] pub fn main() { let mut r = Result::::Err((0, 0)); diff --git a/tests/ui/coercion/coerce-issue-49593-box-never.rs b/tests/ui/coercion/coerce-issue-49593-box-never.rs index 751450a7fb435..6b1ec2a849d6d 100644 --- a/tests/ui/coercion/coerce-issue-49593-box-never.rs +++ b/tests/ui/coercion/coerce-issue-49593-box-never.rs @@ -15,8 +15,6 @@ // //@[e2024] check-pass -#![feature(never_type)] - use std::error::Error; use std::mem; diff --git a/tests/ui/coercion/coerce-to-bang-cast.rs b/tests/ui/coercion/coerce-to-bang-cast.rs index 85598a42eccd9..7fb9235ea3669 100644 --- a/tests/ui/coercion/coerce-to-bang-cast.rs +++ b/tests/ui/coercion/coerce-to-bang-cast.rs @@ -1,5 +1,3 @@ -#![feature(never_type)] - fn cast_a() { let y = {return; 22} as !; //~^ ERROR non-primitive cast diff --git a/tests/ui/const-generics/min_const_generics/complex-types.rs b/tests/ui/const-generics/min_const_generics/complex-types.rs index 057bd5af89ef7..f3d103d46ce65 100644 --- a/tests/ui/const-generics/min_const_generics/complex-types.rs +++ b/tests/ui/const-generics/min_const_generics/complex-types.rs @@ -1,5 +1,3 @@ -#![feature(never_type)] - struct Foo; //~^ ERROR `[u8; 0]` is forbidden diff --git a/tests/ui/consts/assert-type-intrinsics.rs b/tests/ui/consts/assert-type-intrinsics.rs index 91c8dd00e89f9..3390db9227174 100644 --- a/tests/ui/consts/assert-type-intrinsics.rs +++ b/tests/ui/consts/assert-type-intrinsics.rs @@ -1,4 +1,3 @@ -#![feature(never_type)] #![feature(core_intrinsics)] use std::intrinsics; 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 dbe507e3cd137..a9f8e3ed826ed 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 @@ -2,7 +2,6 @@ //@ ignore-parallel-frontend post-monomorphization errors // Regression test for #66975 #![warn(unconditional_panic)] -#![feature(never_type)] struct PrintName(T); 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 a0a5ba36bfe4f..3fe25f582d823 100644 --- a/tests/ui/consts/const-eval/panic-assoc-never-type.rs +++ b/tests/ui/consts/const-eval/panic-assoc-never-type.rs @@ -2,7 +2,6 @@ //@ dont-require-annotations: NOTE // Regression test for #66975 -#![feature(never_type)] struct PrintName; diff --git a/tests/ui/consts/const-eval/panic-never-type.rs b/tests/ui/consts/const-eval/panic-never-type.rs index d9b46e70b357d..1dbaa85377f31 100644 --- a/tests/ui/consts/const-eval/panic-never-type.rs +++ b/tests/ui/consts/const-eval/panic-never-type.rs @@ -1,5 +1,4 @@ // Regression test for #66975 -#![feature(never_type)] const VOID: ! = panic!(); //~^ ERROR explicit panic diff --git a/tests/ui/consts/const-eval/raw-bytes.rs b/tests/ui/consts/const-eval/raw-bytes.rs index d63e1d5b062cf..e2e13d3312b8b 100644 --- a/tests/ui/consts/const-eval/raw-bytes.rs +++ b/tests/ui/consts/const-eval/raw-bytes.rs @@ -5,7 +5,7 @@ //@ dont-require-annotations: NOTE //@ ignore-parallel-frontend different alloc ids #![allow(invalid_value, unnecessary_transmutes)] -#![feature(never_type, rustc_attrs, ptr_metadata, slice_from_ptr_range, const_slice_from_ptr_range)] +#![feature(rustc_attrs, ptr_metadata, slice_from_ptr_range, const_slice_from_ptr_range)] use std::mem; use std::alloc::Layout; diff --git a/tests/ui/consts/const-eval/ub-enum.rs b/tests/ui/consts/const-eval/ub-enum.rs index 8feb78e0b11e8..10dd4b94fe0b6 100644 --- a/tests/ui/consts/const-eval/ub-enum.rs +++ b/tests/ui/consts/const-eval/ub-enum.rs @@ -5,7 +5,6 @@ //@ normalize-stderr: "0x[0-9](\.\.|\])" -> "0x%$1" //@ dont-require-annotations: NOTE //@ ignore-parallel-frontend different alloc ids -#![feature(never_type)] #![allow(invalid_value, unnecessary_transmutes)] use std::mem; diff --git a/tests/ui/consts/const-eval/ub-uninhabit.rs b/tests/ui/consts/const-eval/ub-uninhabit.rs index 188ad768a0e98..2b2edf64e7e12 100644 --- a/tests/ui/consts/const-eval/ub-uninhabit.rs +++ b/tests/ui/consts/const-eval/ub-uninhabit.rs @@ -4,7 +4,6 @@ //@ dont-require-annotations: NOTE #![feature(core_intrinsics)] -#![feature(never_type)] use std::{intrinsics, mem}; diff --git a/tests/ui/consts/const-variant-count.rs b/tests/ui/consts/const-variant-count.rs index c554c3b0ff418..8faee50a756ef 100644 --- a/tests/ui/consts/const-variant-count.rs +++ b/tests/ui/consts/const-variant-count.rs @@ -1,7 +1,6 @@ //@ run-pass #![allow(dead_code, enum_intrinsics_non_enums)] #![feature(variant_count)] -#![feature(never_type)] use std::mem::variant_count; diff --git a/tests/ui/consts/extra-const-ub/detect-extra-ub.rs b/tests/ui/consts/extra-const-ub/detect-extra-ub.rs index 60086acc3707e..52bcb07ee298a 100644 --- a/tests/ui/consts/extra-const-ub/detect-extra-ub.rs +++ b/tests/ui/consts/extra-const-ub/detect-extra-ub.rs @@ -1,7 +1,6 @@ //@ revisions: no_flag with_flag //@ [no_flag] check-pass //@ [with_flag] compile-flags: -Zextra-const-ub-checks -#![feature(never_type)] #![allow(unnecessary_transmutes)] use std::mem::transmute; diff --git a/tests/ui/consts/let-irrefutable-pattern-ice-120337.rs b/tests/ui/consts/let-irrefutable-pattern-ice-120337.rs index 24ff0a1f0719c..af4ac479905ab 100644 --- a/tests/ui/consts/let-irrefutable-pattern-ice-120337.rs +++ b/tests/ui/consts/let-irrefutable-pattern-ice-120337.rs @@ -4,7 +4,6 @@ // variant. (N.B. this is UB, but not currently detected by rustc) // //@ check-pass -#![feature(never_type)] #[derive(Copy, Clone)] pub enum E { A(!), } diff --git a/tests/ui/consts/validate_never_arrays.rs b/tests/ui/consts/validate_never_arrays.rs index b0ea064188bcf..c67681b0002c8 100644 --- a/tests/ui/consts/validate_never_arrays.rs +++ b/tests/ui/consts/validate_never_arrays.rs @@ -1,7 +1,6 @@ // Strip out raw byte dumps to make comparison platform-independent: //@ normalize-stderr: "(the raw bytes of the constant) \(size: [0-9]*, align: [0-9]*\)" -> "$1 (size: $$SIZE, align: $$ALIGN)" //@ normalize-stderr: "([0-9a-f][0-9a-f] |╾─*ALLOC[0-9]+(\+[a-z0-9]+)?()?─*╼ )+ *│.*" -> "HEX_DUMP" -#![feature(never_type)] const _: &[!; 1] = unsafe { &*(1_usize as *const [!; 1]) }; //~ ERROR invalid value const _: &[!; 0] = unsafe { &*(1_usize as *const [!; 0]) }; // ok diff --git a/tests/ui/coroutine/issue-93161.rs b/tests/ui/coroutine/issue-93161.rs index 0c7be8407d0b9..fd76f3fbf4bed 100644 --- a/tests/ui/coroutine/issue-93161.rs +++ b/tests/ui/coroutine/issue-93161.rs @@ -1,8 +1,6 @@ //@ edition:2021 //@ run-pass -#![feature(never_type)] - use std::future::Future; // See if we can run a basic `async fn` diff --git a/tests/ui/coroutine/uninhabited-field.rs b/tests/ui/coroutine/uninhabited-field.rs index 6debd89ef4a9e..a349093570d19 100644 --- a/tests/ui/coroutine/uninhabited-field.rs +++ b/tests/ui/coroutine/uninhabited-field.rs @@ -3,7 +3,6 @@ #![allow(unused)] #![feature(coroutine_trait)] #![feature(coroutines, stmt_expr_attributes)] -#![feature(never_type)] use std::assert_matches; use std::ops::Coroutine; use std::ops::CoroutineState; diff --git a/tests/ui/feature-gates/feature-gate-exhaustive-patterns.rs b/tests/ui/feature-gates/feature-gate-exhaustive-patterns.rs index 7989159369275..b5c9a93533e76 100644 --- a/tests/ui/feature-gates/feature-gate-exhaustive-patterns.rs +++ b/tests/ui/feature-gates/feature-gate-exhaustive-patterns.rs @@ -1,5 +1,3 @@ -#![feature(never_type)] - fn foo() -> Result { Ok(123) } diff --git a/tests/ui/feature-gates/feature-gate-never_type.rs b/tests/ui/feature-gates/feature-gate-never_type.rs deleted file mode 100644 index c678d55acd0ff..0000000000000 --- a/tests/ui/feature-gates/feature-gate-never_type.rs +++ /dev/null @@ -1,71 +0,0 @@ -// Test that ! errors when used in illegal positions with feature(never_type) disabled - -mod ungated { - //! Functions returning `!` directly (as in `-> !`) and function pointers doing the same are - //! allowed with no gates. - - fn panic() -> ! { - panic!(); - } - - fn takes_fn_ptr(x: fn() -> !) -> ! { - x() - } -} - -mod gated { - //! All other mentions of the type are gated. - - trait Foo { - type Wub; - } - - type Ma = (u32, !, i32); //~ ERROR type is experimental - type Meeshka = Vec; //~ ERROR type is experimental - type Mow = &'static fn(!) -> !; //~ ERROR type is experimental - type Skwoz = &'static mut !; //~ ERROR type is experimental - type Meow = fn() -> Result<(), !>; //~ ERROR type is experimental - - impl Foo for Meeshka { - type Wub = !; //~ ERROR type is experimental - } - - fn look_ma_no_feature_gate !>() {} //~ ERROR type is experimental - - fn tadam(f: &dyn Fn() -> !) {} //~ ERROR type is experimental - - fn toudoum() -> impl Fn() -> ! { //~ ERROR type is experimental - || panic!() - } - - fn infallible() -> Result<(), !> { //~ ERROR type is experimental - Ok(()) - } -} - -mod hack { - //! There is a hack which, by exploiting the fact that `fn() -> !` can be named stably and that - //! type system does not interact with stability, allows one to mention the never type while - //! avoiding any and all feature gates. It is generally considered a "hack"/compiler bug, and - //! thus users of this hack resign stability guarantees. However, fixing this is more trouble - //! than good. - - trait F { - type Ret; - } - - impl F for fn() -> T { - type Ret = T; - } - - type Never = ! as F>::Ret; - - fn damn( - never: Never, - _: &dyn Fn() -> Never, - ) -> (impl Fn() -> Never, &'static mut Never, Never, u8) { - (|| never, never, never, never) - } -} - -fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-never_type.stderr b/tests/ui/feature-gates/feature-gate-never_type.stderr deleted file mode 100644 index 475aac433b84d..0000000000000 --- a/tests/ui/feature-gates/feature-gate-never_type.stderr +++ /dev/null @@ -1,103 +0,0 @@ -error[E0658]: the `!` type is experimental - --> $DIR/feature-gate-never_type.rs:23:21 - | -LL | type Ma = (u32, !, i32); - | ^ - | - = note: see issue #35121 for more information - = help: add `#![feature(never_type)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: the `!` type is experimental - --> $DIR/feature-gate-never_type.rs:24:24 - | -LL | type Meeshka = Vec; - | ^ - | - = note: see issue #35121 for more information - = help: add `#![feature(never_type)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: the `!` type is experimental - --> $DIR/feature-gate-never_type.rs:25:28 - | -LL | type Mow = &'static fn(!) -> !; - | ^ - | - = note: see issue #35121 for more information - = help: add `#![feature(never_type)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: the `!` type is experimental - --> $DIR/feature-gate-never_type.rs:26:31 - | -LL | type Skwoz = &'static mut !; - | ^ - | - = note: see issue #35121 for more information - = help: add `#![feature(never_type)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: the `!` type is experimental - --> $DIR/feature-gate-never_type.rs:27:36 - | -LL | type Meow = fn() -> Result<(), !>; - | ^ - | - = note: see issue #35121 for more information - = help: add `#![feature(never_type)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: the `!` type is experimental - --> $DIR/feature-gate-never_type.rs:30:20 - | -LL | type Wub = !; - | ^ - | - = note: see issue #35121 for more information - = help: add `#![feature(never_type)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: the `!` type is experimental - --> $DIR/feature-gate-never_type.rs:33:47 - | -LL | fn look_ma_no_feature_gate !>() {} - | ^ - | - = note: see issue #35121 for more information - = help: add `#![feature(never_type)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: the `!` type is experimental - --> $DIR/feature-gate-never_type.rs:35:30 - | -LL | fn tadam(f: &dyn Fn() -> !) {} - | ^ - | - = note: see issue #35121 for more information - = help: add `#![feature(never_type)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: the `!` type is experimental - --> $DIR/feature-gate-never_type.rs:37:34 - | -LL | fn toudoum() -> impl Fn() -> ! { - | ^ - | - = note: see issue #35121 for more information - = help: add `#![feature(never_type)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: the `!` type is experimental - --> $DIR/feature-gate-never_type.rs:41:35 - | -LL | fn infallible() -> Result<(), !> { - | ^ - | - = note: see issue #35121 for more information - = help: add `#![feature(never_type)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error: aborting due to 10 previous errors - -For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/for-loop-while/break-while-condition.rs b/tests/ui/for-loop-while/break-while-condition.rs index 6064e6ab00235..f61ef6b4898e9 100644 --- a/tests/ui/for-loop-while/break-while-condition.rs +++ b/tests/ui/for-loop-while/break-while-condition.rs @@ -1,28 +1,29 @@ -#![feature(never_type)] - fn main() { // The `if false` expressions are simply to // make sure we don't avoid checking everything // simply because a few expressions are unreachable. if false { - let _: ! = { //~ ERROR mismatched types - 'a: while break 'a {}; + let _: ! = { + 'a: while break 'a {} + //~^ ERROR mismatched types }; } if false { let _: ! = { - while false { //~ ERROR mismatched types - break + while false { + //~^ ERROR mismatched types + break; } }; } if false { let _: ! = { - while false { //~ ERROR mismatched types - return + while false { + //~^ ERROR mismatched types + return; } }; } diff --git a/tests/ui/for-loop-while/loop-break-value.rs b/tests/ui/for-loop-while/loop-break-value.rs index f46524b6d2781..53183899fae1d 100644 --- a/tests/ui/for-loop-while/loop-break-value.rs +++ b/tests/ui/for-loop-while/loop-break-value.rs @@ -1,7 +1,6 @@ //@ run-pass #![allow(unreachable_code)] -#![feature(never_type)] #[allow(unused)] fn never_returns() { @@ -18,7 +17,7 @@ pub fn main() { let _never: ! = loop { break loop { break 'outer panic!(); - } + }; }; } }; @@ -38,29 +37,21 @@ pub fn main() { assert_eq!(coerced, &[17u32]); let trait_unified = loop { - break if true { - break Default::default() - } else { - break [13, 14] - }; + break if true { break Default::default() } else { break [13, 14] }; }; assert_eq!(trait_unified, [0, 0]); let trait_unified_2 = loop { if false { - break [String::from("Hello")] + break [String::from("Hello")]; } else { - break Default::default() + break Default::default(); }; }; assert_eq!(trait_unified_2, [""]); let trait_unified_3 = loop { - break if false { - break [String::from("Hello")] - } else { - ["Yes".into()] - }; + break if false { break [String::from("Hello")] } else { ["Yes".into()] }; }; assert_eq!(trait_unified_3, ["Yes"]); @@ -87,7 +78,7 @@ pub fn main() { Default::default() } else { break; - } + }; }; assert_eq!(regular_break_3, ()); diff --git a/tests/ui/intrinsics/panic-uninitialized-zeroed.rs b/tests/ui/intrinsics/panic-uninitialized-zeroed.rs index 00fb2b029f9aa..df340f259a5ab 100644 --- a/tests/ui/intrinsics/panic-uninitialized-zeroed.rs +++ b/tests/ui/intrinsics/panic-uninitialized-zeroed.rs @@ -8,13 +8,11 @@ //@ edition:2024 #![allow(deprecated, invalid_value, unreachable_code)] -#![feature(never_type, rustc_private)] +#![feature(rustc_private)] -use std::{ - mem::{self, MaybeUninit, ManuallyDrop}, - ptr::NonNull, - num, -}; +use std::mem::{self, ManuallyDrop, MaybeUninit}; +use std::num; +use std::ptr::NonNull; #[cfg(target_os = "linux")] extern crate libc; @@ -28,7 +26,9 @@ struct Foo { enum Bar {} #[allow(dead_code)] -enum OneVariant { Variant(i32) } +enum OneVariant { + Variant(i32), +} #[allow(dead_code, non_camel_case_types)] enum OneVariant_NonZero { @@ -73,7 +73,7 @@ enum ZeroIsValid { #[track_caller] fn test_panic_msg T) + 'static>(op: F, msg: &str) { - use std::{panic, env, process}; + use std::{env, panic, process}; // The tricky part is that we can't just run `op`, as that would *abort* the process. // So instead, we reinvoke this process with the caller location as argument. @@ -96,7 +96,12 @@ fn test_panic_msg T) + 'static>(op: F, msg: &str) { let res = cmd.output().unwrap(); assert!(!res.status.success(), "test did not fail"); let stderr = String::from_utf8_lossy(&res.stderr); - assert!(stderr.contains(msg), "test did not contain expected output: looking for {:?}, output:\n{}", msg, stderr); + assert!( + stderr.contains(msg), + "test did not contain expected output: looking for {:?}, output:\n{}", + msg, + stderr + ); } } @@ -126,276 +131,267 @@ fn main() { // Uninhabited types test_panic_msg( || mem::uninitialized::(), - "attempted to instantiate uninhabited type `!`" - ); - test_panic_msg( - || mem::zeroed::(), - "attempted to instantiate uninhabited type `!`" + "attempted to instantiate uninhabited type `!`", ); + test_panic_msg(|| mem::zeroed::(), "attempted to instantiate uninhabited type `!`"); test_panic_msg( || MaybeUninit::::uninit().assume_init(), - "attempted to instantiate uninhabited type `!`" + "attempted to instantiate uninhabited type `!`", ); test_panic_msg( || mem::uninitialized::(), - "attempted to instantiate uninhabited type `Foo`" - ); - test_panic_msg( - || mem::zeroed::(), - "attempted to instantiate uninhabited type `Foo`" + "attempted to instantiate uninhabited type `Foo`", ); + test_panic_msg(|| mem::zeroed::(), "attempted to instantiate uninhabited type `Foo`"); test_panic_msg( || MaybeUninit::::uninit().assume_init(), - "attempted to instantiate uninhabited type `Foo`" + "attempted to instantiate uninhabited type `Foo`", ); test_panic_msg( || mem::uninitialized::(), - "attempted to instantiate uninhabited type `Bar`" - ); - test_panic_msg( - || mem::zeroed::(), - "attempted to instantiate uninhabited type `Bar`" + "attempted to instantiate uninhabited type `Bar`", ); + test_panic_msg(|| mem::zeroed::(), "attempted to instantiate uninhabited type `Bar`"); test_panic_msg( || MaybeUninit::::uninit().assume_init(), - "attempted to instantiate uninhabited type `Bar`" + "attempted to instantiate uninhabited type `Bar`", ); test_panic_msg( || mem::uninitialized::<[Foo; 2]>(), - "attempted to instantiate uninhabited type `[Foo; 2]`" + "attempted to instantiate uninhabited type `[Foo; 2]`", ); test_panic_msg( || mem::zeroed::<[Foo; 2]>(), - "attempted to instantiate uninhabited type `[Foo; 2]`" + "attempted to instantiate uninhabited type `[Foo; 2]`", ); test_panic_msg( || MaybeUninit::<[Foo; 2]>::uninit().assume_init(), - "attempted to instantiate uninhabited type `[Foo; 2]`" + "attempted to instantiate uninhabited type `[Foo; 2]`", ); test_panic_msg( || mem::uninitialized::<[Bar; 2]>(), - "attempted to instantiate uninhabited type `[Bar; 2]`" + "attempted to instantiate uninhabited type `[Bar; 2]`", ); test_panic_msg( || mem::zeroed::<[Bar; 2]>(), - "attempted to instantiate uninhabited type `[Bar; 2]`" + "attempted to instantiate uninhabited type `[Bar; 2]`", ); test_panic_msg( || MaybeUninit::<[Bar; 2]>::uninit().assume_init(), - "attempted to instantiate uninhabited type `[Bar; 2]`" + "attempted to instantiate uninhabited type `[Bar; 2]`", ); // Types that don't allow either. test_panic_msg( || mem::zeroed::<&i32>(), - "attempted to zero-initialize type `&i32`, which is invalid" + "attempted to zero-initialize type `&i32`, which is invalid", ); test_panic_msg( || mem::uninitialized::<&i32>(), - "attempted to leave type `&i32` uninitialized, which is invalid" + "attempted to leave type `&i32` uninitialized, which is invalid", ); test_panic_msg( || mem::zeroed::>(), - "attempted to zero-initialize type `alloc::boxed::Box<[i32; 0]>`, which is invalid" + "attempted to zero-initialize type `alloc::boxed::Box<[i32; 0]>`, which is invalid", ); test_panic_msg( || mem::uninitialized::>(), - "attempted to leave type `alloc::boxed::Box<[i32; 0]>` uninitialized, which is invalid" + "attempted to leave type `alloc::boxed::Box<[i32; 0]>` uninitialized, which is invalid", ); test_panic_msg( || mem::zeroed::>(), - "attempted to zero-initialize type `alloc::boxed::Box`, which is invalid" + "attempted to zero-initialize type `alloc::boxed::Box`, which is invalid", ); test_panic_msg( || mem::uninitialized::>(), - "attempted to leave type `alloc::boxed::Box` uninitialized, which is invalid" + "attempted to leave type `alloc::boxed::Box` uninitialized, which is invalid", ); test_panic_msg( || mem::zeroed::<&[i32]>(), - "attempted to zero-initialize type `&[i32]`, which is invalid" + "attempted to zero-initialize type `&[i32]`, which is invalid", ); test_panic_msg( || mem::uninitialized::<&[i32]>(), - "attempted to leave type `&[i32]` uninitialized, which is invalid" + "attempted to leave type `&[i32]` uninitialized, which is invalid", ); test_panic_msg( || mem::zeroed::<&(u8, [u8])>(), - "attempted to zero-initialize type `&(u8, [u8])`, which is invalid" + "attempted to zero-initialize type `&(u8, [u8])`, which is invalid", ); test_panic_msg( || mem::uninitialized::<&(u8, [u8])>(), - "attempted to leave type `&(u8, [u8])` uninitialized, which is invalid" + "attempted to leave type `&(u8, [u8])` uninitialized, which is invalid", ); test_panic_msg( || mem::zeroed::<&dyn Send>(), - "attempted to zero-initialize type `&dyn core::marker::Send`, which is invalid" + "attempted to zero-initialize type `&dyn core::marker::Send`, which is invalid", ); test_panic_msg( || mem::uninitialized::<&dyn Send>(), - "attempted to leave type `&dyn core::marker::Send` uninitialized, which is invalid" + "attempted to leave type `&dyn core::marker::Send` uninitialized, which is invalid", ); test_panic_msg( || mem::zeroed::<*const dyn Send>(), - "attempted to zero-initialize type `*const dyn core::marker::Send`, which is invalid" + "attempted to zero-initialize type `*const dyn core::marker::Send`, which is invalid", ); test_panic_msg( || mem::uninitialized::<*const dyn Send>(), - "attempted to leave type `*const dyn core::marker::Send` uninitialized, which is invalid" + "attempted to leave type `*const dyn core::marker::Send` uninitialized, which is invalid", ); test_panic_msg( || mem::uninitialized::(), "attempted to leave type `NoNullVariant` uninitialized, \ - which is invalid" + which is invalid", ); test_panic_msg( || mem::zeroed::(), "attempted to zero-initialize type `NoNullVariant`, \ - which is invalid" + which is invalid", ); test_panic_msg( || mem::zeroed::(), "attempted to zero-initialize type `OneVariant_Ref`, \ - which is invalid" + which is invalid", ); test_panic_msg( || mem::uninitialized::(), - "attempted to leave type `OneVariant_Ref` uninitialized, which is invalid" + "attempted to leave type `OneVariant_Ref` uninitialized, which is invalid", ); // Types where both are invalid, but we allow uninit since the 0x01-filling is not LLVM UB. test_panic_msg( || mem::zeroed::(), - "attempted to zero-initialize type `fn()`, which is invalid" + "attempted to zero-initialize type `fn()`, which is invalid", ); test_panic_msg_only_if_strict( || mem::uninitialized::(), - "attempted to leave type `fn()` uninitialized, which is invalid" + "attempted to leave type `fn()` uninitialized, which is invalid", ); test_panic_msg( || mem::zeroed::<&()>(), - "attempted to zero-initialize type `&()`, which is invalid" + "attempted to zero-initialize type `&()`, which is invalid", ); test_panic_msg_only_if_strict( || mem::uninitialized::<&()>(), - "attempted to leave type `&()` uninitialized, which is invalid" + "attempted to leave type `&()` uninitialized, which is invalid", ); test_panic_msg( || mem::zeroed::<&[u8]>(), - "attempted to zero-initialize type `&[u8]`, which is invalid" + "attempted to zero-initialize type `&[u8]`, which is invalid", ); test_panic_msg_only_if_strict( || mem::uninitialized::<&[u8]>(), - "attempted to leave type `&[u8]` uninitialized, which is invalid" + "attempted to leave type `&[u8]` uninitialized, which is invalid", ); test_panic_msg( || mem::zeroed::<&str>(), - "attempted to zero-initialize type `&str`, which is invalid" + "attempted to zero-initialize type `&str`, which is invalid", ); test_panic_msg_only_if_strict( || mem::uninitialized::<&str>(), - "attempted to leave type `&str` uninitialized, which is invalid" + "attempted to leave type `&str` uninitialized, which is invalid", ); test_panic_msg( || mem::zeroed::<(NonNull, u32, u32)>(), "attempted to zero-initialize type `(core::ptr::non_null::NonNull, u32, u32)`, \ - which is invalid" + which is invalid", ); test_panic_msg_only_if_strict( || mem::uninitialized::<(NonNull, u32, u32)>(), - "attempted to leave type `(core::ptr::non_null::NonNull, u32, u32)` uninitialized, which is invalid" + "attempted to leave type `(core::ptr::non_null::NonNull, u32, u32)` uninitialized, which is invalid", ); test_panic_msg( || mem::zeroed::(), "attempted to zero-initialize type `OneVariant_NonZero`, \ - which is invalid" + which is invalid", ); test_panic_msg_only_if_strict( || mem::uninitialized::(), - "attempted to leave type `OneVariant_NonZero` uninitialized, which is invalid" + "attempted to leave type `OneVariant_NonZero` uninitialized, which is invalid", ); // Types where both are invalid but we allow the zeroed form since it is not LLVM UB. test_panic_msg_only_if_strict( || mem::zeroed::(), - "attempted to zero-initialize type `LR_NonZero`, which is invalid" + "attempted to zero-initialize type `LR_NonZero`, which is invalid", ); test_panic_msg( || mem::uninitialized::(), - "attempted to leave type `LR_NonZero` uninitialized, which is invalid" + "attempted to leave type `LR_NonZero` uninitialized, which is invalid", ); test_panic_msg_only_if_strict( || mem::zeroed::>(), "attempted to zero-initialize type `core::mem::manually_drop::ManuallyDrop`, \ - which is invalid" + which is invalid", ); test_panic_msg( || mem::uninitialized::>(), "attempted to leave type `core::mem::manually_drop::ManuallyDrop` uninitialized, \ - which is invalid" + which is invalid", ); // Some strict-only things test_panic_msg_only_if_strict( || mem::uninitialized::(), - "attempted to leave type `i32` uninitialized, which is invalid" + "attempted to leave type `i32` uninitialized, which is invalid", ); test_panic_msg_only_if_strict( || mem::uninitialized::<*const ()>(), - "attempted to leave type `*const ()` uninitialized, which is invalid" + "attempted to leave type `*const ()` uninitialized, which is invalid", ); test_panic_msg_only_if_strict( || mem::uninitialized::<[i32; 1]>(), - "attempted to leave type `[i32; 1]` uninitialized, which is invalid" + "attempted to leave type `[i32; 1]` uninitialized, which is invalid", ); test_panic_msg_only_if_strict( || mem::zeroed::<[NonNull<()>; 1]>(), - "attempted to zero-initialize type `[core::ptr::non_null::NonNull<()>; 1]`, which is invalid" + "attempted to zero-initialize type `[core::ptr::non_null::NonNull<()>; 1]`, which is invalid", ); // Types that can be zero, but not uninit (though some are mitigated). let _val = mem::zeroed::(); test_panic_msg( || mem::uninitialized::(), - "attempted to leave type `LR` uninitialized, which is invalid" + "attempted to leave type `LR` uninitialized, which is invalid", ); let _val = mem::zeroed::>(); test_panic_msg( || mem::uninitialized::>(), - "attempted to leave type `core::mem::manually_drop::ManuallyDrop` uninitialized, which is invalid" + "attempted to leave type `core::mem::manually_drop::ManuallyDrop` uninitialized, which is invalid", ); let _val = mem::zeroed::(); test_panic_msg_only_if_strict( || mem::uninitialized::(), - "attempted to leave type `bool` uninitialized, which is invalid" + "attempted to leave type `bool` uninitialized, which is invalid", ); let _val = mem::zeroed::(); test_panic_msg_only_if_strict( || mem::uninitialized::(), - "attempted to leave type `OneVariant` uninitialized, which is invalid" + "attempted to leave type `OneVariant` uninitialized, which is invalid", ); // Some things that are actually allowed. diff --git a/tests/ui/layout/debug.rs b/tests/ui/layout/debug.rs index 60415911d38e9..a3d39fcaf9768 100644 --- a/tests/ui/layout/debug.rs +++ b/tests/ui/layout/debug.rs @@ -1,6 +1,6 @@ //@ normalize-stderr: "pref: Align\([1-8] bytes\)" -> "pref: $$SOME_ALIGN" //@ normalize-stderr: "randomization_seed: \d+" -> "randomization_seed: $$SEED" -#![feature(never_type, rustc_attrs, type_alias_impl_trait, repr_simd)] +#![feature(rustc_attrs, type_alias_impl_trait, repr_simd)] #![crate_type = "lib"] #[rustc_layout(debug)] diff --git a/tests/ui/layout/enum-scalar-pair-int-ptr.rs b/tests/ui/layout/enum-scalar-pair-int-ptr.rs index 60cada5e05a8c..3e88b3d1f3688 100644 --- a/tests/ui/layout/enum-scalar-pair-int-ptr.rs +++ b/tests/ui/layout/enum-scalar-pair-int-ptr.rs @@ -5,7 +5,6 @@ //! Enum layout tests related to scalar pairs with an int/ptr common primitive. #![feature(rustc_attrs)] -#![feature(never_type)] #![crate_type = "lib"] #[rustc_layout(abi)] diff --git a/tests/ui/layout/enum.rs b/tests/ui/layout/enum.rs index c4eb943a83287..a390f54e973ff 100644 --- a/tests/ui/layout/enum.rs +++ b/tests/ui/layout/enum.rs @@ -2,23 +2,25 @@ //! Various enum layout tests. #![feature(rustc_attrs)] -#![feature(never_type)] #![crate_type = "lib"] #[rustc_layout(align)] -enum UninhabitedVariantAlign { //~ERROR: abi: Align(2 bytes) +enum UninhabitedVariantAlign { + //~^ ERROR: abi: Align(2 bytes) A([u8; 32]), B([u16; 0], !), // make sure alignment in uninhabited fields is respected } #[rustc_layout(size)] -enum UninhabitedVariantSpace { //~ERROR: size: Size(16 bytes) +enum UninhabitedVariantSpace { + //~^ ERROR: size: Size(16 bytes) A, B([u8; 15], !), // make sure there is space being reserved for this field. } #[rustc_layout(abi)] -enum ScalarPairDifferingSign { //~ERROR: abi: ScalarPair +enum ScalarPairDifferingSign { + //~^ ERROR: abi: ScalarPair A(u8), B(i8), } @@ -28,7 +30,8 @@ enum Never {} // See https://github.com/rust-lang/rust/issues/146984 #[rustc_layout(size)] #[repr(u32)] -enum DefinedLayoutAllUninhabited { //~ERROR: size: Size(4 bytes) +enum DefinedLayoutAllUninhabited { + //~^ ERROR: size: Size(4 bytes) A(Never), B(Never), } diff --git a/tests/ui/layout/hexagon-enum.rs b/tests/ui/layout/hexagon-enum.rs index 517c1cb3d5cfc..b088767a89457 100644 --- a/tests/ui/layout/hexagon-enum.rs +++ b/tests/ui/layout/hexagon-enum.rs @@ -7,7 +7,7 @@ // Verify that the hexagon targets implement the repr(C) for enums correctly. // // See #82100 -#![feature(never_type, rustc_attrs, no_core, lang_items)] +#![feature(rustc_attrs, no_core, lang_items)] #![crate_type = "lib"] #![no_core] diff --git a/tests/ui/layout/struct.rs b/tests/ui/layout/struct.rs index 5f652b3d570db..084fb15ea1f3f 100644 --- a/tests/ui/layout/struct.rs +++ b/tests/ui/layout/struct.rs @@ -2,7 +2,6 @@ //! Various struct layout tests. #![feature(rustc_attrs)] -#![feature(never_type)] #![crate_type = "lib"] #[rustc_layout(abi)] diff --git a/tests/ui/layout/thumb-enum.rs b/tests/ui/layout/thumb-enum.rs index d65822b4647a5..5a4ee49d2216d 100644 --- a/tests/ui/layout/thumb-enum.rs +++ b/tests/ui/layout/thumb-enum.rs @@ -7,7 +7,7 @@ // Verify that thumb targets implement the repr(C) for enums correctly. // // See #87917 -#![feature(never_type, rustc_attrs, no_core, lang_items)] +#![feature(rustc_attrs, no_core, lang_items)] #![crate_type = "lib"] #![no_core] diff --git a/tests/ui/lifetimes/issue-54378.rs b/tests/ui/lifetimes/issue-54378.rs index b835b08d31e9c..35bd7eeb56a9b 100644 --- a/tests/ui/lifetimes/issue-54378.rs +++ b/tests/ui/lifetimes/issue-54378.rs @@ -2,8 +2,6 @@ // Regression test for #54378. -#![feature(never_type)] - use std::marker::PhantomData; pub trait Machine<'a, 'mir, 'tcx>: Sized { diff --git a/tests/ui/lint/invalid_value.rs b/tests/ui/lint/invalid_value.rs index 29e8e6cfef6dd..49a729f55eaf0 100644 --- a/tests/ui/lint/invalid_value.rs +++ b/tests/ui/lint/invalid_value.rs @@ -2,7 +2,7 @@ // in a lint. #![allow(deprecated)] #![deny(invalid_value)] -#![feature(never_type, rustc_attrs)] +#![feature(rustc_attrs)] use std::mem::{self, MaybeUninit}; use std::ptr::NonNull; diff --git a/tests/ui/lint/unused-features/unused-language-features.rs b/tests/ui/lint/unused-features/unused-language-features.rs index 9334c1df0408a..89fbda6d9e887 100644 --- a/tests/ui/lint/unused-features/unused-language-features.rs +++ b/tests/ui/lint/unused-features/unused-language-features.rs @@ -1,6 +1,5 @@ #![crate_type = "lib"] #![deny(unused_features)] - // Unused language features #![feature(coroutines)] //~^ ERROR feature `coroutines` is declared but not used @@ -16,10 +15,10 @@ //~^ ERROR feature `negative_impls` is declared but not used // Not enabled via cfg_attr, so should not warn even if unused -#![cfg_attr(any(), feature(never_type))] +#![cfg_attr(any(), feature(type_ascription))] macro_rules! use_asm_unwind { () => { unsafe { std::arch::asm!("", options(may_unwind)) }; - } + }; } diff --git a/tests/ui/lint/unused/must-use-ops.rs b/tests/ui/lint/unused/must-use-ops.rs index 5085dbb58c19f..a04ec0fd9a042 100644 --- a/tests/ui/lint/unused/must-use-ops.rs +++ b/tests/ui/lint/unused/must-use-ops.rs @@ -3,7 +3,6 @@ //@ check-pass #![warn(unused_must_use)] -#![feature(never_type)] fn deref_never(x: &!) { // Don't lint for uninhabited types diff --git a/tests/ui/lint/unused/must_use-result-unit-uninhabited.rs b/tests/ui/lint/unused/must_use-result-unit-uninhabited.rs index 8f63e4a7f8323..be31a57140e01 100644 --- a/tests/ui/lint/unused/must_use-result-unit-uninhabited.rs +++ b/tests/ui/lint/unused/must_use-result-unit-uninhabited.rs @@ -2,7 +2,6 @@ //@ aux-crate:dep=must_use_result_unit_uninhabited_extern_crate.rs #![deny(unused_must_use)] -#![feature(never_type)] use core::ops::{ControlFlow, ControlFlow::Continue}; use dep::{MyUninhabited, MyUninhabitedNonexhaustive}; diff --git a/tests/ui/lint/unused/must_use-unit.rs b/tests/ui/lint/unused/must_use-unit.rs index 171ae3257b6c2..4566bbc631daf 100644 --- a/tests/ui/lint/unused/must_use-unit.rs +++ b/tests/ui/lint/unused/must_use-unit.rs @@ -1,4 +1,3 @@ -#![feature(never_type)] #![deny(unused_must_use)] #[must_use] diff --git a/tests/ui/loops/loop-break-never-type-mismatch.rs b/tests/ui/loops/loop-break-never-type-mismatch.rs index 2be4e4f4ac5ab..d76dbc9f021f7 100644 --- a/tests/ui/loops/loop-break-never-type-mismatch.rs +++ b/tests/ui/loops/loop-break-never-type-mismatch.rs @@ -1,7 +1,5 @@ //! Tests type mismatches with `break` and diverging types in loops -#![feature(never_type)] - fn loop_break_return() -> i32 { let loop_value = loop { break return 0; diff --git a/tests/ui/loops/loop-break-value.rs b/tests/ui/loops/loop-break-value.rs index d509fc1657054..23a326b6b090d 100644 --- a/tests/ui/loops/loop-break-value.rs +++ b/tests/ui/loops/loop-break-value.rs @@ -1,5 +1,3 @@ -#![feature(never_type)] - fn main() { let val: ! = loop { break break; }; //~^ ERROR mismatched types diff --git a/tests/ui/mir/enum/wrap_break.rs b/tests/ui/mir/enum/wrap_break.rs index 5c410afa511c7..bd176c0e59797 100644 --- a/tests/ui/mir/enum/wrap_break.rs +++ b/tests/ui/mir/enum/wrap_break.rs @@ -1,7 +1,6 @@ //@ run-crash //@ compile-flags: -C debug-assertions //@ error-pattern: trying to construct an enum from an invalid value 0x0 -#![feature(never_type)] #![allow(invalid_value)] #[allow(dead_code)] diff --git a/tests/ui/mir/mir_calls_to_shims.rs b/tests/ui/mir/mir_calls_to_shims.rs index 9e8dd0c0afbfc..7ba49aa8c50a4 100644 --- a/tests/ui/mir/mir_calls_to_shims.rs +++ b/tests/ui/mir/mir_calls_to_shims.rs @@ -3,7 +3,6 @@ //@ needs-unwind #![feature(fn_traits)] -#![feature(never_type)] use std::panic; diff --git a/tests/ui/never_type/basic/adjust_never.rs b/tests/ui/never_type/basic/adjust_never.rs index aa7ee9ef7ab17..973ed8e859b32 100644 --- a/tests/ui/never_type/basic/adjust_never.rs +++ b/tests/ui/never_type/basic/adjust_never.rs @@ -2,8 +2,6 @@ //@ check-pass -#![feature(never_type)] - fn main() { let x: ! = panic!(); let y: u32 = x; diff --git a/tests/ui/never_type/basic/auto-traits.rs b/tests/ui/never_type/basic/auto-traits.rs index 19554f13b0bac..484829b4a55fd 100644 --- a/tests/ui/never_type/basic/auto-traits.rs +++ b/tests/ui/never_type/basic/auto-traits.rs @@ -1,7 +1,6 @@ //@ check-pass #![feature(auto_traits)] -#![feature(never_type)] fn main() { enum Void {} diff --git a/tests/ui/never_type/basic/call-fn-never-arg-wrong-type.rs b/tests/ui/never_type/basic/call-fn-never-arg-wrong-type.rs index d06637e74a2f2..a2b44e91f1141 100644 --- a/tests/ui/never_type/basic/call-fn-never-arg-wrong-type.rs +++ b/tests/ui/never_type/basic/call-fn-never-arg-wrong-type.rs @@ -1,7 +1,5 @@ // Test that we can't pass other types for ! -#![feature(never_type)] - fn foo(x: !) -> ! { x } diff --git a/tests/ui/never_type/basic/call-fn-never-arg.rs b/tests/ui/never_type/basic/call-fn-never-arg.rs index 546b37fb52f5f..0f85f1077208f 100644 --- a/tests/ui/never_type/basic/call-fn-never-arg.rs +++ b/tests/ui/never_type/basic/call-fn-never-arg.rs @@ -2,7 +2,6 @@ // //@ check-pass -#![feature(never_type)] #![expect(unreachable_code)] fn foo(x: !) -> ! { diff --git a/tests/ui/never_type/basic/cast-never.rs b/tests/ui/never_type/basic/cast-never.rs index eaca210182873..77667d895e843 100644 --- a/tests/ui/never_type/basic/cast-never.rs +++ b/tests/ui/never_type/basic/cast-never.rs @@ -2,8 +2,6 @@ // //@ check-pass -#![feature(never_type)] - fn main() { let x: ! = panic!(); let y: u32 = x as u32; diff --git a/tests/ui/never_type/basic/impl-for-never.rs b/tests/ui/never_type/basic/impl-for-never.rs index e908d2a62547c..fe10b2943d1b8 100644 --- a/tests/ui/never_type/basic/impl-for-never.rs +++ b/tests/ui/never_type/basic/impl-for-never.rs @@ -3,9 +3,6 @@ //@ run-pass //@ check-run-results -#![feature(never_type)] - - trait StringifyType { fn stringify_type() -> &'static str; } diff --git a/tests/ui/never_type/basic/never-assign-wrong-type.rs b/tests/ui/never_type/basic/never-assign-wrong-type.rs index ccc2f872dab43..799786978b0f0 100644 --- a/tests/ui/never_type/basic/never-assign-wrong-type.rs +++ b/tests/ui/never_type/basic/never-assign-wrong-type.rs @@ -1,7 +1,5 @@ // Test that we can't use another type in place of ! -#![feature(never_type)] - fn main() { let x: ! = "hello"; //~ ERROR mismatched types } diff --git a/tests/ui/never_type/basic/never-associated-type.rs b/tests/ui/never_type/basic/never-associated-type.rs index a62ec7e599107..cca38f5096806 100644 --- a/tests/ui/never_type/basic/never-associated-type.rs +++ b/tests/ui/never_type/basic/never-associated-type.rs @@ -2,8 +2,6 @@ // //@ check-pass -#![feature(never_type)] - trait Foo { type Wow; diff --git a/tests/ui/never_type/basic/never-result.rs b/tests/ui/never_type/basic/never-result.rs index 34b7cd67a55a1..c4901498538eb 100644 --- a/tests/ui/never_type/basic/never-result.rs +++ b/tests/ui/never_type/basic/never-result.rs @@ -3,7 +3,6 @@ // //@ run-pass -#![feature(never_type)] #![expect(unused_variables)] #![expect(unreachable_code)] diff --git a/tests/ui/never_type/basic/never-type-arg.rs b/tests/ui/never_type/basic/never-type-arg.rs index 45ce6836e2a40..1c0f10b3b2bfe 100644 --- a/tests/ui/never_type/basic/never-type-arg.rs +++ b/tests/ui/never_type/basic/never-type-arg.rs @@ -2,8 +2,6 @@ // //@ check-pass -#![feature(never_type)] - struct Wub; impl PartialEq for Wub { diff --git a/tests/ui/never_type/basic/never-type-rvalues.rs b/tests/ui/never_type/basic/never-type-rvalues.rs index 943de2563ef81..7595dc01e9c46 100644 --- a/tests/ui/never_type/basic/never-type-rvalues.rs +++ b/tests/ui/never_type/basic/never-type-rvalues.rs @@ -2,7 +2,6 @@ // //@ run-pass -#![feature(never_type)] #![allow(dead_code)] #![allow(path_statements)] #![allow(unreachable_patterns)] diff --git a/tests/ui/never_type/basic/never_transmute_never.rs b/tests/ui/never_type/basic/never_transmute_never.rs index 6d32a12bc44a3..ad00f322b3cc7 100644 --- a/tests/ui/never_type/basic/never_transmute_never.rs +++ b/tests/ui/never_type/basic/never_transmute_never.rs @@ -1,6 +1,5 @@ //@ check-pass -#![feature(never_type)] #![allow(dead_code)] #![expect(unreachable_code)] #![expect(unused_variables)] diff --git a/tests/ui/never_type/diverging-place-match.rs b/tests/ui/never_type/diverging-place-match.rs index b9bc29a218c4a..e029323bc8db5 100644 --- a/tests/ui/never_type/diverging-place-match.rs +++ b/tests/ui/never_type/diverging-place-match.rs @@ -1,5 +1,3 @@ -#![feature(never_type)] - fn not_a_read() -> ! { unsafe { //~^ ERROR mismatched types diff --git a/tests/ui/never_type/empty-never-array.rs b/tests/ui/never_type/empty-never-array.rs index c84d9bd85a3bc..42f5a53fa511c 100644 --- a/tests/ui/never_type/empty-never-array.rs +++ b/tests/ui/never_type/empty-never-array.rs @@ -1,7 +1,5 @@ //@ dont-require-annotations: NOTE -#![feature(never_type)] - enum Helper { T(T, [!; 0]), #[allow(dead_code)] diff --git a/tests/ui/never_type/exhaustive_patterns.rs b/tests/ui/never_type/exhaustive_patterns.rs index 0562575d511e1..f54f98d749cec 100644 --- a/tests/ui/never_type/exhaustive_patterns.rs +++ b/tests/ui/never_type/exhaustive_patterns.rs @@ -3,8 +3,6 @@ // //@ check-fail -#![feature(never_type)] - mod inner { pub struct Wrapper(T); } diff --git a/tests/ui/never_type/fallback_change/try-block-never-type-fallback.rs b/tests/ui/never_type/fallback_change/try-block-never-type-fallback.rs index 94107a0ff103c..770fc6f58c722 100644 --- a/tests/ui/never_type/fallback_change/try-block-never-type-fallback.rs +++ b/tests/ui/never_type/fallback_change/try-block-never-type-fallback.rs @@ -9,7 +9,6 @@ // causing a type error (since (): Into does not hold). // In edition 2024, it falls back to !, allowing the code to compile correctly. -#![feature(never_type)] #![feature(try_blocks)] fn bar(_: Result, u32>) { diff --git a/tests/ui/never_type/never-from-impl-is-reserved.rs b/tests/ui/never_type/never-from-impl-is-reserved.rs index c673462f2962a..4bf80fce1ab05 100644 --- a/tests/ui/never_type/never-from-impl-is-reserved.rs +++ b/tests/ui/never_type/never-from-impl-is-reserved.rs @@ -4,8 +4,6 @@ //@ ignore-compare-mode-next-solver (explicit revisions) //@[next] compile-flags: -Znext-solver=coherence -#![feature(never_type)] - pub struct MyFoo; pub trait MyTrait {} diff --git a/tests/ui/never_type/regress/eq-never-types.rs b/tests/ui/never_type/regress/eq-never-types.rs index c130b9a352142..6d462d918b3bb 100644 --- a/tests/ui/never_type/regress/eq-never-types.rs +++ b/tests/ui/never_type/regress/eq-never-types.rs @@ -3,8 +3,6 @@ //@ edition: 2024 //@ check-pass -#![feature(never_type)] - fn ice(a: !) { a == a; } diff --git a/tests/ui/never_type/regress/never-as-spec-default-associated-type.rs b/tests/ui/never_type/regress/never-as-spec-default-associated-type.rs index c366b6c16b297..9fff364bb62db 100644 --- a/tests/ui/never_type/regress/never-as-spec-default-associated-type.rs +++ b/tests/ui/never_type/regress/never-as-spec-default-associated-type.rs @@ -1,6 +1,6 @@ // Regression test for -#![feature(never_type, specialization)] +#![feature(specialization)] #![allow(incomplete_features)] use std::iter::{self, Empty}; diff --git a/tests/ui/never_type/regress/never-in-range-pat.rs b/tests/ui/never_type/regress/never-in-range-pat.rs index 2e0409bfa6458..9b2847f882d2a 100644 --- a/tests/ui/never_type/regress/never-in-range-pat.rs +++ b/tests/ui/never_type/regress/never-in-range-pat.rs @@ -5,8 +5,6 @@ // This shouldn't be allowed anyways, but we only deny it during MIR // building, so make sure we handle it semi-gracefully during typeck. -#![feature(never_type)] - fn main() { let x: !; match 1 { diff --git a/tests/ui/never_type/regress/span-bug-issue-121445.rs b/tests/ui/never_type/regress/span-bug-issue-121445.rs index 64bf6bd6aa11e..f9f95b6d8e11f 100644 --- a/tests/ui/never_type/regress/span-bug-issue-121445.rs +++ b/tests/ui/never_type/regress/span-bug-issue-121445.rs @@ -1,7 +1,5 @@ // Regression test for -#![feature(never_type)] - fn test2() { let x: !; let c2 = SingleVariant::Points(0) diff --git a/tests/ui/pattern/usefulness/always-inhabited-union-ref.rs b/tests/ui/pattern/usefulness/always-inhabited-union-ref.rs index 335eff425abef..8353ad5c6284e 100644 --- a/tests/ui/pattern/usefulness/always-inhabited-union-ref.rs +++ b/tests/ui/pattern/usefulness/always-inhabited-union-ref.rs @@ -4,7 +4,6 @@ // undecided. This test file currently checks a conservative choice. #![cfg_attr(exhaustive_patterns, feature(exhaustive_patterns))] -#![feature(never_type)] #![allow(dead_code)] #![allow(unreachable_code)] diff --git a/tests/ui/pattern/usefulness/empty-match-check-notes.rs b/tests/ui/pattern/usefulness/empty-match-check-notes.rs index 48d20fd2d5c1b..fda609229ab0e 100644 --- a/tests/ui/pattern/usefulness/empty-match-check-notes.rs +++ b/tests/ui/pattern/usefulness/empty-match-check-notes.rs @@ -2,7 +2,6 @@ //@ revisions: normal exhaustive_patterns // // This tests a match with no arms on various types, and checks NOTEs. -#![feature(never_type)] #![cfg_attr(exhaustive_patterns, feature(exhaustive_patterns))] #![deny(unreachable_patterns)] //~^ NOTE the lint level is defined here diff --git a/tests/ui/pattern/usefulness/empty-match.rs b/tests/ui/pattern/usefulness/empty-match.rs index b34427a7c2388..9f9997e7f698e 100644 --- a/tests/ui/pattern/usefulness/empty-match.rs +++ b/tests/ui/pattern/usefulness/empty-match.rs @@ -1,7 +1,6 @@ //@ revisions: normal exhaustive_patterns // // This tests a match with no arms on various types. -#![feature(never_type)] #![cfg_attr(exhaustive_patterns, feature(exhaustive_patterns))] #![deny(unreachable_patterns)] diff --git a/tests/ui/pattern/usefulness/empty-types.rs b/tests/ui/pattern/usefulness/empty-types.rs index d4fdb7c1dd46a..9cb23a5c1b746 100644 --- a/tests/ui/pattern/usefulness/empty-types.rs +++ b/tests/ui/pattern/usefulness/empty-types.rs @@ -6,7 +6,6 @@ // Most of the subtlety of this file happens in scrutinee places which are not required to hold // valid data, namely dereferences and union field accesses. In these cases, empty arms can // generally not be omitted, except with `exhaustive_patterns` which ignores this.. -#![feature(never_type)] #![cfg_attr(exhaustive_patterns, feature(exhaustive_patterns))] #![cfg_attr(never_pats, feature(never_patterns))] #![allow(dead_code, unreachable_code)] diff --git a/tests/ui/pattern/usefulness/explain-unreachable-pats.rs b/tests/ui/pattern/usefulness/explain-unreachable-pats.rs index f1af7f294cbd8..502ab7b2a14e7 100644 --- a/tests/ui/pattern/usefulness/explain-unreachable-pats.rs +++ b/tests/ui/pattern/usefulness/explain-unreachable-pats.rs @@ -1,4 +1,3 @@ -#![feature(never_type)] #![feature(exhaustive_patterns)] #![deny(unreachable_patterns)] //~^ NOTE lint level is defined here diff --git a/tests/ui/pattern/usefulness/impl-trait.rs b/tests/ui/pattern/usefulness/impl-trait.rs index 47cee17b57994..f04633ebef2f6 100644 --- a/tests/ui/pattern/usefulness/impl-trait.rs +++ b/tests/ui/pattern/usefulness/impl-trait.rs @@ -1,4 +1,3 @@ -#![feature(never_type)] #![feature(type_alias_impl_trait)] #![feature(non_exhaustive_omitted_patterns_lint)] #![feature(exhaustive_patterns)] diff --git a/tests/ui/pattern/usefulness/match-privately-empty.rs b/tests/ui/pattern/usefulness/match-privately-empty.rs index bfea15af18011..1c439e0135c12 100644 --- a/tests/ui/pattern/usefulness/match-privately-empty.rs +++ b/tests/ui/pattern/usefulness/match-privately-empty.rs @@ -1,6 +1,5 @@ //@ revisions: normal exhaustive_patterns #![cfg_attr(exhaustive_patterns, feature(exhaustive_patterns))] -#![feature(never_type)] mod private { pub struct Private { diff --git a/tests/ui/pattern/usefulness/slice_of_empty.rs b/tests/ui/pattern/usefulness/slice_of_empty.rs index e186ba5134d5f..fba9f1083ba1b 100644 --- a/tests/ui/pattern/usefulness/slice_of_empty.rs +++ b/tests/ui/pattern/usefulness/slice_of_empty.rs @@ -1,6 +1,5 @@ //@ revisions: normal exhaustive_patterns #![cfg_attr(exhaustive_patterns, feature(exhaustive_patterns))] -#![feature(never_type)] #![deny(unreachable_patterns)] fn main() {} diff --git a/tests/ui/pattern/usefulness/uninhabited.rs b/tests/ui/pattern/usefulness/uninhabited.rs index 2e2c7cae65cbc..c3c350af130d7 100644 --- a/tests/ui/pattern/usefulness/uninhabited.rs +++ b/tests/ui/pattern/usefulness/uninhabited.rs @@ -4,7 +4,6 @@ // // This tests plays with matching and uninhabited types. This also serves as a test for the // `Ty::is_inhabited_from` function. -#![feature(never_type)] #![deny(unreachable_patterns)] macro_rules! assert_empty { diff --git a/tests/ui/print_type_sizes/uninhabited.rs b/tests/ui/print_type_sizes/uninhabited.rs index 7cb3e5b33fa56..b55707d041088 100644 --- a/tests/ui/print_type_sizes/uninhabited.rs +++ b/tests/ui/print_type_sizes/uninhabited.rs @@ -4,8 +4,6 @@ // ^-- needed because `--pass check` does not emit the output needed. // FIXME: consider using an attribute instead of side-effects. -#![feature(never_type)] - pub fn test() { let _x: Option = None; let _y: Result = Ok(42); diff --git a/tests/ui/raw-ref-op/never-place-isnt-diverging.rs b/tests/ui/raw-ref-op/never-place-isnt-diverging.rs index 80d441729f746..8f41363ffc6b0 100644 --- a/tests/ui/raw-ref-op/never-place-isnt-diverging.rs +++ b/tests/ui/raw-ref-op/never-place-isnt-diverging.rs @@ -1,5 +1,3 @@ -#![feature(never_type)] - fn make_up_a_value() -> T { unsafe { //~^ ERROR mismatched types diff --git a/tests/ui/reachable/expr_add.rs b/tests/ui/reachable/expr_add.rs index b45e5daf42c8d..640c2a2cf8fcc 100644 --- a/tests/ui/reachable/expr_add.rs +++ b/tests/ui/reachable/expr_add.rs @@ -1,4 +1,3 @@ -#![feature(never_type)] #![allow(unused_variables)] #![deny(unreachable_code)] diff --git a/tests/ui/reachable/expr_assign.rs b/tests/ui/reachable/expr_assign.rs index e547f75e2697b..3914fb32432ef 100644 --- a/tests/ui/reachable/expr_assign.rs +++ b/tests/ui/reachable/expr_assign.rs @@ -1,4 +1,3 @@ -#![feature(never_type)] #![allow(unused_variables)] #![allow(unused_assignments)] #![allow(dead_code)] diff --git a/tests/ui/reachable/expr_call.rs b/tests/ui/reachable/expr_call.rs index 1eaa96c3ce773..ce1a94e3c4a25 100644 --- a/tests/ui/reachable/expr_call.rs +++ b/tests/ui/reachable/expr_call.rs @@ -1,4 +1,3 @@ -#![feature(never_type)] #![allow(unused_variables)] #![allow(unused_assignments)] #![allow(dead_code)] diff --git a/tests/ui/reachable/expr_method.rs b/tests/ui/reachable/expr_method.rs index d917df05b3c3d..e74a7daec8828 100644 --- a/tests/ui/reachable/expr_method.rs +++ b/tests/ui/reachable/expr_method.rs @@ -1,4 +1,3 @@ -#![feature(never_type)] #![allow(unused_variables)] #![allow(unused_assignments)] #![allow(dead_code)] diff --git a/tests/ui/reachable/expr_type.rs b/tests/ui/reachable/expr_type.rs index 1ceb2f8597160..c0a5452f4ad0c 100644 --- a/tests/ui/reachable/expr_type.rs +++ b/tests/ui/reachable/expr_type.rs @@ -2,7 +2,7 @@ #![allow(unused_assignments)] #![allow(dead_code)] #![deny(unreachable_code)] -#![feature(never_type, type_ascription)] +#![feature(type_ascription)] fn a() { // the cast is unreachable: diff --git a/tests/ui/reachable/expr_unary.rs b/tests/ui/reachable/expr_unary.rs index 190c7447dccbe..6b54822a2b0ee 100644 --- a/tests/ui/reachable/expr_unary.rs +++ b/tests/ui/reachable/expr_unary.rs @@ -1,4 +1,3 @@ -#![feature(never_type)] #![allow(unused_variables)] #![allow(unused_assignments)] #![allow(dead_code)] diff --git a/tests/ui/reachable/nested_type_ascription.rs b/tests/ui/reachable/nested_type_ascription.rs index 1712ee00b17c8..5f8fc09db81a2 100644 --- a/tests/ui/reachable/nested_type_ascription.rs +++ b/tests/ui/reachable/nested_type_ascription.rs @@ -5,7 +5,6 @@ // //@ check-pass -#![feature(never_type)] #![feature(type_ascription)] #![deny(unreachable_code)] diff --git a/tests/ui/reachable/never-assign-dead-code.rs b/tests/ui/reachable/never-assign-dead-code.rs index 05e5d5551336b..249f12628408e 100644 --- a/tests/ui/reachable/never-assign-dead-code.rs +++ b/tests/ui/reachable/never-assign-dead-code.rs @@ -2,7 +2,6 @@ // //@ check-pass -#![feature(never_type)] #![expect(dropping_copy_types)] #![warn(unused)] diff --git a/tests/ui/reachable/type_ascribe_never_field.rs b/tests/ui/reachable/type_ascribe_never_field.rs index 2788d30414e69..48f540ca96237 100644 --- a/tests/ui/reachable/type_ascribe_never_field.rs +++ b/tests/ui/reachable/type_ascribe_never_field.rs @@ -5,7 +5,6 @@ // //@ check-pass -#![feature(never_type)] #![feature(type_ascription)] #![deny(unreachable_code)] diff --git a/tests/ui/reachable/unreachable-try-pattern.rs b/tests/ui/reachable/unreachable-try-pattern.rs index 1358722e229ce..5d787fc5966f8 100644 --- a/tests/ui/reachable/unreachable-try-pattern.rs +++ b/tests/ui/reachable/unreachable-try-pattern.rs @@ -1,5 +1,5 @@ //@ check-pass -#![feature(never_type, exhaustive_patterns)] +#![feature(exhaustive_patterns)] #![warn(unreachable_code)] #![warn(unreachable_patterns)] diff --git a/tests/ui/reachable/unwarned-match-on-never.rs b/tests/ui/reachable/unwarned-match-on-never.rs index 71f8fe3a783e2..c38ea6ab9ad01 100644 --- a/tests/ui/reachable/unwarned-match-on-never.rs +++ b/tests/ui/reachable/unwarned-match-on-never.rs @@ -1,8 +1,6 @@ #![deny(unreachable_code)] #![allow(dead_code)] -#![feature(never_type)] - fn foo(x: !) -> bool { // Explicit matches on the never type are unwarned. match x {} diff --git a/tests/ui/rfcs/rfc-0000-never_patterns/ICE-133063-never-arm-no-otherwise-block.rs b/tests/ui/rfcs/rfc-0000-never_patterns/ICE-133063-never-arm-no-otherwise-block.rs index 4f52f6ee4bd91..7597ef41b0c84 100644 --- a/tests/ui/rfcs/rfc-0000-never_patterns/ICE-133063-never-arm-no-otherwise-block.rs +++ b/tests/ui/rfcs/rfc-0000-never_patterns/ICE-133063-never-arm-no-otherwise-block.rs @@ -1,4 +1,3 @@ -#![feature(never_type)] #![feature(never_patterns)] #![allow(incomplete_features)] diff --git a/tests/ui/rfcs/rfc-0000-never_patterns/ICE-133117-duplicate-never-arm.rs b/tests/ui/rfcs/rfc-0000-never_patterns/ICE-133117-duplicate-never-arm.rs index bca2ab5657021..484583c30b969 100644 --- a/tests/ui/rfcs/rfc-0000-never_patterns/ICE-133117-duplicate-never-arm.rs +++ b/tests/ui/rfcs/rfc-0000-never_patterns/ICE-133117-duplicate-never-arm.rs @@ -1,4 +1,3 @@ -#![feature(never_type)] #![feature(never_patterns)] #![allow(incomplete_features)] diff --git a/tests/ui/rfcs/rfc-0000-never_patterns/never-pattern-is-a-read.rs b/tests/ui/rfcs/rfc-0000-never_patterns/never-pattern-is-a-read.rs index 8dff48de60aa5..8d9d91204959d 100644 --- a/tests/ui/rfcs/rfc-0000-never_patterns/never-pattern-is-a-read.rs +++ b/tests/ui/rfcs/rfc-0000-never_patterns/never-pattern-is-a-read.rs @@ -1,6 +1,5 @@ // Make sure we consider `!` to be a union read. - -#![feature(never_type, never_patterns)] +#![feature(never_patterns)] union U { a: !, diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/auxiliary/uninhabited.rs b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/auxiliary/uninhabited.rs index e1799761b6961..9e6f0142bb37c 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/auxiliary/uninhabited.rs +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/auxiliary/uninhabited.rs @@ -1,5 +1,4 @@ #![crate_type = "rlib"] -#![feature(never_type)] #[non_exhaustive] pub enum UninhabitedEnum { diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/coercions.rs b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/coercions.rs index 4804d34a920ca..857185e8aac3a 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/coercions.rs +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/coercions.rs @@ -1,5 +1,4 @@ //@ aux-build:uninhabited.rs -#![feature(never_type)] extern crate uninhabited; diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/coercions_same_crate.rs b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/coercions_same_crate.rs index 6b911dd989cc5..c3c0ce650d73e 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/coercions_same_crate.rs +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/coercions_same_crate.rs @@ -1,5 +1,3 @@ -#![feature(never_type)] - #[non_exhaustive] pub enum UninhabitedEnum { } diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/indirect_match.rs b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/indirect_match.rs index c7a7c927c0c23..9d19189b819da 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/indirect_match.rs +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/indirect_match.rs @@ -1,5 +1,4 @@ //@ aux-build:uninhabited.rs -#![feature(never_type)] extern crate uninhabited; diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/indirect_match_same_crate.rs b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/indirect_match_same_crate.rs index d81896eba1956..be4856bf26f49 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/indirect_match_same_crate.rs +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/indirect_match_same_crate.rs @@ -1,5 +1,4 @@ //@ check-pass -#![feature(never_type)] #[non_exhaustive] pub enum UninhabitedEnum { diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/indirect_match_with_exhaustive_patterns.rs b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/indirect_match_with_exhaustive_patterns.rs index dd9a570522a26..0d940bae74dd6 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/indirect_match_with_exhaustive_patterns.rs +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/indirect_match_with_exhaustive_patterns.rs @@ -1,6 +1,5 @@ //@ aux-build:uninhabited.rs #![deny(unreachable_patterns)] -#![feature(never_type)] extern crate uninhabited; diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/indirect_match_with_exhaustive_patterns_same_crate.rs b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/indirect_match_with_exhaustive_patterns_same_crate.rs index 32f5f504136ab..802f994aab9f8 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/indirect_match_with_exhaustive_patterns_same_crate.rs +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/indirect_match_with_exhaustive_patterns_same_crate.rs @@ -1,7 +1,6 @@ //@ check-pass #![deny(unreachable_patterns)] -#![feature(never_type)] #[non_exhaustive] pub enum UninhabitedEnum { diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/issue-65157-repeated-match-arm.rs b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/issue-65157-repeated-match-arm.rs index ca7c528715420..e7bc2525a6830 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/issue-65157-repeated-match-arm.rs +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/issue-65157-repeated-match-arm.rs @@ -1,6 +1,5 @@ //@ aux-build:uninhabited.rs #![deny(unreachable_patterns)] -#![feature(never_type)] extern crate uninhabited; diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match.rs b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match.rs index 58d7bbd2c1730..f1caf15a79402 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match.rs +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match.rs @@ -1,5 +1,4 @@ //@ aux-build:uninhabited.rs -#![feature(never_type)] extern crate uninhabited; diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_same_crate.rs b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_same_crate.rs index 04f7fe26b5ae1..b15d09d49cd07 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_same_crate.rs +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_same_crate.rs @@ -1,5 +1,4 @@ //@ check-pass -#![feature(never_type)] #[non_exhaustive] pub enum UninhabitedEnum { diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.rs b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.rs index c214581549cd7..7b19825da1330 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.rs +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.rs @@ -1,6 +1,5 @@ //@ aux-build:uninhabited.rs #![deny(unreachable_patterns)] -#![feature(never_type)] extern crate uninhabited; diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns_same_crate.rs b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns_same_crate.rs index 9662016221278..5f79abf27eeb9 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns_same_crate.rs +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns_same_crate.rs @@ -1,6 +1,5 @@ //@ check-pass #![deny(unreachable_patterns)] -#![feature(never_type)] #[non_exhaustive] pub enum UninhabitedEnum { diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/patterns_same_crate.rs b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/patterns_same_crate.rs index 3d89ca15d3778..c12963a6f9c48 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/patterns_same_crate.rs +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/patterns_same_crate.rs @@ -1,6 +1,5 @@ #![feature(exhaustive_patterns)] #![deny(unreachable_patterns)] -#![feature(never_type)] #[non_exhaustive] pub enum UninhabitedEnum { diff --git a/tests/ui/scalable-vectors/illformed-element-type.rs b/tests/ui/scalable-vectors/illformed-element-type.rs index 8461b0a067ff8..ce406cb5f725b 100644 --- a/tests/ui/scalable-vectors/illformed-element-type.rs +++ b/tests/ui/scalable-vectors/illformed-element-type.rs @@ -2,7 +2,6 @@ //@ only-aarch64 #![allow(internal_features)] #![feature(extern_types)] -#![feature(never_type)] #![feature(rustc_attrs)] struct Foo; diff --git a/tests/ui/statics/uninhabited-static.rs b/tests/ui/statics/uninhabited-static.rs index febbca6f0026d..3dc1975f970be 100644 --- a/tests/ui/statics/uninhabited-static.rs +++ b/tests/ui/statics/uninhabited-static.rs @@ -1,5 +1,3 @@ -#![feature(never_type)] - enum Void {} extern "C" { static VOID: Void; //~ ERROR static of uninhabited type diff --git a/tests/ui/structs-enums/type-sizes.rs b/tests/ui/structs-enums/type-sizes.rs index a8fadcc1d1ec6..7e4b3c8ad73af 100644 --- a/tests/ui/structs-enums/type-sizes.rs +++ b/tests/ui/structs-enums/type-sizes.rs @@ -3,7 +3,6 @@ #![allow(non_camel_case_types)] #![allow(dead_code)] -#![feature(never_type)] #![feature(pointer_is_aligned_to)] #![feature(rustc_attrs)] diff --git a/tests/ui/symbol-names/types.rs b/tests/ui/symbol-names/types.rs index a4bbbaa02f278..c0ce609d6a9bf 100644 --- a/tests/ui/symbol-names/types.rs +++ b/tests/ui/symbol-names/types.rs @@ -7,7 +7,6 @@ //@ normalize-stderr: "h[[:xdigit:]]{16}" -> "h[HASH]" //@ [v0] normalize-stderr: "\[[[:xdigit:]]{16}\]" -> "[HASH]" -#![feature(never_type)] #![feature(rustc_attrs)] #![feature(f128)] #![feature(f16)] diff --git a/tests/ui/traits/const-traits/const-drop.rs b/tests/ui/traits/const-traits/const-drop.rs index f7c3ec9be331d..e30368d1b2758 100644 --- a/tests/ui/traits/const-traits/const-drop.rs +++ b/tests/ui/traits/const-traits/const-drop.rs @@ -3,7 +3,6 @@ //@ revisions: stock precise #![feature(const_trait_impl, const_destruct)] -#![feature(never_type)] #![cfg_attr(precise, feature(const_precise_live_drops))] use std::marker::Destruct; diff --git a/tests/ui/traits/next-solver/typeck/resolve-before-checking-never.rs b/tests/ui/traits/next-solver/typeck/resolve-before-checking-never.rs index 6df1fd5d4ba16..7b1a7372b0b25 100644 --- a/tests/ui/traits/next-solver/typeck/resolve-before-checking-never.rs +++ b/tests/ui/traits/next-solver/typeck/resolve-before-checking-never.rs @@ -1,8 +1,6 @@ //@ check-pass //@ compile-flags: -Znext-solver -#![feature(never_type)] - trait Mirror { type Assoc; } diff --git a/tests/ui/transmutability/char.rs b/tests/ui/transmutability/char.rs index 55a6153732955..ddf6da564ddea 100644 --- a/tests/ui/transmutability/char.rs +++ b/tests/ui/transmutability/char.rs @@ -1,4 +1,3 @@ -#![feature(never_type)] #![feature(transmutability)] use std::mem::{Assume, TransmuteFrom}; diff --git a/tests/ui/uninhabited/projection.rs b/tests/ui/uninhabited/projection.rs index 395eeb675791e..51475de92c120 100644 --- a/tests/ui/uninhabited/projection.rs +++ b/tests/ui/uninhabited/projection.rs @@ -1,6 +1,6 @@ //@ check-pass -#![feature(never_type, exhaustive_patterns)] +#![feature(exhaustive_patterns)] trait Tag { type TagType; diff --git a/tests/ui/uninhabited/uninhabited-irrefutable.rs b/tests/ui/uninhabited/uninhabited-irrefutable.rs index 9f4731e6e71a2..43616aa8acbc8 100644 --- a/tests/ui/uninhabited/uninhabited-irrefutable.rs +++ b/tests/ui/uninhabited/uninhabited-irrefutable.rs @@ -1,6 +1,5 @@ //@ revisions: normal exhaustive_patterns #![cfg_attr(exhaustive_patterns, feature(exhaustive_patterns))] -#![feature(never_type)] mod foo { pub struct SecretlyEmpty { diff --git a/tests/ui/uninhabited/uninhabited-patterns.rs b/tests/ui/uninhabited/uninhabited-patterns.rs index 1f30af2acc697..0c811c5b7c748 100644 --- a/tests/ui/uninhabited/uninhabited-patterns.rs +++ b/tests/ui/uninhabited/uninhabited-patterns.rs @@ -1,6 +1,5 @@ #![feature(exhaustive_patterns)] #![feature(box_patterns)] -#![feature(never_type)] #![deny(unreachable_patterns)] mod foo { diff --git a/tests/ui/uninhabited/uninhabited-unstable-field.rs b/tests/ui/uninhabited/uninhabited-unstable-field.rs index 321b864aa27de..f59b9c0a98efd 100644 --- a/tests/ui/uninhabited/uninhabited-unstable-field.rs +++ b/tests/ui/uninhabited/uninhabited-unstable-field.rs @@ -4,7 +4,6 @@ //! been reverted, and this file ensures that we don't special-case unstable fields wrt //! inhabitedness anymore. #![feature(exhaustive_patterns)] -#![feature(never_type)] #![feature(my_coro_state)] // Custom feature from `staged-api.rs` #![deny(unreachable_patterns)] diff --git a/tests/ui/unpretty/exhaustive.expanded.stdout b/tests/ui/unpretty/exhaustive.expanded.stdout index f555904e5dd7d..f2488029bffda 100644 --- a/tests/ui/unpretty/exhaustive.expanded.stdout +++ b/tests/ui/unpretty/exhaustive.expanded.stdout @@ -20,7 +20,6 @@ #![feature(gen_blocks)] #![feature(more_qualified_paths)] #![feature(never_patterns)] -#![feature(never_type)] #![feature(pattern_types)] #![feature(pattern_type_macro)] #![feature(prelude_import)] diff --git a/tests/ui/unpretty/exhaustive.rs b/tests/ui/unpretty/exhaustive.rs index 0bbc87845695f..1ab664434e1f6 100644 --- a/tests/ui/unpretty/exhaustive.rs +++ b/tests/ui/unpretty/exhaustive.rs @@ -19,7 +19,6 @@ #![feature(gen_blocks)] #![feature(more_qualified_paths)] #![feature(never_patterns)] -#![feature(never_type)] #![feature(pattern_types)] #![feature(pattern_type_macro)] #![feature(prelude_import)] From d3a77235e12d6c4285e537cbd26c96e3ff5a3a94 Mon Sep 17 00:00:00 2001 From: Waffle Lapkin Date: Fri, 15 Aug 2025 02:32:46 +0200 Subject: [PATCH 06/18] remove `#![feature(never_type)]` from library --- library/alloc/src/lib.rs | 1 - library/alloctests/lib.rs | 1 - library/core/src/lib.rs | 1 - library/core/src/mem/mod.rs | 1 - library/core/src/primitive_docs.rs | 2 -- library/core/src/result.rs | 2 -- library/coretests/tests/lib.rs | 1 - library/std/src/keyword_docs.rs | 1 - library/std/src/lib.rs | 1 - 9 files changed, 11 deletions(-) diff --git a/library/alloc/src/lib.rs b/library/alloc/src/lib.rs index 344b46f01b756..f469910ef9fee 100644 --- a/library/alloc/src/lib.rs +++ b/library/alloc/src/lib.rs @@ -183,7 +183,6 @@ #![feature(min_specialization)] #![feature(multiple_supertrait_upcastable)] #![feature(negative_impls)] -#![feature(never_type)] #![feature(optimize_attribute)] #![feature(rustc_attrs)] #![feature(slice_internals)] diff --git a/library/alloctests/lib.rs b/library/alloctests/lib.rs index e09d8495fdeac..6778f25de5d21 100644 --- a/library/alloctests/lib.rs +++ b/library/alloctests/lib.rs @@ -57,7 +57,6 @@ #![feature(const_trait_impl)] #![feature(dropck_eyepatch)] #![feature(min_specialization)] -#![feature(never_type)] #![feature(optimize_attribute)] #![feature(prelude_import)] #![feature(rustc_attrs)] diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index 312295154dc52..ccdf5646365fd 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -152,7 +152,6 @@ #![feature(multiple_supertrait_upcastable)] #![feature(must_not_suspend)] #![feature(negative_impls)] -#![feature(never_type)] #![feature(no_core)] #![feature(optimize_attribute)] #![feature(pattern_types)] diff --git a/library/core/src/mem/mod.rs b/library/core/src/mem/mod.rs index a987970c9bcc3..651c143bca36a 100644 --- a/library/core/src/mem/mod.rs +++ b/library/core/src/mem/mod.rs @@ -1245,7 +1245,6 @@ pub const fn discriminant(v: &T) -> Discriminant { /// # Examples /// /// ``` -/// # #![feature(never_type)] /// # #![feature(variant_count)] /// /// use std::mem; diff --git a/library/core/src/primitive_docs.rs b/library/core/src/primitive_docs.rs index db61aba59277d..46984b8592e4c 100644 --- a/library/core/src/primitive_docs.rs +++ b/library/core/src/primitive_docs.rs @@ -73,7 +73,6 @@ mod prim_bool {} /// write: /// /// ``` -/// #![feature(never_type)] /// # fn foo() -> u32 { /// let x: ! = { /// return 123 @@ -230,7 +229,6 @@ mod prim_bool {} /// for example: /// /// ``` -/// #![feature(never_type)] /// # use std::fmt; /// # trait Debug { /// # fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result; diff --git a/library/core/src/result.rs b/library/core/src/result.rs index 5f438d72ac13c..4ea35279ecc36 100644 --- a/library/core/src/result.rs +++ b/library/core/src/result.rs @@ -1344,7 +1344,6 @@ impl Result { /// # Examples /// /// ``` - /// # #![feature(never_type)] /// # #![feature(unwrap_infallible)] /// /// fn only_good_news() -> Result { @@ -1381,7 +1380,6 @@ impl Result { /// # Examples /// /// ``` - /// # #![feature(never_type)] /// # #![feature(unwrap_infallible)] /// /// fn only_bad_news() -> Result { diff --git a/library/coretests/tests/lib.rs b/library/coretests/tests/lib.rs index 7fc779d3d082f..d4bfab3e1c2a6 100644 --- a/library/coretests/tests/lib.rs +++ b/library/coretests/tests/lib.rs @@ -85,7 +85,6 @@ #![feature(maybe_uninit_fill)] #![feature(maybe_uninit_uninit_array_transpose)] #![feature(min_specialization)] -#![feature(never_type)] #![feature(next_index)] #![feature(non_exhaustive_omitted_patterns_lint)] #![feature(nonzero_from_str_radix)] diff --git a/library/std/src/keyword_docs.rs b/library/std/src/keyword_docs.rs index dc0d11b07a9f3..fe04c8c89d0fa 100644 --- a/library/std/src/keyword_docs.rs +++ b/library/std/src/keyword_docs.rs @@ -2213,7 +2213,6 @@ mod type_keyword {} /// It is also possible to have `unsafe fn` in a regular safe `trait`: /// /// ```rust -/// # #![feature(never_type)] /// #![deny(unsafe_op_in_unsafe_fn)] /// /// trait Indexable { diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs index 7cc526b426723..167a8bdf254d0 100644 --- a/library/std/src/lib.rs +++ b/library/std/src/lib.rs @@ -294,7 +294,6 @@ #![feature(must_not_suspend)] #![feature(needs_panic_runtime)] #![feature(negative_impls)] -#![feature(never_type)] #![feature(optimize_attribute)] #![feature(prelude_import)] #![feature(rustc_attrs)] From 3d6df718571988e877607043d04e6c6e49c791aa Mon Sep 17 00:00:00 2001 From: Waffle Lapkin Date: Fri, 15 Aug 2025 02:32:46 +0200 Subject: [PATCH 07/18] remove `#![feature(never_type)]` from tools --- src/tools/clippy/clippy_lints/src/lib.rs | 2 +- .../src/zero_repeat_side_effects.rs | 5 +-- src/tools/clippy/clippy_utils/src/lib.rs | 2 +- src/tools/clippy/tests/ui/double_must_use.rs | 1 - .../clippy/tests/ui/double_must_use.stderr | 12 +++---- .../clippy/tests/ui/drop_non_drop.stderr | 2 +- src/tools/clippy/tests/ui/empty_enums.rs | 1 - src/tools/clippy/tests/ui/empty_enums.stderr | 2 +- .../ui/empty_enums_without_never_type.rs | 8 ----- .../ui/infallible_destructuring_match.fixed | 2 +- .../ui/infallible_destructuring_match.rs | 2 +- .../clippy/tests/ui/infallible_try_from.rs | 1 - .../tests/ui/infallible_try_from.stderr | 4 +-- .../clippy/tests/ui/must_use_candidates.fixed | 1 - .../clippy/tests/ui/must_use_candidates.rs | 1 - .../tests/ui/must_use_candidates.stderr | 14 ++++---- .../tests/ui/result_map_unit_fn_unfixable.rs | 1 - .../ui/result_map_unit_fn_unfixable.stderr | 12 +++---- .../clippy/tests/ui/uninhabited_references.rs | 1 - .../tests/ui/uninhabited_references.stderr | 8 ++--- .../clippy/tests/ui/unwrap_expect_used.rs | 1 - .../clippy/tests/ui/unwrap_expect_used.stderr | 32 +++++++++---------- ...ro_repeat_side_effects_never_pattern.fixed | 1 - .../zero_repeat_side_effects_never_pattern.rs | 1 - ...o_repeat_side_effects_never_pattern.stderr | 2 +- .../zero_repeat_side_effects_unfixable.stderr | 6 +++- src/tools/miri/src/lib.rs | 2 +- .../dangling_pointer_deref_match_never.rs | 1 - src/tools/miri/tests/fail/erroneous_const.rs | 1 - .../intrinsics/uninit_uninhabited_type.rs | 2 -- .../match/closures/uninhabited-variant1.rs | 1 - .../match/closures/uninhabited-variant2.rs | 1 - .../fail/match/only_inhabited_variant.rs | 1 - .../miri/tests/fail/never_match_never.rs | 1 - src/tools/miri/tests/fail/never_say_never.rs | 1 - .../miri/tests/fail/never_transmute_humans.rs | 2 -- .../miri/tests/fail/never_transmute_void.rs | 1 - .../invalid_enum_op_discr_uninhabited.rs | 1 - .../fail/validity/ref_to_uninhabited1.rs | 1 - .../fail/validity/uninhabited_variant.rs | 1 - src/tools/miri/tests/pass/async-fn.rs | 2 -- src/tools/miri/tests/pass/coroutine.rs | 2 +- .../tests/pass/function_calls/abi_compat.rs | 2 -- .../issue-120337-irrefutable-let-ice.rs | 1 - src/tools/miri/tests/pass/loop-break-value.rs | 1 - .../miri/tests/pass/panic/catch_panic.rs | 1 - .../miri/tests/pass/underscore_pattern.rs | 1 - 47 files changed, 56 insertions(+), 96 deletions(-) delete mode 100644 src/tools/clippy/tests/ui/empty_enums_without_never_type.rs diff --git a/src/tools/clippy/clippy_lints/src/lib.rs b/src/tools/clippy/clippy_lints/src/lib.rs index 68a8f51e7f4d3..20c28a2782031 100644 --- a/src/tools/clippy/clippy_lints/src/lib.rs +++ b/src/tools/clippy/clippy_lints/src/lib.rs @@ -6,7 +6,7 @@ #![feature(iter_intersperse)] #![feature(iter_partition_in_place)] #![feature(macro_metavar_expr_concat)] -#![feature(never_type)] +#![cfg_attr(bootstrap, feature(never_type))] #![feature(rustc_private)] #![feature(stmt_expr_attributes)] #![feature(unwrap_infallible)] diff --git a/src/tools/clippy/clippy_lints/src/zero_repeat_side_effects.rs b/src/tools/clippy/clippy_lints/src/zero_repeat_side_effects.rs index cb254cc156296..73f749f24d572 100644 --- a/src/tools/clippy/clippy_lints/src/zero_repeat_side_effects.rs +++ b/src/tools/clippy/clippy_lints/src/zero_repeat_side_effects.rs @@ -74,7 +74,6 @@ fn inner_check(cx: &LateContext<'_>, expr: &'_ Expr<'_>, inner_expr: &'_ Expr<'_ // check if expr is a call or has a call inside it if inner_expr.can_have_side_effects() { let parent_hir_node = cx.tcx.parent_hir_node(expr.hir_id); - let inner_expr_ty = cx.typeck_results().expr_ty(inner_expr); let return_type = cx.typeck_results().expr_ty(expr); let inner_expr = snippet(cx, inner_expr.span.source_callsite(), ".."); @@ -119,9 +118,7 @@ fn inner_check(cx: &LateContext<'_>, expr: &'_ Expr<'_>, inner_expr: &'_ Expr<'_ span, "expression with side effects as the initial value in a zero-sized array initializer", |diag| { - if (!inner_expr_ty.is_never() || cx.tcx.features().never_type()) - && return_type.is_suggestable(cx.tcx, true) - { + if return_type.is_suggestable(cx.tcx, true) { diag.span_suggestion_verbose( span, "consider performing the side effect separately", diff --git a/src/tools/clippy/clippy_utils/src/lib.rs b/src/tools/clippy/clippy_utils/src/lib.rs index a8ff9b4cf6fb5..77215e36fc94c 100644 --- a/src/tools/clippy/clippy_utils/src/lib.rs +++ b/src/tools/clippy/clippy_utils/src/lib.rs @@ -1,6 +1,6 @@ #![feature(box_patterns)] #![feature(macro_metavar_expr)] -#![feature(never_type)] +#![cfg_attr(bootstrap, feature(never_type))] #![feature(rustc_private)] #![feature(unwrap_infallible)] #![recursion_limit = "512"] diff --git a/src/tools/clippy/tests/ui/double_must_use.rs b/src/tools/clippy/tests/ui/double_must_use.rs index c8b5828889fc8..93389b3d54a34 100644 --- a/src/tools/clippy/tests/ui/double_must_use.rs +++ b/src/tools/clippy/tests/ui/double_must_use.rs @@ -1,6 +1,5 @@ #![warn(clippy::double_must_use)] #![allow(clippy::result_unit_err)] -#![feature(never_type)] use std::ops::ControlFlow; diff --git a/src/tools/clippy/tests/ui/double_must_use.stderr b/src/tools/clippy/tests/ui/double_must_use.stderr index 50b1640c47f5f..7e923a7dcb08c 100644 --- a/src/tools/clippy/tests/ui/double_must_use.stderr +++ b/src/tools/clippy/tests/ui/double_must_use.stderr @@ -1,5 +1,5 @@ error: this function has a `#[must_use]` attribute with no message, but returns a type already marked as `#[must_use]` - --> tests/ui/double_must_use.rs:8:1 + --> tests/ui/double_must_use.rs:7:1 | LL | pub fn must_use_result() -> Result<(), ()> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -9,7 +9,7 @@ LL | pub fn must_use_result() -> Result<(), ()> { = help: to override `-D warnings` add `#[allow(clippy::double_must_use)]` error: this function has a `#[must_use]` attribute with no message, but returns a type already marked as `#[must_use]` - --> tests/ui/double_must_use.rs:15:1 + --> tests/ui/double_must_use.rs:14:1 | LL | pub fn must_use_tuple() -> (Result<(), ()>, u8) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -17,7 +17,7 @@ LL | pub fn must_use_tuple() -> (Result<(), ()>, u8) { = help: either add some descriptive message or remove the attribute error: this function has a `#[must_use]` attribute with no message, but returns a type already marked as `#[must_use]` - --> tests/ui/double_must_use.rs:22:1 + --> tests/ui/double_must_use.rs:21:1 | LL | pub fn must_use_array() -> [Result<(), ()>; 1] { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -25,7 +25,7 @@ LL | pub fn must_use_array() -> [Result<(), ()>; 1] { = help: either add some descriptive message or remove the attribute error: this function has a `#[must_use]` attribute with no message, but returns a type already marked as `#[must_use]` - --> tests/ui/double_must_use.rs:40:1 + --> tests/ui/double_must_use.rs:39:1 | LL | async fn async_must_use_result() -> Result<(), ()> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -33,7 +33,7 @@ LL | async fn async_must_use_result() -> Result<(), ()> { = help: either add some descriptive message or remove the attribute error: this function has a `#[must_use]` attribute with no message, but returns a type already marked as `#[must_use]` - --> tests/ui/double_must_use.rs:55:1 + --> tests/ui/double_must_use.rs:54:1 | LL | pub fn must_use_result_with_uninhabited_2() -> Result { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -41,7 +41,7 @@ LL | pub fn must_use_result_with_uninhabited_2() -> Result { = help: either add some descriptive message or remove the attribute error: this function has a `#[must_use]` attribute with no message, but returns a type already marked as `#[must_use]` - --> tests/ui/double_must_use.rs:66:1 + --> tests/ui/double_must_use.rs:65:1 | LL | pub fn must_use_controlflow_with_uninhabited_2() -> ControlFlow { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/tools/clippy/tests/ui/drop_non_drop.stderr b/src/tools/clippy/tests/ui/drop_non_drop.stderr index 567a820990c60..252ba3915ed84 100644 --- a/src/tools/clippy/tests/ui/drop_non_drop.stderr +++ b/src/tools/clippy/tests/ui/drop_non_drop.stderr @@ -30,7 +30,7 @@ error: call to `std::mem::drop` with a value that does not implement `Drop`. Dro LL | drop(make_result_uninhabited_err(Foo)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: argument has type `std::result::Result` +note: argument has type `std::result::Result` --> tests/ui/drop_non_drop.rs:51:10 | LL | drop(make_result_uninhabited_err(Foo)); diff --git a/src/tools/clippy/tests/ui/empty_enums.rs b/src/tools/clippy/tests/ui/empty_enums.rs index 0deb0f57b0e4a..dc8549f52fdc8 100644 --- a/src/tools/clippy/tests/ui/empty_enums.rs +++ b/src/tools/clippy/tests/ui/empty_enums.rs @@ -1,6 +1,5 @@ #![warn(clippy::empty_enums)] // Enable never type to test empty enum lint -#![feature(never_type)] enum Empty {} //~^ empty_enums diff --git a/src/tools/clippy/tests/ui/empty_enums.stderr b/src/tools/clippy/tests/ui/empty_enums.stderr index 5aa2347b4ae08..231d68a21c258 100644 --- a/src/tools/clippy/tests/ui/empty_enums.stderr +++ b/src/tools/clippy/tests/ui/empty_enums.stderr @@ -1,5 +1,5 @@ error: enum with no variants - --> tests/ui/empty_enums.rs:5:1 + --> tests/ui/empty_enums.rs:4:1 | LL | enum Empty {} | ^^^^^^^^^^^^^ diff --git a/src/tools/clippy/tests/ui/empty_enums_without_never_type.rs b/src/tools/clippy/tests/ui/empty_enums_without_never_type.rs deleted file mode 100644 index 17ccac83ce98e..0000000000000 --- a/src/tools/clippy/tests/ui/empty_enums_without_never_type.rs +++ /dev/null @@ -1,8 +0,0 @@ -//@ check-pass - -#![warn(clippy::empty_enums)] - -// `never_type` is not enabled; this test has no stderr file -enum Empty {} - -fn main() {} diff --git a/src/tools/clippy/tests/ui/infallible_destructuring_match.fixed b/src/tools/clippy/tests/ui/infallible_destructuring_match.fixed index ecf1b14e5b620..57e2efdf79301 100644 --- a/src/tools/clippy/tests/ui/infallible_destructuring_match.fixed +++ b/src/tools/clippy/tests/ui/infallible_destructuring_match.fixed @@ -1,4 +1,4 @@ -#![feature(exhaustive_patterns, never_type)] +#![feature(exhaustive_patterns)] #![allow(dead_code, unreachable_code, unused_variables)] #![allow(clippy::let_and_return, clippy::uninhabited_references)] diff --git a/src/tools/clippy/tests/ui/infallible_destructuring_match.rs b/src/tools/clippy/tests/ui/infallible_destructuring_match.rs index 5db30ebca88fa..fe425abcf1dff 100644 --- a/src/tools/clippy/tests/ui/infallible_destructuring_match.rs +++ b/src/tools/clippy/tests/ui/infallible_destructuring_match.rs @@ -1,4 +1,4 @@ -#![feature(exhaustive_patterns, never_type)] +#![feature(exhaustive_patterns)] #![allow(dead_code, unreachable_code, unused_variables)] #![allow(clippy::let_and_return, clippy::uninhabited_references)] diff --git a/src/tools/clippy/tests/ui/infallible_try_from.rs b/src/tools/clippy/tests/ui/infallible_try_from.rs index 6a1f12f824f55..6545a54980ae9 100644 --- a/src/tools/clippy/tests/ui/infallible_try_from.rs +++ b/src/tools/clippy/tests/ui/infallible_try_from.rs @@ -1,4 +1,3 @@ -#![feature(never_type)] #![warn(clippy::infallible_try_from)] use std::convert::Infallible; diff --git a/src/tools/clippy/tests/ui/infallible_try_from.stderr b/src/tools/clippy/tests/ui/infallible_try_from.stderr index d1e0d9e7d3bb7..d4774b2430e4a 100644 --- a/src/tools/clippy/tests/ui/infallible_try_from.stderr +++ b/src/tools/clippy/tests/ui/infallible_try_from.stderr @@ -1,5 +1,5 @@ error: infallible TryFrom impl; consider implementing From instead - --> tests/ui/infallible_try_from.rs:8:1 + --> tests/ui/infallible_try_from.rs:7:1 | LL | impl TryFrom for MyStruct { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -11,7 +11,7 @@ LL | type Error = !; = help: to override `-D warnings` add `#[allow(clippy::infallible_try_from)]` error: infallible TryFrom impl; consider implementing From instead - --> tests/ui/infallible_try_from.rs:16:1 + --> tests/ui/infallible_try_from.rs:15:1 | LL | impl TryFrom for MyStruct { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/tools/clippy/tests/ui/must_use_candidates.fixed b/src/tools/clippy/tests/ui/must_use_candidates.fixed index 17569884658b1..cd78dcdbb9fda 100644 --- a/src/tools/clippy/tests/ui/must_use_candidates.fixed +++ b/src/tools/clippy/tests/ui/must_use_candidates.fixed @@ -1,4 +1,3 @@ -#![feature(never_type)] #![allow( unused_mut, clippy::redundant_allocation, diff --git a/src/tools/clippy/tests/ui/must_use_candidates.rs b/src/tools/clippy/tests/ui/must_use_candidates.rs index 8b898533d01b7..5b18a13045326 100644 --- a/src/tools/clippy/tests/ui/must_use_candidates.rs +++ b/src/tools/clippy/tests/ui/must_use_candidates.rs @@ -1,4 +1,3 @@ -#![feature(never_type)] #![allow( unused_mut, clippy::redundant_allocation, diff --git a/src/tools/clippy/tests/ui/must_use_candidates.stderr b/src/tools/clippy/tests/ui/must_use_candidates.stderr index 38c7334322503..ddb14b1b87a62 100644 --- a/src/tools/clippy/tests/ui/must_use_candidates.stderr +++ b/src/tools/clippy/tests/ui/must_use_candidates.stderr @@ -1,5 +1,5 @@ error: this function could have a `#[must_use]` attribute - --> tests/ui/must_use_candidates.rs:16:8 + --> tests/ui/must_use_candidates.rs:15:8 | LL | pub fn pure(i: u8) -> u8 { | ^^^^ @@ -13,7 +13,7 @@ LL | pub fn pure(i: u8) -> u8 { | error: this method could have a `#[must_use]` attribute - --> tests/ui/must_use_candidates.rs:22:12 + --> tests/ui/must_use_candidates.rs:21:12 | LL | pub fn inherent_pure(&self) -> u8 { | ^^^^^^^^^^^^^ @@ -25,7 +25,7 @@ LL ~ pub fn inherent_pure(&self) -> u8 { | error: this function could have a `#[must_use]` attribute - --> tests/ui/must_use_candidates.rs:54:8 + --> tests/ui/must_use_candidates.rs:53:8 | LL | pub fn with_marker(_d: std::marker::PhantomData<&mut u32>) -> bool { | ^^^^^^^^^^^ @@ -37,7 +37,7 @@ LL | pub fn with_marker(_d: std::marker::PhantomData<&mut u32>) -> bool { | error: this function could have a `#[must_use]` attribute - --> tests/ui/must_use_candidates.rs:67:8 + --> tests/ui/must_use_candidates.rs:66:8 | LL | pub fn rcd(_x: Rc) -> bool { | ^^^ @@ -49,7 +49,7 @@ LL | pub fn rcd(_x: Rc) -> bool { | error: this function could have a `#[must_use]` attribute - --> tests/ui/must_use_candidates.rs:76:8 + --> tests/ui/must_use_candidates.rs:75:8 | LL | pub fn arcd(_x: Arc) -> bool { | ^^^^ @@ -61,7 +61,7 @@ LL | pub fn arcd(_x: Arc) -> bool { | error: this function could have a `#[must_use]` attribute - --> tests/ui/must_use_candidates.rs:108:8 + --> tests/ui/must_use_candidates.rs:107:8 | LL | pub fn result_uninhabited() -> Result { | ^^^^^^^^^^^^^^^^^^ @@ -74,7 +74,7 @@ LL | pub fn result_uninhabited() -> Result { | error: this function could have a `#[must_use]` attribute - --> tests/ui/must_use_candidates.rs:113:8 + --> tests/ui/must_use_candidates.rs:112:8 | LL | pub fn controlflow_uninhabited() -> std::ops::ControlFlow { | ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/tools/clippy/tests/ui/result_map_unit_fn_unfixable.rs b/src/tools/clippy/tests/ui/result_map_unit_fn_unfixable.rs index e3f5c7f996dad..eae7c7d660909 100644 --- a/src/tools/clippy/tests/ui/result_map_unit_fn_unfixable.rs +++ b/src/tools/clippy/tests/ui/result_map_unit_fn_unfixable.rs @@ -1,6 +1,5 @@ //@no-rustfix #![warn(clippy::result_map_unit_fn)] -#![feature(never_type)] #![allow(clippy::unnecessary_map_on_constructor)] struct HasResult { diff --git a/src/tools/clippy/tests/ui/result_map_unit_fn_unfixable.stderr b/src/tools/clippy/tests/ui/result_map_unit_fn_unfixable.stderr index c7bca9e9e02b3..5b808fd383f98 100644 --- a/src/tools/clippy/tests/ui/result_map_unit_fn_unfixable.stderr +++ b/src/tools/clippy/tests/ui/result_map_unit_fn_unfixable.stderr @@ -1,5 +1,5 @@ error: called `map(f)` on a `Result` value where `f` is a closure that returns the unit type `()` - --> tests/ui/result_map_unit_fn_unfixable.rs:24:5 + --> tests/ui/result_map_unit_fn_unfixable.rs:23:5 | LL | x.field.map(|value| { do_nothing(value); do_nothing(value) }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -13,7 +13,7 @@ LL + if let Ok(value) = x.field { ... } | error: called `map(f)` on a `Result` value where `f` is a closure that returns the unit type `()` - --> tests/ui/result_map_unit_fn_unfixable.rs:29:5 + --> tests/ui/result_map_unit_fn_unfixable.rs:28:5 | LL | x.field.map(|value| if value > 0 { do_nothing(value); do_nothing(value) }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -25,7 +25,7 @@ LL + if let Ok(value) = x.field { ... } | error: called `map(f)` on a `Result` value where `f` is a closure that returns the unit type `()` - --> tests/ui/result_map_unit_fn_unfixable.rs:35:5 + --> tests/ui/result_map_unit_fn_unfixable.rs:34:5 | LL | / x.field.map(|value| { LL | | @@ -47,7 +47,7 @@ LL + if let Ok(value) = x.field { ... } | error: called `map(f)` on a `Result` value where `f` is a closure that returns the unit type `()` - --> tests/ui/result_map_unit_fn_unfixable.rs:41:5 + --> tests/ui/result_map_unit_fn_unfixable.rs:40:5 | LL | x.field.map(|value| { do_nothing(value); do_nothing(value); }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -59,7 +59,7 @@ LL + if let Ok(value) = x.field { ... } | error: called `map(f)` on a `Result` value where `f` is a function that returns the unit type `()` - --> tests/ui/result_map_unit_fn_unfixable.rs:47:5 + --> tests/ui/result_map_unit_fn_unfixable.rs:46:5 | LL | "12".parse::().map(diverge); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -71,7 +71,7 @@ LL + if let Ok(a) = "12".parse::() { diverge(a) } | error: called `map(f)` on a `Result` value where `f` is a function that returns the unit type `()` - --> tests/ui/result_map_unit_fn_unfixable.rs:55:5 + --> tests/ui/result_map_unit_fn_unfixable.rs:54:5 | LL | y.map(do_nothing); | ^^^^^^^^^^^^^^^^^ diff --git a/src/tools/clippy/tests/ui/uninhabited_references.rs b/src/tools/clippy/tests/ui/uninhabited_references.rs index 9b3616ad51871..f8b8dc558dbdf 100644 --- a/src/tools/clippy/tests/ui/uninhabited_references.rs +++ b/src/tools/clippy/tests/ui/uninhabited_references.rs @@ -1,6 +1,5 @@ #![warn(clippy::uninhabited_references)] #![allow(clippy::missing_transmute_annotations)] -#![feature(never_type)] fn ret_uninh_ref() -> &'static std::convert::Infallible { //~^ uninhabited_references diff --git a/src/tools/clippy/tests/ui/uninhabited_references.stderr b/src/tools/clippy/tests/ui/uninhabited_references.stderr index ac05ab5bb4d40..0d29816fc51d9 100644 --- a/src/tools/clippy/tests/ui/uninhabited_references.stderr +++ b/src/tools/clippy/tests/ui/uninhabited_references.stderr @@ -1,5 +1,5 @@ error: dereferencing a reference to an uninhabited type would be undefined behavior - --> tests/ui/uninhabited_references.rs:5:23 + --> tests/ui/uninhabited_references.rs:4:23 | LL | fn ret_uninh_ref() -> &'static std::convert::Infallible { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -8,7 +8,7 @@ LL | fn ret_uninh_ref() -> &'static std::convert::Infallible { = help: to override `-D warnings` add `#[allow(clippy::uninhabited_references)]` error: dereferencing a reference to an uninhabited type would be undefined behavior - --> tests/ui/uninhabited_references.rs:12:30 + --> tests/ui/uninhabited_references.rs:11:30 | LL | fn $name(x: &$ty) -> &$ty { | ^^^^ @@ -19,7 +19,7 @@ LL | ret_something!(id_never, !); = note: this error originates in the macro `ret_something` (in Nightly builds, run with -Z macro-backtrace for more info) error: dereferencing a reference to an uninhabited type is undefined behavior - --> tests/ui/uninhabited_references.rs:14:14 + --> tests/ui/uninhabited_references.rs:13:14 | LL | &*x | ^^ @@ -30,7 +30,7 @@ LL | ret_something!(id_never, !); = note: this error originates in the macro `ret_something` (in Nightly builds, run with -Z macro-backtrace for more info) error: dereferencing a reference to an uninhabited type is undefined behavior - --> tests/ui/uninhabited_references.rs:25:13 + --> tests/ui/uninhabited_references.rs:24:13 | LL | let _ = *x; | ^^ diff --git a/src/tools/clippy/tests/ui/unwrap_expect_used.rs b/src/tools/clippy/tests/ui/unwrap_expect_used.rs index 207d4dd815be3..3e152a3e52a5c 100644 --- a/src/tools/clippy/tests/ui/unwrap_expect_used.rs +++ b/src/tools/clippy/tests/ui/unwrap_expect_used.rs @@ -1,6 +1,5 @@ #![warn(clippy::unwrap_used, clippy::expect_used)] #![allow(clippy::unnecessary_literal_unwrap)] -#![feature(never_type)] use std::convert::Infallible; diff --git a/src/tools/clippy/tests/ui/unwrap_expect_used.stderr b/src/tools/clippy/tests/ui/unwrap_expect_used.stderr index b9a2844b284c8..6c8c16c2c1967 100644 --- a/src/tools/clippy/tests/ui/unwrap_expect_used.stderr +++ b/src/tools/clippy/tests/ui/unwrap_expect_used.stderr @@ -1,5 +1,5 @@ error: used `unwrap()` on an `Option` value - --> tests/ui/unwrap_expect_used.rs:27:5 + --> tests/ui/unwrap_expect_used.rs:26:5 | LL | Some(3).unwrap(); | ^^^^^^^^^^^^^^^^ @@ -9,7 +9,7 @@ LL | Some(3).unwrap(); = help: to override `-D warnings` add `#[allow(clippy::unwrap_used)]` error: used `expect()` on an `Option` value - --> tests/ui/unwrap_expect_used.rs:30:5 + --> tests/ui/unwrap_expect_used.rs:29:5 | LL | Some(3).expect("Hello world!"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -19,7 +19,7 @@ LL | Some(3).expect("Hello world!"); = help: to override `-D warnings` add `#[allow(clippy::expect_used)]` error: used `unwrap()` on a `Result` value - --> tests/ui/unwrap_expect_used.rs:46:5 + --> tests/ui/unwrap_expect_used.rs:45:5 | LL | a.unwrap(); | ^^^^^^^^^^ @@ -27,7 +27,7 @@ LL | a.unwrap(); = note: if this value is an `Err`, it will panic error: used `expect()` on a `Result` value - --> tests/ui/unwrap_expect_used.rs:49:5 + --> tests/ui/unwrap_expect_used.rs:48:5 | LL | a.expect("Hello world!"); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -35,7 +35,7 @@ LL | a.expect("Hello world!"); = note: if this value is an `Err`, it will panic error: used `unwrap_err()` on a `Result` value - --> tests/ui/unwrap_expect_used.rs:52:5 + --> tests/ui/unwrap_expect_used.rs:51:5 | LL | a.unwrap_err(); | ^^^^^^^^^^^^^^ @@ -43,7 +43,7 @@ LL | a.unwrap_err(); = note: if this value is an `Ok`, it will panic error: used `expect_err()` on a `Result` value - --> tests/ui/unwrap_expect_used.rs:55:5 + --> tests/ui/unwrap_expect_used.rs:54:5 | LL | a.expect_err("Hello error!"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -51,7 +51,7 @@ LL | a.expect_err("Hello error!"); = note: if this value is an `Ok`, it will panic error: used `unwrap()` on a `Result` value - --> tests/ui/unwrap_expect_used.rs:80:17 + --> tests/ui/unwrap_expect_used.rs:79:17 | LL | let _ = open!(file).unwrap(); | ^^^^^^^^^^^^^^^^^^^^ @@ -59,7 +59,7 @@ LL | let _ = open!(file).unwrap(); = note: if this value is an `Err`, it will panic error: used `expect()` on a `Result` value - --> tests/ui/unwrap_expect_used.rs:81:17 + --> tests/ui/unwrap_expect_used.rs:80:17 | LL | let _ = open!(file).expect("can open"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -67,7 +67,7 @@ LL | let _ = open!(file).expect("can open"); = note: if this value is an `Err`, it will panic error: used `unwrap_err()` on a `Result` value - --> tests/ui/unwrap_expect_used.rs:82:17 + --> tests/ui/unwrap_expect_used.rs:81:17 | LL | let _ = open!(file).unwrap_err(); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -75,7 +75,7 @@ LL | let _ = open!(file).unwrap_err(); = note: if this value is an `Ok`, it will panic error: used `expect_err()` on a `Result` value - --> tests/ui/unwrap_expect_used.rs:83:17 + --> tests/ui/unwrap_expect_used.rs:82:17 | LL | let _ = open!(file).expect_err("can open"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -83,7 +83,7 @@ LL | let _ = open!(file).expect_err("can open"); = note: if this value is an `Ok`, it will panic error: used `unwrap()` on an `Option` value - --> tests/ui/unwrap_expect_used.rs:89:5 + --> tests/ui/unwrap_expect_used.rs:88:5 | LL | Option::unwrap(opt); | ^^^^^^^^^^^^^^^^^^^ @@ -91,7 +91,7 @@ LL | Option::unwrap(opt); = note: if this value is `None`, it will panic error: used `expect()` on an `Option` value - --> tests/ui/unwrap_expect_used.rs:90:5 + --> tests/ui/unwrap_expect_used.rs:89:5 | LL | Option::expect(opt, "error message"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -99,7 +99,7 @@ LL | Option::expect(opt, "error message"); = note: if this value is `None`, it will panic error: used `unwrap()` on a `Result` value - --> tests/ui/unwrap_expect_used.rs:93:5 + --> tests/ui/unwrap_expect_used.rs:92:5 | LL | Result::unwrap(res); | ^^^^^^^^^^^^^^^^^^^ @@ -107,7 +107,7 @@ LL | Result::unwrap(res); = note: if this value is an `Err`, it will panic error: used `expect()` on a `Result` value - --> tests/ui/unwrap_expect_used.rs:94:5 + --> tests/ui/unwrap_expect_used.rs:93:5 | LL | Result::expect(res, "error message"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -115,7 +115,7 @@ LL | Result::expect(res, "error message"); = note: if this value is an `Err`, it will panic error: used `unwrap_err()` on a `Result` value - --> tests/ui/unwrap_expect_used.rs:95:5 + --> tests/ui/unwrap_expect_used.rs:94:5 | LL | Result::unwrap_err(res); | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -123,7 +123,7 @@ LL | Result::unwrap_err(res); = note: if this value is an `Ok`, it will panic error: used `expect_err()` on a `Result` value - --> tests/ui/unwrap_expect_used.rs:96:5 + --> tests/ui/unwrap_expect_used.rs:95:5 | LL | Result::expect_err(res, "error message"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/tools/clippy/tests/ui/zero_repeat_side_effects_never_pattern.fixed b/src/tools/clippy/tests/ui/zero_repeat_side_effects_never_pattern.fixed index 3d037516f75c8..e6faf115de545 100644 --- a/src/tools/clippy/tests/ui/zero_repeat_side_effects_never_pattern.fixed +++ b/src/tools/clippy/tests/ui/zero_repeat_side_effects_never_pattern.fixed @@ -1,6 +1,5 @@ #![warn(clippy::zero_repeat_side_effects)] #![allow(clippy::diverging_sub_expression)] -#![feature(never_type)] fn issue_14998() { // nameable type thanks to `never_type` being enabled, suggest diff --git a/src/tools/clippy/tests/ui/zero_repeat_side_effects_never_pattern.rs b/src/tools/clippy/tests/ui/zero_repeat_side_effects_never_pattern.rs index 3dc1929bcdc76..2fec6b1d26ab2 100644 --- a/src/tools/clippy/tests/ui/zero_repeat_side_effects_never_pattern.rs +++ b/src/tools/clippy/tests/ui/zero_repeat_side_effects_never_pattern.rs @@ -1,6 +1,5 @@ #![warn(clippy::zero_repeat_side_effects)] #![allow(clippy::diverging_sub_expression)] -#![feature(never_type)] fn issue_14998() { // nameable type thanks to `never_type` being enabled, suggest diff --git a/src/tools/clippy/tests/ui/zero_repeat_side_effects_never_pattern.stderr b/src/tools/clippy/tests/ui/zero_repeat_side_effects_never_pattern.stderr index 280955740cc4c..df2c26bda7971 100644 --- a/src/tools/clippy/tests/ui/zero_repeat_side_effects_never_pattern.stderr +++ b/src/tools/clippy/tests/ui/zero_repeat_side_effects_never_pattern.stderr @@ -1,5 +1,5 @@ error: expression with side effects as the initial value in a zero-sized array initializer - --> tests/ui/zero_repeat_side_effects_never_pattern.rs:7:5 + --> tests/ui/zero_repeat_side_effects_never_pattern.rs:6:5 | LL | let _data = [panic!(); 0]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/tools/clippy/tests/ui/zero_repeat_side_effects_unfixable.stderr b/src/tools/clippy/tests/ui/zero_repeat_side_effects_unfixable.stderr index 450617f3782c4..1a7c88591783f 100644 --- a/src/tools/clippy/tests/ui/zero_repeat_side_effects_unfixable.stderr +++ b/src/tools/clippy/tests/ui/zero_repeat_side_effects_unfixable.stderr @@ -14,7 +14,11 @@ error: expression with side effects as the initial value in a zero-sized array i LL | let _data = [panic!(); 0]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = help: consider performing the side effect separately +help: consider performing the side effect separately + | +LL ~ panic!(); +LL + let _data: [!; 0] = []; + | error: aborting due to 2 previous errors diff --git a/src/tools/miri/src/lib.rs b/src/tools/miri/src/lib.rs index f41e3c20a7d54..204bb00a7ba76 100644 --- a/src/tools/miri/src/lib.rs +++ b/src/tools/miri/src/lib.rs @@ -13,7 +13,7 @@ #![feature(float_gamma)] #![feature(float_erf)] #![feature(map_try_insert)] -#![feature(never_type)] +#![cfg_attr(bootstrap, feature(never_type))] #![feature(try_blocks)] #![feature(io_error_more)] #![feature(io_error_inprogress)] diff --git a/src/tools/miri/tests/fail/dangling_pointers/dangling_pointer_deref_match_never.rs b/src/tools/miri/tests/fail/dangling_pointers/dangling_pointer_deref_match_never.rs index e77c8e06a0f9e..890f194180dbb 100644 --- a/src/tools/miri/tests/fail/dangling_pointers/dangling_pointer_deref_match_never.rs +++ b/src/tools/miri/tests/fail/dangling_pointers/dangling_pointer_deref_match_never.rs @@ -2,7 +2,6 @@ //@compile-flags: -Zmiri-disable-alignment-check -Zmiri-disable-stacked-borrows -Zmiri-disable-validation #![allow(unreachable_code)] -#![feature(never_type)] fn main() { let p = { diff --git a/src/tools/miri/tests/fail/erroneous_const.rs b/src/tools/miri/tests/fail/erroneous_const.rs index 6e126ed701f88..736a881749c6d 100644 --- a/src/tools/miri/tests/fail/erroneous_const.rs +++ b/src/tools/miri/tests/fail/erroneous_const.rs @@ -1,6 +1,5 @@ //! Make sure we detect erroneous constants post-monomorphization even when they are unused. //! (https://github.com/rust-lang/miri/issues/1382) -#![feature(never_type)] struct PrintName(T); impl PrintName { diff --git a/src/tools/miri/tests/fail/intrinsics/uninit_uninhabited_type.rs b/src/tools/miri/tests/fail/intrinsics/uninit_uninhabited_type.rs index 34fef6b9ee556..2d7f8d2e46879 100644 --- a/src/tools/miri/tests/fail/intrinsics/uninit_uninhabited_type.rs +++ b/src/tools/miri/tests/fail/intrinsics/uninit_uninhabited_type.rs @@ -1,5 +1,3 @@ -#![feature(never_type)] - #[allow(deprecated, invalid_value)] fn main() { let _ = unsafe { std::mem::uninitialized::() }; //~ERROR: constructing invalid value diff --git a/src/tools/miri/tests/fail/match/closures/uninhabited-variant1.rs b/src/tools/miri/tests/fail/match/closures/uninhabited-variant1.rs index 0a2dfe9a7f645..4a8c28857ae46 100644 --- a/src/tools/miri/tests/fail/match/closures/uninhabited-variant1.rs +++ b/src/tools/miri/tests/fail/match/closures/uninhabited-variant1.rs @@ -1,6 +1,5 @@ // Motivated by rust-lang/rust#138961, this shows how invalid discriminants interact with // closure captures. -#![feature(never_type)] #[repr(C)] #[allow(dead_code)] diff --git a/src/tools/miri/tests/fail/match/closures/uninhabited-variant2.rs b/src/tools/miri/tests/fail/match/closures/uninhabited-variant2.rs index 050e83884d1e2..3d88798f44b18 100644 --- a/src/tools/miri/tests/fail/match/closures/uninhabited-variant2.rs +++ b/src/tools/miri/tests/fail/match/closures/uninhabited-variant2.rs @@ -3,7 +3,6 @@ // // Test case with only one inhabited variant, for which rustc used to not emit // a discriminant read in the first place. See: rust-lang/miri#4778 -#![feature(never_type)] #[repr(C)] #[allow(dead_code)] diff --git a/src/tools/miri/tests/fail/match/only_inhabited_variant.rs b/src/tools/miri/tests/fail/match/only_inhabited_variant.rs index 2be5e8083aa7f..7457481a22ca2 100644 --- a/src/tools/miri/tests/fail/match/only_inhabited_variant.rs +++ b/src/tools/miri/tests/fail/match/only_inhabited_variant.rs @@ -1,5 +1,4 @@ // rust-lang/miri#4778 -#![feature(never_type)] #[repr(C)] #[allow(dead_code)] diff --git a/src/tools/miri/tests/fail/never_match_never.rs b/src/tools/miri/tests/fail/never_match_never.rs index 5f2f471bf6098..02b3eff13a377 100644 --- a/src/tools/miri/tests/fail/never_match_never.rs +++ b/src/tools/miri/tests/fail/never_match_never.rs @@ -1,7 +1,6 @@ // This should fail even without validation //@compile-flags: -Zmiri-disable-validation -#![feature(never_type)] #![allow(unreachable_code)] fn main() { diff --git a/src/tools/miri/tests/fail/never_say_never.rs b/src/tools/miri/tests/fail/never_say_never.rs index fd082e367a83a..457005391ae80 100644 --- a/src/tools/miri/tests/fail/never_say_never.rs +++ b/src/tools/miri/tests/fail/never_say_never.rs @@ -1,7 +1,6 @@ // This should fail even without validation //@compile-flags: -Zmiri-disable-validation -#![feature(never_type)] #![allow(unreachable_code)] fn main() { diff --git a/src/tools/miri/tests/fail/never_transmute_humans.rs b/src/tools/miri/tests/fail/never_transmute_humans.rs index cba3cc0ccf17b..559eb652555ac 100644 --- a/src/tools/miri/tests/fail/never_transmute_humans.rs +++ b/src/tools/miri/tests/fail/never_transmute_humans.rs @@ -1,8 +1,6 @@ // This should fail even without validation //@compile-flags: -Zmiri-disable-validation -#![feature(never_type)] - struct Human; fn main() { diff --git a/src/tools/miri/tests/fail/never_transmute_void.rs b/src/tools/miri/tests/fail/never_transmute_void.rs index a2db2ca9db61b..bc1095c815e7f 100644 --- a/src/tools/miri/tests/fail/never_transmute_void.rs +++ b/src/tools/miri/tests/fail/never_transmute_void.rs @@ -1,7 +1,6 @@ // This should fail even without validation //@compile-flags: -Zmiri-disable-validation -#![feature(never_type)] #![allow(unused, invalid_value)] mod m { diff --git a/src/tools/miri/tests/fail/validity/invalid_enum_op_discr_uninhabited.rs b/src/tools/miri/tests/fail/validity/invalid_enum_op_discr_uninhabited.rs index 3d1ae64b57826..96c7a613378ad 100644 --- a/src/tools/miri/tests/fail/validity/invalid_enum_op_discr_uninhabited.rs +++ b/src/tools/miri/tests/fail/validity/invalid_enum_op_discr_uninhabited.rs @@ -1,6 +1,5 @@ // Make sure we find these even with many checks disabled. //@compile-flags: -Zmiri-disable-alignment-check -Zmiri-disable-stacked-borrows -Zmiri-disable-validation -#![feature(never_type)] enum Never {} diff --git a/src/tools/miri/tests/fail/validity/ref_to_uninhabited1.rs b/src/tools/miri/tests/fail/validity/ref_to_uninhabited1.rs index 2e6be8b971c64..a3741a394d752 100644 --- a/src/tools/miri/tests/fail/validity/ref_to_uninhabited1.rs +++ b/src/tools/miri/tests/fail/validity/ref_to_uninhabited1.rs @@ -1,4 +1,3 @@ -#![feature(never_type)] use std::mem::{forget, transmute}; fn main() { diff --git a/src/tools/miri/tests/fail/validity/uninhabited_variant.rs b/src/tools/miri/tests/fail/validity/uninhabited_variant.rs index 303584423fdcf..4d6b4b84ca53f 100644 --- a/src/tools/miri/tests/fail/validity/uninhabited_variant.rs +++ b/src/tools/miri/tests/fail/validity/uninhabited_variant.rs @@ -1,6 +1,5 @@ // NOTE: this is essentially a smoke-test, with more comprehensive tests living in the rustc // repository at tests/ui/consts/const-eval/ub-enum.rs -#![feature(never_type)] #[repr(C)] #[allow(dead_code)] diff --git a/src/tools/miri/tests/pass/async-fn.rs b/src/tools/miri/tests/pass/async-fn.rs index 42c60bb4fabdd..a20caf3d9f515 100644 --- a/src/tools/miri/tests/pass/async-fn.rs +++ b/src/tools/miri/tests/pass/async-fn.rs @@ -1,5 +1,3 @@ -#![feature(never_type)] - use std::future::Future; // See if we can run a basic `async fn` diff --git a/src/tools/miri/tests/pass/coroutine.rs b/src/tools/miri/tests/pass/coroutine.rs index 96b60b515cb6d..6ecf867771262 100644 --- a/src/tools/miri/tests/pass/coroutine.rs +++ b/src/tools/miri/tests/pass/coroutine.rs @@ -1,6 +1,6 @@ //@revisions: stack tree //@[tree]compile-flags: -Zmiri-tree-borrows -#![feature(coroutines, coroutine_trait, never_type, stmt_expr_attributes)] +#![feature(coroutines, coroutine_trait, stmt_expr_attributes)] use std::fmt::Debug; use std::mem::ManuallyDrop; diff --git a/src/tools/miri/tests/pass/function_calls/abi_compat.rs b/src/tools/miri/tests/pass/function_calls/abi_compat.rs index cd48bd2accb27..3c0535adea94c 100644 --- a/src/tools/miri/tests/pass/function_calls/abi_compat.rs +++ b/src/tools/miri/tests/pass/function_calls/abi_compat.rs @@ -1,5 +1,3 @@ -#![feature(never_type)] - use std::rc::Rc; use std::{mem, num, ptr}; diff --git a/src/tools/miri/tests/pass/issues/issue-120337-irrefutable-let-ice.rs b/src/tools/miri/tests/pass/issues/issue-120337-irrefutable-let-ice.rs index 5af0d0e4bbd95..7380d700ab708 100644 --- a/src/tools/miri/tests/pass/issues/issue-120337-irrefutable-let-ice.rs +++ b/src/tools/miri/tests/pass/issues/issue-120337-irrefutable-let-ice.rs @@ -1,7 +1,6 @@ // Validation stops the test before the ICE we used to hit //@compile-flags: -Zmiri-disable-validation -#![feature(never_type)] #[derive(Copy, Clone)] pub enum E { A(!), diff --git a/src/tools/miri/tests/pass/loop-break-value.rs b/src/tools/miri/tests/pass/loop-break-value.rs index 74ab487b342a1..dffbfdaf06472 100644 --- a/src/tools/miri/tests/pass/loop-break-value.rs +++ b/src/tools/miri/tests/pass/loop-break-value.rs @@ -1,4 +1,3 @@ -#![feature(never_type)] #![allow(unreachable_code)] #[allow(unused)] diff --git a/src/tools/miri/tests/pass/panic/catch_panic.rs b/src/tools/miri/tests/pass/panic/catch_panic.rs index 06d15a1a7f94e..bd26a79a0b8ec 100644 --- a/src/tools/miri/tests/pass/panic/catch_panic.rs +++ b/src/tools/miri/tests/pass/panic/catch_panic.rs @@ -1,4 +1,3 @@ -#![feature(never_type)] #![allow(unconditional_panic, non_fmt_panics)] use std::cell::Cell; diff --git a/src/tools/miri/tests/pass/underscore_pattern.rs b/src/tools/miri/tests/pass/underscore_pattern.rs index 2f203bdc01e45..44a1d02cc393e 100644 --- a/src/tools/miri/tests/pass/underscore_pattern.rs +++ b/src/tools/miri/tests/pass/underscore_pattern.rs @@ -1,5 +1,4 @@ // Various tests ensuring that underscore patterns really just construct the place, but don't check its contents. -#![feature(never_type)] use std::ptr; From 8ef4406c9b56954344cd7657ad2b87b085aeed05 Mon Sep 17 00:00:00 2001 From: Waffle Lapkin Date: Fri, 15 Aug 2025 03:05:04 +0200 Subject: [PATCH 08/18] bless tests --- tests/ui/asm/x86_64/type-check-2.rs | 2 +- tests/ui/asm/x86_64/type-check-5.stderr | 6 +- ...ed-types-ICE-when-projecting-out-of-err.rs | 2 +- ...ypes-ICE-when-projecting-out-of-err.stderr | 4 +- tests/ui/async-await/async-error-span.rs | 2 +- tests/ui/async-await/async-error-span.stderr | 6 +- .../ui/borrowck/suggest-assign-rvalue.stderr | 20 +- .../match/pattern-matching-should-fail.stderr | 16 +- .../migrations/mir_calls_to_shims.stderr | 2 +- ...habited-variant.exhaustive_patterns.stderr | 2 +- .../only-inhabited-variant.normal.stderr | 2 +- tests/ui/coercion/coerce-to-bang-cast.stderr | 4 +- .../min_const_generics/complex-types.stderr | 14 +- tests/ui/consts/assert-type-intrinsics.stderr | 6 +- .../index-out-of-bounds-never-type.stderr | 6 +- .../const-eval/panic-assoc-never-type.stderr | 6 +- .../consts/const-eval/panic-never-type.stderr | 2 +- tests/ui/consts/const-eval/ub-enum.stderr | 30 +-- .../ui/consts/const-eval/ub-uninhabit.stderr | 8 +- .../detect-extra-ub.with_flag.stderr | 18 +- tests/ui/consts/std/conjure_zst.stderr | 4 +- tests/ui/consts/validate_never_arrays.stderr | 6 +- .../never-type-fallback-breaking.e2021.fixed | 81 ------ .../never-type-fallback-breaking.e2021.stderr | 235 ++++-------------- .../never-type-fallback-breaking.e2024.stderr | 16 +- .../editions/never-type-fallback-breaking.rs | 27 +- .../never-type-fallback.e2021.run.stdout | 2 +- .../feature-gate-exhaustive-patterns.stderr | 2 +- .../break-while-condition.stderr | 22 +- ...h-implicit-hrtb-without-dyn.pre2021.stderr | 7 +- .../generic-with-implicit-hrtb-without-dyn.rs | 2 +- tests/ui/impl-trait/issues/issue-58504.rs | 2 +- .../ice-issue-146191.current.stderr | 4 +- .../non-defining-uses/ice-issue-146191.rs | 2 +- tests/ui/impl-trait/rpit/early_bound.stderr | 2 +- .../ui/layout/enum-scalar-pair-int-ptr.stderr | 4 +- tests/ui/layout/enum.stderr | 6 +- tests/ui/layout/struct.stderr | 4 +- .../unused-language-features.stderr | 10 +- tests/ui/lint/unused/must-use-ops.stderr | 42 ++-- .../must_use-result-unit-uninhabited.stderr | 12 +- tests/ui/lint/unused/must_use-unit.stderr | 6 +- .../loop-break-never-type-mismatch.stderr | 4 +- tests/ui/loops/loop-break-value.stderr | 58 ++--- .../basic/call-fn-never-arg-wrong-type.stderr | 4 +- .../basic/never-assign-wrong-type.stderr | 2 +- .../never_type/diverging-place-match.stderr | 22 +- tests/ui/never_type/empty-never-array.stderr | 4 +- .../ui/never_type/exhaustive_patterns.stderr | 4 +- .../dependency-on-fallback-to-unit.stderr | 87 ++----- ...fallback-unconstrained-return.e2021.stderr | 55 ++-- ...nt-suggest-turbofish-from-expansion.stderr | 51 ++-- .../from_infer_breaking_with_unit_fallback.rs | 2 +- ...lint-breaking-2024-assign-underscore.fixed | 2 +- ...int-breaking-2024-assign-underscore.stderr | 46 +--- ...-fallback-flowing-into-unsafe.e2015.stderr | 11 +- .../question_mark_from_never.rs | 2 +- ...never-from-impl-is-reserved.current.stderr | 2 +- .../never-from-impl-is-reserved.next.stderr | 2 +- .../regress/never-in-range-pat.stderr | 2 +- .../regress/span-bug-issue-121445.stderr | 4 +- ...hesized-type-arguments-ice-issue-122345.rs | 1 - ...zed-type-arguments-ice-issue-122345.stderr | 15 +- ...bited-union-ref.exhaustive_patterns.stderr | 6 +- .../always-inhabited-union-ref.normal.stderr | 6 +- ...tch-check-notes.exhaustive_patterns.stderr | 14 +- .../empty-match-check-notes.normal.stderr | 14 +- .../empty-match.exhaustive_patterns.stderr | 80 +++--- .../usefulness/empty-match.normal.stderr | 80 +++--- .../empty-types.exhaustive_patterns.stderr | 100 ++++---- .../usefulness/empty-types.never_pats.stderr | 86 +++---- .../usefulness/empty-types.normal.stderr | 86 +++---- .../explain-unreachable-pats.stderr | 28 +-- tests/ui/pattern/usefulness/impl-trait.stderr | 32 +-- ...privately-empty.exhaustive_patterns.stderr | 2 +- .../match-privately-empty.normal.stderr | 2 +- .../slice_of_empty.exhaustive_patterns.stderr | 2 +- .../usefulness/slice_of_empty.normal.stderr | 4 +- .../never-place-isnt-diverging.stderr | 4 +- tests/ui/reachable/expr_add.stderr | 4 +- tests/ui/reachable/expr_assign.stderr | 8 +- tests/ui/reachable/expr_call.stderr | 6 +- tests/ui/reachable/expr_method.stderr | 6 +- tests/ui/reachable/expr_unary.stderr | 6 +- tests/ui/reachable/guard_read_for_never.rs | 2 +- .../reachable/never-assign-dead-code.stderr | 8 +- .../reachable/unwarned-match-on-never.stderr | 6 +- ...133063-never-arm-no-otherwise-block.stderr | 2 +- .../ICE-133117-duplicate-never-arm.stderr | 4 +- .../never-pattern-is-a-read.stderr | 2 +- .../uninhabited/coercions.stderr | 8 +- .../uninhabited/coercions_same_crate.stderr | 8 +- .../uninhabited/indirect_match.stderr | 16 +- ...rect_match_with_exhaustive_patterns.stderr | 16 +- .../issue-65157-repeated-match-arm.stderr | 2 +- .../uninhabited/match.stderr | 8 +- .../match_with_exhaustive_patterns.stderr | 4 +- .../uninhabited/patterns_same_crate.stderr | 10 +- .../protect-precedences.rs | 1 + .../protect-precedences.stderr | 11 +- .../illformed-element-type.rs | 4 +- .../illformed-element-type.stderr | 30 +-- tests/ui/self/dispatch_from_dyn_zst.rs | 2 +- tests/ui/sized-hierarchy/impls.rs | 2 +- .../stability-attribute-trait-impl.rs | 2 +- .../stability-attribute-trait-impl.stderr | 2 +- tests/ui/statics/uninhabited-static.stderr | 20 +- tests/ui/symbol-names/types.legacy.stderr | 174 ++++++------- tests/ui/symbol-names/types.v0.stderr | 174 ++++++------- .../symbol-names/types.verbose-legacy.stderr | 174 ++++++------- .../const-traits/reservation-impl-ice.rs | 2 +- .../traits/reservation-impl/non-lattice-ok.rs | 2 +- tests/ui/transmutability/char.stderr | 12 +- .../try-block-bad-type-heterogeneous.stderr | 4 +- .../different_defining_uses_never_type.stderr | 2 +- ...ted-irrefutable.exhaustive_patterns.stderr | 4 +- .../uninhabited-irrefutable.normal.stderr | 4 +- .../uninhabited/uninhabited-patterns.stderr | 8 +- .../uninhabited-unstable-field.stderr | 8 +- tests/ui/uninhabited/void-branch.stderr | 33 ++- tests/ui/unpretty/exhaustive.hir.stderr | 40 +-- tests/ui/unpretty/exhaustive.hir.stdout | 6 +- 122 files changed, 1046 insertions(+), 1383 deletions(-) delete mode 100644 tests/ui/editions/never-type-fallback-breaking.e2021.fixed diff --git a/tests/ui/asm/x86_64/type-check-2.rs b/tests/ui/asm/x86_64/type-check-2.rs index c63042298da30..ed5ad6fbc4591 100644 --- a/tests/ui/asm/x86_64/type-check-2.rs +++ b/tests/ui/asm/x86_64/type-check-2.rs @@ -1,6 +1,6 @@ //@ only-x86_64 -#![feature(repr_simd, never_type)] +#![feature(repr_simd)] use std::arch::{asm, global_asm}; diff --git a/tests/ui/asm/x86_64/type-check-5.stderr b/tests/ui/asm/x86_64/type-check-5.stderr index 377e1d19f6c5c..0c471ee28d261 100644 --- a/tests/ui/asm/x86_64/type-check-5.stderr +++ b/tests/ui/asm/x86_64/type-check-5.stderr @@ -1,5 +1,5 @@ error[E0381]: used binding `x` isn't initialized - --> $DIR/type-check-5.rs:12:28 + --> $DIR/type-check-5.rs:10:28 | LL | let x: u64; | - binding declared here but left uninitialized @@ -12,7 +12,7 @@ LL | let x: u64 = 42; | ++++ error[E0381]: used binding `y` isn't initialized - --> $DIR/type-check-5.rs:15:9 + --> $DIR/type-check-5.rs:13:9 | LL | let mut y: u64; | ----- binding declared here but left uninitialized @@ -25,7 +25,7 @@ LL | let mut y: u64 = 42; | ++++ error[E0596]: cannot borrow `v` as mutable, as it is not declared as mutable - --> $DIR/type-check-5.rs:21:13 + --> $DIR/type-check-5.rs:19:13 | LL | let v: Vec = vec![0, 1, 2]; | ^ not mutable diff --git a/tests/ui/associated-types/associated-types-ICE-when-projecting-out-of-err.rs b/tests/ui/associated-types/associated-types-ICE-when-projecting-out-of-err.rs index ceee5728b4143..aa6f988c1e40d 100644 --- a/tests/ui/associated-types/associated-types-ICE-when-projecting-out-of-err.rs +++ b/tests/ui/associated-types/associated-types-ICE-when-projecting-out-of-err.rs @@ -13,5 +13,5 @@ use minicore::*; fn ice(a: A) { let r = loop {}; r = r + a; - //~^ ERROR the trait bound `(): Add` is not satisfied + //~^ ERROR the trait bound `!: Add` is not satisfied } diff --git a/tests/ui/associated-types/associated-types-ICE-when-projecting-out-of-err.stderr b/tests/ui/associated-types/associated-types-ICE-when-projecting-out-of-err.stderr index 0bbb601a6d23a..5bd5a9d98015c 100644 --- a/tests/ui/associated-types/associated-types-ICE-when-projecting-out-of-err.stderr +++ b/tests/ui/associated-types/associated-types-ICE-when-projecting-out-of-err.stderr @@ -1,8 +1,8 @@ -error[E0277]: the trait bound `(): Add` is not satisfied +error[E0277]: the trait bound `!: Add` is not satisfied --> $DIR/associated-types-ICE-when-projecting-out-of-err.rs:15:11 | LL | r = r + a; - | ^ the trait `Add` is not implemented for `()` + | ^ the trait `Add` is not implemented for `!` error: aborting due to 1 previous error diff --git a/tests/ui/async-await/async-error-span.rs b/tests/ui/async-await/async-error-span.rs index 486a07d3dd1ae..96d9d641a5729 100644 --- a/tests/ui/async-await/async-error-span.rs +++ b/tests/ui/async-await/async-error-span.rs @@ -5,7 +5,7 @@ use std::future::Future; fn get_future() -> impl Future { -//~^ ERROR `()` is not a future + //~^ ERROR `!` is not a future panic!() } diff --git a/tests/ui/async-await/async-error-span.stderr b/tests/ui/async-await/async-error-span.stderr index 37b5c329a7d07..c5a2ecb57b80f 100644 --- a/tests/ui/async-await/async-error-span.stderr +++ b/tests/ui/async-await/async-error-span.stderr @@ -1,13 +1,13 @@ -error[E0277]: `()` is not a future +error[E0277]: `!` is not a future --> $DIR/async-error-span.rs:7:20 | LL | fn get_future() -> impl Future { - | ^^^^^^^^^^^^^^^^^^^^^^^^ `()` is not a future + | ^^^^^^^^^^^^^^^^^^^^^^^^ `!` is not a future LL | LL | panic!() | -------- return type was inferred to be `_` here | - = help: the trait `Future` is not implemented for `()` + = help: the trait `Future` is not implemented for `!` error[E0282]: type annotations needed --> $DIR/async-error-span.rs:13:9 diff --git a/tests/ui/borrowck/suggest-assign-rvalue.stderr b/tests/ui/borrowck/suggest-assign-rvalue.stderr index 6ae893915aa99..db9e1457a9f51 100644 --- a/tests/ui/borrowck/suggest-assign-rvalue.stderr +++ b/tests/ui/borrowck/suggest-assign-rvalue.stderr @@ -1,5 +1,5 @@ error[E0381]: used binding `chaenomeles` isn't initialized - --> $DIR/suggest-assign-rvalue.rs:14:11 + --> $DIR/suggest-assign-rvalue.rs:13:11 | LL | let chaenomeles; | ----------- binding declared here but left uninitialized @@ -12,7 +12,7 @@ LL | let chaenomeles = 42; | ++++ error[E0381]: used binding `my_float` isn't initialized - --> $DIR/suggest-assign-rvalue.rs:23:30 + --> $DIR/suggest-assign-rvalue.rs:22:30 | LL | let my_float: f32; | -------- binding declared here but left uninitialized @@ -25,7 +25,7 @@ LL | let my_float: f32 = 3.14159; | +++++++++ error[E0381]: used binding `demo` isn't initialized - --> $DIR/suggest-assign-rvalue.rs:26:28 + --> $DIR/suggest-assign-rvalue.rs:25:28 | LL | let demo: Demo; | ---- binding declared here but left uninitialized @@ -38,7 +38,7 @@ LL | let demo: Demo = Default::default(); | ++++++++++++++++++++ error[E0381]: used binding `demo_no` isn't initialized - --> $DIR/suggest-assign-rvalue.rs:30:31 + --> $DIR/suggest-assign-rvalue.rs:29:31 | LL | let demo_no: DemoNoDef; | ------- binding declared here but left uninitialized @@ -51,7 +51,7 @@ LL | let demo_no: DemoNoDef = /* value */; | +++++++++++++ error[E0381]: used binding `arr` isn't initialized - --> $DIR/suggest-assign-rvalue.rs:34:27 + --> $DIR/suggest-assign-rvalue.rs:33:27 | LL | let arr: [i32; 5]; | --- binding declared here but left uninitialized @@ -64,7 +64,7 @@ LL | let arr: [i32; 5] = [42; 5]; | +++++++++ error[E0381]: used binding `foo` isn't initialized - --> $DIR/suggest-assign-rvalue.rs:37:27 + --> $DIR/suggest-assign-rvalue.rs:36:27 | LL | let foo: Vec<&str>; | --- binding declared here but left uninitialized @@ -77,7 +77,7 @@ LL | let foo: Vec<&str> = vec![]; | ++++++++ error[E0381]: used binding `my_string` isn't initialized - --> $DIR/suggest-assign-rvalue.rs:41:31 + --> $DIR/suggest-assign-rvalue.rs:40:31 | LL | let my_string: String; | --------- binding declared here but left uninitialized @@ -90,7 +90,7 @@ LL | let my_string: String = Default::default(); | ++++++++++++++++++++ error[E0381]: used binding `my_int` isn't initialized - --> $DIR/suggest-assign-rvalue.rs:45:28 + --> $DIR/suggest-assign-rvalue.rs:44:28 | LL | let my_int: &i32; | ------ binding declared here but left uninitialized @@ -103,7 +103,7 @@ LL | let my_int: &i32 = &42; | +++++ error[E0381]: used binding `hello` isn't initialized - --> $DIR/suggest-assign-rvalue.rs:49:27 + --> $DIR/suggest-assign-rvalue.rs:48:27 | LL | let hello: &str; | ----- binding declared here but left uninitialized @@ -116,7 +116,7 @@ LL | let hello: &str = ""; | ++++ error[E0381]: used binding `never` isn't initialized - --> $DIR/suggest-assign-rvalue.rs:53:27 + --> $DIR/suggest-assign-rvalue.rs:52:27 | LL | let never: !; | ----- binding declared here but left uninitialized diff --git a/tests/ui/closures/2229_closure_analysis/match/pattern-matching-should-fail.stderr b/tests/ui/closures/2229_closure_analysis/match/pattern-matching-should-fail.stderr index e0d900a1eb564..cc46ea72e9901 100644 --- a/tests/ui/closures/2229_closure_analysis/match/pattern-matching-should-fail.stderr +++ b/tests/ui/closures/2229_closure_analysis/match/pattern-matching-should-fail.stderr @@ -1,5 +1,5 @@ error[E0381]: used binding `x` isn't initialized - --> $DIR/pattern-matching-should-fail.rs:8:23 + --> $DIR/pattern-matching-should-fail.rs:6:23 | LL | let x: !; | - binding declared here but left uninitialized @@ -7,7 +7,7 @@ LL | let c1 = || match x { }; | ^ `x` used here but it isn't initialized error[E0381]: used binding `x` isn't initialized - --> $DIR/pattern-matching-should-fail.rs:15:23 + --> $DIR/pattern-matching-should-fail.rs:13:23 | LL | let x: !; | - binding declared here but left uninitialized @@ -15,7 +15,7 @@ LL | let c2 = || match x { _ => () }; | ^ `x` used here but it isn't initialized error[E0381]: used binding `variant` isn't initialized - --> $DIR/pattern-matching-should-fail.rs:27:13 + --> $DIR/pattern-matching-should-fail.rs:25:13 | LL | let variant: !; | ------- binding declared here but left uninitialized @@ -26,7 +26,7 @@ LL | match variant { | ------- borrow occurs due to use in closure error[E0381]: used binding `variant` isn't initialized - --> $DIR/pattern-matching-should-fail.rs:39:13 + --> $DIR/pattern-matching-should-fail.rs:37:13 | LL | let variant: !; | ------- binding declared here but left uninitialized @@ -36,7 +36,7 @@ LL | match variant { | ------- borrow occurs due to use in closure error[E0381]: used binding `g` isn't initialized - --> $DIR/pattern-matching-should-fail.rs:54:15 + --> $DIR/pattern-matching-should-fail.rs:52:15 | LL | let g: !; | - binding declared here but left uninitialized @@ -45,7 +45,7 @@ LL | match g { }; | ^ `g` used here but it isn't initialized error[E0381]: used binding `t` isn't initialized - --> $DIR/pattern-matching-should-fail.rs:56:19 + --> $DIR/pattern-matching-should-fail.rs:54:19 | LL | let t: !; | - binding declared here but left uninitialized @@ -54,7 +54,7 @@ LL | match t { }; | ^ `t` used here but it isn't initialized error[E0004]: non-exhaustive patterns: type `u8` is non-empty - --> $DIR/pattern-matching-should-fail.rs:67:23 + --> $DIR/pattern-matching-should-fail.rs:65:23 | LL | let c1 = || match x { }; | ^ @@ -68,7 +68,7 @@ LL ~ }; | error[E0381]: used binding `x` isn't initialized - --> $DIR/pattern-matching-should-fail.rs:67:23 + --> $DIR/pattern-matching-should-fail.rs:65:23 | LL | let x: u8; | - binding declared here but left uninitialized diff --git a/tests/ui/closures/2229_closure_analysis/migrations/mir_calls_to_shims.stderr b/tests/ui/closures/2229_closure_analysis/migrations/mir_calls_to_shims.stderr index f94451bd1fa0f..0db0759b88f67 100644 --- a/tests/ui/closures/2229_closure_analysis/migrations/mir_calls_to_shims.stderr +++ b/tests/ui/closures/2229_closure_analysis/migrations/mir_calls_to_shims.stderr @@ -1,5 +1,5 @@ error: changes to closure capture in Rust 2021 will affect which traits the closure implements - --> $DIR/mir_calls_to_shims.rs:21:38 + --> $DIR/mir_calls_to_shims.rs:20:38 | LL | let result = panic::catch_unwind(move || { | ^^^^^^^ diff --git a/tests/ui/closures/2229_closure_analysis/only-inhabited-variant.exhaustive_patterns.stderr b/tests/ui/closures/2229_closure_analysis/only-inhabited-variant.exhaustive_patterns.stderr index 58a5348aa391a..e019f7939cd78 100644 --- a/tests/ui/closures/2229_closure_analysis/only-inhabited-variant.exhaustive_patterns.stderr +++ b/tests/ui/closures/2229_closure_analysis/only-inhabited-variant.exhaustive_patterns.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `r` as mutable more than once at a time - --> $DIR/only-inhabited-variant.rs:16:17 + --> $DIR/only-inhabited-variant.rs:15:17 | LL | let mut f = || { | -- first mutable borrow occurs here diff --git a/tests/ui/closures/2229_closure_analysis/only-inhabited-variant.normal.stderr b/tests/ui/closures/2229_closure_analysis/only-inhabited-variant.normal.stderr index 58a5348aa391a..e019f7939cd78 100644 --- a/tests/ui/closures/2229_closure_analysis/only-inhabited-variant.normal.stderr +++ b/tests/ui/closures/2229_closure_analysis/only-inhabited-variant.normal.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `r` as mutable more than once at a time - --> $DIR/only-inhabited-variant.rs:16:17 + --> $DIR/only-inhabited-variant.rs:15:17 | LL | let mut f = || { | -- first mutable borrow occurs here diff --git a/tests/ui/coercion/coerce-to-bang-cast.stderr b/tests/ui/coercion/coerce-to-bang-cast.stderr index 50e009aa25bb1..92d798ac12c15 100644 --- a/tests/ui/coercion/coerce-to-bang-cast.stderr +++ b/tests/ui/coercion/coerce-to-bang-cast.stderr @@ -1,11 +1,11 @@ error[E0605]: non-primitive cast: `i32` as `!` - --> $DIR/coerce-to-bang-cast.rs:4:13 + --> $DIR/coerce-to-bang-cast.rs:2:13 | LL | let y = {return; 22} as !; | ^^^^^^^^^^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object error[E0605]: non-primitive cast: `i32` as `!` - --> $DIR/coerce-to-bang-cast.rs:9:13 + --> $DIR/coerce-to-bang-cast.rs:7:13 | LL | let y = 22 as !; | ^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object diff --git a/tests/ui/const-generics/min_const_generics/complex-types.stderr b/tests/ui/const-generics/min_const_generics/complex-types.stderr index bca68982c399d..44215accc486f 100644 --- a/tests/ui/const-generics/min_const_generics/complex-types.stderr +++ b/tests/ui/const-generics/min_const_generics/complex-types.stderr @@ -1,5 +1,5 @@ error: `[u8; 0]` is forbidden as the type of a const generic parameter - --> $DIR/complex-types.rs:3:21 + --> $DIR/complex-types.rs:1:21 | LL | struct Foo; | ^^^^^^^ @@ -11,7 +11,7 @@ LL + #![feature(adt_const_params)] | error: `()` is forbidden as the type of a const generic parameter - --> $DIR/complex-types.rs:6:21 + --> $DIR/complex-types.rs:4:21 | LL | struct Bar; | ^^ @@ -23,7 +23,7 @@ LL + #![feature(adt_const_params)] | error: `No` is forbidden as the type of a const generic parameter - --> $DIR/complex-types.rs:11:21 + --> $DIR/complex-types.rs:9:21 | LL | struct Fez; | ^^ @@ -35,7 +35,7 @@ LL + #![feature(adt_const_params)] | error: `&'static u8` is forbidden as the type of a const generic parameter - --> $DIR/complex-types.rs:14:21 + --> $DIR/complex-types.rs:12:21 | LL | struct Faz; | ^^^^^^^^^^^ @@ -51,7 +51,7 @@ LL + #![feature(unsized_const_params)] | error: `!` is forbidden as the type of a const generic parameter - --> $DIR/complex-types.rs:17:21 + --> $DIR/complex-types.rs:15:21 | LL | struct Fiz; | ^ @@ -59,7 +59,7 @@ LL | struct Fiz; = note: the only supported types are integers, `bool`, and `char` error: `()` is forbidden as the type of a const generic parameter - --> $DIR/complex-types.rs:20:19 + --> $DIR/complex-types.rs:18:19 | LL | enum Goo { A, B } | ^^ @@ -71,7 +71,7 @@ LL + #![feature(adt_const_params)] | error: `()` is forbidden as the type of a const generic parameter - --> $DIR/complex-types.rs:23:20 + --> $DIR/complex-types.rs:21:20 | LL | union Boo { a: () } | ^^ diff --git a/tests/ui/consts/assert-type-intrinsics.stderr b/tests/ui/consts/assert-type-intrinsics.stderr index 92fc90aebe42c..775b95ac30a40 100644 --- a/tests/ui/consts/assert-type-intrinsics.stderr +++ b/tests/ui/consts/assert-type-intrinsics.stderr @@ -1,17 +1,17 @@ error[E0080]: evaluation panicked: aborted execution: attempted to instantiate uninhabited type `!` - --> $DIR/assert-type-intrinsics.rs:11:9 + --> $DIR/assert-type-intrinsics.rs:10:9 | LL | MaybeUninit::::uninit().assume_init(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `main::_BAD1` failed here error[E0080]: evaluation panicked: aborted execution: attempted to leave type `&i32` uninitialized, which is invalid - --> $DIR/assert-type-intrinsics.rs:15:9 + --> $DIR/assert-type-intrinsics.rs:14:9 | LL | intrinsics::assert_mem_uninitialized_valid::<&'static i32>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `main::_BAD2` failed here error[E0080]: evaluation panicked: aborted execution: attempted to zero-initialize type `&i32`, which is invalid - --> $DIR/assert-type-intrinsics.rs:19:9 + --> $DIR/assert-type-intrinsics.rs:18:9 | LL | intrinsics::assert_zero_valid::<&'static i32>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `main::_BAD3` failed here 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 7e57e16aa4f03..495cc0eb8921b 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,17 +1,17 @@ error[E0080]: index out of bounds: the length is 0 but the index is 0 - --> $DIR/index-out-of-bounds-never-type.rs:10:61 + --> $DIR/index-out-of-bounds-never-type.rs:9:61 | LL | const VOID: ! = { let x = 0 * std::mem::size_of::(); [][x] }; | ^^^^^ evaluation of `PrintName::<()>::VOID` failed here note: erroneous constant encountered - --> $DIR/index-out-of-bounds-never-type.rs:16:13 + --> $DIR/index-out-of-bounds-never-type.rs:15:13 | LL | let _ = PrintName::::VOID; | ^^^^^^^^^^^^^^^^^^^^ 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/panic-assoc-never-type.stderr b/tests/ui/consts/const-eval/panic-assoc-never-type.stderr index d3a293149287e..18cf327d9cd40 100644 --- a/tests/ui/consts/const-eval/panic-assoc-never-type.stderr +++ b/tests/ui/consts/const-eval/panic-assoc-never-type.stderr @@ -1,17 +1,17 @@ error[E0080]: evaluation panicked: explicit panic - --> $DIR/panic-assoc-never-type.rs:10:21 + --> $DIR/panic-assoc-never-type.rs:9:21 | LL | const VOID: ! = panic!(); | ^^^^^^^^ evaluation of `PrintName::VOID` failed here note: erroneous constant encountered - --> $DIR/panic-assoc-never-type.rs:15:13 + --> $DIR/panic-assoc-never-type.rs:14:13 | LL | let _ = PrintName::VOID; | ^^^^^^^^^^^^^^^ note: erroneous constant encountered - --> $DIR/panic-assoc-never-type.rs:15:13 + --> $DIR/panic-assoc-never-type.rs:14:13 | LL | let _ = PrintName::VOID; | ^^^^^^^^^^^^^^^ diff --git a/tests/ui/consts/const-eval/panic-never-type.stderr b/tests/ui/consts/const-eval/panic-never-type.stderr index 317be64205ed7..4251737259518 100644 --- a/tests/ui/consts/const-eval/panic-never-type.stderr +++ b/tests/ui/consts/const-eval/panic-never-type.stderr @@ -1,5 +1,5 @@ error[E0080]: evaluation panicked: explicit panic - --> $DIR/panic-never-type.rs:4:17 + --> $DIR/panic-never-type.rs:3:17 | LL | const VOID: ! = panic!(); | ^^^^^^^^ evaluation of `VOID` failed here diff --git a/tests/ui/consts/const-eval/ub-enum.stderr b/tests/ui/consts/const-eval/ub-enum.stderr index bb2c58796b1c4..d9de9952f5006 100644 --- a/tests/ui/consts/const-eval/ub-enum.stderr +++ b/tests/ui/consts/const-eval/ub-enum.stderr @@ -1,5 +1,5 @@ error[E0080]: constructing invalid value of type Enum: at ., encountered 0x01, but expected a valid enum tag - --> $DIR/ub-enum.rs:30:1 + --> $DIR/ub-enum.rs:29:1 | LL | const BAD_ENUM: Enum = unsafe { mem::transmute(1usize) }; | ^^^^^^^^^^^^^^^^^^^^ it is undefined behavior to use this value @@ -10,7 +10,7 @@ LL | const BAD_ENUM: Enum = unsafe { mem::transmute(1usize) }; } error[E0080]: unable to turn pointer into integer - --> $DIR/ub-enum.rs:33:1 + --> $DIR/ub-enum.rs:32:1 | LL | const BAD_ENUM_PTR: Enum = unsafe { mem::transmute(&1) }; | ^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `BAD_ENUM_PTR` failed here @@ -19,7 +19,7 @@ LL | const BAD_ENUM_PTR: Enum = unsafe { mem::transmute(&1) }; = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error[E0080]: unable to turn pointer into integer - --> $DIR/ub-enum.rs:36:1 + --> $DIR/ub-enum.rs:35:1 | LL | const BAD_ENUM_WRAPPED: Wrap = unsafe { mem::transmute(&1) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `BAD_ENUM_WRAPPED` failed here @@ -28,7 +28,7 @@ LL | const BAD_ENUM_WRAPPED: Wrap = unsafe { mem::transmute(&1) }; = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error[E0080]: constructing invalid value of type Enum2: at ., encountered 0x0, but expected a valid enum tag - --> $DIR/ub-enum.rs:48:1 + --> $DIR/ub-enum.rs:47:1 | LL | const BAD_ENUM2: Enum2 = unsafe { mem::transmute(0usize) }; | ^^^^^^^^^^^^^^^^^^^^^^ it is undefined behavior to use this value @@ -39,7 +39,7 @@ LL | const BAD_ENUM2: Enum2 = unsafe { mem::transmute(0usize) }; } error[E0080]: unable to turn pointer into integer - --> $DIR/ub-enum.rs:50:1 + --> $DIR/ub-enum.rs:49:1 | LL | const BAD_ENUM2_PTR: Enum2 = unsafe { mem::transmute(&0) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `BAD_ENUM2_PTR` failed here @@ -48,7 +48,7 @@ LL | const BAD_ENUM2_PTR: Enum2 = unsafe { mem::transmute(&0) }; = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error[E0080]: unable to turn pointer into integer - --> $DIR/ub-enum.rs:53:1 + --> $DIR/ub-enum.rs:52:1 | LL | const BAD_ENUM2_WRAPPED: Wrap = unsafe { mem::transmute(&0) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `BAD_ENUM2_WRAPPED` failed here @@ -57,7 +57,7 @@ LL | const BAD_ENUM2_WRAPPED: Wrap = unsafe { mem::transmute(&0) }; = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error[E0080]: reading memory at ALLOC0[0x%..0x%], but memory is uninitialized at [0x%..0x%], and this operation requires initialized memory - --> $DIR/ub-enum.rs:62:41 + --> $DIR/ub-enum.rs:61:41 | LL | const BAD_ENUM2_UNDEF: Enum2 = unsafe { MaybeUninit { uninit: () }.init }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `BAD_ENUM2_UNDEF` failed here @@ -67,7 +67,7 @@ LL | const BAD_ENUM2_UNDEF: Enum2 = unsafe { MaybeUninit { uninit: () }.init }; } error[E0080]: unable to turn pointer into integer - --> $DIR/ub-enum.rs:66:1 + --> $DIR/ub-enum.rs:65:1 | LL | const BAD_ENUM2_OPTION_PTR: Option = unsafe { mem::transmute(&0) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `BAD_ENUM2_OPTION_PTR` failed here @@ -76,7 +76,7 @@ LL | const BAD_ENUM2_OPTION_PTR: Option = unsafe { mem::transmute(&0) }; = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error[E0080]: constructing invalid value of type UninhDiscriminant: at ., encountered an uninhabited enum variant - --> $DIR/ub-enum.rs:83:1 + --> $DIR/ub-enum.rs:82:1 | LL | const BAD_UNINHABITED_VARIANT1: UninhDiscriminant = unsafe { mem::transmute(1u8) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ it is undefined behavior to use this value @@ -87,7 +87,7 @@ LL | const BAD_UNINHABITED_VARIANT1: UninhDiscriminant = unsafe { mem::transmute } error[E0080]: constructing invalid value of type UninhDiscriminant: at ., encountered 0x03, but expected a valid enum tag - --> $DIR/ub-enum.rs:85:1 + --> $DIR/ub-enum.rs:84:1 | LL | const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute(3u8) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ it is undefined behavior to use this value @@ -98,7 +98,7 @@ LL | const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute } error[E0080]: constructing invalid value of type Option<(char, char)>: at ..0.1, encountered 0xffffffff, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`) - --> $DIR/ub-enum.rs:93:1 + --> $DIR/ub-enum.rs:92:1 | LL | const BAD_OPTION_CHAR: Option<(char, char)> = Some(('x', unsafe { mem::transmute(!0u32) })); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ it is undefined behavior to use this value @@ -109,19 +109,19 @@ LL | const BAD_OPTION_CHAR: Option<(char, char)> = Some(('x', unsafe { mem::tran } error[E0080]: constructing invalid value of type Result<(i32, Never), (i32, !)>: at ., encountered an uninhabited enum variant - --> $DIR/ub-enum.rs:98:77 + --> $DIR/ub-enum.rs:97:77 | LL | const BAD_UNINHABITED_WITH_DATA1: Result<(i32, Never), (i32, !)> = unsafe { mem::transmute(0u64) }; | ^^^^^^^^^^^^^^^^^^^^ evaluation of `BAD_UNINHABITED_WITH_DATA1` failed here error[E0080]: constructing invalid value of type Result<(i32, !), (i32, Never)>: at ., encountered an uninhabited enum variant - --> $DIR/ub-enum.rs:100:77 + --> $DIR/ub-enum.rs:99:77 | LL | const BAD_UNINHABITED_WITH_DATA2: Result<(i32, !), (i32, Never)> = unsafe { mem::transmute(0u64) }; | ^^^^^^^^^^^^^^^^^^^^ evaluation of `BAD_UNINHABITED_WITH_DATA2` failed here error[E0080]: read discriminant of an uninhabited enum variant - --> $DIR/ub-enum.rs:106:9 + --> $DIR/ub-enum.rs:105:9 | LL | std::mem::discriminant(&*(&() as *const () as *const Never)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `TEST_ICE_89765` failed inside this call @@ -130,7 +130,7 @@ note: inside `discriminant::` --> $SRC_DIR/core/src/mem/mod.rs:LL:COL error[E0080]: constructing invalid value of type WideRangeDiscriminants: at ., encountered 0x0, but expected a valid enum tag - --> $DIR/ub-enum.rs:121:1 + --> $DIR/ub-enum.rs:120:1 | LL | const BAD_WIDE_RANGE_ENUM: WideRangeDiscriminants = unsafe { mem::transmute(0_i64) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ it is undefined behavior to use this value diff --git a/tests/ui/consts/const-eval/ub-uninhabit.stderr b/tests/ui/consts/const-eval/ub-uninhabit.stderr index 244cb96b69231..f1337b3cf1940 100644 --- a/tests/ui/consts/const-eval/ub-uninhabit.stderr +++ b/tests/ui/consts/const-eval/ub-uninhabit.stderr @@ -1,11 +1,11 @@ error[E0080]: constructing invalid value of type Bar: encountered a value of uninhabited type `Bar` - --> $DIR/ub-uninhabit.rs:20:35 + --> $DIR/ub-uninhabit.rs:19:35 | LL | const BAD_BAD_BAD: Bar = unsafe { MaybeUninit { uninit: () }.init }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `BAD_BAD_BAD` failed here error[E0080]: constructing invalid value of type &Bar: encountered a reference pointing to uninhabited type Bar - --> $DIR/ub-uninhabit.rs:23:1 + --> $DIR/ub-uninhabit.rs:22:1 | LL | const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) }; | ^^^^^^^^^^^^^^^^^^^^^^^ it is undefined behavior to use this value @@ -16,13 +16,13 @@ LL | const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) }; } error[E0080]: constructing invalid value of type [Bar; 1]: at [0], encountered a value of uninhabited type `Bar` - --> $DIR/ub-uninhabit.rs:26:42 + --> $DIR/ub-uninhabit.rs:25:42 | LL | const BAD_BAD_ARRAY: [Bar; 1] = unsafe { MaybeUninit { uninit: () }.init }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `BAD_BAD_ARRAY` failed here error[E0080]: constructing invalid value of type !: encountered a value of the never type `!` - --> $DIR/ub-uninhabit.rs:32:16 + --> $DIR/ub-uninhabit.rs:31:16 | LL | let _val = intrinsics::read_via_copy(ptr); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `READ_NEVER` failed here diff --git a/tests/ui/consts/extra-const-ub/detect-extra-ub.with_flag.stderr b/tests/ui/consts/extra-const-ub/detect-extra-ub.with_flag.stderr index a55a90dfb89a4..870f89733409b 100644 --- a/tests/ui/consts/extra-const-ub/detect-extra-ub.with_flag.stderr +++ b/tests/ui/consts/extra-const-ub/detect-extra-ub.with_flag.stderr @@ -1,11 +1,11 @@ error[E0080]: constructing invalid value of type bool: encountered 0x03, but expected a boolean - --> $DIR/detect-extra-ub.rs:30:20 + --> $DIR/detect-extra-ub.rs:29:20 | LL | let _x: bool = transmute(3u8); | ^^^^^^^^^^^^^^ evaluation of `INVALID_BOOL` failed here error[E0080]: constructing invalid value of type usize: encountered a pointer, but expected an integer - --> $DIR/detect-extra-ub.rs:35:21 + --> $DIR/detect-extra-ub.rs:34:21 | LL | let _x: usize = transmute(&3u8); | ^^^^^^^^^^^^^^^ evaluation of `INVALID_PTR_IN_INT` failed here @@ -14,7 +14,7 @@ LL | let _x: usize = transmute(&3u8); = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error[E0080]: constructing invalid value of type PtrSizedEnum: at ., encountered a pointer, but expected an integer - --> $DIR/detect-extra-ub.rs:40:28 + --> $DIR/detect-extra-ub.rs:39:28 | LL | let _x: PtrSizedEnum = transmute(&3u8); | ^^^^^^^^^^^^^^^ evaluation of `INVALID_PTR_IN_ENUM` failed here @@ -23,7 +23,7 @@ LL | let _x: PtrSizedEnum = transmute(&3u8); = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error[E0080]: constructing invalid value of type (usize, usize): at .0, encountered a pointer, but expected an integer - --> $DIR/detect-extra-ub.rs:46:30 + --> $DIR/detect-extra-ub.rs:45:30 | LL | let _x: (usize, usize) = transmute(x); | ^^^^^^^^^^^^ evaluation of `INVALID_SLICE_TO_USIZE_TRANSMUTE` failed here @@ -32,13 +32,13 @@ LL | let _x: (usize, usize) = transmute(x); = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error[E0080]: constructing invalid value of type &u32: encountered an unaligned reference (required 4 byte alignment but found 1) - --> $DIR/detect-extra-ub.rs:51:20 + --> $DIR/detect-extra-ub.rs:50:20 | LL | let _x: &u32 = transmute(&[0u8; 4]); | ^^^^^^^^^^^^^^^^^^^^ evaluation of `UNALIGNED_PTR` failed here error[E0080]: constructing invalid value of type fn(): encountered a maybe-null function pointer - --> $DIR/detect-extra-ub.rs:57:20 + --> $DIR/detect-extra-ub.rs:56:20 | LL | let _x: fn() = transmute({ | ____________________^ @@ -50,13 +50,13 @@ LL | | }); | |______^ evaluation of `MAYBE_NULL_FN_PTR` failed here error[E0080]: constructing invalid value of type UninhDiscriminant: at ., encountered an uninhabited enum variant - --> $DIR/detect-extra-ub.rs:68:13 + --> $DIR/detect-extra-ub.rs:67:13 | LL | let v = *addr_of!(data).cast::(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `UNINHABITED_VARIANT` failed here error[E0080]: constructing invalid value of type [*const u8; 2]: at [0], encountered a partial pointer or a mix of pointers - --> $DIR/detect-extra-ub.rs:87:16 + --> $DIR/detect-extra-ub.rs:86:16 | LL | let _val = *(&mem as *const Align as *const [*const u8; 2]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `PARTIAL_POINTER` failed here @@ -65,7 +65,7 @@ LL | let _val = *(&mem as *const Align as *const [*const u8; 2]); = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error[E0080]: constructing invalid value of type &[u8]: encountered invalid reference metadata: slice is bigger than largest supported object - --> $DIR/detect-extra-ub.rs:101:16 + --> $DIR/detect-extra-ub.rs:100:16 | LL | let _val = &*slice; | ^^^^^^^ evaluation of `OVERSIZED_REF` failed here diff --git a/tests/ui/consts/std/conjure_zst.stderr b/tests/ui/consts/std/conjure_zst.stderr index 0c4a978b81ee6..d4c9df07a393a 100644 --- a/tests/ui/consts/std/conjure_zst.stderr +++ b/tests/ui/consts/std/conjure_zst.stderr @@ -1,10 +1,10 @@ -error[E0080]: evaluation panicked: aborted execution: attempted to instantiate uninhabited type `Infallible` +error[E0080]: evaluation panicked: aborted execution: attempted to instantiate uninhabited type `!` --> $DIR/conjure_zst.rs:5:38 | LL | const INVALID: Infallible = unsafe { mem::conjure_zst() }; | ^^^^^^^^^^^^^^^^^^ evaluation of `INVALID` failed inside this call | -note: inside `conjure_zst::` +note: inside `conjure_zst::` --> $SRC_DIR/core/src/mem/mod.rs:LL:COL error: aborting due to 1 previous error diff --git a/tests/ui/consts/validate_never_arrays.stderr b/tests/ui/consts/validate_never_arrays.stderr index 517b632bdd7be..a147a52b60d5e 100644 --- a/tests/ui/consts/validate_never_arrays.stderr +++ b/tests/ui/consts/validate_never_arrays.stderr @@ -1,5 +1,5 @@ error[E0080]: constructing invalid value of type &[!; 1]: encountered a reference pointing to uninhabited type [!; 1] - --> $DIR/validate_never_arrays.rs:6:1 + --> $DIR/validate_never_arrays.rs:5:1 | LL | const _: &[!; 1] = unsafe { &*(1_usize as *const [!; 1]) }; | ^^^^^^^^^^^^^^^^ it is undefined behavior to use this value @@ -10,7 +10,7 @@ LL | const _: &[!; 1] = unsafe { &*(1_usize as *const [!; 1]) }; } error[E0080]: constructing invalid value of type &[!]: at .[0], encountered a value of the never type `!` - --> $DIR/validate_never_arrays.rs:9:1 + --> $DIR/validate_never_arrays.rs:8:1 | LL | const _: &[!] = unsafe { &*(1_usize as *const [!; 1]) }; | ^^^^^^^^^^^^^ it is undefined behavior to use this value @@ -21,7 +21,7 @@ LL | const _: &[!] = unsafe { &*(1_usize as *const [!; 1]) }; } error[E0080]: constructing invalid value of type &[!]: at .[0], encountered a value of the never type `!` - --> $DIR/validate_never_arrays.rs:10:1 + --> $DIR/validate_never_arrays.rs:9:1 | LL | const _: &[!] = unsafe { &*(1_usize as *const [!; 42]) }; | ^^^^^^^^^^^^^ it is undefined behavior to use this value diff --git a/tests/ui/editions/never-type-fallback-breaking.e2021.fixed b/tests/ui/editions/never-type-fallback-breaking.e2021.fixed deleted file mode 100644 index 7e6c47ed43e05..0000000000000 --- a/tests/ui/editions/never-type-fallback-breaking.e2021.fixed +++ /dev/null @@ -1,81 +0,0 @@ -// This is a test for various ways in which the change to the never type -// fallback can break things and for the `dependency_on_unit_never_type_fallback` -// lint. -// -//@ revisions: e2021 e2024 -// -//@[e2021] edition: 2021 -//@[e2024] edition: 2024 -// -//@[e2021] run-rustfix - -fn main() { - m(); - q(); - let _ = meow(); - let _ = fallback_return(); - let _ = fully_apit(); -} - -fn m() { - //[e2021]~^ error: this function depends on never type fallback being `()` - //[e2021]~| warn: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - let x: () = match true { - true => Default::default(), - //[e2024]~^ error: the trait bound `!: Default` is not satisfied - false => panic!("..."), - }; - - dbg!(x); -} - -fn q() -> Option<()> { - //[e2021]~^ error: this function depends on never type fallback being `()` - //[e2021]~| warn: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - fn deserialize() -> Option { - Some(T::default()) - } - - deserialize::<()>()?; - //[e2024]~^ error: the trait bound `!: Default` is not satisfied - - None -} - -// Make sure we turbofish the right argument -fn help<'a: 'a, T: Into<()>, U>(_: U) -> Result { - Err(()) -} -fn meow() -> Result<(), ()> { - //[e2021]~^ error: this function depends on never type fallback being `()` - //[e2021]~| warn: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - help::<(), _>(1)?; - //[e2024]~^ error: the trait bound `(): From` is not satisfied - Ok(()) -} - -pub fn takes_apit(_y: impl Fn() -> T) -> Result { - Err(()) -} - -pub fn fallback_return() -> Result<(), ()> { - //[e2021]~^ error: this function depends on never type fallback being `()` - //[e2021]~| warn: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - takes_apit::<()>(|| Default::default())?; - //[e2024]~^ error: the trait bound `!: Default` is not satisfied - Ok(()) -} - -fn mk() -> Result { - Err(()) -} - -fn takes_apit2(_x: impl Default) {} - -fn fully_apit() -> Result<(), ()> { - //[e2021]~^ error: this function depends on never type fallback being `()` - //[e2021]~| warn: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - takes_apit2(mk::<()>()?); - //[e2024]~^ error: the trait bound `!: Default` is not satisfied - Ok(()) -} diff --git a/tests/ui/editions/never-type-fallback-breaking.e2021.stderr b/tests/ui/editions/never-type-fallback-breaking.e2021.stderr index 17dc5fc8795bc..66aa056880c22 100644 --- a/tests/ui/editions/never-type-fallback-breaking.e2021.stderr +++ b/tests/ui/editions/never-type-fallback-breaking.e2021.stderr @@ -1,203 +1,74 @@ -error: this function depends on never type fallback being `()` - --> $DIR/never-type-fallback-breaking.rs:20:1 - | -LL | fn m() { - | ^^^^^^ - | - = help: specify the types explicitly -note: in edition 2024, the requirement `!: Default` will fail - --> $DIR/never-type-fallback-breaking.rs:24:17 +error[E0277]: the trait bound `!: Default` is not satisfied + --> $DIR/never-type-fallback-breaking.rs:21:17 | LL | true => Default::default(), - | ^^^^^^^^^^^^^^^^^^ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see - = note: `#[deny(dependency_on_unit_never_type_fallback)]` (part of `#[deny(rust_2024_compatibility)]`) on by default -help: use `()` annotations to avoid fallback changes + | ^^^^^^^^^^^^^^^^^^ the trait `Default` is not implemented for `!` | -LL | let x: () = match true { - | ++++ + = note: this error might have been caused by changes to Rust's type-inference algorithm (see issue #148922 for more information) + = help: you might have intended to use the type `()` here instead -error: this function depends on never type fallback being `()` - --> $DIR/never-type-fallback-breaking.rs:32:1 - | -LL | fn q() -> Option<()> { - | ^^^^^^^^^^^^^^^^^^^^ - | - = help: specify the types explicitly -note: in edition 2024, the requirement `!: Default` will fail - --> $DIR/never-type-fallback-breaking.rs:39:5 +error[E0277]: the trait bound `!: Default` is not satisfied + --> $DIR/never-type-fallback-breaking.rs:34:5 | LL | deserialize()?; - | ^^^^^^^^^^^^^ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see -help: use `()` annotations to avoid fallback changes - | -LL | deserialize::<()>()?; - | ++++++ - -error: this function depends on never type fallback being `()` - --> $DIR/never-type-fallback-breaking.rs:49:1 + | ^^^^^^^^^^^^^ the trait `Default` is not implemented for `!` | -LL | fn meow() -> Result<(), ()> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: this error might have been caused by changes to Rust's type-inference algorithm (see issue #148922 for more information) + = help: you might have intended to use the type `()` here instead +note: required by a bound in `deserialize` + --> $DIR/never-type-fallback-breaking.rs:30:23 | - = help: specify the types explicitly -note: in edition 2024, the requirement `(): From` will fail - --> $DIR/never-type-fallback-breaking.rs:52:5 +LL | fn deserialize() -> Option { + | ^^^^^^^ required by this bound in `deserialize` + +error[E0277]: the trait bound `(): From` is not satisfied + --> $DIR/never-type-fallback-breaking.rs:45:5 | LL | help(1)?; - | ^^^^^^^ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see -help: use `()` annotations to avoid fallback changes - | -LL | help::<(), _>(1)?; - | +++++++++ + | ^^^^^^^ the trait `From` is not implemented for `()` + | + = help: the following other types implement trait `From`: + `(T, T)` implements `From<[T; 2]>` + `(T, T, T)` implements `From<[T; 3]>` + `(T, T, T, T)` implements `From<[T; 4]>` + `(T, T, T, T, T)` implements `From<[T; 5]>` + `(T, T, T, T, T, T)` implements `From<[T; 6]>` + `(T, T, T, T, T, T, T)` implements `From<[T; 7]>` + `(T, T, T, T, T, T, T, T)` implements `From<[T; 8]>` + `(T, T, T, T, T, T, T, T, T)` implements `From<[T; 9]>` + and 4 others + = note: required for `!` to implement `Into<()>` +note: required by a bound in `help` + --> $DIR/never-type-fallback-breaking.rs:41:20 + | +LL | fn help<'a: 'a, T: Into<()>, U>(_: U) -> Result { + | ^^^^^^^^ required by this bound in `help` -error: this function depends on never type fallback being `()` - --> $DIR/never-type-fallback-breaking.rs:61:1 - | -LL | pub fn fallback_return() -> Result<(), ()> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: specify the types explicitly -note: in edition 2024, the requirement `!: Default` will fail - --> $DIR/never-type-fallback-breaking.rs:64:19 +error[E0277]: the trait bound `!: Default` is not satisfied + --> $DIR/never-type-fallback-breaking.rs:55:19 | LL | takes_apit(|| Default::default())?; - | ^^^^^^^^^^^^^^^^^^ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see -help: use `()` annotations to avoid fallback changes + | ^^^^^^^^^^^^^^^^^^ the trait `Default` is not implemented for `!` | -LL | takes_apit::<()>(|| Default::default())?; - | ++++++ + = note: this error might have been caused by changes to Rust's type-inference algorithm (see issue #148922 for more information) + = help: you might have intended to use the type `()` here instead -error: this function depends on never type fallback being `()` - --> $DIR/never-type-fallback-breaking.rs:75:1 - | -LL | fn fully_apit() -> Result<(), ()> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: specify the types explicitly -note: in edition 2024, the requirement `!: Default` will fail - --> $DIR/never-type-fallback-breaking.rs:78:17 +error[E0277]: the trait bound `!: Default` is not satisfied + --> $DIR/never-type-fallback-breaking.rs:67:17 | LL | takes_apit2(mk()?); - | ^^^^^ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see -help: use `()` annotations to avoid fallback changes - | -LL | takes_apit2(mk::<()>()?); - | ++++++ - -error: aborting due to 5 previous errors - -Future incompatibility report: Future breakage diagnostic: -error: this function depends on never type fallback being `()` - --> $DIR/never-type-fallback-breaking.rs:20:1 - | -LL | fn m() { - | ^^^^^^ + | ----------- ^^^^^ the trait `Default` is not implemented for `!` + | | + | required by a bound introduced by this call | - = help: specify the types explicitly -note: in edition 2024, the requirement `!: Default` will fail - --> $DIR/never-type-fallback-breaking.rs:24:17 + = note: this error might have been caused by changes to Rust's type-inference algorithm (see issue #148922 for more information) + = help: you might have intended to use the type `()` here instead +note: required by a bound in `takes_apit2` + --> $DIR/never-type-fallback-breaking.rs:64:25 | -LL | true => Default::default(), - | ^^^^^^^^^^^^^^^^^^ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see - = note: `#[deny(dependency_on_unit_never_type_fallback)]` (part of `#[deny(rust_2024_compatibility)]`) on by default -help: use `()` annotations to avoid fallback changes - | -LL | let x: () = match true { - | ++++ +LL | fn takes_apit2(_x: impl Default) {} + | ^^^^^^^ required by this bound in `takes_apit2` -Future breakage diagnostic: -error: this function depends on never type fallback being `()` - --> $DIR/never-type-fallback-breaking.rs:32:1 - | -LL | fn q() -> Option<()> { - | ^^^^^^^^^^^^^^^^^^^^ - | - = help: specify the types explicitly -note: in edition 2024, the requirement `!: Default` will fail - --> $DIR/never-type-fallback-breaking.rs:39:5 - | -LL | deserialize()?; - | ^^^^^^^^^^^^^ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see - = note: `#[deny(dependency_on_unit_never_type_fallback)]` (part of `#[deny(rust_2024_compatibility)]`) on by default -help: use `()` annotations to avoid fallback changes - | -LL | deserialize::<()>()?; - | ++++++ - -Future breakage diagnostic: -error: this function depends on never type fallback being `()` - --> $DIR/never-type-fallback-breaking.rs:49:1 - | -LL | fn meow() -> Result<(), ()> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: specify the types explicitly -note: in edition 2024, the requirement `(): From` will fail - --> $DIR/never-type-fallback-breaking.rs:52:5 - | -LL | help(1)?; - | ^^^^^^^ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see - = note: `#[deny(dependency_on_unit_never_type_fallback)]` (part of `#[deny(rust_2024_compatibility)]`) on by default -help: use `()` annotations to avoid fallback changes - | -LL | help::<(), _>(1)?; - | +++++++++ - -Future breakage diagnostic: -error: this function depends on never type fallback being `()` - --> $DIR/never-type-fallback-breaking.rs:61:1 - | -LL | pub fn fallback_return() -> Result<(), ()> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: specify the types explicitly -note: in edition 2024, the requirement `!: Default` will fail - --> $DIR/never-type-fallback-breaking.rs:64:19 - | -LL | takes_apit(|| Default::default())?; - | ^^^^^^^^^^^^^^^^^^ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see - = note: `#[deny(dependency_on_unit_never_type_fallback)]` (part of `#[deny(rust_2024_compatibility)]`) on by default -help: use `()` annotations to avoid fallback changes - | -LL | takes_apit::<()>(|| Default::default())?; - | ++++++ - -Future breakage diagnostic: -error: this function depends on never type fallback being `()` - --> $DIR/never-type-fallback-breaking.rs:75:1 - | -LL | fn fully_apit() -> Result<(), ()> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: specify the types explicitly -note: in edition 2024, the requirement `!: Default` will fail - --> $DIR/never-type-fallback-breaking.rs:78:17 - | -LL | takes_apit2(mk()?); - | ^^^^^ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see - = note: `#[deny(dependency_on_unit_never_type_fallback)]` (part of `#[deny(rust_2024_compatibility)]`) on by default -help: use `()` annotations to avoid fallback changes - | -LL | takes_apit2(mk::<()>()?); - | ++++++ +error: aborting due to 5 previous errors +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/editions/never-type-fallback-breaking.e2024.stderr b/tests/ui/editions/never-type-fallback-breaking.e2024.stderr index 65be5d90d011c..66aa056880c22 100644 --- a/tests/ui/editions/never-type-fallback-breaking.e2024.stderr +++ b/tests/ui/editions/never-type-fallback-breaking.e2024.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `!: Default` is not satisfied - --> $DIR/never-type-fallback-breaking.rs:24:17 + --> $DIR/never-type-fallback-breaking.rs:21:17 | LL | true => Default::default(), | ^^^^^^^^^^^^^^^^^^ the trait `Default` is not implemented for `!` @@ -8,7 +8,7 @@ LL | true => Default::default(), = help: you might have intended to use the type `()` here instead error[E0277]: the trait bound `!: Default` is not satisfied - --> $DIR/never-type-fallback-breaking.rs:39:5 + --> $DIR/never-type-fallback-breaking.rs:34:5 | LL | deserialize()?; | ^^^^^^^^^^^^^ the trait `Default` is not implemented for `!` @@ -16,13 +16,13 @@ LL | deserialize()?; = note: this error might have been caused by changes to Rust's type-inference algorithm (see issue #148922 for more information) = help: you might have intended to use the type `()` here instead note: required by a bound in `deserialize` - --> $DIR/never-type-fallback-breaking.rs:35:23 + --> $DIR/never-type-fallback-breaking.rs:30:23 | LL | fn deserialize() -> Option { | ^^^^^^^ required by this bound in `deserialize` error[E0277]: the trait bound `(): From` is not satisfied - --> $DIR/never-type-fallback-breaking.rs:52:5 + --> $DIR/never-type-fallback-breaking.rs:45:5 | LL | help(1)?; | ^^^^^^^ the trait `From` is not implemented for `()` @@ -39,13 +39,13 @@ LL | help(1)?; and 4 others = note: required for `!` to implement `Into<()>` note: required by a bound in `help` - --> $DIR/never-type-fallback-breaking.rs:46:20 + --> $DIR/never-type-fallback-breaking.rs:41:20 | LL | fn help<'a: 'a, T: Into<()>, U>(_: U) -> Result { | ^^^^^^^^ required by this bound in `help` error[E0277]: the trait bound `!: Default` is not satisfied - --> $DIR/never-type-fallback-breaking.rs:64:19 + --> $DIR/never-type-fallback-breaking.rs:55:19 | LL | takes_apit(|| Default::default())?; | ^^^^^^^^^^^^^^^^^^ the trait `Default` is not implemented for `!` @@ -54,7 +54,7 @@ LL | takes_apit(|| Default::default())?; = help: you might have intended to use the type `()` here instead error[E0277]: the trait bound `!: Default` is not satisfied - --> $DIR/never-type-fallback-breaking.rs:78:17 + --> $DIR/never-type-fallback-breaking.rs:67:17 | LL | takes_apit2(mk()?); | ----------- ^^^^^ the trait `Default` is not implemented for `!` @@ -64,7 +64,7 @@ LL | takes_apit2(mk()?); = note: this error might have been caused by changes to Rust's type-inference algorithm (see issue #148922 for more information) = help: you might have intended to use the type `()` here instead note: required by a bound in `takes_apit2` - --> $DIR/never-type-fallback-breaking.rs:73:25 + --> $DIR/never-type-fallback-breaking.rs:64:25 | LL | fn takes_apit2(_x: impl Default) {} | ^^^^^^^ required by this bound in `takes_apit2` diff --git a/tests/ui/editions/never-type-fallback-breaking.rs b/tests/ui/editions/never-type-fallback-breaking.rs index ae31b436f5662..cafa3eac5d666 100644 --- a/tests/ui/editions/never-type-fallback-breaking.rs +++ b/tests/ui/editions/never-type-fallback-breaking.rs @@ -1,13 +1,12 @@ // This is a test for various ways in which the change to the never type -// fallback can break things and for the `dependency_on_unit_never_type_fallback` -// lint. +// fallback can break things. +// +// It also used to test for the `dependency_on_unit_never_type_fallback` lint. // //@ revisions: e2021 e2024 // //@[e2021] edition: 2021 //@[e2024] edition: 2024 -// -//@[e2021] run-rustfix fn main() { m(); @@ -18,11 +17,9 @@ fn main() { } fn m() { - //[e2021]~^ error: this function depends on never type fallback being `()` - //[e2021]~| warn: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! let x = match true { true => Default::default(), - //[e2024]~^ error: the trait bound `!: Default` is not satisfied + //~^ error: the trait bound `!: Default` is not satisfied false => panic!("..."), }; @@ -30,14 +27,12 @@ fn m() { } fn q() -> Option<()> { - //[e2021]~^ error: this function depends on never type fallback being `()` - //[e2021]~| warn: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! fn deserialize() -> Option { Some(T::default()) } deserialize()?; - //[e2024]~^ error: the trait bound `!: Default` is not satisfied + //~^ error: the trait bound `!: Default` is not satisfied None } @@ -47,10 +42,8 @@ fn help<'a: 'a, T: Into<()>, U>(_: U) -> Result { Err(()) } fn meow() -> Result<(), ()> { - //[e2021]~^ error: this function depends on never type fallback being `()` - //[e2021]~| warn: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! help(1)?; - //[e2024]~^ error: the trait bound `(): From` is not satisfied + //~^ error: the trait bound `(): From` is not satisfied Ok(()) } @@ -59,10 +52,8 @@ pub fn takes_apit(_y: impl Fn() -> T) -> Result { } pub fn fallback_return() -> Result<(), ()> { - //[e2021]~^ error: this function depends on never type fallback being `()` - //[e2021]~| warn: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! takes_apit(|| Default::default())?; - //[e2024]~^ error: the trait bound `!: Default` is not satisfied + //~^ error: the trait bound `!: Default` is not satisfied Ok(()) } @@ -73,9 +64,7 @@ fn mk() -> Result { fn takes_apit2(_x: impl Default) {} fn fully_apit() -> Result<(), ()> { - //[e2021]~^ error: this function depends on never type fallback being `()` - //[e2021]~| warn: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! takes_apit2(mk()?); - //[e2024]~^ error: the trait bound `!: Default` is not satisfied + //~^ error: the trait bound `!: Default` is not satisfied Ok(()) } diff --git a/tests/ui/editions/never-type-fallback.e2021.run.stdout b/tests/ui/editions/never-type-fallback.e2021.run.stdout index 4122f7ac1eed2..df2eeae60b4c5 100644 --- a/tests/ui/editions/never-type-fallback.e2021.run.stdout +++ b/tests/ui/editions/never-type-fallback.e2021.run.stdout @@ -1 +1 @@ -return type = () +return type = ! diff --git a/tests/ui/feature-gates/feature-gate-exhaustive-patterns.stderr b/tests/ui/feature-gates/feature-gate-exhaustive-patterns.stderr index 614f382d67327..4a9dc6036289d 100644 --- a/tests/ui/feature-gates/feature-gate-exhaustive-patterns.stderr +++ b/tests/ui/feature-gates/feature-gate-exhaustive-patterns.stderr @@ -1,5 +1,5 @@ error[E0005]: refutable pattern in local binding - --> $DIR/feature-gate-exhaustive-patterns.rs:8:9 + --> $DIR/feature-gate-exhaustive-patterns.rs:6:9 | LL | let Ok(_x) = &foo(); | ^^^^^^ pattern `&Err(_)` not covered diff --git a/tests/ui/for-loop-while/break-while-condition.stderr b/tests/ui/for-loop-while/break-while-condition.stderr index 07a57424575fd..095c4032c3243 100644 --- a/tests/ui/for-loop-while/break-while-condition.stderr +++ b/tests/ui/for-loop-while/break-while-condition.stderr @@ -1,20 +1,23 @@ error[E0308]: mismatched types - --> $DIR/break-while-condition.rs:9:20 + --> $DIR/break-while-condition.rs:8:13 | -LL | let _: ! = { - | ____________________^ -LL | | 'a: while break 'a {}; -LL | | }; - | |_________^ expected `!`, found `()` +LL | 'a: while break 'a {} + | ^^^^^^^^^^^^^^^^^^^^^ expected `!`, found `()` | = note: expected type `!` found unit type `()` + = note: `while` loops evaluate to unit type `()` +help: consider adding a diverging expression here + | +LL | 'a: while break 'a {} /* `loop {}` or `panic!("...")` */ + | ++++++++++++++++++++++++++++++++++ error[E0308]: mismatched types - --> $DIR/break-while-condition.rs:16:13 + --> $DIR/break-while-condition.rs:15:13 | LL | / while false { -LL | | break +LL | | +LL | | break; LL | | } | |_____________^ expected `!`, found `()` | @@ -31,7 +34,8 @@ error[E0308]: mismatched types --> $DIR/break-while-condition.rs:24:13 | LL | / while false { -LL | | return +LL | | +LL | | return; LL | | } | |_____________^ expected `!`, found `()` | diff --git a/tests/ui/impl-trait/generic-with-implicit-hrtb-without-dyn.pre2021.stderr b/tests/ui/impl-trait/generic-with-implicit-hrtb-without-dyn.pre2021.stderr index 82a2c6693826b..55775e6a4004e 100644 --- a/tests/ui/impl-trait/generic-with-implicit-hrtb-without-dyn.pre2021.stderr +++ b/tests/ui/impl-trait/generic-with-implicit-hrtb-without-dyn.pre2021.stderr @@ -1,8 +1,11 @@ -error[E0277]: the trait bound `(): AsRef<(dyn for<'a> Fn(&'a ()) + 'static)>` is not satisfied +error[E0277]: the trait bound `!: AsRef<(dyn for<'a> Fn(&'a ()) + 'static)>` is not satisfied --> $DIR/generic-with-implicit-hrtb-without-dyn.rs:7:13 | LL | fn ice() -> impl AsRef { - | ^^^^^^^^^^^^^^^^^^^ the trait `AsRef<(dyn for<'a> Fn(&'a ()) + 'static)>` is not implemented for `()` + | ^^^^^^^^^^^^^^^^^^^ the trait `AsRef<(dyn for<'a> Fn(&'a ()) + 'static)>` is not implemented for `!` +... +LL | todo!() + | ------- return type was inferred to be `!` here error: aborting due to 1 previous error diff --git a/tests/ui/impl-trait/generic-with-implicit-hrtb-without-dyn.rs b/tests/ui/impl-trait/generic-with-implicit-hrtb-without-dyn.rs index a419f3a2acf1c..64311a474cade 100644 --- a/tests/ui/impl-trait/generic-with-implicit-hrtb-without-dyn.rs +++ b/tests/ui/impl-trait/generic-with-implicit-hrtb-without-dyn.rs @@ -5,7 +5,7 @@ #![allow(warnings)] fn ice() -> impl AsRef { - //[pre2021]~^ ERROR: the trait bound `(): AsRef<(dyn for<'a> Fn(&'a ()) + 'static)>` is not satisfied [E0277] + //[pre2021]~^ ERROR: the trait bound `!: AsRef<(dyn for<'a> Fn(&'a ()) + 'static)>` is not satisfied [E0277] //[edition2021]~^^ ERROR: expected a type, found a trait [E0782] //[edition2021]~| ERROR: expected a type, found a trait [E0782] todo!() diff --git a/tests/ui/impl-trait/issues/issue-58504.rs b/tests/ui/impl-trait/issues/issue-58504.rs index 57119671680ed..10e2670504b94 100644 --- a/tests/ui/impl-trait/issues/issue-58504.rs +++ b/tests/ui/impl-trait/issues/issue-58504.rs @@ -1,4 +1,4 @@ -#![feature(coroutines, coroutine_trait, never_type)] +#![feature(coroutines, coroutine_trait)] use std::ops::Coroutine; diff --git a/tests/ui/impl-trait/non-defining-uses/ice-issue-146191.current.stderr b/tests/ui/impl-trait/non-defining-uses/ice-issue-146191.current.stderr index 5dc66f454652a..2b496068c1162 100644 --- a/tests/ui/impl-trait/non-defining-uses/ice-issue-146191.current.stderr +++ b/tests/ui/impl-trait/non-defining-uses/ice-issue-146191.current.stderr @@ -1,8 +1,8 @@ -error[E0277]: the trait bound `(): ReturnsSend` is not satisfied +error[E0277]: the trait bound `!: ReturnsSend` is not satisfied --> $DIR/ice-issue-146191.rs:6:52 | LL | fn create_complex_future() -> impl Future { - | ^^^^^^^^^^^^^^^^ the trait `ReturnsSend` is not implemented for `()` + | ^^^^^^^^^^^^^^^^ the trait `ReturnsSend` is not implemented for `!` | help: this trait has no implementations, consider adding one --> $DIR/ice-issue-146191.rs:13:1 diff --git a/tests/ui/impl-trait/non-defining-uses/ice-issue-146191.rs b/tests/ui/impl-trait/non-defining-uses/ice-issue-146191.rs index 84f139da4e32a..8c22376f61ee3 100644 --- a/tests/ui/impl-trait/non-defining-uses/ice-issue-146191.rs +++ b/tests/ui/impl-trait/non-defining-uses/ice-issue-146191.rs @@ -4,7 +4,7 @@ //@ ignore-compare-mode-next-solver (explicit revisions) fn create_complex_future() -> impl Future { - //[current]~^ ERROR the trait bound `(): ReturnsSend` is not satisfied + //[current]~^ ERROR the trait bound `!: ReturnsSend` is not satisfied async { create_complex_future().await } //[current]~^ ERROR recursion in an async block requires //[next]~^^ ERROR type annotations needed diff --git a/tests/ui/impl-trait/rpit/early_bound.stderr b/tests/ui/impl-trait/rpit/early_bound.stderr index d00005f20d4a3..d5eb229e3a75a 100644 --- a/tests/ui/impl-trait/rpit/early_bound.stderr +++ b/tests/ui/impl-trait/rpit/early_bound.stderr @@ -2,7 +2,7 @@ error: concrete type differs from previous defining opaque type use --> $DIR/early_bound.rs:6:36 | LL | let _ = identity::<&'a ()>(test(false)); - | ^^^^^^^^^^^ expected `()`, got `&()` + | ^^^^^^^^^^^ expected `!`, got `&()` | note: previous use here --> $DIR/early_bound.rs:3:29 diff --git a/tests/ui/layout/enum-scalar-pair-int-ptr.stderr b/tests/ui/layout/enum-scalar-pair-int-ptr.stderr index 357c8182ebd6f..47368d99ad486 100644 --- a/tests/ui/layout/enum-scalar-pair-int-ptr.stderr +++ b/tests/ui/layout/enum-scalar-pair-int-ptr.stderr @@ -1,11 +1,11 @@ error: abi: ScalarPair(Initialized { value: Int(I?, false), valid_range: $VALID_RANGE }, Initialized { value: Pointer(AddressSpace(0)), valid_range: $VALID_RANGE }) - --> $DIR/enum-scalar-pair-int-ptr.rs:12:1 + --> $DIR/enum-scalar-pair-int-ptr.rs:11:1 | LL | enum ScalarPairPointerWithInt { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: abi: Memory { sized: true } - --> $DIR/enum-scalar-pair-int-ptr.rs:21:1 + --> $DIR/enum-scalar-pair-int-ptr.rs:20:1 | LL | enum NotScalarPairPointerWithSmallerInt { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/layout/enum.stderr b/tests/ui/layout/enum.stderr index dc9a43eed10f5..7507650d7e246 100644 --- a/tests/ui/layout/enum.stderr +++ b/tests/ui/layout/enum.stderr @@ -1,5 +1,5 @@ error: align: AbiAlign { abi: Align(2 bytes) } - --> $DIR/enum.rs:9:1 + --> $DIR/enum.rs:8:1 | LL | enum UninhabitedVariantAlign { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -11,13 +11,13 @@ LL | enum UninhabitedVariantSpace { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: abi: ScalarPair(Initialized { value: Int(I8, false), valid_range: 0..=1 }, Initialized { value: Int(I8, false), valid_range: 0..=255 }) - --> $DIR/enum.rs:21:1 + --> $DIR/enum.rs:22:1 | LL | enum ScalarPairDifferingSign { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: size: Size(4 bytes) - --> $DIR/enum.rs:31:1 + --> $DIR/enum.rs:33:1 | LL | enum DefinedLayoutAllUninhabited { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/layout/struct.stderr b/tests/ui/layout/struct.stderr index 7bc9af61ed48e..26a6aad2286f6 100644 --- a/tests/ui/layout/struct.stderr +++ b/tests/ui/layout/struct.stderr @@ -1,11 +1,11 @@ error: abi: Memory { sized: true } - --> $DIR/struct.rs:9:1 + --> $DIR/struct.rs:8:1 | LL | struct AlignedZstPreventsScalar(i16, [i32; 0]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: abi: Scalar(Initialized { value: Int(I32, true), valid_range: 0..=4294967295 }) - --> $DIR/struct.rs:12:1 + --> $DIR/struct.rs:11:1 | LL | struct AlignedZstButStillScalar(i32, [i16; 0]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/lint/unused-features/unused-language-features.stderr b/tests/ui/lint/unused-features/unused-language-features.stderr index 3cede1a6fe726..c17c12988ebbf 100644 --- a/tests/ui/lint/unused-features/unused-language-features.stderr +++ b/tests/ui/lint/unused-features/unused-language-features.stderr @@ -1,5 +1,5 @@ error: feature `coroutines` is declared but not used - --> $DIR/unused-language-features.rs:5:12 + --> $DIR/unused-language-features.rs:4:12 | LL | #![feature(coroutines)] | ^^^^^^^^^^ @@ -11,25 +11,25 @@ LL | #![deny(unused_features)] | ^^^^^^^^^^^^^^^ error: feature `coroutine_clone` is declared but not used - --> $DIR/unused-language-features.rs:7:12 + --> $DIR/unused-language-features.rs:6:12 | LL | #![feature(coroutine_clone)] | ^^^^^^^^^^^^^^^ error: feature `stmt_expr_attributes` is declared but not used - --> $DIR/unused-language-features.rs:9:12 + --> $DIR/unused-language-features.rs:8:12 | LL | #![feature(stmt_expr_attributes)] | ^^^^^^^^^^^^^^^^^^^^ error: feature `asm_unwind` is declared but not used - --> $DIR/unused-language-features.rs:11:12 + --> $DIR/unused-language-features.rs:10:12 | LL | #![feature(asm_unwind)] | ^^^^^^^^^^ error: feature `negative_impls` is declared but not used - --> $DIR/unused-language-features.rs:15:28 + --> $DIR/unused-language-features.rs:14:28 | LL | #![cfg_attr(all(), feature(negative_impls))] | ^^^^^^^^^^^^^^ diff --git a/tests/ui/lint/unused/must-use-ops.stderr b/tests/ui/lint/unused/must-use-ops.stderr index 79a53d39cbf10..41594f47a1398 100644 --- a/tests/ui/lint/unused/must-use-ops.stderr +++ b/tests/ui/lint/unused/must-use-ops.stderr @@ -1,5 +1,5 @@ warning: unused comparison that must be used - --> $DIR/must-use-ops.rs:18:5 + --> $DIR/must-use-ops.rs:17:5 | LL | val == 1; | ^^^^^^^^ the comparison produces a value @@ -15,7 +15,7 @@ LL | let _ = val == 1; | +++++++ warning: unused comparison that must be used - --> $DIR/must-use-ops.rs:19:5 + --> $DIR/must-use-ops.rs:18:5 | LL | val < 1; | ^^^^^^^ the comparison produces a value @@ -26,7 +26,7 @@ LL | let _ = val < 1; | +++++++ warning: unused comparison that must be used - --> $DIR/must-use-ops.rs:20:5 + --> $DIR/must-use-ops.rs:19:5 | LL | val <= 1; | ^^^^^^^^ the comparison produces a value @@ -37,7 +37,7 @@ LL | let _ = val <= 1; | +++++++ warning: unused comparison that must be used - --> $DIR/must-use-ops.rs:21:5 + --> $DIR/must-use-ops.rs:20:5 | LL | val != 1; | ^^^^^^^^ the comparison produces a value @@ -48,7 +48,7 @@ LL | let _ = val != 1; | +++++++ warning: unused comparison that must be used - --> $DIR/must-use-ops.rs:22:5 + --> $DIR/must-use-ops.rs:21:5 | LL | val >= 1; | ^^^^^^^^ the comparison produces a value @@ -59,7 +59,7 @@ LL | let _ = val >= 1; | +++++++ warning: unused comparison that must be used - --> $DIR/must-use-ops.rs:23:5 + --> $DIR/must-use-ops.rs:22:5 | LL | val > 1; | ^^^^^^^ the comparison produces a value @@ -70,7 +70,7 @@ LL | let _ = val > 1; | +++++++ warning: unused arithmetic operation that must be used - --> $DIR/must-use-ops.rs:26:5 + --> $DIR/must-use-ops.rs:25:5 | LL | val + 2; | ^^^^^^^ the arithmetic operation produces a value @@ -81,7 +81,7 @@ LL | let _ = val + 2; | +++++++ warning: unused arithmetic operation that must be used - --> $DIR/must-use-ops.rs:27:5 + --> $DIR/must-use-ops.rs:26:5 | LL | val - 2; | ^^^^^^^ the arithmetic operation produces a value @@ -92,7 +92,7 @@ LL | let _ = val - 2; | +++++++ warning: unused arithmetic operation that must be used - --> $DIR/must-use-ops.rs:28:5 + --> $DIR/must-use-ops.rs:27:5 | LL | val / 2; | ^^^^^^^ the arithmetic operation produces a value @@ -103,7 +103,7 @@ LL | let _ = val / 2; | +++++++ warning: unused arithmetic operation that must be used - --> $DIR/must-use-ops.rs:29:5 + --> $DIR/must-use-ops.rs:28:5 | LL | val * 2; | ^^^^^^^ the arithmetic operation produces a value @@ -114,7 +114,7 @@ LL | let _ = val * 2; | +++++++ warning: unused arithmetic operation that must be used - --> $DIR/must-use-ops.rs:30:5 + --> $DIR/must-use-ops.rs:29:5 | LL | val % 2; | ^^^^^^^ the arithmetic operation produces a value @@ -125,7 +125,7 @@ LL | let _ = val % 2; | +++++++ warning: unused logical operation that must be used - --> $DIR/must-use-ops.rs:33:5 + --> $DIR/must-use-ops.rs:32:5 | LL | true && true; | ^^^^^^^^^^^^ the logical operation produces a value @@ -136,7 +136,7 @@ LL | let _ = true && true; | +++++++ warning: unused logical operation that must be used - --> $DIR/must-use-ops.rs:34:5 + --> $DIR/must-use-ops.rs:33:5 | LL | false || true; | ^^^^^^^^^^^^^ the logical operation produces a value @@ -147,7 +147,7 @@ LL | let _ = false || true; | +++++++ warning: unused bitwise operation that must be used - --> $DIR/must-use-ops.rs:37:5 + --> $DIR/must-use-ops.rs:36:5 | LL | 5 ^ val; | ^^^^^^^ the bitwise operation produces a value @@ -158,7 +158,7 @@ LL | let _ = 5 ^ val; | +++++++ warning: unused bitwise operation that must be used - --> $DIR/must-use-ops.rs:38:5 + --> $DIR/must-use-ops.rs:37:5 | LL | 5 & val; | ^^^^^^^ the bitwise operation produces a value @@ -169,7 +169,7 @@ LL | let _ = 5 & val; | +++++++ warning: unused bitwise operation that must be used - --> $DIR/must-use-ops.rs:39:5 + --> $DIR/must-use-ops.rs:38:5 | LL | 5 | val; | ^^^^^^^ the bitwise operation produces a value @@ -180,7 +180,7 @@ LL | let _ = 5 | val; | +++++++ warning: unused bitwise operation that must be used - --> $DIR/must-use-ops.rs:40:5 + --> $DIR/must-use-ops.rs:39:5 | LL | 5 << val; | ^^^^^^^^ the bitwise operation produces a value @@ -191,7 +191,7 @@ LL | let _ = 5 << val; | +++++++ warning: unused bitwise operation that must be used - --> $DIR/must-use-ops.rs:41:5 + --> $DIR/must-use-ops.rs:40:5 | LL | 5 >> val; | ^^^^^^^^ the bitwise operation produces a value @@ -202,7 +202,7 @@ LL | let _ = 5 >> val; | +++++++ warning: unused unary operation that must be used - --> $DIR/must-use-ops.rs:44:5 + --> $DIR/must-use-ops.rs:43:5 | LL | !val; | ^^^^ the unary operation produces a value @@ -213,7 +213,7 @@ LL | let _ = !val; | +++++++ warning: unused unary operation that must be used - --> $DIR/must-use-ops.rs:45:5 + --> $DIR/must-use-ops.rs:44:5 | LL | -val; | ^^^^ the unary operation produces a value @@ -224,7 +224,7 @@ LL | let _ = -val; | +++++++ warning: unused unary operation that must be used - --> $DIR/must-use-ops.rs:46:5 + --> $DIR/must-use-ops.rs:45:5 | LL | *val_pointer; | ^^^^^^^^^^^^ the unary operation produces a value diff --git a/tests/ui/lint/unused/must_use-result-unit-uninhabited.stderr b/tests/ui/lint/unused/must_use-result-unit-uninhabited.stderr index 31d6f6bcf2bc7..eee42d474eac9 100644 --- a/tests/ui/lint/unused/must_use-result-unit-uninhabited.stderr +++ b/tests/ui/lint/unused/must_use-result-unit-uninhabited.stderr @@ -1,5 +1,5 @@ error: unused `Result` that must be used - --> $DIR/must_use-result-unit-uninhabited.rs:80:5 + --> $DIR/must_use-result-unit-uninhabited.rs:79:5 | LL | result_unit_unit(); | ^^^^^^^^^^^^^^^^^^ @@ -16,7 +16,7 @@ LL | let _ = result_unit_unit(); | +++++++ error: unused `Result` that must be used - --> $DIR/must_use-result-unit-uninhabited.rs:84:5 + --> $DIR/must_use-result-unit-uninhabited.rs:83:5 | LL | result_unit_myuninhabited_nonexhaustive(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -28,7 +28,7 @@ LL | let _ = result_unit_myuninhabited_nonexhaustive(); | +++++++ error: unused `Result` that must be used - --> $DIR/must_use-result-unit-uninhabited.rs:86:5 + --> $DIR/must_use-result-unit-uninhabited.rs:85:5 | LL | result_unit_assoctype(S2); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -40,7 +40,7 @@ LL | let _ = result_unit_assoctype(S2); | +++++++ error: unused `Result` that must be used - --> $DIR/must_use-result-unit-uninhabited.rs:88:5 + --> $DIR/must_use-result-unit-uninhabited.rs:87:5 | LL | S2.method_use_assoc_type(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -52,7 +52,7 @@ LL | let _ = S2.method_use_assoc_type(); | +++++++ error: unused `ControlFlow` that must be used - --> $DIR/must_use-result-unit-uninhabited.rs:90:5 + --> $DIR/must_use-result-unit-uninhabited.rs:89:5 | LL | controlflow_unit(); | ^^^^^^^^^^^^^^^^^^ @@ -63,7 +63,7 @@ LL | let _ = controlflow_unit(); | +++++++ error: unused `Result` that must be used - --> $DIR/must_use-result-unit-uninhabited.rs:99:9 + --> $DIR/must_use-result-unit-uninhabited.rs:98:9 | LL | self.generate(); | ^^^^^^^^^^^^^^^ diff --git a/tests/ui/lint/unused/must_use-unit.stderr b/tests/ui/lint/unused/must_use-unit.stderr index 993a19e5f04ed..b6e365a468173 100644 --- a/tests/ui/lint/unused/must_use-unit.stderr +++ b/tests/ui/lint/unused/must_use-unit.stderr @@ -1,11 +1,11 @@ error: unused return value of `foo` that must be used - --> $DIR/must_use-unit.rs:13:5 + --> $DIR/must_use-unit.rs:12:5 | LL | foo(); | ^^^^^ | note: the lint level is defined here - --> $DIR/must_use-unit.rs:2:9 + --> $DIR/must_use-unit.rs:1:9 | LL | #![deny(unused_must_use)] | ^^^^^^^^^^^^^^^ @@ -15,7 +15,7 @@ LL | let _ = foo(); | +++++++ error: unused return value of `bar` that must be used - --> $DIR/must_use-unit.rs:15:5 + --> $DIR/must_use-unit.rs:14:5 | LL | bar(); | ^^^^^ diff --git a/tests/ui/loops/loop-break-never-type-mismatch.stderr b/tests/ui/loops/loop-break-never-type-mismatch.stderr index e6868f375e28d..684eee7d0245a 100644 --- a/tests/ui/loops/loop-break-never-type-mismatch.stderr +++ b/tests/ui/loops/loop-break-never-type-mismatch.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/loop-break-never-type-mismatch.rs:17:26 + --> $DIR/loop-break-never-type-mismatch.rs:15:26 | LL | fn loop_break_break() -> i32 { | ---------------- ^^^ expected `i32`, found `()` @@ -7,7 +7,7 @@ LL | fn loop_break_break() -> i32 { | implicitly returns `()` as its body has no tail or `return` expression error[E0308]: mismatched types - --> $DIR/loop-break-never-type-mismatch.rs:39:25 + --> $DIR/loop-break-never-type-mismatch.rs:37:25 | LL | fn loop_break_void() -> i32 { | --------------- ^^^ expected `i32`, found `()` diff --git a/tests/ui/loops/loop-break-value.stderr b/tests/ui/loops/loop-break-value.stderr index 8810d16ca5986..432f6be699cbf 100644 --- a/tests/ui/loops/loop-break-value.stderr +++ b/tests/ui/loops/loop-break-value.stderr @@ -1,5 +1,5 @@ warning: label name `'a` shadows a label name that is already in scope - --> $DIR/loop-break-value.rs:140:17 + --> $DIR/loop-break-value.rs:138:17 | LL | 'a: loop { | -- first declared here @@ -8,7 +8,7 @@ LL | let _ = 'a: loop { | ^^ label `'a` already in scope warning: label name `'a` shadows a label name that is already in scope - --> $DIR/loop-break-value.rs:152:17 + --> $DIR/loop-break-value.rs:150:17 | LL | 'a: loop { | -- first declared here @@ -17,7 +17,7 @@ LL | let _ = 'a: loop { | ^^ label `'a` already in scope error[E0425]: cannot find value `LOOP` in this scope - --> $DIR/loop-break-value.rs:99:15 + --> $DIR/loop-break-value.rs:97:15 | LL | 'LOOP: for _ in 0 .. 9 { | ----- a label with a similar name exists @@ -28,7 +28,7 @@ LL | break LOOP; | help: use the similarly named label: `'LOOP` warning: denote infinite loops with `loop { ... }` - --> $DIR/loop-break-value.rs:30:5 + --> $DIR/loop-break-value.rs:28:5 | LL | 'while_loop: while true { | ^^^^^^^^^^^^^^^^^^^^^^^ help: use `loop` @@ -36,7 +36,7 @@ LL | 'while_loop: while true { = note: `#[warn(while_true)]` on by default error[E0571]: `break` with value from a `while` loop - --> $DIR/loop-break-value.rs:32:9 + --> $DIR/loop-break-value.rs:30:9 | LL | 'while_loop: while true { | ----------------------- you can't `break` with a value in a `while` loop @@ -56,7 +56,7 @@ LL + break 'while_loop; | error[E0571]: `break` with value from a `while` loop - --> $DIR/loop-break-value.rs:34:13 + --> $DIR/loop-break-value.rs:32:13 | LL | 'while_loop: while true { | ----------------------- you can't `break` with a value in a `while` loop @@ -71,7 +71,7 @@ LL + break 'while_loop; | error[E0571]: `break` with value from a `while` loop - --> $DIR/loop-break-value.rs:42:12 + --> $DIR/loop-break-value.rs:40:12 | LL | while let Some(_) = Some(()) { | ---------------------------- you can't `break` with a value in a `while` loop @@ -85,7 +85,7 @@ LL + if break { | error[E0571]: `break` with value from a `while` loop - --> $DIR/loop-break-value.rs:47:9 + --> $DIR/loop-break-value.rs:45:9 | LL | while let Some(_) = Some(()) { | ---------------------------- you can't `break` with a value in a `while` loop @@ -99,7 +99,7 @@ LL + break; | error[E0571]: `break` with value from a `while` loop - --> $DIR/loop-break-value.rs:53:13 + --> $DIR/loop-break-value.rs:51:13 | LL | 'while_let_loop: while let Some(_) = Some(()) { | --------------------------------------------- you can't `break` with a value in a `while` loop @@ -114,7 +114,7 @@ LL + break 'while_let_loop; | error[E0571]: `break` with value from a `for` loop - --> $DIR/loop-break-value.rs:60:9 + --> $DIR/loop-break-value.rs:58:9 | LL | for _ in &[1,2,3] { | ----------------- you can't `break` with a value in a `for` loop @@ -128,7 +128,7 @@ LL + break; | error[E0571]: `break` with value from a `for` loop - --> $DIR/loop-break-value.rs:61:9 + --> $DIR/loop-break-value.rs:59:9 | LL | for _ in &[1,2,3] { | ----------------- you can't `break` with a value in a `for` loop @@ -143,7 +143,7 @@ LL + break; | error[E0571]: `break` with value from a `for` loop - --> $DIR/loop-break-value.rs:68:13 + --> $DIR/loop-break-value.rs:66:13 | LL | 'for_loop: for _ in &[1,2,3] { | ---------------------------- you can't `break` with a value in a `for` loop @@ -158,7 +158,7 @@ LL + break 'for_loop; | error[E0308]: mismatched types - --> $DIR/loop-break-value.rs:4:31 + --> $DIR/loop-break-value.rs:2:31 | LL | let val: ! = loop { break break; }; | --- ---- ^^^^^ expected `!`, found `()` @@ -170,7 +170,7 @@ LL | let val: ! = loop { break break; }; found unit type `()` error[E0308]: mismatched types - --> $DIR/loop-break-value.rs:11:19 + --> $DIR/loop-break-value.rs:9:19 | LL | break "asdf"; | ------------ expected because of this `break` @@ -179,7 +179,7 @@ LL | break 123; | ^^^ expected `&str`, found integer error[E0308]: mismatched types - --> $DIR/loop-break-value.rs:16:15 + --> $DIR/loop-break-value.rs:14:15 | LL | let _: i32 = loop { | - ---- this loop is expected to be of type `i32` @@ -189,7 +189,7 @@ LL | break "asdf"; | ^^^^^^ expected `i32`, found `&str` error[E0308]: mismatched types - --> $DIR/loop-break-value.rs:21:31 + --> $DIR/loop-break-value.rs:19:31 | LL | let _: i32 = 'outer_loop: loop { | - ---- this loop is expected to be of type `i32` @@ -200,7 +200,7 @@ LL | break 'outer_loop "nope"; | ^^^^^^ expected `i32`, found `&str` error[E0308]: mismatched types - --> $DIR/loop-break-value.rs:27:9 + --> $DIR/loop-break-value.rs:25:9 | LL | let _: Option = loop { | - ---- this loop is expected to be of type `Option` @@ -217,7 +217,7 @@ LL | break None; | ++++ error[E0308]: mismatched types - --> $DIR/loop-break-value.rs:77:26 + --> $DIR/loop-break-value.rs:75:26 | LL | break; | ----- expected because of this `break` @@ -225,7 +225,7 @@ LL | break 'c 123; | ^^^ expected `()`, found integer error[E0308]: mismatched types - --> $DIR/loop-break-value.rs:84:15 + --> $DIR/loop-break-value.rs:82:15 | LL | break (break, break); | ^-----^^-----^ @@ -238,7 +238,7 @@ LL | break (break, break); found tuple `(_, _)` error[E0308]: mismatched types - --> $DIR/loop-break-value.rs:89:15 + --> $DIR/loop-break-value.rs:87:15 | LL | break; | ----- expected because of this `break` @@ -246,7 +246,7 @@ LL | break 2; | ^ expected `()`, found integer error[E0308]: mismatched types - --> $DIR/loop-break-value.rs:94:9 + --> $DIR/loop-break-value.rs:92:9 | LL | break 2; | ------- expected because of this `break` @@ -259,7 +259,7 @@ LL | break /* value */; | +++++++++++ error[E0308]: mismatched types - --> $DIR/loop-break-value.rs:112:9 + --> $DIR/loop-break-value.rs:110:9 | LL | break 'a 1; | ---------- expected because of this `break` @@ -273,7 +273,7 @@ LL | break /* value */; | +++++++++++ error[E0308]: mismatched types - --> $DIR/loop-break-value.rs:124:9 + --> $DIR/loop-break-value.rs:122:9 | LL | break 'a 1; | ---------- expected because of this `break` @@ -287,7 +287,7 @@ LL | break 'a /* value */; | +++++++++++ error[E0308]: mismatched types - --> $DIR/loop-break-value.rs:135:15 + --> $DIR/loop-break-value.rs:133:15 | LL | break; | ----- expected because of this `break` @@ -296,7 +296,7 @@ LL | break 2; | ^ expected `()`, found integer error[E0308]: mismatched types - --> $DIR/loop-break-value.rs:144:17 + --> $DIR/loop-break-value.rs:142:17 | LL | break 2; | ------- expected because of this `break` @@ -310,7 +310,7 @@ LL | break 'a /* value */; | +++++++++++ error[E0308]: mismatched types - --> $DIR/loop-break-value.rs:147:15 + --> $DIR/loop-break-value.rs:145:15 | LL | break; | ----- expected because of this `break` @@ -319,7 +319,7 @@ LL | break 2; | ^ expected `()`, found integer error[E0308]: mismatched types - --> $DIR/loop-break-value.rs:156:17 + --> $DIR/loop-break-value.rs:154:17 | LL | break 'a 2; | ---------- expected because of this `break` @@ -333,7 +333,7 @@ LL | break 'a /* value */; | +++++++++++ error[E0308]: mismatched types - --> $DIR/loop-break-value.rs:159:15 + --> $DIR/loop-break-value.rs:157:15 | LL | break; | ----- expected because of this `break` @@ -342,7 +342,7 @@ LL | break 2; | ^ expected `()`, found integer error[E0308]: mismatched types - --> $DIR/loop-break-value.rs:163:15 + --> $DIR/loop-break-value.rs:161:15 | LL | fn main() { | - expected `()` because of this return type diff --git a/tests/ui/never_type/basic/call-fn-never-arg-wrong-type.stderr b/tests/ui/never_type/basic/call-fn-never-arg-wrong-type.stderr index bdeb2fb906c78..bd5526c8c10c1 100644 --- a/tests/ui/never_type/basic/call-fn-never-arg-wrong-type.stderr +++ b/tests/ui/never_type/basic/call-fn-never-arg-wrong-type.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/call-fn-never-arg-wrong-type.rs:10:9 + --> $DIR/call-fn-never-arg-wrong-type.rs:8:9 | LL | foo("wow"); | --- ^^^^^ expected `!`, found `&str` @@ -9,7 +9,7 @@ LL | foo("wow"); = note: expected type `!` found reference `&'static str` note: function defined here - --> $DIR/call-fn-never-arg-wrong-type.rs:5:4 + --> $DIR/call-fn-never-arg-wrong-type.rs:3:4 | LL | fn foo(x: !) -> ! { | ^^^ ---- diff --git a/tests/ui/never_type/basic/never-assign-wrong-type.stderr b/tests/ui/never_type/basic/never-assign-wrong-type.stderr index dd890e4d163b3..c3d3bdd0f0f61 100644 --- a/tests/ui/never_type/basic/never-assign-wrong-type.stderr +++ b/tests/ui/never_type/basic/never-assign-wrong-type.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/never-assign-wrong-type.rs:6:16 + --> $DIR/never-assign-wrong-type.rs:4:16 | LL | let x: ! = "hello"; | - ^^^^^^^ expected `!`, found `&str` diff --git a/tests/ui/never_type/diverging-place-match.stderr b/tests/ui/never_type/diverging-place-match.stderr index 14300c4df05e4..1bffc97a42a72 100644 --- a/tests/ui/never_type/diverging-place-match.stderr +++ b/tests/ui/never_type/diverging-place-match.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/diverging-place-match.rs:4:5 + --> $DIR/diverging-place-match.rs:2:5 | LL | / unsafe { LL | | @@ -13,7 +13,7 @@ LL | | } found unit type `()` error[E0308]: mismatched types - --> $DIR/diverging-place-match.rs:14:5 + --> $DIR/diverging-place-match.rs:12:5 | LL | / unsafe { LL | | @@ -26,7 +26,7 @@ LL | | } found unit type `()` error[E0308]: mismatched types - --> $DIR/diverging-place-match.rs:25:21 + --> $DIR/diverging-place-match.rs:23:21 | LL | let _: () = *x; | -- ^^ expected `()`, found `!` @@ -37,7 +37,7 @@ LL | let _: () = *x; found type `!` error[E0308]: mismatched types - --> $DIR/diverging-place-match.rs:22:5 + --> $DIR/diverging-place-match.rs:20:5 | LL | / unsafe { LL | | @@ -51,7 +51,7 @@ LL | | } found unit type `()` error[E0308]: mismatched types - --> $DIR/diverging-place-match.rs:31:5 + --> $DIR/diverging-place-match.rs:29:5 | LL | / unsafe { LL | | @@ -64,7 +64,7 @@ LL | | } found unit type `()` error[E0308]: mismatched types - --> $DIR/diverging-place-match.rs:39:5 + --> $DIR/diverging-place-match.rs:37:5 | LL | / unsafe { LL | | @@ -78,7 +78,7 @@ LL | | } found unit type `()` error[E0308]: mismatched types - --> $DIR/diverging-place-match.rs:51:18 + --> $DIR/diverging-place-match.rs:49:18 | LL | let (_ | 1i32) = *x; | ^^^^ -- this expression has type `!` @@ -89,7 +89,7 @@ LL | let (_ | 1i32) = *x; found type `i32` error[E0308]: mismatched types - --> $DIR/diverging-place-match.rs:48:5 + --> $DIR/diverging-place-match.rs:46:5 | LL | / unsafe { LL | | @@ -103,7 +103,7 @@ LL | | } found unit type `()` error[E0308]: mismatched types - --> $DIR/diverging-place-match.rs:61:14 + --> $DIR/diverging-place-match.rs:59:14 | LL | let (1i32 | _) = *x; | ^^^^ -- this expression has type `!` @@ -114,7 +114,7 @@ LL | let (1i32 | _) = *x; found type `i32` error[E0308]: mismatched types - --> $DIR/diverging-place-match.rs:58:5 + --> $DIR/diverging-place-match.rs:56:5 | LL | / unsafe { LL | | @@ -128,7 +128,7 @@ LL | | } found unit type `()` error[E0308]: mismatched types - --> $DIR/diverging-place-match.rs:69:26 + --> $DIR/diverging-place-match.rs:67:26 | LL | let ref _x: () = *x; | ^^ expected `()`, found `!` diff --git a/tests/ui/never_type/empty-never-array.stderr b/tests/ui/never_type/empty-never-array.stderr index cd8a80e3d49d7..72984027dfdad 100644 --- a/tests/ui/never_type/empty-never-array.stderr +++ b/tests/ui/never_type/empty-never-array.stderr @@ -1,5 +1,5 @@ error[E0005]: refutable pattern in local binding - --> $DIR/empty-never-array.rs:12:9 + --> $DIR/empty-never-array.rs:10:9 | LL | let Helper::U(u) = Helper::T(t, []); | ^^^^^^^^^^^^ pattern `Helper::T(_, _)` not covered @@ -7,7 +7,7 @@ LL | let Helper::U(u) = Helper::T(t, []); = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html note: `Helper` defined here - --> $DIR/empty-never-array.rs:5:6 + --> $DIR/empty-never-array.rs:3:6 | LL | enum Helper { | ^^^^^^ diff --git a/tests/ui/never_type/exhaustive_patterns.stderr b/tests/ui/never_type/exhaustive_patterns.stderr index f8b582d1b50bf..9738510fa177e 100644 --- a/tests/ui/never_type/exhaustive_patterns.stderr +++ b/tests/ui/never_type/exhaustive_patterns.stderr @@ -1,5 +1,5 @@ error[E0005]: refutable pattern in local binding - --> $DIR/exhaustive_patterns.rs:24:9 + --> $DIR/exhaustive_patterns.rs:22:9 | LL | let Either::A(()) = foo(); | ^^^^^^^^^^^^^ pattern `Either::B(_)` not covered @@ -7,7 +7,7 @@ LL | let Either::A(()) = foo(); = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html note: `Either<(), !>` defined here - --> $DIR/exhaustive_patterns.rs:12:6 + --> $DIR/exhaustive_patterns.rs:10:6 | LL | enum Either { | ^^^^^^ diff --git a/tests/ui/never_type/fallback_change/dependency-on-fallback-to-unit.stderr b/tests/ui/never_type/fallback_change/dependency-on-fallback-to-unit.stderr index bb9de45637a09..7f041260c03a8 100644 --- a/tests/ui/never_type/fallback_change/dependency-on-fallback-to-unit.stderr +++ b/tests/ui/never_type/fallback_change/dependency-on-fallback-to-unit.stderr @@ -1,85 +1,26 @@ -error: this function depends on never type fallback being `()` - --> $DIR/dependency-on-fallback-to-unit.rs:6:1 - | -LL | fn def() { - | ^^^^^^^^ - | - = help: specify the types explicitly -note: in edition 2024, the requirement `!: Default` will fail +error[E0277]: the trait bound `!: Default` is not satisfied --> $DIR/dependency-on-fallback-to-unit.rs:10:19 | LL | false => <_>::default(), - | ^ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see - = note: `#[deny(dependency_on_unit_never_type_fallback)]` (part of `#[deny(rust_2024_compatibility)]`) on by default -help: use `()` annotations to avoid fallback changes - | -LL - false => <_>::default(), -LL + false => <()>::default(), + | ^ the trait `Default` is not implemented for `!` | + = note: this error might have been caused by changes to Rust's type-inference algorithm (see issue #148922 for more information) + = help: you might have intended to use the type `()` here instead -error: this function depends on never type fallback being `()` - --> $DIR/dependency-on-fallback-to-unit.rs:17:1 - | -LL | fn question_mark() -> Result<(), ()> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: specify the types explicitly -note: in edition 2024, the requirement `!: Default` will fail +error[E0277]: the trait bound `!: Default` is not satisfied --> $DIR/dependency-on-fallback-to-unit.rs:20:5 | LL | deserialize()?; - | ^^^^^^^^^^^^^ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see -help: use `()` annotations to avoid fallback changes + | ^^^^^^^^^^^^^ the trait `Default` is not implemented for `!` | -LL | deserialize::<()>()?; - | ++++++ - -error: aborting due to 2 previous errors - -Future incompatibility report: Future breakage diagnostic: -error: this function depends on never type fallback being `()` - --> $DIR/dependency-on-fallback-to-unit.rs:6:1 - | -LL | fn def() { - | ^^^^^^^^ - | - = help: specify the types explicitly -note: in edition 2024, the requirement `!: Default` will fail - --> $DIR/dependency-on-fallback-to-unit.rs:10:19 - | -LL | false => <_>::default(), - | ^ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see - = note: `#[deny(dependency_on_unit_never_type_fallback)]` (part of `#[deny(rust_2024_compatibility)]`) on by default -help: use `()` annotations to avoid fallback changes - | -LL - false => <_>::default(), -LL + false => <()>::default(), + = note: this error might have been caused by changes to Rust's type-inference algorithm (see issue #148922 for more information) + = help: you might have intended to use the type `()` here instead +note: required by a bound in `deserialize` + --> $DIR/dependency-on-fallback-to-unit.rs:24:19 | +LL | fn deserialize() -> Result { + | ^^^^^^^ required by this bound in `deserialize` -Future breakage diagnostic: -error: this function depends on never type fallback being `()` - --> $DIR/dependency-on-fallback-to-unit.rs:17:1 - | -LL | fn question_mark() -> Result<(), ()> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: specify the types explicitly -note: in edition 2024, the requirement `!: Default` will fail - --> $DIR/dependency-on-fallback-to-unit.rs:20:5 - | -LL | deserialize()?; - | ^^^^^^^^^^^^^ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see - = note: `#[deny(dependency_on_unit_never_type_fallback)]` (part of `#[deny(rust_2024_compatibility)]`) on by default -help: use `()` annotations to avoid fallback changes - | -LL | deserialize::<()>()?; - | ++++++ +error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/never_type/fallback_change/diverging-fallback-unconstrained-return.e2021.stderr b/tests/ui/never_type/fallback_change/diverging-fallback-unconstrained-return.e2021.stderr index 40e7e30274be8..d28f5d7de92f5 100644 --- a/tests/ui/never_type/fallback_change/diverging-fallback-unconstrained-return.e2021.stderr +++ b/tests/ui/never_type/fallback_change/diverging-fallback-unconstrained-return.e2021.stderr @@ -1,43 +1,24 @@ -error: this function depends on never type fallback being `()` - --> $DIR/diverging-fallback-unconstrained-return.rs:26:1 - | -LL | fn main() { - | ^^^^^^^^^ - | - = help: specify the types explicitly -note: in edition 2024, the requirement `!: UnitReturn` will fail +error[E0277]: the trait bound `!: UnitReturn` is not satisfied --> $DIR/diverging-fallback-unconstrained-return.rs:37:23 | LL | let _ = if true { unconstrained_return() } else { panic!() }; - | ^^^^^^^^^^^^^^^^^^^^^^ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see - = note: `#[deny(dependency_on_unit_never_type_fallback)]` (part of `#[deny(rust_2024_compatibility)]`) on by default -help: use `()` annotations to avoid fallback changes - | -LL | let _: () = if true { unconstrained_return() } else { panic!() }; - | ++++ + | ^^^^^^^^^^^^^^^^^^^^^^ the trait `UnitReturn` is not implemented for `!` + | +help: the following other types implement trait `UnitReturn` + --> $DIR/diverging-fallback-unconstrained-return.rs:15:1 + | +LL | impl UnitReturn for i32 {} + | ^^^^^^^^^^^^^^^^^^^^^^^ `i32` +LL | impl UnitReturn for () {} + | ^^^^^^^^^^^^^^^^^^^^^^ `()` + = note: this error might have been caused by changes to Rust's type-inference algorithm (see issue #148922 for more information) + = help: you might have intended to use the type `()` here instead +note: required by a bound in `unconstrained_return` + --> $DIR/diverging-fallback-unconstrained-return.rs:18:28 + | +LL | fn unconstrained_return() -> T { + | ^^^^^^^^^^ required by this bound in `unconstrained_return` error: aborting due to 1 previous error -Future incompatibility report: Future breakage diagnostic: -error: this function depends on never type fallback being `()` - --> $DIR/diverging-fallback-unconstrained-return.rs:26:1 - | -LL | fn main() { - | ^^^^^^^^^ - | - = help: specify the types explicitly -note: in edition 2024, the requirement `!: UnitReturn` will fail - --> $DIR/diverging-fallback-unconstrained-return.rs:37:23 - | -LL | let _ = if true { unconstrained_return() } else { panic!() }; - | ^^^^^^^^^^^^^^^^^^^^^^ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see - = note: `#[deny(dependency_on_unit_never_type_fallback)]` (part of `#[deny(rust_2024_compatibility)]`) on by default -help: use `()` annotations to avoid fallback changes - | -LL | let _: () = if true { unconstrained_return() } else { panic!() }; - | ++++ - +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/never_type/fallback_change/dont-suggest-turbofish-from-expansion.stderr b/tests/ui/never_type/fallback_change/dont-suggest-turbofish-from-expansion.stderr index 73c2a5bd3907e..48a84f5c70314 100644 --- a/tests/ui/never_type/fallback_change/dont-suggest-turbofish-from-expansion.stderr +++ b/tests/ui/never_type/fallback_change/dont-suggest-turbofish-from-expansion.stderr @@ -1,43 +1,20 @@ -error: this function depends on never type fallback being `()` - --> $DIR/dont-suggest-turbofish-from-expansion.rs:8:1 - | -LL | fn main() -> Result<(), ()> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: specify the types explicitly -note: in edition 2024, the requirement `!: Default` will fail +error[E0277]: the trait bound `!: Default` is not satisfied --> $DIR/dont-suggest-turbofish-from-expansion.rs:12:23 | LL | let created = create_ok_default()?; - | ^^^^^^^^^^^^^^^^^^^ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see - = note: `#[deny(dependency_on_unit_never_type_fallback)]` (part of `#[deny(rust_2024_compatibility)]`) on by default -help: use `()` annotations to avoid fallback changes - | -LL | let created: () = create_ok_default()?; - | ++++ + | ^^^^^^^^^^^^^^^^^^^ the trait `Default` is not implemented for `!` + | + = note: this error might have been caused by changes to Rust's type-inference algorithm (see issue #148922 for more information) + = help: you might have intended to use the type `()` here instead +note: required by a bound in `create_ok_default` + --> $DIR/dont-suggest-turbofish-from-expansion.rs:3:8 + | +LL | fn create_ok_default() -> Result + | ----------------- required by a bound in this function +LL | where +LL | C: Default, + | ^^^^^^^ required by this bound in `create_ok_default` error: aborting due to 1 previous error -Future incompatibility report: Future breakage diagnostic: -error: this function depends on never type fallback being `()` - --> $DIR/dont-suggest-turbofish-from-expansion.rs:8:1 - | -LL | fn main() -> Result<(), ()> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: specify the types explicitly -note: in edition 2024, the requirement `!: Default` will fail - --> $DIR/dont-suggest-turbofish-from-expansion.rs:12:23 - | -LL | let created = create_ok_default()?; - | ^^^^^^^^^^^^^^^^^^^ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see - = note: `#[deny(dependency_on_unit_never_type_fallback)]` (part of `#[deny(rust_2024_compatibility)]`) on by default -help: use `()` annotations to avoid fallback changes - | -LL | let created: () = create_ok_default()?; - | ++++ - +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/never_type/fallback_change/from_infer_breaking_with_unit_fallback.rs b/tests/ui/never_type/fallback_change/from_infer_breaking_with_unit_fallback.rs index 970c642514b23..a13e52966973d 100644 --- a/tests/ui/never_type/fallback_change/from_infer_breaking_with_unit_fallback.rs +++ b/tests/ui/never_type/fallback_change/from_infer_breaking_with_unit_fallback.rs @@ -7,7 +7,7 @@ //@ revisions: unit never //@[never] check-pass #![allow(internal_features)] -#![feature(rustc_attrs, never_type)] +#![feature(rustc_attrs)] #![cfg_attr(unit, rustc_never_type_options(fallback = "unit"))] #![cfg_attr(never, rustc_never_type_options(fallback = "never"))] diff --git a/tests/ui/never_type/fallback_change/lint-breaking-2024-assign-underscore.fixed b/tests/ui/never_type/fallback_change/lint-breaking-2024-assign-underscore.fixed index b235c6e4eb464..14d88503e85f0 100644 --- a/tests/ui/never_type/fallback_change/lint-breaking-2024-assign-underscore.fixed +++ b/tests/ui/never_type/fallback_change/lint-breaking-2024-assign-underscore.fixed @@ -8,7 +8,7 @@ fn foo() -> Result { fn test() -> Result<(), ()> { //~^ ERROR this function depends on never type fallback being `()` //~| WARN this was previously accepted by the compiler but is being phased out - _ = foo::<()>()?; + _ = foo()?; Ok(()) } diff --git a/tests/ui/never_type/fallback_change/lint-breaking-2024-assign-underscore.stderr b/tests/ui/never_type/fallback_change/lint-breaking-2024-assign-underscore.stderr index a0a300aae6af7..f14846d2afc9e 100644 --- a/tests/ui/never_type/fallback_change/lint-breaking-2024-assign-underscore.stderr +++ b/tests/ui/never_type/fallback_change/lint-breaking-2024-assign-underscore.stderr @@ -1,43 +1,17 @@ -error: this function depends on never type fallback being `()` - --> $DIR/lint-breaking-2024-assign-underscore.rs:8:1 - | -LL | fn test() -> Result<(), ()> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: specify the types explicitly -note: in edition 2024, the requirement `!: Default` will fail +error[E0277]: the trait bound `!: Default` is not satisfied --> $DIR/lint-breaking-2024-assign-underscore.rs:11:9 | LL | _ = foo()?; - | ^^^^^ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see - = note: `#[deny(dependency_on_unit_never_type_fallback)]` (part of `#[deny(rust_2024_compatibility)]`) on by default -help: use `()` annotations to avoid fallback changes + | ^^^^^ the trait `Default` is not implemented for `!` + | + = note: this error might have been caused by changes to Rust's type-inference algorithm (see issue #148922 for more information) + = help: you might have intended to use the type `()` here instead +note: required by a bound in `foo` + --> $DIR/lint-breaking-2024-assign-underscore.rs:4:11 | -LL | _ = foo::<()>()?; - | ++++++ +LL | fn foo() -> Result { + | ^^^^^^^ required by this bound in `foo` error: aborting due to 1 previous error -Future incompatibility report: Future breakage diagnostic: -error: this function depends on never type fallback being `()` - --> $DIR/lint-breaking-2024-assign-underscore.rs:8:1 - | -LL | fn test() -> Result<(), ()> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: specify the types explicitly -note: in edition 2024, the requirement `!: Default` will fail - --> $DIR/lint-breaking-2024-assign-underscore.rs:11:9 - | -LL | _ = foo()?; - | ^^^^^ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see - = note: `#[deny(dependency_on_unit_never_type_fallback)]` (part of `#[deny(rust_2024_compatibility)]`) on by default -help: use `()` annotations to avoid fallback changes - | -LL | _ = foo::<()>()?; - | ++++++ - +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/never_type/fallback_change/lint-never-type-fallback-flowing-into-unsafe.e2015.stderr b/tests/ui/never_type/fallback_change/lint-never-type-fallback-flowing-into-unsafe.e2015.stderr index 730e449704859..631b6dae92942 100644 --- a/tests/ui/never_type/fallback_change/lint-never-type-fallback-flowing-into-unsafe.e2015.stderr +++ b/tests/ui/never_type/fallback_change/lint-never-type-fallback-flowing-into-unsafe.e2015.stderr @@ -131,7 +131,16 @@ LL | msg_send!(); = note: for more information, see = note: this error originates in the macro `msg_send` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to 10 previous errors +warning: the type `!` does not permit zero-initialization + --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:10:18 + | +LL | unsafe { mem::zeroed() } + | ^^^^^^^^^^^^^ this code causes undefined behavior when executed + | + = note: the `!` type has no valid value + = note: `#[warn(invalid_value)]` on by default + +error: aborting due to 10 previous errors; 1 warning emitted Future incompatibility report: Future breakage diagnostic: error: never type fallback affects this call to an `unsafe` function diff --git a/tests/ui/never_type/fallback_change/question_mark_from_never.rs b/tests/ui/never_type/fallback_change/question_mark_from_never.rs index 8f5862a2a0ea2..1685b66b538ee 100644 --- a/tests/ui/never_type/fallback_change/question_mark_from_never.rs +++ b/tests/ui/never_type/fallback_change/question_mark_from_never.rs @@ -5,7 +5,7 @@ //@ revisions: unit never //@ check-pass #![allow(internal_features)] -#![feature(rustc_attrs, never_type)] +#![feature(rustc_attrs)] #![cfg_attr(unit, rustc_never_type_options(fallback = "unit"))] #![cfg_attr(never, rustc_never_type_options(fallback = "never"))] diff --git a/tests/ui/never_type/never-from-impl-is-reserved.current.stderr b/tests/ui/never_type/never-from-impl-is-reserved.current.stderr index 7868206950c34..dd001bf70c164 100644 --- a/tests/ui/never_type/never-from-impl-is-reserved.current.stderr +++ b/tests/ui/never_type/never-from-impl-is-reserved.current.stderr @@ -1,5 +1,5 @@ error[E0119]: conflicting implementations of trait `MyTrait` for type `MyFoo` - --> $DIR/never-from-impl-is-reserved.rs:14:1 + --> $DIR/never-from-impl-is-reserved.rs:12:1 | LL | impl MyTrait for MyFoo {} | ---------------------- first implementation here diff --git a/tests/ui/never_type/never-from-impl-is-reserved.next.stderr b/tests/ui/never_type/never-from-impl-is-reserved.next.stderr index 7868206950c34..dd001bf70c164 100644 --- a/tests/ui/never_type/never-from-impl-is-reserved.next.stderr +++ b/tests/ui/never_type/never-from-impl-is-reserved.next.stderr @@ -1,5 +1,5 @@ error[E0119]: conflicting implementations of trait `MyTrait` for type `MyFoo` - --> $DIR/never-from-impl-is-reserved.rs:14:1 + --> $DIR/never-from-impl-is-reserved.rs:12:1 | LL | impl MyTrait for MyFoo {} | ---------------------- first implementation here diff --git a/tests/ui/never_type/regress/never-in-range-pat.stderr b/tests/ui/never_type/regress/never-in-range-pat.stderr index c78be5350e0f0..977f486f598b7 100644 --- a/tests/ui/never_type/regress/never-in-range-pat.stderr +++ b/tests/ui/never_type/regress/never-in-range-pat.stderr @@ -1,5 +1,5 @@ error[E0029]: only `char` and numeric types are allowed in range patterns - --> $DIR/never-in-range-pat.rs:13:12 + --> $DIR/never-in-range-pat.rs:11:12 | LL | 0..x => {} | - ^ this is of type `!` but it should be `char` or numeric diff --git a/tests/ui/never_type/regress/span-bug-issue-121445.stderr b/tests/ui/never_type/regress/span-bug-issue-121445.stderr index 8c8bc133433a7..b211afa236fef 100644 --- a/tests/ui/never_type/regress/span-bug-issue-121445.stderr +++ b/tests/ui/never_type/regress/span-bug-issue-121445.stderr @@ -1,5 +1,5 @@ error[E0369]: no implementation for `SingleVariant | ()` - --> $DIR/span-bug-issue-121445.rs:8:9 + --> $DIR/span-bug-issue-121445.rs:6:9 | LL | let c2 = SingleVariant::Points(0) | ------------------------ SingleVariant @@ -10,7 +10,7 @@ LL | | }; | |_________- () | note: an implementation of `BitOr<()>` might be missing for `SingleVariant` - --> $DIR/span-bug-issue-121445.rs:13:1 + --> $DIR/span-bug-issue-121445.rs:11:1 | LL | enum SingleVariant { | ^^^^^^^^^^^^^^^^^^ must implement `BitOr<()>` diff --git a/tests/ui/parser/diagnostics-parenthesized-type-arguments-ice-issue-122345.rs b/tests/ui/parser/diagnostics-parenthesized-type-arguments-ice-issue-122345.rs index db25ce440893d..4a2ef8f9ac0f4 100644 --- a/tests/ui/parser/diagnostics-parenthesized-type-arguments-ice-issue-122345.rs +++ b/tests/ui/parser/diagnostics-parenthesized-type-arguments-ice-issue-122345.rs @@ -5,7 +5,6 @@ fn main() { dealloc(ptr2, Layout::(x: !)(1, 1)); //~ ERROR `Trait(...)` syntax does not support named parameters //~^ ERROR cannot find function `dealloc` in this scope [E0425] //~| ERROR cannot find value `ptr2` in this scope [E0425] - //~| ERROR the `!` type is experimental [E0658] //~| ERROR cannot find function, tuple struct or tuple variant `Layout` in this scope [E0425] } } diff --git a/tests/ui/parser/diagnostics-parenthesized-type-arguments-ice-issue-122345.stderr b/tests/ui/parser/diagnostics-parenthesized-type-arguments-ice-issue-122345.stderr index a083883af219f..23a0e36dc9f2b 100644 --- a/tests/ui/parser/diagnostics-parenthesized-type-arguments-ice-issue-122345.stderr +++ b/tests/ui/parser/diagnostics-parenthesized-type-arguments-ice-issue-122345.stderr @@ -21,23 +21,12 @@ error[E0425]: cannot find value `ptr2` in this scope LL | dealloc(ptr2, Layout::(x: !)(1, 1)); | ^^^^ not found in this scope -error[E0658]: the `!` type is experimental - --> $DIR/diagnostics-parenthesized-type-arguments-ice-issue-122345.rs:5:35 - | -LL | dealloc(ptr2, Layout::(x: !)(1, 1)); - | ^ - | - = note: see issue #35121 for more information - = help: add `#![feature(never_type)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - error[E0425]: cannot find function, tuple struct or tuple variant `Layout` in this scope --> $DIR/diagnostics-parenthesized-type-arguments-ice-issue-122345.rs:5:23 | LL | dealloc(ptr2, Layout::(x: !)(1, 1)); | ^^^^^^ not found in this scope -error: aborting due to 5 previous errors +error: aborting due to 4 previous errors -Some errors have detailed explanations: E0425, E0658. -For more information about an error, try `rustc --explain E0425`. +For more information about this error, try `rustc --explain E0425`. diff --git a/tests/ui/pattern/usefulness/always-inhabited-union-ref.exhaustive_patterns.stderr b/tests/ui/pattern/usefulness/always-inhabited-union-ref.exhaustive_patterns.stderr index bc74069b3e774..cd5c283f9fd93 100644 --- a/tests/ui/pattern/usefulness/always-inhabited-union-ref.exhaustive_patterns.stderr +++ b/tests/ui/pattern/usefulness/always-inhabited-union-ref.exhaustive_patterns.stderr @@ -1,5 +1,5 @@ error[E0004]: non-exhaustive patterns: type `&!` is non-empty - --> $DIR/always-inhabited-union-ref.rs:24:11 + --> $DIR/always-inhabited-union-ref.rs:23:11 | LL | match uninhab_ref() { | ^^^^^^^^^^^^^ @@ -14,13 +14,13 @@ LL + } | error[E0004]: non-exhaustive patterns: type `Foo` is non-empty - --> $DIR/always-inhabited-union-ref.rs:28:11 + --> $DIR/always-inhabited-union-ref.rs:27:11 | LL | match uninhab_union() { | ^^^^^^^^^^^^^^^ | note: `Foo` defined here - --> $DIR/always-inhabited-union-ref.rs:11:11 + --> $DIR/always-inhabited-union-ref.rs:10:11 | LL | pub union Foo { | ^^^ diff --git a/tests/ui/pattern/usefulness/always-inhabited-union-ref.normal.stderr b/tests/ui/pattern/usefulness/always-inhabited-union-ref.normal.stderr index bc74069b3e774..cd5c283f9fd93 100644 --- a/tests/ui/pattern/usefulness/always-inhabited-union-ref.normal.stderr +++ b/tests/ui/pattern/usefulness/always-inhabited-union-ref.normal.stderr @@ -1,5 +1,5 @@ error[E0004]: non-exhaustive patterns: type `&!` is non-empty - --> $DIR/always-inhabited-union-ref.rs:24:11 + --> $DIR/always-inhabited-union-ref.rs:23:11 | LL | match uninhab_ref() { | ^^^^^^^^^^^^^ @@ -14,13 +14,13 @@ LL + } | error[E0004]: non-exhaustive patterns: type `Foo` is non-empty - --> $DIR/always-inhabited-union-ref.rs:28:11 + --> $DIR/always-inhabited-union-ref.rs:27:11 | LL | match uninhab_union() { | ^^^^^^^^^^^^^^^ | note: `Foo` defined here - --> $DIR/always-inhabited-union-ref.rs:11:11 + --> $DIR/always-inhabited-union-ref.rs:10:11 | LL | pub union Foo { | ^^^ diff --git a/tests/ui/pattern/usefulness/empty-match-check-notes.exhaustive_patterns.stderr b/tests/ui/pattern/usefulness/empty-match-check-notes.exhaustive_patterns.stderr index 4a435bcc8bad9..e72fdeeac3188 100644 --- a/tests/ui/pattern/usefulness/empty-match-check-notes.exhaustive_patterns.stderr +++ b/tests/ui/pattern/usefulness/empty-match-check-notes.exhaustive_patterns.stderr @@ -1,5 +1,5 @@ error: unreachable pattern - --> $DIR/empty-match-check-notes.rs:17:9 + --> $DIR/empty-match-check-notes.rs:16:9 | LL | _ => {} | ^------ @@ -9,13 +9,13 @@ LL | _ => {} | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types note: the lint level is defined here - --> $DIR/empty-match-check-notes.rs:7:9 + --> $DIR/empty-match-check-notes.rs:6:9 | LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ error: unreachable pattern - --> $DIR/empty-match-check-notes.rs:22:9 + --> $DIR/empty-match-check-notes.rs:21:9 | LL | _ if false => {} | ^--------------- @@ -26,7 +26,7 @@ LL | _ if false => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-match-check-notes.rs:31:9 + --> $DIR/empty-match-check-notes.rs:30:9 | LL | _ => {} | ^------ @@ -37,7 +37,7 @@ LL | _ => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-match-check-notes.rs:36:9 + --> $DIR/empty-match-check-notes.rs:35:9 | LL | _ if false => {} | ^--------------- @@ -48,7 +48,7 @@ LL | _ if false => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error[E0005]: refutable pattern in local binding - --> $DIR/empty-match-check-notes.rs:43:9 + --> $DIR/empty-match-check-notes.rs:42:9 | LL | let None = *x; | ^^^^ pattern `Some(_)` not covered @@ -63,7 +63,7 @@ LL | if let None = *x { todo!() }; | ++ +++++++++++ error[E0004]: non-exhaustive patterns: `0_u8..=u8::MAX` not covered - --> $DIR/empty-match-check-notes.rs:53:11 + --> $DIR/empty-match-check-notes.rs:52:11 | LL | match 0u8 { | ^^^ pattern `0_u8..=u8::MAX` not covered diff --git a/tests/ui/pattern/usefulness/empty-match-check-notes.normal.stderr b/tests/ui/pattern/usefulness/empty-match-check-notes.normal.stderr index 4a435bcc8bad9..e72fdeeac3188 100644 --- a/tests/ui/pattern/usefulness/empty-match-check-notes.normal.stderr +++ b/tests/ui/pattern/usefulness/empty-match-check-notes.normal.stderr @@ -1,5 +1,5 @@ error: unreachable pattern - --> $DIR/empty-match-check-notes.rs:17:9 + --> $DIR/empty-match-check-notes.rs:16:9 | LL | _ => {} | ^------ @@ -9,13 +9,13 @@ LL | _ => {} | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types note: the lint level is defined here - --> $DIR/empty-match-check-notes.rs:7:9 + --> $DIR/empty-match-check-notes.rs:6:9 | LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ error: unreachable pattern - --> $DIR/empty-match-check-notes.rs:22:9 + --> $DIR/empty-match-check-notes.rs:21:9 | LL | _ if false => {} | ^--------------- @@ -26,7 +26,7 @@ LL | _ if false => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-match-check-notes.rs:31:9 + --> $DIR/empty-match-check-notes.rs:30:9 | LL | _ => {} | ^------ @@ -37,7 +37,7 @@ LL | _ => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-match-check-notes.rs:36:9 + --> $DIR/empty-match-check-notes.rs:35:9 | LL | _ if false => {} | ^--------------- @@ -48,7 +48,7 @@ LL | _ if false => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error[E0005]: refutable pattern in local binding - --> $DIR/empty-match-check-notes.rs:43:9 + --> $DIR/empty-match-check-notes.rs:42:9 | LL | let None = *x; | ^^^^ pattern `Some(_)` not covered @@ -63,7 +63,7 @@ LL | if let None = *x { todo!() }; | ++ +++++++++++ error[E0004]: non-exhaustive patterns: `0_u8..=u8::MAX` not covered - --> $DIR/empty-match-check-notes.rs:53:11 + --> $DIR/empty-match-check-notes.rs:52:11 | LL | match 0u8 { | ^^^ pattern `0_u8..=u8::MAX` not covered diff --git a/tests/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr b/tests/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr index b649aa122b255..8becc8e7c7eec 100644 --- a/tests/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr +++ b/tests/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr @@ -1,5 +1,5 @@ error[E0004]: non-exhaustive patterns: type `u8` is non-empty - --> $DIR/empty-match.rs:47:20 + --> $DIR/empty-match.rs:46:20 | LL | match_no_arms!(0u8); | ^^^ @@ -8,7 +8,7 @@ LL | match_no_arms!(0u8); = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern error[E0004]: non-exhaustive patterns: type `i8` is non-empty - --> $DIR/empty-match.rs:48:20 + --> $DIR/empty-match.rs:47:20 | LL | match_no_arms!(0i8); | ^^^ @@ -17,7 +17,7 @@ LL | match_no_arms!(0i8); = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern error[E0004]: non-exhaustive patterns: type `usize` is non-empty - --> $DIR/empty-match.rs:49:20 + --> $DIR/empty-match.rs:48:20 | LL | match_no_arms!(0usize); | ^^^^^^ @@ -26,7 +26,7 @@ LL | match_no_arms!(0usize); = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern error[E0004]: non-exhaustive patterns: type `isize` is non-empty - --> $DIR/empty-match.rs:50:20 + --> $DIR/empty-match.rs:49:20 | LL | match_no_arms!(0isize); | ^^^^^^ @@ -35,13 +35,13 @@ LL | match_no_arms!(0isize); = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern error[E0004]: non-exhaustive patterns: type `NonEmptyStruct1` is non-empty - --> $DIR/empty-match.rs:51:20 + --> $DIR/empty-match.rs:50:20 | LL | match_no_arms!(NonEmptyStruct1); | ^^^^^^^^^^^^^^^ | note: `NonEmptyStruct1` defined here - --> $DIR/empty-match.rs:22:12 + --> $DIR/empty-match.rs:21:12 | LL | struct NonEmptyStruct1; | ^^^^^^^^^^^^^^^ @@ -49,13 +49,13 @@ LL | struct NonEmptyStruct1; = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern error[E0004]: non-exhaustive patterns: type `NonEmptyStruct2` is non-empty - --> $DIR/empty-match.rs:52:20 + --> $DIR/empty-match.rs:51:20 | LL | match_no_arms!(NonEmptyStruct2(true)); | ^^^^^^^^^^^^^^^^^^^^^ | note: `NonEmptyStruct2` defined here - --> $DIR/empty-match.rs:23:12 + --> $DIR/empty-match.rs:22:12 | LL | struct NonEmptyStruct2(bool); | ^^^^^^^^^^^^^^^ @@ -63,13 +63,13 @@ LL | struct NonEmptyStruct2(bool); = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern error[E0004]: non-exhaustive patterns: type `NonEmptyUnion1` is non-empty - --> $DIR/empty-match.rs:53:20 + --> $DIR/empty-match.rs:52:20 | LL | match_no_arms!((NonEmptyUnion1 { foo: () })); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: `NonEmptyUnion1` defined here - --> $DIR/empty-match.rs:24:11 + --> $DIR/empty-match.rs:23:11 | LL | union NonEmptyUnion1 { | ^^^^^^^^^^^^^^ @@ -77,13 +77,13 @@ LL | union NonEmptyUnion1 { = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern error[E0004]: non-exhaustive patterns: type `NonEmptyUnion2` is non-empty - --> $DIR/empty-match.rs:54:20 + --> $DIR/empty-match.rs:53:20 | LL | match_no_arms!((NonEmptyUnion2 { foo: () })); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: `NonEmptyUnion2` defined here - --> $DIR/empty-match.rs:27:11 + --> $DIR/empty-match.rs:26:11 | LL | union NonEmptyUnion2 { | ^^^^^^^^^^^^^^ @@ -91,13 +91,13 @@ LL | union NonEmptyUnion2 { = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern error[E0004]: non-exhaustive patterns: `NonEmptyEnum1::Foo(_)` not covered - --> $DIR/empty-match.rs:55:20 + --> $DIR/empty-match.rs:54:20 | LL | match_no_arms!(NonEmptyEnum1::Foo(true)); | ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyEnum1::Foo(_)` not covered | note: `NonEmptyEnum1` defined here - --> $DIR/empty-match.rs:31:10 + --> $DIR/empty-match.rs:30:10 | LL | enum NonEmptyEnum1 { | ^^^^^^^^^^^^^ @@ -107,13 +107,13 @@ LL | Foo(bool), = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern error[E0004]: non-exhaustive patterns: `NonEmptyEnum2::Foo(_)` and `NonEmptyEnum2::Bar` not covered - --> $DIR/empty-match.rs:56:20 + --> $DIR/empty-match.rs:55:20 | LL | match_no_arms!(NonEmptyEnum2::Foo(true)); | ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `NonEmptyEnum2::Foo(_)` and `NonEmptyEnum2::Bar` not covered | note: `NonEmptyEnum2` defined here - --> $DIR/empty-match.rs:34:10 + --> $DIR/empty-match.rs:33:10 | LL | enum NonEmptyEnum2 { | ^^^^^^^^^^^^^ @@ -125,13 +125,13 @@ LL | Bar, = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or multiple match arms error[E0004]: non-exhaustive patterns: `NonEmptyEnum5::V1`, `NonEmptyEnum5::V2`, `NonEmptyEnum5::V3` and 2 more not covered - --> $DIR/empty-match.rs:57:20 + --> $DIR/empty-match.rs:56:20 | LL | match_no_arms!(NonEmptyEnum5::V1); | ^^^^^^^^^^^^^^^^^ patterns `NonEmptyEnum5::V1`, `NonEmptyEnum5::V2`, `NonEmptyEnum5::V3` and 2 more not covered | note: `NonEmptyEnum5` defined here - --> $DIR/empty-match.rs:38:10 + --> $DIR/empty-match.rs:37:10 | LL | enum NonEmptyEnum5 { | ^^^^^^^^^^^^^ @@ -149,7 +149,7 @@ LL | V5, = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or multiple match arms error[E0004]: non-exhaustive patterns: type `[!; 0]` is non-empty - --> $DIR/empty-match.rs:58:20 + --> $DIR/empty-match.rs:57:20 | LL | match_no_arms!(array0_of_empty); | ^^^^^^^^^^^^^^^ @@ -158,7 +158,7 @@ LL | match_no_arms!(array0_of_empty); = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern error[E0004]: non-exhaustive patterns: type `[!; N]` is non-empty - --> $DIR/empty-match.rs:59:20 + --> $DIR/empty-match.rs:58:20 | LL | match_no_arms!(arrayN_of_empty); | ^^^^^^^^^^^^^^^ @@ -167,7 +167,7 @@ LL | match_no_arms!(arrayN_of_empty); = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern error[E0004]: non-exhaustive patterns: `0_u8..=u8::MAX` not covered - --> $DIR/empty-match.rs:61:24 + --> $DIR/empty-match.rs:60:24 | LL | match_guarded_arm!(0u8); | ^^^ pattern `0_u8..=u8::MAX` not covered @@ -181,7 +181,7 @@ LL + 0_u8..=u8::MAX => todo!() | error[E0004]: non-exhaustive patterns: `i8::MIN..=i8::MAX` not covered - --> $DIR/empty-match.rs:62:24 + --> $DIR/empty-match.rs:61:24 | LL | match_guarded_arm!(0i8); | ^^^ pattern `i8::MIN..=i8::MAX` not covered @@ -195,7 +195,7 @@ LL + i8::MIN..=i8::MAX => todo!() | error[E0004]: non-exhaustive patterns: `0_usize..` not covered - --> $DIR/empty-match.rs:63:24 + --> $DIR/empty-match.rs:62:24 | LL | match_guarded_arm!(0usize); | ^^^^^^ pattern `0_usize..` not covered @@ -209,7 +209,7 @@ LL + 0_usize.. => todo!() | error[E0004]: non-exhaustive patterns: `_` not covered - --> $DIR/empty-match.rs:64:24 + --> $DIR/empty-match.rs:63:24 | LL | match_guarded_arm!(0isize); | ^^^^^^ pattern `_` not covered @@ -223,13 +223,13 @@ LL + _ => todo!() | error[E0004]: non-exhaustive patterns: `NonEmptyStruct1` not covered - --> $DIR/empty-match.rs:65:24 + --> $DIR/empty-match.rs:64:24 | LL | match_guarded_arm!(NonEmptyStruct1); | ^^^^^^^^^^^^^^^ pattern `NonEmptyStruct1` not covered | note: `NonEmptyStruct1` defined here - --> $DIR/empty-match.rs:22:12 + --> $DIR/empty-match.rs:21:12 | LL | struct NonEmptyStruct1; | ^^^^^^^^^^^^^^^ @@ -242,13 +242,13 @@ LL + NonEmptyStruct1 => todo!() | error[E0004]: non-exhaustive patterns: `NonEmptyStruct2(_)` not covered - --> $DIR/empty-match.rs:66:24 + --> $DIR/empty-match.rs:65:24 | LL | match_guarded_arm!(NonEmptyStruct2(true)); | ^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyStruct2(_)` not covered | note: `NonEmptyStruct2` defined here - --> $DIR/empty-match.rs:23:12 + --> $DIR/empty-match.rs:22:12 | LL | struct NonEmptyStruct2(bool); | ^^^^^^^^^^^^^^^ @@ -261,13 +261,13 @@ LL + NonEmptyStruct2(_) => todo!() | error[E0004]: non-exhaustive patterns: `NonEmptyUnion1 { .. }` not covered - --> $DIR/empty-match.rs:67:24 + --> $DIR/empty-match.rs:66:24 | LL | match_guarded_arm!((NonEmptyUnion1 { foo: () })); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyUnion1 { .. }` not covered | note: `NonEmptyUnion1` defined here - --> $DIR/empty-match.rs:24:11 + --> $DIR/empty-match.rs:23:11 | LL | union NonEmptyUnion1 { | ^^^^^^^^^^^^^^ @@ -280,13 +280,13 @@ LL + NonEmptyUnion1 { .. } => todo!() | error[E0004]: non-exhaustive patterns: `NonEmptyUnion2 { .. }` not covered - --> $DIR/empty-match.rs:68:24 + --> $DIR/empty-match.rs:67:24 | LL | match_guarded_arm!((NonEmptyUnion2 { foo: () })); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyUnion2 { .. }` not covered | note: `NonEmptyUnion2` defined here - --> $DIR/empty-match.rs:27:11 + --> $DIR/empty-match.rs:26:11 | LL | union NonEmptyUnion2 { | ^^^^^^^^^^^^^^ @@ -300,13 +300,13 @@ LL + NonEmptyUnion2 { .. } => todo!() | error[E0004]: non-exhaustive patterns: `NonEmptyEnum1::Foo(_)` not covered - --> $DIR/empty-match.rs:69:24 + --> $DIR/empty-match.rs:68:24 | LL | match_guarded_arm!(NonEmptyEnum1::Foo(true)); | ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyEnum1::Foo(_)` not covered | note: `NonEmptyEnum1` defined here - --> $DIR/empty-match.rs:31:10 + --> $DIR/empty-match.rs:30:10 | LL | enum NonEmptyEnum1 { | ^^^^^^^^^^^^^ @@ -321,13 +321,13 @@ LL + NonEmptyEnum1::Foo(_) => todo!() | error[E0004]: non-exhaustive patterns: `NonEmptyEnum2::Foo(_)` and `NonEmptyEnum2::Bar` not covered - --> $DIR/empty-match.rs:70:24 + --> $DIR/empty-match.rs:69:24 | LL | match_guarded_arm!(NonEmptyEnum2::Foo(true)); | ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `NonEmptyEnum2::Foo(_)` and `NonEmptyEnum2::Bar` not covered | note: `NonEmptyEnum2` defined here - --> $DIR/empty-match.rs:34:10 + --> $DIR/empty-match.rs:33:10 | LL | enum NonEmptyEnum2 { | ^^^^^^^^^^^^^ @@ -344,13 +344,13 @@ LL + NonEmptyEnum2::Foo(_) | NonEmptyEnum2::Bar => todo!() | error[E0004]: non-exhaustive patterns: `NonEmptyEnum5::V1`, `NonEmptyEnum5::V2`, `NonEmptyEnum5::V3` and 2 more not covered - --> $DIR/empty-match.rs:71:24 + --> $DIR/empty-match.rs:70:24 | LL | ...ded_arm!(NonEmptyEnum5::V1); | ^^^^^^^^^^^^^^^^^ patterns `NonEmptyEnum5::V1`, `NonEmptyEnum5::V2`, `NonEmptyEnum5::V3` and 2 more not covered | note: `NonEmptyEnum5` defined here - --> $DIR/empty-match.rs:38:10 + --> $DIR/empty-match.rs:37:10 | LL | enum NonEmptyEnum5 { | ^^^^^^^^^^^^^ @@ -373,7 +373,7 @@ LL + _ => todo!() | error[E0004]: non-exhaustive patterns: `[]` not covered - --> $DIR/empty-match.rs:72:24 + --> $DIR/empty-match.rs:71:24 | LL | match_guarded_arm!(array0_of_empty); | ^^^^^^^^^^^^^^^ pattern `[]` not covered @@ -387,7 +387,7 @@ LL + [] => todo!() | error[E0004]: non-exhaustive patterns: `[]` not covered - --> $DIR/empty-match.rs:73:24 + --> $DIR/empty-match.rs:72:24 | LL | match_guarded_arm!(arrayN_of_empty); | ^^^^^^^^^^^^^^^ pattern `[]` not covered diff --git a/tests/ui/pattern/usefulness/empty-match.normal.stderr b/tests/ui/pattern/usefulness/empty-match.normal.stderr index b649aa122b255..8becc8e7c7eec 100644 --- a/tests/ui/pattern/usefulness/empty-match.normal.stderr +++ b/tests/ui/pattern/usefulness/empty-match.normal.stderr @@ -1,5 +1,5 @@ error[E0004]: non-exhaustive patterns: type `u8` is non-empty - --> $DIR/empty-match.rs:47:20 + --> $DIR/empty-match.rs:46:20 | LL | match_no_arms!(0u8); | ^^^ @@ -8,7 +8,7 @@ LL | match_no_arms!(0u8); = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern error[E0004]: non-exhaustive patterns: type `i8` is non-empty - --> $DIR/empty-match.rs:48:20 + --> $DIR/empty-match.rs:47:20 | LL | match_no_arms!(0i8); | ^^^ @@ -17,7 +17,7 @@ LL | match_no_arms!(0i8); = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern error[E0004]: non-exhaustive patterns: type `usize` is non-empty - --> $DIR/empty-match.rs:49:20 + --> $DIR/empty-match.rs:48:20 | LL | match_no_arms!(0usize); | ^^^^^^ @@ -26,7 +26,7 @@ LL | match_no_arms!(0usize); = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern error[E0004]: non-exhaustive patterns: type `isize` is non-empty - --> $DIR/empty-match.rs:50:20 + --> $DIR/empty-match.rs:49:20 | LL | match_no_arms!(0isize); | ^^^^^^ @@ -35,13 +35,13 @@ LL | match_no_arms!(0isize); = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern error[E0004]: non-exhaustive patterns: type `NonEmptyStruct1` is non-empty - --> $DIR/empty-match.rs:51:20 + --> $DIR/empty-match.rs:50:20 | LL | match_no_arms!(NonEmptyStruct1); | ^^^^^^^^^^^^^^^ | note: `NonEmptyStruct1` defined here - --> $DIR/empty-match.rs:22:12 + --> $DIR/empty-match.rs:21:12 | LL | struct NonEmptyStruct1; | ^^^^^^^^^^^^^^^ @@ -49,13 +49,13 @@ LL | struct NonEmptyStruct1; = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern error[E0004]: non-exhaustive patterns: type `NonEmptyStruct2` is non-empty - --> $DIR/empty-match.rs:52:20 + --> $DIR/empty-match.rs:51:20 | LL | match_no_arms!(NonEmptyStruct2(true)); | ^^^^^^^^^^^^^^^^^^^^^ | note: `NonEmptyStruct2` defined here - --> $DIR/empty-match.rs:23:12 + --> $DIR/empty-match.rs:22:12 | LL | struct NonEmptyStruct2(bool); | ^^^^^^^^^^^^^^^ @@ -63,13 +63,13 @@ LL | struct NonEmptyStruct2(bool); = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern error[E0004]: non-exhaustive patterns: type `NonEmptyUnion1` is non-empty - --> $DIR/empty-match.rs:53:20 + --> $DIR/empty-match.rs:52:20 | LL | match_no_arms!((NonEmptyUnion1 { foo: () })); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: `NonEmptyUnion1` defined here - --> $DIR/empty-match.rs:24:11 + --> $DIR/empty-match.rs:23:11 | LL | union NonEmptyUnion1 { | ^^^^^^^^^^^^^^ @@ -77,13 +77,13 @@ LL | union NonEmptyUnion1 { = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern error[E0004]: non-exhaustive patterns: type `NonEmptyUnion2` is non-empty - --> $DIR/empty-match.rs:54:20 + --> $DIR/empty-match.rs:53:20 | LL | match_no_arms!((NonEmptyUnion2 { foo: () })); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: `NonEmptyUnion2` defined here - --> $DIR/empty-match.rs:27:11 + --> $DIR/empty-match.rs:26:11 | LL | union NonEmptyUnion2 { | ^^^^^^^^^^^^^^ @@ -91,13 +91,13 @@ LL | union NonEmptyUnion2 { = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern error[E0004]: non-exhaustive patterns: `NonEmptyEnum1::Foo(_)` not covered - --> $DIR/empty-match.rs:55:20 + --> $DIR/empty-match.rs:54:20 | LL | match_no_arms!(NonEmptyEnum1::Foo(true)); | ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyEnum1::Foo(_)` not covered | note: `NonEmptyEnum1` defined here - --> $DIR/empty-match.rs:31:10 + --> $DIR/empty-match.rs:30:10 | LL | enum NonEmptyEnum1 { | ^^^^^^^^^^^^^ @@ -107,13 +107,13 @@ LL | Foo(bool), = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern error[E0004]: non-exhaustive patterns: `NonEmptyEnum2::Foo(_)` and `NonEmptyEnum2::Bar` not covered - --> $DIR/empty-match.rs:56:20 + --> $DIR/empty-match.rs:55:20 | LL | match_no_arms!(NonEmptyEnum2::Foo(true)); | ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `NonEmptyEnum2::Foo(_)` and `NonEmptyEnum2::Bar` not covered | note: `NonEmptyEnum2` defined here - --> $DIR/empty-match.rs:34:10 + --> $DIR/empty-match.rs:33:10 | LL | enum NonEmptyEnum2 { | ^^^^^^^^^^^^^ @@ -125,13 +125,13 @@ LL | Bar, = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or multiple match arms error[E0004]: non-exhaustive patterns: `NonEmptyEnum5::V1`, `NonEmptyEnum5::V2`, `NonEmptyEnum5::V3` and 2 more not covered - --> $DIR/empty-match.rs:57:20 + --> $DIR/empty-match.rs:56:20 | LL | match_no_arms!(NonEmptyEnum5::V1); | ^^^^^^^^^^^^^^^^^ patterns `NonEmptyEnum5::V1`, `NonEmptyEnum5::V2`, `NonEmptyEnum5::V3` and 2 more not covered | note: `NonEmptyEnum5` defined here - --> $DIR/empty-match.rs:38:10 + --> $DIR/empty-match.rs:37:10 | LL | enum NonEmptyEnum5 { | ^^^^^^^^^^^^^ @@ -149,7 +149,7 @@ LL | V5, = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or multiple match arms error[E0004]: non-exhaustive patterns: type `[!; 0]` is non-empty - --> $DIR/empty-match.rs:58:20 + --> $DIR/empty-match.rs:57:20 | LL | match_no_arms!(array0_of_empty); | ^^^^^^^^^^^^^^^ @@ -158,7 +158,7 @@ LL | match_no_arms!(array0_of_empty); = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern error[E0004]: non-exhaustive patterns: type `[!; N]` is non-empty - --> $DIR/empty-match.rs:59:20 + --> $DIR/empty-match.rs:58:20 | LL | match_no_arms!(arrayN_of_empty); | ^^^^^^^^^^^^^^^ @@ -167,7 +167,7 @@ LL | match_no_arms!(arrayN_of_empty); = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern error[E0004]: non-exhaustive patterns: `0_u8..=u8::MAX` not covered - --> $DIR/empty-match.rs:61:24 + --> $DIR/empty-match.rs:60:24 | LL | match_guarded_arm!(0u8); | ^^^ pattern `0_u8..=u8::MAX` not covered @@ -181,7 +181,7 @@ LL + 0_u8..=u8::MAX => todo!() | error[E0004]: non-exhaustive patterns: `i8::MIN..=i8::MAX` not covered - --> $DIR/empty-match.rs:62:24 + --> $DIR/empty-match.rs:61:24 | LL | match_guarded_arm!(0i8); | ^^^ pattern `i8::MIN..=i8::MAX` not covered @@ -195,7 +195,7 @@ LL + i8::MIN..=i8::MAX => todo!() | error[E0004]: non-exhaustive patterns: `0_usize..` not covered - --> $DIR/empty-match.rs:63:24 + --> $DIR/empty-match.rs:62:24 | LL | match_guarded_arm!(0usize); | ^^^^^^ pattern `0_usize..` not covered @@ -209,7 +209,7 @@ LL + 0_usize.. => todo!() | error[E0004]: non-exhaustive patterns: `_` not covered - --> $DIR/empty-match.rs:64:24 + --> $DIR/empty-match.rs:63:24 | LL | match_guarded_arm!(0isize); | ^^^^^^ pattern `_` not covered @@ -223,13 +223,13 @@ LL + _ => todo!() | error[E0004]: non-exhaustive patterns: `NonEmptyStruct1` not covered - --> $DIR/empty-match.rs:65:24 + --> $DIR/empty-match.rs:64:24 | LL | match_guarded_arm!(NonEmptyStruct1); | ^^^^^^^^^^^^^^^ pattern `NonEmptyStruct1` not covered | note: `NonEmptyStruct1` defined here - --> $DIR/empty-match.rs:22:12 + --> $DIR/empty-match.rs:21:12 | LL | struct NonEmptyStruct1; | ^^^^^^^^^^^^^^^ @@ -242,13 +242,13 @@ LL + NonEmptyStruct1 => todo!() | error[E0004]: non-exhaustive patterns: `NonEmptyStruct2(_)` not covered - --> $DIR/empty-match.rs:66:24 + --> $DIR/empty-match.rs:65:24 | LL | match_guarded_arm!(NonEmptyStruct2(true)); | ^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyStruct2(_)` not covered | note: `NonEmptyStruct2` defined here - --> $DIR/empty-match.rs:23:12 + --> $DIR/empty-match.rs:22:12 | LL | struct NonEmptyStruct2(bool); | ^^^^^^^^^^^^^^^ @@ -261,13 +261,13 @@ LL + NonEmptyStruct2(_) => todo!() | error[E0004]: non-exhaustive patterns: `NonEmptyUnion1 { .. }` not covered - --> $DIR/empty-match.rs:67:24 + --> $DIR/empty-match.rs:66:24 | LL | match_guarded_arm!((NonEmptyUnion1 { foo: () })); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyUnion1 { .. }` not covered | note: `NonEmptyUnion1` defined here - --> $DIR/empty-match.rs:24:11 + --> $DIR/empty-match.rs:23:11 | LL | union NonEmptyUnion1 { | ^^^^^^^^^^^^^^ @@ -280,13 +280,13 @@ LL + NonEmptyUnion1 { .. } => todo!() | error[E0004]: non-exhaustive patterns: `NonEmptyUnion2 { .. }` not covered - --> $DIR/empty-match.rs:68:24 + --> $DIR/empty-match.rs:67:24 | LL | match_guarded_arm!((NonEmptyUnion2 { foo: () })); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyUnion2 { .. }` not covered | note: `NonEmptyUnion2` defined here - --> $DIR/empty-match.rs:27:11 + --> $DIR/empty-match.rs:26:11 | LL | union NonEmptyUnion2 { | ^^^^^^^^^^^^^^ @@ -300,13 +300,13 @@ LL + NonEmptyUnion2 { .. } => todo!() | error[E0004]: non-exhaustive patterns: `NonEmptyEnum1::Foo(_)` not covered - --> $DIR/empty-match.rs:69:24 + --> $DIR/empty-match.rs:68:24 | LL | match_guarded_arm!(NonEmptyEnum1::Foo(true)); | ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyEnum1::Foo(_)` not covered | note: `NonEmptyEnum1` defined here - --> $DIR/empty-match.rs:31:10 + --> $DIR/empty-match.rs:30:10 | LL | enum NonEmptyEnum1 { | ^^^^^^^^^^^^^ @@ -321,13 +321,13 @@ LL + NonEmptyEnum1::Foo(_) => todo!() | error[E0004]: non-exhaustive patterns: `NonEmptyEnum2::Foo(_)` and `NonEmptyEnum2::Bar` not covered - --> $DIR/empty-match.rs:70:24 + --> $DIR/empty-match.rs:69:24 | LL | match_guarded_arm!(NonEmptyEnum2::Foo(true)); | ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `NonEmptyEnum2::Foo(_)` and `NonEmptyEnum2::Bar` not covered | note: `NonEmptyEnum2` defined here - --> $DIR/empty-match.rs:34:10 + --> $DIR/empty-match.rs:33:10 | LL | enum NonEmptyEnum2 { | ^^^^^^^^^^^^^ @@ -344,13 +344,13 @@ LL + NonEmptyEnum2::Foo(_) | NonEmptyEnum2::Bar => todo!() | error[E0004]: non-exhaustive patterns: `NonEmptyEnum5::V1`, `NonEmptyEnum5::V2`, `NonEmptyEnum5::V3` and 2 more not covered - --> $DIR/empty-match.rs:71:24 + --> $DIR/empty-match.rs:70:24 | LL | ...ded_arm!(NonEmptyEnum5::V1); | ^^^^^^^^^^^^^^^^^ patterns `NonEmptyEnum5::V1`, `NonEmptyEnum5::V2`, `NonEmptyEnum5::V3` and 2 more not covered | note: `NonEmptyEnum5` defined here - --> $DIR/empty-match.rs:38:10 + --> $DIR/empty-match.rs:37:10 | LL | enum NonEmptyEnum5 { | ^^^^^^^^^^^^^ @@ -373,7 +373,7 @@ LL + _ => todo!() | error[E0004]: non-exhaustive patterns: `[]` not covered - --> $DIR/empty-match.rs:72:24 + --> $DIR/empty-match.rs:71:24 | LL | match_guarded_arm!(array0_of_empty); | ^^^^^^^^^^^^^^^ pattern `[]` not covered @@ -387,7 +387,7 @@ LL + [] => todo!() | error[E0004]: non-exhaustive patterns: `[]` not covered - --> $DIR/empty-match.rs:73:24 + --> $DIR/empty-match.rs:72:24 | LL | match_guarded_arm!(arrayN_of_empty); | ^^^^^^^^^^^^^^^ pattern `[]` not covered diff --git a/tests/ui/pattern/usefulness/empty-types.exhaustive_patterns.stderr b/tests/ui/pattern/usefulness/empty-types.exhaustive_patterns.stderr index 75a633cd49a3d..b070b4dad5649 100644 --- a/tests/ui/pattern/usefulness/empty-types.exhaustive_patterns.stderr +++ b/tests/ui/pattern/usefulness/empty-types.exhaustive_patterns.stderr @@ -1,5 +1,5 @@ error: unreachable pattern - --> $DIR/empty-types.rs:47:9 + --> $DIR/empty-types.rs:46:9 | LL | _ => {} | ^------ @@ -9,13 +9,13 @@ LL | _ => {} | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types note: the lint level is defined here - --> $DIR/empty-types.rs:13:9 + --> $DIR/empty-types.rs:12:9 | LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ error: unreachable pattern - --> $DIR/empty-types.rs:50:9 + --> $DIR/empty-types.rs:49:9 | LL | _x => {} | ^^------ @@ -26,7 +26,7 @@ LL | _x => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error[E0004]: non-exhaustive patterns: type `&!` is non-empty - --> $DIR/empty-types.rs:54:11 + --> $DIR/empty-types.rs:53:11 | LL | match ref_never {} | ^^^^^^^^^ @@ -41,7 +41,7 @@ LL ~ } | error: unreachable pattern - --> $DIR/empty-types.rs:68:9 + --> $DIR/empty-types.rs:67:9 | LL | (_, _) => {} | ^^^^^^------ @@ -52,7 +52,7 @@ LL | (_, _) => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:74:9 + --> $DIR/empty-types.rs:73:9 | LL | _ => {} | ^------ @@ -63,7 +63,7 @@ LL | _ => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:77:9 + --> $DIR/empty-types.rs:76:9 | LL | (_, _) => {} | ^^^^^^------ @@ -74,7 +74,7 @@ LL | (_, _) => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:81:9 + --> $DIR/empty-types.rs:80:9 | LL | _ => {} | ^------ @@ -85,7 +85,7 @@ LL | _ => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error[E0004]: non-exhaustive patterns: `Ok(_)` not covered - --> $DIR/empty-types.rs:85:11 + --> $DIR/empty-types.rs:84:11 | LL | match res_u32_never {} | ^^^^^^^^^^^^^ pattern `Ok(_)` not covered @@ -104,7 +104,7 @@ LL ~ } | error: unreachable pattern - --> $DIR/empty-types.rs:92:9 + --> $DIR/empty-types.rs:91:9 | LL | Err(_) => {} | ^^^^^^------ @@ -115,7 +115,7 @@ LL | Err(_) => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:97:9 + --> $DIR/empty-types.rs:96:9 | LL | Err(_) => {} | ^^^^^^------ @@ -126,7 +126,7 @@ LL | Err(_) => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error[E0004]: non-exhaustive patterns: `Ok(1_u32..=u32::MAX)` not covered - --> $DIR/empty-types.rs:94:11 + --> $DIR/empty-types.rs:93:11 | LL | match res_u32_never { | ^^^^^^^^^^^^^ pattern `Ok(1_u32..=u32::MAX)` not covered @@ -144,7 +144,7 @@ LL ~ Ok(1_u32..=u32::MAX) => todo!() | error[E0005]: refutable pattern in local binding - --> $DIR/empty-types.rs:100:9 + --> $DIR/empty-types.rs:99:9 | LL | let Ok(_x) = res_u32_never.as_ref(); | ^^^^^^ pattern `Err(_)` not covered @@ -158,7 +158,7 @@ LL | let Ok(_x) = res_u32_never.as_ref() else { todo!() }; | ++++++++++++++++ error: unreachable pattern - --> $DIR/empty-types.rs:110:9 + --> $DIR/empty-types.rs:109:9 | LL | _ => {} | ^------ @@ -169,7 +169,7 @@ LL | _ => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:113:9 + --> $DIR/empty-types.rs:112:9 | LL | Ok(_) => {} | ^^^^^------ @@ -180,7 +180,7 @@ LL | Ok(_) => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:116:9 + --> $DIR/empty-types.rs:115:9 | LL | Ok(_) => {} | ^^^^^------ @@ -191,7 +191,7 @@ LL | Ok(_) => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:117:9 + --> $DIR/empty-types.rs:116:9 | LL | _ => {} | ^------ @@ -202,7 +202,7 @@ LL | _ => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:120:9 + --> $DIR/empty-types.rs:119:9 | LL | Ok(_) => {} | ^^^^^------ @@ -213,7 +213,7 @@ LL | Ok(_) => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:121:9 + --> $DIR/empty-types.rs:120:9 | LL | Err(_) => {} | ^^^^^^------ @@ -224,7 +224,7 @@ LL | Err(_) => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:130:13 + --> $DIR/empty-types.rs:129:13 | LL | _ => {} | ^------ @@ -235,7 +235,7 @@ LL | _ => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:133:13 + --> $DIR/empty-types.rs:132:13 | LL | _ if false => {} | ^--------------- @@ -246,7 +246,7 @@ LL | _ if false => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:141:13 + --> $DIR/empty-types.rs:140:13 | LL | Some(_) => {} | ^^^^^^^------ @@ -257,7 +257,7 @@ LL | Some(_) => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:145:13 + --> $DIR/empty-types.rs:144:13 | LL | None => {} | ---- matches all the relevant values @@ -265,7 +265,7 @@ LL | _ => {} | ^ no value can reach this error: unreachable pattern - --> $DIR/empty-types.rs:197:13 + --> $DIR/empty-types.rs:196:13 | LL | _ => {} | ^------ @@ -276,7 +276,7 @@ LL | _ => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:202:13 + --> $DIR/empty-types.rs:201:13 | LL | _ => {} | ^------ @@ -287,7 +287,7 @@ LL | _ => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:207:13 + --> $DIR/empty-types.rs:206:13 | LL | _ => {} | ^------ @@ -298,7 +298,7 @@ LL | _ => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:212:13 + --> $DIR/empty-types.rs:211:13 | LL | _ => {} | ^------ @@ -309,7 +309,7 @@ LL | _ => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:218:13 + --> $DIR/empty-types.rs:217:13 | LL | _ => {} | ^------ @@ -320,7 +320,7 @@ LL | _ => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:279:9 + --> $DIR/empty-types.rs:278:9 | LL | _ => {} | ^------ @@ -331,7 +331,7 @@ LL | _ => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:282:9 + --> $DIR/empty-types.rs:281:9 | LL | (_, _) => {} | ^^^^^^------ @@ -342,7 +342,7 @@ LL | (_, _) => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:285:9 + --> $DIR/empty-types.rs:284:9 | LL | Ok(_) => {} | ^^^^^------ @@ -353,7 +353,7 @@ LL | Ok(_) => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:286:9 + --> $DIR/empty-types.rs:285:9 | LL | Err(_) => {} | ^^^^^^------ @@ -364,7 +364,7 @@ LL | Err(_) => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error[E0004]: non-exhaustive patterns: type `&[!]` is non-empty - --> $DIR/empty-types.rs:325:11 + --> $DIR/empty-types.rs:324:11 | LL | match slice_never {} | ^^^^^^^^^^^ @@ -378,7 +378,7 @@ LL ~ } | error[E0004]: non-exhaustive patterns: `&[]` not covered - --> $DIR/empty-types.rs:336:11 + --> $DIR/empty-types.rs:335:11 | LL | match slice_never { | ^^^^^^^^^^^ pattern `&[]` not covered @@ -391,7 +391,7 @@ LL + &[] => todo!() | error[E0004]: non-exhaustive patterns: `&[]` not covered - --> $DIR/empty-types.rs:350:11 + --> $DIR/empty-types.rs:349:11 | LL | match slice_never { | ^^^^^^^^^^^ pattern `&[]` not covered @@ -405,7 +405,7 @@ LL + &[] => todo!() | error[E0004]: non-exhaustive patterns: type `[!]` is non-empty - --> $DIR/empty-types.rs:357:11 + --> $DIR/empty-types.rs:356:11 | LL | match *slice_never {} | ^^^^^^^^^^^^ @@ -419,7 +419,7 @@ LL ~ } | error: unreachable pattern - --> $DIR/empty-types.rs:366:9 + --> $DIR/empty-types.rs:365:9 | LL | _ => {} | ^------ @@ -430,7 +430,7 @@ LL | _ => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:369:9 + --> $DIR/empty-types.rs:368:9 | LL | [_, _, _] => {} | ^^^^^^^^^------ @@ -441,7 +441,7 @@ LL | [_, _, _] => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:372:9 + --> $DIR/empty-types.rs:371:9 | LL | [_, ..] => {} | ^^^^^^^------ @@ -452,7 +452,7 @@ LL | [_, ..] => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error[E0004]: non-exhaustive patterns: type `[!; 0]` is non-empty - --> $DIR/empty-types.rs:386:11 + --> $DIR/empty-types.rs:385:11 | LL | match array_0_never {} | ^^^^^^^^^^^^^ @@ -466,7 +466,7 @@ LL ~ } | error: unreachable pattern - --> $DIR/empty-types.rs:393:9 + --> $DIR/empty-types.rs:392:9 | LL | [] => {} | -- matches all the relevant values @@ -474,7 +474,7 @@ LL | _ => {} | ^ no value can reach this error[E0004]: non-exhaustive patterns: `[]` not covered - --> $DIR/empty-types.rs:395:11 + --> $DIR/empty-types.rs:394:11 | LL | match array_0_never { | ^^^^^^^^^^^^^ pattern `[]` not covered @@ -488,7 +488,7 @@ LL + [] => todo!() | error: unreachable pattern - --> $DIR/empty-types.rs:414:9 + --> $DIR/empty-types.rs:413:9 | LL | Some(_) => {} | ^^^^^^^------ @@ -499,7 +499,7 @@ LL | Some(_) => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:419:9 + --> $DIR/empty-types.rs:418:9 | LL | Some(_a) => {} | ^^^^^^^^------ @@ -510,7 +510,7 @@ LL | Some(_a) => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:424:9 + --> $DIR/empty-types.rs:423:9 | LL | None => {} | ---- matches all the relevant values @@ -519,7 +519,7 @@ LL | _ => {} | ^ no value can reach this error: unreachable pattern - --> $DIR/empty-types.rs:429:9 + --> $DIR/empty-types.rs:428:9 | LL | None => {} | ---- matches all the relevant values @@ -528,7 +528,7 @@ LL | _a => {} | ^^ no value can reach this error: unreachable pattern - --> $DIR/empty-types.rs:601:9 + --> $DIR/empty-types.rs:600:9 | LL | _ => {} | ^------ @@ -539,7 +539,7 @@ LL | _ => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:604:9 + --> $DIR/empty-types.rs:603:9 | LL | _x => {} | ^^------ @@ -550,7 +550,7 @@ LL | _x => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:607:9 + --> $DIR/empty-types.rs:606:9 | LL | _ if false => {} | ^--------------- @@ -561,7 +561,7 @@ LL | _ if false => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:610:9 + --> $DIR/empty-types.rs:609:9 | LL | _x if false => {} | ^^--------------- diff --git a/tests/ui/pattern/usefulness/empty-types.never_pats.stderr b/tests/ui/pattern/usefulness/empty-types.never_pats.stderr index 046c0d5f6588f..37e395b676110 100644 --- a/tests/ui/pattern/usefulness/empty-types.never_pats.stderr +++ b/tests/ui/pattern/usefulness/empty-types.never_pats.stderr @@ -1,5 +1,5 @@ error: unreachable pattern - --> $DIR/empty-types.rs:47:9 + --> $DIR/empty-types.rs:46:9 | LL | _ => {} | ^------ @@ -9,13 +9,13 @@ LL | _ => {} | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types note: the lint level is defined here - --> $DIR/empty-types.rs:13:9 + --> $DIR/empty-types.rs:12:9 | LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ error: unreachable pattern - --> $DIR/empty-types.rs:50:9 + --> $DIR/empty-types.rs:49:9 | LL | _x => {} | ^^------ @@ -26,7 +26,7 @@ LL | _x => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error[E0004]: non-exhaustive patterns: type `&!` is non-empty - --> $DIR/empty-types.rs:54:11 + --> $DIR/empty-types.rs:53:11 | LL | match ref_never {} | ^^^^^^^^^ @@ -41,7 +41,7 @@ LL ~ } | error: unreachable pattern - --> $DIR/empty-types.rs:81:9 + --> $DIR/empty-types.rs:80:9 | LL | _ => {} | ^------ @@ -52,7 +52,7 @@ LL | _ => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error[E0004]: non-exhaustive patterns: `Ok(_)` not covered - --> $DIR/empty-types.rs:85:11 + --> $DIR/empty-types.rs:84:11 | LL | match res_u32_never {} | ^^^^^^^^^^^^^ pattern `Ok(_)` not covered @@ -71,7 +71,7 @@ LL ~ } | error[E0004]: non-exhaustive patterns: `Ok(1_u32..=u32::MAX)` not covered - --> $DIR/empty-types.rs:94:11 + --> $DIR/empty-types.rs:93:11 | LL | match res_u32_never { | ^^^^^^^^^^^^^ pattern `Ok(1_u32..=u32::MAX)` not covered @@ -89,7 +89,7 @@ LL ~ Ok(1_u32..=u32::MAX) => todo!() | error[E0005]: refutable pattern in local binding - --> $DIR/empty-types.rs:100:9 + --> $DIR/empty-types.rs:99:9 | LL | let Ok(_x) = res_u32_never.as_ref(); | ^^^^^^ pattern `Err(_)` not covered @@ -103,7 +103,7 @@ LL | let Ok(_x) = res_u32_never.as_ref() else { todo!() }; | ++++++++++++++++ error[E0005]: refutable pattern in local binding - --> $DIR/empty-types.rs:104:9 + --> $DIR/empty-types.rs:103:9 | LL | let Ok(_x) = &res_u32_never; | ^^^^^^ pattern `&Err(!)` not covered @@ -117,7 +117,7 @@ LL | let Ok(_x) = &res_u32_never else { todo!() }; | ++++++++++++++++ error: unreachable pattern - --> $DIR/empty-types.rs:130:13 + --> $DIR/empty-types.rs:129:13 | LL | _ => {} | ^------ @@ -128,7 +128,7 @@ LL | _ => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:133:13 + --> $DIR/empty-types.rs:132:13 | LL | _ if false => {} | ^--------------- @@ -139,7 +139,7 @@ LL | _ if false => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error[E0004]: non-exhaustive patterns: `Some(!)` not covered - --> $DIR/empty-types.rs:154:15 + --> $DIR/empty-types.rs:153:15 | LL | match *ref_opt_void { | ^^^^^^^^^^^^^ pattern `Some(!)` not covered @@ -158,7 +158,7 @@ LL + Some(!) | error: unreachable pattern - --> $DIR/empty-types.rs:197:13 + --> $DIR/empty-types.rs:196:13 | LL | _ => {} | ^------ @@ -169,7 +169,7 @@ LL | _ => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:202:13 + --> $DIR/empty-types.rs:201:13 | LL | _ => {} | ^------ @@ -180,7 +180,7 @@ LL | _ => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:207:13 + --> $DIR/empty-types.rs:206:13 | LL | _ => {} | ^------ @@ -191,7 +191,7 @@ LL | _ => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:212:13 + --> $DIR/empty-types.rs:211:13 | LL | _ => {} | ^------ @@ -202,7 +202,7 @@ LL | _ => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:218:13 + --> $DIR/empty-types.rs:217:13 | LL | _ => {} | ^------ @@ -213,7 +213,7 @@ LL | _ => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:279:9 + --> $DIR/empty-types.rs:278:9 | LL | _ => {} | ^------ @@ -224,7 +224,7 @@ LL | _ => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error[E0005]: refutable pattern in local binding - --> $DIR/empty-types.rs:295:13 + --> $DIR/empty-types.rs:294:13 | LL | let Ok(_) = *ptr_result_never_err; | ^^^^^ pattern `Err(!)` not covered @@ -238,7 +238,7 @@ LL | if let Ok(_) = *ptr_result_never_err { todo!() }; | ++ +++++++++++ error[E0004]: non-exhaustive patterns: type `(u32, !)` is non-empty - --> $DIR/empty-types.rs:314:11 + --> $DIR/empty-types.rs:313:11 | LL | match *x {} | ^^ @@ -252,7 +252,7 @@ LL ~ } | error[E0004]: non-exhaustive patterns: type `(!, !)` is non-empty - --> $DIR/empty-types.rs:316:11 + --> $DIR/empty-types.rs:315:11 | LL | match *x {} | ^^ @@ -266,7 +266,7 @@ LL ~ } | error[E0004]: non-exhaustive patterns: `Ok(!)` and `Err(!)` not covered - --> $DIR/empty-types.rs:318:11 + --> $DIR/empty-types.rs:317:11 | LL | match *x {} | ^^ patterns `Ok(!)` and `Err(!)` not covered @@ -288,7 +288,7 @@ LL ~ } | error[E0004]: non-exhaustive patterns: type `[!; 3]` is non-empty - --> $DIR/empty-types.rs:320:11 + --> $DIR/empty-types.rs:319:11 | LL | match *x {} | ^^ @@ -302,7 +302,7 @@ LL ~ } | error[E0004]: non-exhaustive patterns: type `&[!]` is non-empty - --> $DIR/empty-types.rs:325:11 + --> $DIR/empty-types.rs:324:11 | LL | match slice_never {} | ^^^^^^^^^^^ @@ -316,7 +316,7 @@ LL ~ } | error[E0004]: non-exhaustive patterns: `&[!, ..]` not covered - --> $DIR/empty-types.rs:327:11 + --> $DIR/empty-types.rs:326:11 | LL | match slice_never { | ^^^^^^^^^^^ pattern `&[!, ..]` not covered @@ -330,7 +330,7 @@ LL + &[!, ..] | error[E0004]: non-exhaustive patterns: `&[]`, `&[!]` and `&[!, !]` not covered - --> $DIR/empty-types.rs:336:11 + --> $DIR/empty-types.rs:335:11 | LL | match slice_never { | ^^^^^^^^^^^ patterns `&[]`, `&[!]` and `&[!, !]` not covered @@ -343,7 +343,7 @@ LL + &[] | &[!] | &[!, !] => todo!() | error[E0004]: non-exhaustive patterns: `&[]` and `&[!, ..]` not covered - --> $DIR/empty-types.rs:350:11 + --> $DIR/empty-types.rs:349:11 | LL | match slice_never { | ^^^^^^^^^^^ patterns `&[]` and `&[!, ..]` not covered @@ -357,7 +357,7 @@ LL + &[] | &[!, ..] => todo!() | error[E0004]: non-exhaustive patterns: type `[!]` is non-empty - --> $DIR/empty-types.rs:357:11 + --> $DIR/empty-types.rs:356:11 | LL | match *slice_never {} | ^^^^^^^^^^^^ @@ -371,7 +371,7 @@ LL ~ } | error[E0004]: non-exhaustive patterns: type `[!; 0]` is non-empty - --> $DIR/empty-types.rs:386:11 + --> $DIR/empty-types.rs:385:11 | LL | match array_0_never {} | ^^^^^^^^^^^^^ @@ -385,7 +385,7 @@ LL ~ } | error: unreachable pattern - --> $DIR/empty-types.rs:393:9 + --> $DIR/empty-types.rs:392:9 | LL | [] => {} | -- matches all the relevant values @@ -393,7 +393,7 @@ LL | _ => {} | ^ no value can reach this error[E0004]: non-exhaustive patterns: `[]` not covered - --> $DIR/empty-types.rs:395:11 + --> $DIR/empty-types.rs:394:11 | LL | match array_0_never { | ^^^^^^^^^^^^^ pattern `[]` not covered @@ -407,7 +407,7 @@ LL + [] => todo!() | error[E0004]: non-exhaustive patterns: `&Some(!)` not covered - --> $DIR/empty-types.rs:449:11 + --> $DIR/empty-types.rs:448:11 | LL | match ref_opt_never { | ^^^^^^^^^^^^^ pattern `&Some(!)` not covered @@ -426,7 +426,7 @@ LL + &Some(!) | error[E0004]: non-exhaustive patterns: `Some(!)` not covered - --> $DIR/empty-types.rs:490:11 + --> $DIR/empty-types.rs:489:11 | LL | match *ref_opt_never { | ^^^^^^^^^^^^^^ pattern `Some(!)` not covered @@ -445,7 +445,7 @@ LL + Some(!) | error[E0004]: non-exhaustive patterns: `Err(!)` not covered - --> $DIR/empty-types.rs:538:11 + --> $DIR/empty-types.rs:537:11 | LL | match *ref_res_never { | ^^^^^^^^^^^^^^ pattern `Err(!)` not covered @@ -464,7 +464,7 @@ LL + Err(!) | error[E0004]: non-exhaustive patterns: `Err(!)` not covered - --> $DIR/empty-types.rs:549:11 + --> $DIR/empty-types.rs:548:11 | LL | match *ref_res_never { | ^^^^^^^^^^^^^^ pattern `Err(!)` not covered @@ -483,7 +483,7 @@ LL + Err(!) | error[E0004]: non-exhaustive patterns: type `(u32, !)` is non-empty - --> $DIR/empty-types.rs:568:11 + --> $DIR/empty-types.rs:567:11 | LL | match *ref_tuple_half_never {} | ^^^^^^^^^^^^^^^^^^^^^ @@ -497,7 +497,7 @@ LL ~ } | error: unreachable pattern - --> $DIR/empty-types.rs:601:9 + --> $DIR/empty-types.rs:600:9 | LL | _ => {} | ^------ @@ -508,7 +508,7 @@ LL | _ => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:604:9 + --> $DIR/empty-types.rs:603:9 | LL | _x => {} | ^^------ @@ -519,7 +519,7 @@ LL | _x => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:607:9 + --> $DIR/empty-types.rs:606:9 | LL | _ if false => {} | ^--------------- @@ -530,7 +530,7 @@ LL | _ if false => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:610:9 + --> $DIR/empty-types.rs:609:9 | LL | _x if false => {} | ^^--------------- @@ -541,7 +541,7 @@ LL | _x if false => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error[E0004]: non-exhaustive patterns: `&!` not covered - --> $DIR/empty-types.rs:635:11 + --> $DIR/empty-types.rs:634:11 | LL | match ref_never { | ^^^^^^^^^ pattern `&!` not covered @@ -557,7 +557,7 @@ LL + &! | error[E0004]: non-exhaustive patterns: `Ok(!)` not covered - --> $DIR/empty-types.rs:651:11 + --> $DIR/empty-types.rs:650:11 | LL | match *ref_result_never { | ^^^^^^^^^^^^^^^^^ pattern `Ok(!)` not covered @@ -576,7 +576,7 @@ LL + Ok(!) | error[E0004]: non-exhaustive patterns: `Some(!)` not covered - --> $DIR/empty-types.rs:671:11 + --> $DIR/empty-types.rs:670:11 | LL | match *x { | ^^ pattern `Some(!)` not covered diff --git a/tests/ui/pattern/usefulness/empty-types.normal.stderr b/tests/ui/pattern/usefulness/empty-types.normal.stderr index ba158c1176b35..6787321f57fc4 100644 --- a/tests/ui/pattern/usefulness/empty-types.normal.stderr +++ b/tests/ui/pattern/usefulness/empty-types.normal.stderr @@ -1,5 +1,5 @@ error: unreachable pattern - --> $DIR/empty-types.rs:47:9 + --> $DIR/empty-types.rs:46:9 | LL | _ => {} | ^------ @@ -9,13 +9,13 @@ LL | _ => {} | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types note: the lint level is defined here - --> $DIR/empty-types.rs:13:9 + --> $DIR/empty-types.rs:12:9 | LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ error: unreachable pattern - --> $DIR/empty-types.rs:50:9 + --> $DIR/empty-types.rs:49:9 | LL | _x => {} | ^^------ @@ -26,7 +26,7 @@ LL | _x => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error[E0004]: non-exhaustive patterns: type `&!` is non-empty - --> $DIR/empty-types.rs:54:11 + --> $DIR/empty-types.rs:53:11 | LL | match ref_never {} | ^^^^^^^^^ @@ -41,7 +41,7 @@ LL ~ } | error: unreachable pattern - --> $DIR/empty-types.rs:81:9 + --> $DIR/empty-types.rs:80:9 | LL | _ => {} | ^------ @@ -52,7 +52,7 @@ LL | _ => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error[E0004]: non-exhaustive patterns: `Ok(_)` not covered - --> $DIR/empty-types.rs:85:11 + --> $DIR/empty-types.rs:84:11 | LL | match res_u32_never {} | ^^^^^^^^^^^^^ pattern `Ok(_)` not covered @@ -71,7 +71,7 @@ LL ~ } | error[E0004]: non-exhaustive patterns: `Ok(1_u32..=u32::MAX)` not covered - --> $DIR/empty-types.rs:94:11 + --> $DIR/empty-types.rs:93:11 | LL | match res_u32_never { | ^^^^^^^^^^^^^ pattern `Ok(1_u32..=u32::MAX)` not covered @@ -89,7 +89,7 @@ LL ~ Ok(1_u32..=u32::MAX) => todo!() | error[E0005]: refutable pattern in local binding - --> $DIR/empty-types.rs:100:9 + --> $DIR/empty-types.rs:99:9 | LL | let Ok(_x) = res_u32_never.as_ref(); | ^^^^^^ pattern `Err(_)` not covered @@ -103,7 +103,7 @@ LL | let Ok(_x) = res_u32_never.as_ref() else { todo!() }; | ++++++++++++++++ error[E0005]: refutable pattern in local binding - --> $DIR/empty-types.rs:104:9 + --> $DIR/empty-types.rs:103:9 | LL | let Ok(_x) = &res_u32_never; | ^^^^^^ pattern `&Err(_)` not covered @@ -117,7 +117,7 @@ LL | let Ok(_x) = &res_u32_never else { todo!() }; | ++++++++++++++++ error: unreachable pattern - --> $DIR/empty-types.rs:130:13 + --> $DIR/empty-types.rs:129:13 | LL | _ => {} | ^------ @@ -128,7 +128,7 @@ LL | _ => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:133:13 + --> $DIR/empty-types.rs:132:13 | LL | _ if false => {} | ^--------------- @@ -139,7 +139,7 @@ LL | _ if false => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error[E0004]: non-exhaustive patterns: `Some(_)` not covered - --> $DIR/empty-types.rs:154:15 + --> $DIR/empty-types.rs:153:15 | LL | match *ref_opt_void { | ^^^^^^^^^^^^^ pattern `Some(_)` not covered @@ -158,7 +158,7 @@ LL + Some(_) => todo!() | error: unreachable pattern - --> $DIR/empty-types.rs:197:13 + --> $DIR/empty-types.rs:196:13 | LL | _ => {} | ^------ @@ -169,7 +169,7 @@ LL | _ => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:202:13 + --> $DIR/empty-types.rs:201:13 | LL | _ => {} | ^------ @@ -180,7 +180,7 @@ LL | _ => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:207:13 + --> $DIR/empty-types.rs:206:13 | LL | _ => {} | ^------ @@ -191,7 +191,7 @@ LL | _ => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:212:13 + --> $DIR/empty-types.rs:211:13 | LL | _ => {} | ^------ @@ -202,7 +202,7 @@ LL | _ => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:218:13 + --> $DIR/empty-types.rs:217:13 | LL | _ => {} | ^------ @@ -213,7 +213,7 @@ LL | _ => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:279:9 + --> $DIR/empty-types.rs:278:9 | LL | _ => {} | ^------ @@ -224,7 +224,7 @@ LL | _ => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error[E0005]: refutable pattern in local binding - --> $DIR/empty-types.rs:295:13 + --> $DIR/empty-types.rs:294:13 | LL | let Ok(_) = *ptr_result_never_err; | ^^^^^ pattern `Err(_)` not covered @@ -238,7 +238,7 @@ LL | if let Ok(_) = *ptr_result_never_err { todo!() }; | ++ +++++++++++ error[E0004]: non-exhaustive patterns: type `(u32, !)` is non-empty - --> $DIR/empty-types.rs:314:11 + --> $DIR/empty-types.rs:313:11 | LL | match *x {} | ^^ @@ -252,7 +252,7 @@ LL ~ } | error[E0004]: non-exhaustive patterns: type `(!, !)` is non-empty - --> $DIR/empty-types.rs:316:11 + --> $DIR/empty-types.rs:315:11 | LL | match *x {} | ^^ @@ -266,7 +266,7 @@ LL ~ } | error[E0004]: non-exhaustive patterns: `Ok(_)` and `Err(_)` not covered - --> $DIR/empty-types.rs:318:11 + --> $DIR/empty-types.rs:317:11 | LL | match *x {} | ^^ patterns `Ok(_)` and `Err(_)` not covered @@ -288,7 +288,7 @@ LL ~ } | error[E0004]: non-exhaustive patterns: type `[!; 3]` is non-empty - --> $DIR/empty-types.rs:320:11 + --> $DIR/empty-types.rs:319:11 | LL | match *x {} | ^^ @@ -302,7 +302,7 @@ LL ~ } | error[E0004]: non-exhaustive patterns: type `&[!]` is non-empty - --> $DIR/empty-types.rs:325:11 + --> $DIR/empty-types.rs:324:11 | LL | match slice_never {} | ^^^^^^^^^^^ @@ -316,7 +316,7 @@ LL ~ } | error[E0004]: non-exhaustive patterns: `&[_, ..]` not covered - --> $DIR/empty-types.rs:327:11 + --> $DIR/empty-types.rs:326:11 | LL | match slice_never { | ^^^^^^^^^^^ pattern `&[_, ..]` not covered @@ -330,7 +330,7 @@ LL + &[_, ..] => todo!() | error[E0004]: non-exhaustive patterns: `&[]`, `&[_]` and `&[_, _]` not covered - --> $DIR/empty-types.rs:336:11 + --> $DIR/empty-types.rs:335:11 | LL | match slice_never { | ^^^^^^^^^^^ patterns `&[]`, `&[_]` and `&[_, _]` not covered @@ -343,7 +343,7 @@ LL + &[] | &[_] | &[_, _] => todo!() | error[E0004]: non-exhaustive patterns: `&[]` and `&[_, ..]` not covered - --> $DIR/empty-types.rs:350:11 + --> $DIR/empty-types.rs:349:11 | LL | match slice_never { | ^^^^^^^^^^^ patterns `&[]` and `&[_, ..]` not covered @@ -357,7 +357,7 @@ LL + &[] | &[_, ..] => todo!() | error[E0004]: non-exhaustive patterns: type `[!]` is non-empty - --> $DIR/empty-types.rs:357:11 + --> $DIR/empty-types.rs:356:11 | LL | match *slice_never {} | ^^^^^^^^^^^^ @@ -371,7 +371,7 @@ LL ~ } | error[E0004]: non-exhaustive patterns: type `[!; 0]` is non-empty - --> $DIR/empty-types.rs:386:11 + --> $DIR/empty-types.rs:385:11 | LL | match array_0_never {} | ^^^^^^^^^^^^^ @@ -385,7 +385,7 @@ LL ~ } | error: unreachable pattern - --> $DIR/empty-types.rs:393:9 + --> $DIR/empty-types.rs:392:9 | LL | [] => {} | -- matches all the relevant values @@ -393,7 +393,7 @@ LL | _ => {} | ^ no value can reach this error[E0004]: non-exhaustive patterns: `[]` not covered - --> $DIR/empty-types.rs:395:11 + --> $DIR/empty-types.rs:394:11 | LL | match array_0_never { | ^^^^^^^^^^^^^ pattern `[]` not covered @@ -407,7 +407,7 @@ LL + [] => todo!() | error[E0004]: non-exhaustive patterns: `&Some(_)` not covered - --> $DIR/empty-types.rs:449:11 + --> $DIR/empty-types.rs:448:11 | LL | match ref_opt_never { | ^^^^^^^^^^^^^ pattern `&Some(_)` not covered @@ -426,7 +426,7 @@ LL + &Some(_) => todo!() | error[E0004]: non-exhaustive patterns: `Some(_)` not covered - --> $DIR/empty-types.rs:490:11 + --> $DIR/empty-types.rs:489:11 | LL | match *ref_opt_never { | ^^^^^^^^^^^^^^ pattern `Some(_)` not covered @@ -445,7 +445,7 @@ LL + Some(_) => todo!() | error[E0004]: non-exhaustive patterns: `Err(_)` not covered - --> $DIR/empty-types.rs:538:11 + --> $DIR/empty-types.rs:537:11 | LL | match *ref_res_never { | ^^^^^^^^^^^^^^ pattern `Err(_)` not covered @@ -464,7 +464,7 @@ LL + Err(_) => todo!() | error[E0004]: non-exhaustive patterns: `Err(_)` not covered - --> $DIR/empty-types.rs:549:11 + --> $DIR/empty-types.rs:548:11 | LL | match *ref_res_never { | ^^^^^^^^^^^^^^ pattern `Err(_)` not covered @@ -483,7 +483,7 @@ LL + Err(_) => todo!() | error[E0004]: non-exhaustive patterns: type `(u32, !)` is non-empty - --> $DIR/empty-types.rs:568:11 + --> $DIR/empty-types.rs:567:11 | LL | match *ref_tuple_half_never {} | ^^^^^^^^^^^^^^^^^^^^^ @@ -497,7 +497,7 @@ LL ~ } | error: unreachable pattern - --> $DIR/empty-types.rs:601:9 + --> $DIR/empty-types.rs:600:9 | LL | _ => {} | ^------ @@ -508,7 +508,7 @@ LL | _ => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:604:9 + --> $DIR/empty-types.rs:603:9 | LL | _x => {} | ^^------ @@ -519,7 +519,7 @@ LL | _x => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:607:9 + --> $DIR/empty-types.rs:606:9 | LL | _ if false => {} | ^--------------- @@ -530,7 +530,7 @@ LL | _ if false => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:610:9 + --> $DIR/empty-types.rs:609:9 | LL | _x if false => {} | ^^--------------- @@ -541,7 +541,7 @@ LL | _x if false => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error[E0004]: non-exhaustive patterns: `&_` not covered - --> $DIR/empty-types.rs:635:11 + --> $DIR/empty-types.rs:634:11 | LL | match ref_never { | ^^^^^^^^^ pattern `&_` not covered @@ -557,7 +557,7 @@ LL + &_ => todo!() | error[E0004]: non-exhaustive patterns: `Ok(_)` not covered - --> $DIR/empty-types.rs:651:11 + --> $DIR/empty-types.rs:650:11 | LL | match *ref_result_never { | ^^^^^^^^^^^^^^^^^ pattern `Ok(_)` not covered @@ -576,7 +576,7 @@ LL + Ok(_) => todo!() | error[E0004]: non-exhaustive patterns: `Some(_)` not covered - --> $DIR/empty-types.rs:671:11 + --> $DIR/empty-types.rs:670:11 | LL | match *x { | ^^ pattern `Some(_)` not covered diff --git a/tests/ui/pattern/usefulness/explain-unreachable-pats.stderr b/tests/ui/pattern/usefulness/explain-unreachable-pats.stderr index 8651be2055f53..a18454b2cf95a 100644 --- a/tests/ui/pattern/usefulness/explain-unreachable-pats.stderr +++ b/tests/ui/pattern/usefulness/explain-unreachable-pats.stderr @@ -1,5 +1,5 @@ error: unreachable pattern - --> $DIR/explain-unreachable-pats.rs:11:9 + --> $DIR/explain-unreachable-pats.rs:10:9 | LL | (1 | 2,) => {} | -------- matches all the relevant values @@ -8,19 +8,19 @@ LL | (2,) => {} | ^^^^ no value can reach this | note: the lint level is defined here - --> $DIR/explain-unreachable-pats.rs:3:9 + --> $DIR/explain-unreachable-pats.rs:2:9 | LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ error: unreachable pattern - --> $DIR/explain-unreachable-pats.rs:22:9 + --> $DIR/explain-unreachable-pats.rs:21:9 | LL | (1 | 2,) => {} | ^^^^^^^^ no value can reach this | note: multiple earlier patterns match some of the same values - --> $DIR/explain-unreachable-pats.rs:22:9 + --> $DIR/explain-unreachable-pats.rs:21:9 | LL | (1,) => {} | ---- matches some of the same values @@ -32,13 +32,13 @@ LL | (1 | 2,) => {} | ^^^^^^^^ collectively making this unreachable error: unreachable pattern - --> $DIR/explain-unreachable-pats.rs:41:9 + --> $DIR/explain-unreachable-pats.rs:40:9 | LL | 1 ..= 6 => {} | ^^^^^^^ no value can reach this | note: multiple earlier patterns match some of the same values - --> $DIR/explain-unreachable-pats.rs:41:9 + --> $DIR/explain-unreachable-pats.rs:40:9 | LL | 1 => {} | - matches some of the same values @@ -56,7 +56,7 @@ LL | 1 ..= 6 => {} | ^^^^^^^ ...and 2 other patterns collectively make this unreachable error: unreachable pattern - --> $DIR/explain-unreachable-pats.rs:52:9 + --> $DIR/explain-unreachable-pats.rs:51:9 | LL | Err(_) => {} | ^^^^^^------ @@ -67,7 +67,7 @@ LL | Err(_) => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/explain-unreachable-pats.rs:66:9 + --> $DIR/explain-unreachable-pats.rs:65:9 | LL | (Err(_), Err(_)) => {} | ^^^^^^^^^^^^^^^^------ @@ -78,7 +78,7 @@ LL | (Err(_), Err(_)) => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/explain-unreachable-pats.rs:73:9 + --> $DIR/explain-unreachable-pats.rs:72:9 | LL | (Err(_), Err(_)) => {} | ^^^^^^^^^^^^^^^^------ @@ -89,7 +89,7 @@ LL | (Err(_), Err(_)) => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/explain-unreachable-pats.rs:83:11 + --> $DIR/explain-unreachable-pats.rs:82:11 | LL | if let (0 | - matches all the relevant values @@ -98,13 +98,13 @@ LL | | 0, _) = (0, 0) {} | ^ no value can reach this error: unreachable pattern - --> $DIR/explain-unreachable-pats.rs:93:9 + --> $DIR/explain-unreachable-pats.rs:92:9 | LL | (_, true) => {} | ^^^^^^^^^ no value can reach this | note: multiple earlier patterns match some of the same values - --> $DIR/explain-unreachable-pats.rs:93:9 + --> $DIR/explain-unreachable-pats.rs:92:9 | LL | (true, _) => {} | --------- matches some of the same values @@ -116,7 +116,7 @@ LL | (_, true) => {} | ^^^^^^^^^ collectively making this unreachable error: unreachable pattern - --> $DIR/explain-unreachable-pats.rs:106:9 + --> $DIR/explain-unreachable-pats.rs:105:9 | LL | (true, _) => {} | --------- matches all the relevant values @@ -125,7 +125,7 @@ LL | (true, true) => {} | ^^^^^^^^^^^^ no value can reach this error: unreachable pattern - --> $DIR/explain-unreachable-pats.rs:118:9 + --> $DIR/explain-unreachable-pats.rs:117:9 | LL | (_, true, 0..10) => {} | ---------------- matches all the relevant values diff --git a/tests/ui/pattern/usefulness/impl-trait.stderr b/tests/ui/pattern/usefulness/impl-trait.stderr index 62045151968e2..6efa783cf63cb 100644 --- a/tests/ui/pattern/usefulness/impl-trait.stderr +++ b/tests/ui/pattern/usefulness/impl-trait.stderr @@ -1,5 +1,5 @@ error: unreachable pattern - --> $DIR/impl-trait.rs:17:13 + --> $DIR/impl-trait.rs:16:13 | LL | _ => {} | ^------ @@ -9,13 +9,13 @@ LL | _ => {} | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types note: the lint level is defined here - --> $DIR/impl-trait.rs:5:9 + --> $DIR/impl-trait.rs:4:9 | LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ error: unreachable pattern - --> $DIR/impl-trait.rs:32:13 + --> $DIR/impl-trait.rs:31:13 | LL | _ => {} | ^------ @@ -26,7 +26,7 @@ LL | _ => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/impl-trait.rs:46:13 + --> $DIR/impl-trait.rs:45:13 | LL | Some(_) => {} | ^^^^^^^------ @@ -37,7 +37,7 @@ LL | Some(_) => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/impl-trait.rs:50:13 + --> $DIR/impl-trait.rs:49:13 | LL | None => {} | ---- matches all the relevant values @@ -45,7 +45,7 @@ LL | _ => {} | ^ no value can reach this error: unreachable pattern - --> $DIR/impl-trait.rs:60:13 + --> $DIR/impl-trait.rs:59:13 | LL | Some(_) => {} | ^^^^^^^------ @@ -56,7 +56,7 @@ LL | Some(_) => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/impl-trait.rs:64:13 + --> $DIR/impl-trait.rs:63:13 | LL | None => {} | ---- matches all the relevant values @@ -64,7 +64,7 @@ LL | _ => {} | ^ no value can reach this error: unreachable pattern - --> $DIR/impl-trait.rs:77:9 + --> $DIR/impl-trait.rs:76:9 | LL | _ => {} | ^------ @@ -75,7 +75,7 @@ LL | _ => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/impl-trait.rs:87:9 + --> $DIR/impl-trait.rs:86:9 | LL | _ => {} | - matches any value @@ -83,7 +83,7 @@ LL | Some((a, b)) => {} | ^^^^^^^^^^^^ no value can reach this error: unreachable pattern - --> $DIR/impl-trait.rs:96:13 + --> $DIR/impl-trait.rs:95:13 | LL | _ => {} | ^------ @@ -94,7 +94,7 @@ LL | _ => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/impl-trait.rs:108:9 + --> $DIR/impl-trait.rs:107:9 | LL | Some((a, b)) => {} | ------------ matches all the relevant values @@ -102,7 +102,7 @@ LL | Some((mut x, mut y)) => { | ^^^^^^^^^^^^^^^^^^^^ no value can reach this error: unreachable pattern - --> $DIR/impl-trait.rs:128:13 + --> $DIR/impl-trait.rs:127:13 | LL | _ => {} | - matches any value @@ -110,7 +110,7 @@ LL | Rec { n: 0, w: Some(Rec { n: 0, w: _ }) } => {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no value can reach this error: unreachable pattern - --> $DIR/impl-trait.rs:143:13 + --> $DIR/impl-trait.rs:142:13 | LL | _ => {} | ^------ @@ -121,7 +121,7 @@ LL | _ => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/impl-trait.rs:157:13 + --> $DIR/impl-trait.rs:156:13 | LL | _ => {} | ^------ @@ -132,7 +132,7 @@ LL | _ => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error[E0004]: non-exhaustive patterns: type `impl Copy` is non-empty - --> $DIR/impl-trait.rs:23:11 + --> $DIR/impl-trait.rs:22:11 | LL | match return_never_rpit(x) {} | ^^^^^^^^^^^^^^^^^^^^ @@ -146,7 +146,7 @@ LL ~ } | error[E0004]: non-exhaustive patterns: type `T` is non-empty - --> $DIR/impl-trait.rs:38:11 + --> $DIR/impl-trait.rs:37:11 | LL | match return_never_tait(x) {} | ^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/pattern/usefulness/match-privately-empty.exhaustive_patterns.stderr b/tests/ui/pattern/usefulness/match-privately-empty.exhaustive_patterns.stderr index 463e104f970c4..fef7b67ad7ae5 100644 --- a/tests/ui/pattern/usefulness/match-privately-empty.exhaustive_patterns.stderr +++ b/tests/ui/pattern/usefulness/match-privately-empty.exhaustive_patterns.stderr @@ -1,5 +1,5 @@ error[E0004]: non-exhaustive patterns: `Some(Private { misc: true, .. })` not covered - --> $DIR/match-privately-empty.rs:14:11 + --> $DIR/match-privately-empty.rs:13:11 | LL | match private::DATA { | ^^^^^^^^^^^^^ pattern `Some(Private { misc: true, .. })` not covered diff --git a/tests/ui/pattern/usefulness/match-privately-empty.normal.stderr b/tests/ui/pattern/usefulness/match-privately-empty.normal.stderr index 463e104f970c4..fef7b67ad7ae5 100644 --- a/tests/ui/pattern/usefulness/match-privately-empty.normal.stderr +++ b/tests/ui/pattern/usefulness/match-privately-empty.normal.stderr @@ -1,5 +1,5 @@ error[E0004]: non-exhaustive patterns: `Some(Private { misc: true, .. })` not covered - --> $DIR/match-privately-empty.rs:14:11 + --> $DIR/match-privately-empty.rs:13:11 | LL | match private::DATA { | ^^^^^^^^^^^^^ pattern `Some(Private { misc: true, .. })` not covered diff --git a/tests/ui/pattern/usefulness/slice_of_empty.exhaustive_patterns.stderr b/tests/ui/pattern/usefulness/slice_of_empty.exhaustive_patterns.stderr index c4fcd67cfdbdc..f3b7fb0468cb3 100644 --- a/tests/ui/pattern/usefulness/slice_of_empty.exhaustive_patterns.stderr +++ b/tests/ui/pattern/usefulness/slice_of_empty.exhaustive_patterns.stderr @@ -1,5 +1,5 @@ error[E0004]: non-exhaustive patterns: `&[]` not covered - --> $DIR/slice_of_empty.rs:20:11 + --> $DIR/slice_of_empty.rs:19:11 | LL | match nevers { | ^^^^^^ pattern `&[]` not covered diff --git a/tests/ui/pattern/usefulness/slice_of_empty.normal.stderr b/tests/ui/pattern/usefulness/slice_of_empty.normal.stderr index c9afd1bfc9016..0b8125eba65d4 100644 --- a/tests/ui/pattern/usefulness/slice_of_empty.normal.stderr +++ b/tests/ui/pattern/usefulness/slice_of_empty.normal.stderr @@ -1,5 +1,5 @@ error[E0004]: non-exhaustive patterns: `&[_, ..]` not covered - --> $DIR/slice_of_empty.rs:9:11 + --> $DIR/slice_of_empty.rs:8:11 | LL | match nevers { | ^^^^^^ pattern `&[_, ..]` not covered @@ -13,7 +13,7 @@ LL ~ &[_, ..] => todo!(), | error[E0004]: non-exhaustive patterns: `&[]` and `&[_, _, ..]` not covered - --> $DIR/slice_of_empty.rs:20:11 + --> $DIR/slice_of_empty.rs:19:11 | LL | match nevers { | ^^^^^^ patterns `&[]` and `&[_, _, ..]` not covered diff --git a/tests/ui/raw-ref-op/never-place-isnt-diverging.stderr b/tests/ui/raw-ref-op/never-place-isnt-diverging.stderr index 0a8340545eb78..39c37b3cf70db 100644 --- a/tests/ui/raw-ref-op/never-place-isnt-diverging.stderr +++ b/tests/ui/raw-ref-op/never-place-isnt-diverging.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/never-place-isnt-diverging.rs:4:5 + --> $DIR/never-place-isnt-diverging.rs:2:5 | LL | fn make_up_a_value() -> T { | - expected this type parameter @@ -15,7 +15,7 @@ LL | | } found unit type `()` error[E0308]: mismatched types - --> $DIR/never-place-isnt-diverging.rs:17:9 + --> $DIR/never-place-isnt-diverging.rs:15:9 | LL | fn make_up_a_pointer() -> *const T { | - -------- expected `*const T` because of return type diff --git a/tests/ui/reachable/expr_add.stderr b/tests/ui/reachable/expr_add.stderr index f4a56fcbcb2cc..a54e3275334ea 100644 --- a/tests/ui/reachable/expr_add.stderr +++ b/tests/ui/reachable/expr_add.stderr @@ -1,5 +1,5 @@ error: unreachable expression - --> $DIR/expr_add.rs:17:13 + --> $DIR/expr_add.rs:16:13 | LL | let x = Foo + return; | ^^^^^^------ @@ -8,7 +8,7 @@ LL | let x = Foo + return; | unreachable expression | note: the lint level is defined here - --> $DIR/expr_add.rs:3:9 + --> $DIR/expr_add.rs:2:9 | LL | #![deny(unreachable_code)] | ^^^^^^^^^^^^^^^^ diff --git a/tests/ui/reachable/expr_assign.stderr b/tests/ui/reachable/expr_assign.stderr index cfbbe04db769d..c1a918ffb9f52 100644 --- a/tests/ui/reachable/expr_assign.stderr +++ b/tests/ui/reachable/expr_assign.stderr @@ -1,5 +1,5 @@ error: unreachable expression - --> $DIR/expr_assign.rs:10:5 + --> $DIR/expr_assign.rs:9:5 | LL | x = return; | ^^^^------ @@ -8,13 +8,13 @@ LL | x = return; | unreachable expression | note: the lint level is defined here - --> $DIR/expr_assign.rs:5:9 + --> $DIR/expr_assign.rs:4:9 | LL | #![deny(unreachable_code)] | ^^^^^^^^^^^^^^^^ error: unreachable expression - --> $DIR/expr_assign.rs:20:9 + --> $DIR/expr_assign.rs:19:9 | LL | *p = return; | ^^^^^------ @@ -23,7 +23,7 @@ LL | *p = return; | unreachable expression error: unreachable expression - --> $DIR/expr_assign.rs:26:15 + --> $DIR/expr_assign.rs:25:15 | LL | *{return; &mut i} = 22; | ------ ^^^^^^ unreachable expression diff --git a/tests/ui/reachable/expr_call.stderr b/tests/ui/reachable/expr_call.stderr index a5ad9a329f06e..2d7675bbadc40 100644 --- a/tests/ui/reachable/expr_call.stderr +++ b/tests/ui/reachable/expr_call.stderr @@ -1,5 +1,5 @@ error: unreachable expression - --> $DIR/expr_call.rs:13:17 + --> $DIR/expr_call.rs:12:17 | LL | foo(return, 22); | ------ ^^ unreachable expression @@ -7,13 +7,13 @@ LL | foo(return, 22); | any code following this expression is unreachable | note: the lint level is defined here - --> $DIR/expr_call.rs:5:9 + --> $DIR/expr_call.rs:4:9 | LL | #![deny(unreachable_code)] | ^^^^^^^^^^^^^^^^ error: unreachable call - --> $DIR/expr_call.rs:18:5 + --> $DIR/expr_call.rs:17:5 | LL | bar(return); | ^^^ ------ any code following this expression is unreachable diff --git a/tests/ui/reachable/expr_method.stderr b/tests/ui/reachable/expr_method.stderr index 41c3b8a39060f..1bf797ec06307 100644 --- a/tests/ui/reachable/expr_method.stderr +++ b/tests/ui/reachable/expr_method.stderr @@ -1,5 +1,5 @@ error: unreachable expression - --> $DIR/expr_method.rs:16:21 + --> $DIR/expr_method.rs:15:21 | LL | Foo.foo(return, 22); | ------ ^^ unreachable expression @@ -7,13 +7,13 @@ LL | Foo.foo(return, 22); | any code following this expression is unreachable | note: the lint level is defined here - --> $DIR/expr_method.rs:5:9 + --> $DIR/expr_method.rs:4:9 | LL | #![deny(unreachable_code)] | ^^^^^^^^^^^^^^^^ error: unreachable call - --> $DIR/expr_method.rs:21:9 + --> $DIR/expr_method.rs:20:9 | LL | Foo.bar(return); | ^^^ ------ any code following this expression is unreachable diff --git a/tests/ui/reachable/expr_unary.stderr b/tests/ui/reachable/expr_unary.stderr index 7deca1b86021e..af4a1cce15b19 100644 --- a/tests/ui/reachable/expr_unary.stderr +++ b/tests/ui/reachable/expr_unary.stderr @@ -1,11 +1,11 @@ error[E0614]: type `!` cannot be dereferenced - --> $DIR/expr_unary.rs:8:16 + --> $DIR/expr_unary.rs:7:16 | LL | let x: ! = * { return; }; | ^^^^^^^^^^^^^ can't be dereferenced error: unreachable expression - --> $DIR/expr_unary.rs:8:16 + --> $DIR/expr_unary.rs:7:16 | LL | let x: ! = * { return; }; | ^^^^------^^^ @@ -14,7 +14,7 @@ LL | let x: ! = * { return; }; | unreachable expression | note: the lint level is defined here - --> $DIR/expr_unary.rs:5:9 + --> $DIR/expr_unary.rs:4:9 | LL | #![deny(unreachable_code)] | ^^^^^^^^^^^^^^^^ diff --git a/tests/ui/reachable/guard_read_for_never.rs b/tests/ui/reachable/guard_read_for_never.rs index 763dfd354b586..3af5ecd9896d6 100644 --- a/tests/ui/reachable/guard_read_for_never.rs +++ b/tests/ui/reachable/guard_read_for_never.rs @@ -1,7 +1,7 @@ // Regression test for // //@ check-pass -#![feature(guard_patterns, never_type)] +#![feature(guard_patterns)] #![expect(incomplete_features)] #![deny(unreachable_code)] diff --git a/tests/ui/reachable/never-assign-dead-code.stderr b/tests/ui/reachable/never-assign-dead-code.stderr index 5660bde5c279b..521b82023c93b 100644 --- a/tests/ui/reachable/never-assign-dead-code.stderr +++ b/tests/ui/reachable/never-assign-dead-code.stderr @@ -1,5 +1,5 @@ warning: unreachable statement - --> $DIR/never-assign-dead-code.rs:11:5 + --> $DIR/never-assign-dead-code.rs:10:5 | LL | let x: ! = panic!("aah"); | ------------- any code following this expression is unreachable @@ -7,14 +7,14 @@ LL | drop(x); | ^^^^^^^^ unreachable statement | note: the lint level is defined here - --> $DIR/never-assign-dead-code.rs:7:9 + --> $DIR/never-assign-dead-code.rs:6:9 | LL | #![warn(unused)] | ^^^^^^ = note: `#[warn(unreachable_code)]` implied by `#[warn(unused)]` warning: unreachable call - --> $DIR/never-assign-dead-code.rs:11:5 + --> $DIR/never-assign-dead-code.rs:10:5 | LL | drop(x); | ^^^^ - any code following this expression is unreachable @@ -22,7 +22,7 @@ LL | drop(x); | unreachable call warning: unused variable: `x` - --> $DIR/never-assign-dead-code.rs:10:9 + --> $DIR/never-assign-dead-code.rs:9:9 | LL | let x: ! = panic!("aah"); | ^ help: if this is intentional, prefix it with an underscore: `_x` diff --git a/tests/ui/reachable/unwarned-match-on-never.stderr b/tests/ui/reachable/unwarned-match-on-never.stderr index a296d2a055e09..472f349947458 100644 --- a/tests/ui/reachable/unwarned-match-on-never.stderr +++ b/tests/ui/reachable/unwarned-match-on-never.stderr @@ -1,5 +1,5 @@ error: unreachable expression - --> $DIR/unwarned-match-on-never.rs:10:5 + --> $DIR/unwarned-match-on-never.rs:8:5 | LL | match x {} | - any code following this expression is unreachable @@ -14,7 +14,7 @@ LL | #![deny(unreachable_code)] | ^^^^^^^^^^^^^^^^ error: unreachable arm - --> $DIR/unwarned-match-on-never.rs:15:15 + --> $DIR/unwarned-match-on-never.rs:13:15 | LL | match (return) { | -------- any code following this expression is unreachable @@ -22,7 +22,7 @@ LL | () => () | ^^ unreachable arm error: unreachable expression - --> $DIR/unwarned-match-on-never.rs:21:5 + --> $DIR/unwarned-match-on-never.rs:19:5 | LL | return; | ------ any code following this expression is unreachable diff --git a/tests/ui/rfcs/rfc-0000-never_patterns/ICE-133063-never-arm-no-otherwise-block.stderr b/tests/ui/rfcs/rfc-0000-never_patterns/ICE-133063-never-arm-no-otherwise-block.stderr index cc451fed31805..adaaf2b35585f 100644 --- a/tests/ui/rfcs/rfc-0000-never_patterns/ICE-133063-never-arm-no-otherwise-block.stderr +++ b/tests/ui/rfcs/rfc-0000-never_patterns/ICE-133063-never-arm-no-otherwise-block.stderr @@ -1,5 +1,5 @@ error: a never pattern is always unreachable - --> $DIR/ICE-133063-never-arm-no-otherwise-block.rs:10:31 + --> $DIR/ICE-133063-never-arm-no-otherwise-block.rs:9:31 | LL | (!|!) if false => {} | ^^ diff --git a/tests/ui/rfcs/rfc-0000-never_patterns/ICE-133117-duplicate-never-arm.stderr b/tests/ui/rfcs/rfc-0000-never_patterns/ICE-133117-duplicate-never-arm.stderr index 5da9642dc1998..7b8ac6dc05fea 100644 --- a/tests/ui/rfcs/rfc-0000-never_patterns/ICE-133117-duplicate-never-arm.stderr +++ b/tests/ui/rfcs/rfc-0000-never_patterns/ICE-133117-duplicate-never-arm.stderr @@ -1,5 +1,5 @@ error: a never pattern is always unreachable - --> $DIR/ICE-133117-duplicate-never-arm.rs:9:26 + --> $DIR/ICE-133117-duplicate-never-arm.rs:8:26 | LL | (!|!) if true => {} | ^^ @@ -8,7 +8,7 @@ LL | (!|!) if true => {} | help: remove this expression error: a never pattern is always unreachable - --> $DIR/ICE-133117-duplicate-never-arm.rs:10:26 + --> $DIR/ICE-133117-duplicate-never-arm.rs:9:26 | LL | (!|!) if true => {} | ^^ diff --git a/tests/ui/rfcs/rfc-0000-never_patterns/never-pattern-is-a-read.stderr b/tests/ui/rfcs/rfc-0000-never_patterns/never-pattern-is-a-read.stderr index c415e26f6e277..5f8de55fc376d 100644 --- a/tests/ui/rfcs/rfc-0000-never_patterns/never-pattern-is-a-read.stderr +++ b/tests/ui/rfcs/rfc-0000-never_patterns/never-pattern-is-a-read.stderr @@ -1,5 +1,5 @@ error[E0133]: access to union field is unsafe and requires unsafe function or block - --> $DIR/never-pattern-is-a-read.rs:11:16 + --> $DIR/never-pattern-is-a-read.rs:10:16 | LL | let U { a: ! } = u; | ^ access to union field diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/coercions.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/coercions.stderr index c209caab5ecb6..7af8133ba2a94 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/coercions.stderr +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/coercions.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/coercions.rs:23:5 + --> $DIR/coercions.rs:22:5 | LL | fn cannot_coerce_empty_enum_to_anything(x: UninhabitedEnum) -> A { | - expected `A` because of return type @@ -7,7 +7,7 @@ LL | x | ^ expected `A`, found `UninhabitedEnum` error[E0308]: mismatched types - --> $DIR/coercions.rs:27:5 + --> $DIR/coercions.rs:26:5 | LL | fn cannot_coerce_empty_tuple_struct_to_anything(x: UninhabitedTupleStruct) -> A { | - expected `A` because of return type @@ -15,7 +15,7 @@ LL | x | ^ expected `A`, found `UninhabitedTupleStruct` error[E0308]: mismatched types - --> $DIR/coercions.rs:31:5 + --> $DIR/coercions.rs:30:5 | LL | fn cannot_coerce_empty_struct_to_anything(x: UninhabitedStruct) -> A { | - expected `A` because of return type @@ -23,7 +23,7 @@ LL | x | ^ expected `A`, found `UninhabitedStruct` error[E0308]: mismatched types - --> $DIR/coercions.rs:35:5 + --> $DIR/coercions.rs:34:5 | LL | fn cannot_coerce_enum_with_empty_variants_to_anything(x: UninhabitedVariants) -> A { | - expected `A` because of return type diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/coercions_same_crate.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/coercions_same_crate.stderr index 289433edf6292..8c9c15e5adafd 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/coercions_same_crate.stderr +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/coercions_same_crate.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/coercions_same_crate.rs:30:5 + --> $DIR/coercions_same_crate.rs:28:5 | LL | fn cannot_coerce_empty_enum_to_anything(x: UninhabitedEnum) -> A { | - expected `A` because of return type @@ -7,7 +7,7 @@ LL | x | ^ expected `A`, found `UninhabitedEnum` error[E0308]: mismatched types - --> $DIR/coercions_same_crate.rs:34:5 + --> $DIR/coercions_same_crate.rs:32:5 | LL | fn cannot_coerce_empty_tuple_struct_to_anything(x: UninhabitedTupleStruct) -> A { | - expected `A` because of return type @@ -15,7 +15,7 @@ LL | x | ^ expected `A`, found `UninhabitedTupleStruct` error[E0308]: mismatched types - --> $DIR/coercions_same_crate.rs:38:5 + --> $DIR/coercions_same_crate.rs:36:5 | LL | fn cannot_coerce_empty_struct_to_anything(x: UninhabitedStruct) -> A { | - expected `A` because of return type @@ -23,7 +23,7 @@ LL | x | ^ expected `A`, found `UninhabitedStruct` error[E0308]: mismatched types - --> $DIR/coercions_same_crate.rs:42:5 + --> $DIR/coercions_same_crate.rs:40:5 | LL | fn cannot_coerce_enum_with_empty_variants_to_anything(x: UninhabitedVariants) -> A { | - expected `A` because of return type diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/indirect_match.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/indirect_match.stderr index f332e6deeb82c..0a20b615f7eb8 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/indirect_match.stderr +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/indirect_match.stderr @@ -1,11 +1,11 @@ error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedEnum` is non-empty - --> $DIR/indirect_match.rs:19:11 + --> $DIR/indirect_match.rs:18:11 | LL | match x {} | ^ | note: `IndirectUninhabitedEnum` defined here - --> $DIR/auxiliary/uninhabited.rs:32:1 + --> $DIR/auxiliary/uninhabited.rs:31:1 | LL | pub struct IndirectUninhabitedEnum(UninhabitedEnum); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -18,13 +18,13 @@ LL ~ } | error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedStruct` is non-empty - --> $DIR/indirect_match.rs:23:11 + --> $DIR/indirect_match.rs:22:11 | LL | match x {} | ^ | note: `IndirectUninhabitedStruct` defined here - --> $DIR/auxiliary/uninhabited.rs:34:1 + --> $DIR/auxiliary/uninhabited.rs:33:1 | LL | pub struct IndirectUninhabitedStruct(UninhabitedStruct); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -37,13 +37,13 @@ LL ~ } | error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedTupleStruct` is non-empty - --> $DIR/indirect_match.rs:27:11 + --> $DIR/indirect_match.rs:26:11 | LL | match x {} | ^ | note: `IndirectUninhabitedTupleStruct` defined here - --> $DIR/auxiliary/uninhabited.rs:36:1 + --> $DIR/auxiliary/uninhabited.rs:35:1 | LL | pub struct IndirectUninhabitedTupleStruct(UninhabitedTupleStruct); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -56,13 +56,13 @@ LL ~ } | error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedVariants` is non-empty - --> $DIR/indirect_match.rs:33:11 + --> $DIR/indirect_match.rs:32:11 | LL | match x {} | ^ | note: `IndirectUninhabitedVariants` defined here - --> $DIR/auxiliary/uninhabited.rs:38:1 + --> $DIR/auxiliary/uninhabited.rs:37:1 | LL | pub struct IndirectUninhabitedVariants(UninhabitedVariants); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/indirect_match_with_exhaustive_patterns.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/indirect_match_with_exhaustive_patterns.stderr index 48f3857bfa7f8..af95c5bcf456e 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/indirect_match_with_exhaustive_patterns.stderr +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/indirect_match_with_exhaustive_patterns.stderr @@ -1,11 +1,11 @@ error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedEnum` is non-empty - --> $DIR/indirect_match_with_exhaustive_patterns.rs:22:11 + --> $DIR/indirect_match_with_exhaustive_patterns.rs:21:11 | LL | match x {} | ^ | note: `IndirectUninhabitedEnum` defined here - --> $DIR/auxiliary/uninhabited.rs:32:1 + --> $DIR/auxiliary/uninhabited.rs:31:1 | LL | pub struct IndirectUninhabitedEnum(UninhabitedEnum); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -18,13 +18,13 @@ LL ~ } | error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedStruct` is non-empty - --> $DIR/indirect_match_with_exhaustive_patterns.rs:26:11 + --> $DIR/indirect_match_with_exhaustive_patterns.rs:25:11 | LL | match x {} | ^ | note: `IndirectUninhabitedStruct` defined here - --> $DIR/auxiliary/uninhabited.rs:34:1 + --> $DIR/auxiliary/uninhabited.rs:33:1 | LL | pub struct IndirectUninhabitedStruct(UninhabitedStruct); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -37,13 +37,13 @@ LL ~ } | error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedTupleStruct` is non-empty - --> $DIR/indirect_match_with_exhaustive_patterns.rs:30:11 + --> $DIR/indirect_match_with_exhaustive_patterns.rs:29:11 | LL | match x {} | ^ | note: `IndirectUninhabitedTupleStruct` defined here - --> $DIR/auxiliary/uninhabited.rs:36:1 + --> $DIR/auxiliary/uninhabited.rs:35:1 | LL | pub struct IndirectUninhabitedTupleStruct(UninhabitedTupleStruct); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -56,13 +56,13 @@ LL ~ } | error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedVariants` is non-empty - --> $DIR/indirect_match_with_exhaustive_patterns.rs:36:11 + --> $DIR/indirect_match_with_exhaustive_patterns.rs:35:11 | LL | match x {} | ^ | note: `IndirectUninhabitedVariants` defined here - --> $DIR/auxiliary/uninhabited.rs:38:1 + --> $DIR/auxiliary/uninhabited.rs:37:1 | LL | pub struct IndirectUninhabitedVariants(UninhabitedVariants); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/issue-65157-repeated-match-arm.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/issue-65157-repeated-match-arm.stderr index 86df9ef9b564c..5436cd9e48331 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/issue-65157-repeated-match-arm.stderr +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/issue-65157-repeated-match-arm.stderr @@ -1,5 +1,5 @@ error: unreachable pattern - --> $DIR/issue-65157-repeated-match-arm.rs:15:9 + --> $DIR/issue-65157-repeated-match-arm.rs:14:9 | LL | PartiallyInhabitedVariants::Struct { .. } => {} | ----------------------------------------- matches all the relevant values diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match.stderr index 0232e7106aab7..8dae46b4d7e9f 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match.stderr +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match.stderr @@ -1,11 +1,11 @@ error[E0004]: non-exhaustive patterns: type `uninhabited::UninhabitedEnum` is non-empty - --> $DIR/match.rs:14:11 + --> $DIR/match.rs:13:11 | LL | match x {} | ^ | note: `uninhabited::UninhabitedEnum` defined here - --> $DIR/auxiliary/uninhabited.rs:5:1 + --> $DIR/auxiliary/uninhabited.rs:4:1 | LL | pub enum UninhabitedEnum { | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -18,13 +18,13 @@ LL ~ } | error[E0004]: non-exhaustive patterns: type `uninhabited::PrivatelyUninhabitedStruct` is non-empty - --> $DIR/match.rs:22:11 + --> $DIR/match.rs:21:11 | LL | match x {} | ^ | note: `uninhabited::PrivatelyUninhabitedStruct` defined here - --> $DIR/auxiliary/uninhabited.rs:15:1 + --> $DIR/auxiliary/uninhabited.rs:14:1 | LL | pub struct PrivatelyUninhabitedStruct { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr index d6f0bc724a98d..a3d20abbb37b2 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr @@ -1,11 +1,11 @@ error[E0004]: non-exhaustive patterns: type `UninhabitedEnum` is non-empty - --> $DIR/match_with_exhaustive_patterns.rs:17:11 + --> $DIR/match_with_exhaustive_patterns.rs:16:11 | LL | match x {} | ^ | note: `UninhabitedEnum` defined here - --> $DIR/auxiliary/uninhabited.rs:5:1 + --> $DIR/auxiliary/uninhabited.rs:4:1 | LL | pub enum UninhabitedEnum { | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/patterns_same_crate.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/patterns_same_crate.stderr index bd70a7b409149..cea452d034d2b 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/patterns_same_crate.stderr +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/patterns_same_crate.stderr @@ -1,5 +1,5 @@ error: unreachable pattern - --> $DIR/patterns_same_crate.rs:53:9 + --> $DIR/patterns_same_crate.rs:52:9 | LL | Some(_x) => (), | ^^^^^^^^------- @@ -15,7 +15,7 @@ LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ error: unreachable pattern - --> $DIR/patterns_same_crate.rs:58:9 + --> $DIR/patterns_same_crate.rs:57:9 | LL | Some(_x) => (), | ^^^^^^^^------- @@ -26,7 +26,7 @@ LL | Some(_x) => (), = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/patterns_same_crate.rs:62:15 + --> $DIR/patterns_same_crate.rs:61:15 | LL | while let PartiallyInhabitedVariants::Struct { x } = partially_inhabited_variant() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ matches no values because `!` is uninhabited @@ -34,7 +34,7 @@ LL | while let PartiallyInhabitedVariants::Struct { x } = partially_inhabite = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/patterns_same_crate.rs:66:15 + --> $DIR/patterns_same_crate.rs:65:15 | LL | while let Some(_x) = uninhabited_struct() { | ^^^^^^^^ matches no values because `UninhabitedStruct` is uninhabited @@ -42,7 +42,7 @@ LL | while let Some(_x) = uninhabited_struct() { = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/patterns_same_crate.rs:69:15 + --> $DIR/patterns_same_crate.rs:68:15 | LL | while let Some(_x) = uninhabited_tuple_struct() { | ^^^^^^^^ matches no values because `UninhabitedTupleStruct` is uninhabited diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/protect-precedences.rs b/tests/ui/rfcs/rfc-2497-if-let-chains/protect-precedences.rs index 59a29446f8f02..533f91dba15d2 100644 --- a/tests/ui/rfcs/rfc-2497-if-let-chains/protect-precedences.rs +++ b/tests/ui/rfcs/rfc-2497-if-let-chains/protect-precedences.rs @@ -12,6 +12,7 @@ fn main() { // Should associate as `(let _ = (return (true && false)))`. if let _ = return true && false {}; //~^ WARNING unreachable block in `if` + //~| WARNING unreachable pattern } assert!(!_f1()); } diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/protect-precedences.stderr b/tests/ui/rfcs/rfc-2497-if-let-chains/protect-precedences.stderr index 689ccb4bc9a86..639af45532b63 100644 --- a/tests/ui/rfcs/rfc-2497-if-let-chains/protect-precedences.stderr +++ b/tests/ui/rfcs/rfc-2497-if-let-chains/protect-precedences.stderr @@ -8,5 +8,14 @@ LL | if let _ = return true && false {}; | = note: `#[warn(unreachable_code)]` (part of `#[warn(unused)]`) on by default -warning: 1 warning emitted +warning: unreachable pattern + --> $DIR/protect-precedences.rs:13:16 + | +LL | if let _ = return true && false {}; + | ^ matches no values because `!` is uninhabited + | + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types + = note: `#[warn(unreachable_patterns)]` (part of `#[warn(unused)]`) on by default + +warning: 2 warnings emitted diff --git a/tests/ui/scalable-vectors/illformed-element-type.rs b/tests/ui/scalable-vectors/illformed-element-type.rs index ce406cb5f725b..ef87c98ebfae5 100644 --- a/tests/ui/scalable-vectors/illformed-element-type.rs +++ b/tests/ui/scalable-vectors/illformed-element-type.rs @@ -6,7 +6,9 @@ struct Foo; enum Bar {} -union Baz { x: u16 } +union Baz { + x: u16, +} extern "C" { type Qux; } diff --git a/tests/ui/scalable-vectors/illformed-element-type.stderr b/tests/ui/scalable-vectors/illformed-element-type.stderr index 52a4346570702..36497207f4186 100644 --- a/tests/ui/scalable-vectors/illformed-element-type.stderr +++ b/tests/ui/scalable-vectors/illformed-element-type.stderr @@ -1,5 +1,5 @@ error: element type of a scalable vector must be a primitive scalar - --> $DIR/illformed-element-type.rs:16:1 + --> $DIR/illformed-element-type.rs:17:1 | LL | struct TyChar(char); | ^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | struct TyChar(char); = help: only `u*`, `i*`, `f*` and `bool` types are accepted error: element type of a scalable vector must be a primitive scalar - --> $DIR/illformed-element-type.rs:20:1 + --> $DIR/illformed-element-type.rs:21:1 | LL | struct TyConstPtr(*const u8); | ^^^^^^^^^^^^^^^^^ @@ -15,7 +15,7 @@ LL | struct TyConstPtr(*const u8); = help: only `u*`, `i*`, `f*` and `bool` types are accepted error: element type of a scalable vector must be a primitive scalar - --> $DIR/illformed-element-type.rs:24:1 + --> $DIR/illformed-element-type.rs:25:1 | LL | struct TyMutPtr(*mut u8); | ^^^^^^^^^^^^^^^ @@ -23,7 +23,7 @@ LL | struct TyMutPtr(*mut u8); = help: only `u*`, `i*`, `f*` and `bool` types are accepted error: element type of a scalable vector must be a primitive scalar - --> $DIR/illformed-element-type.rs:28:1 + --> $DIR/illformed-element-type.rs:29:1 | LL | struct TyStruct(Foo); | ^^^^^^^^^^^^^^^ @@ -31,7 +31,7 @@ LL | struct TyStruct(Foo); = help: only `u*`, `i*`, `f*` and `bool` types are accepted error: element type of a scalable vector must be a primitive scalar - --> $DIR/illformed-element-type.rs:32:1 + --> $DIR/illformed-element-type.rs:33:1 | LL | struct TyEnum(Bar); | ^^^^^^^^^^^^^ @@ -39,7 +39,7 @@ LL | struct TyEnum(Bar); = help: only `u*`, `i*`, `f*` and `bool` types are accepted error: element type of a scalable vector must be a primitive scalar - --> $DIR/illformed-element-type.rs:36:1 + --> $DIR/illformed-element-type.rs:37:1 | LL | struct TyUnion(Baz); | ^^^^^^^^^^^^^^ @@ -47,7 +47,7 @@ LL | struct TyUnion(Baz); = help: only `u*`, `i*`, `f*` and `bool` types are accepted error: element type of a scalable vector must be a primitive scalar - --> $DIR/illformed-element-type.rs:40:1 + --> $DIR/illformed-element-type.rs:41:1 | LL | struct TyForeign(Qux); | ^^^^^^^^^^^^^^^^ @@ -55,7 +55,7 @@ LL | struct TyForeign(Qux); = help: only `u*`, `i*`, `f*` and `bool` types are accepted error: element type of a scalable vector must be a primitive scalar - --> $DIR/illformed-element-type.rs:44:1 + --> $DIR/illformed-element-type.rs:45:1 | LL | struct TyArray([u32; 4]); | ^^^^^^^^^^^^^^ @@ -63,7 +63,7 @@ LL | struct TyArray([u32; 4]); = help: only `u*`, `i*`, `f*` and `bool` types are accepted error: element type of a scalable vector must be a primitive scalar - --> $DIR/illformed-element-type.rs:48:1 + --> $DIR/illformed-element-type.rs:49:1 | LL | struct TySlice([u32]); | ^^^^^^^^^^^^^^ @@ -71,7 +71,7 @@ LL | struct TySlice([u32]); = help: only `u*`, `i*`, `f*` and `bool` types are accepted error: element type of a scalable vector must be a primitive scalar - --> $DIR/illformed-element-type.rs:52:1 + --> $DIR/illformed-element-type.rs:53:1 | LL | struct TyRef<'a>(&'a u32); | ^^^^^^^^^^^^^^^^ @@ -79,7 +79,7 @@ LL | struct TyRef<'a>(&'a u32); = help: only `u*`, `i*`, `f*` and `bool` types are accepted error: element type of a scalable vector must be a primitive scalar - --> $DIR/illformed-element-type.rs:56:1 + --> $DIR/illformed-element-type.rs:57:1 | LL | struct TyFnPtr(fn(u32) -> u32); | ^^^^^^^^^^^^^^ @@ -87,7 +87,7 @@ LL | struct TyFnPtr(fn(u32) -> u32); = help: only `u*`, `i*`, `f*` and `bool` types are accepted error: element type of a scalable vector must be a primitive scalar - --> $DIR/illformed-element-type.rs:60:1 + --> $DIR/illformed-element-type.rs:61:1 | LL | struct TyDyn(dyn std::io::Write); | ^^^^^^^^^^^^ @@ -95,7 +95,7 @@ LL | struct TyDyn(dyn std::io::Write); = help: only `u*`, `i*`, `f*` and `bool` types are accepted error: element type of a scalable vector must be a primitive scalar - --> $DIR/illformed-element-type.rs:64:1 + --> $DIR/illformed-element-type.rs:65:1 | LL | struct TyNever(!); | ^^^^^^^^^^^^^^ @@ -103,7 +103,7 @@ LL | struct TyNever(!); = help: only `u*`, `i*`, `f*` and `bool` types are accepted error: element type of a scalable vector must be a primitive scalar - --> $DIR/illformed-element-type.rs:68:1 + --> $DIR/illformed-element-type.rs:69:1 | LL | struct TyTuple((u32, u32)); | ^^^^^^^^^^^^^^ @@ -111,7 +111,7 @@ LL | struct TyTuple((u32, u32)); = help: only `u*`, `i*`, `f*` and `bool` types are accepted error: element type of a scalable vector must be a primitive scalar - --> $DIR/illformed-element-type.rs:78:1 + --> $DIR/illformed-element-type.rs:79:1 | LL | struct TyInvalidAlias(InvalidAlias); | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/self/dispatch_from_dyn_zst.rs b/tests/ui/self/dispatch_from_dyn_zst.rs index d3c32b57519fb..3d655165be2d6 100644 --- a/tests/ui/self/dispatch_from_dyn_zst.rs +++ b/tests/ui/self/dispatch_from_dyn_zst.rs @@ -1,6 +1,6 @@ //@ run-pass -#![feature(unsize, dispatch_from_dyn, never_type)] +#![feature(unsize, dispatch_from_dyn)] #![allow(dead_code)] diff --git a/tests/ui/sized-hierarchy/impls.rs b/tests/ui/sized-hierarchy/impls.rs index 643f7bc7c46cb..6b6089243c3fd 100644 --- a/tests/ui/sized-hierarchy/impls.rs +++ b/tests/ui/sized-hierarchy/impls.rs @@ -3,7 +3,7 @@ #![allow(incomplete_features, internal_features)] #![feature(sized_hierarchy)] -#![feature(coroutines, extern_types, f16, never_type, unsized_fn_params)] +#![feature(coroutines, extern_types, f16, unsized_fn_params)] use std::fmt::Debug; use std::marker::{MetaSized, PointeeSized}; diff --git a/tests/ui/stability-attribute/stability-attribute-trait-impl.rs b/tests/ui/stability-attribute/stability-attribute-trait-impl.rs index 880000ee7a434..2ef6ec81a56c5 100644 --- a/tests/ui/stability-attribute/stability-attribute-trait-impl.rs +++ b/tests/ui/stability-attribute/stability-attribute-trait-impl.rs @@ -1,4 +1,4 @@ -#![feature(staged_api, never_type, rust_cold_cc)] +#![feature(staged_api, rust_cold_cc)] //~^ ERROR module has missing stability attribute #[stable(feature = "a", since = "3.3.3")] diff --git a/tests/ui/stability-attribute/stability-attribute-trait-impl.stderr b/tests/ui/stability-attribute/stability-attribute-trait-impl.stderr index c954282cbc7a2..1f6762795e618 100644 --- a/tests/ui/stability-attribute/stability-attribute-trait-impl.stderr +++ b/tests/ui/stability-attribute/stability-attribute-trait-impl.stderr @@ -18,7 +18,7 @@ LL | #[unstable(feature = "k", issue = "none")] error: module has missing stability attribute --> $DIR/stability-attribute-trait-impl.rs:1:1 | -LL | / #![feature(staged_api, never_type, rust_cold_cc)] +LL | / #![feature(staged_api, rust_cold_cc)] LL | | LL | | LL | | #[stable(feature = "a", since = "3.3.3")] diff --git a/tests/ui/statics/uninhabited-static.stderr b/tests/ui/statics/uninhabited-static.stderr index ccfb98a74f4a4..6805bb5b76abb 100644 --- a/tests/ui/statics/uninhabited-static.stderr +++ b/tests/ui/statics/uninhabited-static.stderr @@ -1,5 +1,5 @@ error: static of uninhabited type - --> $DIR/uninhabited-static.rs:11:1 + --> $DIR/uninhabited-static.rs:9:1 | LL | static VOID2: Void = unsafe { std::mem::transmute(()) }; | ^^^^^^^^^^^^^^^^^^ @@ -10,7 +10,7 @@ LL | static VOID2: Void = unsafe { std::mem::transmute(()) }; = note: `#[deny(uninhabited_static)]` (part of `#[deny(future_incompatible)]`) on by default error: static of uninhabited type - --> $DIR/uninhabited-static.rs:14:1 + --> $DIR/uninhabited-static.rs:12:1 | LL | static NEVER2: Void = unsafe { std::mem::transmute(()) }; | ^^^^^^^^^^^^^^^^^^^ @@ -20,7 +20,7 @@ LL | static NEVER2: Void = unsafe { std::mem::transmute(()) }; = note: for more information, see issue #74840 error: static of uninhabited type - --> $DIR/uninhabited-static.rs:5:5 + --> $DIR/uninhabited-static.rs:3:5 | LL | static VOID: Void; | ^^^^^^^^^^^^^^^^^ @@ -30,7 +30,7 @@ LL | static VOID: Void; = note: for more information, see issue #74840 error: static of uninhabited type - --> $DIR/uninhabited-static.rs:7:5 + --> $DIR/uninhabited-static.rs:5:5 | LL | static NEVER: !; | ^^^^^^^^^^^^^^^ @@ -40,13 +40,13 @@ LL | static NEVER: !; = note: for more information, see issue #74840 error[E0080]: constructing invalid value of type Void: encountered a value of uninhabited type `Void` - --> $DIR/uninhabited-static.rs:11:31 + --> $DIR/uninhabited-static.rs:9:31 | LL | static VOID2: Void = unsafe { std::mem::transmute(()) }; | ^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `VOID2` failed here error[E0080]: constructing invalid value of type Void: encountered a value of uninhabited type `Void` - --> $DIR/uninhabited-static.rs:14:32 + --> $DIR/uninhabited-static.rs:12:32 | LL | static NEVER2: Void = unsafe { std::mem::transmute(()) }; | ^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `NEVER2` failed here @@ -56,7 +56,7 @@ error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0080`. Future incompatibility report: Future breakage diagnostic: error: static of uninhabited type - --> $DIR/uninhabited-static.rs:11:1 + --> $DIR/uninhabited-static.rs:9:1 | LL | static VOID2: Void = unsafe { std::mem::transmute(()) }; | ^^^^^^^^^^^^^^^^^^ @@ -68,7 +68,7 @@ LL | static VOID2: Void = unsafe { std::mem::transmute(()) }; Future breakage diagnostic: error: static of uninhabited type - --> $DIR/uninhabited-static.rs:14:1 + --> $DIR/uninhabited-static.rs:12:1 | LL | static NEVER2: Void = unsafe { std::mem::transmute(()) }; | ^^^^^^^^^^^^^^^^^^^ @@ -80,7 +80,7 @@ LL | static NEVER2: Void = unsafe { std::mem::transmute(()) }; Future breakage diagnostic: error: static of uninhabited type - --> $DIR/uninhabited-static.rs:5:5 + --> $DIR/uninhabited-static.rs:3:5 | LL | static VOID: Void; | ^^^^^^^^^^^^^^^^^ @@ -92,7 +92,7 @@ LL | static VOID: Void; Future breakage diagnostic: error: static of uninhabited type - --> $DIR/uninhabited-static.rs:7:5 + --> $DIR/uninhabited-static.rs:5:5 | LL | static NEVER: !; | ^^^^^^^^^^^^^^^ diff --git a/tests/ui/symbol-names/types.legacy.stderr b/tests/ui/symbol-names/types.legacy.stderr index c368b31860989..e71a4805e0342 100644 --- a/tests/ui/symbol-names/types.legacy.stderr +++ b/tests/ui/symbol-names/types.legacy.stderr @@ -1,521 +1,521 @@ error: symbol-name(_ZN1a1b16Type$LT$bool$GT$17h[HASH]E) - --> $DIR/types.rs:18:5 + --> $DIR/types.rs:17:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:18:5 + --> $DIR/types.rs:17:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:18:5 + --> $DIR/types.rs:17:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b16Type$LT$char$GT$17h[HASH]E) - --> $DIR/types.rs:27:5 + --> $DIR/types.rs:26:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:27:5 + --> $DIR/types.rs:26:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:27:5 + --> $DIR/types.rs:26:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b14Type$LT$i8$GT$17h[HASH]E) - --> $DIR/types.rs:36:5 + --> $DIR/types.rs:35:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:36:5 + --> $DIR/types.rs:35:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:36:5 + --> $DIR/types.rs:35:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b15Type$LT$i16$GT$17h[HASH]E) - --> $DIR/types.rs:45:5 + --> $DIR/types.rs:44:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:45:5 + --> $DIR/types.rs:44:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:45:5 + --> $DIR/types.rs:44:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b15Type$LT$i32$GT$17h[HASH]E) - --> $DIR/types.rs:54:5 + --> $DIR/types.rs:53:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:54:5 + --> $DIR/types.rs:53:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:54:5 + --> $DIR/types.rs:53:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b15Type$LT$i64$GT$17h[HASH]E) - --> $DIR/types.rs:63:5 + --> $DIR/types.rs:62:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:63:5 + --> $DIR/types.rs:62:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:63:5 + --> $DIR/types.rs:62:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b14Type$LT$u8$GT$17h[HASH]E) - --> $DIR/types.rs:72:5 + --> $DIR/types.rs:71:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:72:5 + --> $DIR/types.rs:71:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:72:5 + --> $DIR/types.rs:71:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b15Type$LT$u16$GT$17h[HASH]E) - --> $DIR/types.rs:81:5 + --> $DIR/types.rs:80:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:81:5 + --> $DIR/types.rs:80:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:81:5 + --> $DIR/types.rs:80:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b15Type$LT$u32$GT$17h[HASH]E) - --> $DIR/types.rs:90:5 + --> $DIR/types.rs:89:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:90:5 + --> $DIR/types.rs:89:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:90:5 + --> $DIR/types.rs:89:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b15Type$LT$u64$GT$17h[HASH]E) - --> $DIR/types.rs:99:5 + --> $DIR/types.rs:98:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:99:5 + --> $DIR/types.rs:98:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:99:5 + --> $DIR/types.rs:98:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b15Type$LT$f16$GT$17h[HASH]E) - --> $DIR/types.rs:108:5 + --> $DIR/types.rs:107:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:108:5 + --> $DIR/types.rs:107:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:108:5 + --> $DIR/types.rs:107:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b15Type$LT$f32$GT$17h[HASH]E) - --> $DIR/types.rs:117:5 + --> $DIR/types.rs:116:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:117:5 + --> $DIR/types.rs:116:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:117:5 + --> $DIR/types.rs:116:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b15Type$LT$f64$GT$17h[HASH]E) - --> $DIR/types.rs:126:5 + --> $DIR/types.rs:125:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:126:5 + --> $DIR/types.rs:125:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:126:5 + --> $DIR/types.rs:125:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b16Type$LT$f128$GT$17h[HASH]E) - --> $DIR/types.rs:135:5 + --> $DIR/types.rs:134:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:135:5 + --> $DIR/types.rs:134:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:135:5 + --> $DIR/types.rs:134:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b15Type$LT$str$GT$17h[HASH]E) - --> $DIR/types.rs:144:5 + --> $DIR/types.rs:143:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:144:5 + --> $DIR/types.rs:143:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:144:5 + --> $DIR/types.rs:143:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b17Type$LT$$u21$$GT$17h[HASH]E) - --> $DIR/types.rs:153:5 + --> $DIR/types.rs:152:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:153:5 + --> $DIR/types.rs:152:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:153:5 + --> $DIR/types.rs:152:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b20Type$LT$$LP$$RP$$GT$17h[HASH]E) - --> $DIR/types.rs:162:5 + --> $DIR/types.rs:161:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type<()>::h[HASH]) - --> $DIR/types.rs:162:5 + --> $DIR/types.rs:161:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type<()>) - --> $DIR/types.rs:162:5 + --> $DIR/types.rs:161:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b25Type$LT$$LP$u8$C$$RP$$GT$17h[HASH]E) - --> $DIR/types.rs:171:5 + --> $DIR/types.rs:170:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type<(u8,)>::h[HASH]) - --> $DIR/types.rs:171:5 + --> $DIR/types.rs:170:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type<(u8,)>) - --> $DIR/types.rs:171:5 + --> $DIR/types.rs:170:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b28Type$LT$$LP$u8$C$u16$RP$$GT$17h[HASH]E) - --> $DIR/types.rs:180:5 + --> $DIR/types.rs:179:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type<(u8,u16)>::h[HASH]) - --> $DIR/types.rs:180:5 + --> $DIR/types.rs:179:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type<(u8,u16)>) - --> $DIR/types.rs:180:5 + --> $DIR/types.rs:179:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b34Type$LT$$LP$u8$C$u16$C$u32$RP$$GT$17h[HASH]E) - --> $DIR/types.rs:189:5 + --> $DIR/types.rs:188:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type<(u8,u16,u32)>::h[HASH]) - --> $DIR/types.rs:189:5 + --> $DIR/types.rs:188:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type<(u8,u16,u32)>) - --> $DIR/types.rs:189:5 + --> $DIR/types.rs:188:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b28Type$LT$$BP$const$u20$u8$GT$17h[HASH]E) - --> $DIR/types.rs:198:5 + --> $DIR/types.rs:197:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type<*const u8>::h[HASH]) - --> $DIR/types.rs:198:5 + --> $DIR/types.rs:197:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type<*const u8>) - --> $DIR/types.rs:198:5 + --> $DIR/types.rs:197:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b26Type$LT$$BP$mut$u20$u8$GT$17h[HASH]E) - --> $DIR/types.rs:207:5 + --> $DIR/types.rs:206:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type<*mut u8>::h[HASH]) - --> $DIR/types.rs:207:5 + --> $DIR/types.rs:206:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type<*mut u8>) - --> $DIR/types.rs:207:5 + --> $DIR/types.rs:206:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b19Type$LT$$RF$str$GT$17h[HASH]E) - --> $DIR/types.rs:216:5 + --> $DIR/types.rs:215:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type<&str>::h[HASH]) - --> $DIR/types.rs:216:5 + --> $DIR/types.rs:215:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type<&str>) - --> $DIR/types.rs:216:5 + --> $DIR/types.rs:215:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b27Type$LT$$RF$mut$u20$str$GT$17h[HASH]E) - --> $DIR/types.rs:225:5 + --> $DIR/types.rs:224:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type<&mut str>::h[HASH]) - --> $DIR/types.rs:225:5 + --> $DIR/types.rs:224:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type<&mut str>) - --> $DIR/types.rs:225:5 + --> $DIR/types.rs:224:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b35Type$LT$$u5b$u8$u3b$$u20$0$u5d$$GT$17h[HASH]E) - --> $DIR/types.rs:234:5 + --> $DIR/types.rs:233:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type<[u8; 0]>::h[HASH]) - --> $DIR/types.rs:234:5 + --> $DIR/types.rs:233:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type<[u8; 0]>) - --> $DIR/types.rs:234:5 + --> $DIR/types.rs:233:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b22Type$LT$fn$LP$$RP$$GT$17h[HASH]E) - --> $DIR/types.rs:243:5 + --> $DIR/types.rs:242:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:243:5 + --> $DIR/types.rs:242:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:243:5 + --> $DIR/types.rs:242:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b60Type$LT$unsafe$u20$extern$u20$$u22$C$u22$$u20$fn$LP$$RP$$GT$17h[HASH]E) - --> $DIR/types.rs:252:5 + --> $DIR/types.rs:251:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:252:5 + --> $DIR/types.rs:251:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:252:5 + --> $DIR/types.rs:251:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b34Type$LT$$u5b$T$u3b$$u20$N$u5d$$GT$17h[HASH]E) - --> $DIR/types.rs:261:5 + --> $DIR/types.rs:260:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type<[T; N]>::h[HASH]) - --> $DIR/types.rs:261:5 + --> $DIR/types.rs:260:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type<[T; N]>) - --> $DIR/types.rs:261:5 + --> $DIR/types.rs:260:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b35Type$LT$$u5b$u8$u3b$$u20$0$u5d$$GT$17h[HASH]E) - --> $DIR/types.rs:272:5 + --> $DIR/types.rs:271:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type<[u8; 0]>::h[HASH]) - --> $DIR/types.rs:272:5 + --> $DIR/types.rs:271:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type<[u8; 0]>) - --> $DIR/types.rs:272:5 + --> $DIR/types.rs:271:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/symbol-names/types.v0.stderr b/tests/ui/symbol-names/types.v0.stderr index 90012a2dcf72f..57c24774f2bf8 100644 --- a/tests/ui/symbol-names/types.v0.stderr +++ b/tests/ui/symbol-names/types.v0.stderr @@ -1,521 +1,521 @@ error: symbol-name(_RMNvCsCRATE_HASH_1a1bINtB_4TypebE) - --> $DIR/types.rs:18:5 + --> $DIR/types.rs:17:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:18:5 + --> $DIR/types.rs:17:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:18:5 + --> $DIR/types.rs:17:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMs_NvCsCRATE_HASH_1a1bINtB_4TypecE) - --> $DIR/types.rs:27:5 + --> $DIR/types.rs:26:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:27:5 + --> $DIR/types.rs:26:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:27:5 + --> $DIR/types.rs:26:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMs0_NvCsCRATE_HASH_1a1bINtB_4TypeaE) - --> $DIR/types.rs:36:5 + --> $DIR/types.rs:35:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:36:5 + --> $DIR/types.rs:35:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:36:5 + --> $DIR/types.rs:35:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMs1_NvCsCRATE_HASH_1a1bINtB_4TypesE) - --> $DIR/types.rs:45:5 + --> $DIR/types.rs:44:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:45:5 + --> $DIR/types.rs:44:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:45:5 + --> $DIR/types.rs:44:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMs2_NvCsCRATE_HASH_1a1bINtB_4TypelE) - --> $DIR/types.rs:54:5 + --> $DIR/types.rs:53:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:54:5 + --> $DIR/types.rs:53:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:54:5 + --> $DIR/types.rs:53:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMs3_NvCsCRATE_HASH_1a1bINtB_4TypexE) - --> $DIR/types.rs:63:5 + --> $DIR/types.rs:62:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:63:5 + --> $DIR/types.rs:62:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:63:5 + --> $DIR/types.rs:62:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMs4_NvCsCRATE_HASH_1a1bINtB_4TypehE) - --> $DIR/types.rs:72:5 + --> $DIR/types.rs:71:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:72:5 + --> $DIR/types.rs:71:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:72:5 + --> $DIR/types.rs:71:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMs5_NvCsCRATE_HASH_1a1bINtB_4TypetE) - --> $DIR/types.rs:81:5 + --> $DIR/types.rs:80:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:81:5 + --> $DIR/types.rs:80:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:81:5 + --> $DIR/types.rs:80:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMs6_NvCsCRATE_HASH_1a1bINtB_4TypemE) - --> $DIR/types.rs:90:5 + --> $DIR/types.rs:89:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:90:5 + --> $DIR/types.rs:89:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:90:5 + --> $DIR/types.rs:89:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMs7_NvCsCRATE_HASH_1a1bINtB_4TypeyE) - --> $DIR/types.rs:99:5 + --> $DIR/types.rs:98:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:99:5 + --> $DIR/types.rs:98:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:99:5 + --> $DIR/types.rs:98:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMs8_NvCsCRATE_HASH_1a1bINtB_4TypeC3f16E) - --> $DIR/types.rs:108:5 + --> $DIR/types.rs:107:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:108:5 + --> $DIR/types.rs:107:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:108:5 + --> $DIR/types.rs:107:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMs9_NvCsCRATE_HASH_1a1bINtB_4TypefE) - --> $DIR/types.rs:117:5 + --> $DIR/types.rs:116:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:117:5 + --> $DIR/types.rs:116:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:117:5 + --> $DIR/types.rs:116:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMsa_NvCsCRATE_HASH_1a1bINtB_4TypedE) - --> $DIR/types.rs:126:5 + --> $DIR/types.rs:125:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:126:5 + --> $DIR/types.rs:125:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:126:5 + --> $DIR/types.rs:125:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMsb_NvCsCRATE_HASH_1a1bINtB_4TypeC4f128E) - --> $DIR/types.rs:135:5 + --> $DIR/types.rs:134:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:135:5 + --> $DIR/types.rs:134:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:135:5 + --> $DIR/types.rs:134:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMsc_NvCsCRATE_HASH_1a1bINtB_4TypeeE) - --> $DIR/types.rs:144:5 + --> $DIR/types.rs:143:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:144:5 + --> $DIR/types.rs:143:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:144:5 + --> $DIR/types.rs:143:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMsd_NvCsCRATE_HASH_1a1bINtB_4TypezE) - --> $DIR/types.rs:153:5 + --> $DIR/types.rs:152:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:153:5 + --> $DIR/types.rs:152:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:153:5 + --> $DIR/types.rs:152:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMse_NvCsCRATE_HASH_1a1bINtB_4TypeuE) - --> $DIR/types.rs:162:5 + --> $DIR/types.rs:161:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:162:5 + --> $DIR/types.rs:161:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:162:5 + --> $DIR/types.rs:161:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMsf_NvCsCRATE_HASH_1a1bINtB_4TypeThEE) - --> $DIR/types.rs:171:5 + --> $DIR/types.rs:170:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:171:5 + --> $DIR/types.rs:170:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:171:5 + --> $DIR/types.rs:170:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMsg_NvCsCRATE_HASH_1a1bINtB_4TypeThtEE) - --> $DIR/types.rs:180:5 + --> $DIR/types.rs:179:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:180:5 + --> $DIR/types.rs:179:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:180:5 + --> $DIR/types.rs:179:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMsh_NvCsCRATE_HASH_1a1bINtB_4TypeThtmEE) - --> $DIR/types.rs:189:5 + --> $DIR/types.rs:188:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:189:5 + --> $DIR/types.rs:188:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:189:5 + --> $DIR/types.rs:188:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMsi_NvCsCRATE_HASH_1a1bINtB_4TypePhE) - --> $DIR/types.rs:198:5 + --> $DIR/types.rs:197:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:198:5 + --> $DIR/types.rs:197:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:198:5 + --> $DIR/types.rs:197:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMsj_NvCsCRATE_HASH_1a1bINtB_4TypeOhE) - --> $DIR/types.rs:207:5 + --> $DIR/types.rs:206:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:207:5 + --> $DIR/types.rs:206:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:207:5 + --> $DIR/types.rs:206:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMsk_NvCsCRATE_HASH_1a1bINtB_4TypeReE) - --> $DIR/types.rs:216:5 + --> $DIR/types.rs:215:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:216:5 + --> $DIR/types.rs:215:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:216:5 + --> $DIR/types.rs:215:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMsl_NvCsCRATE_HASH_1a1bINtB_4TypeQeE) - --> $DIR/types.rs:225:5 + --> $DIR/types.rs:224:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:225:5 + --> $DIR/types.rs:224:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:225:5 + --> $DIR/types.rs:224:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMsm_NvCsCRATE_HASH_1a1bINtB_4TypeAhj0_E) - --> $DIR/types.rs:234:5 + --> $DIR/types.rs:233:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:234:5 + --> $DIR/types.rs:233:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:234:5 + --> $DIR/types.rs:233:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMsn_NvCsCRATE_HASH_1a1bINtB_4TypeFEuE) - --> $DIR/types.rs:243:5 + --> $DIR/types.rs:242:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:243:5 + --> $DIR/types.rs:242:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:243:5 + --> $DIR/types.rs:242:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMso_NvCsCRATE_HASH_1a1bINtB_4TypeFUKCEuE) - --> $DIR/types.rs:252:5 + --> $DIR/types.rs:251:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:252:5 + --> $DIR/types.rs:251:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:252:5 + --> $DIR/types.rs:251:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMsp_NvCsCRATE_HASH_1a1bINtB_4TypeAppEB_) - --> $DIR/types.rs:261:5 + --> $DIR/types.rs:260:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:261:5 + --> $DIR/types.rs:260:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:261:5 + --> $DIR/types.rs:260:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMsq_NvCsCRATE_HASH_1a1bINtB_4TypeAhj0_E) - --> $DIR/types.rs:272:5 + --> $DIR/types.rs:271:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:272:5 + --> $DIR/types.rs:271:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:272:5 + --> $DIR/types.rs:271:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/symbol-names/types.verbose-legacy.stderr b/tests/ui/symbol-names/types.verbose-legacy.stderr index c368b31860989..e71a4805e0342 100644 --- a/tests/ui/symbol-names/types.verbose-legacy.stderr +++ b/tests/ui/symbol-names/types.verbose-legacy.stderr @@ -1,521 +1,521 @@ error: symbol-name(_ZN1a1b16Type$LT$bool$GT$17h[HASH]E) - --> $DIR/types.rs:18:5 + --> $DIR/types.rs:17:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:18:5 + --> $DIR/types.rs:17:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:18:5 + --> $DIR/types.rs:17:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b16Type$LT$char$GT$17h[HASH]E) - --> $DIR/types.rs:27:5 + --> $DIR/types.rs:26:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:27:5 + --> $DIR/types.rs:26:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:27:5 + --> $DIR/types.rs:26:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b14Type$LT$i8$GT$17h[HASH]E) - --> $DIR/types.rs:36:5 + --> $DIR/types.rs:35:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:36:5 + --> $DIR/types.rs:35:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:36:5 + --> $DIR/types.rs:35:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b15Type$LT$i16$GT$17h[HASH]E) - --> $DIR/types.rs:45:5 + --> $DIR/types.rs:44:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:45:5 + --> $DIR/types.rs:44:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:45:5 + --> $DIR/types.rs:44:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b15Type$LT$i32$GT$17h[HASH]E) - --> $DIR/types.rs:54:5 + --> $DIR/types.rs:53:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:54:5 + --> $DIR/types.rs:53:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:54:5 + --> $DIR/types.rs:53:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b15Type$LT$i64$GT$17h[HASH]E) - --> $DIR/types.rs:63:5 + --> $DIR/types.rs:62:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:63:5 + --> $DIR/types.rs:62:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:63:5 + --> $DIR/types.rs:62:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b14Type$LT$u8$GT$17h[HASH]E) - --> $DIR/types.rs:72:5 + --> $DIR/types.rs:71:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:72:5 + --> $DIR/types.rs:71:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:72:5 + --> $DIR/types.rs:71:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b15Type$LT$u16$GT$17h[HASH]E) - --> $DIR/types.rs:81:5 + --> $DIR/types.rs:80:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:81:5 + --> $DIR/types.rs:80:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:81:5 + --> $DIR/types.rs:80:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b15Type$LT$u32$GT$17h[HASH]E) - --> $DIR/types.rs:90:5 + --> $DIR/types.rs:89:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:90:5 + --> $DIR/types.rs:89:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:90:5 + --> $DIR/types.rs:89:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b15Type$LT$u64$GT$17h[HASH]E) - --> $DIR/types.rs:99:5 + --> $DIR/types.rs:98:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:99:5 + --> $DIR/types.rs:98:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:99:5 + --> $DIR/types.rs:98:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b15Type$LT$f16$GT$17h[HASH]E) - --> $DIR/types.rs:108:5 + --> $DIR/types.rs:107:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:108:5 + --> $DIR/types.rs:107:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:108:5 + --> $DIR/types.rs:107:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b15Type$LT$f32$GT$17h[HASH]E) - --> $DIR/types.rs:117:5 + --> $DIR/types.rs:116:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:117:5 + --> $DIR/types.rs:116:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:117:5 + --> $DIR/types.rs:116:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b15Type$LT$f64$GT$17h[HASH]E) - --> $DIR/types.rs:126:5 + --> $DIR/types.rs:125:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:126:5 + --> $DIR/types.rs:125:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:126:5 + --> $DIR/types.rs:125:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b16Type$LT$f128$GT$17h[HASH]E) - --> $DIR/types.rs:135:5 + --> $DIR/types.rs:134:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:135:5 + --> $DIR/types.rs:134:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:135:5 + --> $DIR/types.rs:134:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b15Type$LT$str$GT$17h[HASH]E) - --> $DIR/types.rs:144:5 + --> $DIR/types.rs:143:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:144:5 + --> $DIR/types.rs:143:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:144:5 + --> $DIR/types.rs:143:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b17Type$LT$$u21$$GT$17h[HASH]E) - --> $DIR/types.rs:153:5 + --> $DIR/types.rs:152:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:153:5 + --> $DIR/types.rs:152:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:153:5 + --> $DIR/types.rs:152:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b20Type$LT$$LP$$RP$$GT$17h[HASH]E) - --> $DIR/types.rs:162:5 + --> $DIR/types.rs:161:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type<()>::h[HASH]) - --> $DIR/types.rs:162:5 + --> $DIR/types.rs:161:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type<()>) - --> $DIR/types.rs:162:5 + --> $DIR/types.rs:161:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b25Type$LT$$LP$u8$C$$RP$$GT$17h[HASH]E) - --> $DIR/types.rs:171:5 + --> $DIR/types.rs:170:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type<(u8,)>::h[HASH]) - --> $DIR/types.rs:171:5 + --> $DIR/types.rs:170:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type<(u8,)>) - --> $DIR/types.rs:171:5 + --> $DIR/types.rs:170:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b28Type$LT$$LP$u8$C$u16$RP$$GT$17h[HASH]E) - --> $DIR/types.rs:180:5 + --> $DIR/types.rs:179:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type<(u8,u16)>::h[HASH]) - --> $DIR/types.rs:180:5 + --> $DIR/types.rs:179:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type<(u8,u16)>) - --> $DIR/types.rs:180:5 + --> $DIR/types.rs:179:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b34Type$LT$$LP$u8$C$u16$C$u32$RP$$GT$17h[HASH]E) - --> $DIR/types.rs:189:5 + --> $DIR/types.rs:188:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type<(u8,u16,u32)>::h[HASH]) - --> $DIR/types.rs:189:5 + --> $DIR/types.rs:188:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type<(u8,u16,u32)>) - --> $DIR/types.rs:189:5 + --> $DIR/types.rs:188:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b28Type$LT$$BP$const$u20$u8$GT$17h[HASH]E) - --> $DIR/types.rs:198:5 + --> $DIR/types.rs:197:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type<*const u8>::h[HASH]) - --> $DIR/types.rs:198:5 + --> $DIR/types.rs:197:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type<*const u8>) - --> $DIR/types.rs:198:5 + --> $DIR/types.rs:197:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b26Type$LT$$BP$mut$u20$u8$GT$17h[HASH]E) - --> $DIR/types.rs:207:5 + --> $DIR/types.rs:206:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type<*mut u8>::h[HASH]) - --> $DIR/types.rs:207:5 + --> $DIR/types.rs:206:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type<*mut u8>) - --> $DIR/types.rs:207:5 + --> $DIR/types.rs:206:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b19Type$LT$$RF$str$GT$17h[HASH]E) - --> $DIR/types.rs:216:5 + --> $DIR/types.rs:215:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type<&str>::h[HASH]) - --> $DIR/types.rs:216:5 + --> $DIR/types.rs:215:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type<&str>) - --> $DIR/types.rs:216:5 + --> $DIR/types.rs:215:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b27Type$LT$$RF$mut$u20$str$GT$17h[HASH]E) - --> $DIR/types.rs:225:5 + --> $DIR/types.rs:224:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type<&mut str>::h[HASH]) - --> $DIR/types.rs:225:5 + --> $DIR/types.rs:224:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type<&mut str>) - --> $DIR/types.rs:225:5 + --> $DIR/types.rs:224:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b35Type$LT$$u5b$u8$u3b$$u20$0$u5d$$GT$17h[HASH]E) - --> $DIR/types.rs:234:5 + --> $DIR/types.rs:233:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type<[u8; 0]>::h[HASH]) - --> $DIR/types.rs:234:5 + --> $DIR/types.rs:233:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type<[u8; 0]>) - --> $DIR/types.rs:234:5 + --> $DIR/types.rs:233:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b22Type$LT$fn$LP$$RP$$GT$17h[HASH]E) - --> $DIR/types.rs:243:5 + --> $DIR/types.rs:242:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:243:5 + --> $DIR/types.rs:242:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:243:5 + --> $DIR/types.rs:242:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b60Type$LT$unsafe$u20$extern$u20$$u22$C$u22$$u20$fn$LP$$RP$$GT$17h[HASH]E) - --> $DIR/types.rs:252:5 + --> $DIR/types.rs:251:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:252:5 + --> $DIR/types.rs:251:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:252:5 + --> $DIR/types.rs:251:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b34Type$LT$$u5b$T$u3b$$u20$N$u5d$$GT$17h[HASH]E) - --> $DIR/types.rs:261:5 + --> $DIR/types.rs:260:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type<[T; N]>::h[HASH]) - --> $DIR/types.rs:261:5 + --> $DIR/types.rs:260:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type<[T; N]>) - --> $DIR/types.rs:261:5 + --> $DIR/types.rs:260:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b35Type$LT$$u5b$u8$u3b$$u20$0$u5d$$GT$17h[HASH]E) - --> $DIR/types.rs:272:5 + --> $DIR/types.rs:271:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type<[u8; 0]>::h[HASH]) - --> $DIR/types.rs:272:5 + --> $DIR/types.rs:271:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type<[u8; 0]>) - --> $DIR/types.rs:272:5 + --> $DIR/types.rs:271:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/traits/const-traits/reservation-impl-ice.rs b/tests/ui/traits/const-traits/reservation-impl-ice.rs index 3fbfe8c950daa..c2d9662945a44 100644 --- a/tests/ui/traits/const-traits/reservation-impl-ice.rs +++ b/tests/ui/traits/const-traits/reservation-impl-ice.rs @@ -1,5 +1,5 @@ //@ compile-flags: -Znext-solver -#![feature(const_convert, never_type, const_trait_impl)] +#![feature(const_convert, const_trait_impl)] const fn impls_from>() {} diff --git a/tests/ui/traits/reservation-impl/non-lattice-ok.rs b/tests/ui/traits/reservation-impl/non-lattice-ok.rs index 32d610bf915aa..698601af7db9c 100644 --- a/tests/ui/traits/reservation-impl/non-lattice-ok.rs +++ b/tests/ui/traits/reservation-impl/non-lattice-ok.rs @@ -36,7 +36,7 @@ //@ revisions: old next //@[next] compile-flags: -Znext-solver -#![feature(rustc_attrs, never_type)] +#![feature(rustc_attrs)] trait MyTrait {} diff --git a/tests/ui/transmutability/char.stderr b/tests/ui/transmutability/char.stderr index 98e7ae9c0d49c..b15d4c83e29b3 100644 --- a/tests/ui/transmutability/char.stderr +++ b/tests/ui/transmutability/char.stderr @@ -1,11 +1,11 @@ error[E0277]: `main::Char<(), !, !>` cannot be safely transmuted into `char` - --> $DIR/char.rs:35:39 + --> $DIR/char.rs:34:39 | LL | is_transmutable::, char>(); | ^^^^ at least one value of `main::Char<(), !, !>` isn't a bit-valid value of `char` | note: required by a bound in `is_transmutable` - --> $DIR/char.rs:8:10 + --> $DIR/char.rs:7:10 | LL | pub fn is_transmutable() | --------------- required by a bound in this function @@ -14,13 +14,13 @@ LL | Dst: TransmuteFrom, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `main::Char` cannot be safely transmuted into `char` - --> $DIR/char.rs:37:39 + --> $DIR/char.rs:36:39 | LL | is_transmutable::, char>(); | ^^^^ at least one value of `main::Char` isn't a bit-valid value of `char` | note: required by a bound in `is_transmutable` - --> $DIR/char.rs:8:10 + --> $DIR/char.rs:7:10 | LL | pub fn is_transmutable() | --------------- required by a bound in this function @@ -29,13 +29,13 @@ LL | Dst: TransmuteFrom, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `main::Char` cannot be safely transmuted into `char` - --> $DIR/char.rs:39:39 + --> $DIR/char.rs:38:39 | LL | is_transmutable::, char>(); | ^^^^ at least one value of `main::Char` isn't a bit-valid value of `char` | note: required by a bound in `is_transmutable` - --> $DIR/char.rs:8:10 + --> $DIR/char.rs:7:10 | LL | pub fn is_transmutable() | --------------- required by a bound in this function diff --git a/tests/ui/try-block/try-block-bad-type-heterogeneous.stderr b/tests/ui/try-block/try-block-bad-type-heterogeneous.stderr index 4962534cf2945..403a8fee0aecc 100644 --- a/tests/ui/try-block/try-block-bad-type-heterogeneous.stderr +++ b/tests/ui/try-block/try-block-bad-type-heterogeneous.stderr @@ -8,9 +8,9 @@ LL | Err("")?; | = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait help: the trait `From<&str>` is not implemented for `TryFromSliceError` - but trait `From` is implemented for it + but trait `From` is implemented for it --> $SRC_DIR/core/src/array/mod.rs:LL:COL - = help: for that trait implementation, expected `Infallible`, found `&str` + = help: for that trait implementation, expected `!`, found `&str` error[E0271]: type mismatch resolving ` as Try>::Output == &str` --> $DIR/try-block-bad-type-heterogeneous.rs:12:9 diff --git a/tests/ui/type-alias-impl-trait/different_defining_uses_never_type.stderr b/tests/ui/type-alias-impl-trait/different_defining_uses_never_type.stderr index 0914dd1c546e4..701b6a4c57dce 100644 --- a/tests/ui/type-alias-impl-trait/different_defining_uses_never_type.stderr +++ b/tests/ui/type-alias-impl-trait/different_defining_uses_never_type.stderr @@ -2,7 +2,7 @@ error: concrete type differs from previous defining opaque type use --> $DIR/different_defining_uses_never_type.rs:14:13 | LL | fn bar() -> Foo { - | ^^^ expected `&str`, got `()` + | ^^^ expected `&str`, got `!` | note: previous use here --> $DIR/different_defining_uses_never_type.rs:9:13 diff --git a/tests/ui/uninhabited/uninhabited-irrefutable.exhaustive_patterns.stderr b/tests/ui/uninhabited/uninhabited-irrefutable.exhaustive_patterns.stderr index a4270c29ff35b..4c11e97fdd810 100644 --- a/tests/ui/uninhabited/uninhabited-irrefutable.exhaustive_patterns.stderr +++ b/tests/ui/uninhabited/uninhabited-irrefutable.exhaustive_patterns.stderr @@ -1,5 +1,5 @@ error[E0005]: refutable pattern in local binding - --> $DIR/uninhabited-irrefutable.rs:30:9 + --> $DIR/uninhabited-irrefutable.rs:29:9 | LL | let Foo::D(_y, _z) = x; | ^^^^^^^^^^^^^^ pattern `Foo::A(_)` not covered @@ -7,7 +7,7 @@ LL | let Foo::D(_y, _z) = x; = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html note: `Foo` defined here - --> $DIR/uninhabited-irrefutable.rs:19:6 + --> $DIR/uninhabited-irrefutable.rs:18:6 | LL | enum Foo { | ^^^ diff --git a/tests/ui/uninhabited/uninhabited-irrefutable.normal.stderr b/tests/ui/uninhabited/uninhabited-irrefutable.normal.stderr index a4270c29ff35b..4c11e97fdd810 100644 --- a/tests/ui/uninhabited/uninhabited-irrefutable.normal.stderr +++ b/tests/ui/uninhabited/uninhabited-irrefutable.normal.stderr @@ -1,5 +1,5 @@ error[E0005]: refutable pattern in local binding - --> $DIR/uninhabited-irrefutable.rs:30:9 + --> $DIR/uninhabited-irrefutable.rs:29:9 | LL | let Foo::D(_y, _z) = x; | ^^^^^^^^^^^^^^ pattern `Foo::A(_)` not covered @@ -7,7 +7,7 @@ LL | let Foo::D(_y, _z) = x; = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html note: `Foo` defined here - --> $DIR/uninhabited-irrefutable.rs:19:6 + --> $DIR/uninhabited-irrefutable.rs:18:6 | LL | enum Foo { | ^^^ diff --git a/tests/ui/uninhabited/uninhabited-patterns.stderr b/tests/ui/uninhabited/uninhabited-patterns.stderr index 62113c82a3648..d2964694c2ebf 100644 --- a/tests/ui/uninhabited/uninhabited-patterns.stderr +++ b/tests/ui/uninhabited/uninhabited-patterns.stderr @@ -1,5 +1,5 @@ error[E0004]: non-exhaustive patterns: `Ok(_)` not covered - --> $DIR/uninhabited-patterns.rs:34:11 + --> $DIR/uninhabited-patterns.rs:33:11 | LL | match x { | ^ pattern `Ok(_)` not covered @@ -17,7 +17,7 @@ LL ~ Ok(_) => todo!(), | error: unreachable pattern - --> $DIR/uninhabited-patterns.rs:43:9 + --> $DIR/uninhabited-patterns.rs:42:9 | LL | Err(Ok(_y)) => (), | ^^^^^^^^^^^------- @@ -27,13 +27,13 @@ LL | Err(Ok(_y)) => (), | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types note: the lint level is defined here - --> $DIR/uninhabited-patterns.rs:4:9 + --> $DIR/uninhabited-patterns.rs:3:9 | LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ error: unreachable pattern - --> $DIR/uninhabited-patterns.rs:46:15 + --> $DIR/uninhabited-patterns.rs:45:15 | LL | while let Some(_y) = foo() { | ^^^^^^^^ matches no values because `NotSoSecretlyEmpty` is uninhabited diff --git a/tests/ui/uninhabited/uninhabited-unstable-field.stderr b/tests/ui/uninhabited/uninhabited-unstable-field.stderr index a0c9f9366a6b5..84ddfb5c32de9 100644 --- a/tests/ui/uninhabited/uninhabited-unstable-field.stderr +++ b/tests/ui/uninhabited/uninhabited-unstable-field.stderr @@ -1,5 +1,5 @@ error: unreachable pattern - --> $DIR/uninhabited-unstable-field.rs:24:9 + --> $DIR/uninhabited-unstable-field.rs:23:9 | LL | Foo { .. } => {} | ^^^^^^^^^^------ @@ -9,13 +9,13 @@ LL | Foo { .. } => {} | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types note: the lint level is defined here - --> $DIR/uninhabited-unstable-field.rs:9:9 + --> $DIR/uninhabited-unstable-field.rs:8:9 | LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ error: unreachable pattern - --> $DIR/uninhabited-unstable-field.rs:31:9 + --> $DIR/uninhabited-unstable-field.rs:30:9 | LL | _ => {} | ^------ @@ -26,7 +26,7 @@ LL | _ => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/uninhabited-unstable-field.rs:41:9 + --> $DIR/uninhabited-unstable-field.rs:40:9 | LL | MyCoroutineState::Complete(_) => {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^------ diff --git a/tests/ui/uninhabited/void-branch.stderr b/tests/ui/uninhabited/void-branch.stderr index 15693fc85f4b6..d9931ac66f2e8 100644 --- a/tests/ui/uninhabited/void-branch.stderr +++ b/tests/ui/uninhabited/void-branch.stderr @@ -1,16 +1,11 @@ error: unreachable expression - --> $DIR/void-branch.rs:10:13 - | -LL | std::mem::uninitialized::(); - | --------------------------------- any code following this expression is unreachable -LL | println!(); - | ^^^^^^^^^^ unreachable expression + --> $DIR/void-branch.rs:25:9 | -note: this expression has type `Void`, which is uninhabited - --> $DIR/void-branch.rs:9:13 +LL | infallible(); + | ------------ any code following this expression is unreachable +LL | println!() + | ^^^^^^^^^^ unreachable expression | -LL | std::mem::uninitialized::(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: the lint level is defined here --> $DIR/void-branch.rs:1:9 | @@ -18,18 +13,18 @@ LL | #![deny(unreachable_code)] | ^^^^^^^^^^^^^^^^ error: unreachable expression - --> $DIR/void-branch.rs:25:9 + --> $DIR/void-branch.rs:10:13 | -LL | infallible(); - | ------------ any code following this expression is unreachable -LL | println!() - | ^^^^^^^^^^ unreachable expression +LL | std::mem::uninitialized::(); + | --------------------------------- any code following this expression is unreachable +LL | println!(); + | ^^^^^^^^^^ unreachable expression | -note: this expression has type `Infallible`, which is uninhabited - --> $DIR/void-branch.rs:24:9 +note: this expression has type `Void`, which is uninhabited + --> $DIR/void-branch.rs:9:13 | -LL | infallible(); - | ^^^^^^^^^^^^ +LL | std::mem::uninitialized::(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/tests/ui/unpretty/exhaustive.hir.stderr b/tests/ui/unpretty/exhaustive.hir.stderr index f6800fc9c1e6f..0f7e6f4b09dc1 100644 --- a/tests/ui/unpretty/exhaustive.hir.stderr +++ b/tests/ui/unpretty/exhaustive.hir.stderr @@ -1,17 +1,17 @@ error[E0697]: closures cannot be static - --> $DIR/exhaustive.rs:211:9 + --> $DIR/exhaustive.rs:210:9 | LL | static || value; | ^^^^^^^^^ error[E0697]: closures cannot be static - --> $DIR/exhaustive.rs:212:9 + --> $DIR/exhaustive.rs:211:9 | LL | static move || value; | ^^^^^^^^^^^^^^ error[E0728]: `await` is only allowed inside `async` functions and blocks - --> $DIR/exhaustive.rs:241:13 + --> $DIR/exhaustive.rs:240:13 | LL | fn expr_await() { | --------------- this is not `async` @@ -20,19 +20,19 @@ LL | fut.await; | ^^^^^ only allowed inside `async` functions and blocks error: in expressions, `_` can only be used on the left-hand side of an assignment - --> $DIR/exhaustive.rs:292:9 + --> $DIR/exhaustive.rs:291:9 | LL | _; | ^ `_` not allowed here error[E0214]: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/exhaustive.rs:302:9 + --> $DIR/exhaustive.rs:301:9 | LL | x::(); | ^^^^^ only `Fn` traits may use parentheses error[E0214]: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/exhaustive.rs:303:9 + --> $DIR/exhaustive.rs:302:9 | LL | x::(T, T) -> T; | ^^^^^^^^^^^^^^ only `Fn` traits may use parentheses @@ -44,31 +44,31 @@ LL + x:: -> T; | error[E0214]: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/exhaustive.rs:304:9 + --> $DIR/exhaustive.rs:303:9 | LL | crate::() -> ()::expressions::() -> ()::expr_path; | ^^^^^^^^^^^^^^^ only `Fn` traits may use parentheses error[E0214]: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/exhaustive.rs:304:26 + --> $DIR/exhaustive.rs:303:26 | LL | crate::() -> ()::expressions::() -> ()::expr_path; | ^^^^^^^^^^^^^^^^^^^^^ only `Fn` traits may use parentheses error[E0214]: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/exhaustive.rs:307:9 + --> $DIR/exhaustive.rs:306:9 | LL | core::()::marker::()::PhantomData; | ^^^^^^^^ only `Fn` traits may use parentheses error[E0214]: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/exhaustive.rs:307:19 + --> $DIR/exhaustive.rs:306:19 | LL | core::()::marker::()::PhantomData; | ^^^^^^^^^^ only `Fn` traits may use parentheses error: `yield` can only be used in `#[coroutine]` closures, or `gen` blocks - --> $DIR/exhaustive.rs:394:9 + --> $DIR/exhaustive.rs:393:9 | LL | yield; | ^^^^^ @@ -79,7 +79,7 @@ LL | #[coroutine] fn expr_yield() { | ++++++++++++ error[E0703]: invalid ABI: found `C++` - --> $DIR/exhaustive.rs:474:23 + --> $DIR/exhaustive.rs:473:23 | LL | unsafe extern "C++" {} | ^^^^^ invalid ABI @@ -87,7 +87,7 @@ LL | unsafe extern "C++" {} = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions error: `..` patterns are not allowed here - --> $DIR/exhaustive.rs:681:13 + --> $DIR/exhaustive.rs:680:13 | LL | let ..; | ^^ @@ -95,13 +95,13 @@ LL | let ..; = note: only allowed in tuple, tuple struct, and slice patterns error[E0214]: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/exhaustive.rs:796:16 + --> $DIR/exhaustive.rs:795:16 | LL | let _: T() -> !; | ^^^^^^^^ only `Fn` traits may use parentheses error[E0562]: `impl Trait` is not allowed in the type of variable bindings - --> $DIR/exhaustive.rs:810:16 + --> $DIR/exhaustive.rs:809:16 | LL | let _: impl Send; | ^^^^^^^^^ @@ -112,7 +112,7 @@ LL | let _: impl Send; = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0562]: `impl Trait` is not allowed in the type of variable bindings - --> $DIR/exhaustive.rs:811:16 + --> $DIR/exhaustive.rs:810:16 | LL | let _: impl Send + 'static; | ^^^^^^^^^^^^^^^^^^^ @@ -123,7 +123,7 @@ LL | let _: impl Send + 'static; = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0562]: `impl Trait` is not allowed in the type of variable bindings - --> $DIR/exhaustive.rs:812:16 + --> $DIR/exhaustive.rs:811:16 | LL | let _: impl 'static + Send; | ^^^^^^^^^^^^^^^^^^^ @@ -134,7 +134,7 @@ LL | let _: impl 'static + Send; = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0562]: `impl Trait` is not allowed in the type of variable bindings - --> $DIR/exhaustive.rs:813:16 + --> $DIR/exhaustive.rs:812:16 | LL | let _: impl ?Sized; | ^^^^^^^^^^^ @@ -145,7 +145,7 @@ LL | let _: impl ?Sized; = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0562]: `impl Trait` is not allowed in the type of variable bindings - --> $DIR/exhaustive.rs:814:16 + --> $DIR/exhaustive.rs:813:16 | LL | let _: impl [const] Clone; | ^^^^^^^^^^^^^^^^^^ @@ -156,7 +156,7 @@ LL | let _: impl [const] Clone; = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0562]: `impl Trait` is not allowed in the type of variable bindings - --> $DIR/exhaustive.rs:815:16 + --> $DIR/exhaustive.rs:814:16 | LL | let _: impl for<'a> Send; | ^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/unpretty/exhaustive.hir.stdout b/tests/ui/unpretty/exhaustive.hir.stdout index 8265563787c80..589e464988c21 100644 --- a/tests/ui/unpretty/exhaustive.hir.stdout +++ b/tests/ui/unpretty/exhaustive.hir.stdout @@ -1,9 +1,9 @@ #![attr = Feature([auto_traits#0, box_patterns#0, builtin_syntax#0, const_trait_impl#0, coroutines#0, decl_macro#0, deref_patterns#0, explicit_tail_calls#0, gen_blocks#0, more_qualified_paths#0, never_patterns#0, -never_type#0, pattern_types#0, pattern_type_macro#0, prelude_import#0, -specialization#0, trace_macros#0, trait_alias#0, try_blocks#0, -try_blocks_heterogeneous#0, yeet_expr#0])] +pattern_types#0, pattern_type_macro#0, prelude_import#0, specialization#0, +trace_macros#0, trait_alias#0, try_blocks#0, try_blocks_heterogeneous#0, +yeet_expr#0])] #![attr = LintAttributes([LintAttribute {kind: Allow, attr_style: Inner, lint_instances: [incomplete_features]}])] extern crate std; From 172651f286871dc97febc0cd06a02284105b7086 Mon Sep 17 00:00:00 2001 From: Waffle Lapkin Date: Mon, 9 Mar 2026 17:20:30 +0100 Subject: [PATCH 09/18] update tests which depended on never fallback to `()` --- .../defaulted-never-note.e2021.stderr | 18 -- .../fallback_change/defaulted-never-note.rs | 49 ++- ...024.stderr => defaulted-never-note.stderr} | 18 +- .../dependency-on-fallback-to-unit.rs | 6 +- .../dependency-on-fallback-to-unit.stderr | 6 +- ...diverging-fallback-unconstrained-return.rs | 8 +- ...rging-fallback-unconstrained-return.stderr | 24 ++ .../dont-suggest-turbofish-from-expansion.rs | 18 -- ...nt-suggest-turbofish-from-expansion.stderr | 20 -- .../fallback_change/fallback-closure-ret.rs | 9 +- .../fallback-closure-ret.stderr | 24 ++ .../fallback_change/fallback-closure-wrap.rs | 8 +- .../fallback-closure-wrap.stderr | 15 + ...lint-breaking-2024-assign-underscore.fixed | 15 - .../lint-breaking-2024-assign-underscore.rs | 4 +- ...int-breaking-2024-assign-underscore.stderr | 4 +- ...never-type-fallback-flowing-into-unsafe.rs | 35 +-- ...r-type-fallback-flowing-into-unsafe.stderr | 296 ++++++++++++++++++ .../try-block-never-type-fallback.rs | 14 +- 19 files changed, 419 insertions(+), 172 deletions(-) delete mode 100644 tests/ui/never_type/fallback_change/defaulted-never-note.e2021.stderr rename tests/ui/never_type/fallback_change/{defaulted-never-note.e2024.stderr => defaulted-never-note.stderr} (84%) create mode 100644 tests/ui/never_type/fallback_change/diverging-fallback-unconstrained-return.stderr delete mode 100644 tests/ui/never_type/fallback_change/dont-suggest-turbofish-from-expansion.rs delete mode 100644 tests/ui/never_type/fallback_change/dont-suggest-turbofish-from-expansion.stderr create mode 100644 tests/ui/never_type/fallback_change/fallback-closure-ret.stderr create mode 100644 tests/ui/never_type/fallback_change/fallback-closure-wrap.stderr delete mode 100644 tests/ui/never_type/fallback_change/lint-breaking-2024-assign-underscore.fixed create mode 100644 tests/ui/never_type/fallback_change/lint-never-type-fallback-flowing-into-unsafe.stderr diff --git a/tests/ui/never_type/fallback_change/defaulted-never-note.e2021.stderr b/tests/ui/never_type/fallback_change/defaulted-never-note.e2021.stderr deleted file mode 100644 index 96013df5fb0d0..0000000000000 --- a/tests/ui/never_type/fallback_change/defaulted-never-note.e2021.stderr +++ /dev/null @@ -1,18 +0,0 @@ -Future incompatibility report: Future breakage diagnostic: -warning: this function depends on never type fallback being `()` - --> $DIR/defaulted-never-note.rs:38:1 - | -LL | fn main() { - | ^^^^^^^^^ - | - = help: specify the types explicitly -note: in edition 2024, the requirement `!: OnlyUnit` will fail - --> $DIR/defaulted-never-note.rs:40:19 - | -LL | requires_unit(x); - | ^ -help: use `()` annotations to avoid fallback changes - | -LL | let x: () = return; - | ++++ - diff --git a/tests/ui/never_type/fallback_change/defaulted-never-note.rs b/tests/ui/never_type/fallback_change/defaulted-never-note.rs index 79510bbfa0dc0..4d18b5af2c541 100644 --- a/tests/ui/never_type/fallback_change/defaulted-never-note.rs +++ b/tests/ui/never_type/fallback_change/defaulted-never-note.rs @@ -1,58 +1,49 @@ // Test diagnostic for the case where a trait is not implemented for `!`. If it is implemented // for `()`, we want to add a note saying that this might be caused by a breaking change in the // compiler. -// -//@ revisions: e2021 e2024 -//@[e2021] edition: 2021 -//@[e2024] edition: 2024 -//@[e2021] run-pass #![expect(dependency_on_unit_never_type_fallback, unused)] trait OnlyUnit {} impl OnlyUnit for () {} -//[e2024]~^ help: trait `OnlyUnit` is implemented for `()` +//~^ help: trait `OnlyUnit` is implemented for `()` fn requires_unit(_: impl OnlyUnit) {} -//[e2024]~^ note: required by this bound in `requires_unit` -//[e2024]~| note: required by a bound in `requires_unit` - +//~^ note: required by this bound in `requires_unit` +//~| note: required by a bound in `requires_unit` trait OnlyU32 {} impl OnlyU32 for u32 {} -//[e2024]~^ help: the trait `OnlyU32` is implemented for `u32` +//~^ help: the trait `OnlyU32` is implemented for `u32` fn requires_u32(_: impl OnlyU32) {} -//[e2024]~^ note: required by this bound in `requires_u32` -//[e2024]~| note: required by a bound in `requires_u32` - +//~^ note: required by this bound in `requires_u32` +//~| note: required by a bound in `requires_u32` trait Nothing {} -//[e2024]~^ help: this trait has no implementations, consider adding one +//~^ help: this trait has no implementations, consider adding one fn requires_nothing(_: impl Nothing) {} -//[e2024]~^ note: required by this bound in `requires_nothing` -//[e2024]~| note: required by a bound in `requires_nothing` +//~^ note: required by this bound in `requires_nothing` +//~| note: required by a bound in `requires_nothing` fn main() { let x = return; requires_unit(x); - //[e2024]~^ error: the trait bound `!: OnlyUnit` is not satisfied - //[e2024]~| note: the trait `OnlyUnit` is not implemented for `!` - //[e2024]~| note: this error might have been caused by changes to Rust's type-inference algorithm (see issue #148922 for more information) - //[e2024]~| note: required by a bound introduced by this call - //[e2024]~| help: you might have intended to use the type `()` + //~^ error: the trait bound `!: OnlyUnit` is not satisfied + //~| note: the trait `OnlyUnit` is not implemented for `!` + //~| note: this error might have been caused by changes to Rust's type-inference algorithm (see issue #148922 for more information) + //~| note: required by a bound introduced by this call + //~| help: you might have intended to use the type `()` - #[cfg(e2024)] requires_u32(x); - //[e2024]~^ error: the trait bound `!: OnlyU32` is not satisfied - //[e2024]~| note: the trait `OnlyU32` is not implemented for `!` - //[e2024]~| note: required by a bound introduced by this call + //~^ error: the trait bound `!: OnlyU32` is not satisfied + //~| note: the trait `OnlyU32` is not implemented for `!` + //~| note: required by a bound introduced by this call - #[cfg(e2024)] requires_nothing(x); - //[e2024]~^ error: the trait bound `!: Nothing` is not satisfied - //[e2024]~| note: the trait `Nothing` is not implemented for `!` - //[e2024]~| note: required by a bound introduced by this call + //~^ error: the trait bound `!: Nothing` is not satisfied + //~| note: the trait `Nothing` is not implemented for `!` + //~| note: required by a bound introduced by this call } diff --git a/tests/ui/never_type/fallback_change/defaulted-never-note.e2024.stderr b/tests/ui/never_type/fallback_change/defaulted-never-note.stderr similarity index 84% rename from tests/ui/never_type/fallback_change/defaulted-never-note.e2024.stderr rename to tests/ui/never_type/fallback_change/defaulted-never-note.stderr index d8c6059a67d3f..b9179a58bdb89 100644 --- a/tests/ui/never_type/fallback_change/defaulted-never-note.e2024.stderr +++ b/tests/ui/never_type/fallback_change/defaulted-never-note.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `!: OnlyUnit` is not satisfied - --> $DIR/defaulted-never-note.rs:40:19 + --> $DIR/defaulted-never-note.rs:33:19 | LL | requires_unit(x); | ------------- ^ the trait `OnlyUnit` is not implemented for `!` @@ -7,20 +7,20 @@ LL | requires_unit(x); | required by a bound introduced by this call | help: the trait `OnlyUnit` is implemented for `()` - --> $DIR/defaulted-never-note.rs:13:1 + --> $DIR/defaulted-never-note.rs:8:1 | LL | impl OnlyUnit for () {} | ^^^^^^^^^^^^^^^^^^^^ = note: this error might have been caused by changes to Rust's type-inference algorithm (see issue #148922 for more information) = help: you might have intended to use the type `()` here instead note: required by a bound in `requires_unit` - --> $DIR/defaulted-never-note.rs:16:26 + --> $DIR/defaulted-never-note.rs:11:26 | LL | fn requires_unit(_: impl OnlyUnit) {} | ^^^^^^^^ required by this bound in `requires_unit` error[E0277]: the trait bound `!: OnlyU32` is not satisfied - --> $DIR/defaulted-never-note.rs:48:18 + --> $DIR/defaulted-never-note.rs:40:18 | LL | requires_u32(x); | ------------ ^ the trait `OnlyU32` is not implemented for `!` @@ -28,18 +28,18 @@ LL | requires_u32(x); | required by a bound introduced by this call | help: the trait `OnlyU32` is implemented for `u32` - --> $DIR/defaulted-never-note.rs:23:1 + --> $DIR/defaulted-never-note.rs:17:1 | LL | impl OnlyU32 for u32 {} | ^^^^^^^^^^^^^^^^^^^^ note: required by a bound in `requires_u32` - --> $DIR/defaulted-never-note.rs:26:25 + --> $DIR/defaulted-never-note.rs:20:25 | LL | fn requires_u32(_: impl OnlyU32) {} | ^^^^^^^ required by this bound in `requires_u32` error[E0277]: the trait bound `!: Nothing` is not satisfied - --> $DIR/defaulted-never-note.rs:54:22 + --> $DIR/defaulted-never-note.rs:45:22 | LL | requires_nothing(x); | ---------------- ^ the trait `Nothing` is not implemented for `!` @@ -47,12 +47,12 @@ LL | requires_nothing(x); | required by a bound introduced by this call | help: this trait has no implementations, consider adding one - --> $DIR/defaulted-never-note.rs:31:1 + --> $DIR/defaulted-never-note.rs:24:1 | LL | trait Nothing {} | ^^^^^^^^^^^^^ note: required by a bound in `requires_nothing` - --> $DIR/defaulted-never-note.rs:34:29 + --> $DIR/defaulted-never-note.rs:27:29 | LL | fn requires_nothing(_: impl Nothing) {} | ^^^^^^^ required by this bound in `requires_nothing` diff --git a/tests/ui/never_type/fallback_change/dependency-on-fallback-to-unit.rs b/tests/ui/never_type/fallback_change/dependency-on-fallback-to-unit.rs index 9cbce58ba4ad7..3ef44bae33e1a 100644 --- a/tests/ui/never_type/fallback_change/dependency-on-fallback-to-unit.rs +++ b/tests/ui/never_type/fallback_change/dependency-on-fallback-to-unit.rs @@ -4,10 +4,9 @@ fn main() { } fn def() { - //~^ error: this function depends on never type fallback being `()` - //~| warn: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! match true { false => <_>::default(), + //~^ error: the trait bound `!: Default` is not satisfied true => return, }; } @@ -15,9 +14,8 @@ fn def() { // // fn question_mark() -> Result<(), ()> { - //~^ error: this function depends on never type fallback being `()` - //~| warn: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! deserialize()?; + //~^ error: the trait bound `!: Default` is not satisfied Ok(()) } diff --git a/tests/ui/never_type/fallback_change/dependency-on-fallback-to-unit.stderr b/tests/ui/never_type/fallback_change/dependency-on-fallback-to-unit.stderr index 7f041260c03a8..1dd6b37dedd33 100644 --- a/tests/ui/never_type/fallback_change/dependency-on-fallback-to-unit.stderr +++ b/tests/ui/never_type/fallback_change/dependency-on-fallback-to-unit.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `!: Default` is not satisfied - --> $DIR/dependency-on-fallback-to-unit.rs:10:19 + --> $DIR/dependency-on-fallback-to-unit.rs:8:19 | LL | false => <_>::default(), | ^ the trait `Default` is not implemented for `!` @@ -8,7 +8,7 @@ LL | false => <_>::default(), = help: you might have intended to use the type `()` here instead error[E0277]: the trait bound `!: Default` is not satisfied - --> $DIR/dependency-on-fallback-to-unit.rs:20:5 + --> $DIR/dependency-on-fallback-to-unit.rs:17:5 | LL | deserialize()?; | ^^^^^^^^^^^^^ the trait `Default` is not implemented for `!` @@ -16,7 +16,7 @@ LL | deserialize()?; = note: this error might have been caused by changes to Rust's type-inference algorithm (see issue #148922 for more information) = help: you might have intended to use the type `()` here instead note: required by a bound in `deserialize` - --> $DIR/dependency-on-fallback-to-unit.rs:24:19 + --> $DIR/dependency-on-fallback-to-unit.rs:22:19 | LL | fn deserialize() -> Result { | ^^^^^^^ required by this bound in `deserialize` diff --git a/tests/ui/never_type/fallback_change/diverging-fallback-unconstrained-return.rs b/tests/ui/never_type/fallback_change/diverging-fallback-unconstrained-return.rs index 1c8ce71080bfb..19d5601475d46 100644 --- a/tests/ui/never_type/fallback_change/diverging-fallback-unconstrained-return.rs +++ b/tests/ui/never_type/fallback_change/diverging-fallback-unconstrained-return.rs @@ -4,8 +4,7 @@ // in the objc crate, where changing the fallback from `!` to `()` // resulted in unsoundness. // -//@ revisions: e2021 e2024 -//@[e2024] edition: 2024 +//@ edition: 2018..2024 #![expect(unit_bindings)] @@ -24,9 +23,6 @@ fn unconstrained_return() -> T { } fn main() { - //[e2021]~^ error: this function depends on never type fallback being `()` - //[e2021]~| warn: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - // In Ye Olde Days, the `T` parameter of `unconstrained_return` // winds up "entangled" with the `!` type that results from // `panic!`, and hence falls back to `()`. This is kind of unfortunate @@ -34,5 +30,5 @@ fn main() { // idea was to change that fallback to `!`, but that would have resulted // in this code no longer compiling (or worse, in some cases it injected // unsound results). - let _ = if true { unconstrained_return() } else { panic!() }; //[e2024]~ error: the trait bound `!: UnitReturn` is not satisfied + let _ = if true { unconstrained_return() } else { panic!() }; //~ error: the trait bound `!: UnitReturn` is not satisfied } diff --git a/tests/ui/never_type/fallback_change/diverging-fallback-unconstrained-return.stderr b/tests/ui/never_type/fallback_change/diverging-fallback-unconstrained-return.stderr new file mode 100644 index 0000000000000..cdadbc2bc6574 --- /dev/null +++ b/tests/ui/never_type/fallback_change/diverging-fallback-unconstrained-return.stderr @@ -0,0 +1,24 @@ +error[E0277]: the trait bound `!: UnitReturn` is not satisfied + --> $DIR/diverging-fallback-unconstrained-return.rs:33:23 + | +LL | let _ = if true { unconstrained_return() } else { panic!() }; + | ^^^^^^^^^^^^^^^^^^^^^^ the trait `UnitReturn` is not implemented for `!` + | +help: the following other types implement trait `UnitReturn` + --> $DIR/diverging-fallback-unconstrained-return.rs:14:1 + | +LL | impl UnitReturn for i32 {} + | ^^^^^^^^^^^^^^^^^^^^^^^ `i32` +LL | impl UnitReturn for () {} + | ^^^^^^^^^^^^^^^^^^^^^^ `()` + = note: this error might have been caused by changes to Rust's type-inference algorithm (see issue #148922 for more information) + = help: you might have intended to use the type `()` here instead +note: required by a bound in `unconstrained_return` + --> $DIR/diverging-fallback-unconstrained-return.rs:17:28 + | +LL | fn unconstrained_return() -> T { + | ^^^^^^^^^^ required by this bound in `unconstrained_return` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/never_type/fallback_change/dont-suggest-turbofish-from-expansion.rs b/tests/ui/never_type/fallback_change/dont-suggest-turbofish-from-expansion.rs deleted file mode 100644 index 7bae1ddc027f6..0000000000000 --- a/tests/ui/never_type/fallback_change/dont-suggest-turbofish-from-expansion.rs +++ /dev/null @@ -1,18 +0,0 @@ -fn create_ok_default() -> Result -where - C: Default, -{ - Ok(C::default()) -} - -fn main() -> Result<(), ()> { - //~^ ERROR this function depends on never type fallback being `()` - //~| WARN this was previously accepted by the compiler but is being phased out - let (returned_value, _) = (|| { - let created = create_ok_default()?; - Ok((created, ())) - })()?; - - let _ = format_args!("{:?}", returned_value); - Ok(()) -} diff --git a/tests/ui/never_type/fallback_change/dont-suggest-turbofish-from-expansion.stderr b/tests/ui/never_type/fallback_change/dont-suggest-turbofish-from-expansion.stderr deleted file mode 100644 index 48a84f5c70314..0000000000000 --- a/tests/ui/never_type/fallback_change/dont-suggest-turbofish-from-expansion.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error[E0277]: the trait bound `!: Default` is not satisfied - --> $DIR/dont-suggest-turbofish-from-expansion.rs:12:23 - | -LL | let created = create_ok_default()?; - | ^^^^^^^^^^^^^^^^^^^ the trait `Default` is not implemented for `!` - | - = note: this error might have been caused by changes to Rust's type-inference algorithm (see issue #148922 for more information) - = help: you might have intended to use the type `()` here instead -note: required by a bound in `create_ok_default` - --> $DIR/dont-suggest-turbofish-from-expansion.rs:3:8 - | -LL | fn create_ok_default() -> Result - | ----------------- required by a bound in this function -LL | where -LL | C: Default, - | ^^^^^^^ required by this bound in `create_ok_default` - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/never_type/fallback_change/fallback-closure-ret.rs b/tests/ui/never_type/fallback_change/fallback-closure-ret.rs index 11d7c685706b4..0023478dbea56 100644 --- a/tests/ui/never_type/fallback_change/fallback-closure-ret.rs +++ b/tests/ui/never_type/fallback_change/fallback-closure-ret.rs @@ -5,11 +5,7 @@ // never type fallback. However, it got removed, so now this is an example of // expected breakage from the never type fallback change. // -//@ revisions: e2021 e2024 -//@[e2021] edition: 2021 -//@[e2024] edition: 2024 -// -//@[e2021] check-pass +//@ edition: 2018..2024 trait Bar {} impl Bar for () {} @@ -17,7 +13,6 @@ impl Bar for u32 {} fn foo(_: impl Fn() -> R) {} -#[cfg_attr(e2021, expect(dependency_on_unit_never_type_fallback))] fn main() { - foo(|| panic!()); //[e2024]~ error: the trait bound `!: Bar` is not satisfied + foo(|| panic!()); //~ error: the trait bound `!: Bar` is not satisfied } diff --git a/tests/ui/never_type/fallback_change/fallback-closure-ret.stderr b/tests/ui/never_type/fallback_change/fallback-closure-ret.stderr new file mode 100644 index 0000000000000..3249e947ac3b6 --- /dev/null +++ b/tests/ui/never_type/fallback_change/fallback-closure-ret.stderr @@ -0,0 +1,24 @@ +error[E0277]: the trait bound `!: Bar` is not satisfied + --> $DIR/fallback-closure-ret.rs:17:5 + | +LL | foo(|| panic!()); + | ^^^^^^^^^^^^^^^^ the trait `Bar` is not implemented for `!` + | +help: the following other types implement trait `Bar` + --> $DIR/fallback-closure-ret.rs:11:1 + | +LL | impl Bar for () {} + | ^^^^^^^^^^^^^^^ `()` +LL | impl Bar for u32 {} + | ^^^^^^^^^^^^^^^^ `u32` + = note: this error might have been caused by changes to Rust's type-inference algorithm (see issue #148922 for more information) + = help: you might have intended to use the type `()` here instead +note: required by a bound in `foo` + --> $DIR/fallback-closure-ret.rs:14:11 + | +LL | fn foo(_: impl Fn() -> R) {} + | ^^^ required by this bound in `foo` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/never_type/fallback_change/fallback-closure-wrap.rs b/tests/ui/never_type/fallback_change/fallback-closure-wrap.rs index 51be6ac06cc21..1a93cc7f1c4d2 100644 --- a/tests/ui/never_type/fallback_change/fallback-closure-wrap.rs +++ b/tests/ui/never_type/fallback_change/fallback-closure-wrap.rs @@ -4,18 +4,14 @@ // Crater did not find many cases of this occurring, but it is included for // awareness. // -//@ revisions: e2021 e2024 -//@[e2021] edition: 2021 -//@[e2024] edition: 2024 -// -//@[e2021] check-pass +//@ edition 2015..2024 use std::marker::PhantomData; fn main() { let error = Closure::wrap(Box::new(move || { panic!("Can't connect to server."); - //[e2024]~^ ERROR to return `()`, but it returns `!` + //~^ ERROR to return `()`, but it returns `!` }) as Box); } diff --git a/tests/ui/never_type/fallback_change/fallback-closure-wrap.stderr b/tests/ui/never_type/fallback_change/fallback-closure-wrap.stderr new file mode 100644 index 0000000000000..fd9135aa2bf38 --- /dev/null +++ b/tests/ui/never_type/fallback_change/fallback-closure-wrap.stderr @@ -0,0 +1,15 @@ +error[E0271]: expected `{closure@fallback-closure-wrap.rs:12:40}` to return `()`, but it returns `!` + --> $DIR/fallback-closure-wrap.rs:13:9 + | +LL | let error = Closure::wrap(Box::new(move || { + | ------- this closure +LL | panic!("Can't connect to server."); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `!` + | + = note: expected unit type `()` + found type `!` + = note: required for the cast from `Box<{closure@$DIR/fallback-closure-wrap.rs:12:40: 12:47}>` to `Box` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0271`. diff --git a/tests/ui/never_type/fallback_change/lint-breaking-2024-assign-underscore.fixed b/tests/ui/never_type/fallback_change/lint-breaking-2024-assign-underscore.fixed deleted file mode 100644 index 14d88503e85f0..0000000000000 --- a/tests/ui/never_type/fallback_change/lint-breaking-2024-assign-underscore.fixed +++ /dev/null @@ -1,15 +0,0 @@ -//@ run-rustfix -#![allow(unused)] - -fn foo() -> Result { - Err(()) -} - -fn test() -> Result<(), ()> { - //~^ ERROR this function depends on never type fallback being `()` - //~| WARN this was previously accepted by the compiler but is being phased out - _ = foo()?; - Ok(()) -} - -fn main() {} diff --git a/tests/ui/never_type/fallback_change/lint-breaking-2024-assign-underscore.rs b/tests/ui/never_type/fallback_change/lint-breaking-2024-assign-underscore.rs index 14d88503e85f0..a2cc1cc5108f2 100644 --- a/tests/ui/never_type/fallback_change/lint-breaking-2024-assign-underscore.rs +++ b/tests/ui/never_type/fallback_change/lint-breaking-2024-assign-underscore.rs @@ -1,4 +1,3 @@ -//@ run-rustfix #![allow(unused)] fn foo() -> Result { @@ -6,9 +5,8 @@ fn foo() -> Result { } fn test() -> Result<(), ()> { - //~^ ERROR this function depends on never type fallback being `()` - //~| WARN this was previously accepted by the compiler but is being phased out _ = foo()?; + //~^ error: the trait bound `!: Default` is not satisfied Ok(()) } diff --git a/tests/ui/never_type/fallback_change/lint-breaking-2024-assign-underscore.stderr b/tests/ui/never_type/fallback_change/lint-breaking-2024-assign-underscore.stderr index f14846d2afc9e..137fd826c1b17 100644 --- a/tests/ui/never_type/fallback_change/lint-breaking-2024-assign-underscore.stderr +++ b/tests/ui/never_type/fallback_change/lint-breaking-2024-assign-underscore.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `!: Default` is not satisfied - --> $DIR/lint-breaking-2024-assign-underscore.rs:11:9 + --> $DIR/lint-breaking-2024-assign-underscore.rs:8:9 | LL | _ = foo()?; | ^^^^^ the trait `Default` is not implemented for `!` @@ -7,7 +7,7 @@ LL | _ = foo()?; = note: this error might have been caused by changes to Rust's type-inference algorithm (see issue #148922 for more information) = help: you might have intended to use the type `()` here instead note: required by a bound in `foo` - --> $DIR/lint-breaking-2024-assign-underscore.rs:4:11 + --> $DIR/lint-breaking-2024-assign-underscore.rs:3:11 | LL | fn foo() -> Result { | ^^^^^^^ required by this bound in `foo` diff --git a/tests/ui/never_type/fallback_change/lint-never-type-fallback-flowing-into-unsafe.rs b/tests/ui/never_type/fallback_change/lint-never-type-fallback-flowing-into-unsafe.rs index 744fff4194cbb..064431d0eaed9 100644 --- a/tests/ui/never_type/fallback_change/lint-never-type-fallback-flowing-into-unsafe.rs +++ b/tests/ui/never_type/fallback_change/lint-never-type-fallback-flowing-into-unsafe.rs @@ -1,5 +1,4 @@ -//@ revisions: e2015 e2024 -//@[e2024] edition:2024 +//@ edition: 2015..2024 use std::{marker, mem, ptr}; @@ -8,10 +7,9 @@ fn main() {} fn _zero() { if false { unsafe { mem::zeroed() } - //[e2015]~^ error: never type fallback affects this call to an `unsafe` function - //[e2024]~^^ error: never type fallback affects this call to an `unsafe` function + //~^ error: never type fallback affects this call to an `unsafe` function //~| warn: this changes meaning in Rust 2024 and in a future release in all editions! - //[e2024]~| warn: the type `!` does not permit zero-initialization + //~| warn: the type `!` does not permit zero-initialization } else { return; }; @@ -25,8 +23,7 @@ fn _trans() { unsafe { struct Zst; core::mem::transmute(Zst) - //[e2015]~^ error: never type fallback affects this call to an `unsafe` function - //[e2024]~^^ error: never type fallback affects this call to an `unsafe` function + //~^ error: never type fallback affects this call to an `unsafe` function //~| warn: this changes meaning in Rust 2024 and in a future release in all editions! } } else { @@ -42,8 +39,7 @@ fn _union() { } unsafe { Union { a: () }.b } - //[e2015]~^ error: never type fallback affects this union access - //[e2024]~^^ error: never type fallback affects this union access + //~^ error: never type fallback affects this union access //~| warn: this changes meaning in Rust 2024 and in a future release in all editions! } else { return; @@ -53,8 +49,7 @@ fn _union() { fn _deref() { if false { unsafe { *ptr::from_ref(&()).cast() } - //[e2015]~^ error: never type fallback affects this raw pointer dereference - //[e2024]~^^ error: never type fallback affects this raw pointer dereference + //~^ error: never type fallback affects this raw pointer dereference //~| warn: this changes meaning in Rust 2024 and in a future release in all editions! } else { return; @@ -74,8 +69,7 @@ fn _only_generics() { let x = None; unsafe { internally_create(x) } - //[e2015]~^ error: never type fallback affects this call to an `unsafe` function - //[e2024]~^^ error: never type fallback affects this call to an `unsafe` function + //~^ error: never type fallback affects this call to an `unsafe` function //~| warn: this changes meaning in Rust 2024 and in a future release in all editions! x.unwrap() @@ -87,13 +81,11 @@ fn _only_generics() { fn _stored_function() { if false { let zeroed = mem::zeroed; - //[e2015]~^ error: never type fallback affects this `unsafe` function - //[e2024]~^^ error: never type fallback affects this `unsafe` function + //~^ error: never type fallback affects this `unsafe` function //~| warn: this changes meaning in Rust 2024 and in a future release in all editions! unsafe { zeroed() } - //[e2015]~^ error: never type fallback affects this call to an `unsafe` function - //[e2024]~^^ error: never type fallback affects this call to an `unsafe` function + //~^ error: never type fallback affects this call to an `unsafe` function //~| warn: this changes meaning in Rust 2024 and in a future release in all editions! } else { return; @@ -110,8 +102,7 @@ fn _only_generics_stored_function() { let x = None; let f = internally_create; - //[e2015]~^ error: never type fallback affects this `unsafe` function - //[e2024]~^^ error: never type fallback affects this `unsafe` function + //~^ error: never type fallback affects this `unsafe` function //~| warn: this changes meaning in Rust 2024 and in a future release in all editions! unsafe { f(x) } @@ -135,8 +126,7 @@ fn _method() { if false { unsafe { S(marker::PhantomData).create_out_of_thin_air() - //[e2015]~^ error: never type fallback affects this call to an `unsafe` method - //[e2024]~^^ error: never type fallback affects this call to an `unsafe` method + //~^ error: never type fallback affects this call to an `unsafe` method //~| warn: this changes meaning in Rust 2024 and in a future release in all editions! } } else { @@ -153,8 +143,7 @@ fn _objc() { macro_rules! msg_send { () => { match send_message::<_ /* ?0 */>() { - //[e2015]~^ error: never type fallback affects this call to an `unsafe` function - //[e2024]~^^ error: never type fallback affects this call to an `unsafe` function + //~^ error: never type fallback affects this call to an `unsafe` function //~| warn: this changes meaning in Rust 2024 and in a future release in all editions! Ok(x) => x, Err(_) => loop {}, diff --git a/tests/ui/never_type/fallback_change/lint-never-type-fallback-flowing-into-unsafe.stderr b/tests/ui/never_type/fallback_change/lint-never-type-fallback-flowing-into-unsafe.stderr new file mode 100644 index 0000000000000..69649dbde3f33 --- /dev/null +++ b/tests/ui/never_type/fallback_change/lint-never-type-fallback-flowing-into-unsafe.stderr @@ -0,0 +1,296 @@ +error: never type fallback affects this call to an `unsafe` function + --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:9:18 + | +LL | unsafe { mem::zeroed() } + | ^^^^^^^^^^^^^ + | + = help: specify the type explicitly + = warning: this changes meaning in Rust 2024 and in a future release in all editions! + = note: for more information, see + = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default +help: use `()` annotations to avoid fallback changes + | +LL | unsafe { mem::zeroed::<()>() } + | ++++++ + +error: never type fallback affects this call to an `unsafe` function + --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:25:13 + | +LL | core::mem::transmute(Zst) + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: specify the type explicitly + = warning: this changes meaning in Rust 2024 and in a future release in all editions! + = note: for more information, see +help: use `()` annotations to avoid fallback changes + | +LL | core::mem::transmute::<_, ()>(Zst) + | +++++++++ + +error: never type fallback affects this union access + --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:41:18 + | +LL | unsafe { Union { a: () }.b } + | ^^^^^^^^^^^^^^^^^ + | + = help: specify the type explicitly + = warning: this changes meaning in Rust 2024 and in a future release in all editions! + = note: for more information, see + +error: never type fallback affects this raw pointer dereference + --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:51:18 + | +LL | unsafe { *ptr::from_ref(&()).cast() } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: specify the type explicitly + = warning: this changes meaning in Rust 2024 and in a future release in all editions! + = note: for more information, see +help: use `()` annotations to avoid fallback changes + | +LL | unsafe { *ptr::from_ref(&()).cast::<()>() } + | ++++++ + +error: never type fallback affects this call to an `unsafe` function + --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:71:18 + | +LL | unsafe { internally_create(x) } + | ^^^^^^^^^^^^^^^^^^^^ + | + = help: specify the type explicitly + = warning: this changes meaning in Rust 2024 and in a future release in all editions! + = note: for more information, see +help: use `()` annotations to avoid fallback changes + | +LL | unsafe { internally_create::<()>(x) } + | ++++++ + +error: never type fallback affects this call to an `unsafe` function + --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:87:18 + | +LL | unsafe { zeroed() } + | ^^^^^^^^ + | + = help: specify the type explicitly + = warning: this changes meaning in Rust 2024 and in a future release in all editions! + = note: for more information, see +help: use `()` annotations to avoid fallback changes + | +LL | let zeroed = mem::zeroed::<()>; + | ++++++ + +error: never type fallback affects this `unsafe` function + --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:83:22 + | +LL | let zeroed = mem::zeroed; + | ^^^^^^^^^^^ + | + = help: specify the type explicitly + = warning: this changes meaning in Rust 2024 and in a future release in all editions! + = note: for more information, see +help: use `()` annotations to avoid fallback changes + | +LL | let zeroed = mem::zeroed::<()>; + | ++++++ + +error: never type fallback affects this `unsafe` function + --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:104:17 + | +LL | let f = internally_create; + | ^^^^^^^^^^^^^^^^^ + | + = help: specify the type explicitly + = warning: this changes meaning in Rust 2024 and in a future release in all editions! + = note: for more information, see +help: use `()` annotations to avoid fallback changes + | +LL | let f = internally_create::<()>; + | ++++++ + +error: never type fallback affects this call to an `unsafe` method + --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:128:13 + | +LL | S(marker::PhantomData).create_out_of_thin_air() + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: specify the type explicitly + = warning: this changes meaning in Rust 2024 and in a future release in all editions! + = note: for more information, see + +error: never type fallback affects this call to an `unsafe` function + --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:145:19 + | +LL | match send_message::<_ /* ?0 */>() { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +... +LL | msg_send!(); + | ----------- in this macro invocation + | + = help: specify the type explicitly + = warning: this changes meaning in Rust 2024 and in a future release in all editions! + = note: for more information, see + = note: this error originates in the macro `msg_send` (in Nightly builds, run with -Z macro-backtrace for more info) + +warning: the type `!` does not permit zero-initialization + --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:9:18 + | +LL | unsafe { mem::zeroed() } + | ^^^^^^^^^^^^^ this code causes undefined behavior when executed + | + = note: the `!` type has no valid value + = note: `#[warn(invalid_value)]` on by default + +error: aborting due to 10 previous errors; 1 warning emitted + +Future incompatibility report: Future breakage diagnostic: +error: never type fallback affects this call to an `unsafe` function + --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:9:18 + | +LL | unsafe { mem::zeroed() } + | ^^^^^^^^^^^^^ + | + = help: specify the type explicitly + = warning: this changes meaning in Rust 2024 and in a future release in all editions! + = note: for more information, see + = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default +help: use `()` annotations to avoid fallback changes + | +LL | unsafe { mem::zeroed::<()>() } + | ++++++ + +Future breakage diagnostic: +error: never type fallback affects this call to an `unsafe` function + --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:25:13 + | +LL | core::mem::transmute(Zst) + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: specify the type explicitly + = warning: this changes meaning in Rust 2024 and in a future release in all editions! + = note: for more information, see + = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default +help: use `()` annotations to avoid fallback changes + | +LL | core::mem::transmute::<_, ()>(Zst) + | +++++++++ + +Future breakage diagnostic: +error: never type fallback affects this union access + --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:41:18 + | +LL | unsafe { Union { a: () }.b } + | ^^^^^^^^^^^^^^^^^ + | + = help: specify the type explicitly + = warning: this changes meaning in Rust 2024 and in a future release in all editions! + = note: for more information, see + = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default + +Future breakage diagnostic: +error: never type fallback affects this raw pointer dereference + --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:51:18 + | +LL | unsafe { *ptr::from_ref(&()).cast() } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: specify the type explicitly + = warning: this changes meaning in Rust 2024 and in a future release in all editions! + = note: for more information, see + = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default +help: use `()` annotations to avoid fallback changes + | +LL | unsafe { *ptr::from_ref(&()).cast::<()>() } + | ++++++ + +Future breakage diagnostic: +error: never type fallback affects this call to an `unsafe` function + --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:71:18 + | +LL | unsafe { internally_create(x) } + | ^^^^^^^^^^^^^^^^^^^^ + | + = help: specify the type explicitly + = warning: this changes meaning in Rust 2024 and in a future release in all editions! + = note: for more information, see + = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default +help: use `()` annotations to avoid fallback changes + | +LL | unsafe { internally_create::<()>(x) } + | ++++++ + +Future breakage diagnostic: +error: never type fallback affects this call to an `unsafe` function + --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:87:18 + | +LL | unsafe { zeroed() } + | ^^^^^^^^ + | + = help: specify the type explicitly + = warning: this changes meaning in Rust 2024 and in a future release in all editions! + = note: for more information, see + = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default +help: use `()` annotations to avoid fallback changes + | +LL | let zeroed = mem::zeroed::<()>; + | ++++++ + +Future breakage diagnostic: +error: never type fallback affects this `unsafe` function + --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:83:22 + | +LL | let zeroed = mem::zeroed; + | ^^^^^^^^^^^ + | + = help: specify the type explicitly + = warning: this changes meaning in Rust 2024 and in a future release in all editions! + = note: for more information, see + = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default +help: use `()` annotations to avoid fallback changes + | +LL | let zeroed = mem::zeroed::<()>; + | ++++++ + +Future breakage diagnostic: +error: never type fallback affects this `unsafe` function + --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:104:17 + | +LL | let f = internally_create; + | ^^^^^^^^^^^^^^^^^ + | + = help: specify the type explicitly + = warning: this changes meaning in Rust 2024 and in a future release in all editions! + = note: for more information, see + = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default +help: use `()` annotations to avoid fallback changes + | +LL | let f = internally_create::<()>; + | ++++++ + +Future breakage diagnostic: +error: never type fallback affects this call to an `unsafe` method + --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:128:13 + | +LL | S(marker::PhantomData).create_out_of_thin_air() + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: specify the type explicitly + = warning: this changes meaning in Rust 2024 and in a future release in all editions! + = note: for more information, see + = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default + +Future breakage diagnostic: +error: never type fallback affects this call to an `unsafe` function + --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:145:19 + | +LL | match send_message::<_ /* ?0 */>() { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +... +LL | msg_send!(); + | ----------- in this macro invocation + | + = help: specify the type explicitly + = warning: this changes meaning in Rust 2024 and in a future release in all editions! + = note: for more information, see + = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default + = note: this error originates in the macro `msg_send` (in Nightly builds, run with -Z macro-backtrace for more info) + diff --git a/tests/ui/never_type/fallback_change/try-block-never-type-fallback.rs b/tests/ui/never_type/fallback_change/try-block-never-type-fallback.rs index 770fc6f58c722..a4b217b70bb73 100644 --- a/tests/ui/never_type/fallback_change/try-block-never-type-fallback.rs +++ b/tests/ui/never_type/fallback_change/try-block-never-type-fallback.rs @@ -1,13 +1,11 @@ -//@ revisions: e2021 e2024 -//@[e2021] edition: 2021 -//@[e2024] edition: 2024 -//@[e2024] check-pass +//@ check-pass +//@ edition: 2018..2024 // Issue #125364: Bad interaction between never_type, try_blocks, and From/Into // -// In edition 2021, the never type in try blocks falls back to (), +// Previouslyu, the never type in try blocks used to fall back to (), // causing a type error (since (): Into does not hold). -// In edition 2024, it falls back to !, allowing the code to compile correctly. +// Nowdays, it falls back to !, allowing the code to compile correctly. #![feature(try_blocks)] @@ -17,8 +15,6 @@ fn bar(_: Result, u32>) { fn foo(x: Result) { bar(try { x? }); - //[e2021]~^ ERROR the trait bound `!: From<()>` is not satisfied } -fn main() { -} +fn main() {} From a87e47ec454d4e139518ab673fee75f60ed7433b Mon Sep 17 00:00:00 2001 From: Waffle Lapkin Date: Fri, 15 Aug 2025 02:10:40 +0200 Subject: [PATCH 10/18] Make `Infallible = !` --- library/core/src/convert/mod.rs | 102 +----------------------------- library/core/src/num/error.rs | 14 +--- library/core/src/ops/try_trait.rs | 2 +- library/std/src/process.rs | 8 --- 4 files changed, 3 insertions(+), 123 deletions(-) diff --git a/library/core/src/convert/mod.rs b/library/core/src/convert/mod.rs index ef4ab15f93c0b..60437b8f7504e 100644 --- a/library/core/src/convert/mod.rs +++ b/library/core/src/convert/mod.rs @@ -35,9 +35,6 @@ #![stable(feature = "rust1", since = "1.0.0")] -use crate::error::Error; -use crate::fmt; -use crate::hash::{Hash, Hasher}; use crate::marker::PointeeSized; mod num; @@ -898,102 +895,5 @@ impl const AsMut for str { /// } /// } /// ``` -/// -/// # Future compatibility -/// -/// This enum has the same role as [the `!` “never” type][never], -/// which is unstable in this version of Rust. -/// When `!` is stabilized, we plan to make `Infallible` a type alias to it: -/// -/// ```ignore (illustrates future std change) -/// pub type Infallible = !; -/// ``` -/// -/// … and eventually deprecate `Infallible`. -/// -/// However there is one case where `!` syntax can be used -/// before `!` is stabilized as a full-fledged type: in the position of a function’s return type. -/// Specifically, it is possible to have implementations for two different function pointer types: -/// -/// ``` -/// trait MyTrait {} -/// impl MyTrait for fn() -> ! {} -/// impl MyTrait for fn() -> std::convert::Infallible {} -/// ``` -/// -/// With `Infallible` being an enum, this code is valid. -/// However when `Infallible` becomes an alias for the never type, -/// the two `impl`s will start to overlap -/// and therefore will be disallowed by the language’s trait coherence rules. -#[stable(feature = "convert_infallible", since = "1.34.0")] -#[derive(Copy)] -pub enum Infallible {} - -#[stable(feature = "convert_infallible", since = "1.34.0")] -#[rustc_const_unstable(feature = "const_clone", issue = "142757")] -impl const Clone for Infallible { - fn clone(&self) -> Infallible { - match *self {} - } -} - -#[stable(feature = "convert_infallible", since = "1.34.0")] -impl fmt::Debug for Infallible { - fn fmt(&self, _: &mut fmt::Formatter<'_>) -> fmt::Result { - match *self {} - } -} - -#[stable(feature = "convert_infallible", since = "1.34.0")] -impl fmt::Display for Infallible { - fn fmt(&self, _: &mut fmt::Formatter<'_>) -> fmt::Result { - match *self {} - } -} - -#[stable(feature = "str_parse_error2", since = "1.8.0")] -impl Error for Infallible {} - -#[stable(feature = "convert_infallible", since = "1.34.0")] -#[rustc_const_unstable(feature = "const_cmp", issue = "143800")] -impl const PartialEq for Infallible { - fn eq(&self, _: &Infallible) -> bool { - match *self {} - } -} - -#[stable(feature = "convert_infallible", since = "1.34.0")] -#[rustc_const_unstable(feature = "const_cmp", issue = "143800")] -impl const Eq for Infallible {} - -#[stable(feature = "convert_infallible", since = "1.34.0")] -#[rustc_const_unstable(feature = "const_cmp", issue = "143800")] -impl const PartialOrd for Infallible { - fn partial_cmp(&self, _other: &Self) -> Option { - match *self {} - } -} - #[stable(feature = "convert_infallible", since = "1.34.0")] -#[rustc_const_unstable(feature = "const_cmp", issue = "143800")] -impl const Ord for Infallible { - fn cmp(&self, _other: &Self) -> crate::cmp::Ordering { - match *self {} - } -} - -#[stable(feature = "convert_infallible", since = "1.34.0")] -#[rustc_const_unstable(feature = "const_convert", issue = "143773")] -impl const From for Infallible { - #[inline] - fn from(x: !) -> Self { - x - } -} - -#[stable(feature = "convert_infallible_hash", since = "1.44.0")] -impl Hash for Infallible { - fn hash(&self, _: &mut H) { - match *self {} - } -} +pub type Infallible = !; diff --git a/library/core/src/num/error.rs b/library/core/src/num/error.rs index 66b92a31bc048..c4e3184286b0e 100644 --- a/library/core/src/num/error.rs +++ b/library/core/src/num/error.rs @@ -1,6 +1,5 @@ //! Error types for conversion to integral types. -use crate::convert::Infallible; use crate::error::Error; use crate::fmt; @@ -19,23 +18,12 @@ impl fmt::Display for TryFromIntError { #[stable(feature = "try_from", since = "1.34.0")] impl Error for TryFromIntError {} -#[stable(feature = "try_from", since = "1.34.0")] -#[rustc_const_unstable(feature = "const_convert", issue = "143773")] -impl const From for TryFromIntError { - fn from(x: Infallible) -> TryFromIntError { - match x {} - } -} - #[stable(feature = "never_type", since = "CURRENT_RUSTC_VERSION")] #[rustc_const_unstable(feature = "const_convert", issue = "143773")] impl const From for TryFromIntError { #[inline] fn from(never: !) -> TryFromIntError { - // Match rather than coerce to make sure that code like - // `From for TryFromIntError` above will keep working - // when `Infallible` becomes an alias to `!`. - match never {} + never } } diff --git a/library/core/src/ops/try_trait.rs b/library/core/src/ops/try_trait.rs index 34000f6d6b218..743ac9241499c 100644 --- a/library/core/src/ops/try_trait.rs +++ b/library/core/src/ops/try_trait.rs @@ -229,7 +229,7 @@ pub const trait Try: [const] FromResidual { all( from_desugaring = "QuestionMark", Self = "core::result::Result", - R = "core::option::Option", + R = "core::option::Option", ), message = "the `?` operator can only be used on `Result`s, not `Option`s, \ in {ItemContext} that returns `Result`", diff --git a/library/std/src/process.rs b/library/std/src/process.rs index 321b68b3225ad..b8e08840340d9 100644 --- a/library/std/src/process.rs +++ b/library/std/src/process.rs @@ -161,7 +161,6 @@ ))] mod tests; -use crate::convert::Infallible; use crate::ffi::OsStr; use crate::io::prelude::*; use crate::io::{self, BorrowedCursor, IoSlice, IoSliceMut}; @@ -2593,13 +2592,6 @@ impl Termination for ! { } } -#[stable(feature = "termination_trait_lib", since = "1.61.0")] -impl Termination for Infallible { - fn report(self) -> ExitCode { - match self {} - } -} - #[stable(feature = "termination_trait_lib", since = "1.61.0")] impl Termination for ExitCode { #[inline] From 3a556fd0ef8c33d5ba476395c5bcbbd066e81015 Mon Sep 17 00:00:00 2001 From: Waffle Lapkin Date: Fri, 15 Aug 2025 04:04:54 +0200 Subject: [PATCH 11/18] fixup tests to account for `Infallible = !` --- .../item-collection/opaque-return-impls.rs | 2 +- tests/rustdoc-json/blanket_impls.rs | 3 +-- .../coerce-issue-49593-box-never.e2021.stderr | 19 --------------- .../coercion/coerce-issue-49593-box-never.rs | 6 ++--- .../generic-const-items/unsatisfied-bounds.rs | 4 ++-- .../unsatisfied-bounds.stderr | 16 ++++--------- .../question-mark-result-err-mismatch.rs | 6 ++--- .../question-mark-result-err-mismatch.stderr | 6 ++--- tests/ui/try-trait/bad-interconversion.stderr | 24 +++++++++---------- tests/ui/try-trait/option-to-result.stderr | 2 +- 10 files changed, 29 insertions(+), 59 deletions(-) delete mode 100644 tests/ui/coercion/coerce-issue-49593-box-never.e2021.stderr diff --git a/tests/codegen-units/item-collection/opaque-return-impls.rs b/tests/codegen-units/item-collection/opaque-return-impls.rs index 484fbe7fe62f1..d2781b356e976 100644 --- a/tests/codegen-units/item-collection/opaque-return-impls.rs +++ b/tests/codegen-units/item-collection/opaque-return-impls.rs @@ -79,7 +79,7 @@ pub fn foo3() -> Box> { //~ MONO_ITEM fn ::nth //~ MONO_ITEM fn ::size_hint //~ MONO_ITEM fn ::try_fold::, {closure@::spec_advance_by::{closure#0}}, std::option::Option>> -//~ MONO_ITEM fn > as std::ops::FromResidual>>::from_residual +//~ MONO_ITEM fn > as std::ops::FromResidual>>::from_residual //~ MONO_ITEM fn > as std::ops::Try>::branch //~ MONO_ITEM fn > as std::ops::Try>::from_output //~ MONO_ITEM fn foo3 diff --git a/tests/rustdoc-json/blanket_impls.rs b/tests/rustdoc-json/blanket_impls.rs index d500bf5af6bd7..780d92d41314f 100644 --- a/tests/rustdoc-json/blanket_impls.rs +++ b/tests/rustdoc-json/blanket_impls.rs @@ -3,6 +3,5 @@ #![no_std] //@ has "$.index[?(@.name=='Error')].inner.assoc_type" -//@ has "$.index[?(@.name=='Error')].inner.assoc_type.type.resolved_path" -//@ has "$.index[?(@.name=='Error')].inner.assoc_type.type.resolved_path.path" \"Infallible\" +//@ has "$.index[?(@.name=='Error')].inner.assoc_type.type.primitive" \"never\" pub struct ForBlanketTryFromImpl; diff --git a/tests/ui/coercion/coerce-issue-49593-box-never.e2021.stderr b/tests/ui/coercion/coerce-issue-49593-box-never.e2021.stderr deleted file mode 100644 index 214c37febc06b..0000000000000 --- a/tests/ui/coercion/coerce-issue-49593-box-never.e2021.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0277]: the trait bound `(): std::error::Error` is not satisfied - --> $DIR/coerce-issue-49593-box-never.rs:28:5 - | -LL | Box::new(x) - | ^^^^^^^^^^^ the trait `std::error::Error` is not implemented for `()` - | - = note: required for the cast from `Box<()>` to `Box<(dyn std::error::Error + 'static)>` - -error[E0277]: the trait bound `(): std::error::Error` is not satisfied - --> $DIR/coerce-issue-49593-box-never.rs:33:5 - | -LL | raw_ptr(x) - | ^^^^^^^^^^ the trait `std::error::Error` is not implemented for `()` - | - = note: required for the cast from `*mut ()` to `*mut (dyn std::error::Error + 'static)` - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/coercion/coerce-issue-49593-box-never.rs b/tests/ui/coercion/coerce-issue-49593-box-never.rs index 6b1ec2a849d6d..85da6ab0d390d 100644 --- a/tests/ui/coercion/coerce-issue-49593-box-never.rs +++ b/tests/ui/coercion/coerce-issue-49593-box-never.rs @@ -6,14 +6,14 @@ // This used to fail because we tried to coerce `! -> dyn Error`, which then // failed because we were trying to pass an unsized value by value, etc. // -// On edition <= 2021 this currently fails because of never type fallback to +// On edition <= 2021 this used to fail because of never type fallback to // unit. // //@ revisions: e2021 e2024 //@[e2021] edition: 2021 //@[e2024] edition: 2024 // -//@[e2024] check-pass +//@ check-pass use std::error::Error; use std::mem; @@ -24,12 +24,10 @@ fn raw_ptr(t: T) -> *mut T { fn foo(x: !) -> Box { Box::new(x) - //[e2021]~^ ERROR trait bound `(): std::error::Error` is not satisfied } fn foo_raw_ptr(x: !) -> *mut dyn Error { raw_ptr(x) - //[e2021]~^ ERROR trait bound `(): std::error::Error` is not satisfied } fn main() {} diff --git a/tests/ui/generic-const-items/unsatisfied-bounds.rs b/tests/ui/generic-const-items/unsatisfied-bounds.rs index 058799001725b..d203297c78e9e 100644 --- a/tests/ui/generic-const-items/unsatisfied-bounds.rs +++ b/tests/ui/generic-const-items/unsatisfied-bounds.rs @@ -28,7 +28,7 @@ impl

Trait

for () { fn main() { let () = C::; //~ ERROR the trait bound `String: Copy` is not satisfied - let () = K::<()>; //~ ERROR the trait bound `Infallible: From<()>` is not satisfied + let () = K::<()>; //~ ERROR the trait bound `!: From<()>` is not satisfied let _ = <() as Trait>>::A; //~ ERROR the trait bound `Vec: Copy` is not satisfied - let _ = <() as Trait<&'static str>>::B::<()>; //~ ERROR the trait bound `Infallible: From<()>` is not satisfied + let _ = <() as Trait<&'static str>>::B::<()>; //~ ERROR the trait bound `!: From<()>` is not satisfied } diff --git a/tests/ui/generic-const-items/unsatisfied-bounds.stderr b/tests/ui/generic-const-items/unsatisfied-bounds.stderr index dc243e342dd9a..06cd935fae4c0 100644 --- a/tests/ui/generic-const-items/unsatisfied-bounds.stderr +++ b/tests/ui/generic-const-items/unsatisfied-bounds.stderr @@ -10,16 +10,12 @@ note: required by a bound in `C` LL | const C: () = (); | ^^^^ required by this bound in `C` -error[E0277]: the trait bound `Infallible: From<()>` is not satisfied +error[E0277]: the trait bound `!: From<()>` is not satisfied --> $DIR/unsatisfied-bounds.rs:31:18 | LL | let () = K::<()>; - | ^^ the trait `From<()>` is not implemented for `Infallible` + | ^^ the trait `From<()>` is not implemented for `!` | -help: the trait `From<()>` is not implemented for `Infallible` - but trait `From` is implemented for it - --> $SRC_DIR/core/src/convert/mod.rs:LL:COL - = help: for that trait implementation, expected `!`, found `()` note: required by a bound in `K` --> $DIR/unsatisfied-bounds.rs:12:17 | @@ -44,16 +40,12 @@ LL | where LL | P: Copy; | ^^^^ required by this bound in `Trait::A` -error[E0277]: the trait bound `Infallible: From<()>` is not satisfied +error[E0277]: the trait bound `!: From<()>` is not satisfied --> $DIR/unsatisfied-bounds.rs:33:46 | LL | let _ = <() as Trait<&'static str>>::B::<()>; - | ^^ the trait `From<()>` is not implemented for `Infallible` + | ^^ the trait `From<()>` is not implemented for `!` | -help: the trait `From<()>` is not implemented for `Infallible` - but trait `From` is implemented for it - --> $SRC_DIR/core/src/convert/mod.rs:LL:COL - = help: for that trait implementation, expected `!`, found `()` note: required by a bound in `Trait::B` --> $DIR/unsatisfied-bounds.rs:21:21 | diff --git a/tests/ui/traits/question-mark-result-err-mismatch.rs b/tests/ui/traits/question-mark-result-err-mismatch.rs index f9ca6e0ab4483..bf6e219b86f71 100644 --- a/tests/ui/traits/question-mark-result-err-mismatch.rs +++ b/tests/ui/traits/question-mark-result-err-mismatch.rs @@ -18,7 +18,7 @@ fn foo() -> Result { //~ NOTE expected `String` because of this //~| NOTE in this expansion of desugaring of operator `?` //~| NOTE the trait `From<()>` is not implemented for `String` //~| NOTE the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait - //~| NOTE required for `Result` to implement `FromResidual>` + //~| NOTE required for `Result` to implement `FromResidual>` Ok(one.to_string()) } @@ -34,7 +34,7 @@ fn bar() -> Result<(), String> { //~ NOTE expected `String` because of this //~| NOTE this can't be annotated with `?` because it has type `Result<_, ()>` //~| NOTE the trait `From<()>` is not implemented for `String` //~| NOTE the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait - //~| NOTE required for `Result<(), String>` to implement `FromResidual>` + //~| NOTE required for `Result<(), String>` to implement `FromResidual>` //~| HELP `String` implements trait `From`: Ok(one) } @@ -53,7 +53,7 @@ fn baz() -> Result { //~ NOTE expected `String` because of this //~| NOTE in this expansion of desugaring of operator `?` //~| NOTE the trait `From<()>` is not implemented for `String` //~| NOTE the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait - //~| NOTE required for `Result` to implement `FromResidual>` + //~| NOTE required for `Result` to implement `FromResidual>` Ok(one.to_string()) } diff --git a/tests/ui/traits/question-mark-result-err-mismatch.stderr b/tests/ui/traits/question-mark-result-err-mismatch.stderr index 3739b508a8689..38639a9fb6229 100644 --- a/tests/ui/traits/question-mark-result-err-mismatch.stderr +++ b/tests/ui/traits/question-mark-result-err-mismatch.stderr @@ -14,7 +14,7 @@ LL | .map(|()| "")?; | ^ the trait `From<()>` is not implemented for `String` | = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait - = note: required for `Result` to implement `FromResidual>` + = note: required for `Result` to implement `FromResidual>` error[E0277]: `?` couldn't convert the error to `String` --> $DIR/question-mark-result-err-mismatch.rs:29:25 @@ -37,7 +37,7 @@ LL | .map_err(|_| ())?; From> From> From - = note: required for `Result<(), String>` to implement `FromResidual>` + = note: required for `Result<(), String>` to implement `FromResidual>` error[E0277]: `?` couldn't convert the error to `String` --> $DIR/question-mark-result-err-mismatch.rs:49:11 @@ -55,7 +55,7 @@ LL | | })?; | this can't be annotated with `?` because it has type `Result<_, ()>` | = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait - = note: required for `Result` to implement `FromResidual>` + = note: required for `Result` to implement `FromResidual>` error: aborting due to 3 previous errors diff --git a/tests/ui/try-trait/bad-interconversion.stderr b/tests/ui/try-trait/bad-interconversion.stderr index e1cc7a45e5de9..51a9a8d759338 100644 --- a/tests/ui/try-trait/bad-interconversion.stderr +++ b/tests/ui/try-trait/bad-interconversion.stderr @@ -38,7 +38,7 @@ error[E0277]: the `?` operator can only be used on `Result`s in a function that LL | fn control_flow_to_result() -> Result { | -------------------------------------------------- this function returns a `Result` LL | Ok(ControlFlow::Break(123)?) - | ^ this `?` produces `ControlFlow<{integer}, Infallible>`, which is incompatible with `Result` + | ^ this `?` produces `ControlFlow<{integer}, !>`, which is incompatible with `Result` error[E0277]: the `?` operator can only be used on `Option`s, not `Result`s, in a function that returns `Option` --> $DIR/bad-interconversion.rs:20:22 @@ -46,7 +46,7 @@ error[E0277]: the `?` operator can only be used on `Option`s, not `Result`s, in LL | fn result_to_option() -> Option { | ------------------------------------ this function returns an `Option` LL | Some(Err("hello")?) - | ^ use `.ok()?` if you want to discard the `Result` error information + | ^ use `.ok()?` if you want to discard the `Result` error information error[E0277]: the `?` operator can only be used on `Option`s in a function that returns `Option` --> $DIR/bad-interconversion.rs:25:33 @@ -54,7 +54,7 @@ error[E0277]: the `?` operator can only be used on `Option`s in a function that LL | fn control_flow_to_option() -> Option { | ------------------------------------------ this function returns an `Option` LL | Some(ControlFlow::Break(123)?) - | ^ this `?` produces `ControlFlow<{integer}, Infallible>`, which is incompatible with `Option` + | ^ this `?` produces `ControlFlow<{integer}, !>`, which is incompatible with `Option` error[E0277]: the `?` operator can only be used on `ControlFlow`s in a function that returns `ControlFlow` --> $DIR/bad-interconversion.rs:30:39 @@ -62,12 +62,12 @@ error[E0277]: the `?` operator can only be used on `ControlFlow`s in a function LL | fn result_to_control_flow() -> ControlFlow { | -------------------------------------------------- this function returns a `ControlFlow` LL | ControlFlow::Continue(Err("hello")?) - | ^ this `?` produces `Result`, which is incompatible with `ControlFlow` + | ^ this `?` produces `Result`, which is incompatible with `ControlFlow` | -help: the trait `FromResidual>` is not implemented for `ControlFlow` - but trait `FromResidual>` is implemented for it +help: the trait `FromResidual>` is not implemented for `ControlFlow` + but trait `FromResidual>` is implemented for it --> $SRC_DIR/core/src/ops/control_flow.rs:LL:COL - = help: for that trait implementation, expected `ControlFlow`, found `Result` + = help: for that trait implementation, expected `ControlFlow`, found `Result` error[E0277]: the `?` operator can only be used on `ControlFlow`s in a function that returns `ControlFlow` --> $DIR/bad-interconversion.rs:35:12 @@ -75,12 +75,12 @@ error[E0277]: the `?` operator can only be used on `ControlFlow`s in a function LL | fn option_to_control_flow() -> ControlFlow { | ----------------------------------------------- this function returns a `ControlFlow` LL | Some(3)?; - | ^ this `?` produces `Option`, which is incompatible with `ControlFlow` + | ^ this `?` produces `Option`, which is incompatible with `ControlFlow` | -help: the trait `FromResidual>` is not implemented for `ControlFlow` - but trait `FromResidual>` is implemented for it +help: the trait `FromResidual>` is not implemented for `ControlFlow` + but trait `FromResidual>` is implemented for it --> $SRC_DIR/core/src/ops/control_flow.rs:LL:COL - = help: for that trait implementation, expected `ControlFlow`, found `Option` + = help: for that trait implementation, expected `ControlFlow`, found `Option` error[E0277]: the `?` operator in a function that returns `ControlFlow` can only be used on other `ControlFlow`s (with the same Break type) --> $DIR/bad-interconversion.rs:41:29 @@ -88,7 +88,7 @@ error[E0277]: the `?` operator in a function that returns `ControlFlow` ca LL | fn control_flow_to_control_flow() -> ControlFlow { | ----------------------------------------------------- this function returns a `ControlFlow` LL | ControlFlow::Break(4_u8)?; - | ^ this `?` produces `ControlFlow`, which is incompatible with `ControlFlow` + | ^ this `?` produces `ControlFlow`, which is incompatible with `ControlFlow` | = note: unlike `Result`, there's no `From`-conversion performed for `ControlFlow` help: the trait `FromResidual>` is not implemented for `ControlFlow` diff --git a/tests/ui/try-trait/option-to-result.stderr b/tests/ui/try-trait/option-to-result.stderr index 8a4c4707942ce..6ae9d840e0696 100644 --- a/tests/ui/try-trait/option-to-result.stderr +++ b/tests/ui/try-trait/option-to-result.stderr @@ -14,7 +14,7 @@ LL | fn test_option() -> Option{ | ------------------------------- this function returns an `Option` LL | let a:Result = Ok(5); LL | a?; - | ^ use `.ok()?` if you want to discard the `Result` error information + | ^ use `.ok()?` if you want to discard the `Result` error information error: aborting due to 2 previous errors From 4db949355349b314984e06c7c01004206b7c2636 Mon Sep 17 00:00:00 2001 From: Waffle Lapkin Date: Wed, 4 Mar 2026 14:35:01 +0100 Subject: [PATCH 12/18] change never type fallback in r-a --- .../crates/hir-ty/src/infer/fallback.rs | 68 +------------------ 1 file changed, 3 insertions(+), 65 deletions(-) diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/infer/fallback.rs b/src/tools/rust-analyzer/crates/hir-ty/src/infer/fallback.rs index c7669b346fe8d..fd6d016c90fc8 100644 --- a/src/tools/rust-analyzer/crates/hir-ty/src/infer/fallback.rs +++ b/src/tools/rust-analyzer/crates/hir-ty/src/infer/fallback.rs @@ -1,10 +1,6 @@ //! Fallback of infer vars to `!` and `i32`/`f64`. -use intern::sym; -use petgraph::{ - Graph, - visit::{Dfs, Walker}, -}; +use petgraph::{Graph, visit::Dfs}; use rustc_hash::{FxBuildHasher, FxHashMap, FxHashSet}; use rustc_type_ir::{ TyVid, @@ -19,10 +15,6 @@ use crate::{ #[derive(Copy, Clone)] pub(crate) enum DivergingFallbackBehavior { - /// Always fallback to `()` (aka "always spontaneous decay") - ToUnit, - /// Sometimes fallback to `!`, but mainly fallback to `()` so that most of the crates are not broken. - ContextDependent, /// Always fallback to `!` (which should be equivalent to never falling back + not making /// never-to-any coercions unless necessary) ToNever, @@ -76,15 +68,8 @@ impl<'db> InferenceContext<'_, 'db> { } fn diverging_fallback_behavior(&self) -> DivergingFallbackBehavior { - if self.krate().data(self.db).edition.at_least_2024() { - return DivergingFallbackBehavior::ToNever; - } - - if self.resolver.def_map().is_unstable_feature_enabled(&sym::never_type_fallback) { - return DivergingFallbackBehavior::ContextDependent; - } - - DivergingFallbackBehavior::ToUnit + // FIXME: remove this whole system for changing diverging fallback behavior + DivergingFallbackBehavior::ToNever } fn fallback_types(&mut self) -> bool { @@ -325,59 +310,12 @@ impl<'db> InferenceContext<'_, 'db> { for &diverging_vid in &diverging_vids { let diverging_ty = Ty::new_var(self.interner(), diverging_vid); - let root_vid = self.table.infer_ctxt.root_var(diverging_vid); - let can_reach_non_diverging = Dfs::new(&coercion_graph, root_vid.as_u32().into()) - .iter(&coercion_graph) - .any(|n| roots_reachable_from_non_diverging.discovered.contains(n.index())); let mut fallback_to = |ty| { diverging_fallback.insert(diverging_ty, ty); }; match behavior { - DivergingFallbackBehavior::ToUnit => { - debug!("fallback to () - legacy: {:?}", diverging_vid); - fallback_to(self.types.types.unit); - } - DivergingFallbackBehavior::ContextDependent => { - // FIXME: rustc does the following, but given this is only relevant when the unstable - // `never_type_fallback` feature is active, I chose to not port this. - // if found_infer_var_info.self_in_trait && found_infer_var_info.output { - // // This case falls back to () to ensure that the code pattern in - // // tests/ui/never_type/fallback-closure-ret.rs continues to - // // compile when never_type_fallback is enabled. - // // - // // This rule is not readily explainable from first principles, - // // but is rather intended as a patchwork fix to ensure code - // // which compiles before the stabilization of never type - // // fallback continues to work. - // // - // // Typically this pattern is encountered in a function taking a - // // closure as a parameter, where the return type of that closure - // // (checked by `relationship.output`) is expected to implement - // // some trait (checked by `relationship.self_in_trait`). This - // // can come up in non-closure cases too, so we do not limit this - // // rule to specifically `FnOnce`. - // // - // // When the closure's body is something like `panic!()`, the - // // return type would normally be inferred to `!`. However, it - // // needs to fall back to `()` in order to still compile, as the - // // trait is specifically implemented for `()` but not `!`. - // // - // // For details on the requirements for these relationships to be - // // set, see the relationship finding module in - // // compiler/rustc_trait_selection/src/traits/relationships.rs. - // debug!("fallback to () - found trait and projection: {:?}", diverging_vid); - // fallback_to(self.types.types.unit); - // } - if can_reach_non_diverging { - debug!("fallback to () - reached non-diverging: {:?}", diverging_vid); - fallback_to(self.types.types.unit); - } else { - debug!("fallback to ! - all diverging: {:?}", diverging_vid); - fallback_to(self.types.types.never); - } - } DivergingFallbackBehavior::ToNever => { debug!( "fallback to ! - `rustc_never_type_mode = \"fallback_to_never\")`: {:?}", From 5c8ed8d0779399e7eb8a342fca0a06dd92e9701f Mon Sep 17 00:00:00 2001 From: Waffle Lapkin Date: Sun, 5 Apr 2026 23:19:52 +0200 Subject: [PATCH 13/18] bless mir-opt tests --- .../building/eq_never_type._f.built.after.mir | 23 ++------ .../issue_101867.main.built.after.mir | 23 ++++---- ...ny.main-{closure#0}.coroutine_resume.0.mir | 56 +++++++++---------- ...inline_diverging.g.Inline.panic-abort.diff | 2 +- ...nline_diverging.g.Inline.panic-unwind.diff | 2 +- ....test.ElaborateDrops.after.panic-abort.mir | 10 ++-- ...test.ElaborateDrops.after.panic-unwind.mir | 10 ++-- .../issue_72181_1.main.built.after.mir | 4 +- ...ng.identity.JumpThreading.panic-abort.diff | 18 +++--- ...g.identity.JumpThreading.panic-unwind.diff | 18 +++--- tests/mir-opt/jump_threading.rs | 6 +- ...reachable.LowerIntrinsics.panic-abort.diff | 6 +- ...eachable.LowerIntrinsics.panic-unwind.diff | 6 +- ...on_traits.PreCodegen.after.panic-abort.mir | 6 +- ...n_traits.PreCodegen.after.panic-unwind.mir | 6 +- ...map_via_question_mark.PreCodegen.after.mir | 10 ++-- .../mir-opt/pre-codegen/simple_option_map.rs | 2 +- ...e_const_switch.identity.JumpThreading.diff | 16 +++--- ...ocess_never.SimplifyLocals-final.after.mir | 2 +- 19 files changed, 102 insertions(+), 124 deletions(-) diff --git a/tests/mir-opt/building/eq_never_type._f.built.after.mir b/tests/mir-opt/building/eq_never_type._f.built.after.mir index 4711af46f1c8c..7a4bb2df7a007 100644 --- a/tests/mir-opt/building/eq_never_type._f.built.after.mir +++ b/tests/mir-opt/building/eq_never_type._f.built.after.mir @@ -6,11 +6,9 @@ fn _f(_1: !, _2: !) -> () { let mut _0: (); let mut _3: !; let _4: bool; - let mut _5: &(); + let mut _5: &!; let mut _6: !; - let mut _7: &(); - let _8: (); - let mut _9: !; + let mut _7: &!; bb0: { StorageLive(_4); @@ -23,31 +21,22 @@ fn _f(_1: !, _2: !) -> () { bb1: { StorageDead(_6); StorageLive(_7); - StorageLive(_8); - StorageLive(_9); - _9 = copy _2; - unreachable; + _7 = &_2; + _4 = ::eq(move _5, move _7) -> [return: bb2, unwind: bb4]; } bb2: { - _7 = &_8; - StorageDead(_9); - _4 = <() as PartialEq>::eq(move _5, move _7) -> [return: bb3, unwind: bb5]; - } - - bb3: { StorageDead(_7); StorageDead(_5); - StorageDead(_8); StorageDead(_4); unreachable; } - bb4: { + bb3: { return; } - bb5 (cleanup): { + bb4 (cleanup): { resume; } } diff --git a/tests/mir-opt/building/issue_101867.main.built.after.mir b/tests/mir-opt/building/issue_101867.main.built.after.mir index cef4325b9a4d6..3540e5e31303a 100644 --- a/tests/mir-opt/building/issue_101867.main.built.after.mir +++ b/tests/mir-opt/building/issue_101867.main.built.after.mir @@ -8,14 +8,13 @@ fn main() -> () { let mut _0: (); let _1: std::option::Option as UserTypeProjection { base: UserType(0), projs: [] }; let mut _2: !; - let _3: (); - let mut _4: !; - let mut _6: isize; + let _3: !; + let mut _5: isize; scope 1 { debug x => _1; - let _5: u8; + let _4: u8; scope 2 { - debug y => _5; + debug y => _4; } } @@ -25,18 +24,16 @@ fn main() -> () { FakeRead(ForLet(None), _1); AscribeUserType(_1, o, UserTypeProjection { base: UserType(1), projs: [] }); PlaceMention(_1); - _6 = discriminant(_1); - switchInt(move _6) -> [1: bb4, otherwise: bb3]; + _5 = discriminant(_1); + switchInt(move _5) -> [1: bb4, otherwise: bb3]; } bb1: { StorageLive(_3); - StorageLive(_4); - _4 = std::rt::begin_panic::<&str>(const "explicit panic") -> bb8; + _3 = std::rt::begin_panic::<&str>(const "explicit panic") -> bb8; } bb2: { - StorageDead(_4); StorageDead(_3); unreachable; } @@ -54,10 +51,10 @@ fn main() -> () { } bb6: { - StorageLive(_5); - _5 = copy ((_1 as Some).0: u8); + StorageLive(_4); + _4 = copy ((_1 as Some).0: u8); _0 = const (); - StorageDead(_5); + StorageDead(_4); StorageDead(_1); return; } diff --git a/tests/mir-opt/coroutine_tiny.main-{closure#0}.coroutine_resume.0.mir b/tests/mir-opt/coroutine_tiny.main-{closure#0}.coroutine_resume.0.mir index 222c7144ef07d..1027aa954fa14 100644 --- a/tests/mir-opt/coroutine_tiny.main-{closure#0}.coroutine_resume.0.mir +++ b/tests/mir-opt/coroutine_tiny.main-{closure#0}.coroutine_resume.0.mir @@ -21,65 +21,61 @@ }, } */ -fn main::{closure#0}(_1: Pin<&mut {coroutine@$DIR/coroutine_tiny.rs:21:5: 21:13}>, _2: u8) -> CoroutineState<(), ()> { +fn main::{closure#0}(_1: Pin<&mut {coroutine@$DIR/coroutine_tiny.rs:21:5: 21:13}>, _2: u8) -> CoroutineState<(), !> { debug _x => _2; - let mut _0: std::ops::CoroutineState<(), ()>; + let mut _0: std::ops::CoroutineState<(), !>; let _3: HasDrop; - let mut _4: !; - let mut _5: (); - let _6: u8; - let mut _7: (); - let _8: (); - let mut _9: (); - let mut _10: u32; - let mut _11: &mut {coroutine@$DIR/coroutine_tiny.rs:21:5: 21:13}; + let mut _4: (); + let _5: u8; + let mut _6: (); + let _7: (); + let mut _8: !; + let mut _9: u32; + let mut _10: &mut {coroutine@$DIR/coroutine_tiny.rs:21:5: 21:13}; scope 1 { - debug _d => (((*_11) as variant#3).0: HasDrop); + debug _d => (((*_10) as variant#3).0: HasDrop); } bb0: { - _11 = copy (_1.0: &mut {coroutine@$DIR/coroutine_tiny.rs:21:5: 21:13}); - _10 = discriminant((*_11)); - switchInt(move _10) -> [0: bb1, 3: bb5, otherwise: bb6]; + _10 = copy (_1.0: &mut {coroutine@$DIR/coroutine_tiny.rs:21:5: 21:13}); + _9 = discriminant((*_10)); + switchInt(move _9) -> [0: bb1, 3: bb5, otherwise: bb6]; } bb1: { nop; - (((*_11) as variant#3).0: HasDrop) = HasDrop; - StorageLive(_4); + (((*_10) as variant#3).0: HasDrop) = HasDrop; goto -> bb2; } bb2: { + StorageLive(_5); StorageLive(_6); - StorageLive(_7); - _7 = (); - _0 = CoroutineState::<(), ()>::Yielded(move _7); - StorageDead(_4); + _6 = (); + _0 = CoroutineState::<(), !>::Yielded(move _6); + StorageDead(_5); StorageDead(_6); - StorageDead(_7); - discriminant((*_11)) = 3; + discriminant((*_10)) = 3; return; } bb3: { - StorageDead(_7); StorageDead(_6); - StorageLive(_8); - _8 = callee() -> [return: bb4, unwind unreachable]; + StorageDead(_5); + StorageLive(_7); + _7 = callee() -> [return: bb4, unwind unreachable]; } bb4: { - StorageDead(_8); - _5 = const (); + StorageDead(_7); + _4 = const (); goto -> bb2; } bb5: { - StorageLive(_4); + StorageLive(_5); StorageLive(_6); - StorageLive(_7); - _6 = move _2; + _5 = move _2; goto -> bb3; } diff --git a/tests/mir-opt/inline/inline_diverging.g.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_diverging.g.Inline.panic-abort.diff index 66b1bc29877ab..8d7a32322ad93 100644 --- a/tests/mir-opt/inline/inline_diverging.g.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/inline_diverging.g.Inline.panic-abort.diff @@ -10,7 +10,7 @@ let mut _5: !; let _6: !; + scope 1 (inlined panic) { -+ let mut _7: !; ++ let _7: !; + } bb0: { diff --git a/tests/mir-opt/inline/inline_diverging.g.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_diverging.g.Inline.panic-unwind.diff index 68dd9530137d5..11a9ae601fb50 100644 --- a/tests/mir-opt/inline/inline_diverging.g.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/inline_diverging.g.Inline.panic-unwind.diff @@ -10,7 +10,7 @@ let mut _5: !; let _6: !; + scope 1 (inlined panic) { -+ let mut _7: !; ++ let _7: !; + } bb0: { diff --git a/tests/mir-opt/issue_62289.test.ElaborateDrops.after.panic-abort.mir b/tests/mir-opt/issue_62289.test.ElaborateDrops.after.panic-abort.mir index 968334753db40..afee76707e8a4 100644 --- a/tests/mir-opt/issue_62289.test.ElaborateDrops.after.panic-abort.mir +++ b/tests/mir-opt/issue_62289.test.ElaborateDrops.after.panic-abort.mir @@ -6,12 +6,12 @@ fn test() -> Option> { let mut _2: std::boxed::Box>; let mut _3: std::boxed::Box>; let mut _4: u32; - let mut _5: std::ops::ControlFlow, u32>; + let mut _5: std::ops::ControlFlow, u32>; let mut _6: std::option::Option; let mut _7: isize; - let _8: std::option::Option; + let _8: std::option::Option; let mut _9: !; - let mut _10: std::option::Option; + let mut _10: std::option::Option; let _11: u32; scope 1 { debug residual => _8; @@ -63,10 +63,10 @@ fn test() -> Option> { bb5: { StorageLive(_8); - _8 = copy ((_5 as Break).0: std::option::Option); + _8 = copy ((_5 as Break).0: std::option::Option); StorageLive(_10); _10 = copy _8; - _0 = > as FromResidual>>::from_residual(move _10) -> [return: bb6, unwind: bb13]; + _0 = > as FromResidual>>::from_residual(move _10) -> [return: bb6, unwind: bb13]; } bb6: { diff --git a/tests/mir-opt/issue_62289.test.ElaborateDrops.after.panic-unwind.mir b/tests/mir-opt/issue_62289.test.ElaborateDrops.after.panic-unwind.mir index 1fc75018c8625..d44db1eb1c8c6 100644 --- a/tests/mir-opt/issue_62289.test.ElaborateDrops.after.panic-unwind.mir +++ b/tests/mir-opt/issue_62289.test.ElaborateDrops.after.panic-unwind.mir @@ -6,12 +6,12 @@ fn test() -> Option> { let mut _2: std::boxed::Box>; let mut _3: std::boxed::Box>; let mut _4: u32; - let mut _5: std::ops::ControlFlow, u32>; + let mut _5: std::ops::ControlFlow, u32>; let mut _6: std::option::Option; let mut _7: isize; - let _8: std::option::Option; + let _8: std::option::Option; let mut _9: !; - let mut _10: std::option::Option; + let mut _10: std::option::Option; let _11: u32; scope 1 { debug residual => _8; @@ -63,10 +63,10 @@ fn test() -> Option> { bb5: { StorageLive(_8); - _8 = copy ((_5 as Break).0: std::option::Option); + _8 = copy ((_5 as Break).0: std::option::Option); StorageLive(_10); _10 = copy _8; - _0 = > as FromResidual>>::from_residual(move _10) -> [return: bb6, unwind: bb13]; + _0 = > as FromResidual>>::from_residual(move _10) -> [return: bb6, unwind: bb13]; } bb6: { diff --git a/tests/mir-opt/issue_72181_1.main.built.after.mir b/tests/mir-opt/issue_72181_1.main.built.after.mir index 398a4bcb3ab3e..15b76d8d71f28 100644 --- a/tests/mir-opt/issue_72181_1.main.built.after.mir +++ b/tests/mir-opt/issue_72181_1.main.built.after.mir @@ -1,8 +1,8 @@ // MIR for `main` after built | User Type Annotations -| 0: user_ty: Canonical { value: Ty(Void), max_universe: U0, var_kinds: [] }, span: $DIR/issue_72181_1.rs:17:12: 17:16, inferred_ty: Void -| 1: user_ty: Canonical { value: Ty(Void), max_universe: U0, var_kinds: [] }, span: $DIR/issue_72181_1.rs:17:12: 17:16, inferred_ty: Void +| 0: user_ty: Canonical { value: Ty(Void), max_universe: U0, var_kinds: [] }, span: $DIR/issue_72181_1.rs:16:12: 16:16, inferred_ty: Void +| 1: user_ty: Canonical { value: Ty(Void), max_universe: U0, var_kinds: [] }, span: $DIR/issue_72181_1.rs:16:12: 16:16, inferred_ty: Void | fn main() -> () { let mut _0: (); diff --git a/tests/mir-opt/jump_threading.identity.JumpThreading.panic-abort.diff b/tests/mir-opt/jump_threading.identity.JumpThreading.panic-abort.diff index 9630f4001494a..92bcd8404f488 100644 --- a/tests/mir-opt/jump_threading.identity.JumpThreading.panic-abort.diff +++ b/tests/mir-opt/jump_threading.identity.JumpThreading.panic-abort.diff @@ -5,17 +5,17 @@ debug x => _1; let mut _0: std::result::Result; let mut _2: i32; - let mut _3: std::ops::ControlFlow, i32>; + let mut _3: std::ops::ControlFlow, i32>; let mut _4: std::result::Result; let mut _5: isize; - let _6: std::result::Result; + let _6: std::result::Result; let mut _7: !; - let mut _8: std::result::Result; + let mut _8: std::result::Result; let _9: i32; scope 1 { debug residual => _6; scope 2 { - scope 8 (inlined #[track_caller] as FromResidual>>::from_residual) { + scope 8 (inlined #[track_caller] as FromResidual>>::from_residual) { let mut _14: isize; let _15: i32; let mut _16: i32; @@ -36,7 +36,7 @@ let mut _10: isize; let _11: i32; let _12: i32; - let mut _13: std::result::Result; + let mut _13: std::result::Result; scope 6 { } scope 7 { @@ -72,7 +72,7 @@ bb3: { StorageLive(_6); - _6 = copy ((_3 as Break).0: std::result::Result); + _6 = copy ((_3 as Break).0: std::result::Result); StorageLive(_8); _8 = copy _6; StorageLive(_14); @@ -112,8 +112,8 @@ bb6: { _12 = move ((_4 as Err).0: i32); StorageLive(_13); - _13 = Result::::Err(copy _12); - _3 = ControlFlow::, i32>::Break(move _13); + _13 = Result::::Err(copy _12); + _3 = ControlFlow::, i32>::Break(move _13); StorageDead(_13); - goto -> bb5; + goto -> bb8; @@ -121,7 +121,7 @@ bb7: { _11 = move ((_4 as Ok).0: i32); - _3 = ControlFlow::, i32>::Continue(copy _11); + _3 = ControlFlow::, i32>::Continue(copy _11); - goto -> bb5; + goto -> bb9; + } diff --git a/tests/mir-opt/jump_threading.identity.JumpThreading.panic-unwind.diff b/tests/mir-opt/jump_threading.identity.JumpThreading.panic-unwind.diff index 9630f4001494a..92bcd8404f488 100644 --- a/tests/mir-opt/jump_threading.identity.JumpThreading.panic-unwind.diff +++ b/tests/mir-opt/jump_threading.identity.JumpThreading.panic-unwind.diff @@ -5,17 +5,17 @@ debug x => _1; let mut _0: std::result::Result; let mut _2: i32; - let mut _3: std::ops::ControlFlow, i32>; + let mut _3: std::ops::ControlFlow, i32>; let mut _4: std::result::Result; let mut _5: isize; - let _6: std::result::Result; + let _6: std::result::Result; let mut _7: !; - let mut _8: std::result::Result; + let mut _8: std::result::Result; let _9: i32; scope 1 { debug residual => _6; scope 2 { - scope 8 (inlined #[track_caller] as FromResidual>>::from_residual) { + scope 8 (inlined #[track_caller] as FromResidual>>::from_residual) { let mut _14: isize; let _15: i32; let mut _16: i32; @@ -36,7 +36,7 @@ let mut _10: isize; let _11: i32; let _12: i32; - let mut _13: std::result::Result; + let mut _13: std::result::Result; scope 6 { } scope 7 { @@ -72,7 +72,7 @@ bb3: { StorageLive(_6); - _6 = copy ((_3 as Break).0: std::result::Result); + _6 = copy ((_3 as Break).0: std::result::Result); StorageLive(_8); _8 = copy _6; StorageLive(_14); @@ -112,8 +112,8 @@ bb6: { _12 = move ((_4 as Err).0: i32); StorageLive(_13); - _13 = Result::::Err(copy _12); - _3 = ControlFlow::, i32>::Break(move _13); + _13 = Result::::Err(copy _12); + _3 = ControlFlow::, i32>::Break(move _13); StorageDead(_13); - goto -> bb5; + goto -> bb8; @@ -121,7 +121,7 @@ bb7: { _11 = move ((_4 as Ok).0: i32); - _3 = ControlFlow::, i32>::Continue(copy _11); + _3 = ControlFlow::, i32>::Continue(copy _11); - goto -> bb5; + goto -> bb9; + } diff --git a/tests/mir-opt/jump_threading.rs b/tests/mir-opt/jump_threading.rs index 39a2f16c5ad6f..04e9b31aa59a6 100644 --- a/tests/mir-opt/jump_threading.rs +++ b/tests/mir-opt/jump_threading.rs @@ -59,7 +59,7 @@ fn identity(x: Result) -> Result { // CHECK: _0 = Result::::Ok( // CHECK: goto -> bb4; // CHECK: bb3: { - // CHECK: {{_.*}} = copy (([[controlflow]] as Break).0: std::result::Result); + // CHECK: {{_.*}} = copy (([[controlflow]] as Break).0: std::result::Result); // CHECK: _0 = Result::::Err( // CHECK: goto -> bb4; // CHECK: bb4: { @@ -68,11 +68,11 @@ fn identity(x: Result) -> Result { // CHECK: switchInt(move _5) -> [0: bb2, 1: bb3, otherwise: bb1]; // CHECK: bb6: { // CHECK: {{_.*}} = move (([[x]] as Err).0: i32); - // CHECK: [[controlflow]] = ControlFlow::, i32>::Break( + // CHECK: [[controlflow]] = ControlFlow::, i32>::Break( // CHECK: goto -> bb8; // CHECK: bb7: { // CHECK: {{_.*}} = move (([[x]] as Ok).0: i32); - // CHECK: [[controlflow]] = ControlFlow::, i32>::Continue( + // CHECK: [[controlflow]] = ControlFlow::, i32>::Continue( // CHECK: goto -> bb9; // CHECK: bb8: { // CHECK: goto -> bb3; diff --git a/tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.panic-abort.diff index 2b715ac1d635b..a4be4617b9370 100644 --- a/tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.panic-abort.diff +++ b/tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.panic-abort.diff @@ -3,13 +3,11 @@ fn unreachable() -> ! { let mut _0: !; - let _1: (); - let mut _2: !; + let _1: !; bb0: { StorageLive(_1); - StorageLive(_2); -- _2 = std::intrinsics::unreachable() -> unwind unreachable; +- _1 = std::intrinsics::unreachable() -> unwind unreachable; + unreachable; } } diff --git a/tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.panic-unwind.diff index 2b715ac1d635b..a4be4617b9370 100644 --- a/tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.panic-unwind.diff +++ b/tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.panic-unwind.diff @@ -3,13 +3,11 @@ fn unreachable() -> ! { let mut _0: !; - let _1: (); - let mut _2: !; + let _1: !; bb0: { StorageLive(_1); - StorageLive(_2); -- _2 = std::intrinsics::unreachable() -> unwind unreachable; +- _1 = std::intrinsics::unreachable() -> unwind unreachable; + unreachable; } } diff --git a/tests/mir-opt/pre-codegen/option_bubble_debug.option_traits.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/option_bubble_debug.option_traits.PreCodegen.after.panic-abort.mir index 55f44d954d806..91d7418997fde 100644 --- a/tests/mir-opt/pre-codegen/option_bubble_debug.option_traits.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/option_bubble_debug.option_traits.PreCodegen.after.panic-abort.mir @@ -3,12 +3,12 @@ fn option_traits(_1: Option) -> Option { debug x => _1; let mut _0: std::option::Option; - let mut _2: std::ops::ControlFlow, u32>; + let mut _2: std::ops::ControlFlow, u32>; let mut _3: isize; let _4: u32; let mut _5: u32; scope 1 { - debug residual => const Option::::None; + debug residual => const Option::::None; scope 2 { } } @@ -34,7 +34,7 @@ fn option_traits(_1: Option) -> Option { } bb3: { - _0 = ops::try_trait::residual_into_try_type::, u32>(const Option::::None) -> [return: bb4, unwind unreachable]; + _0 = ops::try_trait::residual_into_try_type::, u32>(const Option::::None) -> [return: bb4, unwind unreachable]; } bb4: { diff --git a/tests/mir-opt/pre-codegen/option_bubble_debug.option_traits.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/option_bubble_debug.option_traits.PreCodegen.after.panic-unwind.mir index b42aea38d3e35..77186f414f981 100644 --- a/tests/mir-opt/pre-codegen/option_bubble_debug.option_traits.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/option_bubble_debug.option_traits.PreCodegen.after.panic-unwind.mir @@ -3,12 +3,12 @@ fn option_traits(_1: Option) -> Option { debug x => _1; let mut _0: std::option::Option; - let mut _2: std::ops::ControlFlow, u32>; + let mut _2: std::ops::ControlFlow, u32>; let mut _3: isize; let _4: u32; let mut _5: u32; scope 1 { - debug residual => const Option::::None; + debug residual => const Option::::None; scope 2 { } } @@ -34,7 +34,7 @@ fn option_traits(_1: Option) -> Option { } bb3: { - _0 = ops::try_trait::residual_into_try_type::, u32>(const Option::::None) -> [return: bb4, unwind continue]; + _0 = ops::try_trait::residual_into_try_type::, u32>(const Option::::None) -> [return: bb4, unwind continue]; } bb4: { diff --git a/tests/mir-opt/pre-codegen/simple_option_map.map_via_question_mark.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/simple_option_map.map_via_question_mark.PreCodegen.after.mir index ef7ccfa5bddf6..c0f4bb953814a 100644 --- a/tests/mir-opt/pre-codegen/simple_option_map.map_via_question_mark.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/simple_option_map.map_via_question_mark.PreCodegen.after.mir @@ -3,14 +3,14 @@ fn map_via_question_mark(_1: Option) -> Option { debug x => _1; let mut _0: std::option::Option; - let mut _4: std::option::Option; - let mut _7: std::ops::ControlFlow, i32>; + let mut _4: std::option::Option; + let mut _7: std::ops::ControlFlow, i32>; let _8: i32; let mut _9: i32; scope 1 { - debug residual => const Option::::None; + debug residual => const Option::::None; scope 2 { - scope 7 (inlined as FromResidual>>::from_residual) { + scope 7 (inlined as FromResidual>>::from_residual) { let mut _3: isize; let mut _5: bool; } @@ -55,7 +55,7 @@ fn map_via_question_mark(_1: Option) -> Option { bb2: { _6 = copy ((_1 as Some).0: i32); - _7 = ControlFlow::, i32>::Continue(copy _6); + _7 = ControlFlow::, i32>::Continue(copy _6); StorageDead(_6); StorageDead(_2); _8 = copy ((_7 as Continue).0: i32); diff --git a/tests/mir-opt/pre-codegen/simple_option_map.rs b/tests/mir-opt/pre-codegen/simple_option_map.rs index f0d7b51a64397..fb30fff02f830 100644 --- a/tests/mir-opt/pre-codegen/simple_option_map.rs +++ b/tests/mir-opt/pre-codegen/simple_option_map.rs @@ -29,7 +29,7 @@ pub fn map_via_question_mark(x: Option) -> Option { // CHECK-LABEL: fn map_via_question_mark // CHECK: [[INNER:_.+]] = copy ((_1 as Some).0: i32); - // CHECK: [[TEMP1:_.+]] = ControlFlow::, i32>::Continue(copy [[INNER]]); + // CHECK: [[TEMP1:_.+]] = ControlFlow::, i32>::Continue(copy [[INNER]]); // CHECK: [[TEMP2:_.+]] = copy (([[TEMP1]] as Continue).0: i32); // CHECK: [[SUCC:_.+]] = Add({{copy|move}} [[TEMP2]], const 1_i32); // CHECK: _0 = Option::::Some({{copy|move}} [[SUCC]]); diff --git a/tests/mir-opt/separate_const_switch.identity.JumpThreading.diff b/tests/mir-opt/separate_const_switch.identity.JumpThreading.diff index 10ad4ec754141..745bececd6f94 100644 --- a/tests/mir-opt/separate_const_switch.identity.JumpThreading.diff +++ b/tests/mir-opt/separate_const_switch.identity.JumpThreading.diff @@ -4,14 +4,14 @@ fn identity(_1: Result) -> Result { debug x => _1; let mut _0: std::result::Result; - let mut _2: std::ops::ControlFlow, i32>; + let mut _2: std::ops::ControlFlow, i32>; let mut _3: isize; - let _4: std::result::Result; + let _4: std::result::Result; let _5: i32; scope 1 { debug residual => _4; scope 2 { - scope 8 (inlined #[track_caller] as FromResidual>>::from_residual) { + scope 8 (inlined #[track_caller] as FromResidual>>::from_residual) { let mut _10: isize; let _11: i32; let mut _12: bool; @@ -31,7 +31,7 @@ let mut _6: isize; let _7: i32; let _8: i32; - let mut _9: std::result::Result; + let mut _9: std::result::Result; scope 6 { } scope 7 { @@ -59,7 +59,7 @@ } bb3: { - _4 = copy ((_2 as Break).0: std::result::Result); + _4 = copy ((_2 as Break).0: std::result::Result); StorageLive(_10); StorageLive(_12); _10 = discriminant(_4); @@ -84,8 +84,8 @@ bb5: { _8 = copy ((_1 as Err).0: i32); StorageLive(_9); - _9 = Result::::Err(copy _8); - _2 = ControlFlow::, i32>::Break(move _9); + _9 = Result::::Err(copy _8); + _2 = ControlFlow::, i32>::Break(move _9); StorageDead(_9); - goto -> bb4; + goto -> bb7; @@ -93,7 +93,7 @@ bb6: { _7 = copy ((_1 as Ok).0: i32); - _2 = ControlFlow::, i32>::Continue(copy _7); + _2 = ControlFlow::, i32>::Continue(copy _7); - goto -> bb4; + goto -> bb8; + } diff --git a/tests/mir-opt/uninhabited_enum.process_never.SimplifyLocals-final.after.mir b/tests/mir-opt/uninhabited_enum.process_never.SimplifyLocals-final.after.mir index 02e1f4be15e2e..dced13df2ea38 100644 --- a/tests/mir-opt/uninhabited_enum.process_never.SimplifyLocals-final.after.mir +++ b/tests/mir-opt/uninhabited_enum.process_never.SimplifyLocals-final.after.mir @@ -4,7 +4,7 @@ fn process_never(_1: *const !) -> () { debug input => _1; let mut _0: (); scope 1 { - debug _input => const (); + debug _input => const ZeroSized: !; } bb0: { From e4d55b8f8d1f0b98f1fa4c772f72e0886ec7aa52 Mon Sep 17 00:00:00 2001 From: Waffle Lapkin Date: Sun, 5 Apr 2026 23:52:15 +0200 Subject: [PATCH 14/18] oh shut up tidy Add a hack to tidy to consider stuff like `#[cfg_attr(bootstrap, doc = "feature(never_type)")]` to be part of a comment, and thus don't break stuff when counting backticks. --- src/tools/tidy/src/style.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/tools/tidy/src/style.rs b/src/tools/tidy/src/style.rs index 77c15672e0022..77b45f262d677 100644 --- a/src/tools/tidy/src/style.rs +++ b/src/tools/tidy/src/style.rs @@ -602,10 +602,15 @@ pub fn check(path: &Path, tidy_ctx: TidyCtx) { err(DOUBLE_SPACE_AFTER_DOT) } - if trimmed.contains("//") { + if trimmed.contains("//") + || (trimmed.contains("cfg_attr") && trimmed.contains("doc")) + { let (start_line, mut backtick_count) = comment_block.unwrap_or((i + 1, 0)); let line_backticks = trimmed.chars().filter(|ch| *ch == '`').count(); - let comment_text = trimmed.split("//").nth(1).unwrap(); + let comment_text = trimmed + .split("//") + .nth(1) + .unwrap_or_else(|| trimmed.split_once("doc").unwrap().1); // This check ensures that we don't lint for code that has `//` in a string literal if line_backticks % 2 == 1 { backtick_count += comment_text.chars().filter(|ch| *ch == '`').count(); From 7c8ef22e3adcf2cf59a9a113f9422937e8b23c9e Mon Sep 17 00:00:00 2001 From: Waffle Lapkin Date: Mon, 6 Apr 2026 14:17:46 +0200 Subject: [PATCH 15/18] remove `dependency_on_unit_never_type_fallback` lint --- compiler/rustc_hir_typeck/src/errors.rs | 13 +---- compiler/rustc_hir_typeck/src/fallback.rs | 58 ------------------- compiler/rustc_lint/src/lib.rs | 4 ++ compiler/rustc_lint_defs/src/builtin.rs | 54 ----------------- .../tests/ui/unused_unit.edition2021.fixed | 1 - .../tests/ui/unused_unit.edition2021.stderr | 2 +- .../tests/ui/unused_unit.edition2024.fixed | 1 - src/tools/clippy/tests/ui/unused_unit.rs | 1 - .../fallback_change/defaulted-never-note.rs | 2 +- 9 files changed, 7 insertions(+), 129 deletions(-) diff --git a/compiler/rustc_hir_typeck/src/errors.rs b/compiler/rustc_hir_typeck/src/errors.rs index 6eef156846972..beb56a485228a 100644 --- a/compiler/rustc_hir_typeck/src/errors.rs +++ b/compiler/rustc_hir_typeck/src/errors.rs @@ -12,7 +12,7 @@ use rustc_errors::{ use rustc_hir as hir; use rustc_hir::ExprKind; use rustc_macros::{Diagnostic, Subdiagnostic}; -use rustc_middle::ty::{self, Ty}; +use rustc_middle::ty::Ty; use rustc_span::edition::{Edition, LATEST_STABLE_EDITION}; use rustc_span::{Ident, Span, Spanned, Symbol}; @@ -248,17 +248,6 @@ pub(crate) enum NeverTypeFallbackFlowingIntoUnsafe { }, } -#[derive(Diagnostic)] -#[help("specify the types explicitly")] -#[diag("this function depends on never type fallback being `()`")] -pub(crate) struct DependencyOnUnitNeverTypeFallback<'tcx> { - #[note("in edition 2024, the requirement `{$obligation}` will fail")] - pub obligation_span: Span, - pub obligation: ty::Predicate<'tcx>, - #[subdiagnostic] - pub sugg: SuggestAnnotations, -} - #[derive(Clone)] pub(crate) enum SuggestAnnotation { Unit(Span), diff --git a/compiler/rustc_hir_typeck/src/fallback.rs b/compiler/rustc_hir_typeck/src/fallback.rs index 5aadf37720d0c..8f9038cb91a81 100644 --- a/compiler/rustc_hir_typeck/src/fallback.rs +++ b/compiler/rustc_hir_typeck/src/fallback.rs @@ -15,7 +15,6 @@ use rustc_middle::ty::{self, Ty, TyCtxt, TypeSuperVisitable, TypeVisitable}; use rustc_session::lint; use rustc_span::def_id::LocalDefId; use rustc_span::{DUMMY_SP, Span}; -use rustc_trait_selection::traits::{ObligationCause, ObligationCtxt}; use tracing::debug; use crate::{FnCtxt, errors}; @@ -197,11 +196,6 @@ impl<'tcx> FnCtxt<'_, 'tcx> { let mut diverging_fallback = UnordSet::with_capacity(diverging_vids.len()); let unsafe_infer_vars = OnceCell::new(); - self.lint_obligations_broken_by_never_type_fallback_change( - &diverging_vids, - &coercion_graph, - ); - for &diverging_vid in &diverging_vids { let diverging_ty = Ty::new_var(self.tcx, diverging_vid); let root_vid = self.root_var(diverging_vid); @@ -265,58 +259,6 @@ impl<'tcx> FnCtxt<'_, 'tcx> { } } - fn lint_obligations_broken_by_never_type_fallback_change( - &self, - diverging_vids: &[ty::TyVid], - coercions: &VecGraph, - ) { - let DivergingFallbackBehavior::ToUnit = self.diverging_fallback_behavior else { return }; - - // Fallback happens if and only if there are diverging variables - if diverging_vids.is_empty() { - return; - } - - // Returns errors which happen if fallback is set to `fallback` - let remaining_errors_if_fallback_to = |fallback| { - self.probe(|_| { - let obligations = self.fulfillment_cx.borrow().pending_obligations(); - let ocx = ObligationCtxt::new_with_diagnostics(&self.infcx); - ocx.register_obligations(obligations.iter().cloned()); - - for &diverging_vid in diverging_vids { - let diverging_ty = Ty::new_var(self.tcx, diverging_vid); - - ocx.eq(&ObligationCause::dummy(), self.param_env, diverging_ty, fallback) - .expect("expected diverging var to be unconstrained"); - } - - ocx.try_evaluate_obligations() - }) - }; - - // If we have no errors with `fallback = ()`, but *do* have errors with `fallback = !`, - // then this code will be broken by the never type fallback change. - let unit_errors = remaining_errors_if_fallback_to(self.tcx.types.unit); - if unit_errors.is_empty() - && let mut never_errors = remaining_errors_if_fallback_to(self.tcx.types.never) - && let [never_error, ..] = never_errors.as_mut_slice() - { - self.adjust_fulfillment_error_for_expr_obligation(never_error); - let sugg = self.try_to_suggest_annotations(diverging_vids, coercions); - self.tcx.emit_node_span_lint( - lint::builtin::DEPENDENCY_ON_UNIT_NEVER_TYPE_FALLBACK, - self.tcx.local_def_id_to_hir_id(self.body_id), - self.tcx.def_span(self.body_id), - errors::DependencyOnUnitNeverTypeFallback { - obligation_span: never_error.obligation.cause.span, - obligation: never_error.obligation.predicate, - sugg, - }, - ) - } - } - /// Returns a graph whose nodes are (unresolved) inference variables and where /// an edge `?A -> ?B` indicates that the variable `?A` is coerced to `?B`. fn create_coercion_graph(&self) -> VecGraph { diff --git a/compiler/rustc_lint/src/lib.rs b/compiler/rustc_lint/src/lib.rs index c76fafcde2ee1..cc57463a3071a 100644 --- a/compiler/rustc_lint/src/lib.rs +++ b/compiler/rustc_lint/src/lib.rs @@ -645,6 +645,10 @@ fn register_builtins(store: &mut LintStore) { ); store.register_removed("wasm_c_abi", "the wasm C ABI has been fixed"); store.register_removed("soft_unstable", "the general soft-unstable mechanism has been removed"); + store.register_removed( + "dependency_on_unit_never_type_fallback", + "the code warned by this lint no longer compiles", + ); } fn register_internals(store: &mut LintStore) { diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs index b3cac5a9f93db..186793bc509ac 100644 --- a/compiler/rustc_lint_defs/src/builtin.rs +++ b/compiler/rustc_lint_defs/src/builtin.rs @@ -34,7 +34,6 @@ declare_lint_pass! { CONST_EVALUATABLE_UNCHECKED, CONST_ITEM_MUTATION, DEAD_CODE, - DEPENDENCY_ON_UNIT_NEVER_TYPE_FALLBACK, DEPRECATED, DEPRECATED_IN_FUTURE, DEPRECATED_SAFE_2024, @@ -4222,59 +4221,6 @@ declare_lint! { report_in_external_macro } -declare_lint! { - /// The `dependency_on_unit_never_type_fallback` lint detects cases where code compiles with - /// [never type fallback] being [`()`], but will stop compiling with fallback being [`!`]. - /// - /// [never type fallback]: https://doc.rust-lang.org/nightly/core/primitive.never.html#never-type-fallback - /// [`!`]: https://doc.rust-lang.org/core/primitive.never.html - /// [`()`]: https://doc.rust-lang.org/core/primitive.unit.html - /// - /// ### Example - /// - /// ```rust,compile_fail,edition2021 - /// # #![deny(dependency_on_unit_never_type_fallback)] - /// fn main() { - /// if true { - /// // return has type `!` which, is some cases, causes never type fallback - /// return - /// } else { - /// // the type produced by this call is not specified explicitly, - /// // so it will be inferred from the previous branch - /// Default::default() - /// }; - /// // depending on the fallback, this may compile (because `()` implements `Default`), - /// // or it may not (because `!` does not implement `Default`) - /// } - /// ``` - /// - /// {{produces}} - /// - /// ### Explanation - /// - /// Due to historic reasons never type fallback was `()`, meaning that `!` got spontaneously - /// coerced to `()`. There are plans to change that, but they may make the code such as above - /// not compile. Instead of depending on the fallback, you should specify the type explicitly: - /// ``` - /// if true { - /// return - /// } else { - /// // type is explicitly specified, fallback can't hurt us no more - /// <() as Default>::default() - /// }; - /// ``` - /// - /// See [Tracking Issue for making `!` fall back to `!`](https://github.com/rust-lang/rust/issues/123748). - pub DEPENDENCY_ON_UNIT_NEVER_TYPE_FALLBACK, - Deny, - "never type fallback affecting unsafe function calls", - @future_incompatible = FutureIncompatibleInfo { - reason: fcw!(EditionAndFutureReleaseError 2024 "never-type-fallback"), - report_in_deps: true, - }; - report_in_external_macro -} - declare_lint! { /// The `invalid_macro_export_arguments` lint detects cases where `#[macro_export]` is being used with invalid arguments. /// diff --git a/src/tools/clippy/tests/ui/unused_unit.edition2021.fixed b/src/tools/clippy/tests/ui/unused_unit.edition2021.fixed index 8e12bd2c8c7b9..e8fb7d1a885ce 100644 --- a/src/tools/clippy/tests/ui/unused_unit.edition2021.fixed +++ b/src/tools/clippy/tests/ui/unused_unit.edition2021.fixed @@ -127,7 +127,6 @@ mod issue14577 { trait Unit {} impl Unit for () {} - #[allow(dependency_on_unit_never_type_fallback)] fn bar() { //~[edition2021]^ unused_unit panic!() diff --git a/src/tools/clippy/tests/ui/unused_unit.edition2021.stderr b/src/tools/clippy/tests/ui/unused_unit.edition2021.stderr index 9ad3c2df915ec..8edbb2224a83a 100644 --- a/src/tools/clippy/tests/ui/unused_unit.edition2021.stderr +++ b/src/tools/clippy/tests/ui/unused_unit.edition2021.stderr @@ -119,7 +119,7 @@ LL | fn test3()-> (){} | ^^^^^ help: remove the `-> ()` error: unneeded unit return type - --> tests/ui/unused_unit.rs:131:13 + --> tests/ui/unused_unit.rs:130:13 | LL | fn bar() -> () { | ^^^^^^ help: remove the `-> ()` diff --git a/src/tools/clippy/tests/ui/unused_unit.edition2024.fixed b/src/tools/clippy/tests/ui/unused_unit.edition2024.fixed index 688d2fe9afa28..fdfc3e0423506 100644 --- a/src/tools/clippy/tests/ui/unused_unit.edition2024.fixed +++ b/src/tools/clippy/tests/ui/unused_unit.edition2024.fixed @@ -127,7 +127,6 @@ mod issue14577 { trait Unit {} impl Unit for () {} - #[allow(dependency_on_unit_never_type_fallback)] fn bar() -> () { //~[edition2021]^ unused_unit panic!() diff --git a/src/tools/clippy/tests/ui/unused_unit.rs b/src/tools/clippy/tests/ui/unused_unit.rs index 31e980f2655c6..1ed5d6d47e0d0 100644 --- a/src/tools/clippy/tests/ui/unused_unit.rs +++ b/src/tools/clippy/tests/ui/unused_unit.rs @@ -127,7 +127,6 @@ mod issue14577 { trait Unit {} impl Unit for () {} - #[allow(dependency_on_unit_never_type_fallback)] fn bar() -> () { //~[edition2021]^ unused_unit panic!() diff --git a/tests/ui/never_type/fallback_change/defaulted-never-note.rs b/tests/ui/never_type/fallback_change/defaulted-never-note.rs index 4d18b5af2c541..2f31dbef19c60 100644 --- a/tests/ui/never_type/fallback_change/defaulted-never-note.rs +++ b/tests/ui/never_type/fallback_change/defaulted-never-note.rs @@ -1,7 +1,7 @@ // Test diagnostic for the case where a trait is not implemented for `!`. If it is implemented // for `()`, we want to add a note saying that this might be caused by a breaking change in the // compiler. -#![expect(dependency_on_unit_never_type_fallback, unused)] +#![expect(unused)] trait OnlyUnit {} From c9d408abac9234049efe8dfed3cc5f1f08551763 Mon Sep 17 00:00:00 2001 From: Waffle Lapkin Date: Mon, 6 Apr 2026 14:17:46 +0200 Subject: [PATCH 16/18] remove stray stderr files ??? why wasn't this detected by compiletest ??? --- ...fallback-unconstrained-return.e2021.stderr | 24 -- ...fallback-unconstrained-return.e2024.stderr | 24 -- ...lback-unconstrained-return.fallback.stderr | 24 -- ...ack-unconstrained-return.nofallback.stderr | 43 --- .../fallback-closure-ret.e2021.stderr | 18 -- .../fallback-closure-ret.e2024.stderr | 24 -- .../fallback-closure-ret.fallback.stderr | 24 -- .../fallback-closure-ret.nofallback.stderr | 18 -- .../fallback-closure-wrap.e2024.stderr | 15 - .../fallback-closure-wrap.fallback.stderr | 15 - ...-fallback-flowing-into-unsafe.e2015.stderr | 296 ------------------ ...-fallback-flowing-into-unsafe.e2024.stderr | 296 ------------------ ...try-block-never-type-fallback.e2021.stderr | 20 -- 13 files changed, 841 deletions(-) delete mode 100644 tests/ui/never_type/fallback_change/diverging-fallback-unconstrained-return.e2021.stderr delete mode 100644 tests/ui/never_type/fallback_change/diverging-fallback-unconstrained-return.e2024.stderr delete mode 100644 tests/ui/never_type/fallback_change/diverging-fallback-unconstrained-return.fallback.stderr delete mode 100644 tests/ui/never_type/fallback_change/diverging-fallback-unconstrained-return.nofallback.stderr delete mode 100644 tests/ui/never_type/fallback_change/fallback-closure-ret.e2021.stderr delete mode 100644 tests/ui/never_type/fallback_change/fallback-closure-ret.e2024.stderr delete mode 100644 tests/ui/never_type/fallback_change/fallback-closure-ret.fallback.stderr delete mode 100644 tests/ui/never_type/fallback_change/fallback-closure-ret.nofallback.stderr delete mode 100644 tests/ui/never_type/fallback_change/fallback-closure-wrap.e2024.stderr delete mode 100644 tests/ui/never_type/fallback_change/fallback-closure-wrap.fallback.stderr delete mode 100644 tests/ui/never_type/fallback_change/lint-never-type-fallback-flowing-into-unsafe.e2015.stderr delete mode 100644 tests/ui/never_type/fallback_change/lint-never-type-fallback-flowing-into-unsafe.e2024.stderr delete mode 100644 tests/ui/never_type/fallback_change/try-block-never-type-fallback.e2021.stderr diff --git a/tests/ui/never_type/fallback_change/diverging-fallback-unconstrained-return.e2021.stderr b/tests/ui/never_type/fallback_change/diverging-fallback-unconstrained-return.e2021.stderr deleted file mode 100644 index d28f5d7de92f5..0000000000000 --- a/tests/ui/never_type/fallback_change/diverging-fallback-unconstrained-return.e2021.stderr +++ /dev/null @@ -1,24 +0,0 @@ -error[E0277]: the trait bound `!: UnitReturn` is not satisfied - --> $DIR/diverging-fallback-unconstrained-return.rs:37:23 - | -LL | let _ = if true { unconstrained_return() } else { panic!() }; - | ^^^^^^^^^^^^^^^^^^^^^^ the trait `UnitReturn` is not implemented for `!` - | -help: the following other types implement trait `UnitReturn` - --> $DIR/diverging-fallback-unconstrained-return.rs:15:1 - | -LL | impl UnitReturn for i32 {} - | ^^^^^^^^^^^^^^^^^^^^^^^ `i32` -LL | impl UnitReturn for () {} - | ^^^^^^^^^^^^^^^^^^^^^^ `()` - = note: this error might have been caused by changes to Rust's type-inference algorithm (see issue #148922 for more information) - = help: you might have intended to use the type `()` here instead -note: required by a bound in `unconstrained_return` - --> $DIR/diverging-fallback-unconstrained-return.rs:18:28 - | -LL | fn unconstrained_return() -> T { - | ^^^^^^^^^^ required by this bound in `unconstrained_return` - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/never_type/fallback_change/diverging-fallback-unconstrained-return.e2024.stderr b/tests/ui/never_type/fallback_change/diverging-fallback-unconstrained-return.e2024.stderr deleted file mode 100644 index d28f5d7de92f5..0000000000000 --- a/tests/ui/never_type/fallback_change/diverging-fallback-unconstrained-return.e2024.stderr +++ /dev/null @@ -1,24 +0,0 @@ -error[E0277]: the trait bound `!: UnitReturn` is not satisfied - --> $DIR/diverging-fallback-unconstrained-return.rs:37:23 - | -LL | let _ = if true { unconstrained_return() } else { panic!() }; - | ^^^^^^^^^^^^^^^^^^^^^^ the trait `UnitReturn` is not implemented for `!` - | -help: the following other types implement trait `UnitReturn` - --> $DIR/diverging-fallback-unconstrained-return.rs:15:1 - | -LL | impl UnitReturn for i32 {} - | ^^^^^^^^^^^^^^^^^^^^^^^ `i32` -LL | impl UnitReturn for () {} - | ^^^^^^^^^^^^^^^^^^^^^^ `()` - = note: this error might have been caused by changes to Rust's type-inference algorithm (see issue #148922 for more information) - = help: you might have intended to use the type `()` here instead -note: required by a bound in `unconstrained_return` - --> $DIR/diverging-fallback-unconstrained-return.rs:18:28 - | -LL | fn unconstrained_return() -> T { - | ^^^^^^^^^^ required by this bound in `unconstrained_return` - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/never_type/fallback_change/diverging-fallback-unconstrained-return.fallback.stderr b/tests/ui/never_type/fallback_change/diverging-fallback-unconstrained-return.fallback.stderr deleted file mode 100644 index d28f5d7de92f5..0000000000000 --- a/tests/ui/never_type/fallback_change/diverging-fallback-unconstrained-return.fallback.stderr +++ /dev/null @@ -1,24 +0,0 @@ -error[E0277]: the trait bound `!: UnitReturn` is not satisfied - --> $DIR/diverging-fallback-unconstrained-return.rs:37:23 - | -LL | let _ = if true { unconstrained_return() } else { panic!() }; - | ^^^^^^^^^^^^^^^^^^^^^^ the trait `UnitReturn` is not implemented for `!` - | -help: the following other types implement trait `UnitReturn` - --> $DIR/diverging-fallback-unconstrained-return.rs:15:1 - | -LL | impl UnitReturn for i32 {} - | ^^^^^^^^^^^^^^^^^^^^^^^ `i32` -LL | impl UnitReturn for () {} - | ^^^^^^^^^^^^^^^^^^^^^^ `()` - = note: this error might have been caused by changes to Rust's type-inference algorithm (see issue #148922 for more information) - = help: you might have intended to use the type `()` here instead -note: required by a bound in `unconstrained_return` - --> $DIR/diverging-fallback-unconstrained-return.rs:18:28 - | -LL | fn unconstrained_return() -> T { - | ^^^^^^^^^^ required by this bound in `unconstrained_return` - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/never_type/fallback_change/diverging-fallback-unconstrained-return.nofallback.stderr b/tests/ui/never_type/fallback_change/diverging-fallback-unconstrained-return.nofallback.stderr deleted file mode 100644 index eb79cf5dd1559..0000000000000 --- a/tests/ui/never_type/fallback_change/diverging-fallback-unconstrained-return.nofallback.stderr +++ /dev/null @@ -1,43 +0,0 @@ -error: this function depends on never type fallback being `()` - --> $DIR/diverging-fallback-unconstrained-return.rs:26:1 - | -LL | fn main() { - | ^^^^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see - = help: specify the types explicitly -note: in edition 2024, the requirement `!: UnitReturn` will fail - --> $DIR/diverging-fallback-unconstrained-return.rs:37:23 - | -LL | let _ = if true { unconstrained_return() } else { panic!() }; - | ^^^^^^^^^^^^^^^^^^^^^^ - = note: `#[deny(dependency_on_unit_never_type_fallback)]` (part of `#[deny(rust_2024_compatibility)]`) on by default -help: use `()` annotations to avoid fallback changes - | -LL | let _: () = if true { unconstrained_return() } else { panic!() }; - | ++++ - -error: aborting due to 1 previous error - -Future incompatibility report: Future breakage diagnostic: -error: this function depends on never type fallback being `()` - --> $DIR/diverging-fallback-unconstrained-return.rs:26:1 - | -LL | fn main() { - | ^^^^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see - = help: specify the types explicitly -note: in edition 2024, the requirement `!: UnitReturn` will fail - --> $DIR/diverging-fallback-unconstrained-return.rs:37:23 - | -LL | let _ = if true { unconstrained_return() } else { panic!() }; - | ^^^^^^^^^^^^^^^^^^^^^^ - = note: `#[deny(dependency_on_unit_never_type_fallback)]` (part of `#[deny(rust_2024_compatibility)]`) on by default -help: use `()` annotations to avoid fallback changes - | -LL | let _: () = if true { unconstrained_return() } else { panic!() }; - | ++++ - diff --git a/tests/ui/never_type/fallback_change/fallback-closure-ret.e2021.stderr b/tests/ui/never_type/fallback_change/fallback-closure-ret.e2021.stderr deleted file mode 100644 index 44ec166eaa30e..0000000000000 --- a/tests/ui/never_type/fallback_change/fallback-closure-ret.e2021.stderr +++ /dev/null @@ -1,18 +0,0 @@ -Future incompatibility report: Future breakage diagnostic: -warning: this function depends on never type fallback being `()` - --> $DIR/fallback-closure-ret.rs:21:1 - | -LL | fn main() { - | ^^^^^^^^^ - | - = help: specify the types explicitly -note: in edition 2024, the requirement `!: Bar` will fail - --> $DIR/fallback-closure-ret.rs:22:5 - | -LL | foo(|| panic!()); - | ^^^^^^^^^^^^^^^^ -help: use `()` annotations to avoid fallback changes - | -LL | foo::<()>(|| panic!()); - | ++++++ - diff --git a/tests/ui/never_type/fallback_change/fallback-closure-ret.e2024.stderr b/tests/ui/never_type/fallback_change/fallback-closure-ret.e2024.stderr deleted file mode 100644 index 9687ddf6459db..0000000000000 --- a/tests/ui/never_type/fallback_change/fallback-closure-ret.e2024.stderr +++ /dev/null @@ -1,24 +0,0 @@ -error[E0277]: the trait bound `!: Bar` is not satisfied - --> $DIR/fallback-closure-ret.rs:22:5 - | -LL | foo(|| panic!()); - | ^^^^^^^^^^^^^^^^ the trait `Bar` is not implemented for `!` - | -help: the following other types implement trait `Bar` - --> $DIR/fallback-closure-ret.rs:15:1 - | -LL | impl Bar for () {} - | ^^^^^^^^^^^^^^^ `()` -LL | impl Bar for u32 {} - | ^^^^^^^^^^^^^^^^ `u32` - = note: this error might have been caused by changes to Rust's type-inference algorithm (see issue #148922 for more information) - = help: you might have intended to use the type `()` here instead -note: required by a bound in `foo` - --> $DIR/fallback-closure-ret.rs:18:11 - | -LL | fn foo(_: impl Fn() -> R) {} - | ^^^ required by this bound in `foo` - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/never_type/fallback_change/fallback-closure-ret.fallback.stderr b/tests/ui/never_type/fallback_change/fallback-closure-ret.fallback.stderr deleted file mode 100644 index 8230ca1eabc1a..0000000000000 --- a/tests/ui/never_type/fallback_change/fallback-closure-ret.fallback.stderr +++ /dev/null @@ -1,24 +0,0 @@ -error[E0277]: the trait bound `!: Bar` is not satisfied - --> $DIR/fallback-closure-ret.rs:18:5 - | -LL | foo(|| panic!()); - | ^^^^^^^^^^^^^^^^ the trait `Bar` is not implemented for `!` - | -help: the following other types implement trait `Bar` - --> $DIR/fallback-closure-ret.rs:12:1 - | -LL | impl Bar for () {} - | ^^^^^^^^^^^^^^^ `()` -LL | impl Bar for u32 {} - | ^^^^^^^^^^^^^^^^ `u32` - = note: this error might have been caused by changes to Rust's type-inference algorithm (see issue #148922 for more information) - = help: you might have intended to use the type `()` here instead -note: required by a bound in `foo` - --> $DIR/fallback-closure-ret.rs:15:11 - | -LL | fn foo(_: impl Fn() -> R) {} - | ^^^ required by this bound in `foo` - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/never_type/fallback_change/fallback-closure-ret.nofallback.stderr b/tests/ui/never_type/fallback_change/fallback-closure-ret.nofallback.stderr deleted file mode 100644 index fd7f5fea02196..0000000000000 --- a/tests/ui/never_type/fallback_change/fallback-closure-ret.nofallback.stderr +++ /dev/null @@ -1,18 +0,0 @@ -Future incompatibility report: Future breakage diagnostic: -warning: this function depends on never type fallback being `()` - --> $DIR/fallback-closure-ret.rs:17:1 - | -LL | fn main() { - | ^^^^^^^^^ - | - = help: specify the types explicitly -note: in edition 2024, the requirement `!: Bar` will fail - --> $DIR/fallback-closure-ret.rs:18:5 - | -LL | foo(|| panic!()); - | ^^^^^^^^^^^^^^^^ -help: use `()` annotations to avoid fallback changes - | -LL | foo::<()>(|| panic!()); - | ++++++ - diff --git a/tests/ui/never_type/fallback_change/fallback-closure-wrap.e2024.stderr b/tests/ui/never_type/fallback_change/fallback-closure-wrap.e2024.stderr deleted file mode 100644 index b55f9c99ae507..0000000000000 --- a/tests/ui/never_type/fallback_change/fallback-closure-wrap.e2024.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0271]: expected `{closure@fallback-closure-wrap.rs:16:40}` to return `()`, but it returns `!` - --> $DIR/fallback-closure-wrap.rs:17:9 - | -LL | let error = Closure::wrap(Box::new(move || { - | ------- this closure -LL | panic!("Can't connect to server."); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `!` - | - = note: expected unit type `()` - found type `!` - = note: required for the cast from `Box<{closure@$DIR/fallback-closure-wrap.rs:16:40: 16:47}>` to `Box` - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0271`. diff --git a/tests/ui/never_type/fallback_change/fallback-closure-wrap.fallback.stderr b/tests/ui/never_type/fallback_change/fallback-closure-wrap.fallback.stderr deleted file mode 100644 index e3d8718682fb7..0000000000000 --- a/tests/ui/never_type/fallback_change/fallback-closure-wrap.fallback.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0271]: expected `{closure@fallback-closure-wrap.rs:17:40}` to return `()`, but it returns `!` - --> $DIR/fallback-closure-wrap.rs:18:9 - | -LL | let error = Closure::wrap(Box::new(move || { - | ------- this closure -LL | panic!("Can't connect to server."); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `!` - | - = note: expected unit type `()` - found type `!` - = note: required for the cast from `Box<{closure@$DIR/fallback-closure-wrap.rs:17:40: 17:47}>` to `Box` - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0271`. diff --git a/tests/ui/never_type/fallback_change/lint-never-type-fallback-flowing-into-unsafe.e2015.stderr b/tests/ui/never_type/fallback_change/lint-never-type-fallback-flowing-into-unsafe.e2015.stderr deleted file mode 100644 index 631b6dae92942..0000000000000 --- a/tests/ui/never_type/fallback_change/lint-never-type-fallback-flowing-into-unsafe.e2015.stderr +++ /dev/null @@ -1,296 +0,0 @@ -error: never type fallback affects this call to an `unsafe` function - --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:10:18 - | -LL | unsafe { mem::zeroed() } - | ^^^^^^^^^^^^^ - | - = help: specify the type explicitly - = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see - = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default -help: use `()` annotations to avoid fallback changes - | -LL | unsafe { mem::zeroed::<()>() } - | ++++++ - -error: never type fallback affects this call to an `unsafe` function - --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:27:13 - | -LL | core::mem::transmute(Zst) - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: specify the type explicitly - = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see -help: use `()` annotations to avoid fallback changes - | -LL | core::mem::transmute::<_, ()>(Zst) - | +++++++++ - -error: never type fallback affects this union access - --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:44:18 - | -LL | unsafe { Union { a: () }.b } - | ^^^^^^^^^^^^^^^^^ - | - = help: specify the type explicitly - = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see - -error: never type fallback affects this raw pointer dereference - --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:55:18 - | -LL | unsafe { *ptr::from_ref(&()).cast() } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: specify the type explicitly - = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see -help: use `()` annotations to avoid fallback changes - | -LL | unsafe { *ptr::from_ref(&()).cast::<()>() } - | ++++++ - -error: never type fallback affects this call to an `unsafe` function - --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:76:18 - | -LL | unsafe { internally_create(x) } - | ^^^^^^^^^^^^^^^^^^^^ - | - = help: specify the type explicitly - = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see -help: use `()` annotations to avoid fallback changes - | -LL | unsafe { internally_create::<()>(x) } - | ++++++ - -error: never type fallback affects this call to an `unsafe` function - --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:94:18 - | -LL | unsafe { zeroed() } - | ^^^^^^^^ - | - = help: specify the type explicitly - = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see -help: use `()` annotations to avoid fallback changes - | -LL | let zeroed = mem::zeroed::<()>; - | ++++++ - -error: never type fallback affects this `unsafe` function - --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:89:22 - | -LL | let zeroed = mem::zeroed; - | ^^^^^^^^^^^ - | - = help: specify the type explicitly - = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see -help: use `()` annotations to avoid fallback changes - | -LL | let zeroed = mem::zeroed::<()>; - | ++++++ - -error: never type fallback affects this `unsafe` function - --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:112:17 - | -LL | let f = internally_create; - | ^^^^^^^^^^^^^^^^^ - | - = help: specify the type explicitly - = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see -help: use `()` annotations to avoid fallback changes - | -LL | let f = internally_create::<()>; - | ++++++ - -error: never type fallback affects this call to an `unsafe` method - --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:137:13 - | -LL | S(marker::PhantomData).create_out_of_thin_air() - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: specify the type explicitly - = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see - -error: never type fallback affects this call to an `unsafe` function - --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:155:19 - | -LL | match send_message::<_ /* ?0 */>() { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -... -LL | msg_send!(); - | ----------- in this macro invocation - | - = help: specify the type explicitly - = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see - = note: this error originates in the macro `msg_send` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: the type `!` does not permit zero-initialization - --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:10:18 - | -LL | unsafe { mem::zeroed() } - | ^^^^^^^^^^^^^ this code causes undefined behavior when executed - | - = note: the `!` type has no valid value - = note: `#[warn(invalid_value)]` on by default - -error: aborting due to 10 previous errors; 1 warning emitted - -Future incompatibility report: Future breakage diagnostic: -error: never type fallback affects this call to an `unsafe` function - --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:10:18 - | -LL | unsafe { mem::zeroed() } - | ^^^^^^^^^^^^^ - | - = help: specify the type explicitly - = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see - = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default -help: use `()` annotations to avoid fallback changes - | -LL | unsafe { mem::zeroed::<()>() } - | ++++++ - -Future breakage diagnostic: -error: never type fallback affects this call to an `unsafe` function - --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:27:13 - | -LL | core::mem::transmute(Zst) - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: specify the type explicitly - = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see - = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default -help: use `()` annotations to avoid fallback changes - | -LL | core::mem::transmute::<_, ()>(Zst) - | +++++++++ - -Future breakage diagnostic: -error: never type fallback affects this union access - --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:44:18 - | -LL | unsafe { Union { a: () }.b } - | ^^^^^^^^^^^^^^^^^ - | - = help: specify the type explicitly - = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see - = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default - -Future breakage diagnostic: -error: never type fallback affects this raw pointer dereference - --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:55:18 - | -LL | unsafe { *ptr::from_ref(&()).cast() } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: specify the type explicitly - = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see - = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default -help: use `()` annotations to avoid fallback changes - | -LL | unsafe { *ptr::from_ref(&()).cast::<()>() } - | ++++++ - -Future breakage diagnostic: -error: never type fallback affects this call to an `unsafe` function - --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:76:18 - | -LL | unsafe { internally_create(x) } - | ^^^^^^^^^^^^^^^^^^^^ - | - = help: specify the type explicitly - = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see - = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default -help: use `()` annotations to avoid fallback changes - | -LL | unsafe { internally_create::<()>(x) } - | ++++++ - -Future breakage diagnostic: -error: never type fallback affects this call to an `unsafe` function - --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:94:18 - | -LL | unsafe { zeroed() } - | ^^^^^^^^ - | - = help: specify the type explicitly - = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see - = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default -help: use `()` annotations to avoid fallback changes - | -LL | let zeroed = mem::zeroed::<()>; - | ++++++ - -Future breakage diagnostic: -error: never type fallback affects this `unsafe` function - --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:89:22 - | -LL | let zeroed = mem::zeroed; - | ^^^^^^^^^^^ - | - = help: specify the type explicitly - = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see - = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default -help: use `()` annotations to avoid fallback changes - | -LL | let zeroed = mem::zeroed::<()>; - | ++++++ - -Future breakage diagnostic: -error: never type fallback affects this `unsafe` function - --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:112:17 - | -LL | let f = internally_create; - | ^^^^^^^^^^^^^^^^^ - | - = help: specify the type explicitly - = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see - = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default -help: use `()` annotations to avoid fallback changes - | -LL | let f = internally_create::<()>; - | ++++++ - -Future breakage diagnostic: -error: never type fallback affects this call to an `unsafe` method - --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:137:13 - | -LL | S(marker::PhantomData).create_out_of_thin_air() - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: specify the type explicitly - = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see - = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default - -Future breakage diagnostic: -error: never type fallback affects this call to an `unsafe` function - --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:155:19 - | -LL | match send_message::<_ /* ?0 */>() { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -... -LL | msg_send!(); - | ----------- in this macro invocation - | - = help: specify the type explicitly - = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see - = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default - = note: this error originates in the macro `msg_send` (in Nightly builds, run with -Z macro-backtrace for more info) - diff --git a/tests/ui/never_type/fallback_change/lint-never-type-fallback-flowing-into-unsafe.e2024.stderr b/tests/ui/never_type/fallback_change/lint-never-type-fallback-flowing-into-unsafe.e2024.stderr deleted file mode 100644 index 631b6dae92942..0000000000000 --- a/tests/ui/never_type/fallback_change/lint-never-type-fallback-flowing-into-unsafe.e2024.stderr +++ /dev/null @@ -1,296 +0,0 @@ -error: never type fallback affects this call to an `unsafe` function - --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:10:18 - | -LL | unsafe { mem::zeroed() } - | ^^^^^^^^^^^^^ - | - = help: specify the type explicitly - = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see - = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default -help: use `()` annotations to avoid fallback changes - | -LL | unsafe { mem::zeroed::<()>() } - | ++++++ - -error: never type fallback affects this call to an `unsafe` function - --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:27:13 - | -LL | core::mem::transmute(Zst) - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: specify the type explicitly - = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see -help: use `()` annotations to avoid fallback changes - | -LL | core::mem::transmute::<_, ()>(Zst) - | +++++++++ - -error: never type fallback affects this union access - --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:44:18 - | -LL | unsafe { Union { a: () }.b } - | ^^^^^^^^^^^^^^^^^ - | - = help: specify the type explicitly - = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see - -error: never type fallback affects this raw pointer dereference - --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:55:18 - | -LL | unsafe { *ptr::from_ref(&()).cast() } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: specify the type explicitly - = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see -help: use `()` annotations to avoid fallback changes - | -LL | unsafe { *ptr::from_ref(&()).cast::<()>() } - | ++++++ - -error: never type fallback affects this call to an `unsafe` function - --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:76:18 - | -LL | unsafe { internally_create(x) } - | ^^^^^^^^^^^^^^^^^^^^ - | - = help: specify the type explicitly - = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see -help: use `()` annotations to avoid fallback changes - | -LL | unsafe { internally_create::<()>(x) } - | ++++++ - -error: never type fallback affects this call to an `unsafe` function - --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:94:18 - | -LL | unsafe { zeroed() } - | ^^^^^^^^ - | - = help: specify the type explicitly - = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see -help: use `()` annotations to avoid fallback changes - | -LL | let zeroed = mem::zeroed::<()>; - | ++++++ - -error: never type fallback affects this `unsafe` function - --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:89:22 - | -LL | let zeroed = mem::zeroed; - | ^^^^^^^^^^^ - | - = help: specify the type explicitly - = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see -help: use `()` annotations to avoid fallback changes - | -LL | let zeroed = mem::zeroed::<()>; - | ++++++ - -error: never type fallback affects this `unsafe` function - --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:112:17 - | -LL | let f = internally_create; - | ^^^^^^^^^^^^^^^^^ - | - = help: specify the type explicitly - = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see -help: use `()` annotations to avoid fallback changes - | -LL | let f = internally_create::<()>; - | ++++++ - -error: never type fallback affects this call to an `unsafe` method - --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:137:13 - | -LL | S(marker::PhantomData).create_out_of_thin_air() - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: specify the type explicitly - = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see - -error: never type fallback affects this call to an `unsafe` function - --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:155:19 - | -LL | match send_message::<_ /* ?0 */>() { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -... -LL | msg_send!(); - | ----------- in this macro invocation - | - = help: specify the type explicitly - = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see - = note: this error originates in the macro `msg_send` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: the type `!` does not permit zero-initialization - --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:10:18 - | -LL | unsafe { mem::zeroed() } - | ^^^^^^^^^^^^^ this code causes undefined behavior when executed - | - = note: the `!` type has no valid value - = note: `#[warn(invalid_value)]` on by default - -error: aborting due to 10 previous errors; 1 warning emitted - -Future incompatibility report: Future breakage diagnostic: -error: never type fallback affects this call to an `unsafe` function - --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:10:18 - | -LL | unsafe { mem::zeroed() } - | ^^^^^^^^^^^^^ - | - = help: specify the type explicitly - = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see - = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default -help: use `()` annotations to avoid fallback changes - | -LL | unsafe { mem::zeroed::<()>() } - | ++++++ - -Future breakage diagnostic: -error: never type fallback affects this call to an `unsafe` function - --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:27:13 - | -LL | core::mem::transmute(Zst) - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: specify the type explicitly - = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see - = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default -help: use `()` annotations to avoid fallback changes - | -LL | core::mem::transmute::<_, ()>(Zst) - | +++++++++ - -Future breakage diagnostic: -error: never type fallback affects this union access - --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:44:18 - | -LL | unsafe { Union { a: () }.b } - | ^^^^^^^^^^^^^^^^^ - | - = help: specify the type explicitly - = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see - = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default - -Future breakage diagnostic: -error: never type fallback affects this raw pointer dereference - --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:55:18 - | -LL | unsafe { *ptr::from_ref(&()).cast() } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: specify the type explicitly - = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see - = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default -help: use `()` annotations to avoid fallback changes - | -LL | unsafe { *ptr::from_ref(&()).cast::<()>() } - | ++++++ - -Future breakage diagnostic: -error: never type fallback affects this call to an `unsafe` function - --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:76:18 - | -LL | unsafe { internally_create(x) } - | ^^^^^^^^^^^^^^^^^^^^ - | - = help: specify the type explicitly - = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see - = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default -help: use `()` annotations to avoid fallback changes - | -LL | unsafe { internally_create::<()>(x) } - | ++++++ - -Future breakage diagnostic: -error: never type fallback affects this call to an `unsafe` function - --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:94:18 - | -LL | unsafe { zeroed() } - | ^^^^^^^^ - | - = help: specify the type explicitly - = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see - = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default -help: use `()` annotations to avoid fallback changes - | -LL | let zeroed = mem::zeroed::<()>; - | ++++++ - -Future breakage diagnostic: -error: never type fallback affects this `unsafe` function - --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:89:22 - | -LL | let zeroed = mem::zeroed; - | ^^^^^^^^^^^ - | - = help: specify the type explicitly - = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see - = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default -help: use `()` annotations to avoid fallback changes - | -LL | let zeroed = mem::zeroed::<()>; - | ++++++ - -Future breakage diagnostic: -error: never type fallback affects this `unsafe` function - --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:112:17 - | -LL | let f = internally_create; - | ^^^^^^^^^^^^^^^^^ - | - = help: specify the type explicitly - = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see - = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default -help: use `()` annotations to avoid fallback changes - | -LL | let f = internally_create::<()>; - | ++++++ - -Future breakage diagnostic: -error: never type fallback affects this call to an `unsafe` method - --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:137:13 - | -LL | S(marker::PhantomData).create_out_of_thin_air() - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: specify the type explicitly - = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see - = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default - -Future breakage diagnostic: -error: never type fallback affects this call to an `unsafe` function - --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:155:19 - | -LL | match send_message::<_ /* ?0 */>() { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -... -LL | msg_send!(); - | ----------- in this macro invocation - | - = help: specify the type explicitly - = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see - = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default - = note: this error originates in the macro `msg_send` (in Nightly builds, run with -Z macro-backtrace for more info) - diff --git a/tests/ui/never_type/fallback_change/try-block-never-type-fallback.e2021.stderr b/tests/ui/never_type/fallback_change/try-block-never-type-fallback.e2021.stderr deleted file mode 100644 index 7e23c86bcbccc..0000000000000 --- a/tests/ui/never_type/fallback_change/try-block-never-type-fallback.e2021.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error[E0277]: the trait bound `!: From<()>` is not satisfied - --> $DIR/try-block-never-type-fallback.rs:20:9 - | -LL | bar(try { x? }); - | --- ^^^^^^^^^^ the trait `From<()>` is not implemented for `!` - | | - | required by a bound introduced by this call - | - = note: this error might have been caused by changes to Rust's type-inference algorithm (see issue #148922 for more information) - = help: you might have intended to use the type `()` here instead - = note: required for `()` to implement `Into` -note: required by a bound in `bar` - --> $DIR/try-block-never-type-fallback.rs:15:23 - | -LL | fn bar(_: Result, u32>) { - | ^^^^^^^ required by this bound in `bar` - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0277`. From 90d9c6319a0973afdaae9a145f23afcdd7edfc2f Mon Sep 17 00:00:00 2001 From: Waffle Lapkin Date: Mon, 6 Apr 2026 19:07:09 +0200 Subject: [PATCH 17/18] TMP: allow a lint in r-a --- src/tools/rust-analyzer/crates/hir-ty/src/mir.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/mir.rs b/src/tools/rust-analyzer/crates/hir-ty/src/mir.rs index a8865cd54e6a5..9363cf73785a9 100644 --- a/src/tools/rust-analyzer/crates/hir-ty/src/mir.rs +++ b/src/tools/rust-analyzer/crates/hir-ty/src/mir.rs @@ -875,6 +875,7 @@ pub enum CastKind { } #[derive(Debug, PartialEq, Eq, Clone)] +#[allow(unreachable_code)] // https://github.com/rust-lang/rust/issues/154900 pub enum Rvalue { /// Yields the operand unchanged Use(Operand), From bc01cc0717ad8bb1c63dfa6a36115bafe0d58c9b Mon Sep 17 00:00:00 2001 From: Waffle Lapkin Date: Mon, 6 Apr 2026 23:27:00 +0200 Subject: [PATCH 18/18] update edition-guide submodule to unfuck tests there --- src/doc/edition-guide | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/edition-guide b/src/doc/edition-guide index c3c0f0b3da266..43d56e0a79665 160000 --- a/src/doc/edition-guide +++ b/src/doc/edition-guide @@ -1 +1 @@ -Subproject commit c3c0f0b3da26610138b7ba7663f60cd2c68cf184 +Subproject commit 43d56e0a79665eddb15052b29390d248c3b8f68b