diff --git a/compiler/rustc_arena/src/lib.rs b/compiler/rustc_arena/src/lib.rs index 3e9012f2d3871..c33765f03d77d 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 f90359c515264..e919e7df99ee0 100644 --- a/compiler/rustc_ast_ir/src/lib.rs +++ b/compiler/rustc_ast_ir/src/lib.rs @@ -7,7 +7,7 @@ // tidy-alphabetical-start #![cfg_attr(feature = "nightly", allow(internal_features))] -#![cfg_attr(feature = "nightly", feature(never_type))] +#![cfg_attr(feature = "nightly", cfg_attr(bootstrap, feature(never_type)))] #![cfg_attr(feature = "nightly", feature(rustc_attrs))] // tidy-alphabetical-end diff --git a/compiler/rustc_ast_passes/src/feature_gate.rs b/compiler/rustc_ast_passes/src/feature_gate.rs index 01d81bab55075..ec9a2a1d23084 100644 --- a/compiler/rustc_ast_passes/src/feature_gate.rs +++ b/compiler/rustc_ast_passes/src/feature_gate.rs @@ -261,9 +261,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"); } @@ -294,15 +291,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_borrowck/src/lib.rs b/compiler/rustc_borrowck/src/lib.rs index 42b525ea97d94..692941f066314 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(default_field_values)] #![feature(deref_patterns)] #![feature(file_buffered)] #![feature(negative_impls)] -#![feature(never_type)] #![feature(option_into_flat_iter)] #![feature(rustc_attrs)] #![feature(stmt_expr_attributes)] diff --git a/compiler/rustc_const_eval/src/lib.rs b/compiler/rustc_const_eval/src/lib.rs index 7fe32b4e75ffb..a7cad6c0adfb2 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(decl_macro)] #![feature(deref_patterns)] -#![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 d8c1e2bd0ed30..ab30806bd2a59 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(nonzero_internals)] #![feature(pattern_type_macro)] #![feature(pattern_types)] 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 b487187842029..f868b11ea6fd2 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -3,11 +3,11 @@ //! This module contains the code for creating and emitting diagnostics. // tidy-alphabetical-start +#![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)] // tidy-alphabetical-end extern crate self as rustc_errors; diff --git a/compiler/rustc_feature/src/accepted.rs b/compiler/rustc_feature/src/accepted.rs index f57a280968322..a6e6f4f78323c 100644 --- a/compiler/rustc_feature/src/accepted.rs +++ b/compiler/rustc_feature/src/accepted.rs @@ -335,6 +335,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 00ca1e07c93fd..8731c41da1884 100644 --- a/compiler/rustc_feature/src/unstable.rs +++ b/compiler/rustc_feature/src/unstable.rs @@ -673,8 +673,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/compiler/rustc_hir/src/lib.rs b/compiler/rustc_hir/src/lib.rs index 0b279f334e9fb..55ef1c9fb3ef9 100644 --- a/compiler/rustc_hir/src/lib.rs +++ b/compiler/rustc_hir/src/lib.rs @@ -3,6 +3,7 @@ //! [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)] @@ -10,7 +11,6 @@ #![feature(default_field_values)] #![feature(derive_const)] #![feature(exhaustive_patterns)] -#![feature(never_type)] #![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 1f342f10f8b17..9799208efdb2a 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/diagnostics.rs b/compiler/rustc_hir_typeck/src/diagnostics.rs index fd74693e7f9fb..2d4cf3d9b400d 100644 --- a/compiler/rustc_hir_typeck/src/diagnostics.rs +++ b/compiler/rustc_hir_typeck/src/diagnostics.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}; @@ -262,17 +262,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 e6f87304ee396..889b8e841febc 100644 --- a/compiler/rustc_hir_typeck/src/fallback.rs +++ b/compiler/rustc_hir_typeck/src/fallback.rs @@ -10,13 +10,12 @@ use rustc_hir::def_id::DefId; use rustc_hir::intravisit::{InferKind, Visitor}; use rustc_hir::{self as hir, CRATE_HIR_ID, HirId}; use rustc_lint_defs::builtin::{ - DEPENDENCY_ON_UNIT_NEVER_TYPE_FALLBACK, FLOAT_LITERAL_F32_FALLBACK, - NEVER_TYPE_FALLBACK_FLOWING_INTO_UNSAFE, + FLOAT_LITERAL_F32_FALLBACK, NEVER_TYPE_FALLBACK_FLOWING_INTO_UNSAFE, }; use rustc_middle::ty::{self, FloatVid, Ty, TyCtxt, TypeSuperVisitable, TypeVisitable}; use rustc_span::def_id::LocalDefId; use rustc_span::{DUMMY_SP, Span}; -use rustc_trait_selection::traits::{ObligationCause, ObligationCtxt, TraitEngine}; +use rustc_trait_selection::traits::TraitEngine; use tracing::debug; use crate::{FnCtxt, diagnostics}; @@ -237,11 +236,6 @@ impl<'tcx> FnCtxt<'_, 'tcx> { // a type variable is that is coerced let coercion_graph = self.create_coercion_graph(); - self.lint_obligations_broken_by_never_type_fallback_change( - &diverging_root_vids, - &coercion_graph, - ); - if !diverging_root_vids.is_empty() { let unsafe_infer_vars = compute_unsafe_infer_vars(self, self.body_def_id); @@ -305,58 +299,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.no_errors() - && 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( - DEPENDENCY_ON_UNIT_NEVER_TYPE_FALLBACK, - self.tcx.local_def_id_to_hir_id(self.body_def_id), - self.tcx.def_span(self.body_def_id), - diagnostics::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_hir_typeck/src/fn_ctxt/mod.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs index e488f8c9a7887..06c8583b632ae 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs @@ -493,24 +493,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) { diff --git a/compiler/rustc_hir_typeck/src/lib.rs b/compiler/rustc_hir_typeck/src/lib.rs index 7f38aeb5ac3fa..57fd6a8658ae3 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(deref_patterns)] #![feature(iter_intersperse)] #![feature(iter_order_by)] -#![feature(never_type)] #![feature(option_into_flat_iter)] #![feature(option_reference_flattening)] #![feature(trim_prefix_suffix)] diff --git a/compiler/rustc_lint/src/lib.rs b/compiler/rustc_lint/src/lib.rs index 852f1cfda5168..5310500fa84eb 100644 --- a/compiler/rustc_lint/src/lib.rs +++ b/compiler/rustc_lint/src/lib.rs @@ -713,6 +713,10 @@ fn register_builtins(store: &mut LintStore) { "converted into hard error, \ generic items must always be mangled", ); + 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 d7339d1b60269..def2662e15837 100644 --- a/compiler/rustc_lint_defs/src/builtin.rs +++ b/compiler/rustc_lint_defs/src/builtin.rs @@ -36,7 +36,6 @@ pub mod hardwired { CONST_ITEM_MUTATION, DEAD_CODE, DEAD_CODE_PUB_IN_BINARY, - DEPENDENCY_ON_UNIT_NEVER_TYPE_FALLBACK, DEPRECATED, DEPRECATED_IN_FUTURE, DEPRECATED_LLVM_INTRINSIC, @@ -4176,9 +4175,9 @@ declare_lint! { /// /// ### 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 - /// unsound. Instead of depending on the fallback, you should specify the type explicitly: + /// The never type fallback used to be `()`, meaning that `!` got spontaneously coerced to `()`. + /// Since then the never type fallback has been changed to `!`, making the above code undefined + /// behavior. Instead of depending on the fallback, you should specify the type explicitly: /// ``` /// if true { /// return @@ -4195,64 +4194,6 @@ declare_lint! { pub NEVER_TYPE_FALLBACK_FLOWING_INTO_UNSAFE, Deny, "never type fallback affecting unsafe function calls", - @future_incompatible = FutureIncompatibleInfo { - reason: fcw!(EditionAndFutureReleaseSemanticsChange 2024 "never-type-fallback"), - report_in_deps: true, - }; - @edition Edition2024 => Deny; - 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 } diff --git a/compiler/rustc_macros/src/lib.rs b/compiler/rustc_macros/src/lib.rs index 2f4e5606cd555..ec7495f95ac3a 100644 --- a/compiler/rustc_macros/src/lib.rs +++ b/compiler/rustc_macros/src/lib.rs @@ -3,11 +3,11 @@ rustc::default_hash_types, reason = "we like performance but can't use `rustc_data_structures`" )] +#![cfg_attr(bootstrap, feature(never_type))] #![deny( rustc::potential_query_instability, reason = "macros shall produce deterministic output/errors" )] -#![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 306e344c23095..dd963fc8773c7 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(option_into_flat_iter)] #![feature(proc_macro_internals)] #![feature(trusted_len)] diff --git a/compiler/rustc_middle/src/lib.rs b/compiler/rustc_middle/src/lib.rs index 60fb7fb53a533..993cb6e7769dd 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(option_into_flat_iter)] #![feature(ptr_alignment_type)] #![feature(range_bounds_is_empty)] diff --git a/compiler/rustc_middle/src/ty/inhabitedness/mod.rs b/compiler/rustc_middle/src/ty/inhabitedness/mod.rs index 42485a17f1011..9261986137d9d 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 { @@ -154,7 +154,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 56351e817efcd..c0929bef38465 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(deref_patterns)] #![feature(exact_size_is_empty)] #![feature(file_buffered)] -#![feature(never_type)] #![feature(try_blocks)] // tidy-alphabetical-end diff --git a/compiler/rustc_next_trait_solver/src/solve/normalizes_to.rs b/compiler/rustc_next_trait_solver/src/solve/normalizes_to.rs index b9f9fb773c126..1d8617812937f 100644 --- a/compiler/rustc_next_trait_solver/src/solve/normalizes_to.rs +++ b/compiler/rustc_next_trait_solver/src/solve/normalizes_to.rs @@ -365,8 +365,9 @@ where } FetchEligibleAssocItemResponse::Err(guar) => return error_response(ecx, guar), FetchEligibleAssocItemResponse::NotFoundBecauseErased => { - ecx.opaque_accesses.rerun_always(RerunReason::FetchEligibleAssocItem)?; - return Err(NoSolution.into()); + match ecx + .opaque_accesses + .rerun_always(RerunReason::FetchEligibleAssocItem)? {} } }; diff --git a/compiler/rustc_next_trait_solver/src/solve/trait_goals.rs b/compiler/rustc_next_trait_solver/src/solve/trait_goals.rs index ccd3856fc962b..14cb3acad68e0 100644 --- a/compiler/rustc_next_trait_solver/src/solve/trait_goals.rs +++ b/compiler/rustc_next_trait_solver/src/solve/trait_goals.rs @@ -257,8 +257,7 @@ where { debug_assert!(is_rigid == ty::IsRigid::Yes); if ecx.opaque_accesses.might_rerun() { - ecx.opaque_accesses.rerun_always(RerunReason::AutoTraitLeakage)?; - return Err(NoSolution.into()); + match ecx.opaque_accesses.rerun_always(RerunReason::AutoTraitLeakage)? {} } for item_bound in cx.item_self_bounds(def_id.into()).skip_binder() { diff --git a/compiler/rustc_pattern_analysis/src/constructor.rs b/compiler/rustc_pattern_analysis/src/constructor.rs index 6f07e922ceef4..2159a8533508f 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(feature = "rustc", 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 0e99db1b95cc1..16a7d1d77301c 100644 --- a/compiler/rustc_resolve/src/late.rs +++ b/compiler/rustc_resolve/src/late.rs @@ -3957,8 +3957,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 { @@ -4023,8 +4023,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 8b383cc3cbc04..39333ab00b57f 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(nonzero_internals)] #![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 44fa3ea59ac50..bbaf683f4288a 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(default_field_values)] #![feature(deref_patterns)] #![feature(hash_set_entry)] #![feature(iter_intersperse)] #![feature(iterator_try_reduce)] -#![feature(never_type)] #![feature(option_into_flat_iter)] #![feature(try_blocks)] #![feature(unwrap_infallible)] diff --git a/compiler/rustc_transmute/src/lib.rs b/compiler/rustc_transmute/src/lib.rs index 0c031d978d6ac..b49836dd0b8ea 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)] #![feature(option_into_flat_iter)] // tidy-alphabetical-end diff --git a/compiler/rustc_ty_utils/src/lib.rs b/compiler/rustc_ty_utils/src/lib.rs index 6eaf040f45f90..ba37f7f72691a 100644 --- a/compiler/rustc_ty_utils/src/lib.rs +++ b/compiler/rustc_ty_utils/src/lib.rs @@ -5,9 +5,9 @@ //! This API is completely unstable and subject to change. // tidy-alphabetical-start +#![cfg_attr(bootstrap, feature(never_type))] #![feature(deref_patterns)] #![feature(iterator_try_collect)] -#![feature(never_type)] #![feature(option_into_flat_iter)] // tidy-alphabetical-end diff --git a/library/alloc/src/lib.rs b/library/alloc/src/lib.rs index 09b752491673e..2b0b1ade64087 100644 --- a/library/alloc/src/lib.rs +++ b/library/alloc/src/lib.rs @@ -208,7 +208,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 83b017b7625b9..eca8444812521 100644 --- a/library/alloctests/lib.rs +++ b/library/alloctests/lib.rs @@ -62,7 +62,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/clone.rs b/library/core/src/clone.rs index f124b8bceaded..126ab37bc0b71 100644 --- a/library/core/src/clone.rs +++ b/library/core/src/clone.rs @@ -732,7 +732,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")] const impl Clone for ! { #[inline] diff --git a/library/core/src/cmp.rs b/library/core/src/cmp.rs index 43128302dfef4..87f0638df183e 100644 --- a/library/core/src/cmp.rs +++ b/library/core/src/cmp.rs @@ -2355,7 +2355,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")] const impl PartialEq for ! { #[inline] @@ -2364,11 +2364,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")] const impl Eq for ! {} - #[unstable(feature = "never_type", issue = "35121")] + #[stable(feature = "never_type", since = "CURRENT_RUSTC_VERSION")] #[rustc_const_unstable(feature = "const_cmp", issue = "143800")] const impl PartialOrd for ! { #[inline] @@ -2377,7 +2377,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")] const impl Ord for ! { #[inline] diff --git a/library/core/src/convert/mod.rs b/library/core/src/convert/mod.rs index 540b4aa0efdda..7e675815edb2e 100644 --- a/library/core/src/convert/mod.rs +++ b/library/core/src/convert/mod.rs @@ -34,9 +34,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; @@ -872,7 +869,7 @@ const impl AsMut for str { /// The error type for errors that can never happen. /// -/// Since this enum has no variant, a value of this type can never actually exist. +/// Since this is an alias to the never type, a value of this type can never actually exist. /// This can be useful for generic APIs that use [`Result`] and parameterize the error type, /// to indicate that the result is always [`Ok`]. /// @@ -889,101 +886,7 @@ const impl 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. +/// Note: since CURRENT_RUSTC_VERSION this is an alias to `!`. If targeting that or future versions, +/// prefer using the never type directly. #[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")] -const impl 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")] -const impl 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")] -const impl Eq for Infallible {} - -#[stable(feature = "convert_infallible", since = "1.34.0")] -#[rustc_const_unstable(feature = "const_cmp", issue = "143800")] -const impl 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")] -const impl 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")] -const impl 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/error.rs b/library/core/src/error.rs index 0f01c09c8d91c..7386c52849eab 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 6a4c58afc16f3..7a3d874f3b6f4 100644 --- a/library/core/src/fmt/mod.rs +++ b/library/core/src/fmt/mod.rs @@ -2896,7 +2896,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 { @@ -2904,7 +2904,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/keyword_docs.rs b/library/core/src/keyword_docs.rs index 3d914556fc65c..38f48d29ff272 100644 --- a/library/core/src/keyword_docs.rs +++ b/library/core/src/keyword_docs.rs @@ -2219,7 +2219,6 @@ const _: () = (); /// 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/core/src/lib.rs b/library/core/src/lib.rs index f026434acbbc1..89ae9179f4e25 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -145,7 +145,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/marker.rs b/library/core/src/marker.rs index c83972d6eae58..e499955df9479 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/mem/mod.rs b/library/core/src/mem/mod.rs index 63d17f2832493..26390e5071c53 100644 --- a/library/core/src/mem/mod.rs +++ b/library/core/src/mem/mod.rs @@ -1427,7 +1427,6 @@ pub const fn discriminant(v: &T) -> Discriminant { /// # Examples /// /// ``` -/// # #![feature(never_type)] /// # #![feature(variant_count)] /// /// use std::mem; diff --git a/library/core/src/num/error.rs b/library/core/src/num/error.rs index ccf50a2c81a1b..d102c456f3b4a 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; @@ -35,23 +34,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")] -const impl From for TryFromIntError { - fn from(x: Infallible) -> TryFromIntError { - match x {} - } -} - -#[unstable(feature = "never_type", issue = "35121")] +#[stable(feature = "never_type", since = "CURRENT_RUSTC_VERSION")] #[rustc_const_unstable(feature = "const_convert", issue = "143773")] const impl 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 f7486cddaae5d..614b104d9c2a2 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/core/src/primitive_docs.rs b/library/core/src/primitive_docs.rs index 3e1596689e9d1..04865cccde94e 100644 --- a/library/core/src/primitive_docs.rs +++ b/library/core/src/primitive_docs.rs @@ -73,7 +73,6 @@ const _: () = (); /// write: /// /// ``` -/// #![feature(never_type)] /// # fn foo() -> u32 { /// let x: ! = { /// return 123 @@ -230,7 +229,6 @@ const _: () = (); /// for example: /// /// ``` -/// #![feature(never_type)] /// # use std::fmt; /// # trait Debug { /// # fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result; @@ -311,7 +309,7 @@ const _: () = (); /// [`()`]: prim@unit /// [2024 edition]: /// -#[unstable(feature = "never_type", issue = "35121")] +#[stable(feature = "never_type", since = "CURRENT_RUSTC_VERSION")] const _: () = (); // Required to make auto trait impls render. diff --git a/library/core/src/result.rs b/library/core/src/result.rs index b257cd8c82a0e..c38008cf73d2b 100644 --- a/library/core/src/result.rs +++ b/library/core/src/result.rs @@ -1343,7 +1343,6 @@ impl Result { /// # Examples /// /// ``` - /// # #![feature(never_type)] /// # #![feature(unwrap_infallible)] /// /// fn only_good_news() -> Result { @@ -1380,7 +1379,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 c653fdcdf4927..de90ce42c1529 100644 --- a/library/coretests/tests/lib.rs +++ b/library/coretests/tests/lib.rs @@ -88,7 +88,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(num_internals)] diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs index 980ec4416f04a..cc652cb743353 100644 --- a/library/std/src/lib.rs +++ b/library/std/src/lib.rs @@ -302,7 +302,6 @@ #![feature(must_not_suspend)] #![feature(needs_panic_runtime)] #![feature(negative_impls)] -#![feature(never_type)] #![feature(optimize_attribute)] #![feature(prelude_import)] #![feature(rustc_attrs)] diff --git a/library/std/src/process.rs b/library/std/src/process.rs index a4c461737b620..6414a235698b8 100644 --- a/library/std/src/process.rs +++ b/library/std/src/process.rs @@ -162,7 +162,6 @@ ))] mod tests; -use crate::convert::Infallible; use crate::ffi::OsStr; use crate::io::prelude::*; use crate::io::{self, BorrowedCursor, IoSlice, IoSliceMut}; @@ -2700,13 +2699,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] diff --git a/src/bootstrap/stdlib-semver-check-stamp b/src/bootstrap/stdlib-semver-check-stamp index d93ba46345c85..3462b7f3cd9eb 100644 --- a/src/bootstrap/stdlib-semver-check-stamp +++ b/src/bootstrap/stdlib-semver-check-stamp @@ -2,4 +2,4 @@ Change this file to explicitly acknowledge making a breaking change to the Rust If this file is modified in the same PR as the breaking change, then CI will not fail due to the breaking change being detected by cargo-semver-checks. -Last change is for: https://github.com/rust-lang/rust/pull/160253 +Last change is for: https://github.com/rust-lang/rust/pull/155499 diff --git a/src/tools/clippy/clippy_lints/src/empty_enums.rs b/src/tools/clippy/clippy_lints/src/empty_enums.rs index 8c113e6febc92..0ee29584d1a5e 100644 --- a/src/tools/clippy/clippy_lints/src/empty_enums.rs +++ b/src/tools/clippy/clippy_lints/src/empty_enums.rs @@ -8,9 +8,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 @@ -35,8 +32,6 @@ declare_clippy_lint! { /// /// Use instead: /// ```no_run - /// #![feature(never_type)] - /// /// /// Use the `!` type directly... /// type CannotExist = !; /// @@ -60,8 +55,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( diff --git a/src/tools/clippy/clippy_lints/src/lib.rs b/src/tools/clippy/clippy_lints/src/lib.rs index f7f5341772623..8df0aad4024ca 100644 --- a/src/tools/clippy/clippy_lints/src/lib.rs +++ b/src/tools/clippy/clippy_lints/src/lib.rs @@ -7,7 +7,7 @@ #![feature(iter_partition_in_place)] #![feature(macro_metavar_expr)] #![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 1c5e26a590613..24f37ec67528b 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 @@ -73,7 +73,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(), ".."); @@ -118,9 +117,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/tests/ui/double_must_use.fixed b/src/tools/clippy/tests/ui/double_must_use.fixed index 81c62b4726f57..121d8c631adf5 100644 --- a/src/tools/clippy/tests/ui/double_must_use.fixed +++ b/src/tools/clippy/tests/ui/double_must_use.fixed @@ -1,6 +1,5 @@ #![warn(clippy::double_must_use)] #![expect(clippy::result_unit_err)] -#![feature(never_type)] use std::ops::ControlFlow; diff --git a/src/tools/clippy/tests/ui/double_must_use.rs b/src/tools/clippy/tests/ui/double_must_use.rs index e3c01b6f57a8b..f26161483b412 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)] #![expect(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 edb56104e6f24..a7a8c9f2dbb46 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 considered as `#[must_use]` - --> tests/ui/double_must_use.rs:8:1 + --> tests/ui/double_must_use.rs:7:1 | LL | #[must_use] | ----------- help: remove the attribute @@ -11,7 +11,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 considered as `#[must_use]` - --> tests/ui/double_must_use.rs:15:1 + --> tests/ui/double_must_use.rs:14:1 | LL | #[must_use] | ----------- help: remove the attribute @@ -19,14 +19,14 @@ LL | pub fn must_use_tuple() -> (Result<(), ()>, u8) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: the return type is `std::result::Result` in tuple element 0 - --> tests/ui/double_must_use.rs:15:28 + --> tests/ui/double_must_use.rs:14:28 | LL | pub fn must_use_tuple() -> (Result<(), ()>, u8) { | ^^^^^^^^^^^^^^^^^^^^ = note: alternatively, you may add an explicit reason to the `must_use` attribute error: this function has a `#[must_use]` attribute with no message, but returns a type already considered as `#[must_use]` - --> tests/ui/double_must_use.rs:22:1 + --> tests/ui/double_must_use.rs:21:1 | LL | #[must_use] | ----------- help: remove the attribute @@ -34,14 +34,14 @@ LL | pub fn must_use_array() -> [Result<(), ()>; 1] { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: the return type is array of `std::result::Result`s - --> tests/ui/double_must_use.rs:22:28 + --> tests/ui/double_must_use.rs:21:28 | LL | pub fn must_use_array() -> [Result<(), ()>; 1] { | ^^^^^^^^^^^^^^^^^^^ = note: alternatively, you may add an explicit reason to the `must_use` attribute error: this function has a `#[must_use]` attribute with no message, but returns a type already considered as `#[must_use]` - --> tests/ui/double_must_use.rs:40:1 + --> tests/ui/double_must_use.rs:39:1 | LL | #[must_use] | ----------- help: remove the attribute @@ -49,14 +49,14 @@ LL | async fn async_must_use_result() -> Result<(), ()> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: the return type is implementer of `std::future::Future` - --> tests/ui/double_must_use.rs:40:37 + --> tests/ui/double_must_use.rs:39:37 | LL | async fn async_must_use_result() -> Result<(), ()> { | ^^^^^^^^^^^^^^ = note: alternatively, you may add an explicit reason to the `must_use` attribute error: this function has a `#[must_use]` attribute with no message, but returns a type already considered as `#[must_use]` - --> tests/ui/double_must_use.rs:55:1 + --> tests/ui/double_must_use.rs:54:1 | LL | #[must_use] | ----------- help: remove the attribute @@ -64,14 +64,14 @@ LL | pub fn must_use_result_with_uninhabited_2() -> Result { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: the return type is `T` in a `Result` with an uninhabited error - --> tests/ui/double_must_use.rs:55:48 + --> tests/ui/double_must_use.rs:54:48 | LL | pub fn must_use_result_with_uninhabited_2() -> Result { | ^^^^^^^^^^^^ = note: alternatively, you may add an explicit reason to the `must_use` attribute error: this function has a `#[must_use]` attribute with no message, but returns a type already considered as `#[must_use]` - --> tests/ui/double_must_use.rs:66:1 + --> tests/ui/double_must_use.rs:65:1 | LL | #[must_use] | ----------- help: remove the attribute @@ -79,7 +79,7 @@ LL | pub fn must_use_controlflow_with_uninhabited_2() -> ControlFlow tests/ui/double_must_use.rs:66:53 + --> tests/ui/double_must_use.rs:65:53 | LL | pub fn must_use_controlflow_with_uninhabited_2() -> ControlFlow { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/tools/clippy/tests/ui/double_must_use_unfixable.rs b/src/tools/clippy/tests/ui/double_must_use_unfixable.rs index 88c2502da9f74..677a42a7ece66 100644 --- a/src/tools/clippy/tests/ui/double_must_use_unfixable.rs +++ b/src/tools/clippy/tests/ui/double_must_use_unfixable.rs @@ -1,6 +1,5 @@ #![warn(clippy::double_must_use)] #![expect(clippy::result_unit_err)] -#![feature(never_type)] #[cfg_attr(all(), must_use, deprecated)] pub fn issue_12320() -> Result<(), ()> { diff --git a/src/tools/clippy/tests/ui/double_must_use_unfixable.stderr b/src/tools/clippy/tests/ui/double_must_use_unfixable.stderr index 5d9c02e5d6cea..aa7da6b10405e 100644 --- a/src/tools/clippy/tests/ui/double_must_use_unfixable.stderr +++ b/src/tools/clippy/tests/ui/double_must_use_unfixable.stderr @@ -1,11 +1,11 @@ error: this function has a `#[must_use]` attribute with no message, but returns a type already considered as `#[must_use]` - --> tests/ui/double_must_use_unfixable.rs:6:1 + --> tests/ui/double_must_use_unfixable.rs:5:1 | LL | pub fn issue_12320() -> Result<(), ()> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove `must_use` - --> tests/ui/double_must_use_unfixable.rs:5:19 + --> tests/ui/double_must_use_unfixable.rs:4:19 | LL | #[cfg_attr(all(), must_use, deprecated)] | ^^^^^^^^ @@ -14,13 +14,13 @@ LL | #[cfg_attr(all(), must_use, deprecated)] = 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 considered as `#[must_use]` - --> tests/ui/double_must_use_unfixable.rs:12:1 + --> tests/ui/double_must_use_unfixable.rs:11:1 | LL | pub fn issue_12320_2() -> Result<(), ()> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove `must_use` - --> tests/ui/double_must_use_unfixable.rs:11:31 + --> tests/ui/double_must_use_unfixable.rs:10:31 | LL | #[cfg_attr(all(), deprecated, must_use)] | ^^^^^^^^ 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 2af4c577278b2..c799d7cf4940b 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)] #![expect(clippy::let_and_return, clippy::uninhabited_references)] enum SingleVariantEnum { diff --git a/src/tools/clippy/tests/ui/infallible_destructuring_match.rs b/src/tools/clippy/tests/ui/infallible_destructuring_match.rs index 87b36bb1babda..2e06df30484c8 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)] #![expect(clippy::let_and_return, clippy::uninhabited_references)] enum SingleVariantEnum { 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 8aac045cad089..66d7fc5325abf 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)] #![warn(clippy::must_use_candidate)] use std::rc::Rc; use std::sync::Arc; diff --git a/src/tools/clippy/tests/ui/must_use_candidates.rs b/src/tools/clippy/tests/ui/must_use_candidates.rs index d0e2dbd3d62de..79edb4f2be19b 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)] #![warn(clippy::must_use_candidate)] use std::rc::Rc; use std::sync::Arc; diff --git a/src/tools/clippy/tests/ui/must_use_candidates.stderr b/src/tools/clippy/tests/ui/must_use_candidates.stderr index 9f6beaf19595d..d7ce0f91a3330 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:10:8 + --> tests/ui/must_use_candidates.rs:9: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:16:12 + --> tests/ui/must_use_candidates.rs:15: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:48:8 + --> tests/ui/must_use_candidates.rs:47: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:61:8 + --> tests/ui/must_use_candidates.rs:60: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:70:8 + --> tests/ui/must_use_candidates.rs:69: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:102:8 + --> tests/ui/must_use_candidates.rs:101:8 | LL | pub fn result_uninhabited_1() -> Result { | ^^^^^^^^^^^^^^^^^^^^ diff --git a/src/tools/clippy/tests/ui/redundant_else.fixed b/src/tools/clippy/tests/ui/redundant_else.fixed index 328fb8d7a900f..d0e8ffc8de188 100644 --- a/src/tools/clippy/tests/ui/redundant_else.fixed +++ b/src/tools/clippy/tests/ui/redundant_else.fixed @@ -1,6 +1,5 @@ //@aux-build:proc_macros.rs -#![feature(never_type)] #![warn(clippy::redundant_else)] #![expect(clippy::unnecessary_operation)] diff --git a/src/tools/clippy/tests/ui/redundant_else.rs b/src/tools/clippy/tests/ui/redundant_else.rs index 478b6277dbfc3..dd9c8348e690e 100644 --- a/src/tools/clippy/tests/ui/redundant_else.rs +++ b/src/tools/clippy/tests/ui/redundant_else.rs @@ -1,6 +1,5 @@ //@aux-build:proc_macros.rs -#![feature(never_type)] #![warn(clippy::redundant_else)] #![expect(clippy::unnecessary_operation)] diff --git a/src/tools/clippy/tests/ui/redundant_else.stderr b/src/tools/clippy/tests/ui/redundant_else.stderr index 01112d5e0ea15..31a8f45599ec0 100644 --- a/src/tools/clippy/tests/ui/redundant_else.stderr +++ b/src/tools/clippy/tests/ui/redundant_else.stderr @@ -1,5 +1,5 @@ error: redundant else block - --> tests/ui/redundant_else.rs:19:10 + --> tests/ui/redundant_else.rs:18:10 | LL | } else { | __________^ @@ -18,7 +18,7 @@ LL ~ black_box(0); | error: redundant else block - --> tests/ui/redundant_else.rs:27:14 + --> tests/ui/redundant_else.rs:26:14 | LL | } else { | ______________^ @@ -35,7 +35,7 @@ LL ~ black_box(0); | error: redundant else block - --> tests/ui/redundant_else.rs:36:14 + --> tests/ui/redundant_else.rs:35:14 | LL | } else { | ______________^ @@ -52,7 +52,7 @@ LL ~ black_box(0); | error: redundant else block - --> tests/ui/redundant_else.rs:47:10 + --> tests/ui/redundant_else.rs:46:10 | LL | } else { | __________^ @@ -69,7 +69,7 @@ LL ~ black_box(0); | error: redundant else block - --> tests/ui/redundant_else.rs:55:14 + --> tests/ui/redundant_else.rs:54:14 | LL | } else { | ______________^ @@ -86,7 +86,7 @@ LL ~ black_box(0); | error: redundant else block - --> tests/ui/redundant_else.rs:61:14 + --> tests/ui/redundant_else.rs:60:14 | LL | } else { | ______________^ @@ -103,7 +103,7 @@ LL ~ black_box(0); | error: redundant else block - --> tests/ui/redundant_else.rs:72:10 + --> tests/ui/redundant_else.rs:71:10 | LL | } else { | __________^ @@ -120,7 +120,7 @@ LL ~ black_box(()); | error: redundant else block - --> tests/ui/redundant_else.rs:79:10 + --> tests/ui/redundant_else.rs:78:10 | LL | } else { | __________^ @@ -137,7 +137,7 @@ LL ~ black_box(0); | error: redundant else block - --> tests/ui/redundant_else.rs:86:10 + --> tests/ui/redundant_else.rs:85:10 | LL | } else { | __________^ @@ -154,7 +154,7 @@ LL ~ black_box(0i32); | error: redundant else block - --> tests/ui/redundant_else.rs:96:10 + --> tests/ui/redundant_else.rs:95:10 | LL | } else { | __________^ @@ -171,7 +171,7 @@ LL + black_box(0); | error: redundant else block - --> tests/ui/redundant_else.rs:103:10 + --> tests/ui/redundant_else.rs:102:10 | LL | } else { | __________^ @@ -190,7 +190,7 @@ LL + black_box(()); | error: redundant else block - --> tests/ui/redundant_else.rs:111:10 + --> tests/ui/redundant_else.rs:110:10 | LL | } else { | __________^ @@ -207,7 +207,7 @@ LL + { black_box(()) } | error: redundant else block - --> tests/ui/redundant_else.rs:118:10 + --> tests/ui/redundant_else.rs:117:10 | LL | } else { | __________^ @@ -228,7 +228,7 @@ LL + } | error: redundant else block - --> tests/ui/redundant_else.rs:127:10 + --> tests/ui/redundant_else.rs:126:10 | LL | } else { | __________^ @@ -250,7 +250,7 @@ LL + } | error: redundant else block - --> tests/ui/redundant_else.rs:138:10 + --> tests/ui/redundant_else.rs:137:10 | LL | } else { | __________^ @@ -275,7 +275,7 @@ LL + } | error: redundant else block - --> tests/ui/redundant_else.rs:151:10 + --> tests/ui/redundant_else.rs:150:10 | LL | } else { | __________^ @@ -298,7 +298,7 @@ LL + } | error: redundant else block - --> tests/ui/redundant_else.rs:162:10 + --> tests/ui/redundant_else.rs:161:10 | LL | } else { | __________^ @@ -321,7 +321,7 @@ LL + } | error: redundant else block - --> tests/ui/redundant_else.rs:173:10 + --> tests/ui/redundant_else.rs:172:10 | LL | } else { | __________^ @@ -344,7 +344,7 @@ LL + }; | error: redundant else block - --> tests/ui/redundant_else.rs:184:10 + --> tests/ui/redundant_else.rs:183:10 | LL | } else { | __________^ @@ -361,7 +361,7 @@ LL + black_box(1) | error: redundant else block - --> tests/ui/redundant_else.rs:197:10 + --> tests/ui/redundant_else.rs:196:10 | LL | } else { | __________^ @@ -378,7 +378,7 @@ LL ~ black_box(0); | error: redundant else block - --> tests/ui/redundant_else.rs:207:10 + --> tests/ui/redundant_else.rs:206:10 | LL | } else { | __________^ @@ -395,7 +395,7 @@ LL ~ black_box(0); | error: redundant else block - --> tests/ui/redundant_else.rs:223:14 + --> tests/ui/redundant_else.rs:222:14 | LL | } else { | ______________^ @@ -412,7 +412,7 @@ LL ~ black_box(0); | error: redundant else block - --> tests/ui/redundant_else.rs:236:10 + --> tests/ui/redundant_else.rs:235:10 | LL | } else { | __________^ @@ -429,7 +429,7 @@ LL ~ black_box(0); | error: redundant else block - --> tests/ui/redundant_else.rs:232:14 + --> tests/ui/redundant_else.rs:231:14 | LL | } else { | ______________^ @@ -446,7 +446,7 @@ LL + return; | error: redundant else block - --> tests/ui/redundant_else.rs:252:10 + --> tests/ui/redundant_else.rs:251:10 | LL | } else { | __________^ @@ -463,7 +463,7 @@ LL ~ black_box(0); | error: redundant else block - --> tests/ui/redundant_else.rs:290:10 + --> tests/ui/redundant_else.rs:289:10 | LL | } else { | __________^ @@ -480,7 +480,7 @@ LL ~ black_box(0); | error: redundant else block - --> tests/ui/redundant_else.rs:305:10 + --> tests/ui/redundant_else.rs:304:10 | LL | } else { | __________^ @@ -497,13 +497,13 @@ LL ~ black_box(0); | error: redundant else block - --> tests/ui/redundant_else.rs:326:42 + --> tests/ui/redundant_else.rs:325:42 | LL | if black_box(true) { return } else { black_box(0) } | ^^^^^^^^^^^^^^^^^^^^^^ help: remove the `else` block and move the contents out: `black_box(0)` error: redundant else block - --> tests/ui/redundant_else.rs:426:14 + --> tests/ui/redundant_else.rs:425:14 | LL | } else { | ______________^ @@ -521,7 +521,7 @@ LL + black_box(0); | error: redundant else block - --> tests/ui/redundant_else.rs:433:14 + --> tests/ui/redundant_else.rs:432:14 | LL | } else { | ______________^ @@ -539,7 +539,7 @@ LL + black_box(0); | error: redundant else block - --> tests/ui/redundant_else.rs:446:14 + --> tests/ui/redundant_else.rs:445:14 | LL | } else { | ______________^ @@ -557,7 +557,7 @@ LL + black_box(0); | error: redundant else block - --> tests/ui/redundant_else.rs:441:18 + --> tests/ui/redundant_else.rs:440:18 | LL | } else { | __________________^ @@ -577,7 +577,7 @@ LL + return | error: redundant else block - --> tests/ui/redundant_else.rs:459:14 + --> tests/ui/redundant_else.rs:458:14 | LL | } else { | ______________^ @@ -595,7 +595,7 @@ LL + black_box(0); | error: redundant else block - --> tests/ui/redundant_else.rs:473:14 + --> tests/ui/redundant_else.rs:472:14 | LL | } else { | ______________^ @@ -613,7 +613,7 @@ LL + inline!({ black_box(()); }); | error: redundant else block - --> tests/ui/redundant_else.rs:481:14 + --> tests/ui/redundant_else.rs:480:14 | LL | } else { | ______________^ 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 8453e57d43fba..d83ab1d9f05d9 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)] #![expect(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 2351fb6a2c4e6..a5052ecbb42cd 100644 --- a/src/tools/clippy/tests/ui/uninhabited_references.rs +++ b/src/tools/clippy/tests/ui/uninhabited_references.rs @@ -1,5 +1,4 @@ #![warn(clippy::uninhabited_references)] -#![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 0d29816fc51d9..a76782086d8bc 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:4:23 + --> tests/ui/uninhabited_references.rs:3: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:11:30 + --> tests/ui/uninhabited_references.rs:10: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:13:14 + --> tests/ui/uninhabited_references.rs:12: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:24:13 + --> tests/ui/uninhabited_references.rs:23:13 | LL | let _ = *x; | ^^ diff --git a/src/tools/clippy/tests/ui/unused_unit.edition2021.fixed b/src/tools/clippy/tests/ui/unused_unit.edition2021.fixed index b6e3753d9ee4d..37c50cd78a94c 100644 --- a/src/tools/clippy/tests/ui/unused_unit.edition2021.fixed +++ b/src/tools/clippy/tests/ui/unused_unit.edition2021.fixed @@ -126,7 +126,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 a6b9fa70d6cf8..8a1ab2ef65813 100644 --- a/src/tools/clippy/tests/ui/unused_unit.edition2021.stderr +++ b/src/tools/clippy/tests/ui/unused_unit.edition2021.stderr @@ -116,7 +116,7 @@ LL | fn test3()-> (){} | ^^^^^ help: remove the `-> ()` error: unneeded unit return type - --> tests/ui/unused_unit.rs:130:13 + --> tests/ui/unused_unit.rs:129: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 f389b833310a1..5e77094cc0c81 100644 --- a/src/tools/clippy/tests/ui/unused_unit.edition2024.fixed +++ b/src/tools/clippy/tests/ui/unused_unit.edition2024.fixed @@ -126,7 +126,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 b70d7bf18ac84..156f038cbedf5 100644 --- a/src/tools/clippy/tests/ui/unused_unit.rs +++ b/src/tools/clippy/tests/ui/unused_unit.rs @@ -126,7 +126,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/unwrap_expect_used.rs b/src/tools/clippy/tests/ui/unwrap_expect_used.rs index ef638bf0e9c9a..3fb1c8d838106 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::expect_used, clippy::unwrap_used)] #![expect(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.fixed b/src/tools/clippy/tests/ui/zero_repeat_side_effects.fixed index 27adfadcf19a0..b05d4b85ee780 100644 --- a/src/tools/clippy/tests/ui/zero_repeat_side_effects.fixed +++ b/src/tools/clippy/tests/ui/zero_repeat_side_effects.fixed @@ -149,3 +149,11 @@ fn issue_15824() { _ => {}, } } + +#[allow(clippy::diverging_sub_expression)] // only fires *before* the fix +fn diverging() { + // Used to not be fixable when `!` wasn't stable yet and thus not nameable + panic!(); + let _data: [!; 0] = []; + //~^ zero_repeat_side_effects +} diff --git a/src/tools/clippy/tests/ui/zero_repeat_side_effects.rs b/src/tools/clippy/tests/ui/zero_repeat_side_effects.rs index 292387bb36e88..479cf20cff55e 100644 --- a/src/tools/clippy/tests/ui/zero_repeat_side_effects.rs +++ b/src/tools/clippy/tests/ui/zero_repeat_side_effects.rs @@ -126,3 +126,10 @@ fn issue_15824() { _ => {}, } } + +#[allow(clippy::diverging_sub_expression)] // only fires *before* the fix +fn diverging() { + // Used to not be fixable when `!` wasn't stable yet and thus not nameable + let _data = [panic!(); 0]; + //~^ zero_repeat_side_effects +} diff --git a/src/tools/clippy/tests/ui/zero_repeat_side_effects.stderr b/src/tools/clippy/tests/ui/zero_repeat_side_effects.stderr index 5560f4855c75c..276f1cdae6be2 100644 --- a/src/tools/clippy/tests/ui/zero_repeat_side_effects.stderr +++ b/src/tools/clippy/tests/ui/zero_repeat_side_effects.stderr @@ -166,5 +166,17 @@ LL + a = [] as [(); 0] LL ~ }, | -error: aborting due to 13 previous errors +error: expression with side effects as the initial value in a zero-sized array initializer + --> tests/ui/zero_repeat_side_effects.rs:133:5 + | +LL | let _data = [panic!(); 0]; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider performing the side effect separately + | +LL ~ panic!(); +LL + let _data: [!; 0] = []; + | + +error: aborting due to 14 previous errors 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.rs b/src/tools/clippy/tests/ui/zero_repeat_side_effects_unfixable.rs index 82f0884056ab0..834b8640cad05 100644 --- a/src/tools/clippy/tests/ui/zero_repeat_side_effects_unfixable.rs +++ b/src/tools/clippy/tests/ui/zero_repeat_side_effects_unfixable.rs @@ -1,13 +1,8 @@ //@no-rustfix #![warn(clippy::zero_repeat_side_effects)] -#![expect(clippy::diverging_sub_expression)] fn issue_14998() { // unnameable types, don't suggest let _data = [|| 3i32; 0]; //~^ zero_repeat_side_effects - - // unnameable type because `never_type` is not enabled, don't suggest - let _data = [panic!(); 0]; - //~^ zero_repeat_side_effects } 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..24cba6e3932fe 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 @@ -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_unfixable.rs:7:5 + --> tests/ui/zero_repeat_side_effects_unfixable.rs:6:5 | LL | let _data = [|| 3i32; 0]; | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -8,13 +8,5 @@ LL | let _data = [|| 3i32; 0]; = note: `-D clippy::zero-repeat-side-effects` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::zero_repeat_side_effects)]` -error: expression with side effects as the initial value in a zero-sized array initializer - --> tests/ui/zero_repeat_side_effects_unfixable.rs:11:5 - | -LL | let _data = [panic!(); 0]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: consider performing the side effect separately - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error diff --git a/src/tools/miri/src/lib.rs b/src/tools/miri/src/lib.rs index a2b6108882df3..4cd7475f62915 100644 --- a/src/tools/miri/src/lib.rs +++ b/src/tools/miri/src/lib.rs @@ -14,7 +14,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 25e21375cd746..1f8fc6a2ce334 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 5411ee889054e..9ea2b4d2f3f77 100644 --- a/src/tools/miri/tests/pass/coroutine.rs +++ b/src/tools/miri/tests/pass/coroutine.rs @@ -1,7 +1,7 @@ //@revisions: stack tree tree_implicit_writes //@[tree_implicit_writes]compile-flags: -Zmiri-tree-borrows -Zmiri-tree-borrows-implicit-writes //@[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 56c45eb29a0bf..2f04d2c231790 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; 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/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/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/eq_never_type.rs b/tests/mir-opt/building/eq_never_type.rs index 762f20ee1e104..b805904b4f379 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/building/fallible_struct_drop.build.ElaborateDrops.diff b/tests/mir-opt/building/fallible_struct_drop.build.ElaborateDrops.diff index b0db5ea383919..b6085e6c9b23b 100644 --- a/tests/mir-opt/building/fallible_struct_drop.build.ElaborateDrops.diff +++ b/tests/mir-opt/building/fallible_struct_drop.build.ElaborateDrops.diff @@ -6,54 +6,54 @@ let mut _0: std::result::Result; let mut _2: Big; let mut _3: std::string::String; - let mut _4: std::ops::ControlFlow, std::string::String>; + let mut _4: std::ops::ControlFlow, std::string::String>; let mut _5: std::result::Result; let mut _6: u64; let mut _7: u64; let mut _8: isize; - let _9: std::result::Result; + let _9: std::result::Result; let mut _10: !; - let mut _11: std::result::Result; + let mut _11: std::result::Result; let _12: std::string::String; let mut _13: std::string::String; - let mut _14: std::ops::ControlFlow, std::string::String>; + let mut _14: std::ops::ControlFlow, std::string::String>; let mut _15: std::result::Result; let mut _16: u64; let mut _17: u64; let mut _18: isize; - let _19: std::result::Result; + let _19: std::result::Result; let mut _20: !; - let mut _21: std::result::Result; + let mut _21: std::result::Result; let _22: std::string::String; let mut _23: std::string::String; - let mut _24: std::ops::ControlFlow, std::string::String>; + let mut _24: std::ops::ControlFlow, std::string::String>; let mut _25: std::result::Result; let mut _26: u64; let mut _27: u64; let mut _28: isize; - let _29: std::result::Result; + let _29: std::result::Result; let mut _30: !; - let mut _31: std::result::Result; + let mut _31: std::result::Result; let _32: std::string::String; let mut _33: std::string::String; - let mut _34: std::ops::ControlFlow, std::string::String>; + let mut _34: std::ops::ControlFlow, std::string::String>; let mut _35: std::result::Result; let mut _36: u64; let mut _37: u64; let mut _38: isize; - let _39: std::result::Result; + let _39: std::result::Result; let mut _40: !; - let mut _41: std::result::Result; + let mut _41: std::result::Result; let _42: std::string::String; let mut _43: std::string::String; - let mut _44: std::ops::ControlFlow, std::string::String>; + let mut _44: std::ops::ControlFlow, std::string::String>; let mut _45: std::result::Result; let mut _46: u64; let mut _47: u64; let mut _48: isize; - let _49: std::result::Result; + let _49: std::result::Result; let mut _50: !; - let mut _51: std::result::Result; + let mut _51: std::result::Result; let _52: std::string::String; + let mut _53: bool; + let mut _54: bool; @@ -154,10 +154,10 @@ bb5: { StorageLive(_9); - _9 = copy ((_4 as Break).0: std::result::Result); + _9 = copy ((_4 as Break).0: std::result::Result); StorageLive(_11); _11 = copy _9; - _0 = as FromResidual>>::from_residual(move _11) -> [return: bb6, unwind: bb90]; + _0 = as FromResidual>>::from_residual(move _11) -> [return: bb6, unwind: bb90]; } bb6: { @@ -204,10 +204,10 @@ bb11: { StorageLive(_19); - _19 = copy ((_14 as Break).0: std::result::Result); + _19 = copy ((_14 as Break).0: std::result::Result); StorageLive(_21); _21 = copy _19; - _0 = as FromResidual>>::from_residual(move _21) -> [return: bb12, unwind: bb86]; + _0 = as FromResidual>>::from_residual(move _21) -> [return: bb12, unwind: bb86]; } bb12: { @@ -253,10 +253,10 @@ bb17: { StorageLive(_29); - _29 = copy ((_24 as Break).0: std::result::Result); + _29 = copy ((_24 as Break).0: std::result::Result); StorageLive(_31); _31 = copy _29; - _0 = as FromResidual>>::from_residual(move _31) -> [return: bb18, unwind: bb81]; + _0 = as FromResidual>>::from_residual(move _31) -> [return: bb18, unwind: bb81]; } bb18: { @@ -302,10 +302,10 @@ bb23: { StorageLive(_39); - _39 = copy ((_34 as Break).0: std::result::Result); + _39 = copy ((_34 as Break).0: std::result::Result); StorageLive(_41); _41 = copy _39; - _0 = as FromResidual>>::from_residual(move _41) -> [return: bb24, unwind: bb75]; + _0 = as FromResidual>>::from_residual(move _41) -> [return: bb24, unwind: bb75]; } bb24: { @@ -350,10 +350,10 @@ bb29: { StorageLive(_49); - _49 = copy ((_44 as Break).0: std::result::Result); + _49 = copy ((_44 as Break).0: std::result::Result); StorageLive(_51); _51 = copy _49; - _0 = as FromResidual>>::from_residual(move _51) -> [return: bb30, unwind: bb68]; + _0 = as FromResidual>>::from_residual(move _51) -> [return: bb30, unwind: bb68]; } bb30: { 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 70f602aa236e8..de33a7ebeac3e 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") -> [return: bb2, unwind: bb8]; + _3 = std::rt::begin_panic::<&str>(const "explicit panic") -> [return: bb2, unwind: 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/coroutine_tiny.main-{closure#0}.StateTransform.diff b/tests/mir-opt/coroutine/coroutine_tiny.main-{closure#0}.StateTransform.diff index b84e55cac4616..dc8d51f618dbd 100644 --- a/tests/mir-opt/coroutine/coroutine_tiny.main-{closure#0}.StateTransform.diff +++ b/tests/mir-opt/coroutine/coroutine_tiny.main-{closure#0}.StateTransform.diff @@ -1,10 +1,10 @@ - // MIR for `main::{closure#0}` before StateTransform + // MIR for `main::{closure#0}` after StateTransform -- fn main::{closure#0}(_1: {coroutine@$DIR/coroutine_tiny.rs:20:5: 20:13}, _2: u8) -> () +- fn main::{closure#0}(_1: {coroutine@$DIR/coroutine_tiny.rs:20:5: 20:13}, _2: u8) -> ! - yields () - { -+ fn main::{closure#0}(_1: Pin<&mut {coroutine@$DIR/coroutine_tiny.rs:20:5: 20:13}>, _2: u8) -> CoroutineState<(), ()> { ++ fn main::{closure#0}(_1: Pin<&mut {coroutine@$DIR/coroutine_tiny.rs:20:5: 20:13}>, _2: u8) -> CoroutineState<(), !> { + coroutine layout { + field _s0: HasDrop; + variant_fields = { @@ -16,68 +16,63 @@ + storage_conflicts = BitMatrix(1x1) {(_s0, _s0)} + } debug _x => _2; -- let mut _0: (); +- let mut _0: !; + coroutine debug _d => _s0; -+ 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:20:5: 20: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:20:5: 20:13}; scope 1 { - debug _d => _3; -+ debug _d => (((*_11) as variant#3).0: HasDrop); ++ debug _d => (((*_10) as variant#3).0: HasDrop); } bb0: { - StorageLive(_3); - _3 = HasDrop; -- StorageLive(_4); - goto -> bb1; -+ _11 = copy (_1.0: &mut {coroutine@$DIR/coroutine_tiny.rs:20:5: 20:13}); -+ _10 = discriminant((*_11)); -+ switchInt(move _10) -> [0: bb6, 3: bb4, otherwise: bb5]; ++ _10 = copy (_1.0: &mut {coroutine@$DIR/coroutine_tiny.rs:20:5: 20:13}); ++ _9 = discriminant((*_10)); ++ switchInt(move _9) -> [0: bb6, 3: bb4, otherwise: bb5]; } bb1: { + StorageLive(_5); StorageLive(_6); - StorageLive(_7); - _7 = (); -- _6 = yield(move _7) -> [resume: bb2, drop: bb4]; -+ _0 = CoroutineState::<(), ()>::Yielded(move _7); -+ StorageDead(_4); + _6 = (); +- _5 = yield(move _6) -> [resume: bb2, drop: bb4]; ++ _0 = CoroutineState::<(), !>::Yielded(move _6); ++ StorageDead(_5); + StorageDead(_6); -+ StorageDead(_7); -+ discriminant((*_11)) = 3; ++ discriminant((*_10)) = 3; + return; } bb2: { - StorageDead(_7); StorageDead(_6); - StorageLive(_8); - _8 = callee() -> [return: bb3, unwind unreachable]; + StorageDead(_5); + StorageLive(_7); + _7 = callee() -> [return: bb3, unwind unreachable]; } bb3: { - StorageDead(_8); - _5 = const (); + StorageDead(_7); + _4 = const (); goto -> bb1; } bb4: { -- StorageDead(_7); - StorageDead(_6); -- StorageDead(_4); +- StorageDead(_5); - drop(_3) -> [return: bb5, unwind unreachable]; -+ StorageLive(_4); ++ StorageLive(_5); + StorageLive(_6); -+ StorageLive(_7); -+ _6 = move _2; ++ _5 = move _2; + goto -> bb2; } @@ -90,8 +85,7 @@ bb6: { - coroutine_drop; + nop; -+ (((*_11) as variant#3).0: HasDrop) = HasDrop; -+ StorageLive(_4); ++ (((*_10) as variant#3).0: HasDrop) = HasDrop; + goto -> bb1; } } diff --git a/tests/mir-opt/gvn_uninhabited.rs b/tests/mir-opt/gvn_uninhabited.rs index 78afc0efef900..106d7862471a5 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/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 977d48d6d25f0..07763e0e176ec 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/issue_72181_1.rs b/tests/mir-opt/issue_72181_1.rs index 1e7c70c449d98..c20ae49c75bb0 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/jump_threading.identity.JumpThreading.panic-abort.diff b/tests/mir-opt/jump_threading.identity.JumpThreading.panic-abort.diff index ec4a93c9a4e17..a822ca20a8e80 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 { @@ -70,7 +70,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); @@ -109,8 +109,8 @@ StorageLive(_12); _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); StorageDead(_12); - goto -> bb5; @@ -120,7 +120,7 @@ bb7: { StorageLive(_11); _11 = move ((_4 as Ok).0: i32); - _3 = ControlFlow::, i32>::Continue(copy _11); + _3 = ControlFlow::, i32>::Continue(copy _11); StorageDead(_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 ec4a93c9a4e17..a822ca20a8e80 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 { @@ -70,7 +70,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); @@ -109,8 +109,8 @@ StorageLive(_12); _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); StorageDead(_12); - goto -> bb5; @@ -120,7 +120,7 @@ bb7: { StorageLive(_11); _11 = move ((_4 as Ok).0: i32); - _3 = ControlFlow::, i32>::Continue(copy _11); + _3 = ControlFlow::, i32>::Continue(copy _11); StorageDead(_11); - goto -> bb5; + goto -> bb9; diff --git a/tests/mir-opt/jump_threading.rs b/tests/mir-opt/jump_threading.rs index e4942a5c173fd..b480bc097b99f 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.runtime-optimized.after.panic-abort.mir b/tests/mir-opt/pre-codegen/option_bubble_debug.option_traits.runtime-optimized.after.panic-abort.mir index 26ccbb7d89fd1..5a9f8b2cc466b 100644 --- a/tests/mir-opt/pre-codegen/option_bubble_debug.option_traits.runtime-optimized.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/option_bubble_debug.option_traits.runtime-optimized.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.runtime-optimized.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/option_bubble_debug.option_traits.runtime-optimized.after.panic-unwind.mir index c9cb25b647ef5..8d272ac3485f1 100644 --- a/tests/mir-opt/pre-codegen/option_bubble_debug.option_traits.runtime-optimized.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/option_bubble_debug.option_traits.runtime-optimized.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.runtime-optimized.after.mir b/tests/mir-opt/pre-codegen/simple_option_map.map_via_question_mark.runtime-optimized.after.mir index 26648a3173d67..3c559614e9863 100644 --- a/tests/mir-opt/pre-codegen/simple_option_map.map_via_question_mark.runtime-optimized.after.mir +++ b/tests/mir-opt/pre-codegen/simple_option_map.map_via_question_mark.runtime-optimized.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; } @@ -54,7 +54,7 @@ fn map_via_question_mark(_1: Option) -> Option { bb2: { StorageLive(_6); _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 8f3ea6f0ae280..42d42bac835dd 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/remove_never_const.rs b/tests/mir-opt/remove_never_const.rs index ab7f369e68029..4c5470f568125 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/separate_const_switch.identity.JumpThreading.diff b/tests/mir-opt/separate_const_switch.identity.JumpThreading.diff index 5bc79f76b3706..be29296044837 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 { @@ -58,7 +58,7 @@ bb3: { StorageLive(_4); - _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); @@ -85,8 +85,8 @@ StorageLive(_8); _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); StorageDead(_8); - goto -> bb4; @@ -96,7 +96,7 @@ bb6: { StorageLive(_7); _7 = copy ((_1 as Ok).0: i32); - _2 = ControlFlow::, i32>::Continue(copy _7); + _2 = ControlFlow::, i32>::Continue(copy _7); StorageDead(_7); - goto -> bb4; + goto -> bb8; diff --git a/tests/mir-opt/ssa_unreachable_116212.rs b/tests/mir-opt/ssa_unreachable_116212.rs index f8550556f54d0..14a2195275f7b 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.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: { diff --git a/tests/mir-opt/uninhabited_enum.rs b/tests/mir-opt/uninhabited_enum.rs index 2ef76449e3cc3..4dc05eb8edd99 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 c1598d0301f67..526849cfc612e 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/blanket_impls.rs b/tests/rustdoc-json/blanket_impls.rs index 2def2c2c5a956..e15848cdaddbb 100644 --- a/tests/rustdoc-json/blanket_impls.rs +++ b/tests/rustdoc-json/blanket_impls.rs @@ -3,5 +3,5 @@ #![no_std] //@ jq_is '[.index[] | select(.name == "Error").inner | has("assoc_type")]' '[true, true]' -//@ jq_has '.index[] | select(.name == "Error").inner.assoc_type.type.resolved_path.path' '"Infallible"' +//@ jq_has '.index[] | select(.name == "Error").inner.assoc_type.type.primitive' '"never"' pub struct ForBlanketTryFromImpl; 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-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.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/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-closures/wrong-suggestion-result.stderr b/tests/ui/async-await/async-closures/wrong-suggestion-result.stderr index 7070205801667..dc916165c0fd2 100644 --- a/tests/ui/async-await/async-closures/wrong-suggestion-result.stderr +++ b/tests/ui/async-await/async-closures/wrong-suggestion-result.stderr @@ -11,8 +11,8 @@ LL | | } | help: consider restricting type parameter `O` with unstable trait `FromResidual` | -LL | async fn once>, F: AsyncFnOnce() -> O>(f: F) -> O { - | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +LL | async fn once>, F: AsyncFnOnce() -> O>(f: F) -> O { + | ++++++++++++++++++++++++++++++++++++++++++++++++++++ error[E0308]: mismatched types --> $DIR/wrong-suggestion-result.rs:7:5 @@ -41,8 +41,8 @@ LL | | } | help: consider restricting type parameter `O` with unstable trait `FromResidual` | -LL | async fn fnref>, F: AsyncFn() -> O>(f: F) -> O { - | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +LL | async fn fnref>, F: AsyncFn() -> O>(f: F) -> O { + | ++++++++++++++++++++++++++++++++++++++++++++++++++++ error[E0308]: mismatched types --> $DIR/wrong-suggestion-result.rs:15:5 @@ -71,8 +71,8 @@ LL | | } | help: consider restricting type parameter `O` with unstable trait `FromResidual` | -LL | async fn fnmut>, F: AsyncFnMut() -> O>(f: F) -> O { - | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +LL | async fn fnmut>, F: AsyncFnMut() -> O>(f: F) -> O { + | ++++++++++++++++++++++++++++++++++++++++++++++++++++ error[E0308]: mismatched types --> $DIR/wrong-suggestion-result.rs:24:5 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/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/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.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/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.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/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/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.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.nofallback.stderr b/tests/ui/coercion/coerce-issue-49593-box-never.nofallback.stderr deleted file mode 100644 index b1c4b067305f4..0000000000000 --- a/tests/ui/coercion/coerce-issue-49593-box-never.nofallback.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:17: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:23:5 - | -LL | raw_ptr_box::<_ /* ! */>(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 751450a7fb435..e2ae8a784bcff 100644 --- a/tests/ui/coercion/coerce-issue-49593-box-never.rs +++ b/tests/ui/coercion/coerce-issue-49593-box-never.rs @@ -6,16 +6,11 @@ // 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 -// unit. +// On edition <= 2021 this used to fail because of never type fallback to unit. // -//@ revisions: e2021 e2024 -//@[e2021] edition: 2021 -//@[e2024] edition: 2024 +//@ edition: 2021..2024 // -//@[e2024] check-pass - -#![feature(never_type)] +//@ check-pass use std::error::Error; use std::mem; @@ -26,12 +21,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/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/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.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/const-generics/min_const_generics/complex-types.stderr b/tests/ui/const-generics/min_const_generics/complex-types.stderr index 3233da6382381..a9d8b31f8457f 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(min_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(min_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(min_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(min_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.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/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.rs b/tests/ui/consts/const-eval/index-out-of-bounds-never-type.rs index 6777bee050a16..d4e18cfff6729 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 @@ // Regression test for #66975 #![warn(unconditional_panic)] -#![feature(never_type)] struct PrintName(T); 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.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-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.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/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/raw-bytes.rs b/tests/ui/consts/const-eval/raw-bytes.rs index f4e427baeab2c..c682a17b8decf 100644 --- a/tests/ui/consts/const-eval/raw-bytes.rs +++ b/tests/ui/consts/const-eval/raw-bytes.rs @@ -4,8 +4,8 @@ // ignore-tidy-file-linelength #![allow(invalid_value, unnecessary_transmutes)] -#![feature(never_type, rustc_attrs, ptr_metadata, slice_from_ptr_range, const_slice_from_ptr_range)] #![feature(pattern_types, pattern_type_macro)] +#![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 cea8b6b6403c4..f8a2186b307dc 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 -#![feature(never_type)] #![allow(invalid_value, unnecessary_transmutes)] use std::mem; diff --git a/tests/ui/consts/const-eval/ub-enum.stderr b/tests/ui/consts/const-eval/ub-enum.stderr index 2fbc115fe4f6e..8f0b90dcfca75 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 ALLOC$ID[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.rs b/tests/ui/consts/const-eval/ub-uninhabit.rs index 0bd2e196d14e7..fc97640d3440d 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-eval/ub-uninhabit.stderr b/tests/ui/consts/const-eval/ub-uninhabit.stderr index 59c7e95adc7f7..a1bf930651dba 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 zero-variant enum `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,19 +16,19 @@ 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 zero-variant enum `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 error[E0080]: constructing invalid value of type &&!: encountered a reference pointing to uninhabited type `&!` - --> $DIR/ub-uninhabit.rs:36:1 + --> $DIR/ub-uninhabit.rs:35:1 | LL | const BAD_NESTED_REF: &&! = unsafe { mem::transmute(&&0) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^ it is undefined behavior to use this value @@ -39,7 +39,7 @@ LL | const BAD_NESTED_REF: &&! = unsafe { mem::transmute(&&0) }; } error[E0080]: constructing invalid value of type &&(!, [i32]): encountered a reference pointing to uninhabited type `&(!, [i32])` - --> $DIR/ub-uninhabit.rs:39:1 + --> $DIR/ub-uninhabit.rs:38:1 | LL | const BAD_NESTED_UNSIZED_REF: &&(!, [i32]) = unsafe { mem::transmute(&(&[0] as &[i32])) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ it is undefined behavior to use this value @@ -50,7 +50,7 @@ LL | const BAD_NESTED_UNSIZED_REF: &&(!, [i32]) = unsafe { mem::transmute(&(&[0] } error[E0080]: constructing invalid value of type &[!]: at .[0], encountered a value of the never type `!` - --> $DIR/ub-uninhabit.rs:42:1 + --> $DIR/ub-uninhabit.rs:41:1 | LL | const BAD_UNINHABITED_SLICE: &[!] = unsafe { mem::transmute(&[()] as &[()]) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ it is undefined behavior to use this value @@ -61,13 +61,13 @@ LL | const BAD_UNINHABITED_SLICE: &[!] = unsafe { mem::transmute(&[()] as &[()]) } error[E0080]: constructing invalid value of type Wrap>: at .0.0, encountered a value of the never type `!` - --> $DIR/ub-uninhabit.rs:47:47 + --> $DIR/ub-uninhabit.rs:46:47 | LL | const WRAPPED_TWICE: Wrap> = unsafe { mem::transmute(()) }; | ^^^^^^^^^^^^^^^^^^ evaluation of `WRAPPED_TWICE` failed here error[E0080]: constructing invalid value of type &Wrap>: encountered a reference pointing to uninhabited type `Wrap>` - --> $DIR/ub-uninhabit.rs:49:1 + --> $DIR/ub-uninhabit.rs:48:1 | LL | const WRAPPED_TWICE_REF: &Wrap> = unsafe { mem::transmute(&()) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ it is undefined behavior to use this value 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/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/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/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.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/consts/validate_never_arrays.stderr b/tests/ui/consts/validate_never_arrays.stderr index a006c19587f50..6b1917fb74324 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/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/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..b587da895ff26 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,)` implements `From<[T; 1]>` + `(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]>` + 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 a88bb52738e9f..b587da895ff26 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.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-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/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/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/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/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/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..dc566ad50153a 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,16 @@ -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 + | +help: `!` can be coerced to any type; consider casting it to a concrete type that implements the trait + | +LL | todo!() as /* Type */ + | +++++++++++++ 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/return-never-type.rs b/tests/ui/impl-trait/return-never-type.rs index 97ad2756dce71..be34775411290 100644 --- a/tests/ui/impl-trait/return-never-type.rs +++ b/tests/ui/impl-trait/return-never-type.rs @@ -1,7 +1,5 @@ //@ edition:2024 -#![feature(never_type)] - use std::ops::Add; fn foo() -> impl Add { diff --git a/tests/ui/impl-trait/return-never-type.stderr b/tests/ui/impl-trait/return-never-type.stderr index dff06d7f41c98..4a39994a74045 100644 --- a/tests/ui/impl-trait/return-never-type.stderr +++ b/tests/ui/impl-trait/return-never-type.stderr @@ -1,5 +1,5 @@ error[E0277]: cannot add `u32` to `!` - --> $DIR/return-never-type.rs:7:13 + --> $DIR/return-never-type.rs:5:13 | LL | fn foo() -> impl Add { | ^^^^^^^^^^^^^ no implementation for `! + u32` 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/intrinsics/panic-uninitialized-zeroed.rs b/tests/ui/intrinsics/panic-uninitialized-zeroed.rs index a54c367a0d58c..e2f251f77e4a9 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 7e0dcd078ac9d..2ea2aa5ad9fd0 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_dump_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 90d45f6226f48..d9a92ae89b403 100644 --- a/tests/ui/layout/enum-scalar-pair-int-ptr.rs +++ b/tests/ui/layout/enum-scalar-pair-int-ptr.rs @@ -6,7 +6,6 @@ //! Enum layout tests related to scalar pairs with an int/ptr common primitive. #![feature(rustc_attrs)] -#![feature(never_type)] #![crate_type = "lib"] #[rustc_dump_layout(backend_repr)] diff --git a/tests/ui/layout/enum-scalar-pair-int-ptr.stderr b/tests/ui/layout/enum-scalar-pair-int-ptr.stderr index 6df64bbbf5a08..a0161a0d58305 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: backend_repr: ScalarPair { a: u?? is 0..=1, b: pointer is $VALID_RANGE, b_offset: Size(? bytes) } - --> $DIR/enum-scalar-pair-int-ptr.rs:13:1 + --> $DIR/enum-scalar-pair-int-ptr.rs:12:1 | LL | enum ScalarPairPointerWithInt { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: backend_repr: Memory { sized: true } - --> $DIR/enum-scalar-pair-int-ptr.rs:22:1 + --> $DIR/enum-scalar-pair-int-ptr.rs:21:1 | LL | enum NotScalarPairPointerWithSmallerInt { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/layout/enum-signedness.rs b/tests/ui/layout/enum-signedness.rs index c40955d39ef27..fa9ca7875a87d 100644 --- a/tests/ui/layout/enum-signedness.rs +++ b/tests/ui/layout/enum-signedness.rs @@ -1,6 +1,5 @@ //@ only-64bit #![feature(rustc_attrs)] -#![feature(never_type)] #![crate_type = "lib"] // When picking a representation for things that don't force a particular discriminant type, diff --git a/tests/ui/layout/enum-signedness.stderr b/tests/ui/layout/enum-signedness.stderr index 3e2b9fa69971f..1b994e0e9af69 100644 --- a/tests/ui/layout/enum-signedness.stderr +++ b/tests/ui/layout/enum-signedness.stderr @@ -1,5 +1,5 @@ warning: `repr(C)` enum discriminant does not fit into C `int` nor into C `unsigned int` - --> $DIR/enum-signedness.rs:88:5 + --> $DIR/enum-signedness.rs:87:5 | LL | A = i64::MIN as isize, | ^ @@ -11,7 +11,7 @@ LL | A = i64::MIN as isize, = note: `#[warn(repr_c_enums_larger_than_int)]` (part of `#[warn(future_incompatible)]`) on by default warning: `repr(C)` enum discriminant does not fit into C `int` nor into C `unsigned int` - --> $DIR/enum-signedness.rs:91:5 + --> $DIR/enum-signedness.rs:90:5 | LL | B = i64::MIN as isize + 1, | ^ @@ -22,7 +22,7 @@ LL | B = i64::MIN as isize + 1, = note: for more information, see issue #124403 warning: `repr(C)` enum discriminant does not fit into C `int` nor into C `unsigned int` - --> $DIR/enum-signedness.rs:108:5 + --> $DIR/enum-signedness.rs:107:5 | LL | A = i64::MAX as isize - 1, | ^ @@ -33,7 +33,7 @@ LL | A = i64::MAX as isize - 1, = note: for more information, see issue #124403 warning: `repr(C)` enum discriminant does not fit into C `int` nor into C `unsigned int` - --> $DIR/enum-signedness.rs:111:5 + --> $DIR/enum-signedness.rs:110:5 | LL | B = i64::MAX as isize, | ^ @@ -44,73 +44,73 @@ LL | B = i64::MAX as isize, = note: for more information, see issue #124403 error: largest_niche: Some(Niche { offset: Size(0 bytes), value: i8, valid_range: 155..=156 }) - --> $DIR/enum-signedness.rs:14:1 + --> $DIR/enum-signedness.rs:13:1 | LL | enum NegativeByteRust { | ^^^^^^^^^^^^^^^^^^^^^ error: largest_niche: Some(Niche { offset: Size(0 bytes), value: i32, valid_range: 4294967195..=4294967196 }) - --> $DIR/enum-signedness.rs:22:1 + --> $DIR/enum-signedness.rs:21:1 | LL | enum NegativeByteC { | ^^^^^^^^^^^^^^^^^^ error: largest_niche: Some(Niche { offset: Size(0 bytes), value: u8, valid_range: 155..=156 }) - --> $DIR/enum-signedness.rs:30:1 + --> $DIR/enum-signedness.rs:29:1 | LL | enum PositiveByteRust { | ^^^^^^^^^^^^^^^^^^^^^ error: largest_niche: Some(Niche { offset: Size(0 bytes), value: u32, valid_range: 155..=156 }) - --> $DIR/enum-signedness.rs:38:1 + --> $DIR/enum-signedness.rs:37:1 | LL | enum PositiveByteC { | ^^^^^^^^^^^^^^^^^^ error: largest_niche: Some(Niche { offset: Size(0 bytes), value: i32, valid_range: 0..=2147483648 }) - --> $DIR/enum-signedness.rs:46:1 + --> $DIR/enum-signedness.rs:45:1 | LL | enum Negative32BitRust { | ^^^^^^^^^^^^^^^^^^^^^^ error: largest_niche: Some(Niche { offset: Size(0 bytes), value: i32, valid_range: 0..=2147483648 }) - --> $DIR/enum-signedness.rs:54:1 + --> $DIR/enum-signedness.rs:53:1 | LL | enum Negative32BitC { | ^^^^^^^^^^^^^^^^^^^ error: largest_niche: Some(Niche { offset: Size(0 bytes), value: u32, valid_range: 0..=2147483648 }) - --> $DIR/enum-signedness.rs:62:1 + --> $DIR/enum-signedness.rs:61:1 | LL | enum Positive32BitRust { | ^^^^^^^^^^^^^^^^^^^^^^ error: largest_niche: Some(Niche { offset: Size(0 bytes), value: u32, valid_range: 0..=2147483648 }) - --> $DIR/enum-signedness.rs:70:1 + --> $DIR/enum-signedness.rs:69:1 | LL | enum Positive32BitC { | ^^^^^^^^^^^^^^^^^^^ error: largest_niche: Some(Niche { offset: Size(0 bytes), value: i64, valid_range: 9223372036854775808..=9223372036854775809 }) - --> $DIR/enum-signedness.rs:78:1 + --> $DIR/enum-signedness.rs:77:1 | LL | enum Negative64BitRust { | ^^^^^^^^^^^^^^^^^^^^^^ error: largest_niche: Some(Niche { offset: Size(0 bytes), value: i64, valid_range: 9223372036854775808..=9223372036854775809 }) - --> $DIR/enum-signedness.rs:86:1 + --> $DIR/enum-signedness.rs:85:1 | LL | enum Negative64BitC { | ^^^^^^^^^^^^^^^^^^^ error: largest_niche: Some(Niche { offset: Size(0 bytes), value: u64, valid_range: 9223372036854775806..=9223372036854775807 }) - --> $DIR/enum-signedness.rs:98:1 + --> $DIR/enum-signedness.rs:97:1 | LL | enum Positive64BitRust { | ^^^^^^^^^^^^^^^^^^^^^^ error: largest_niche: Some(Niche { offset: Size(0 bytes), value: u64, valid_range: 9223372036854775806..=9223372036854775807 }) - --> $DIR/enum-signedness.rs:106:1 + --> $DIR/enum-signedness.rs:105:1 | LL | enum Positive64BitC { | ^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/layout/enum-unusual-variants.rs b/tests/ui/layout/enum-unusual-variants.rs index a79ae0e1f32cc..c98595deefb0f 100644 --- a/tests/ui/layout/enum-unusual-variants.rs +++ b/tests/ui/layout/enum-unusual-variants.rs @@ -1,5 +1,4 @@ #![feature(rustc_attrs)] -#![feature(never_type)] #![crate_type = "lib"] // Regression test for https://github.com/rust-lang/rust/issues/159438 diff --git a/tests/ui/layout/enum-unusual-variants.stderr b/tests/ui/layout/enum-unusual-variants.stderr index 4eabd903a0337..9f30b3212cc1b 100644 --- a/tests/ui/layout/enum-unusual-variants.stderr +++ b/tests/ui/layout/enum-unusual-variants.stderr @@ -1,41 +1,41 @@ error: largest_niche: Some(Niche { offset: Size(0 bytes), value: u8, valid_range: 0..=127 }) - --> $DIR/enum-unusual-variants.rs:9:1 + --> $DIR/enum-unusual-variants.rs:8:1 | LL | enum With128Variants { | ^^^^^^^^^^^^^^^^^^^^ error: largest_niche: Some(Niche { offset: Size(0 bytes), value: i8, valid_range: 0..=127 }) - --> $DIR/enum-unusual-variants.rs:22:1 + --> $DIR/enum-unusual-variants.rs:21:1 | LL | enum With128VariantsI8 { | ^^^^^^^^^^^^^^^^^^^^^^ error: largest_niche: Some(Niche { offset: Size(0 bytes), value: u8, valid_range: 0..=127 }) - --> $DIR/enum-unusual-variants.rs:35:1 + --> $DIR/enum-unusual-variants.rs:34:1 | LL | enum With128VariantsU8 { | ^^^^^^^^^^^^^^^^^^^^^^ error: largest_niche: Some(Niche { offset: Size(0 bytes), value: u8, valid_range: 1..=129 }) - --> $DIR/enum-unusual-variants.rs:51:1 + --> $DIR/enum-unusual-variants.rs:50:1 | LL | enum Symmetric { | ^^^^^^^^^^^^^^ error: largest_niche: Some(Niche { offset: Size(0 bytes), value: u8, valid_range: 1..=129 }) - --> $DIR/enum-unusual-variants.rs:59:1 + --> $DIR/enum-unusual-variants.rs:58:1 | LL | enum SymmetricU8 { | ^^^^^^^^^^^^^^^^ error: largest_niche: Some(Niche { offset: Size(0 bytes), value: i8, valid_range: 1..=129 }) - --> $DIR/enum-unusual-variants.rs:69:1 + --> $DIR/enum-unusual-variants.rs:68:1 | LL | enum SymmetricSigned { | ^^^^^^^^^^^^^^^^^^^^ error: largest_niche: Some(Niche { offset: Size(0 bytes), value: i8, valid_range: 1..=129 }) - --> $DIR/enum-unusual-variants.rs:77:1 + --> $DIR/enum-unusual-variants.rs:76:1 | LL | enum SymmetricSignedI8 { | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/layout/enum.rs b/tests/ui/layout/enum.rs index 84918f64fe7ed..0f6d52ccc73f9 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_dump_layout(align)] -enum UninhabitedVariantAlign { //~ERROR: align: Align(2 bytes) +enum UninhabitedVariantAlign { + //~^ ERROR: align: Align(2 bytes) A([u8; 32]), B([u16; 0], !), // make sure alignment in uninhabited fields is respected } #[rustc_dump_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_dump_layout(backend_repr)] -enum ScalarPairDifferingSign { //~ERROR: backend_repr: ScalarPair +enum ScalarPairDifferingSign { + //~^ ERROR: backend_repr: ScalarPair A(u8), B(i8), } @@ -28,7 +30,8 @@ enum Never {} // See https://github.com/rust-lang/rust/issues/146984 #[rustc_dump_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/enum.stderr b/tests/ui/layout/enum.stderr index 332a53c911517..b45745e63701c 100644 --- a/tests/ui/layout/enum.stderr +++ b/tests/ui/layout/enum.stderr @@ -1,5 +1,5 @@ error: align: Align(2 bytes) - --> $DIR/enum.rs:9:1 + --> $DIR/enum.rs:8:1 | LL | enum UninhabitedVariantAlign { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -11,13 +11,13 @@ LL | enum UninhabitedVariantSpace { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: backend_repr: ScalarPair { a: u8 is 0..=1, b: u8 is .., b_offset: Size(1 bytes) } - --> $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/hexagon-enum.rs b/tests/ui/layout/hexagon-enum.rs index 76f1bd5022118..dcb43b04f51da 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 fc218d9fecbd0..e2feb472abbac 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_dump_layout(backend_repr)] diff --git a/tests/ui/layout/struct.stderr b/tests/ui/layout/struct.stderr index 3ea671c1bab8f..decedad2322d8 100644 --- a/tests/ui/layout/struct.stderr +++ b/tests/ui/layout/struct.stderr @@ -1,11 +1,11 @@ error: backend_repr: Memory { sized: true } - --> $DIR/struct.rs:9:1 + --> $DIR/struct.rs:8:1 | LL | struct AlignedZstPreventsScalar(i16, [i32; 0]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: backend_repr: Scalar(i32 is ..) - --> $DIR/struct.rs:12:1 + --> $DIR/struct.rs:11:1 | LL | struct AlignedZstButStillScalar(i32, [i16; 0]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/layout/thumb-enum.rs b/tests/ui/layout/thumb-enum.rs index 7d6d98b9edd6b..613154ee1c194 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 54435583b1341..301283853eb26 100644 --- a/tests/ui/lint/invalid_value.rs +++ b/tests/ui/lint/invalid_value.rs @@ -2,20 +2,24 @@ // in a lint. #![allow(deprecated)] #![deny(invalid_value)] -#![feature(never_type, rustc_attrs, pattern_types, pattern_type_macro)] +#![feature(rustc_attrs, pattern_types, pattern_type_macro)] use std::mem::{self, MaybeUninit}; -use std::ptr::NonNull; use std::num::NonZero; use std::pat::pattern_type; +use std::ptr::NonNull; enum Void {} struct Ref(&'static i32); struct RefPair((&'static i32, i32)); -struct Wrap { wrapped: T } -enum WrapEnum { Wrapped(T) } +struct Wrap { + wrapped: T, +} +enum WrapEnum { + Wrapped(T), +} #[repr(transparent)] pub(crate) struct NonBig(pattern_type!(u64 is 0..=128)); diff --git a/tests/ui/lint/invalid_value.stderr b/tests/ui/lint/invalid_value.stderr index 8500d3732e1a4..28ec54f0c308a 100644 --- a/tests/ui/lint/invalid_value.stderr +++ b/tests/ui/lint/invalid_value.stderr @@ -1,5 +1,5 @@ error: the type `&T` does not permit zero-initialization - --> $DIR/invalid_value.rs:50:32 + --> $DIR/invalid_value.rs:54:32 | LL | let _val: &'static T = mem::zeroed(); | ^^^^^^^^^^^^^ @@ -15,7 +15,7 @@ LL | #![deny(invalid_value)] | ^^^^^^^^^^^^^ error: the type `&T` does not permit being left uninitialized - --> $DIR/invalid_value.rs:51:32 + --> $DIR/invalid_value.rs:55:32 | LL | let _val: &'static T = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ @@ -26,7 +26,7 @@ LL | let _val: &'static T = mem::uninitialized(); = note: references must be non-null error: the type `Wrap<&T>` does not permit zero-initialization - --> $DIR/invalid_value.rs:53:38 + --> $DIR/invalid_value.rs:57:38 | LL | let _val: Wrap<&'static T> = mem::zeroed(); | ^^^^^^^^^^^^^ @@ -36,13 +36,13 @@ LL | let _val: Wrap<&'static T> = mem::zeroed(); | = note: `Wrap<&T>` must be non-null note: because references must be non-null (in this struct field) - --> $DIR/invalid_value.rs:17:18 + --> $DIR/invalid_value.rs:18:5 | -LL | struct Wrap { wrapped: T } - | ^^^^^^^^^^ +LL | wrapped: T, + | ^^^^^^^^^^ error: the type `Wrap<&T>` does not permit being left uninitialized - --> $DIR/invalid_value.rs:54:38 + --> $DIR/invalid_value.rs:58:38 | LL | let _val: Wrap<&'static T> = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ @@ -52,13 +52,13 @@ LL | let _val: Wrap<&'static T> = mem::uninitialized(); | = note: `Wrap<&T>` must be non-null note: because references must be non-null (in this struct field) - --> $DIR/invalid_value.rs:17:18 + --> $DIR/invalid_value.rs:18:5 | -LL | struct Wrap { wrapped: T } - | ^^^^^^^^^^ +LL | wrapped: T, + | ^^^^^^^^^^ error: the type `!` does not permit zero-initialization - --> $DIR/invalid_value.rs:61:23 + --> $DIR/invalid_value.rs:65:23 | LL | let _val: ! = mem::zeroed(); | ^^^^^^^^^^^^^ this code causes undefined behavior when executed @@ -66,7 +66,7 @@ LL | let _val: ! = mem::zeroed(); = note: the `!` type has no valid value error: the type `!` does not permit being left uninitialized - --> $DIR/invalid_value.rs:62:23 + --> $DIR/invalid_value.rs:66:23 | LL | let _val: ! = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed @@ -74,7 +74,7 @@ LL | let _val: ! = mem::uninitialized(); = note: the `!` type has no valid value error: the type `(i32, !)` does not permit zero-initialization - --> $DIR/invalid_value.rs:64:30 + --> $DIR/invalid_value.rs:68:30 | LL | let _val: (i32, !) = mem::zeroed(); | ^^^^^^^^^^^^^ this code causes undefined behavior when executed @@ -82,7 +82,7 @@ LL | let _val: (i32, !) = mem::zeroed(); = note: the `!` type has no valid value error: the type `(i32, !)` does not permit being left uninitialized - --> $DIR/invalid_value.rs:65:30 + --> $DIR/invalid_value.rs:69:30 | LL | let _val: (i32, !) = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed @@ -90,7 +90,7 @@ LL | let _val: (i32, !) = mem::uninitialized(); = note: integers must be initialized error: the type `Void` does not permit zero-initialization - --> $DIR/invalid_value.rs:67:26 + --> $DIR/invalid_value.rs:71:26 | LL | let _val: Void = mem::zeroed(); | ^^^^^^^^^^^^^ this code causes undefined behavior when executed @@ -102,7 +102,7 @@ LL | enum Void {} | ^^^^^^^^^ error: the type `Void` does not permit being left uninitialized - --> $DIR/invalid_value.rs:68:26 + --> $DIR/invalid_value.rs:72:26 | LL | let _val: Void = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed @@ -114,7 +114,7 @@ LL | enum Void {} | ^^^^^^^^^ error: the type `&i32` does not permit zero-initialization - --> $DIR/invalid_value.rs:70:34 + --> $DIR/invalid_value.rs:74:34 | LL | let _val: &'static i32 = mem::zeroed(); | ^^^^^^^^^^^^^ @@ -125,7 +125,7 @@ LL | let _val: &'static i32 = mem::zeroed(); = note: references must be non-null error: the type `&i32` does not permit being left uninitialized - --> $DIR/invalid_value.rs:71:34 + --> $DIR/invalid_value.rs:75:34 | LL | let _val: &'static i32 = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ @@ -136,7 +136,7 @@ LL | let _val: &'static i32 = mem::uninitialized(); = note: references must be non-null error: the type `Ref` does not permit zero-initialization - --> $DIR/invalid_value.rs:73:25 + --> $DIR/invalid_value.rs:77:25 | LL | let _val: Ref = mem::zeroed(); | ^^^^^^^^^^^^^ @@ -152,7 +152,7 @@ LL | struct Ref(&'static i32); | ^^^^^^^^^^^^ error: the type `Ref` does not permit being left uninitialized - --> $DIR/invalid_value.rs:74:25 + --> $DIR/invalid_value.rs:78:25 | LL | let _val: Ref = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ @@ -168,7 +168,7 @@ LL | struct Ref(&'static i32); | ^^^^^^^^^^^^ error: the type `fn()` does not permit zero-initialization - --> $DIR/invalid_value.rs:76:26 + --> $DIR/invalid_value.rs:80:26 | LL | let _val: fn() = mem::zeroed(); | ^^^^^^^^^^^^^ @@ -179,7 +179,7 @@ LL | let _val: fn() = mem::zeroed(); = note: function pointers must be non-null error: the type `fn()` does not permit being left uninitialized - --> $DIR/invalid_value.rs:77:26 + --> $DIR/invalid_value.rs:81:26 | LL | let _val: fn() = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ @@ -190,7 +190,7 @@ LL | let _val: fn() = mem::uninitialized(); = note: function pointers must be non-null error: the type `Wrap` does not permit zero-initialization - --> $DIR/invalid_value.rs:79:32 + --> $DIR/invalid_value.rs:83:32 | LL | let _val: Wrap = mem::zeroed(); | ^^^^^^^^^^^^^ @@ -200,13 +200,13 @@ LL | let _val: Wrap = mem::zeroed(); | = note: `Wrap` must be non-null note: because function pointers must be non-null (in this struct field) - --> $DIR/invalid_value.rs:17:18 + --> $DIR/invalid_value.rs:18:5 | -LL | struct Wrap { wrapped: T } - | ^^^^^^^^^^ +LL | wrapped: T, + | ^^^^^^^^^^ error: the type `Wrap` does not permit being left uninitialized - --> $DIR/invalid_value.rs:80:32 + --> $DIR/invalid_value.rs:84:32 | LL | let _val: Wrap = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ @@ -216,13 +216,13 @@ LL | let _val: Wrap = mem::uninitialized(); | = note: `Wrap` must be non-null note: because function pointers must be non-null (in this struct field) - --> $DIR/invalid_value.rs:17:18 + --> $DIR/invalid_value.rs:18:5 | -LL | struct Wrap { wrapped: T } - | ^^^^^^^^^^ +LL | wrapped: T, + | ^^^^^^^^^^ error: the type `WrapEnum` does not permit zero-initialization - --> $DIR/invalid_value.rs:82:36 + --> $DIR/invalid_value.rs:86:36 | LL | let _val: WrapEnum = mem::zeroed(); | ^^^^^^^^^^^^^ @@ -232,13 +232,13 @@ LL | let _val: WrapEnum = mem::zeroed(); | = note: `WrapEnum` must be non-null note: because function pointers must be non-null (in this field of the only potentially inhabited enum variant) - --> $DIR/invalid_value.rs:18:28 + --> $DIR/invalid_value.rs:21:13 | -LL | enum WrapEnum { Wrapped(T) } - | ^ +LL | Wrapped(T), + | ^ error: the type `WrapEnum` does not permit being left uninitialized - --> $DIR/invalid_value.rs:83:36 + --> $DIR/invalid_value.rs:87:36 | LL | let _val: WrapEnum = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ @@ -248,13 +248,13 @@ LL | let _val: WrapEnum = mem::uninitialized(); | = note: `WrapEnum` must be non-null note: because function pointers must be non-null (in this field of the only potentially inhabited enum variant) - --> $DIR/invalid_value.rs:18:28 + --> $DIR/invalid_value.rs:21:13 | -LL | enum WrapEnum { Wrapped(T) } - | ^ +LL | Wrapped(T), + | ^ error: the type `Wrap<(RefPair, i32)>` does not permit zero-initialization - --> $DIR/invalid_value.rs:85:42 + --> $DIR/invalid_value.rs:89:42 | LL | let _val: Wrap<(RefPair, i32)> = mem::zeroed(); | ^^^^^^^^^^^^^ @@ -263,10 +263,10 @@ LL | let _val: Wrap<(RefPair, i32)> = mem::zeroed(); | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | note: `RefPair` must be non-null (in this struct field) - --> $DIR/invalid_value.rs:17:18 + --> $DIR/invalid_value.rs:18:5 | -LL | struct Wrap { wrapped: T } - | ^^^^^^^^^^ +LL | wrapped: T, + | ^^^^^^^^^^ note: because references must be non-null (in this struct field) --> $DIR/invalid_value.rs:15:16 | @@ -274,7 +274,7 @@ LL | struct RefPair((&'static i32, i32)); | ^^^^^^^^^^^^^^^^^^^ error: the type `Wrap<(RefPair, i32)>` does not permit being left uninitialized - --> $DIR/invalid_value.rs:86:42 + --> $DIR/invalid_value.rs:90:42 | LL | let _val: Wrap<(RefPair, i32)> = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ @@ -283,10 +283,10 @@ LL | let _val: Wrap<(RefPair, i32)> = mem::uninitialized(); | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | note: `RefPair` must be non-null (in this struct field) - --> $DIR/invalid_value.rs:17:18 + --> $DIR/invalid_value.rs:18:5 | -LL | struct Wrap { wrapped: T } - | ^^^^^^^^^^ +LL | wrapped: T, + | ^^^^^^^^^^ note: because references must be non-null (in this struct field) --> $DIR/invalid_value.rs:15:16 | @@ -294,7 +294,7 @@ LL | struct RefPair((&'static i32, i32)); | ^^^^^^^^^^^^^^^^^^^ error: the type `NonNull` does not permit zero-initialization - --> $DIR/invalid_value.rs:88:34 + --> $DIR/invalid_value.rs:92:34 | LL | let _val: NonNull = mem::zeroed(); | ^^^^^^^^^^^^^ @@ -305,7 +305,7 @@ LL | let _val: NonNull = mem::zeroed(); = note: `std::ptr::NonNull` must be non-null error: the type `NonNull` does not permit being left uninitialized - --> $DIR/invalid_value.rs:89:34 + --> $DIR/invalid_value.rs:93:34 | LL | let _val: NonNull = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ @@ -316,7 +316,7 @@ LL | let _val: NonNull = mem::uninitialized(); = note: `std::ptr::NonNull` must be non-null error: the type `(NonZero, i32)` does not permit zero-initialization - --> $DIR/invalid_value.rs:91:41 + --> $DIR/invalid_value.rs:95:41 | LL | let _val: (NonZero, i32) = mem::zeroed(); | ^^^^^^^^^^^^^ this code causes undefined behavior when executed @@ -325,7 +325,7 @@ LL | let _val: (NonZero, i32) = mem::zeroed(); = note: because `core::num::niche_types::NonZeroU32Inner` must be non-null error: the type `(NonZero, i32)` does not permit being left uninitialized - --> $DIR/invalid_value.rs:92:41 + --> $DIR/invalid_value.rs:96:41 | LL | let _val: (NonZero, i32) = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed @@ -334,7 +334,7 @@ LL | let _val: (NonZero, i32) = mem::uninitialized(); = note: because `core::num::niche_types::NonZeroU32Inner` must be non-null error: the type `*const dyn Send` does not permit zero-initialization - --> $DIR/invalid_value.rs:94:37 + --> $DIR/invalid_value.rs:98:37 | LL | let _val: *const dyn Send = mem::zeroed(); | ^^^^^^^^^^^^^ @@ -345,7 +345,7 @@ LL | let _val: *const dyn Send = mem::zeroed(); = note: the vtable of a wide raw pointer must be non-null error: the type `*const dyn Send` does not permit being left uninitialized - --> $DIR/invalid_value.rs:95:37 + --> $DIR/invalid_value.rs:99:37 | LL | let _val: *const dyn Send = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ @@ -356,7 +356,7 @@ LL | let _val: *const dyn Send = mem::uninitialized(); = note: the vtable of a wide raw pointer must be non-null error: the type `[fn(); 2]` does not permit zero-initialization - --> $DIR/invalid_value.rs:97:31 + --> $DIR/invalid_value.rs:101:31 | LL | let _val: [fn(); 2] = mem::zeroed(); | ^^^^^^^^^^^^^ @@ -367,7 +367,7 @@ LL | let _val: [fn(); 2] = mem::zeroed(); = note: function pointers must be non-null error: the type `[fn(); 2]` does not permit being left uninitialized - --> $DIR/invalid_value.rs:98:31 + --> $DIR/invalid_value.rs:102:31 | LL | let _val: [fn(); 2] = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ @@ -378,59 +378,59 @@ LL | let _val: [fn(); 2] = mem::uninitialized(); = note: function pointers must be non-null error: the type `TwoUninhabited` does not permit zero-initialization - --> $DIR/invalid_value.rs:100:36 + --> $DIR/invalid_value.rs:104:36 | LL | let _val: TwoUninhabited = mem::zeroed(); | ^^^^^^^^^^^^^ this code causes undefined behavior when executed | note: enums with no inhabited variants have no valid value - --> $DIR/invalid_value.rs:40:1 + --> $DIR/invalid_value.rs:44:1 | LL | enum TwoUninhabited { | ^^^^^^^^^^^^^^^^^^^ error: the type `TwoUninhabited` does not permit being left uninitialized - --> $DIR/invalid_value.rs:101:36 + --> $DIR/invalid_value.rs:105:36 | LL | let _val: TwoUninhabited = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed | note: enums with no inhabited variants have no valid value - --> $DIR/invalid_value.rs:40:1 + --> $DIR/invalid_value.rs:44:1 | LL | enum TwoUninhabited { | ^^^^^^^^^^^^^^^^^^^ error: the type `OneFruitNonZero` does not permit zero-initialization - --> $DIR/invalid_value.rs:103:37 + --> $DIR/invalid_value.rs:107:37 | LL | let _val: OneFruitNonZero = mem::zeroed(); | ^^^^^^^^^^^^^ this code causes undefined behavior when executed | = note: `OneFruitNonZero` must be non-null note: because `std::num::NonZero` must be non-null (in this field of the only potentially inhabited enum variant) - --> $DIR/invalid_value.rs:37:12 + --> $DIR/invalid_value.rs:41:12 | LL | Banana(NonZero), | ^^^^^^^^^^^^ = note: because `core::num::niche_types::NonZeroU32Inner` must be non-null error: the type `OneFruitNonZero` does not permit being left uninitialized - --> $DIR/invalid_value.rs:104:37 + --> $DIR/invalid_value.rs:108:37 | LL | let _val: OneFruitNonZero = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed | = note: `OneFruitNonZero` must be non-null note: because `std::num::NonZero` must be non-null (in this field of the only potentially inhabited enum variant) - --> $DIR/invalid_value.rs:37:12 + --> $DIR/invalid_value.rs:41:12 | LL | Banana(NonZero), | ^^^^^^^^^^^^ = note: because `core::num::niche_types::NonZeroU32Inner` must be non-null error: the type `bool` does not permit being left uninitialized - --> $DIR/invalid_value.rs:108:26 + --> $DIR/invalid_value.rs:112:26 | LL | let _val: bool = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ @@ -441,7 +441,7 @@ LL | let _val: bool = mem::uninitialized(); = note: booleans must be either `true` or `false` error: the type `Wrap` does not permit being left uninitialized - --> $DIR/invalid_value.rs:111:32 + --> $DIR/invalid_value.rs:115:32 | LL | let _val: Wrap = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ @@ -451,13 +451,13 @@ LL | let _val: Wrap = mem::uninitialized(); | = note: `Wrap` must be initialized inside its custom valid range note: characters must be a valid Unicode codepoint (in this struct field) - --> $DIR/invalid_value.rs:17:18 + --> $DIR/invalid_value.rs:18:5 | -LL | struct Wrap { wrapped: T } - | ^^^^^^^^^^ +LL | wrapped: T, + | ^^^^^^^^^^ error: the type `NonBig` does not permit being left uninitialized - --> $DIR/invalid_value.rs:114:28 + --> $DIR/invalid_value.rs:118:28 | LL | let _val: NonBig = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ @@ -468,7 +468,7 @@ LL | let _val: NonBig = mem::uninitialized(); = note: `NonBig` must be initialized inside its custom valid range error: the type `Fruit` does not permit being left uninitialized - --> $DIR/invalid_value.rs:117:27 + --> $DIR/invalid_value.rs:121:27 | LL | let _val: Fruit = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ @@ -477,13 +477,13 @@ LL | let _val: Fruit = mem::uninitialized(); | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | note: enums with multiple inhabited variants have to be initialized to a variant - --> $DIR/invalid_value.rs:24:1 + --> $DIR/invalid_value.rs:28:1 | LL | enum Fruit { | ^^^^^^^^^^ error: the type `[bool; 2]` does not permit being left uninitialized - --> $DIR/invalid_value.rs:120:31 + --> $DIR/invalid_value.rs:124:31 | LL | let _val: [bool; 2] = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ @@ -494,7 +494,7 @@ LL | let _val: [bool; 2] = mem::uninitialized(); = note: booleans must be either `true` or `false` error: the type `i32` does not permit being left uninitialized - --> $DIR/invalid_value.rs:123:25 + --> $DIR/invalid_value.rs:127:25 | LL | let _val: i32 = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ @@ -505,7 +505,7 @@ LL | let _val: i32 = mem::uninitialized(); = note: integers must be initialized error: the type `f32` does not permit being left uninitialized - --> $DIR/invalid_value.rs:126:25 + --> $DIR/invalid_value.rs:130:25 | LL | let _val: f32 = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ @@ -516,7 +516,7 @@ LL | let _val: f32 = mem::uninitialized(); = note: floats must be initialized error: the type `*const ()` does not permit being left uninitialized - --> $DIR/invalid_value.rs:129:31 + --> $DIR/invalid_value.rs:133:31 | LL | let _val: *const () = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ @@ -527,7 +527,7 @@ LL | let _val: *const () = mem::uninitialized(); = note: raw pointers must be initialized error: the type `*const [()]` does not permit being left uninitialized - --> $DIR/invalid_value.rs:132:33 + --> $DIR/invalid_value.rs:136:33 | LL | let _val: *const [()] = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ @@ -538,7 +538,7 @@ LL | let _val: *const [()] = mem::uninitialized(); = note: raw pointers must be initialized error: the type `WrapAroundRange` does not permit being left uninitialized - --> $DIR/invalid_value.rs:135:37 + --> $DIR/invalid_value.rs:139:37 | LL | let _val: WrapAroundRange = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ @@ -549,7 +549,7 @@ LL | let _val: WrapAroundRange = mem::uninitialized(); = note: `WrapAroundRange` must be initialized inside its custom valid range error: the type `Result` does not permit being left uninitialized - --> $DIR/invalid_value.rs:140:38 + --> $DIR/invalid_value.rs:144:38 | LL | let _val: Result = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ @@ -561,7 +561,7 @@ note: enums with multiple inhabited variants have to be initialized to a variant --> $SRC_DIR/core/src/result.rs:LL:COL error: the type `&i32` does not permit zero-initialization - --> $DIR/invalid_value.rs:148:34 + --> $DIR/invalid_value.rs:152:34 | LL | let _val: &'static i32 = mem::transmute(0usize); | ^^^^^^^^^^^^^^^^^^^^^^ @@ -572,7 +572,7 @@ LL | let _val: &'static i32 = mem::transmute(0usize); = note: references must be non-null error: the type `&[i32]` does not permit zero-initialization - --> $DIR/invalid_value.rs:149:36 + --> $DIR/invalid_value.rs:153:36 | LL | let _val: &'static [i32] = mem::transmute((0usize, 0usize)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -583,7 +583,7 @@ LL | let _val: &'static [i32] = mem::transmute((0usize, 0usize)); = note: references must be non-null error: the type `NonZero` does not permit zero-initialization - --> $DIR/invalid_value.rs:150:34 + --> $DIR/invalid_value.rs:154:34 | LL | let _val: NonZero = mem::transmute(0); | ^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed @@ -592,7 +592,7 @@ LL | let _val: NonZero = mem::transmute(0); = note: because `core::num::niche_types::NonZeroU32Inner` must be non-null error: the type `NonNull` does not permit zero-initialization - --> $DIR/invalid_value.rs:153:34 + --> $DIR/invalid_value.rs:157:34 | LL | let _val: NonNull = MaybeUninit::zeroed().assume_init(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -603,7 +603,7 @@ LL | let _val: NonNull = MaybeUninit::zeroed().assume_init(); = note: `std::ptr::NonNull` must be non-null error: the type `NonNull` does not permit being left uninitialized - --> $DIR/invalid_value.rs:154:34 + --> $DIR/invalid_value.rs:158:34 | LL | let _val: NonNull = MaybeUninit::uninit().assume_init(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -614,7 +614,7 @@ LL | let _val: NonNull = MaybeUninit::uninit().assume_init(); = note: `std::ptr::NonNull` must be non-null error: the type `bool` does not permit being left uninitialized - --> $DIR/invalid_value.rs:155:26 + --> $DIR/invalid_value.rs:159:26 | LL | let _val: bool = MaybeUninit::uninit().assume_init(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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-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.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-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.rs b/tests/ui/lint/unused/must_use-result-unit-uninhabited.rs index d1b47374a11b8..d60915adecf17 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-result-unit-uninhabited.stderr b/tests/ui/lint/unused/must_use-result-unit-uninhabited.stderr index b4c62c7690b49..230c97092b526 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:93:5 + --> $DIR/must_use-result-unit-uninhabited.rs:92:5 | LL | result_unit_unit(); | ^^^^^^^^^^^^^^^^^^ @@ -16,13 +16,13 @@ LL | let _ = result_unit_unit(); | +++++++ error: unused `MustUse` in a `Result` with an uninhabited error that must be used - --> $DIR/must_use-result-unit-uninhabited.rs:96:5 + --> $DIR/must_use-result-unit-uninhabited.rs:95:5 | LL | result_must_use_never(); | ^^^^^^^^^^^^^^^^^^^^^^^ error: unused `Result` that must be used - --> $DIR/must_use-result-unit-uninhabited.rs:99:5 + --> $DIR/must_use-result-unit-uninhabited.rs:98:5 | LL | result_unit_myuninhabited_nonexhaustive(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -34,7 +34,7 @@ LL | let _ = result_unit_myuninhabited_nonexhaustive(); | +++++++ error: unused `Result` that must be used - --> $DIR/must_use-result-unit-uninhabited.rs:101:5 + --> $DIR/must_use-result-unit-uninhabited.rs:100:5 | LL | result_unit_assoctype(S2); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -46,7 +46,7 @@ LL | let _ = result_unit_assoctype(S2); | +++++++ error: unused `Result` that must be used - --> $DIR/must_use-result-unit-uninhabited.rs:103:5 + --> $DIR/must_use-result-unit-uninhabited.rs:102:5 | LL | S2.method_use_assoc_type(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -58,7 +58,7 @@ LL | let _ = S2.method_use_assoc_type(); | +++++++ error: unused `ControlFlow` that must be used - --> $DIR/must_use-result-unit-uninhabited.rs:105:5 + --> $DIR/must_use-result-unit-uninhabited.rs:104:5 | LL | controlflow_unit(); | ^^^^^^^^^^^^^^^^^^ @@ -69,7 +69,7 @@ LL | let _ = controlflow_unit(); | +++++++ error: unused `Result` that must be used - --> $DIR/must_use-result-unit-uninhabited.rs:114:9 + --> $DIR/must_use-result-unit-uninhabited.rs:113:9 | LL | self.generate(); | ^^^^^^^^^^^^^^^ 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/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.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-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.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/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/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-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/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/method-on-never.rs b/tests/ui/never_type/basic/method-on-never.rs index 88cd0d7f31ce8..4194884ade9ea 100644 --- a/tests/ui/never_type/basic/method-on-never.rs +++ b/tests/ui/never_type/basic/method-on-never.rs @@ -1,8 +1,6 @@ //@ check-pass // Regression test for https://github.com/rust-lang/rust/issues/143349 -#![feature(never_type)] - trait Trait { fn method(&self); } @@ -35,7 +33,9 @@ impl Adhoc { } } -fn temp() -> Result { todo!() } +fn temp() -> Result { + todo!() +} fn main() -> Result<(), ()> { let x = loop {}; 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-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/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/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.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/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.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/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/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..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,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)] +#![expect(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 bb9de45637a09..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,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 - --> $DIR/dependency-on-fallback-to-unit.rs:10:19 +error[E0277]: the trait bound `!: Default` is not satisfied + --> $DIR/dependency-on-fallback-to-unit.rs:8: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 - --> $DIR/dependency-on-fallback-to-unit.rs:20:5 +error[E0277]: the trait bound `!: Default` is not satisfied + --> $DIR/dependency-on-fallback-to-unit.rs:17: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: 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() { - | ^^^^^^^^ + | ^^^^^^^^^^^^^ the trait `Default` is not implemented for `!` | - = 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:22: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 deleted file mode 100644 index 40e7e30274be8..0000000000000 --- a/tests/ui/never_type/fallback_change/diverging-fallback-unconstrained-return.e2021.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() { - | ^^^^^^^^^ - | - = 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!() }; - | ++++ - -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!() }; - | ++++ - 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/diverging-fallback-unconstrained-return.rs b/tests/ui/never_type/fallback_change/diverging-fallback-unconstrained-return.rs index 1c8ce71080bfb..2929bbda8a103 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 @@ -1,11 +1,10 @@ // Variant of diverging-fallback-control-flow that tests // the specific case of a free function with an unconstrained // return type. This captures the pattern we saw in the wild -// in the objc crate, where changing the fallback from `!` to `()` +// in the objc crate, where changing the fallback from `()` to `!` // resulted in unsoundness. // -//@ revisions: e2021 e2024 -//@[e2024] edition: 2024 +//@ edition: 2015..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.e2024.stderr b/tests/ui/never_type/fallback_change/diverging-fallback-unconstrained-return.stderr similarity index 84% rename from tests/ui/never_type/fallback_change/diverging-fallback-unconstrained-return.e2024.stderr rename to tests/ui/never_type/fallback_change/diverging-fallback-unconstrained-return.stderr index d28f5d7de92f5..cdadbc2bc6574 100644 --- a/tests/ui/never_type/fallback_change/diverging-fallback-unconstrained-return.e2024.stderr +++ b/tests/ui/never_type/fallback_change/diverging-fallback-unconstrained-return.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `!: UnitReturn` is not satisfied - --> $DIR/diverging-fallback-unconstrained-return.rs:37:23 + --> $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:15:1 + --> $DIR/diverging-fallback-unconstrained-return.rs:14:1 | LL | impl UnitReturn for i32 {} | ^^^^^^^^^^^^^^^^^^^^^^^ `i32` @@ -14,7 +14,7 @@ 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 + --> $DIR/diverging-fallback-unconstrained-return.rs:17:28 | LL | fn unconstrained_return() -> T { | ^^^^^^^^^^ required by this bound in `unconstrained_return` 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 73c2a5bd3907e..0000000000000 --- a/tests/ui/never_type/fallback_change/dont-suggest-turbofish-from-expansion.stderr +++ /dev/null @@ -1,43 +0,0 @@ -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()?; - | ++++ - -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()?; - | ++++ - 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.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-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.e2024.stderr b/tests/ui/never_type/fallback_change/fallback-closure-ret.stderr similarity index 87% rename from tests/ui/never_type/fallback_change/fallback-closure-ret.e2024.stderr rename to tests/ui/never_type/fallback_change/fallback-closure-ret.stderr index 9687ddf6459db..3249e947ac3b6 100644 --- a/tests/ui/never_type/fallback_change/fallback-closure-ret.e2024.stderr +++ b/tests/ui/never_type/fallback_change/fallback-closure-ret.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `!: Bar` is not satisfied - --> $DIR/fallback-closure-ret.rs:22:5 + --> $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:15:1 + --> $DIR/fallback-closure-ret.rs:11:1 | LL | impl Bar for () {} | ^^^^^^^^^^^^^^^ `()` @@ -14,7 +14,7 @@ LL | impl Bar for 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 + --> $DIR/fallback-closure-ret.rs:14:11 | LL | fn foo(_: impl Fn() -> R) {} | ^^^ required by this bound in `foo` 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.rs b/tests/ui/never_type/fallback_change/fallback-closure-wrap.rs index 51be6ac06cc21..b42c454d45dfe 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.fallback.stderr b/tests/ui/never_type/fallback_change/fallback-closure-wrap.stderr similarity index 76% rename from tests/ui/never_type/fallback_change/fallback-closure-wrap.fallback.stderr rename to tests/ui/never_type/fallback_change/fallback-closure-wrap.stderr index e3d8718682fb7..fd9135aa2bf38 100644 --- a/tests/ui/never_type/fallback_change/fallback-closure-wrap.fallback.stderr +++ b/tests/ui/never_type/fallback_change/fallback-closure-wrap.stderr @@ -1,5 +1,5 @@ -error[E0271]: expected `{closure@fallback-closure-wrap.rs:17:40}` to return `()`, but it returns `!` - --> $DIR/fallback-closure-wrap.rs:18:9 +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 @@ -8,7 +8,7 @@ LL | panic!("Can't connect to server."); | = 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` + = 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 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 deleted file mode 100644 index b235c6e4eb464..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 a0a300aae6af7..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,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 - --> $DIR/lint-breaking-2024-assign-underscore.rs:11:9 +error[E0277]: the trait bound `!: Default` is not satisfied + --> $DIR/lint-breaking-2024-assign-underscore.rs:8: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:3: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 deleted file mode 100644 index 730e449704859..0000000000000 --- a/tests/ui/never_type/fallback_change/lint-never-type-fallback-flowing-into-unsafe.e2015.stderr +++ /dev/null @@ -1,287 +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) - -error: aborting due to 10 previous errors - -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/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..db989d0e5362f 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.. use std::{marker, mem, ptr}; @@ -8,10 +7,8 @@ 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 - //~| warn: this changes meaning in Rust 2024 and in a future release in all editions! - //[e2024]~| warn: the type `!` does not permit zero-initialization + //~^ error: never type fallback affects this call to an `unsafe` function + //~| warn: the type `!` does not permit zero-initialization } else { return; }; @@ -25,9 +22,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 - //~| warn: this changes meaning in Rust 2024 and in a future release in all editions! + //~^ error: never type fallback affects this call to an `unsafe` function } } else { return; @@ -42,9 +37,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 - //~| warn: this changes meaning in Rust 2024 and in a future release in all editions! + //~^ error: never type fallback affects this union access } else { return; }; @@ -53,9 +46,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 - //~| warn: this changes meaning in Rust 2024 and in a future release in all editions! + //~^ error: never type fallback affects this raw pointer dereference } else { return; }; @@ -74,9 +65,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 - //~| warn: this changes meaning in Rust 2024 and in a future release in all editions! + //~^ error: never type fallback affects this call to an `unsafe` function x.unwrap() } else { @@ -87,14 +76,10 @@ 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 - //~| warn: this changes meaning in Rust 2024 and in a future release in all editions! + //~^ error: never type fallback affects this `unsafe` function 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 - //~| warn: this changes meaning in Rust 2024 and in a future release in all editions! + //~^ error: never type fallback affects this call to an `unsafe` function } else { return; }; @@ -110,9 +95,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 - //~| warn: this changes meaning in Rust 2024 and in a future release in all editions! + //~^ error: never type fallback affects this `unsafe` function unsafe { f(x) } @@ -135,9 +118,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 - //~| warn: this changes meaning in Rust 2024 and in a future release in all editions! + //~^ error: never type fallback affects this call to an `unsafe` method } } else { return; @@ -153,9 +134,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 - //~| warn: this changes meaning in Rust 2024 and in a future release in all editions! + //~^ error: never type fallback affects this call to an `unsafe` function 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..020713d03d34a --- /dev/null +++ b/tests/ui/never_type/fallback_change/lint-never-type-fallback-flowing-into-unsafe.stderr @@ -0,0 +1,124 @@ +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 + = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` 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:24:13 + | +LL | core::mem::transmute(Zst) + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: specify the type explicitly +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:39:18 + | +LL | unsafe { Union { a: () }.b } + | ^^^^^^^^^^^^^^^^^ + | + = help: specify the type explicitly + +error: never type fallback affects this raw pointer dereference + --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:48:18 + | +LL | unsafe { *ptr::from_ref(&()).cast() } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: specify the type explicitly +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:67:18 + | +LL | unsafe { internally_create(x) } + | ^^^^^^^^^^^^^^^^^^^^ + | + = help: specify the type explicitly +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:81:18 + | +LL | unsafe { zeroed() } + | ^^^^^^^^ + | + = help: specify the type explicitly +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:78:22 + | +LL | let zeroed = mem::zeroed; + | ^^^^^^^^^^^ + | + = help: specify the type explicitly +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:97:17 + | +LL | let f = internally_create; + | ^^^^^^^^^^^^^^^^^ + | + = help: specify the type explicitly +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:120:13 + | +LL | S(marker::PhantomData).create_out_of_thin_air() + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: specify the type explicitly + +error: never type fallback affects this call to an `unsafe` function + --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:136:19 + | +LL | match send_message::<_ /* ?0 */>() { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +... +LL | msg_send!(); + | ----------- in this macro invocation + | + = help: specify the type explicitly + = 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 + 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/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`. 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..48a6134c06564 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,15 +1,12 @@ -//@ 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 (), +// Previously, 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(never_type)] #![feature(try_blocks)] fn bar(_: Result, u32>) { @@ -18,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() {} diff --git a/tests/ui/never_type/never-from-impl-is-not-reserved.rs b/tests/ui/never_type/never-from-impl-is-not-reserved.rs index 22b1c14db0bdf..4a8855ca5534d 100644 --- a/tests/ui/never_type/never-from-impl-is-not-reserved.rs +++ b/tests/ui/never_type/never-from-impl-is-not-reserved.rs @@ -6,8 +6,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/builtin_derives_on_adts_with_never.rs b/tests/ui/never_type/regress/builtin_derives_on_adts_with_never.rs index 2a57c6023adce..27ec28b9ab020 100644 --- a/tests/ui/never_type/regress/builtin_derives_on_adts_with_never.rs +++ b/tests/ui/never_type/regress/builtin_derives_on_adts_with_never.rs @@ -1,7 +1,6 @@ // Regression test for . // //@ check-pass -#![feature(never_type)] #![crate_type = "lib"] #![warn(unreachable_code)] 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/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.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/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 60d87bbe0bfdf..8b2c6f4b5b723 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 named parameters in parenthesized generic argument lists are experimental //~^ 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 1b76e0cd8abed..4673f9cece98b 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 @@ -25,23 +25,13 @@ LL | dealloc(ptr2, Layout::(x: !)(1, 1)); = help: add `#![feature(named_fn_trait_parameters)]` 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/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`. 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/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.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-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.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-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.exhaustive_patterns.stderr b/tests/ui/pattern/usefulness/empty-types.exhaustive_patterns.stderr index 55a1b2edd27ad..f6f7fd24989cc 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:48:9 + --> $DIR/empty-types.rs:47: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:8:9 + --> $DIR/empty-types.rs:7:9 | LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ error: unreachable pattern - --> $DIR/empty-types.rs:51:9 + --> $DIR/empty-types.rs:50: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:55:11 + --> $DIR/empty-types.rs:54:11 | LL | match ref_never {} | ^^^^^^^^^ @@ -41,7 +41,7 @@ LL ~ } | error: unreachable pattern - --> $DIR/empty-types.rs:69:9 + --> $DIR/empty-types.rs:68: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:75:9 + --> $DIR/empty-types.rs:74: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:78:9 + --> $DIR/empty-types.rs:77: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:82:9 + --> $DIR/empty-types.rs:81: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:86:11 + --> $DIR/empty-types.rs:85:11 | LL | match res_u32_never {} | ^^^^^^^^^^^^^ pattern `Ok(_)` not covered @@ -104,7 +104,7 @@ LL ~ } | error: unreachable pattern - --> $DIR/empty-types.rs:93:9 + --> $DIR/empty-types.rs:92: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:98:9 + --> $DIR/empty-types.rs:97: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:95:11 + --> $DIR/empty-types.rs:94: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:101:9 + --> $DIR/empty-types.rs:100: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:111:9 + --> $DIR/empty-types.rs:110: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:114:9 + --> $DIR/empty-types.rs:113: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:117:9 + --> $DIR/empty-types.rs:116: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:118:9 + --> $DIR/empty-types.rs:117: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:121:9 + --> $DIR/empty-types.rs:120: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:122:9 + --> $DIR/empty-types.rs:121: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:131:13 + --> $DIR/empty-types.rs:130: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:134:13 + --> $DIR/empty-types.rs:133: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:142:13 + --> $DIR/empty-types.rs:141: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:146:13 + --> $DIR/empty-types.rs:145: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:198:13 + --> $DIR/empty-types.rs:197: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:203:13 + --> $DIR/empty-types.rs:202: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:208:13 + --> $DIR/empty-types.rs:207: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:213:13 + --> $DIR/empty-types.rs:212: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:219:13 + --> $DIR/empty-types.rs:218: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:280:9 + --> $DIR/empty-types.rs:279: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:283:9 + --> $DIR/empty-types.rs:282: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:286:9 + --> $DIR/empty-types.rs:285: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:287:9 + --> $DIR/empty-types.rs:286: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:326:11 + --> $DIR/empty-types.rs:325:11 | LL | match slice_never {} | ^^^^^^^^^^^ @@ -378,7 +378,7 @@ LL ~ } | error[E0004]: non-exhaustive patterns: `&[]` not covered - --> $DIR/empty-types.rs:337:11 + --> $DIR/empty-types.rs:336:11 | LL | match slice_never { | ^^^^^^^^^^^ pattern `&[]` not covered @@ -391,7 +391,7 @@ LL + &[] => todo!() | error[E0004]: non-exhaustive patterns: `&[]` not covered - --> $DIR/empty-types.rs:351:11 + --> $DIR/empty-types.rs:350: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:358:11 + --> $DIR/empty-types.rs:357:11 | LL | match *slice_never {} | ^^^^^^^^^^^^ @@ -419,7 +419,7 @@ LL ~ } | error: unreachable pattern - --> $DIR/empty-types.rs:367:9 + --> $DIR/empty-types.rs:366: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:370:9 + --> $DIR/empty-types.rs:369: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:373:9 + --> $DIR/empty-types.rs:372: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:387:11 + --> $DIR/empty-types.rs:386:11 | LL | match array_0_never {} | ^^^^^^^^^^^^^ @@ -466,7 +466,7 @@ LL ~ } | error: unreachable pattern - --> $DIR/empty-types.rs:394:9 + --> $DIR/empty-types.rs:393: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:396:11 + --> $DIR/empty-types.rs:395:11 | LL | match array_0_never { | ^^^^^^^^^^^^^ pattern `[]` not covered @@ -488,7 +488,7 @@ LL + [] => todo!() | error: unreachable pattern - --> $DIR/empty-types.rs:415:9 + --> $DIR/empty-types.rs:414: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:420:9 + --> $DIR/empty-types.rs:419: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:425:9 + --> $DIR/empty-types.rs:424: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:430:9 + --> $DIR/empty-types.rs:429: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:602:9 + --> $DIR/empty-types.rs:601: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:605:9 + --> $DIR/empty-types.rs:604: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:608:9 + --> $DIR/empty-types.rs:607: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:611:9 + --> $DIR/empty-types.rs:610: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 507bc50ac7dd2..e3e803e85d617 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:48:9 + --> $DIR/empty-types.rs:47: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:8:9 + --> $DIR/empty-types.rs:7:9 | LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ error: unreachable pattern - --> $DIR/empty-types.rs:51:9 + --> $DIR/empty-types.rs:50: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:55:11 + --> $DIR/empty-types.rs:54:11 | LL | match ref_never {} | ^^^^^^^^^ @@ -41,7 +41,7 @@ LL ~ } | error: unreachable pattern - --> $DIR/empty-types.rs:82:9 + --> $DIR/empty-types.rs:81: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:86:11 + --> $DIR/empty-types.rs:85: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:95:11 + --> $DIR/empty-types.rs:94: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:101:9 + --> $DIR/empty-types.rs:100: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:105:9 + --> $DIR/empty-types.rs:104: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:131:13 + --> $DIR/empty-types.rs:130: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:134:13 + --> $DIR/empty-types.rs:133: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:155:15 + --> $DIR/empty-types.rs:154:15 | LL | match *ref_opt_void { | ^^^^^^^^^^^^^ pattern `Some(!)` not covered @@ -158,7 +158,7 @@ LL + Some(!) | error: unreachable pattern - --> $DIR/empty-types.rs:198:13 + --> $DIR/empty-types.rs:197: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:203:13 + --> $DIR/empty-types.rs:202: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:208:13 + --> $DIR/empty-types.rs:207: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:213:13 + --> $DIR/empty-types.rs:212: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:219:13 + --> $DIR/empty-types.rs:218: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:280:9 + --> $DIR/empty-types.rs:279: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:296:13 + --> $DIR/empty-types.rs:295: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:315:11 + --> $DIR/empty-types.rs:314:11 | LL | match *x {} | ^^ @@ -252,7 +252,7 @@ LL ~ } | error[E0004]: non-exhaustive patterns: type `(!, !)` is non-empty - --> $DIR/empty-types.rs:317:11 + --> $DIR/empty-types.rs:316:11 | LL | match *x {} | ^^ @@ -266,7 +266,7 @@ LL ~ } | error[E0004]: non-exhaustive patterns: `Ok(!)` and `Err(!)` not covered - --> $DIR/empty-types.rs:319:11 + --> $DIR/empty-types.rs:318:11 | LL | match *x {} | ^^ patterns `Ok(!)` and `Err(!)` not covered @@ -288,7 +288,7 @@ LL ~ } | error[E0004]: non-exhaustive patterns: type `[!; 3]` is non-empty - --> $DIR/empty-types.rs:321:11 + --> $DIR/empty-types.rs:320:11 | LL | match *x {} | ^^ @@ -302,7 +302,7 @@ LL ~ } | error[E0004]: non-exhaustive patterns: type `&[!]` is non-empty - --> $DIR/empty-types.rs:326:11 + --> $DIR/empty-types.rs:325:11 | LL | match slice_never {} | ^^^^^^^^^^^ @@ -316,7 +316,7 @@ LL ~ } | error[E0004]: non-exhaustive patterns: `&[!, ..]` not covered - --> $DIR/empty-types.rs:328:11 + --> $DIR/empty-types.rs:327:11 | LL | match slice_never { | ^^^^^^^^^^^ pattern `&[!, ..]` not covered @@ -330,7 +330,7 @@ LL + &[!, ..] | error[E0004]: non-exhaustive patterns: `&[]`, `&[!]` and `&[!, !]` not covered - --> $DIR/empty-types.rs:337:11 + --> $DIR/empty-types.rs:336:11 | LL | match slice_never { | ^^^^^^^^^^^ patterns `&[]`, `&[!]` and `&[!, !]` not covered @@ -343,7 +343,7 @@ LL + &[] | &[!] | &[!, !] => todo!() | error[E0004]: non-exhaustive patterns: `&[]` and `&[!, ..]` not covered - --> $DIR/empty-types.rs:351:11 + --> $DIR/empty-types.rs:350: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:358:11 + --> $DIR/empty-types.rs:357:11 | LL | match *slice_never {} | ^^^^^^^^^^^^ @@ -371,7 +371,7 @@ LL ~ } | error[E0004]: non-exhaustive patterns: type `[!; 0]` is non-empty - --> $DIR/empty-types.rs:387:11 + --> $DIR/empty-types.rs:386:11 | LL | match array_0_never {} | ^^^^^^^^^^^^^ @@ -385,7 +385,7 @@ LL ~ } | error: unreachable pattern - --> $DIR/empty-types.rs:394:9 + --> $DIR/empty-types.rs:393: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:396:11 + --> $DIR/empty-types.rs:395: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:450:11 + --> $DIR/empty-types.rs:449: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:491:11 + --> $DIR/empty-types.rs:490: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:539:11 + --> $DIR/empty-types.rs:538: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:550:11 + --> $DIR/empty-types.rs:549: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:569:11 + --> $DIR/empty-types.rs:568:11 | LL | match *ref_tuple_half_never {} | ^^^^^^^^^^^^^^^^^^^^^ @@ -497,7 +497,7 @@ LL ~ } | error: unreachable pattern - --> $DIR/empty-types.rs:602:9 + --> $DIR/empty-types.rs:601: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:605:9 + --> $DIR/empty-types.rs:604: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:608:9 + --> $DIR/empty-types.rs:607: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:611:9 + --> $DIR/empty-types.rs:610: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:636:11 + --> $DIR/empty-types.rs:635: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:652:11 + --> $DIR/empty-types.rs:651:11 | LL | match *ref_result_never { | ^^^^^^^^^^^^^^^^^ pattern `Ok(!)` not covered @@ -577,7 +577,7 @@ LL + Ok(!) | error[E0004]: non-exhaustive patterns: `Some(!)` not covered - --> $DIR/empty-types.rs:672:11 + --> $DIR/empty-types.rs:671: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 d8bbce98f5b70..b97173a5829fe 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:48:9 + --> $DIR/empty-types.rs:47: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:8:9 + --> $DIR/empty-types.rs:7:9 | LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ error: unreachable pattern - --> $DIR/empty-types.rs:51:9 + --> $DIR/empty-types.rs:50: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:55:11 + --> $DIR/empty-types.rs:54:11 | LL | match ref_never {} | ^^^^^^^^^ @@ -41,7 +41,7 @@ LL ~ } | error: unreachable pattern - --> $DIR/empty-types.rs:82:9 + --> $DIR/empty-types.rs:81: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:86:11 + --> $DIR/empty-types.rs:85: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:95:11 + --> $DIR/empty-types.rs:94: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:101:9 + --> $DIR/empty-types.rs:100: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:105:9 + --> $DIR/empty-types.rs:104: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:131:13 + --> $DIR/empty-types.rs:130: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:134:13 + --> $DIR/empty-types.rs:133: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:155:15 + --> $DIR/empty-types.rs:154:15 | LL | match *ref_opt_void { | ^^^^^^^^^^^^^ pattern `Some(_)` not covered @@ -158,7 +158,7 @@ LL + Some(_) => todo!() | error: unreachable pattern - --> $DIR/empty-types.rs:198:13 + --> $DIR/empty-types.rs:197: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:203:13 + --> $DIR/empty-types.rs:202: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:208:13 + --> $DIR/empty-types.rs:207: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:213:13 + --> $DIR/empty-types.rs:212: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:219:13 + --> $DIR/empty-types.rs:218: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:280:9 + --> $DIR/empty-types.rs:279: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:296:13 + --> $DIR/empty-types.rs:295: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:315:11 + --> $DIR/empty-types.rs:314:11 | LL | match *x {} | ^^ @@ -252,7 +252,7 @@ LL ~ } | error[E0004]: non-exhaustive patterns: type `(!, !)` is non-empty - --> $DIR/empty-types.rs:317:11 + --> $DIR/empty-types.rs:316:11 | LL | match *x {} | ^^ @@ -266,7 +266,7 @@ LL ~ } | error[E0004]: non-exhaustive patterns: `Ok(_)` and `Err(_)` not covered - --> $DIR/empty-types.rs:319:11 + --> $DIR/empty-types.rs:318:11 | LL | match *x {} | ^^ patterns `Ok(_)` and `Err(_)` not covered @@ -288,7 +288,7 @@ LL ~ } | error[E0004]: non-exhaustive patterns: type `[!; 3]` is non-empty - --> $DIR/empty-types.rs:321:11 + --> $DIR/empty-types.rs:320:11 | LL | match *x {} | ^^ @@ -302,7 +302,7 @@ LL ~ } | error[E0004]: non-exhaustive patterns: type `&[!]` is non-empty - --> $DIR/empty-types.rs:326:11 + --> $DIR/empty-types.rs:325:11 | LL | match slice_never {} | ^^^^^^^^^^^ @@ -316,7 +316,7 @@ LL ~ } | error[E0004]: non-exhaustive patterns: `&[_, ..]` not covered - --> $DIR/empty-types.rs:328:11 + --> $DIR/empty-types.rs:327:11 | LL | match slice_never { | ^^^^^^^^^^^ pattern `&[_, ..]` not covered @@ -330,7 +330,7 @@ LL + &[_, ..] => todo!() | error[E0004]: non-exhaustive patterns: `&[]`, `&[_]` and `&[_, _]` not covered - --> $DIR/empty-types.rs:337:11 + --> $DIR/empty-types.rs:336:11 | LL | match slice_never { | ^^^^^^^^^^^ patterns `&[]`, `&[_]` and `&[_, _]` not covered @@ -343,7 +343,7 @@ LL + &[] | &[_] | &[_, _] => todo!() | error[E0004]: non-exhaustive patterns: `&[]` and `&[_, ..]` not covered - --> $DIR/empty-types.rs:351:11 + --> $DIR/empty-types.rs:350: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:358:11 + --> $DIR/empty-types.rs:357:11 | LL | match *slice_never {} | ^^^^^^^^^^^^ @@ -371,7 +371,7 @@ LL ~ } | error[E0004]: non-exhaustive patterns: type `[!; 0]` is non-empty - --> $DIR/empty-types.rs:387:11 + --> $DIR/empty-types.rs:386:11 | LL | match array_0_never {} | ^^^^^^^^^^^^^ @@ -385,7 +385,7 @@ LL ~ } | error: unreachable pattern - --> $DIR/empty-types.rs:394:9 + --> $DIR/empty-types.rs:393: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:396:11 + --> $DIR/empty-types.rs:395: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:450:11 + --> $DIR/empty-types.rs:449: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:491:11 + --> $DIR/empty-types.rs:490: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:539:11 + --> $DIR/empty-types.rs:538: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:550:11 + --> $DIR/empty-types.rs:549: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:569:11 + --> $DIR/empty-types.rs:568:11 | LL | match *ref_tuple_half_never {} | ^^^^^^^^^^^^^^^^^^^^^ @@ -497,7 +497,7 @@ LL ~ } | error: unreachable pattern - --> $DIR/empty-types.rs:602:9 + --> $DIR/empty-types.rs:601: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:605:9 + --> $DIR/empty-types.rs:604: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:608:9 + --> $DIR/empty-types.rs:607: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:611:9 + --> $DIR/empty-types.rs:610: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:636:11 + --> $DIR/empty-types.rs:635: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:652:11 + --> $DIR/empty-types.rs:651:11 | LL | match *ref_result_never { | ^^^^^^^^^^^^^^^^^ pattern `Ok(_)` not covered @@ -577,7 +577,7 @@ LL + Ok(_) => todo!() | error[E0004]: non-exhaustive patterns: `Some(_)` not covered - --> $DIR/empty-types.rs:672:11 + --> $DIR/empty-types.rs:671:11 | LL | match *x { | ^^ pattern `Some(_)` not covered diff --git a/tests/ui/pattern/usefulness/empty-types.rs b/tests/ui/pattern/usefulness/empty-types.rs index 0a9913ff225c3..e8323ce49b78d 100644 --- a/tests/ui/pattern/usefulness/empty-types.rs +++ b/tests/ui/pattern/usefulness/empty-types.rs @@ -1,7 +1,6 @@ //@ revisions: normal exhaustive_patterns never_pats //@ edition: 2024 -#![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/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.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/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/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.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/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 a062a342dbd83..942b86ed3fb11 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/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.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_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.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_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.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_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.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_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_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/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/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 826aa76a8ef86..40bf73489eeab 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/never-assign-dead-code.stderr b/tests/ui/reachable/never-assign-dead-code.stderr index 80352b565e6c7..15fc6b7737685 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 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/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.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-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.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/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.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-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/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.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.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/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.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.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_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.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/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/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.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.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_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.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/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/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 8461b0a067ff8..ef87c98ebfae5 100644 --- a/tests/ui/scalable-vectors/illformed-element-type.rs +++ b/tests/ui/scalable-vectors/illformed-element-type.rs @@ -2,12 +2,13 @@ //@ only-aarch64 #![allow(internal_features)] #![feature(extern_types)] -#![feature(never_type)] #![feature(rustc_attrs)] 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/sized/infer_var_subtyping.rs b/tests/ui/sized/infer_var_subtyping.rs index 2535a71aac619..25457a97955b1 100644 --- a/tests/ui/sized/infer_var_subtyping.rs +++ b/tests/ui/sized/infer_var_subtyping.rs @@ -9,8 +9,6 @@ //@[next] compile-flags: -Znext-solver //@ check-pass -#![feature(never_type)] - fn blah(e: !) { let source = Box::new(e); let _: Box = source; 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.rs b/tests/ui/statics/uninhabited-static.rs index 243a525c71edf..a363a9f974c89 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/statics/uninhabited-static.stderr b/tests/ui/statics/uninhabited-static.stderr index a1f3550646357..959d21feab265 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 zero-variant enum `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 zero-variant enum `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/structs-enums/type-sizes.rs b/tests/ui/structs-enums/type-sizes.rs index af87b4cd92b72..1a619d4d01e42 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.legacy.stderr b/tests/ui/symbol-names/types.legacy.stderr index 53f0c1e576665..a9922d9a957f9 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_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:18:5 + --> $DIR/types.rs:17:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:18:5 + --> $DIR/types.rs:17:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b16Type$LT$char$GT$17h[HASH]E) - --> $DIR/types.rs:27:5 + --> $DIR/types.rs:26:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:27:5 + --> $DIR/types.rs:26:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:27:5 + --> $DIR/types.rs:26:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b14Type$LT$i8$GT$17h[HASH]E) - --> $DIR/types.rs:36:5 + --> $DIR/types.rs:35:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:36:5 + --> $DIR/types.rs:35:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:36:5 + --> $DIR/types.rs:35:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b15Type$LT$i16$GT$17h[HASH]E) - --> $DIR/types.rs:45:5 + --> $DIR/types.rs:44:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:45:5 + --> $DIR/types.rs:44:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:45:5 + --> $DIR/types.rs:44:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b15Type$LT$i32$GT$17h[HASH]E) - --> $DIR/types.rs:54:5 + --> $DIR/types.rs:53:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:54:5 + --> $DIR/types.rs:53:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:54:5 + --> $DIR/types.rs:53:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b15Type$LT$i64$GT$17h[HASH]E) - --> $DIR/types.rs:63:5 + --> $DIR/types.rs:62:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:63:5 + --> $DIR/types.rs:62:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:63:5 + --> $DIR/types.rs:62:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b14Type$LT$u8$GT$17h[HASH]E) - --> $DIR/types.rs:72:5 + --> $DIR/types.rs:71:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:72:5 + --> $DIR/types.rs:71:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:72:5 + --> $DIR/types.rs:71:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b15Type$LT$u16$GT$17h[HASH]E) - --> $DIR/types.rs:81:5 + --> $DIR/types.rs:80:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:81:5 + --> $DIR/types.rs:80:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:81:5 + --> $DIR/types.rs:80:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b15Type$LT$u32$GT$17h[HASH]E) - --> $DIR/types.rs:90:5 + --> $DIR/types.rs:89:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:90:5 + --> $DIR/types.rs:89:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:90:5 + --> $DIR/types.rs:89:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b15Type$LT$u64$GT$17h[HASH]E) - --> $DIR/types.rs:99:5 + --> $DIR/types.rs:98:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:99:5 + --> $DIR/types.rs:98:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:99:5 + --> $DIR/types.rs:98:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b15Type$LT$f16$GT$17h[HASH]E) - --> $DIR/types.rs:108:5 + --> $DIR/types.rs:107:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:108:5 + --> $DIR/types.rs:107:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:108:5 + --> $DIR/types.rs:107:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b15Type$LT$f32$GT$17h[HASH]E) - --> $DIR/types.rs:117:5 + --> $DIR/types.rs:116:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:117:5 + --> $DIR/types.rs:116:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:117:5 + --> $DIR/types.rs:116:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b15Type$LT$f64$GT$17h[HASH]E) - --> $DIR/types.rs:126:5 + --> $DIR/types.rs:125:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:126:5 + --> $DIR/types.rs:125:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:126:5 + --> $DIR/types.rs:125:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b16Type$LT$f128$GT$17h[HASH]E) - --> $DIR/types.rs:135:5 + --> $DIR/types.rs:134:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:135:5 + --> $DIR/types.rs:134:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:135:5 + --> $DIR/types.rs:134:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b15Type$LT$str$GT$17h[HASH]E) - --> $DIR/types.rs:144:5 + --> $DIR/types.rs:143:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:144:5 + --> $DIR/types.rs:143:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:144:5 + --> $DIR/types.rs:143:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b17Type$LT$$u21$$GT$17h[HASH]E) - --> $DIR/types.rs:153:5 + --> $DIR/types.rs:152:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:153:5 + --> $DIR/types.rs:152:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:153:5 + --> $DIR/types.rs:152:5 | LL | #[rustc_dump_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_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type<()>::h[HASH]) - --> $DIR/types.rs:162:5 + --> $DIR/types.rs:161:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type<()>) - --> $DIR/types.rs:162:5 + --> $DIR/types.rs:161:5 | LL | #[rustc_dump_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_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type<(u8,)>::h[HASH]) - --> $DIR/types.rs:171:5 + --> $DIR/types.rs:170:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type<(u8,)>) - --> $DIR/types.rs:171:5 + --> $DIR/types.rs:170:5 | LL | #[rustc_dump_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_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type<(u8,u16)>::h[HASH]) - --> $DIR/types.rs:180:5 + --> $DIR/types.rs:179:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type<(u8,u16)>) - --> $DIR/types.rs:180:5 + --> $DIR/types.rs:179:5 | LL | #[rustc_dump_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_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type<(u8,u16,u32)>::h[HASH]) - --> $DIR/types.rs:189:5 + --> $DIR/types.rs:188:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type<(u8,u16,u32)>) - --> $DIR/types.rs:189:5 + --> $DIR/types.rs:188:5 | LL | #[rustc_dump_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_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type<*const u8>::h[HASH]) - --> $DIR/types.rs:198:5 + --> $DIR/types.rs:197:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type<*const u8>) - --> $DIR/types.rs:198:5 + --> $DIR/types.rs:197:5 | LL | #[rustc_dump_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_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type<*mut u8>::h[HASH]) - --> $DIR/types.rs:207:5 + --> $DIR/types.rs:206:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type<*mut u8>) - --> $DIR/types.rs:207:5 + --> $DIR/types.rs:206:5 | LL | #[rustc_dump_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_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type<&str>::h[HASH]) - --> $DIR/types.rs:216:5 + --> $DIR/types.rs:215:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type<&str>) - --> $DIR/types.rs:216:5 + --> $DIR/types.rs:215:5 | LL | #[rustc_dump_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_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type<&mut str>::h[HASH]) - --> $DIR/types.rs:225:5 + --> $DIR/types.rs:224:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type<&mut str>) - --> $DIR/types.rs:225:5 + --> $DIR/types.rs:224:5 | LL | #[rustc_dump_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_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type<[u8; 0]>::h[HASH]) - --> $DIR/types.rs:234:5 + --> $DIR/types.rs:233:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type<[u8; 0]>) - --> $DIR/types.rs:234:5 + --> $DIR/types.rs:233:5 | LL | #[rustc_dump_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_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:243:5 + --> $DIR/types.rs:242:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:243:5 + --> $DIR/types.rs:242:5 | LL | #[rustc_dump_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_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:252:5 + --> $DIR/types.rs:251:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:252:5 + --> $DIR/types.rs:251:5 | LL | #[rustc_dump_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_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type<[T; N]>::h[HASH]) - --> $DIR/types.rs:261:5 + --> $DIR/types.rs:260:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type<[T; N]>) - --> $DIR/types.rs:261:5 + --> $DIR/types.rs:260:5 | LL | #[rustc_dump_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_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type<[u8; 0]>::h[HASH]) - --> $DIR/types.rs:272:5 + --> $DIR/types.rs:271:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type<[u8; 0]>) - --> $DIR/types.rs:272:5 + --> $DIR/types.rs:271:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/symbol-names/types.rs b/tests/ui/symbol-names/types.rs index 9dc7cad33cb0d..f1789cba6abe6 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/symbol-names/types.v0.stderr b/tests/ui/symbol-names/types.v0.stderr index 36e0306c18b4d..4ac96ca19a53a 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_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:18:5 + --> $DIR/types.rs:17:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:18:5 + --> $DIR/types.rs:17:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMs_NvCsCRATE_HASH_1a1bINtB_4TypecE) - --> $DIR/types.rs:27:5 + --> $DIR/types.rs:26:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:27:5 + --> $DIR/types.rs:26:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:27:5 + --> $DIR/types.rs:26:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMs0_NvCsCRATE_HASH_1a1bINtB_4TypeaE) - --> $DIR/types.rs:36:5 + --> $DIR/types.rs:35:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:36:5 + --> $DIR/types.rs:35:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:36:5 + --> $DIR/types.rs:35:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMs1_NvCsCRATE_HASH_1a1bINtB_4TypesE) - --> $DIR/types.rs:45:5 + --> $DIR/types.rs:44:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:45:5 + --> $DIR/types.rs:44:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:45:5 + --> $DIR/types.rs:44:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMs2_NvCsCRATE_HASH_1a1bINtB_4TypelE) - --> $DIR/types.rs:54:5 + --> $DIR/types.rs:53:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:54:5 + --> $DIR/types.rs:53:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:54:5 + --> $DIR/types.rs:53:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMs3_NvCsCRATE_HASH_1a1bINtB_4TypexE) - --> $DIR/types.rs:63:5 + --> $DIR/types.rs:62:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:63:5 + --> $DIR/types.rs:62:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:63:5 + --> $DIR/types.rs:62:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMs4_NvCsCRATE_HASH_1a1bINtB_4TypehE) - --> $DIR/types.rs:72:5 + --> $DIR/types.rs:71:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:72:5 + --> $DIR/types.rs:71:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:72:5 + --> $DIR/types.rs:71:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMs5_NvCsCRATE_HASH_1a1bINtB_4TypetE) - --> $DIR/types.rs:81:5 + --> $DIR/types.rs:80:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:81:5 + --> $DIR/types.rs:80:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:81:5 + --> $DIR/types.rs:80:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMs6_NvCsCRATE_HASH_1a1bINtB_4TypemE) - --> $DIR/types.rs:90:5 + --> $DIR/types.rs:89:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:90:5 + --> $DIR/types.rs:89:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:90:5 + --> $DIR/types.rs:89:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMs7_NvCsCRATE_HASH_1a1bINtB_4TypeyE) - --> $DIR/types.rs:99:5 + --> $DIR/types.rs:98:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:99:5 + --> $DIR/types.rs:98:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:99:5 + --> $DIR/types.rs:98:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMs8_NvCsCRATE_HASH_1a1bINtB_4TypeC3f16E) - --> $DIR/types.rs:108:5 + --> $DIR/types.rs:107:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:108:5 + --> $DIR/types.rs:107:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:108:5 + --> $DIR/types.rs:107:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMs9_NvCsCRATE_HASH_1a1bINtB_4TypefE) - --> $DIR/types.rs:117:5 + --> $DIR/types.rs:116:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:117:5 + --> $DIR/types.rs:116:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:117:5 + --> $DIR/types.rs:116:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMsa_NvCsCRATE_HASH_1a1bINtB_4TypedE) - --> $DIR/types.rs:126:5 + --> $DIR/types.rs:125:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:126:5 + --> $DIR/types.rs:125:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:126:5 + --> $DIR/types.rs:125:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMsb_NvCsCRATE_HASH_1a1bINtB_4TypeC4f128E) - --> $DIR/types.rs:135:5 + --> $DIR/types.rs:134:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:135:5 + --> $DIR/types.rs:134:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:135:5 + --> $DIR/types.rs:134:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMsc_NvCsCRATE_HASH_1a1bINtB_4TypeeE) - --> $DIR/types.rs:144:5 + --> $DIR/types.rs:143:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:144:5 + --> $DIR/types.rs:143:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:144:5 + --> $DIR/types.rs:143:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMsd_NvCsCRATE_HASH_1a1bINtB_4TypezE) - --> $DIR/types.rs:153:5 + --> $DIR/types.rs:152:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:153:5 + --> $DIR/types.rs:152:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:153:5 + --> $DIR/types.rs:152:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMse_NvCsCRATE_HASH_1a1bINtB_4TypeuE) - --> $DIR/types.rs:162:5 + --> $DIR/types.rs:161:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:162:5 + --> $DIR/types.rs:161:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:162:5 + --> $DIR/types.rs:161:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMsf_NvCsCRATE_HASH_1a1bINtB_4TypeThEE) - --> $DIR/types.rs:171:5 + --> $DIR/types.rs:170:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:171:5 + --> $DIR/types.rs:170:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:171:5 + --> $DIR/types.rs:170:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMsg_NvCsCRATE_HASH_1a1bINtB_4TypeThtEE) - --> $DIR/types.rs:180:5 + --> $DIR/types.rs:179:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:180:5 + --> $DIR/types.rs:179:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:180:5 + --> $DIR/types.rs:179:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMsh_NvCsCRATE_HASH_1a1bINtB_4TypeThtmEE) - --> $DIR/types.rs:189:5 + --> $DIR/types.rs:188:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:189:5 + --> $DIR/types.rs:188:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:189:5 + --> $DIR/types.rs:188:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMsi_NvCsCRATE_HASH_1a1bINtB_4TypePhE) - --> $DIR/types.rs:198:5 + --> $DIR/types.rs:197:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:198:5 + --> $DIR/types.rs:197:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:198:5 + --> $DIR/types.rs:197:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMsj_NvCsCRATE_HASH_1a1bINtB_4TypeOhE) - --> $DIR/types.rs:207:5 + --> $DIR/types.rs:206:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:207:5 + --> $DIR/types.rs:206:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:207:5 + --> $DIR/types.rs:206:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMsk_NvCsCRATE_HASH_1a1bINtB_4TypeReE) - --> $DIR/types.rs:216:5 + --> $DIR/types.rs:215:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:216:5 + --> $DIR/types.rs:215:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:216:5 + --> $DIR/types.rs:215:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMsl_NvCsCRATE_HASH_1a1bINtB_4TypeQeE) - --> $DIR/types.rs:225:5 + --> $DIR/types.rs:224:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:225:5 + --> $DIR/types.rs:224:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:225:5 + --> $DIR/types.rs:224:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMsm_NvCsCRATE_HASH_1a1bINtB_4TypeAhj0_E) - --> $DIR/types.rs:234:5 + --> $DIR/types.rs:233:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:234:5 + --> $DIR/types.rs:233:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:234:5 + --> $DIR/types.rs:233:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMsn_NvCsCRATE_HASH_1a1bINtB_4TypeFEuE) - --> $DIR/types.rs:243:5 + --> $DIR/types.rs:242:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:243:5 + --> $DIR/types.rs:242:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:243:5 + --> $DIR/types.rs:242:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMso_NvCsCRATE_HASH_1a1bINtB_4TypeFUKCEuE) - --> $DIR/types.rs:252:5 + --> $DIR/types.rs:251:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:252:5 + --> $DIR/types.rs:251:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:252:5 + --> $DIR/types.rs:251:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMsp_NvCsCRATE_HASH_1a1bINtB_4TypeAppEB_) - --> $DIR/types.rs:261:5 + --> $DIR/types.rs:260:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:261:5 + --> $DIR/types.rs:260:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:261:5 + --> $DIR/types.rs:260:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_RMsq_NvCsCRATE_HASH_1a1bINtB_4TypeAhj0_E) - --> $DIR/types.rs:272:5 + --> $DIR/types.rs:271:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(>) - --> $DIR/types.rs:272:5 + --> $DIR/types.rs:271:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(>) - --> $DIR/types.rs:272:5 + --> $DIR/types.rs:271:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/symbol-names/types.verbose-legacy.stderr b/tests/ui/symbol-names/types.verbose-legacy.stderr index 53f0c1e576665..a9922d9a957f9 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_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:18:5 + --> $DIR/types.rs:17:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:18:5 + --> $DIR/types.rs:17:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b16Type$LT$char$GT$17h[HASH]E) - --> $DIR/types.rs:27:5 + --> $DIR/types.rs:26:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:27:5 + --> $DIR/types.rs:26:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:27:5 + --> $DIR/types.rs:26:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b14Type$LT$i8$GT$17h[HASH]E) - --> $DIR/types.rs:36:5 + --> $DIR/types.rs:35:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:36:5 + --> $DIR/types.rs:35:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:36:5 + --> $DIR/types.rs:35:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b15Type$LT$i16$GT$17h[HASH]E) - --> $DIR/types.rs:45:5 + --> $DIR/types.rs:44:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:45:5 + --> $DIR/types.rs:44:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:45:5 + --> $DIR/types.rs:44:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b15Type$LT$i32$GT$17h[HASH]E) - --> $DIR/types.rs:54:5 + --> $DIR/types.rs:53:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:54:5 + --> $DIR/types.rs:53:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:54:5 + --> $DIR/types.rs:53:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b15Type$LT$i64$GT$17h[HASH]E) - --> $DIR/types.rs:63:5 + --> $DIR/types.rs:62:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:63:5 + --> $DIR/types.rs:62:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:63:5 + --> $DIR/types.rs:62:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b14Type$LT$u8$GT$17h[HASH]E) - --> $DIR/types.rs:72:5 + --> $DIR/types.rs:71:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:72:5 + --> $DIR/types.rs:71:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:72:5 + --> $DIR/types.rs:71:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b15Type$LT$u16$GT$17h[HASH]E) - --> $DIR/types.rs:81:5 + --> $DIR/types.rs:80:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:81:5 + --> $DIR/types.rs:80:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:81:5 + --> $DIR/types.rs:80:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b15Type$LT$u32$GT$17h[HASH]E) - --> $DIR/types.rs:90:5 + --> $DIR/types.rs:89:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:90:5 + --> $DIR/types.rs:89:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:90:5 + --> $DIR/types.rs:89:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b15Type$LT$u64$GT$17h[HASH]E) - --> $DIR/types.rs:99:5 + --> $DIR/types.rs:98:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:99:5 + --> $DIR/types.rs:98:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:99:5 + --> $DIR/types.rs:98:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b15Type$LT$f16$GT$17h[HASH]E) - --> $DIR/types.rs:108:5 + --> $DIR/types.rs:107:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:108:5 + --> $DIR/types.rs:107:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:108:5 + --> $DIR/types.rs:107:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b15Type$LT$f32$GT$17h[HASH]E) - --> $DIR/types.rs:117:5 + --> $DIR/types.rs:116:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:117:5 + --> $DIR/types.rs:116:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:117:5 + --> $DIR/types.rs:116:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b15Type$LT$f64$GT$17h[HASH]E) - --> $DIR/types.rs:126:5 + --> $DIR/types.rs:125:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:126:5 + --> $DIR/types.rs:125:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:126:5 + --> $DIR/types.rs:125:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b16Type$LT$f128$GT$17h[HASH]E) - --> $DIR/types.rs:135:5 + --> $DIR/types.rs:134:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:135:5 + --> $DIR/types.rs:134:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:135:5 + --> $DIR/types.rs:134:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b15Type$LT$str$GT$17h[HASH]E) - --> $DIR/types.rs:144:5 + --> $DIR/types.rs:143:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:144:5 + --> $DIR/types.rs:143:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:144:5 + --> $DIR/types.rs:143:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN1a1b17Type$LT$$u21$$GT$17h[HASH]E) - --> $DIR/types.rs:153:5 + --> $DIR/types.rs:152:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:153:5 + --> $DIR/types.rs:152:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:153:5 + --> $DIR/types.rs:152:5 | LL | #[rustc_dump_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_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type<()>::h[HASH]) - --> $DIR/types.rs:162:5 + --> $DIR/types.rs:161:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type<()>) - --> $DIR/types.rs:162:5 + --> $DIR/types.rs:161:5 | LL | #[rustc_dump_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_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type<(u8,)>::h[HASH]) - --> $DIR/types.rs:171:5 + --> $DIR/types.rs:170:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type<(u8,)>) - --> $DIR/types.rs:171:5 + --> $DIR/types.rs:170:5 | LL | #[rustc_dump_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_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type<(u8,u16)>::h[HASH]) - --> $DIR/types.rs:180:5 + --> $DIR/types.rs:179:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type<(u8,u16)>) - --> $DIR/types.rs:180:5 + --> $DIR/types.rs:179:5 | LL | #[rustc_dump_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_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type<(u8,u16,u32)>::h[HASH]) - --> $DIR/types.rs:189:5 + --> $DIR/types.rs:188:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type<(u8,u16,u32)>) - --> $DIR/types.rs:189:5 + --> $DIR/types.rs:188:5 | LL | #[rustc_dump_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_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type<*const u8>::h[HASH]) - --> $DIR/types.rs:198:5 + --> $DIR/types.rs:197:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type<*const u8>) - --> $DIR/types.rs:198:5 + --> $DIR/types.rs:197:5 | LL | #[rustc_dump_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_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type<*mut u8>::h[HASH]) - --> $DIR/types.rs:207:5 + --> $DIR/types.rs:206:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type<*mut u8>) - --> $DIR/types.rs:207:5 + --> $DIR/types.rs:206:5 | LL | #[rustc_dump_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_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type<&str>::h[HASH]) - --> $DIR/types.rs:216:5 + --> $DIR/types.rs:215:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type<&str>) - --> $DIR/types.rs:216:5 + --> $DIR/types.rs:215:5 | LL | #[rustc_dump_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_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type<&mut str>::h[HASH]) - --> $DIR/types.rs:225:5 + --> $DIR/types.rs:224:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type<&mut str>) - --> $DIR/types.rs:225:5 + --> $DIR/types.rs:224:5 | LL | #[rustc_dump_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_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type<[u8; 0]>::h[HASH]) - --> $DIR/types.rs:234:5 + --> $DIR/types.rs:233:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type<[u8; 0]>) - --> $DIR/types.rs:234:5 + --> $DIR/types.rs:233:5 | LL | #[rustc_dump_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_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:243:5 + --> $DIR/types.rs:242:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:243:5 + --> $DIR/types.rs:242:5 | LL | #[rustc_dump_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_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type::h[HASH]) - --> $DIR/types.rs:252:5 + --> $DIR/types.rs:251:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type) - --> $DIR/types.rs:252:5 + --> $DIR/types.rs:251:5 | LL | #[rustc_dump_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_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type<[T; N]>::h[HASH]) - --> $DIR/types.rs:261:5 + --> $DIR/types.rs:260:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type<[T; N]>) - --> $DIR/types.rs:261:5 + --> $DIR/types.rs:260:5 | LL | #[rustc_dump_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_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling(a::b::Type<[u8; 0]>::h[HASH]) - --> $DIR/types.rs:272:5 + --> $DIR/types.rs:271:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(a::b::Type<[u8; 0]>) - --> $DIR/types.rs:272:5 + --> $DIR/types.rs:271:5 | LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/traits/const-traits/const-drop.rs b/tests/ui/traits/const-traits/const-drop.rs index 00f7affd1851b..851d73b343f2f 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/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/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/traits/projection-no-progress-cycle-issue-159750.rs b/tests/ui/traits/projection-no-progress-cycle-issue-159750.rs index bfb793e7f7046..0b16ab4a482a6 100644 --- a/tests/ui/traits/projection-no-progress-cycle-issue-159750.rs +++ b/tests/ui/traits/projection-no-progress-cycle-issue-159750.rs @@ -20,7 +20,7 @@ trait Queryable { } fn follow() -> impl Queryable> { - //~^ ERROR the trait bound `(): Queryable` is not satisfied + //~^ ERROR the trait bound `!: Queryable` is not satisfied loop {} } diff --git a/tests/ui/traits/projection-no-progress-cycle-issue-159750.stderr b/tests/ui/traits/projection-no-progress-cycle-issue-159750.stderr index 6c9c76d6bd5d4..d69f85742a9d9 100644 --- a/tests/ui/traits/projection-no-progress-cycle-issue-159750.stderr +++ b/tests/ui/traits/projection-no-progress-cycle-issue-159750.stderr @@ -9,11 +9,14 @@ help: consider further restricting the associated type LL | fn finish(&self) -> >::IDContainer where ::Container: Container<::Output>; | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -error[E0277]: the trait bound `(): Queryable` is not satisfied +error[E0277]: the trait bound `!: Queryable` is not satisfied --> $DIR/projection-no-progress-cycle-issue-159750.rs:22:19 | LL | fn follow() -> impl Queryable> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Queryable` is not implemented for `()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Queryable` is not implemented for `!` +LL | +LL | loop {} + | ------- return type was inferred to be `!` here | help: this trait has no implementations, consider adding one --> $DIR/projection-no-progress-cycle-issue-159750.rs:14:1 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/traits/reservation-impl/non-lattice-ok.rs b/tests/ui/traits/reservation-impl/non-lattice-ok.rs index 32d610bf915aa..93dab111891c0 100644 --- a/tests/ui/traits/reservation-impl/non-lattice-ok.rs +++ b/tests/ui/traits/reservation-impl/non-lattice-ok.rs @@ -30,13 +30,12 @@ // // [ii]: https://smallcultfollowing.com/babysteps/blog/2016/09/24/intersection-impls/ - // check that reservation impls can't be used as normal impls in positive reasoning. //@ revisions: old next //@[next] compile-flags: -Znext-solver -#![feature(rustc_attrs, never_type)] +#![feature(rustc_attrs)] trait MyTrait {} @@ -47,19 +46,25 @@ trait MyFrom { } // Given the "normal" impls for From -#[rustc_reservation_impl="this impl is reserved"] +#[rustc_reservation_impl = "this impl is reserved"] impl MyFrom for T { - fn my_from(x: !) -> Self { match x {} } + fn my_from(x: !) -> Self { + match x {} + } } impl MyFrom for T { - fn my_from(x: T) -> Self { x } + fn my_from(x: T) -> Self { + x + } } // ... we *do* want to allow this common pattern, of `From for MySmaht` struct MySmaht(T); impl MyFrom for MySmaht { - fn my_from(x: T) -> Self { MySmaht(x) } + fn my_from(x: T) -> Self { + MySmaht(x) + } } fn main() {} 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/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/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 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/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.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-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-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.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/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 7d886056098aa..9d5c35dc31661 100644 --- a/tests/ui/uninhabited/void-branch.stderr +++ b/tests/ui/uninhabited/void-branch.stderr @@ -1,11 +1,10 @@ error: unreachable expression - --> $DIR/void-branch.rs:33:5 + --> $DIR/void-branch.rs:25:9 | -LL | (x, loop {}) - | ^^^^-------^ - | | | - | | any code following this expression is unreachable - | unreachable expression +LL | infallible(); + | ------------ any code following this expression is unreachable +LL | println!() + | ^^^^^^^^^^ unreachable expression | note: the lint level is defined here --> $DIR/void-branch.rs:1:9 @@ -13,6 +12,15 @@ note: the lint level is defined here LL | #![deny(unreachable_code)] | ^^^^^^^^^^^^^^^^ +error: unreachable expression + --> $DIR/void-branch.rs:33:5 + | +LL | (x, loop {}) + | ^^^^-------^ + | | | + | | any code following this expression is unreachable + | unreachable expression + error: unreachable expression --> $DIR/void-branch.rs:10:13 | @@ -27,19 +35,5 @@ note: this expression has type `Void`, which is uninhabited LL | std::mem::uninitialized::(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: unreachable expression - --> $DIR/void-branch.rs:25:9 - | -LL | infallible(); - | ------------ 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 - | -LL | infallible(); - | ^^^^^^^^^^^^ - error: aborting due to 3 previous errors diff --git a/tests/ui/unpretty/exhaustive.expanded.stdout b/tests/ui/unpretty/exhaustive.expanded.stdout index 17995cabc75a7..513c402649858 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.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 78403e1704dca..2d3a15ea57052 100644 --- a/tests/ui/unpretty/exhaustive.hir.stdout +++ b/tests/ui/unpretty/exhaustive.hir.stdout @@ -12,9 +12,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])] extern crate std; #[attr = PreludeImport] use std::prelude::rust_2024::*; diff --git a/tests/ui/unpretty/exhaustive.rs b/tests/ui/unpretty/exhaustive.rs index 462429ea8e27e..18470eacfe23b 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)]