1
Fork 0

Stabilize match_default_bindings

This includes a submodule update to rustfmt
in order to allow a stable feature declaration.
This commit is contained in:
Taylor Cramer 2018-03-26 23:39:29 +02:00
parent e58df0d8c5
commit 3c65f53620
56 changed files with 55 additions and 389 deletions

View file

@ -10,8 +10,6 @@
// FIXME(tschottdorf): this test should pass.
#![feature(match_default_bindings)]
#[derive(PartialEq, Eq)]
struct Foo {
bar: i32,

View file

@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/const.rs:26:9
--> $DIR/const.rs:24:9
|
LL | FOO => {}, //~ ERROR mismatched types
| ^^^ expected &Foo, found struct `Foo`

View file

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(match_default_bindings)]
enum Wrapper {
Wrap(i32),
}

View file

@ -1,5 +1,5 @@
error[E0594]: cannot assign to immutable borrowed content `*x`
--> $DIR/enum.rs:21:5
--> $DIR/enum.rs:19:5
|
LL | let Wrap(x) = &Wrap(3);
| - consider changing this to `x`
@ -7,7 +7,7 @@ LL | *x += 1; //~ ERROR cannot assign to immutable
| ^^^^^^^ cannot borrow as mutable
error[E0594]: cannot assign to immutable borrowed content `*x`
--> $DIR/enum.rs:25:9
--> $DIR/enum.rs:23:9
|
LL | if let Some(x) = &Some(3) {
| - consider changing this to `x`
@ -15,7 +15,7 @@ LL | *x += 1; //~ ERROR cannot assign to immutable
| ^^^^^^^ cannot borrow as mutable
error[E0594]: cannot assign to immutable borrowed content `*x`
--> $DIR/enum.rs:31:9
--> $DIR/enum.rs:29:9
|
LL | while let Some(x) = &Some(3) {
| - consider changing this to `x`

View file

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(match_default_bindings)]
// Verify the binding mode shifts - only when no `&` are auto-dereferenced is the
// final default binding mode mutable.

View file

@ -1,5 +1,5 @@
error[E0594]: cannot assign to immutable borrowed content `*n`
--> $DIR/explicit-mut.rs:19:13
--> $DIR/explicit-mut.rs:17:13
|
LL | Some(n) => {
| - consider changing this to `n`
@ -7,7 +7,7 @@ LL | *n += 1; //~ ERROR cannot assign to immutable
| ^^^^^^^ cannot borrow as mutable
error[E0594]: cannot assign to immutable borrowed content `*n`
--> $DIR/explicit-mut.rs:27:13
--> $DIR/explicit-mut.rs:25:13
|
LL | Some(n) => {
| - consider changing this to `n`
@ -15,7 +15,7 @@ LL | *n += 1; //~ ERROR cannot assign to immutable
| ^^^^^^^ cannot borrow as mutable
error[E0594]: cannot assign to immutable borrowed content `*n`
--> $DIR/explicit-mut.rs:35:13
--> $DIR/explicit-mut.rs:33:13
|
LL | Some(n) => {
| - consider changing this to `n`

View file

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(match_default_bindings)]
struct Foo {}
pub fn main() {

View file

@ -1,5 +1,5 @@
error[E0009]: cannot bind by-move and by-ref in the same pattern
--> $DIR/for.rs:18:13
--> $DIR/for.rs:16:13
|
LL | for (n, mut m) in &tups {
| - ^^^^^ by-move pattern here

View file

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(match_default_bindings)]
// FIXME(tschottdorf): This should compile. See #44912.
pub fn main() {

View file

@ -1,5 +1,5 @@
error[E0409]: variable `x` is bound in inconsistent ways within the same match arm
--> $DIR/issue-44912-or.rs:18:35
--> $DIR/issue-44912-or.rs:16:35
|
LL | Some((x, 3)) | &Some((ref x, 5)) => x,
| - first binding ^ bound in different ways

View file

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(match_default_bindings)]
// FIXME(tschottdorf): we want these to compile, but they don't.
fn with_str() {

View file

@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/lit.rs:19:13
--> $DIR/lit.rs:17:13
|
LL | "abc" => true, //~ ERROR mismatched types
| ^^^^^ expected &str, found str
@ -8,7 +8,7 @@ LL | "abc" => true, //~ ERROR mismatched types
found type `&'static str`
error[E0308]: mismatched types
--> $DIR/lit.rs:28:9
--> $DIR/lit.rs:26:9
|
LL | b"abc" => true, //~ ERROR mismatched types
| ^^^^^^ expected &[u8], found array of 3 elements

View file

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

View file

@ -1,5 +1,5 @@
error[E0004]: non-exhaustive patterns: `&[]` not covered
--> $DIR/slice.rs:17:11
--> $DIR/slice.rs:16:11
|
LL | match sl { //~ ERROR non-exhaustive patterns
| ^^ pattern `&[]` not covered

View file

@ -1,15 +0,0 @@
// Copyright 2017 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.
fn main() {
if let Some(y) = &Some(22) { //~ ERROR non-reference pattern
println!("{}", y);
}
}

View file

@ -1,11 +0,0 @@
error[E0658]: non-reference pattern used to match a reference (see issue #42640)
--> $DIR/suggestion.rs:12:12
|
LL | if let Some(y) = &Some(22) { //~ ERROR non-reference pattern
| ^^^^^^^ help: consider using a reference: `&Some(y)`
|
= help: add #![feature(match_default_bindings)] to the crate attributes to enable
error: aborting due to previous error
For more information about this error, try `rustc --explain E0658`.