Rollup merge of #65355 - Centril:almost-is-never-enough, r=oli-obk
Stabilize `!` in Rust 1.41.0 This PR stabilizes the `never_type` (written `!`). The type represents computations that we know diverge in the type system and therefore has no values / inhabitants / elements / members. The current nightly version is 1.40.0 which will become stable on 2019-12-19. Tracking issue: https://github.com/rust-lang/rust/issues/35121. Closes https://github.com/rust-lang/rust/issues/57012. Closes https://github.com/rust-lang/rust/issues/58184. Original stabilization report: https://github.com/rust-lang/rust/issues/57012#issuecomment-452398538 Additional notes: - In #62661 we reserved `impl<T> From<!> for T` so this concern should be resolved. - The type inference fallback change is moved to `#![feature(never_type_fallback)]` (https://github.com/rust-lang/rust/issues/65992). - You can find all of the tests referencing `never_type` in this PR which also reorganizes these tests whereas they were more scattered before. r? @nikomatsakis
This commit is contained in:
commit
0828d5327b
120 changed files with 205 additions and 415 deletions
|
|
@ -185,7 +185,7 @@ mod impls {
|
|||
bool char
|
||||
}
|
||||
|
||||
#[unstable(feature = "never_type", issue = "35121")]
|
||||
#[stable(feature = "never_type", since = "1.41.0")]
|
||||
impl Clone for ! {
|
||||
#[inline]
|
||||
fn clone(&self) -> Self {
|
||||
|
|
|
|||
|
|
@ -1128,24 +1128,24 @@ 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 = "1.41.0")]
|
||||
impl PartialEq for ! {
|
||||
fn eq(&self, _: &!) -> bool {
|
||||
*self
|
||||
}
|
||||
}
|
||||
|
||||
#[unstable(feature = "never_type", issue = "35121")]
|
||||
#[stable(feature = "never_type", since = "1.41.0")]
|
||||
impl Eq for ! {}
|
||||
|
||||
#[unstable(feature = "never_type", issue = "35121")]
|
||||
#[stable(feature = "never_type", since = "1.41.0")]
|
||||
impl PartialOrd for ! {
|
||||
fn partial_cmp(&self, _: &!) -> Option<Ordering> {
|
||||
*self
|
||||
}
|
||||
}
|
||||
|
||||
#[unstable(feature = "never_type", issue = "35121")]
|
||||
#[stable(feature = "never_type", since = "1.41.0")]
|
||||
impl Ord for ! {
|
||||
fn cmp(&self, _: &!) -> Ordering {
|
||||
*self
|
||||
|
|
|
|||
|
|
@ -40,8 +40,6 @@
|
|||
|
||||
#![stable(feature = "rust1", since = "1.0.0")]
|
||||
|
||||
use crate::fmt;
|
||||
|
||||
/// The identity function.
|
||||
///
|
||||
/// Two things are important to note about this function:
|
||||
|
|
@ -426,9 +424,7 @@ pub trait TryInto<T>: Sized {
|
|||
/// - `TryFrom<T> for U` implies [`TryInto`]`<U> for T`
|
||||
/// - [`try_from`] is reflexive, which means that `TryFrom<T> for T`
|
||||
/// is implemented and cannot fail -- the associated `Error` type for
|
||||
/// calling `T::try_from()` on a value of type `T` is [`Infallible`].
|
||||
/// When the [`!`] type is stabilized [`Infallible`] and [`!`] will be
|
||||
/// equivalent.
|
||||
/// calling `T::try_from()` on a value of type `T` is [`!`].
|
||||
///
|
||||
/// `TryFrom<T>` can be implemented as follows:
|
||||
///
|
||||
|
|
@ -477,7 +473,6 @@ pub trait TryInto<T>: Sized {
|
|||
/// [`TryInto`]: trait.TryInto.html
|
||||
/// [`i32::MAX`]: ../../std/i32/constant.MAX.html
|
||||
/// [`!`]: ../../std/primitive.never.html
|
||||
/// [`Infallible`]: enum.Infallible.html
|
||||
#[stable(feature = "try_from", since = "1.34.0")]
|
||||
pub trait TryFrom<T>: Sized {
|
||||
/// The type returned in the event of a conversion error.
|
||||
|
|
@ -615,9 +610,9 @@ impl AsRef<str> for str {
|
|||
// THE NO-ERROR ERROR TYPE
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/// The error type for errors that can never happen.
|
||||
/// A type alias for [the `!` “never” type][never].
|
||||
///
|
||||
/// Since this enum has no variant, a value of this type can never actually exist.
|
||||
/// `Infallible` represents types of errors that can never happen since `!` has no valid values.
|
||||
/// This can be useful for generic APIs that use [`Result`] and parameterize the error type,
|
||||
/// to indicate that the result is always [`Ok`].
|
||||
///
|
||||
|
|
@ -634,33 +629,10 @@ impl AsRef<str> for str {
|
|||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// # Future compatibility
|
||||
/// # Eventual deprecation
|
||||
///
|
||||
/// 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-fleged type: in the position of a function’s return type.
|
||||
/// Specifically, it is possible 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.
|
||||
/// Previously, `Infallible` was defined as `enum Infallible {}`.
|
||||
/// Now that it is merely a type alias to `!`, we will eventually deprecate `Infallible`.
|
||||
///
|
||||
/// [`Ok`]: ../result/enum.Result.html#variant.Ok
|
||||
/// [`Result`]: ../result/enum.Result.html
|
||||
|
|
@ -668,57 +640,4 @@ impl AsRef<str> for str {
|
|||
/// [`Into`]: trait.Into.html
|
||||
/// [never]: ../../std/primitive.never.html
|
||||
#[stable(feature = "convert_infallible", since = "1.34.0")]
|
||||
#[derive(Copy)]
|
||||
pub enum Infallible {}
|
||||
|
||||
#[stable(feature = "convert_infallible", since = "1.34.0")]
|
||||
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 = "convert_infallible", since = "1.34.0")]
|
||||
impl PartialEq for Infallible {
|
||||
fn eq(&self, _: &Infallible) -> bool {
|
||||
match *self {}
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "convert_infallible", since = "1.34.0")]
|
||||
impl Eq for Infallible {}
|
||||
|
||||
#[stable(feature = "convert_infallible", since = "1.34.0")]
|
||||
impl PartialOrd for Infallible {
|
||||
fn partial_cmp(&self, _other: &Self) -> Option<crate::cmp::Ordering> {
|
||||
match *self {}
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "convert_infallible", since = "1.34.0")]
|
||||
impl Ord for Infallible {
|
||||
fn cmp(&self, _other: &Self) -> crate::cmp::Ordering {
|
||||
match *self {}
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "convert_infallible", since = "1.34.0")]
|
||||
impl From<!> for Infallible {
|
||||
fn from(x: !) -> Self {
|
||||
x
|
||||
}
|
||||
}
|
||||
pub type Infallible = !;
|
||||
|
|
|
|||
|
|
@ -1935,14 +1935,14 @@ 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 = "1.41.0")]
|
||||
impl Debug for ! {
|
||||
fn fmt(&self, _: &mut Formatter<'_>) -> Result {
|
||||
*self
|
||||
}
|
||||
}
|
||||
|
||||
#[unstable(feature = "never_type", issue = "35121")]
|
||||
#[stable(feature = "never_type", since = "1.41.0")]
|
||||
impl Display for ! {
|
||||
fn fmt(&self, _: &mut Formatter<'_>) -> Result {
|
||||
*self
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@
|
|||
#![feature(iter_once_with)]
|
||||
#![feature(lang_items)]
|
||||
#![feature(link_llvm_intrinsics)]
|
||||
#![feature(never_type)]
|
||||
#![cfg_attr(bootstrap, feature(never_type))]
|
||||
#![feature(nll)]
|
||||
#![feature(exhaustive_patterns)]
|
||||
#![feature(no_core)]
|
||||
|
|
|
|||
|
|
@ -774,7 +774,7 @@ mod copy_impls {
|
|||
bool char
|
||||
}
|
||||
|
||||
#[unstable(feature = "never_type", issue = "35121")]
|
||||
#[stable(feature = "never_type", since = "1.41.0")]
|
||||
impl Copy for ! {}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#![stable(feature = "rust1", since = "1.0.0")]
|
||||
|
||||
use crate::convert::{TryFrom, Infallible};
|
||||
use crate::convert::TryFrom;
|
||||
use crate::fmt;
|
||||
use crate::intrinsics;
|
||||
use crate::mem;
|
||||
|
|
@ -4722,18 +4722,8 @@ impl fmt::Display for TryFromIntError {
|
|||
}
|
||||
|
||||
#[stable(feature = "try_from", since = "1.34.0")]
|
||||
impl From<Infallible> for TryFromIntError {
|
||||
fn from(x: Infallible) -> TryFromIntError {
|
||||
match x {}
|
||||
}
|
||||
}
|
||||
|
||||
#[unstable(feature = "never_type", issue = "35121")]
|
||||
impl From<!> for TryFromIntError {
|
||||
fn from(never: !) -> TryFromIntError {
|
||||
// Match rather than coerce to make sure that code like
|
||||
// `From<Infallible> for TryFromIntError` above will keep working
|
||||
// when `Infallible` becomes an alias to `!`.
|
||||
match never {}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
#![feature(core_intrinsics)]
|
||||
#![feature(drain_filter)]
|
||||
#![cfg_attr(windows, feature(libc))]
|
||||
#![feature(never_type)]
|
||||
#![cfg_attr(bootstrap, feature(never_type))]
|
||||
#![feature(exhaustive_patterns)]
|
||||
#![feature(overlapping_marker_traits)]
|
||||
#![feature(extern_types)]
|
||||
|
|
|
|||
|
|
@ -2440,10 +2440,10 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
|
||||
#[inline]
|
||||
pub fn mk_diverging_default(self) -> Ty<'tcx> {
|
||||
if self.features().never_type {
|
||||
if self.features().never_type_fallback {
|
||||
self.types.never
|
||||
} else {
|
||||
self.intern_tup(&[])
|
||||
self.types.unit
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
#![feature(box_patterns)]
|
||||
#![feature(box_syntax)]
|
||||
#![feature(core_intrinsics)]
|
||||
#![feature(never_type)]
|
||||
#![cfg_attr(bootstrap, feature(never_type))]
|
||||
#![feature(nll)]
|
||||
#![feature(in_band_lifetimes)]
|
||||
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ 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(specialization)] // error: the feature `specialization` is not in
|
||||
// the list of allowed features
|
||||
```
|
||||
|
||||
Delete the offending feature attribute, or add it to the list of allowed
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
|
|||
#![feature(decl_macro)]
|
||||
#![feature(drain_filter)]
|
||||
#![feature(exhaustive_patterns)]
|
||||
#![feature(never_type)]
|
||||
#![cfg_attr(bootstrap, feature(never_type))]
|
||||
#![feature(specialization)]
|
||||
#![feature(try_trait)]
|
||||
#![feature(unicode_internals)]
|
||||
|
|
|
|||
|
|
@ -3129,9 +3129,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
}
|
||||
|
||||
// Tries to apply a fallback to `ty` if it is an unsolved variable.
|
||||
// Non-numerics get replaced with ! or () (depending on whether
|
||||
// feature(never_type) is enabled, unconstrained ints with i32,
|
||||
// unconstrained floats with f64.
|
||||
//
|
||||
// - Unconstrained ints are replaced with `i32`.
|
||||
//
|
||||
// - Unconstrained floats are replaced with with `f64`.
|
||||
//
|
||||
// - Non-numerics get replaced with `!` when `#![feature(never_type_fallback)]`
|
||||
// is enabled. Otherwise, they are replaced with `()`.
|
||||
//
|
||||
// Fallback becomes very dubious if we have encountered type-checking errors.
|
||||
// In that case, fallback to Error.
|
||||
// The return value indicates whether fallback has occurred.
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ This API is completely unstable and subject to change.
|
|||
#![feature(in_band_lifetimes)]
|
||||
#![feature(nll)]
|
||||
#![feature(slice_patterns)]
|
||||
#![feature(never_type)]
|
||||
#![cfg_attr(bootstrap, feature(never_type))]
|
||||
|
||||
#![recursion_limit="256"]
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
#![feature(crate_visibility_modifier)]
|
||||
#![feature(const_fn)]
|
||||
#![feature(drain_filter)]
|
||||
#![feature(never_type)]
|
||||
#![cfg_attr(bootstrap, feature(never_type))]
|
||||
#![feature(unicode_internals)]
|
||||
|
||||
#![recursion_limit="256"]
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ Core encoding and decoding interfaces.
|
|||
#![feature(box_syntax)]
|
||||
#![feature(core_intrinsics)]
|
||||
#![feature(specialization)]
|
||||
#![feature(never_type)]
|
||||
#![cfg_attr(bootstrap, feature(never_type))]
|
||||
#![feature(nll)]
|
||||
#![feature(associated_type_bounds)]
|
||||
#![cfg_attr(test, feature(test))]
|
||||
|
|
|
|||
|
|
@ -465,7 +465,7 @@ impl<'a> From<Cow<'a, str>> for Box<dyn Error> {
|
|||
}
|
||||
}
|
||||
|
||||
#[unstable(feature = "never_type", issue = "35121")]
|
||||
#[stable(feature = "never_type", since = "1.41.0")]
|
||||
impl Error for ! {
|
||||
fn description(&self) -> &str { *self }
|
||||
}
|
||||
|
|
@ -551,13 +551,6 @@ impl Error for string::FromUtf16Error {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "str_parse_error2", since = "1.8.0")]
|
||||
impl Error for string::ParseError {
|
||||
fn description(&self) -> &str {
|
||||
match *self {}
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "decode_utf16", since = "1.9.0")]
|
||||
impl Error for char::DecodeUtf16Error {
|
||||
fn description(&self) -> &str {
|
||||
|
|
|
|||
|
|
@ -280,7 +280,7 @@
|
|||
#![feature(maybe_uninit_ref)]
|
||||
#![feature(maybe_uninit_slice)]
|
||||
#![feature(needs_panic_runtime)]
|
||||
#![feature(never_type)]
|
||||
#![cfg_attr(bootstrap, feature(never_type))]
|
||||
#![feature(nll)]
|
||||
#![cfg_attr(bootstrap, feature(on_unimplemented))]
|
||||
#![feature(optin_builtin_traits)]
|
||||
|
|
|
|||
|
|
@ -71,7 +71,6 @@ mod prim_bool { }
|
|||
/// write:
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(never_type)]
|
||||
/// # fn foo() -> u32 {
|
||||
/// let x: ! = {
|
||||
/// return 123
|
||||
|
|
@ -201,7 +200,6 @@ mod prim_bool { }
|
|||
/// for example:
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(never_type)]
|
||||
/// # use std::fmt;
|
||||
/// # trait Debug {
|
||||
/// # fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result;
|
||||
|
|
@ -239,7 +237,7 @@ mod prim_bool { }
|
|||
/// [`Default`]: default/trait.Default.html
|
||||
/// [`default()`]: default/trait.Default.html#tymethod.default
|
||||
///
|
||||
#[unstable(feature = "never_type", issue = "35121")]
|
||||
#[stable(feature = "never_type", since = "1.41.0")]
|
||||
mod prim_never { }
|
||||
|
||||
#[doc(primitive = "char")]
|
||||
|
|
|
|||
|
|
@ -253,6 +253,8 @@ declare_features! (
|
|||
(accepted, const_constructor, "1.40.0", Some(61456), None),
|
||||
/// Allows the use of `#[cfg(doctest)]`, set when rustdoc is collecting doctests.
|
||||
(accepted, cfg_doctest, "1.40.0", Some(62210), None),
|
||||
/// Allows the `!` type. Does not imply 'exhaustive_patterns' any more.
|
||||
(accepted, never_type, "1.41.0", Some(35121), None),
|
||||
/// Allows relaxing the coherence rules such that
|
||||
/// `impl<T> ForeignTrait<LocalType> for ForeignType<T>` is permitted.
|
||||
(accepted, re_rebalance_coherence, "1.41.0", Some(55437), None),
|
||||
|
|
|
|||
|
|
@ -318,9 +318,6 @@ declare_features! (
|
|||
/// Allows `X..Y` patterns.
|
||||
(active, exclusive_range_pattern, "1.11.0", Some(37854), None),
|
||||
|
||||
/// Allows the `!` type. Does not imply 'exhaustive_patterns' (below) any more.
|
||||
(active, never_type, "1.13.0", Some(35121), None),
|
||||
|
||||
/// Allows exhaustive pattern matching on types that contain uninhabited types.
|
||||
(active, exhaustive_patterns, "1.13.0", Some(51085), None),
|
||||
|
||||
|
|
@ -523,6 +520,9 @@ declare_features! (
|
|||
/// Allows using the `efiapi` ABI.
|
||||
(active, abi_efiapi, "1.40.0", Some(65815), None),
|
||||
|
||||
/// Allows diverging expressions to fall back to `!` rather than `()`.
|
||||
(active, never_type_fallback, "1.41.0", Some(65992), None),
|
||||
|
||||
/// Allows using the `#[register_attr]` attribute.
|
||||
(active, register_attr, "1.41.0", Some(66080), None),
|
||||
|
||||
|
|
|
|||
|
|
@ -521,25 +521,11 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
|
|||
ast::TyKind::BareFn(ref bare_fn_ty) => {
|
||||
self.check_extern(bare_fn_ty.ext);
|
||||
}
|
||||
ast::TyKind::Never => {
|
||||
gate_feature_post!(&self, never_type, ty.span,
|
||||
"The `!` type is experimental");
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
visit::walk_ty(self, ty)
|
||||
}
|
||||
|
||||
fn visit_fn_ret_ty(&mut self, ret_ty: &'a ast::FunctionRetTy) {
|
||||
if let ast::FunctionRetTy::Ty(ref output_ty) = *ret_ty {
|
||||
if let ast::TyKind::Never = output_ty.kind {
|
||||
// Do nothing.
|
||||
} else {
|
||||
self.visit_ty(output_ty)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn visit_expr(&mut self, e: &'a ast::Expr) {
|
||||
match e.kind {
|
||||
ast::ExprKind::Box(_) => {
|
||||
|
|
@ -567,10 +553,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
|
|||
visit::walk_expr(self, e)
|
||||
}
|
||||
|
||||
fn visit_arm(&mut self, arm: &'a ast::Arm) {
|
||||
visit::walk_arm(self, arm)
|
||||
}
|
||||
|
||||
fn visit_pat(&mut self, pattern: &'a ast::Pat) {
|
||||
match &pattern.kind {
|
||||
PatKind::Slice(pats) => {
|
||||
|
|
|
|||
|
|
@ -444,6 +444,7 @@ symbols! {
|
|||
negate_unsigned,
|
||||
never,
|
||||
never_type,
|
||||
never_type_fallback,
|
||||
new,
|
||||
next,
|
||||
__next,
|
||||
|
|
|
|||
|
|
@ -12,8 +12,6 @@
|
|||
// CHECK: {{.*}}DIDerivedType{{.*}}tag: DW_TAG_member,{{.*}}name: "Placeholder",{{.*}}extraData: i64 4294967295{{[,)].*}}
|
||||
// CHECK: {{.*}}DIDerivedType{{.*}}tag: DW_TAG_member,{{.*}}name: "Error",{{.*}}extraData: i64 0{{[,)].*}}
|
||||
|
||||
#![feature(never_type)]
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct Entity {
|
||||
private: std::num::NonZeroU32,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
#![feature(never_type)]
|
||||
|
||||
pub enum Void {}
|
||||
|
||||
#[no_mangle]
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// run-pass
|
||||
#![feature(never_type)]
|
||||
#![feature(never_type_fallback)]
|
||||
#![feature(exhaustive_patterns)]
|
||||
#![feature(slice_patterns)]
|
||||
#![allow(unreachable_patterns)]
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
// check-pass
|
||||
|
||||
#![feature(never_type)]
|
||||
|
||||
pub fn main() {
|
||||
loop {
|
||||
match None {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
#![feature(never_type)]
|
||||
|
||||
fn main() {
|
||||
// The `if false` expressions are simply to
|
||||
// make sure we don't avoid checking everything
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/break-while-condition.rs:9:20
|
||||
--> $DIR/break-while-condition.rs:7:20
|
||||
|
|
||||
LL | let _: ! = {
|
||||
| ____________________^
|
||||
|
|
@ -11,7 +11,7 @@ LL | | };
|
|||
found type `()`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/break-while-condition.rs:16:13
|
||||
--> $DIR/break-while-condition.rs:14:13
|
||||
|
|
||||
LL | / while false {
|
||||
LL | | break
|
||||
|
|
@ -22,7 +22,7 @@ LL | | }
|
|||
found type `()`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/break-while-condition.rs:24:13
|
||||
--> $DIR/break-while-condition.rs:22:13
|
||||
|
|
||||
LL | / while false {
|
||||
LL | | return
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
// check-pass
|
||||
|
||||
#![feature(never_type)]
|
||||
#![feature(never_type_fallback)]
|
||||
#![allow(unreachable_code)]
|
||||
|
||||
use std::error::Error;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
#![feature(never_type)]
|
||||
|
||||
fn foo(x: usize, y: !, z: usize) { }
|
||||
|
||||
fn cast_a() {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0605]: non-primitive cast: `i32` as `!`
|
||||
--> $DIR/coerce-to-bang-cast.rs:6:13
|
||||
--> $DIR/coerce-to-bang-cast.rs:4:13
|
||||
|
|
||||
LL | let y = {return; 22} as !;
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -7,7 +7,7 @@ LL | let y = {return; 22} as !;
|
|||
= note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
|
||||
|
||||
error[E0605]: non-primitive cast: `i32` as `!`
|
||||
--> $DIR/coerce-to-bang-cast.rs:11:13
|
||||
--> $DIR/coerce-to-bang-cast.rs:9:13
|
||||
|
|
||||
LL | let y = 22 as !;
|
||||
| ^^^^^^^
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
#![feature(never_type)]
|
||||
|
||||
fn foo(x: usize, y: !, z: usize) { }
|
||||
|
||||
fn call_foo_a() {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/coerce-to-bang.rs:6:17
|
||||
--> $DIR/coerce-to-bang.rs:4:17
|
||||
|
|
||||
LL | foo(return, 22, 44);
|
||||
| ^^ expected !, found integer
|
||||
|
|
@ -8,7 +8,7 @@ LL | foo(return, 22, 44);
|
|||
found type `{integer}`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/coerce-to-bang.rs:18:13
|
||||
--> $DIR/coerce-to-bang.rs:16:13
|
||||
|
|
||||
LL | foo(22, 44, return);
|
||||
| ^^ expected !, found integer
|
||||
|
|
@ -17,7 +17,7 @@ LL | foo(22, 44, return);
|
|||
found type `{integer}`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/coerce-to-bang.rs:26:12
|
||||
--> $DIR/coerce-to-bang.rs:24:12
|
||||
|
|
||||
LL | foo(a, b, c); // ... and hence a reference to `a` is expected to diverge.
|
||||
| ^ expected !, found integer
|
||||
|
|
@ -26,7 +26,7 @@ LL | foo(a, b, c); // ... and hence a reference to `a` is expected to diverg
|
|||
found type `{integer}`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/coerce-to-bang.rs:36:12
|
||||
--> $DIR/coerce-to-bang.rs:34:12
|
||||
|
|
||||
LL | foo(a, b, c);
|
||||
| ^ expected !, found integer
|
||||
|
|
@ -35,7 +35,7 @@ LL | foo(a, b, c);
|
|||
found type `{integer}`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/coerce-to-bang.rs:45:12
|
||||
--> $DIR/coerce-to-bang.rs:43:12
|
||||
|
|
||||
LL | foo(a, b, c);
|
||||
| ^ expected !, found integer
|
||||
|
|
@ -44,7 +44,7 @@ LL | foo(a, b, c);
|
|||
found type `{integer}`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/coerce-to-bang.rs:50:21
|
||||
--> $DIR/coerce-to-bang.rs:48:21
|
||||
|
|
||||
LL | let x: [!; 2] = [return, 22];
|
||||
| ^^^^^^^^^^^^ expected !, found integer
|
||||
|
|
@ -53,7 +53,7 @@ LL | let x: [!; 2] = [return, 22];
|
|||
found type `[{integer}; 2]`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/coerce-to-bang.rs:55:22
|
||||
--> $DIR/coerce-to-bang.rs:53:22
|
||||
|
|
||||
LL | let x: [!; 2] = [22, return];
|
||||
| ^^ expected !, found integer
|
||||
|
|
@ -62,7 +62,7 @@ LL | let x: [!; 2] = [22, return];
|
|||
found type `{integer}`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/coerce-to-bang.rs:60:37
|
||||
--> $DIR/coerce-to-bang.rs:58:37
|
||||
|
|
||||
LL | let x: (usize, !, usize) = (22, 44, 66);
|
||||
| ^^ expected !, found integer
|
||||
|
|
@ -71,7 +71,7 @@ LL | let x: (usize, !, usize) = (22, 44, 66);
|
|||
found type `{integer}`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/coerce-to-bang.rs:65:41
|
||||
--> $DIR/coerce-to-bang.rs:63:41
|
||||
|
|
||||
LL | let x: (usize, !, usize) = (return, 44, 66);
|
||||
| ^^ expected !, found integer
|
||||
|
|
@ -80,7 +80,7 @@ LL | let x: (usize, !, usize) = (return, 44, 66);
|
|||
found type `{integer}`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/coerce-to-bang.rs:76:37
|
||||
--> $DIR/coerce-to-bang.rs:74:37
|
||||
|
|
||||
LL | let x: (usize, !, usize) = (22, 44, return);
|
||||
| ^^ expected !, found integer
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#![feature(const_raw_ptr_deref, never_type)]
|
||||
#![feature(const_raw_ptr_deref)]
|
||||
|
||||
const FOO: &[!; 1] = unsafe { &*(1_usize as *const [!; 1]) }; //~ ERROR undefined behavior
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
#![feature(never_type)]
|
||||
|
||||
enum Helper<T, U> {
|
||||
T(T, [!; 0]),
|
||||
#[allow(dead_code)]
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0005]: refutable pattern in local binding: `T(_, _)` not covered
|
||||
--> $DIR/empty-never-array.rs:10:9
|
||||
--> $DIR/empty-never-array.rs:8:9
|
||||
|
|
||||
LL | / enum Helper<T, U> {
|
||||
LL | | T(T, [!; 0]),
|
||||
|
|
@ -20,7 +20,7 @@ LL | if let Helper::U(u) = Helper::T(t, []) { /* */ }
|
|||
|
|
||||
|
||||
error[E0381]: use of possibly-uninitialized variable: `u`
|
||||
--> $DIR/empty-never-array.rs:12:5
|
||||
--> $DIR/empty-never-array.rs:10:5
|
||||
|
|
||||
LL | u
|
||||
| ^ use of possibly-uninitialized `u`
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
#![feature(never_type)]
|
||||
|
||||
fn foo() -> Result<u32, !> {
|
||||
Ok(123)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0005]: refutable pattern in local binding: `Err(_)` not covered
|
||||
--> $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
|
||||
|
|
|
|||
|
|
@ -1,17 +0,0 @@
|
|||
// Test that ! errors when used in illegal positions with feature(never_type) disabled
|
||||
|
||||
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
|
||||
|
||||
impl Foo for Meeshka {
|
||||
type Wub = !; //~ ERROR type is experimental
|
||||
}
|
||||
|
||||
fn main() {
|
||||
}
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
error[E0658]: The `!` type is experimental
|
||||
--> $DIR/feature-gate-never_type.rs:7:17
|
||||
|
|
||||
LL | type Ma = (u32, !, i32);
|
||||
| ^
|
||||
|
|
||||
= note: for more information, see https://github.com/rust-lang/rust/issues/35121
|
||||
= help: add `#![feature(never_type)]` to the crate attributes to enable
|
||||
|
||||
error[E0658]: The `!` type is experimental
|
||||
--> $DIR/feature-gate-never_type.rs:8:20
|
||||
|
|
||||
LL | type Meeshka = Vec<!>;
|
||||
| ^
|
||||
|
|
||||
= note: for more information, see https://github.com/rust-lang/rust/issues/35121
|
||||
= help: add `#![feature(never_type)]` to the crate attributes to enable
|
||||
|
||||
error[E0658]: The `!` type is experimental
|
||||
--> $DIR/feature-gate-never_type.rs:9:24
|
||||
|
|
||||
LL | type Mow = &'static fn(!) -> !;
|
||||
| ^
|
||||
|
|
||||
= note: for more information, see https://github.com/rust-lang/rust/issues/35121
|
||||
= help: add `#![feature(never_type)]` to the crate attributes to enable
|
||||
|
||||
error[E0658]: The `!` type is experimental
|
||||
--> $DIR/feature-gate-never_type.rs:10:27
|
||||
|
|
||||
LL | type Skwoz = &'static mut !;
|
||||
| ^
|
||||
|
|
||||
= note: for more information, see https://github.com/rust-lang/rust/issues/35121
|
||||
= help: add `#![feature(never_type)]` to the crate attributes to enable
|
||||
|
||||
error[E0658]: The `!` type is experimental
|
||||
--> $DIR/feature-gate-never_type.rs:13:16
|
||||
|
|
||||
LL | type Wub = !;
|
||||
| ^
|
||||
|
|
||||
= note: for more information, see https://github.com/rust-lang/rust/issues/35121
|
||||
= help: add `#![feature(never_type)]` to the crate attributes to enable
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
// run-pass
|
||||
|
||||
#![allow(unreachable_code)]
|
||||
#![feature(never_type)]
|
||||
|
||||
#[allow(unused)]
|
||||
fn never_returns() {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
#![feature(never_type)]
|
||||
#![deny(unused_must_use)]
|
||||
|
||||
#[must_use]
|
||||
|
|
|
|||
|
|
@ -1,17 +1,17 @@
|
|||
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: lint level defined here
|
||||
--> $DIR/must_use-unit.rs:2:9
|
||||
--> $DIR/must_use-unit.rs:1:9
|
||||
|
|
||||
LL | #![deny(unused_must_use)]
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
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();
|
||||
| ^^^^^^
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// This test checks that calling `mem::{uninitialized,zeroed}` with certain types results
|
||||
// in a lint.
|
||||
|
||||
#![feature(never_type, rustc_attrs)]
|
||||
#![feature(rustc_attrs)]
|
||||
#![allow(deprecated)]
|
||||
#![deny(invalid_value)]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
#![feature(never_type)]
|
||||
|
||||
fn main() {
|
||||
let val: ! = loop { break break; };
|
||||
//~^ ERROR mismatched types
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
warning: denote infinite loops with `loop { ... }`
|
||||
--> $DIR/loop-break-value.rs:26:5
|
||||
--> $DIR/loop-break-value.rs:24:5
|
||||
|
|
||||
LL | 'while_loop: while true {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ help: use `loop`
|
||||
|
|
@ -7,7 +7,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:28:9
|
||||
--> $DIR/loop-break-value.rs:26:9
|
||||
|
|
||||
LL | break ();
|
||||
| ^^^^^^^^ can only break with a value inside `loop` or breakable block
|
||||
|
|
@ -18,7 +18,7 @@ LL | break;
|
|||
| ^^^^^
|
||||
|
||||
error[E0571]: `break` with value from a `while` loop
|
||||
--> $DIR/loop-break-value.rs:30:13
|
||||
--> $DIR/loop-break-value.rs:28:13
|
||||
|
|
||||
LL | break 'while_loop 123;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ can only break with a value inside `loop` or breakable block
|
||||
|
|
@ -29,7 +29,7 @@ LL | break;
|
|||
| ^^^^^
|
||||
|
||||
error[E0571]: `break` with value from a `while let` loop
|
||||
--> $DIR/loop-break-value.rs:38:12
|
||||
--> $DIR/loop-break-value.rs:36:12
|
||||
|
|
||||
LL | if break () {
|
||||
| ^^^^^^^^ can only break with a value inside `loop` or breakable block
|
||||
|
|
@ -40,7 +40,7 @@ LL | if break {
|
|||
| ^^^^^
|
||||
|
||||
error[E0571]: `break` with value from a `while let` loop
|
||||
--> $DIR/loop-break-value.rs:43:9
|
||||
--> $DIR/loop-break-value.rs:41:9
|
||||
|
|
||||
LL | break None;
|
||||
| ^^^^^^^^^^ can only break with a value inside `loop` or breakable block
|
||||
|
|
@ -51,7 +51,7 @@ LL | break;
|
|||
| ^^^^^
|
||||
|
||||
error[E0571]: `break` with value from a `while let` loop
|
||||
--> $DIR/loop-break-value.rs:49:13
|
||||
--> $DIR/loop-break-value.rs:47:13
|
||||
|
|
||||
LL | break 'while_let_loop "nope";
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can only break with a value inside `loop` or breakable block
|
||||
|
|
@ -62,7 +62,7 @@ LL | break;
|
|||
| ^^^^^
|
||||
|
||||
error[E0571]: `break` with value from a `for` loop
|
||||
--> $DIR/loop-break-value.rs:56:9
|
||||
--> $DIR/loop-break-value.rs:54:9
|
||||
|
|
||||
LL | break ();
|
||||
| ^^^^^^^^ can only break with a value inside `loop` or breakable block
|
||||
|
|
@ -73,7 +73,7 @@ LL | break;
|
|||
| ^^^^^
|
||||
|
||||
error[E0571]: `break` with value from a `for` loop
|
||||
--> $DIR/loop-break-value.rs:57:9
|
||||
--> $DIR/loop-break-value.rs:55:9
|
||||
|
|
||||
LL | break [()];
|
||||
| ^^^^^^^^^^ can only break with a value inside `loop` or breakable block
|
||||
|
|
@ -84,7 +84,7 @@ LL | break;
|
|||
| ^^^^^
|
||||
|
||||
error[E0571]: `break` with value from a `for` loop
|
||||
--> $DIR/loop-break-value.rs:64:13
|
||||
--> $DIR/loop-break-value.rs:62:13
|
||||
|
|
||||
LL | break 'for_loop Some(17);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ can only break with a value inside `loop` or breakable block
|
||||
|
|
@ -95,7 +95,7 @@ LL | break;
|
|||
| ^^^^^
|
||||
|
||||
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 ()
|
||||
|
|
@ -104,7 +104,7 @@ LL | let val: ! = loop { break break; };
|
|||
found type `()`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/loop-break-value.rs:11:19
|
||||
--> $DIR/loop-break-value.rs:9:19
|
||||
|
|
||||
LL | break 123;
|
||||
| ^^^ expected &str, found integer
|
||||
|
|
@ -113,7 +113,7 @@ LL | break 123;
|
|||
found type `{integer}`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/loop-break-value.rs:16:15
|
||||
--> $DIR/loop-break-value.rs:14:15
|
||||
|
|
||||
LL | break "asdf";
|
||||
| ^^^^^^ expected i32, found reference
|
||||
|
|
@ -122,7 +122,7 @@ LL | break "asdf";
|
|||
found type `&'static str`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/loop-break-value.rs:21:31
|
||||
--> $DIR/loop-break-value.rs:19:31
|
||||
|
|
||||
LL | break 'outer_loop "nope";
|
||||
| ^^^^^^ expected i32, found reference
|
||||
|
|
@ -131,7 +131,7 @@ LL | break 'outer_loop "nope";
|
|||
found type `&'static str`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/loop-break-value.rs:73:26
|
||||
--> $DIR/loop-break-value.rs:71:26
|
||||
|
|
||||
LL | break 'c 123;
|
||||
| ^^^ expected (), found integer
|
||||
|
|
@ -140,7 +140,7 @@ LL | break 'c 123;
|
|||
found type `{integer}`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/loop-break-value.rs:80:15
|
||||
--> $DIR/loop-break-value.rs:78:15
|
||||
|
|
||||
LL | break (break, break);
|
||||
| ^^^^^^^^^^^^^^ expected (), found tuple
|
||||
|
|
@ -149,7 +149,7 @@ LL | break (break, break);
|
|||
found type `(!, !)`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/loop-break-value.rs:85:15
|
||||
--> $DIR/loop-break-value.rs:83:15
|
||||
|
|
||||
LL | break 2;
|
||||
| ^ expected (), found integer
|
||||
|
|
@ -158,7 +158,7 @@ LL | break 2;
|
|||
found type `{integer}`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/loop-break-value.rs:90:9
|
||||
--> $DIR/loop-break-value.rs:88:9
|
||||
|
|
||||
LL | break;
|
||||
| ^^^^^
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
// ignore-wasm32-bare compiled with panic=abort by default
|
||||
|
||||
#![feature(fn_traits)]
|
||||
#![feature(never_type)]
|
||||
|
||||
use std::panic;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
// check-pass
|
||||
|
||||
#![feature(never_type)]
|
||||
|
||||
fn main() {
|
||||
let x: ! = panic!();
|
||||
let y: u32 = x;
|
||||
|
|
|
|||
16
src/test/ui/never_type/auto-traits.rs
Normal file
16
src/test/ui/never_type/auto-traits.rs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
// check-pass
|
||||
|
||||
#![feature(optin_builtin_traits)]
|
||||
|
||||
fn main() {
|
||||
enum Void {}
|
||||
|
||||
auto trait Auto {}
|
||||
fn assert_auto<T: Auto>() {}
|
||||
assert_auto::<Void>();
|
||||
assert_auto::<!>();
|
||||
|
||||
fn assert_send<T: Send>() {}
|
||||
assert_send::<Void>();
|
||||
assert_send::<!>();
|
||||
}
|
||||
|
|
@ -1,7 +1,5 @@
|
|||
// Test that we can't pass other types for !
|
||||
|
||||
#![feature(never_type)]
|
||||
|
||||
fn foo(x: !) -> ! {
|
||||
x
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 reference
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
// check-pass
|
||||
|
||||
#![feature(never_type)]
|
||||
#![allow(unreachable_code)]
|
||||
|
||||
fn foo(x: !) -> ! {
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
// check-pass
|
||||
|
||||
#![feature(never_type)]
|
||||
|
||||
fn main() {
|
||||
let x: ! = panic!();
|
||||
let y: u32 = x as u32;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// We need to opt into the `!` feature in order to trigger the
|
||||
// requirement that this is testing.
|
||||
#![feature(never_type)]
|
||||
// We need to opt into the `never_type_fallback` feature
|
||||
// to trigger the requirement that this is testing.
|
||||
#![feature(never_type_fallback)]
|
||||
|
||||
#![allow(unused)]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// run-pass
|
||||
|
||||
#![feature(unsize, dispatch_from_dyn, never_type)]
|
||||
#![feature(unsize, dispatch_from_dyn)]
|
||||
|
||||
#![allow(dead_code)]
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
// These represent current behavior, but are pretty dubious. I would
|
||||
// like to revisit these and potentially change them. --nmatsakis
|
||||
|
||||
#![feature(never_type)]
|
||||
#![feature(never_type_fallback)]
|
||||
|
||||
trait BadDefault {
|
||||
fn default() -> Self;
|
||||
|
|
|
|||
12
src/test/ui/never_type/feature-gate-never_type_fallback.rs
Normal file
12
src/test/ui/never_type/feature-gate-never_type_fallback.rs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
// This is a feature gate test for `never_type_fallback`.
|
||||
// It works by using a scenario where the type fall backs to `()` rather than ´!`
|
||||
// in the case where `#![feature(never_type_fallback)]` would change it to `!`.
|
||||
|
||||
fn main() {}
|
||||
|
||||
trait T {}
|
||||
|
||||
fn should_ret_unit() -> impl T {
|
||||
//~^ ERROR the trait bound `(): T` is not satisfied
|
||||
panic!()
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
error[E0277]: the trait bound `(): T` is not satisfied
|
||||
--> $DIR/feature-gate-never_type_fallback.rs:9:25
|
||||
|
|
||||
LL | fn should_ret_unit() -> impl T {
|
||||
| ^^^^^^ the trait `T` is not implemented for `()`
|
||||
|
|
||||
= note: the return type of a function must have a statically known size
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
|
|
@ -1,7 +1,5 @@
|
|||
// run-pass
|
||||
|
||||
#![feature(never_type)]
|
||||
|
||||
// Test that we can call static methods on ! both directly and when it appears in a generic
|
||||
|
||||
trait StringifyType {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
// check-pass
|
||||
|
||||
#![allow(dead_code)]
|
||||
#![feature(never_type)]
|
||||
#![feature(exhaustive_patterns)]
|
||||
|
||||
// Regression test for inhabitedness check. The old
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
// check-pass
|
||||
|
||||
#![feature(never_type)]
|
||||
#![warn(unused)]
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
warning: unreachable statement
|
||||
--> $DIR/never-assign-dead-code.rs:10:5
|
||||
--> $DIR/never-assign-dead-code.rs:9:5
|
||||
|
|
||||
LL | let x: ! = panic!("aah");
|
||||
| ------------- any code following this expression is unreachable
|
||||
|
|
@ -7,7 +7,7 @@ LL | drop(x);
|
|||
| ^^^^^^^^ unreachable statement
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/never-assign-dead-code.rs:6:9
|
||||
--> $DIR/never-assign-dead-code.rs:5:9
|
||||
|
|
||||
LL | #![warn(unused)]
|
||||
| ^^^^^^
|
||||
|
|
@ -15,7 +15,7 @@ LL | #![warn(unused)]
|
|||
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||
|
||||
warning: unreachable call
|
||||
--> $DIR/never-assign-dead-code.rs:10:5
|
||||
--> $DIR/never-assign-dead-code.rs:9:5
|
||||
|
|
||||
LL | drop(x);
|
||||
| ^^^^ - any code following this expression is unreachable
|
||||
|
|
@ -23,13 +23,13 @@ LL | drop(x);
|
|||
| unreachable call
|
||||
|
||||
warning: unused variable: `x`
|
||||
--> $DIR/never-assign-dead-code.rs:9:9
|
||||
--> $DIR/never-assign-dead-code.rs:8:9
|
||||
|
|
||||
LL | let x: ! = panic!("aah");
|
||||
| ^ help: consider prefixing with an underscore: `_x`
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/never-assign-dead-code.rs:6:9
|
||||
--> $DIR/never-assign-dead-code.rs:5:9
|
||||
|
|
||||
LL | #![warn(unused)]
|
||||
| ^^^^^^
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
// Test that we can't use another type in place of !
|
||||
|
||||
#![feature(never_type)]
|
||||
#![deny(warnings)]
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/never-assign-wrong-type.rs:7:16
|
||||
--> $DIR/never-assign-wrong-type.rs:6:16
|
||||
|
|
||||
LL | let x: ! = "hello";
|
||||
| ^^^^^^^ expected !, found reference
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
// check-pass
|
||||
|
||||
#![feature(never_type)]
|
||||
|
||||
trait Foo {
|
||||
type Wow;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
// check that the `for<T> T: From<!>` impl is reserved
|
||||
|
||||
#![feature(never_type)]
|
||||
|
||||
pub struct MyFoo;
|
||||
pub trait MyTrait {}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0119]: conflicting implementations of trait `MyTrait` for type `MyFoo`:
|
||||
--> $DIR/never-from-impl-is-reserved.rs:10:1
|
||||
--> $DIR/never-from-impl-is-reserved.rs:8:1
|
||||
|
|
||||
LL | impl MyTrait for MyFoo {}
|
||||
| ---------------------- first implementation here
|
||||
|
|
|
|||
|
|
@ -5,8 +5,6 @@
|
|||
|
||||
// Test that we can extract a ! through pattern matching then use it as several different types.
|
||||
|
||||
#![feature(never_type)]
|
||||
|
||||
fn main() {
|
||||
let x: Result<u32, !> = Ok(123);
|
||||
match x {
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
// check-pass
|
||||
|
||||
#![feature(never_type)]
|
||||
|
||||
struct Wub;
|
||||
|
||||
impl PartialEq<!> for Wub {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
// run-pass
|
||||
|
||||
#![feature(never_type)]
|
||||
#![allow(dead_code)]
|
||||
#![allow(path_statements)]
|
||||
#![allow(unreachable_patterns)]
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
#![crate_type="lib"]
|
||||
|
||||
#![feature(never_type)]
|
||||
#![allow(dead_code)]
|
||||
#![allow(unreachable_code)]
|
||||
#![allow(unused_variables)]
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
// This test checks that instantiating an uninhabited type via `mem::{uninitialized,zeroed}` results
|
||||
// in a runtime panic.
|
||||
|
||||
#![feature(never_type)]
|
||||
#![allow(deprecated, invalid_value)]
|
||||
|
||||
use std::{mem, panic};
|
||||
|
|
|
|||
|
|
@ -5,8 +5,6 @@
|
|||
// This test was added to show the motivation for doing this
|
||||
// over `TryFrom` being blanket impl for all `T: From`
|
||||
|
||||
#![feature(never_type)]
|
||||
|
||||
use std::convert::{TryInto, Infallible};
|
||||
|
||||
struct Foo<T> {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
#![feature(never_type)]
|
||||
#![feature(exhaustive_patterns)]
|
||||
|
||||
mod private {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0004]: non-exhaustive patterns: `Some(Private { misc: true, .. })` not covered
|
||||
--> $DIR/match-privately-empty.rs:13:11
|
||||
--> $DIR/match-privately-empty.rs:12:11
|
||||
|
|
||||
LL | match private::DATA {
|
||||
| ^^^^^^^^^^^^^ pattern `Some(Private { misc: true, .. })` not covered
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
// ^-- needed because `--pass check` does not emit the output needed.
|
||||
// FIXME: consider using an attribute instead of side-effects.
|
||||
|
||||
#![feature(never_type)]
|
||||
#![feature(start)]
|
||||
|
||||
#[start]
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
#![feature(never_type)]
|
||||
#![allow(unused_variables)]
|
||||
#![deny(unreachable_code)]
|
||||
|
||||
|
|
|
|||
|
|
@ -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: lint level defined here
|
||||
--> $DIR/expr_add.rs:3:9
|
||||
--> $DIR/expr_add.rs:2:9
|
||||
|
|
||||
LL | #![deny(unreachable_code)]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
#![feature(never_type)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(unused_assignments)]
|
||||
#![allow(dead_code)]
|
||||
|
|
|
|||
|
|
@ -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: lint level 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:14
|
||||
--> $DIR/expr_assign.rs:19:14
|
||||
|
|
||||
LL | *p = return;
|
||||
| -- ^^^^^^ unreachable expression
|
||||
|
|
@ -22,7 +22,7 @@ LL | *p = return;
|
|||
| any code following this expression is unreachable
|
||||
|
||||
error: unreachable expression
|
||||
--> $DIR/expr_assign.rs:26:15
|
||||
--> $DIR/expr_assign.rs:25:15
|
||||
|
|
||||
LL | *{return; &mut i} = 22;
|
||||
| ------ ^^^^^^ unreachable expression
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
#![feature(never_type)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(unused_assignments)]
|
||||
#![allow(dead_code)]
|
||||
|
|
|
|||
|
|
@ -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: lint level 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
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
#![feature(never_type)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(unused_assignments)]
|
||||
#![allow(dead_code)]
|
||||
|
|
|
|||
|
|
@ -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: lint level 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
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
#![feature(never_type)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(unused_assignments)]
|
||||
#![allow(dead_code)]
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
error[E0600]: cannot apply unary operator `!` to type `!`
|
||||
--> $DIR/expr_unary.rs:8:16
|
||||
--> $DIR/expr_unary.rs:7:16
|
||||
|
|
||||
LL | let x: ! = ! { return; };
|
||||
| ^^^^^^^^^^^^^ cannot apply unary operator `!`
|
||||
|
||||
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: lint level defined here
|
||||
--> $DIR/expr_unary.rs:5:9
|
||||
--> $DIR/expr_unary.rs:4:9
|
||||
|
|
||||
LL | #![deny(unreachable_code)]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#![feature(never_type)]
|
||||
#![feature(never_type_fallback)]
|
||||
#![feature(exhaustive_patterns)]
|
||||
|
||||
#![allow(unreachable_code)]
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// check-pass
|
||||
#![feature(never_type, exhaustive_patterns)]
|
||||
#![feature(exhaustive_patterns)]
|
||||
#![warn(unreachable_code)]
|
||||
#![warn(unreachable_patterns)]
|
||||
|
||||
|
|
|
|||
|
|
@ -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 {}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
#![crate_type = "rlib"]
|
||||
#![feature(never_type)]
|
||||
|
||||
#[non_exhaustive]
|
||||
pub enum UninhabitedEnum {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
// aux-build:uninhabited.rs
|
||||
#![feature(never_type)]
|
||||
|
||||
extern crate uninhabited;
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -10,7 +10,7 @@ LL | x
|
|||
found type `uninhabited::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
|
||||
|
|
@ -21,7 +21,7 @@ LL | x
|
|||
found type `uninhabited::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
|
||||
|
|
@ -32,7 +32,7 @@ LL | x
|
|||
found type `uninhabited::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
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
#![feature(never_type)]
|
||||
|
||||
#[non_exhaustive]
|
||||
pub enum UninhabitedEnum {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -10,7 +10,7 @@ LL | x
|
|||
found type `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
|
||||
|
|
@ -21,7 +21,7 @@ LL | x
|
|||
found type `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
|
||||
|
|
@ -32,7 +32,7 @@ LL | x
|
|||
found type `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
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
// aux-build:uninhabited.rs
|
||||
#![feature(never_type)]
|
||||
|
||||
extern crate uninhabited;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0004]: non-exhaustive patterns: pattern `IndirectUninhabitedEnum` of type `uninhabited::IndirectUninhabitedEnum` is not handled
|
||||
--> $DIR/indirect_match.rs:19:11
|
||||
--> $DIR/indirect_match.rs:18:11
|
||||
|
|
||||
LL | match x {}
|
||||
| ^
|
||||
|
|
@ -7,7 +7,7 @@ LL | match x {}
|
|||
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
||||
|
||||
error[E0004]: non-exhaustive patterns: pattern `IndirectUninhabitedStruct` of type `uninhabited::IndirectUninhabitedStruct` is not handled
|
||||
--> $DIR/indirect_match.rs:23:11
|
||||
--> $DIR/indirect_match.rs:22:11
|
||||
|
|
||||
LL | match x {}
|
||||
| ^
|
||||
|
|
@ -15,7 +15,7 @@ LL | match x {}
|
|||
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
||||
|
||||
error[E0004]: non-exhaustive patterns: pattern `IndirectUninhabitedTupleStruct` of type `uninhabited::IndirectUninhabitedTupleStruct` is not handled
|
||||
--> $DIR/indirect_match.rs:27:11
|
||||
--> $DIR/indirect_match.rs:26:11
|
||||
|
|
||||
LL | match x {}
|
||||
| ^
|
||||
|
|
@ -23,7 +23,7 @@ LL | match x {}
|
|||
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
||||
|
||||
error[E0004]: non-exhaustive patterns: pattern `IndirectUninhabitedVariants` of type `uninhabited::IndirectUninhabitedVariants` is not handled
|
||||
--> $DIR/indirect_match.rs:33:11
|
||||
--> $DIR/indirect_match.rs:32:11
|
||||
|
|
||||
LL | match x {}
|
||||
| ^
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue