Remove the let_else feature gate from the testsuite
Result of running: rg -l "feature.let_else" src/test/ | xargs sed -s -i "s#^...feature.let_else..\$##" Plus manual tidy fixes.
This commit is contained in:
parent
173eb6f407
commit
9c7ae381e6
48 changed files with 62 additions and 78 deletions
|
@ -2,7 +2,7 @@
|
|||
// revisions: drop-tracking no-drop-tracking
|
||||
// [drop-tracking] compile-flags: -Zdrop-tracking=yes
|
||||
// [no-drop-tracking] compile-flags: -Zdrop-tracking=no
|
||||
#![feature(let_else)]
|
||||
|
||||
use std::rc::Rc;
|
||||
|
||||
async fn foo(x: Option<bool>) {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// check-pass
|
||||
|
||||
#![feature(try_blocks)]
|
||||
#![feature(let_else)]
|
||||
|
||||
|
||||
fn main() {
|
||||
let _: Result<i32, i32> = try {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Issue #94176: wrong span for the error message of a mismatched type error,
|
||||
// if the function uses a `let else` construct.
|
||||
#![feature(let_else)]
|
||||
|
||||
|
||||
pub fn test(a: Option<u32>) -> Option<u32> { //~ ERROR mismatched types
|
||||
let Some(_) = a else { return None; };
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// run-pass
|
||||
// compile-flags: -C opt-level=3 -Zvalidate-mir
|
||||
|
||||
#![feature(let_else)]
|
||||
|
||||
|
||||
fn return_result() -> Option<String> {
|
||||
Some("ok".to_string())
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#![feature(let_else)]
|
||||
|
||||
#![deny(unused_variables)]
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
error: unused variable: `x`
|
||||
--> $DIR/let-else-allow-in-expr.rs:7:13
|
||||
--> $DIR/let-else-allow-in-expr.rs:5:13
|
||||
|
|
||||
LL | let x = 1;
|
||||
| ^ help: if this is intentional, prefix it with an underscore: `_x`
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/let-else-allow-in-expr.rs:3:9
|
||||
--> $DIR/let-else-allow-in-expr.rs:1:9
|
||||
|
|
||||
LL | #![deny(unused_variables)]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: unused variable: `x`
|
||||
--> $DIR/let-else-allow-in-expr.rs:29:9
|
||||
--> $DIR/let-else-allow-in-expr.rs:27:9
|
||||
|
|
||||
LL | let x = 1;
|
||||
| ^ help: if this is intentional, prefix it with an underscore: `_x`
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// issue #89807
|
||||
|
||||
#![feature(let_else)]
|
||||
|
||||
|
||||
#[deny(unused_variables)]
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// from rfc2005 test suite
|
||||
|
||||
#![feature(let_else)]
|
||||
|
||||
|
||||
// Verify the binding mode shifts - only when no `&` are auto-dereferenced is the
|
||||
// final default binding mode mutable.
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#![feature(let_else)]
|
||||
|
||||
// Slightly different from explicit-mut-annotated -- this won't show an error until borrowck.
|
||||
// Should it show a type error instead?
|
||||
|
||||
|
||||
|
||||
fn main() {
|
||||
let Some(n): &mut Option<i32> = &mut &Some(5i32) else {
|
||||
//~^ ERROR cannot borrow data in a `&` reference as mutable
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// check-pass
|
||||
|
||||
#![feature(let_else)]
|
||||
|
||||
|
||||
fn main() {
|
||||
let Some(n) = &mut &mut Some(5i32) else { return; };
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// from rfc2005 test suite
|
||||
|
||||
#![feature(let_else)]
|
||||
|
||||
|
||||
// Verify the binding mode shifts - only when no `&` are auto-dereferenced is the
|
||||
// final default binding mode mutable.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// from rfc2005 test suite
|
||||
|
||||
#![feature(let_else)]
|
||||
|
||||
|
||||
pub fn main() {
|
||||
let Some(x) = &Some(3) else {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// run-pass
|
||||
// adapted from src/test/ui/binding/if-let.rs
|
||||
#![feature(let_else)]
|
||||
|
||||
#![allow(dead_code)]
|
||||
|
||||
fn none() -> bool {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// run-rustfix
|
||||
|
||||
#![feature(let_else)]
|
||||
|
||||
|
||||
fn main() {
|
||||
let true = (true && false) else { return }; //~ ERROR a `&&` expression cannot be directly assigned in `let...else`
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// run-rustfix
|
||||
|
||||
#![feature(let_else)]
|
||||
|
||||
|
||||
fn main() {
|
||||
let true = true && false else { return }; //~ ERROR a `&&` expression cannot be directly assigned in `let...else`
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// run-rustfix
|
||||
|
||||
#![feature(let_else)]
|
||||
|
||||
|
||||
fn main() {
|
||||
let Some(1) = ({ Some(1) }) else {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// run-rustfix
|
||||
|
||||
#![feature(let_else)]
|
||||
|
||||
|
||||
fn main() {
|
||||
let Some(1) = { Some(1) } else {
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#![feature(let_else)]
|
||||
|
||||
#![deny(unused_variables)]
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
error: unused variable: `x`
|
||||
--> $DIR/let-else-check.rs:14:13
|
||||
--> $DIR/let-else-check.rs:12:13
|
||||
|
|
||||
LL | let x = 1;
|
||||
| ^ help: if this is intentional, prefix it with an underscore: `_x`
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/let-else-check.rs:3:9
|
||||
--> $DIR/let-else-check.rs:1:9
|
||||
|
|
||||
LL | #![deny(unused_variables)]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: unused variable: `x`
|
||||
--> $DIR/let-else-check.rs:18:9
|
||||
--> $DIR/let-else-check.rs:16:9
|
||||
|
|
||||
LL | let x = 1;
|
||||
| ^ help: if this is intentional, prefix it with an underscore: `_x`
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
// Deref/DerefMut to Bar. You can do this with an irrefutable binding, so it should work with
|
||||
// let-else too.
|
||||
|
||||
#![feature(let_else)]
|
||||
|
||||
use std::ops::{Deref, DerefMut};
|
||||
|
||||
struct Foo(Bar);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// We attempt to `let Bar::Present(_) = foo else { ... }` where foo is meant to Deref/DerefMut to
|
||||
// Bar. This fails, you must add a type annotation like `let _: &mut Bar = _ else { ... }`
|
||||
|
||||
#![feature(let_else)]
|
||||
|
||||
use std::ops::{Deref, DerefMut};
|
||||
|
||||
struct Foo(Bar);
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#![feature(let_else)]
|
||||
#[derive(Debug)]
|
||||
enum Foo {
|
||||
Done,
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
error: <assignment> ... else { ... } is not allowed
|
||||
--> $DIR/let-else-destructuring.rs:11:9
|
||||
--> $DIR/let-else-destructuring.rs:10:9
|
||||
|
|
||||
LL | &Foo::Nested(Some(value)) = value else { break };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0070]: invalid left-hand side of assignment
|
||||
--> $DIR/let-else-destructuring.rs:11:35
|
||||
--> $DIR/let-else-destructuring.rs:10:35
|
||||
|
|
||||
LL | &Foo::Nested(Some(value)) = value else { break };
|
||||
| ------------------------- ^
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
// This is important as it's easy to update the stdout file
|
||||
// with a --bless and miss the impact of that change.
|
||||
|
||||
#![feature(let_else)]
|
||||
|
||||
#![allow(irrefutable_let_patterns)]
|
||||
|
||||
use std::cell::RefCell;
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#![feature(let_else)]
|
||||
|
||||
fn main() {
|
||||
let Some(_) = Some(()) else if true {
|
||||
//~^ ERROR conditional `else if` is not supported for `let...else`
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: conditional `else if` is not supported for `let...else`
|
||||
--> $DIR/let-else-if.rs:4:33
|
||||
--> $DIR/let-else-if.rs:2:33
|
||||
|
|
||||
LL | let Some(_) = Some(()) else if true {
|
||||
| ^^ expected `{`
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// check-pass
|
||||
|
||||
#![feature(let_else)]
|
||||
|
||||
|
||||
fn main() {
|
||||
let x = 1 else { return }; //~ WARN irrefutable `let...else` pattern
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#![feature(let_else)]
|
||||
|
||||
fn main() {
|
||||
let Some(x) = Some(1) else {
|
||||
return;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: expected `;`, found keyword `let`
|
||||
--> $DIR/let-else-missing-semicolon.rs:6:6
|
||||
--> $DIR/let-else-missing-semicolon.rs:4:6
|
||||
|
|
||||
LL | }
|
||||
| ^ help: add `;` here
|
||||
|
@ -7,7 +7,7 @@ LL | let _ = "";
|
|||
| --- unexpected token
|
||||
|
||||
error: expected `;`, found `}`
|
||||
--> $DIR/let-else-missing-semicolon.rs:10:6
|
||||
--> $DIR/let-else-missing-semicolon.rs:8:6
|
||||
|
|
||||
LL | }
|
||||
| ^ help: add `;` here
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// from rfc2005 test suite
|
||||
|
||||
#![feature(let_else)]
|
||||
|
||||
|
||||
// Without caching type lookups in FnCtxt.resolve_ty_and_def_ufcs
|
||||
// the error below would be reported twice (once when checking
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
//
|
||||
// The move was due to mir::Place being Copy, but mir::VarDebugInfoContents not being Copy.
|
||||
|
||||
#![feature(let_else)]
|
||||
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
struct Copyable;
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#![feature(let_else)]
|
||||
|
||||
fn main() {
|
||||
let Some(x) = Some(1) else { //~ ERROR does not diverge
|
||||
Some(2)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error[E0308]: `else` clause of `let...else` does not diverge
|
||||
--> $DIR/let-else-non-diverging.rs:4:32
|
||||
--> $DIR/let-else-non-diverging.rs:2:32
|
||||
|
|
||||
LL | let Some(x) = Some(1) else {
|
||||
| ________________________________^
|
||||
|
@ -13,7 +13,7 @@ LL | | };
|
|||
= help: ...or use `match` instead of `let...else`
|
||||
|
||||
error[E0308]: `else` clause of `let...else` does not diverge
|
||||
--> $DIR/let-else-non-diverging.rs:7:32
|
||||
--> $DIR/let-else-non-diverging.rs:5:32
|
||||
|
|
||||
LL | let Some(x) = Some(1) else {
|
||||
| ________________________________^
|
||||
|
@ -29,7 +29,7 @@ LL | | };
|
|||
= help: ...or use `match` instead of `let...else`
|
||||
|
||||
error[E0308]: `else` clause of `let...else` does not diverge
|
||||
--> $DIR/let-else-non-diverging.rs:12:32
|
||||
--> $DIR/let-else-non-diverging.rs:10:32
|
||||
|
|
||||
LL | let Some(x) = Some(1) else { Some(2) };
|
||||
| ^^^^^^^^^^^ expected `!`, found enum `Option`
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// check-pass
|
||||
|
||||
#![feature(let_else)]
|
||||
|
||||
#![allow(unused_variables)]
|
||||
|
||||
fn ref_() {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#![feature(let_else)]
|
||||
#![allow(unused_variables)]
|
||||
|
||||
|
||||
fn ref_() {
|
||||
let bytes: Vec<u8> = b"Hello"[..].to_vec();
|
||||
let some = Some(bytes);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// run-pass
|
||||
|
||||
#![feature(let_else)]
|
||||
|
||||
|
||||
fn main() {
|
||||
#[allow(dead_code)]
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#![feature(let_else)]
|
||||
|
||||
fn main() {
|
||||
let Some(x) = Some(2) else {
|
||||
panic!("{}", x); //~ ERROR cannot find value `x` in this scope
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error[E0425]: cannot find value `x` in this scope
|
||||
--> $DIR/let-else-scope.rs:5:22
|
||||
--> $DIR/let-else-scope.rs:3:22
|
||||
|
|
||||
LL | panic!("{}", x);
|
||||
| ^ not found in this scope
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// issue #92069
|
||||
#![feature(let_else)]
|
||||
|
||||
|
||||
fn main() {
|
||||
let nums = vec![5, 4, 3, 2, 1];
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// run-pass
|
||||
// issue #89688
|
||||
|
||||
#![feature(let_else)]
|
||||
|
||||
|
||||
fn example_let_else(value: Option<String>) {
|
||||
let Some(inner) = value else {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// from issue #93951, where borrowck complained the temporary that `foo(&x)` was stored in was to
|
||||
// be dropped sometime after `x` was. It then suggested adding a semicolon that was already there.
|
||||
|
||||
#![feature(let_else)]
|
||||
|
||||
use std::fmt::Debug;
|
||||
|
||||
fn foo<'a>(x: &'a str) -> Result<impl Debug + 'a, ()> {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
// run-pass
|
||||
// compile-flags: -Zvalidate-mir
|
||||
#![feature(let_else)]
|
||||
|
||||
use std::fmt::Display;
|
||||
use std::rc::Rc;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// popped up in in #94012, where an alternative desugaring was
|
||||
// causing unreachable code errors
|
||||
|
||||
#![feature(let_else)]
|
||||
|
||||
#![deny(unused_variables)]
|
||||
#![deny(unreachable_code)]
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#![feature(let_else)]
|
||||
|
||||
#![deny(unreachable_patterns)]
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -1,71 +1,71 @@
|
|||
error: unreachable pattern
|
||||
--> $DIR/top-level-alternation.rs:6:23
|
||||
--> $DIR/top-level-alternation.rs:4:23
|
||||
|
|
||||
LL | while let 0..=2 | 1 = 0 {}
|
||||
| ^
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/top-level-alternation.rs:3:9
|
||||
--> $DIR/top-level-alternation.rs:1:9
|
||||
|
|
||||
LL | #![deny(unreachable_patterns)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/top-level-alternation.rs:7:20
|
||||
--> $DIR/top-level-alternation.rs:5:20
|
||||
|
|
||||
LL | if let 0..=2 | 1 = 0 {}
|
||||
| ^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/top-level-alternation.rs:11:15
|
||||
--> $DIR/top-level-alternation.rs:9:15
|
||||
|
|
||||
LL | | 0 => {}
|
||||
| ^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/top-level-alternation.rs:16:15
|
||||
--> $DIR/top-level-alternation.rs:14:15
|
||||
|
|
||||
LL | | Some(0) => {}
|
||||
| ^^^^^^^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/top-level-alternation.rs:21:9
|
||||
--> $DIR/top-level-alternation.rs:19:9
|
||||
|
|
||||
LL | (0, 0) => {}
|
||||
| ^^^^^^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/top-level-alternation.rs:41:9
|
||||
--> $DIR/top-level-alternation.rs:39:9
|
||||
|
|
||||
LL | _ => {}
|
||||
| ^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/top-level-alternation.rs:45:9
|
||||
--> $DIR/top-level-alternation.rs:43:9
|
||||
|
|
||||
LL | Some(_) => {}
|
||||
| ^^^^^^^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/top-level-alternation.rs:46:9
|
||||
--> $DIR/top-level-alternation.rs:44:9
|
||||
|
|
||||
LL | None => {}
|
||||
| ^^^^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/top-level-alternation.rs:51:9
|
||||
--> $DIR/top-level-alternation.rs:49:9
|
||||
|
|
||||
LL | None | Some(_) => {}
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/top-level-alternation.rs:55:9
|
||||
--> $DIR/top-level-alternation.rs:53:9
|
||||
|
|
||||
LL | 1..=2 => {},
|
||||
| ^^^^^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/top-level-alternation.rs:58:14
|
||||
--> $DIR/top-level-alternation.rs:56:14
|
||||
|
|
||||
LL | let (0 | 0) = 0 else { return };
|
||||
| ^
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#![feature(let_chains, let_else)]
|
||||
#![feature(let_chains)]
|
||||
|
||||
fn main() {
|
||||
let opt = Some(1i32);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// compile-flags: -Zunpretty=hir
|
||||
// check-pass
|
||||
|
||||
#![feature(let_else)]
|
||||
|
||||
|
||||
fn foo(x: Option<u32>) {
|
||||
let Some(_) = x else { panic!() };
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
// compile-flags: -Zunpretty=hir
|
||||
// check-pass
|
||||
|
||||
#![feature(let_else)]
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
#[macro_use]
|
||||
extern crate std;
|
||||
// compile-flags: -Zunpretty=hir
|
||||
// check-pass
|
||||
|
||||
|
||||
|
||||
fn foo(x:
|
||||
Option<u32>) {
|
||||
|
|
Loading…
Add table
Reference in a new issue