stabilise feature(never_type)

Replace feature(never_type) with feature(exhaustive_patterns).
feature(exhaustive_patterns) only covers the pattern-exhaustives checks
that used to be covered by feature(never_type)
This commit is contained in:
Andrew Cann 2018-01-21 16:44:41 +08:00
parent 9b15ddb29e
commit a9fc3901b0
77 changed files with 91 additions and 164 deletions

View File

@ -882,24 +882,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.24.0")]
impl PartialEq for ! {
fn eq(&self, _: &!) -> bool {
*self
}
}
#[unstable(feature = "never_type", issue = "35121")]
#[stable(feature = "never_type", since = "1.24.0")]
impl Eq for ! {}
#[unstable(feature = "never_type", issue = "35121")]
#[stable(feature = "never_type", since = "1.24.0")]
impl PartialOrd for ! {
fn partial_cmp(&self, _: &!) -> Option<Ordering> {
*self
}
}
#[unstable(feature = "never_type", issue = "35121")]
#[stable(feature = "never_type", since = "1.24.0")]
impl Ord for ! {
fn cmp(&self, _: &!) -> Ordering {
*self

View File

@ -1579,14 +1579,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.24.0")]
impl Debug for ! {
fn fmt(&self, _: &mut Formatter) -> Result {
*self
}
}
#[unstable(feature = "never_type", issue = "35121")]
#[stable(feature = "never_type", since = "1.24.0")]
impl Display for ! {
fn fmt(&self, _: &mut Formatter) -> Result {
*self

View File

@ -85,7 +85,7 @@
#![feature(iterator_repeat_with)]
#![feature(lang_items)]
#![feature(link_llvm_intrinsics)]
#![feature(never_type)]
#![feature(exhaustive_patterns)]
#![feature(no_core)]
#![feature(on_unimplemented)]
#![feature(optin_builtin_traits)]
@ -103,6 +103,7 @@
#![feature(unwind_attributes)]
#![cfg_attr(stage0, allow(unused_attributes))]
#![cfg_attr(stage0, feature(never_type))]
#[prelude_import]
#[allow(unused)]

View File

@ -60,7 +60,7 @@
#![feature(match_default_bindings)]
#![feature(macro_lifetime_matcher)]
#![feature(macro_vis_matcher)]
#![feature(never_type)]
#![feature(exhaustive_patterns)]
#![feature(non_exhaustive)]
#![feature(nonzero)]
#![feature(proc_macro_internals)]

View File

@ -32,6 +32,7 @@
#![feature(quote)]
#![feature(rustc_diagnostic_macros)]
#![feature(slice_patterns)]
#![cfg_attr(stage0, feature(never_type))]
#[macro_use]
extern crate syntax;

View File

@ -113,7 +113,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
PatternKind::Variant { adt_def, substs, variant_index, ref subpatterns } => {
let irrefutable = adt_def.variants.iter().enumerate().all(|(i, v)| {
i == variant_index || {
self.hir.tcx().features().never_type &&
self.hir.tcx().features().exhaustive_patterns &&
self.hir.tcx().is_variant_uninhabited_from_all_modules(v, substs)
}
});

View File

@ -219,7 +219,7 @@ impl<'a, 'tcx> MatchCheckCtxt<'a, 'tcx> {
}
fn is_uninhabited(&self, ty: Ty<'tcx>) -> bool {
if self.tcx.features().never_type {
if self.tcx.features().exhaustive_patterns {
self.tcx.is_ty_uninhabited_from(self.module, ty)
} else {
false
@ -245,7 +245,7 @@ impl<'a, 'tcx> MatchCheckCtxt<'a, 'tcx> {
substs: &'tcx ty::subst::Substs<'tcx>)
-> bool
{
if self.tcx.features().never_type {
if self.tcx.features().exhaustive_patterns {
self.tcx.is_enum_variant_uninhabited_from(self.module, variant, substs)
} else {
false
@ -694,7 +694,7 @@ pub fn is_useful<'p, 'a: 'p, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>,
// test for details.
//
// FIXME: currently the only way I know of something can
// be a privately-empty enum is when the never_type
// be a privately-empty enum is when the exhaustive_patterns
// feature flag is not present, so this is only
// needed for that case.

View File

@ -222,7 +222,7 @@ impl<'a, 'tcx> MatchVisitor<'a, 'tcx> {
let pat_ty = self.tables.node_id_to_type(scrut.hir_id);
let module = self.tcx.hir.get_module_parent(scrut.id);
if inlined_arms.is_empty() {
let scrutinee_is_uninhabited = if self.tcx.features().never_type {
let scrutinee_is_uninhabited = if self.tcx.features().exhaustive_patterns {
self.tcx.is_ty_uninhabited_from(module, pat_ty)
} else {
self.conservative_is_uninhabited(pat_ty)

View File

@ -32,13 +32,14 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
#![feature(inclusive_range)]
#![feature(macro_vis_matcher)]
#![feature(match_default_bindings)]
#![feature(never_type)]
#![feature(exhaustive_patterns)]
#![feature(range_contains)]
#![feature(rustc_diagnostic_macros)]
#![feature(placement_in_syntax)]
#![feature(collection_placement)]
#![feature(nonzero)]
#![feature(underscore_lifetimes)]
#![cfg_attr(stage0, feature(never_type))]
extern crate arena;
#[macro_use]

View File

@ -80,13 +80,14 @@ This API is completely unstable and subject to change.
#![feature(crate_visibility_modifier)]
#![feature(from_ref)]
#![feature(match_default_bindings)]
#![feature(never_type)]
#![feature(exhaustive_patterns)]
#![feature(option_filter)]
#![feature(quote)]
#![feature(refcell_replace_swap)]
#![feature(rustc_diagnostic_macros)]
#![feature(slice_patterns)]
#![feature(i128_type)]
#![cfg_attr(stage0, feature(never_type))]
#[macro_use] extern crate log;
#[macro_use] extern crate syntax;

View File

@ -234,7 +234,7 @@ impl<'a> From<Cow<'a, str>> for Box<Error> {
}
}
#[unstable(feature = "never_type", issue = "35121")]
#[stable(feature = "never_type", since = "1.24.0")]
impl Error for ! {
fn description(&self) -> &str { *self }
}

View File

@ -282,7 +282,7 @@
#![feature(macro_reexport)]
#![feature(macro_vis_matcher)]
#![feature(needs_panic_runtime)]
#![feature(never_type)]
#![feature(exhaustive_patterns)]
#![feature(num_bits_bytes)]
#![feature(old_wrapping)]
#![feature(on_unimplemented)]
@ -324,6 +324,7 @@
#![feature(doc_spotlight)]
#![cfg_attr(test, feature(update_panic_count))]
#![cfg_attr(windows, feature(used))]
#![cfg_attr(stage0, feature(never_type))]
#![default_lib_allocator]

View File

@ -79,7 +79,6 @@ mod prim_bool { }
/// write:
///
/// ```
/// #![feature(never_type)]
/// # fn foo() -> u32 {
/// let x: ! = {
/// return 123
@ -131,13 +130,15 @@ mod prim_bool { }
/// [`Result<String, !>`] which we can unpack like this:
///
/// ```ignore (string-from-str-error-type-is-not-never-yet)
/// #[feature(exhaustive_patterns)]
/// // NOTE: This does not work today!
/// let Ok(s) = String::from_str("hello");
/// ```
///
/// Since the [`Err`] variant contains a `!`, it can never occur. So we can exhaustively match on
/// [`Result<T, !>`] by just taking the [`Ok`] variant. This illustrates another behaviour of `!` -
/// it can be used to "delete" certain enum variants from generic types like `Result`.
/// Since the [`Err`] variant contains a `!`, it can never occur. If the `exhaustive_patterns`
/// feature is present this means we can exhaustively match on [`Result<T, !>`] by just taking the
/// [`Ok`] variant. This illustrates another behaviour of `!` - it can be used to "delete" certain
/// enum variants from generic types like `Result`.
///
/// [`String::from_str`]: str/trait.FromStr.html#tymethod.from_str
/// [`Result<String, !>`]: result/enum.Result.html
@ -154,7 +155,6 @@ mod prim_bool { }
/// for example:
///
/// ```
/// # #![feature(never_type)]
/// # use std::fmt;
/// # trait Debug {
/// # fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result;
@ -192,7 +192,6 @@ mod prim_bool { }
/// [`Default`]: default/trait.Default.html
/// [`default()`]: default/trait.Default.html#tymethod.default
///
#[unstable(feature = "never_type", issue = "35121")]
mod prim_never { }
#[doc(primitive = "char")]

View File

@ -286,8 +286,8 @@ declare_features! (
// Allows `impl Trait` in function arguments.
(active, universal_impl_trait, "1.23.0", Some(34511), None),
// The `!` type
(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", None, None),
// Allows all literals in attribute lists and values of key-value pairs.
(active, attr_literals, "1.13.0", Some(34981), None),
@ -1566,10 +1566,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
ast::TyKind::BareFn(ref bare_fn_ty) => {
self.check_abi(bare_fn_ty.abi, ty.span);
}
ast::TyKind::Never => {
gate_feature_post!(&self, never_type, ty.span,
"The `!` type is experimental");
},
ast::TyKind::TraitObject(_, ast::TraitObjectSyntax::Dyn) => {
gate_feature_post!(&self, dyn_trait, ty.span,
"`dyn Trait` syntax is unstable");

View File

@ -10,8 +10,6 @@
// Test that we can't pass other types for !
#![feature(never_type)]
fn foo(x: !) -> ! {
x
}

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(never_type)]
fn foo(x: usize, y: !, z: usize) { }
#[deny(coerce_never)]

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(never_type)]
#![deny(coerce_never)]
fn foo(x: usize, y: !, z: usize) { }

View File

@ -10,7 +10,7 @@
// error-pattern:reached recursion limit
#![feature(never_type)]
#![feature(exhaustive_patterns)]
struct Foo<'a, T: 'a> {
ph: std::marker::PhantomData<T>,

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(never_type)]
fn main() {
let val: ! = loop { break break; };
//~^ ERROR mismatched types

View File

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(never_type)]
#![feature(exhaustive_patterns)]
mod private {
pub struct Private {

View File

@ -10,7 +10,7 @@
// Test that an assignment of type ! makes the rest of the block dead code.
#![feature(never_type, rustc_attrs)]
#![feature(rustc_attrs)]
#![warn(unused)]
#[rustc_error]

View File

@ -10,7 +10,6 @@
// Test that we can't use another type in place of !
#![feature(never_type)]
#![deny(warnings)]
fn main() {

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
//#![feature(never_type)]
struct R<'a> {
r: &'a R<'a>,
}

View File

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(never_type)]
#![feature(exhaustive_patterns)]
mod foo {
pub struct SecretlyEmpty {

View File

@ -11,7 +11,7 @@
#![feature(box_patterns)]
#![feature(slice_patterns)]
#![feature(box_syntax)]
#![feature(never_type)]
#![feature(exhaustive_patterns)]
#![deny(unreachable_patterns)]
mod foo {

View File

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(never_type)]
#![feature(exhaustive_patterns)]
#![deny(unreachable_patterns)]
fn main() {

View File

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(never_type, rustc_attrs)]
#![feature(exhaustive_patterns, rustc_attrs)]
#![warn(unreachable_code)]
#![warn(unreachable_patterns)]

View File

@ -10,8 +10,6 @@
// Test that a variable of type ! can coerce to another type.
#![feature(never_type)]
// error-pattern:explicit
fn main() {
let x: ! = panic!();

View File

@ -12,7 +12,6 @@
// error-pattern:wowzers!
#![feature(never_type)]
#![allow(unreachable_code)]
fn foo(x: !) -> ! {

View File

@ -10,8 +10,6 @@
// Test that we can explicitly cast ! to another type
#![feature(never_type)]
// error-pattern:explicit
fn main() {
let x: ! = panic!();

View File

@ -10,8 +10,6 @@
// Test that we can use ! as an associated type.
#![feature(never_type)]
// error-pattern:kapow!
trait Foo {

View File

@ -12,8 +12,6 @@
// error-pattern:oh no!
#![feature(never_type)]
struct Wub;
impl PartialEq<!> for Wub {

View File

@ -14,8 +14,6 @@
// These represent current behavior, but are pretty dubious. I would
// like to revisit these and potentially change them. --nmatsakis
#![feature(never_type)]
trait BadDefault {
fn default() -> Self;
}

View File

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(never_type)]
#![feature(exhaustive_patterns)]
#![feature(slice_patterns)]
#![allow(unreachable_patterns)]
#![allow(unreachable_code)]

View File

@ -10,8 +10,6 @@
// Test that we can call static methods on ! both directly and when it appears in a generic
#![feature(never_type)]
trait StringifyType {
fn stringify_type() -> &'static str;
}

View File

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(never_type)]
#![feature(exhaustive_patterns)]
// Regression test for inhabitedness check. The old
// cache used to cause us to incorrectly decide

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(never_type)]
#[allow(unused)]
fn never_returns() {
loop {

View File

@ -11,7 +11,6 @@
// ignore-wasm32-bare compiled with panic=abort by default
#![feature(fn_traits)]
#![feature(never_type)]
use std::panic;

View File

@ -10,8 +10,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 {

View File

@ -1,4 +1,4 @@
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
@ -8,18 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// This issue tracks a regression (a new warning) without
// feature(never_type). When we make that the default, please
// remove this test.
enum Foo { }
fn make_foo() -> Option<Foo> { None }
#[deny(warnings)]
fn main() {
match make_foo() {
None => {},
Some(_) => {}
}
fn foo() -> Result<u32, !> {
Ok(123)
}
fn main() {
let Ok(_x) = foo(); //~ ERROR refutable pattern in local binding
}

View File

@ -0,0 +1,8 @@
error[E0005]: refutable pattern in local binding: `Err(_)` not covered
--> $DIR/feature-gate-exhaustive-patterns.rs:16:9
|
16 | let Ok(_x) = foo(); //~ ERROR refutable pattern in local binding
| ^^^^^^ pattern `Err(_)` not covered
error: aborting due to previous error

View File

@ -1,28 +0,0 @@
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// 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 = &fn(!) -> !; //~ ERROR type is experimental
type Skwoz = &mut !; //~ ERROR type is experimental
impl Foo for Meeshka {
type Wub = !; //~ ERROR type is experimental
}
fn main() {
}

View File

@ -11,7 +11,6 @@
// compile-flags: -Z print-type-sizes
// must-compile-successfully
#![feature(never_type)]
#![feature(start)]
#[start]

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(never_type)]
#![allow(unused_variables)]
#![deny(unreachable_code)]

View File

@ -1,11 +1,11 @@
error: unreachable expression
--> $DIR/expr_add.rs:27:13
--> $DIR/expr_add.rs:26:13
|
LL | let x = Foo + return; //~ ERROR unreachable
| ^^^^^^^^^^^^
|
note: lint level defined here
--> $DIR/expr_add.rs:13:9
--> $DIR/expr_add.rs:12:9
|
LL | #![deny(unreachable_code)]
| ^^^^^^^^^^^^^^^^

View File

@ -12,7 +12,6 @@
#![allow(unused_assignments)]
#![allow(dead_code)]
#![deny(unreachable_code)]
#![feature(never_type)]
#![feature(type_ascription)]
fn a() {
@ -21,7 +20,7 @@ fn a() {
}
fn b() {
// the `array is unreachable:
// the array is unreachable:
let x: [usize; 2] = [22, return]; //~ ERROR unreachable
}

View File

@ -1,5 +1,5 @@
error: unreachable expression
--> $DIR/expr_array.rs:20:34
--> $DIR/expr_array.rs:19:34
|
LL | let x: [usize; 2] = [return, 22]; //~ ERROR unreachable
| ^^
@ -11,7 +11,7 @@ LL | #![deny(unreachable_code)]
| ^^^^^^^^^^^^^^^^
error: unreachable expression
--> $DIR/expr_array.rs:25:25
--> $DIR/expr_array.rs:24:25
|
LL | let x: [usize; 2] = [22, return]; //~ ERROR unreachable
| ^^^^^^^^^^^^

View File

@ -12,7 +12,6 @@
#![allow(unused_assignments)]
#![allow(dead_code)]
#![deny(unreachable_code)]
#![feature(never_type)]
fn foo() {
// No error here.

View File

@ -1,5 +1,5 @@
error: unreachable expression
--> $DIR/expr_assign.rs:20:5
--> $DIR/expr_assign.rs:19:5
|
LL | x = return; //~ ERROR unreachable
| ^^^^^^^^^^
@ -11,13 +11,13 @@ LL | #![deny(unreachable_code)]
| ^^^^^^^^^^^^^^^^
error: unreachable expression
--> $DIR/expr_assign.rs:30:14
--> $DIR/expr_assign.rs:29:14
|
LL | *p = return; //~ ERROR unreachable
| ^^^^^^
error: unreachable expression
--> $DIR/expr_assign.rs:36:15
--> $DIR/expr_assign.rs:35:15
|
LL | *{return; &mut i} = 22; //~ ERROR unreachable
| ^^^^^^

View File

@ -12,7 +12,6 @@
#![allow(unused_assignments)]
#![allow(dead_code)]
#![deny(unreachable_code)]
#![feature(never_type)]
fn a() {
// Here the tail expression is considered unreachable:

View File

@ -1,5 +1,5 @@
error: unreachable expression
--> $DIR/expr_block.rs:21:9
--> $DIR/expr_block.rs:20:9
|
LL | 22 //~ ERROR unreachable
| ^^
@ -11,7 +11,7 @@ LL | #![deny(unreachable_code)]
| ^^^^^^^^^^^^^^^^
error: unreachable statement
--> $DIR/expr_block.rs:36:9
--> $DIR/expr_block.rs:35:9
|
LL | println!("foo");
| ^^^^^^^^^^^^^^^^

View File

@ -12,7 +12,6 @@
#![allow(unused_assignments)]
#![allow(dead_code)]
#![deny(unreachable_code)]
#![feature(never_type)]
fn foo(x: !, y: usize) { }

View File

@ -1,5 +1,5 @@
error: unreachable expression
--> $DIR/expr_call.rs:23:17
--> $DIR/expr_call.rs:22:17
|
LL | foo(return, 22); //~ ERROR unreachable
| ^^
@ -11,7 +11,7 @@ LL | #![deny(unreachable_code)]
| ^^^^^^^^^^^^^^^^
error: unreachable expression
--> $DIR/expr_call.rs:28:5
--> $DIR/expr_call.rs:27:5
|
LL | bar(return); //~ ERROR unreachable
| ^^^^^^^^^^^

View File

@ -12,7 +12,6 @@
#![allow(unused_assignments)]
#![allow(dead_code)]
#![deny(unreachable_code)]
#![feature(never_type)]
#![feature(type_ascription)]
fn a() {

View File

@ -1,5 +1,5 @@
error: unreachable expression
--> $DIR/expr_cast.rs:20:13
--> $DIR/expr_cast.rs:19:13
|
LL | let x = {return} as !; //~ ERROR unreachable
| ^^^^^^^^^^^^^

View File

@ -12,7 +12,6 @@
#![allow(unused_assignments)]
#![allow(dead_code)]
#![deny(unreachable_code)]
#![feature(never_type)]
fn foo() {
if {return} {

View File

@ -1,5 +1,5 @@
error: unreachable statement
--> $DIR/expr_if.rs:38:5
--> $DIR/expr_if.rs:37:5
|
LL | println!("But I am.");
| ^^^^^^^^^^^^^^^^^^^^^^

View File

@ -12,7 +12,6 @@
#![allow(unused_assignments)]
#![allow(dead_code)]
#![deny(unreachable_code)]
#![feature(never_type)]
fn a() {
loop { return; }

View File

@ -1,5 +1,5 @@
error: unreachable statement
--> $DIR/expr_loop.rs:19:5
--> $DIR/expr_loop.rs:18:5
|
LL | println!("I am dead.");
| ^^^^^^^^^^^^^^^^^^^^^^^
@ -12,7 +12,7 @@ LL | #![deny(unreachable_code)]
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
error: unreachable statement
--> $DIR/expr_loop.rs:31:5
--> $DIR/expr_loop.rs:30:5
|
LL | println!("I am dead.");
| ^^^^^^^^^^^^^^^^^^^^^^^
@ -20,7 +20,7 @@ LL | println!("I am dead.");
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
error: unreachable statement
--> $DIR/expr_loop.rs:41:5
--> $DIR/expr_loop.rs:40:5
|
LL | println!("I am dead.");
| ^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -12,7 +12,6 @@
#![allow(unused_assignments)]
#![allow(dead_code)]
#![deny(unreachable_code)]
#![feature(never_type)]
fn a() {
// The match is considered unreachable here, because the `return`

View File

@ -1,5 +1,5 @@
error: unreachable expression
--> $DIR/expr_match.rs:20:5
--> $DIR/expr_match.rs:19:5
|
LL | match {return} { } //~ ERROR unreachable
| ^^^^^^^^^^^^^^^^^^
@ -11,7 +11,7 @@ LL | #![deny(unreachable_code)]
| ^^^^^^^^^^^^^^^^
error: unreachable statement
--> $DIR/expr_match.rs:25:5
--> $DIR/expr_match.rs:24:5
|
LL | println!("I am dead");
| ^^^^^^^^^^^^^^^^^^^^^^
@ -19,7 +19,7 @@ LL | println!("I am dead");
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
error: unreachable statement
--> $DIR/expr_match.rs:35:5
--> $DIR/expr_match.rs:34:5
|
LL | println!("I am dead");
| ^^^^^^^^^^^^^^^^^^^^^^

View File

@ -12,7 +12,6 @@
#![allow(unused_assignments)]
#![allow(dead_code)]
#![deny(unreachable_code)]
#![feature(never_type)]
struct Foo;

View File

@ -1,5 +1,5 @@
error: unreachable expression
--> $DIR/expr_method.rs:26:21
--> $DIR/expr_method.rs:25:21
|
LL | Foo.foo(return, 22); //~ ERROR unreachable
| ^^
@ -11,7 +11,7 @@ LL | #![deny(unreachable_code)]
| ^^^^^^^^^^^^^^^^
error: unreachable expression
--> $DIR/expr_method.rs:31:5
--> $DIR/expr_method.rs:30:5
|
LL | Foo.bar(return); //~ ERROR unreachable
| ^^^^^^^^^^^^^^^

View File

@ -12,7 +12,6 @@
#![allow(unused_assignments)]
#![allow(dead_code)]
#![deny(unreachable_code)]
#![feature(never_type)]
#![feature(type_ascription)]
fn a() {

View File

@ -1,5 +1,5 @@
error: unreachable expression
--> $DIR/expr_repeat.rs:20:25
--> $DIR/expr_repeat.rs:19:25
|
LL | let x: [usize; 2] = [return; 2]; //~ ERROR unreachable
| ^^^^^^^^^^^

View File

@ -12,7 +12,6 @@
#![allow(unused_assignments)]
#![allow(dead_code)]
#![deny(unreachable_code)]
#![feature(never_type)]
#![feature(type_ascription)]
fn a() {

View File

@ -1,5 +1,5 @@
error: unreachable expression
--> $DIR/expr_return.rs:21:22
--> $DIR/expr_return.rs:20:22
|
LL | let x = {return {return {return;}}}; //~ ERROR unreachable
| ^^^^^^^^^^^^^^^^

View File

@ -12,7 +12,6 @@
#![allow(unused_assignments)]
#![allow(dead_code)]
#![deny(unreachable_code)]
#![feature(never_type)]
#![feature(type_ascription)]
struct Foo {

View File

@ -1,5 +1,5 @@
error: unreachable expression
--> $DIR/expr_struct.rs:25:13
--> $DIR/expr_struct.rs:24:13
|
LL | let x = Foo { a: 22, b: 33, ..return }; //~ ERROR unreachable
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -11,19 +11,19 @@ LL | #![deny(unreachable_code)]
| ^^^^^^^^^^^^^^^^
error: unreachable expression
--> $DIR/expr_struct.rs:30:33
--> $DIR/expr_struct.rs:29:33
|
LL | let x = Foo { a: return, b: 33, ..return }; //~ ERROR unreachable
| ^^
error: unreachable expression
--> $DIR/expr_struct.rs:35:39
--> $DIR/expr_struct.rs:34:39
|
LL | let x = Foo { a: 22, b: return, ..return }; //~ ERROR unreachable
| ^^^^^^
error: unreachable expression
--> $DIR/expr_struct.rs:40:13
--> $DIR/expr_struct.rs:39:13
|
LL | let x = Foo { a: 22, b: return }; //~ ERROR unreachable
| ^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -12,7 +12,6 @@
#![allow(unused_assignments)]
#![allow(dead_code)]
#![deny(unreachable_code)]
#![feature(never_type)]
#![feature(type_ascription)]
fn a() {

View File

@ -1,5 +1,5 @@
error: unreachable expression
--> $DIR/expr_tup.rs:20:38
--> $DIR/expr_tup.rs:19:38
|
LL | let x: (usize, usize) = (return, 2); //~ ERROR unreachable
| ^
@ -11,7 +11,7 @@ LL | #![deny(unreachable_code)]
| ^^^^^^^^^^^^^^^^
error: unreachable expression
--> $DIR/expr_tup.rs:25:29
--> $DIR/expr_tup.rs:24:29
|
LL | let x: (usize, usize) = (2, return); //~ ERROR unreachable
| ^^^^^^^^^^^

View File

@ -12,7 +12,6 @@
#![allow(unused_assignments)]
#![allow(dead_code)]
#![deny(unreachable_code)]
#![feature(never_type)]
#![feature(type_ascription)]
fn a() {

View File

@ -1,5 +1,5 @@
error: unreachable expression
--> $DIR/expr_type.rs:20:13
--> $DIR/expr_type.rs:19:13
|
LL | let x = {return}: !; //~ ERROR unreachable
| ^^^^^^^^^^^

View File

@ -13,7 +13,6 @@
#![allow(dead_code)]
#![deny(unreachable_code)]
#![deny(coerce_never)]
#![feature(never_type)]
fn foo() {
let x: ! = ! { return; 22 }; //~ ERROR unreachable

View File

@ -1,5 +1,5 @@
error: unreachable expression
--> $DIR/expr_unary.rs:19:28
--> $DIR/expr_unary.rs:18:28
|
LL | let x: ! = ! { return; 22 }; //~ ERROR unreachable
| ^^
@ -11,7 +11,7 @@ LL | #![deny(unreachable_code)]
| ^^^^^^^^^^^^^^^^
error: cannot coerce `{integer}` to !
--> $DIR/expr_unary.rs:19:28
--> $DIR/expr_unary.rs:18:28
|
LL | let x: ! = ! { return; 22 }; //~ ERROR unreachable
| ^^
@ -25,7 +25,7 @@ LL | #![deny(coerce_never)]
= note: for more information, see issue #46325 <https://github.com/rust-lang/rust/issues/46325>
error[E0600]: cannot apply unary operator `!` to type `!`
--> $DIR/expr_unary.rs:19:16
--> $DIR/expr_unary.rs:18:16
|
LL | let x: ! = ! { return; 22 }; //~ ERROR unreachable
| ^^^^^^^^^^^^^^^^

View File

@ -12,7 +12,6 @@
#![allow(unused_assignments)]
#![allow(dead_code)]
#![deny(unreachable_code)]
#![feature(never_type)]
fn foo() {
while {return} {

View File

@ -1,5 +1,5 @@
error: unreachable statement
--> $DIR/expr_while.rs:19:9
--> $DIR/expr_while.rs:18:9
|
LL | println!("Hello, world!");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -12,7 +12,7 @@ LL | #![deny(unreachable_code)]
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
error: unreachable statement
--> $DIR/expr_while.rs:33:9
--> $DIR/expr_while.rs:32:9
|
LL | println!("I am dead.");
| ^^^^^^^^^^^^^^^^^^^^^^^
@ -20,7 +20,7 @@ LL | println!("I am dead.");
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
error: unreachable statement
--> $DIR/expr_while.rs:35:5
--> $DIR/expr_while.rs:34:5
|
LL | println!("I am, too.");
| ^^^^^^^^^^^^^^^^^^^^^^^