From 3c65f536206a4df9900f5f6666f3674817d3638b Mon Sep 17 00:00:00 2001 From: Taylor Cramer Date: Mon, 26 Mar 2018 23:39:29 +0200 Subject: [PATCH] Stabilize match_default_bindings This includes a submodule update to rustfmt in order to allow a stable feature declaration. --- src/Cargo.lock | 48 +++++++-------- .../match-default-bindings.md | 58 ------------------ src/librustc/diagnostics.rs | 59 ------------------- src/librustc/lib.rs | 2 +- src/librustc_borrowck/lib.rs | 2 +- src/librustc_mir/lib.rs | 2 +- src/librustc_traits/lib.rs | 2 +- src/librustc_typeck/check/_match.rs | 41 ++----------- src/librustc_typeck/lib.rs | 2 +- src/libsyntax/feature_gate.rs | 5 +- src/libsyntax/lib.rs | 2 +- src/test/compile-fail/issue-16338.rs | 1 - src/test/compile-fail/issue-20261.rs | 2 +- src/test/compile-fail/match-range-fail.rs | 2 - src/test/compile-fail/match-vec-mismatch.rs | 2 +- src/test/run-pass/nll/rc-loop.rs | 1 - .../rfc-2005-default-binding-mode/box.rs | 1 - .../rfc-2005-default-binding-mode/constref.rs | 2 - .../rfc-2005-default-binding-mode/enum.rs | 2 - .../rfc-2005-default-binding-mode/for.rs | 2 - .../rfc-2005-default-binding-mode/general.rs | 2 - .../rfc-2005-default-binding-mode/lit.rs | 2 - .../rfc-2005-default-binding-mode/range.rs | 2 - .../ref-region.rs | 2 - .../reset-mode.rs | 2 - .../rfc-2005-default-binding-mode/slice.rs | 1 - .../rfc-2005-default-binding-mode/struct.rs | 2 - .../tuple-struct.rs | 2 - .../rfc-2005-default-binding-mode/tuple.rs | 2 - src/test/ui/error-codes/E0029-teach.rs | 1 - src/test/ui/error-codes/E0029-teach.stderr | 13 +--- src/test/ui/error-codes/E0029.rs | 1 - src/test/ui/error-codes/E0029.stderr | 13 +--- .../ui/feature-gate-match_default_bindings.rs | 17 ------ ...feature-gate-match_default_bindings.stderr | 11 ---- src/test/ui/pat-slice-old-style.rs | 27 --------- src/test/ui/pat-slice-old-style.stderr | 11 ---- .../ui/rfc-2005-default-binding-mode/const.rs | 2 - .../const.stderr | 2 +- .../ui/rfc-2005-default-binding-mode/enum.rs | 2 - .../rfc-2005-default-binding-mode/enum.stderr | 6 +- .../explicit-mut.rs | 2 - .../explicit-mut.stderr | 6 +- .../ui/rfc-2005-default-binding-mode/for.rs | 2 - .../rfc-2005-default-binding-mode/for.stderr | 2 +- .../issue-44912-or.rs | 2 - .../issue-44912-or.stderr | 2 +- .../ui/rfc-2005-default-binding-mode/lit.rs | 2 - .../rfc-2005-default-binding-mode/lit.stderr | 4 +- .../ui/rfc-2005-default-binding-mode/slice.rs | 1 - .../slice.stderr | 2 +- .../suggestion.rs | 15 ----- .../suggestion.stderr | 11 ---- .../dont-suggest-dereference-on-arg.rs | 19 ------ .../dont-suggest-dereference-on-arg.stderr | 11 ---- src/tools/rustfmt | 2 +- 56 files changed, 55 insertions(+), 389 deletions(-) delete mode 100644 src/doc/unstable-book/src/language-features/match-default-bindings.md delete mode 100644 src/test/ui/feature-gate-match_default_bindings.rs delete mode 100644 src/test/ui/feature-gate-match_default_bindings.stderr delete mode 100644 src/test/ui/pat-slice-old-style.rs delete mode 100644 src/test/ui/pat-slice-old-style.stderr delete mode 100644 src/test/ui/rfc-2005-default-binding-mode/suggestion.rs delete mode 100644 src/test/ui/rfc-2005-default-binding-mode/suggestion.stderr delete mode 100644 src/test/ui/suggestions/dont-suggest-dereference-on-arg.rs delete mode 100644 src/test/ui/suggestions/dont-suggest-dereference-on-arg.stderr diff --git a/src/Cargo.lock b/src/Cargo.lock index ad745d29e15e9..8ace51ddac2b5 100644 --- a/src/Cargo.lock +++ b/src/Cargo.lock @@ -1511,7 +1511,7 @@ dependencies = [ [[package]] name = "rustc-ap-rustc_cratesio_shim" -version = "67.0.0" +version = "73.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1520,7 +1520,7 @@ dependencies = [ [[package]] name = "rustc-ap-rustc_data_structures" -version = "67.0.0" +version = "73.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1528,20 +1528,20 @@ dependencies = [ "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot_core 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-serialize 67.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-serialize 73.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "stable_deref_trait 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rustc-ap-rustc_errors" -version = "67.0.0" +version = "73.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "atty 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_data_structures 67.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-serialize 67.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-syntax_pos 67.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_data_structures 73.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-serialize 73.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-syntax_pos 73.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "termcolor 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1549,32 +1549,32 @@ dependencies = [ [[package]] name = "rustc-ap-serialize" -version = "67.0.0" +version = "73.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "rustc-ap-syntax" -version = "67.0.0" +version = "73.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_cratesio_shim 67.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_data_structures 67.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_errors 67.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-serialize 67.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-syntax_pos 67.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_cratesio_shim 73.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_data_structures 73.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_errors 73.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-serialize 73.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-syntax_pos 73.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "scoped-tls 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rustc-ap-syntax_pos" -version = "67.0.0" +version = "73.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rustc-ap-rustc_data_structures 67.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-serialize 67.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_data_structures 73.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-serialize 73.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "scoped-tls 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2009,7 +2009,7 @@ dependencies = [ "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "regex 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-syntax 67.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-syntax 73.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2729,12 +2729,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum rls-rustc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "885f66b92757420572cbb02e033d4a9558c7413ca9b7ac206f28fd58ffdb44ea" "checksum rls-span 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5d7c7046dc6a92f2ae02ed302746db4382e75131b9ce20ce967259f6b5867a6a" "checksum rls-vfs 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "be231e1e559c315bc60ced5ad2cc2d7a9c208ed7d4e2c126500149836fda19bb" -"checksum rustc-ap-rustc_cratesio_shim 67.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "adc16e4a6e50a4ffbd4633d737aedbdfcb565bdf658159e0544266908180a919" -"checksum rustc-ap-rustc_data_structures 67.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5ec5f0a018fbec07f64b689ac20f7343ed77939055ca07d2aceb37c832245b1b" -"checksum rustc-ap-rustc_errors 67.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8301221cc07002666eed552a089b15000bc954c94b14a460c0653363a7f42f4c" -"checksum rustc-ap-serialize 67.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5212ee40fc332d791cacf202ae5fb99197341857c0a14bcdf60541fea7dfc5ed" -"checksum rustc-ap-syntax 67.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "168571b3878c6c61aef4bacef95c86d30fa61fb1cff04395d9535c80c196e559" -"checksum rustc-ap-syntax_pos 67.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cd7a0486f56db583caa665c8b4ff02c4774fe279db1741509437bc8a84c53361" +"checksum rustc-ap-rustc_cratesio_shim 73.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "421262e22426c06306e46057a75048f883dbc43886f78dbe1e750397a9c9b8e6" +"checksum rustc-ap-rustc_data_structures 73.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8460c1207f9abb48a9720aee8be418bcfac018b6eee7b740b98a410e7799d24a" +"checksum rustc-ap-rustc_errors 73.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ad2077469162e52fcd84543334e18632088b9e342fe54e3b78c37d7077d09714" +"checksum rustc-ap-serialize 73.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "69943901ae255dca5f63faeae2ff08b402d34a56d1eb50d34fbff6e83e6ace60" +"checksum rustc-ap-syntax 73.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1a44363359a43df753e26a4d4fef72720af183de635ebae8699686cb5d5de813" +"checksum rustc-ap-syntax_pos 73.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "413f464657e8d5f3864de308dba1867526f21a44809b6f338b34e8c0caf88fb0" "checksum rustc-demangle 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "11fb43a206a04116ffd7cfcf9bcb941f8eb6cc7ff667272246b0a1c74259a3cb" "checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" "checksum same-file 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "cfb6eded0b06a0b512c8ddbcf04089138c9b4362c2f696f3c3d76039d68f3637" diff --git a/src/doc/unstable-book/src/language-features/match-default-bindings.md b/src/doc/unstable-book/src/language-features/match-default-bindings.md deleted file mode 100644 index cc542931cbe1f..0000000000000 --- a/src/doc/unstable-book/src/language-features/match-default-bindings.md +++ /dev/null @@ -1,58 +0,0 @@ -# `match_default_bindings` - -The tracking issue for this feature is: [#42640] - -[#42640]: https://github.com/rust-lang/rust/issues/42640 - ------------------------- - -Match default bindings (also called "default binding modes in match") improves ergonomics for -pattern-matching on references by introducing automatic dereferencing (and a corresponding shift -in binding modes) for large classes of patterns that would otherwise not compile. - -For example, under match default bindings, - -```rust -#![feature(match_default_bindings)] - -fn main() { - let x: &Option<_> = &Some(0); - - match x { - Some(y) => { - println!("y={}", *y); - }, - None => {}, - } -} -``` - -compiles and is equivalent to either of the below: - -```rust -fn main() { - let x: &Option<_> = &Some(0); - - match *x { - Some(ref y) => { - println!("y={}", *y); - }, - None => {}, - } -} -``` - -or - -```rust -fn main() { - let x: &Option<_> = &Some(0); - - match x { - &Some(ref y) => { - println!("y={}", *y); - }, - &None => {}, - } -} -``` diff --git a/src/librustc/diagnostics.rs b/src/librustc/diagnostics.rs index f95c355012a21..c74ae2343b866 100644 --- a/src/librustc/diagnostics.rs +++ b/src/librustc/diagnostics.rs @@ -887,65 +887,6 @@ foo(3_i8); // therefore the type-checker complains with this error code. ``` -Here is a more subtle instance of the same problem, that can -arise with for-loops in Rust: - -```compile_fail -let vs: Vec = vec![1, 2, 3, 4]; -for v in &vs { - match v { - 1 => {}, - _ => {}, - } -} -``` - -The above fails because of an analogous type mismatch, -though may be harder to see. Again, here are some -explanatory comments for the same example: - -```compile_fail -{ - let vs = vec![1, 2, 3, 4]; - - // `for`-loops use a protocol based on the `Iterator` - // trait. Each item yielded in a `for` loop has the - // type `Iterator::Item` -- that is, `Item` is the - // associated type of the concrete iterator impl. - for v in &vs { -// ~ ~~~ -// | | -// | We borrow `vs`, iterating over a sequence of -// | *references* of type `&Elem` (where `Elem` is -// | vector's element type). Thus, the associated -// | type `Item` must be a reference `&`-type ... -// | -// ... and `v` has the type `Iterator::Item`, as dictated by -// the `for`-loop protocol ... - - match v { - 1 => {} -// ~ -// | -// ... but *here*, `v` is forced to have some integral type; -// only types like `u8`,`i8`,`u16`,`i16`, et cetera can -// match the pattern `1` ... - - _ => {} - } - -// ... therefore, the compiler complains, because it sees -// an attempt to solve the equations -// `some integral-type` = type-of-`v` -// = `Iterator::Item` -// = `&Elem` (i.e. `some reference type`) -// -// which cannot possibly all be true. - - } -} -``` - To avoid those issues, you have to make the types match correctly. So we can fix the previous examples like this: diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs index e835d6192e547..ae8ae9404bc87 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -55,7 +55,7 @@ #![cfg_attr(stage0, feature(i128_type, i128))] #![cfg_attr(stage0, feature(inclusive_range_syntax))] #![cfg_attr(windows, feature(libc))] -#![feature(match_default_bindings)] +#![cfg_attr(stage0, feature(match_default_bindings))] #![feature(macro_lifetime_matcher)] #![feature(macro_vis_matcher)] #![feature(exhaustive_patterns)] diff --git a/src/librustc_borrowck/lib.rs b/src/librustc_borrowck/lib.rs index 2bdee3198f22a..d54654c60868c 100644 --- a/src/librustc_borrowck/lib.rs +++ b/src/librustc_borrowck/lib.rs @@ -16,7 +16,7 @@ #![allow(non_camel_case_types)] #![feature(from_ref)] -#![feature(match_default_bindings)] +#![cfg_attr(stage0, feature(match_default_bindings))] #![feature(quote)] #[macro_use] extern crate log; diff --git a/src/librustc_mir/lib.rs b/src/librustc_mir/lib.rs index a1f096b2a382a..262e5f608ca64 100644 --- a/src/librustc_mir/lib.rs +++ b/src/librustc_mir/lib.rs @@ -30,7 +30,7 @@ Rust MIR: a lowered representation of Rust. Also: an experiment! #![cfg_attr(stage0, feature(i128_type))] #![cfg_attr(stage0, feature(inclusive_range_syntax))] #![feature(macro_vis_matcher)] -#![feature(match_default_bindings)] +#![cfg_attr(stage0, feature(match_default_bindings))] #![feature(exhaustive_patterns)] #![feature(range_contains)] #![feature(rustc_diagnostic_macros)] diff --git a/src/librustc_traits/lib.rs b/src/librustc_traits/lib.rs index 2a0f076cefde3..0a21cc597e63b 100644 --- a/src/librustc_traits/lib.rs +++ b/src/librustc_traits/lib.rs @@ -14,7 +14,7 @@ #![deny(warnings)] #![feature(crate_visibility_modifier)] -#![feature(match_default_bindings)] +#![cfg_attr(stage0, feature(match_default_bindings))] #![feature(underscore_lifetimes)] #[macro_use] diff --git a/src/librustc_typeck/check/_match.rs b/src/librustc_typeck/check/_match.rs index 00c3b22780984..43ff925e422f1 100644 --- a/src/librustc_typeck/check/_match.rs +++ b/src/librustc_typeck/check/_match.rs @@ -23,7 +23,6 @@ use std::collections::hash_map::Entry::{Occupied, Vacant}; use std::cmp; use syntax::ast; use syntax::codemap::Spanned; -use syntax::feature_gate; use syntax::ptr::P; use syntax_pos::Span; @@ -114,42 +113,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } }; if pat_adjustments.len() > 0 { - if tcx.features().match_default_bindings { - debug!("default binding mode is now {:?}", def_bm); - self.inh.tables.borrow_mut() - .pat_adjustments_mut() - .insert(pat.hir_id, pat_adjustments); - } else { - let mut ref_sp = pat.span; - let mut id = pat.id; - loop { // make span include all enclosing `&` to avoid confusing diag output - id = tcx.hir.get_parent_node(id); - let node = tcx.hir.find(id); - if let Some(hir::map::NodePat(pat)) = node { - if let hir::PatKind::Ref(..) = pat.node { - ref_sp = pat.span; - } else { - break; - } - } else { - break; - } - } - let sp = ref_sp.to(pat.span); - let mut err = feature_gate::feature_err( - &tcx.sess.parse_sess, - "match_default_bindings", - sp, - feature_gate::GateIssue::Language, - "non-reference pattern used to match a reference", - ); - if let Ok(snippet) = tcx.sess.codemap().span_to_snippet(sp) { - err.span_suggestion(sp, - "consider using a reference", - format!("&{}", &snippet)); - } - err.emit(); - } + debug!("default binding mode is now {:?}", def_bm); + self.inh.tables.borrow_mut() + .pat_adjustments_mut() + .insert(pat.hir_id, pat_adjustments); } } else if let PatKind::Ref(..) = pat.node { // When you encounter a `&pat` pattern, reset to "by diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index 86c5e49d1674b..44ecb32a0bf9b 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -79,7 +79,7 @@ This API is completely unstable and subject to change. #![cfg_attr(stage0, feature(copy_closures, clone_closures))] #![feature(crate_visibility_modifier)] #![feature(from_ref)] -#![feature(match_default_bindings)] +#![cfg_attr(stage0, feature(match_default_bindings))] #![feature(exhaustive_patterns)] #![feature(option_filter)] #![feature(quote)] diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 4e3c77d5e4659..ce8c613dc8bb6 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -385,9 +385,6 @@ declare_features! ( // allow `'_` placeholder lifetimes (active, underscore_lifetimes, "1.22.0", Some(44524), None), - // Default match binding modes (RFC 2005) - (active, match_default_bindings, "1.22.0", Some(42640), None), - // Trait object syntax with `dyn` prefix (active, dyn_trait, "1.22.0", Some(44662), Some(Edition::Edition2018)), @@ -563,6 +560,8 @@ declare_features! ( (accepted, conservative_impl_trait, "1.26.0", Some(34511), None), // The `i128` type (accepted, i128_type, "1.26.0", Some(35118), None), + // Default match binding modes (RFC 2005) + (accepted, match_default_bindings, "1.26.0", Some(42640), None), ); // If you change this, please modify src/doc/unstable-book as well. You must diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index 2218b39668513..dc349c1a3e6a1 100644 --- a/src/libsyntax/lib.rs +++ b/src/libsyntax/lib.rs @@ -22,7 +22,7 @@ #![feature(unicode)] #![feature(rustc_diagnostic_macros)] -#![feature(match_default_bindings)] +#![cfg_attr(stage0, feature(match_default_bindings))] #![feature(non_exhaustive)] #![cfg_attr(stage0, feature(i128_type))] #![feature(const_atomic_usize_new)] diff --git a/src/test/compile-fail/issue-16338.rs b/src/test/compile-fail/issue-16338.rs index 6fdf8802e385e..438073e3b2f82 100644 --- a/src/test/compile-fail/issue-16338.rs +++ b/src/test/compile-fail/issue-16338.rs @@ -17,5 +17,4 @@ fn main() { let Slice { data: data, len: len } = "foo"; //~^ ERROR mismatched types //~| found type `Slice<_>` - //~| ERROR non-reference pattern used to match a reference } diff --git a/src/test/compile-fail/issue-20261.rs b/src/test/compile-fail/issue-20261.rs index 092aaa7695505..bb4dbdcd0cba7 100644 --- a/src/test/compile-fail/issue-20261.rs +++ b/src/test/compile-fail/issue-20261.rs @@ -11,7 +11,7 @@ fn main() { // NB: this (almost) typechecks when default binding modes are enabled. for (ref i,) in [].iter() { - //~^ ERROR non-reference pattern used to match a reference i.clone(); + //~^ ERROR type annotations needed } } diff --git a/src/test/compile-fail/match-range-fail.rs b/src/test/compile-fail/match-range-fail.rs index 355ff6404cea7..f89b3e39390d3 100644 --- a/src/test/compile-fail/match-range-fail.rs +++ b/src/test/compile-fail/match-range-fail.rs @@ -15,7 +15,6 @@ fn main() { //~^^ ERROR only char and numeric types are allowed in range //~| start type: &'static str //~| end type: &'static str - //~| ERROR non-reference pattern used to match a reference match "wow" { 10 ... "what" => () @@ -23,7 +22,6 @@ fn main() { //~^^ ERROR only char and numeric types are allowed in range //~| start type: {integer} //~| end type: &'static str - //~| ERROR non-reference pattern used to match a reference match 5 { 'c' ... 100 => { } diff --git a/src/test/compile-fail/match-vec-mismatch.rs b/src/test/compile-fail/match-vec-mismatch.rs index 998c11979953c..d737aa0029bf8 100644 --- a/src/test/compile-fail/match-vec-mismatch.rs +++ b/src/test/compile-fail/match-vec-mismatch.rs @@ -19,7 +19,7 @@ fn main() { // Note that this one works with default binding modes. match &[0, 1, 2] { - [..] => {} //~ ERROR non-reference pattern used to match a reference + [..] => {} }; match &[0, 1, 2] { diff --git a/src/test/run-pass/nll/rc-loop.rs b/src/test/run-pass/nll/rc-loop.rs index 2b746fac4d426..2114dbebe93fb 100644 --- a/src/test/run-pass/nll/rc-loop.rs +++ b/src/test/run-pass/nll/rc-loop.rs @@ -14,7 +14,6 @@ // `x`. The lexical checker makes this very painful. The NLL checker // does not. -#![feature(match_default_bindings)] #![feature(nll)] use std::rc::Rc; diff --git a/src/test/run-pass/rfc-2005-default-binding-mode/box.rs b/src/test/run-pass/rfc-2005-default-binding-mode/box.rs index 85453f32208cb..95bce1935e525 100644 --- a/src/test/run-pass/rfc-2005-default-binding-mode/box.rs +++ b/src/test/run-pass/rfc-2005-default-binding-mode/box.rs @@ -9,7 +9,6 @@ // except according to those terms. #![feature(box_syntax, box_patterns)] -#![feature(match_default_bindings)] struct Foo{} diff --git a/src/test/run-pass/rfc-2005-default-binding-mode/constref.rs b/src/test/run-pass/rfc-2005-default-binding-mode/constref.rs index 1b8fdbaa4d75c..af40ef2b1c5d1 100644 --- a/src/test/run-pass/rfc-2005-default-binding-mode/constref.rs +++ b/src/test/run-pass/rfc-2005-default-binding-mode/constref.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(match_default_bindings)] - const CONST_REF: &[u8; 3] = b"foo"; trait Foo { diff --git a/src/test/run-pass/rfc-2005-default-binding-mode/enum.rs b/src/test/run-pass/rfc-2005-default-binding-mode/enum.rs index a7b3db021b021..4755fc37ef347 100644 --- a/src/test/run-pass/rfc-2005-default-binding-mode/enum.rs +++ b/src/test/run-pass/rfc-2005-default-binding-mode/enum.rs @@ -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), } diff --git a/src/test/run-pass/rfc-2005-default-binding-mode/for.rs b/src/test/run-pass/rfc-2005-default-binding-mode/for.rs index 4feab94a7edf5..c2467d3f00910 100644 --- a/src/test/run-pass/rfc-2005-default-binding-mode/for.rs +++ b/src/test/run-pass/rfc-2005-default-binding-mode/for.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(match_default_bindings)] - pub fn main() { let mut tups = vec![(0u8, 1u8)]; diff --git a/src/test/run-pass/rfc-2005-default-binding-mode/general.rs b/src/test/run-pass/rfc-2005-default-binding-mode/general.rs index 779a38bdb1672..df28046d7d70b 100644 --- a/src/test/run-pass/rfc-2005-default-binding-mode/general.rs +++ b/src/test/run-pass/rfc-2005-default-binding-mode/general.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(match_default_bindings)] - fn some_or_wildcard(r: &Option, b: &i32) { let _: &i32 = match r { Some(a) => a, diff --git a/src/test/run-pass/rfc-2005-default-binding-mode/lit.rs b/src/test/run-pass/rfc-2005-default-binding-mode/lit.rs index 0b2a8e52fbf77..004ea42b65b88 100644 --- a/src/test/run-pass/rfc-2005-default-binding-mode/lit.rs +++ b/src/test/run-pass/rfc-2005-default-binding-mode/lit.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(match_default_bindings)] - fn with_u8() { let s = 5u8; let r = match &s { diff --git a/src/test/run-pass/rfc-2005-default-binding-mode/range.rs b/src/test/run-pass/rfc-2005-default-binding-mode/range.rs index aafaa4cca82ca..2292d97eaf4e5 100644 --- a/src/test/run-pass/rfc-2005-default-binding-mode/range.rs +++ b/src/test/run-pass/rfc-2005-default-binding-mode/range.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(match_default_bindings)] - pub fn main() { let i = 5; match &&&&i { diff --git a/src/test/run-pass/rfc-2005-default-binding-mode/ref-region.rs b/src/test/run-pass/rfc-2005-default-binding-mode/ref-region.rs index de7df011b56fd..bc96853fd948a 100644 --- a/src/test/run-pass/rfc-2005-default-binding-mode/ref-region.rs +++ b/src/test/run-pass/rfc-2005-default-binding-mode/ref-region.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(match_default_bindings)] - fn foo<'a, 'b>(x: &'a &'b Option) -> &'a u32 { let x: &'a &'a Option = x; match x { diff --git a/src/test/run-pass/rfc-2005-default-binding-mode/reset-mode.rs b/src/test/run-pass/rfc-2005-default-binding-mode/reset-mode.rs index f980ef0ccddda..1d86a2ecf869a 100644 --- a/src/test/run-pass/rfc-2005-default-binding-mode/reset-mode.rs +++ b/src/test/run-pass/rfc-2005-default-binding-mode/reset-mode.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(match_default_bindings)] - // Test that we "reset" the mode as we pass through a `&` pattern. // // cc #46688 diff --git a/src/test/run-pass/rfc-2005-default-binding-mode/slice.rs b/src/test/run-pass/rfc-2005-default-binding-mode/slice.rs index 6178f613b4b86..0d1d0893c593e 100644 --- a/src/test/run-pass/rfc-2005-default-binding-mode/slice.rs +++ b/src/test/run-pass/rfc-2005-default-binding-mode/slice.rs @@ -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)] fn slice_pat() { diff --git a/src/test/run-pass/rfc-2005-default-binding-mode/struct.rs b/src/test/run-pass/rfc-2005-default-binding-mode/struct.rs index 11a675c0c72af..017439b3b140f 100644 --- a/src/test/run-pass/rfc-2005-default-binding-mode/struct.rs +++ b/src/test/run-pass/rfc-2005-default-binding-mode/struct.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(match_default_bindings)] - #[derive(Debug, PartialEq)] struct Foo { x: u8, diff --git a/src/test/run-pass/rfc-2005-default-binding-mode/tuple-struct.rs b/src/test/run-pass/rfc-2005-default-binding-mode/tuple-struct.rs index 7867d6529050d..3b55405abdd7e 100644 --- a/src/test/run-pass/rfc-2005-default-binding-mode/tuple-struct.rs +++ b/src/test/run-pass/rfc-2005-default-binding-mode/tuple-struct.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(match_default_bindings)] - enum Foo { Bar(Option, (), (), Vec), Baz, diff --git a/src/test/run-pass/rfc-2005-default-binding-mode/tuple.rs b/src/test/run-pass/rfc-2005-default-binding-mode/tuple.rs index cf27265b2ed56..966b8e1a81279 100644 --- a/src/test/run-pass/rfc-2005-default-binding-mode/tuple.rs +++ b/src/test/run-pass/rfc-2005-default-binding-mode/tuple.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(match_default_bindings)] - pub fn main() { let foo = (Some(1), (), (), vec![2, 3]); diff --git a/src/test/ui/error-codes/E0029-teach.rs b/src/test/ui/error-codes/E0029-teach.rs index ca85f58133ccd..1bc2c2d58b194 100644 --- a/src/test/ui/error-codes/E0029-teach.rs +++ b/src/test/ui/error-codes/E0029-teach.rs @@ -16,7 +16,6 @@ fn main() { match s { "hello" ... "world" => {} //~^ ERROR only char and numeric types are allowed in range patterns - //~| ERROR non-reference pattern used to match a reference _ => {} } } diff --git a/src/test/ui/error-codes/E0029-teach.stderr b/src/test/ui/error-codes/E0029-teach.stderr index 25d95108f9632..4bb71f68a98b9 100644 --- a/src/test/ui/error-codes/E0029-teach.stderr +++ b/src/test/ui/error-codes/E0029-teach.stderr @@ -1,11 +1,3 @@ -error[E0658]: non-reference pattern used to match a reference (see issue #42640) - --> $DIR/E0029-teach.rs:17:9 - | -LL | "hello" ... "world" => {} - | ^^^^^^^^^^^^^^^^^^^ help: consider using a reference: `&"hello" ... "world"` - | - = help: add #![feature(match_default_bindings)] to the crate attributes to enable - error[E0029]: only char and numeric types are allowed in range patterns --> $DIR/E0029-teach.rs:17:9 | @@ -16,7 +8,6 @@ LL | "hello" ... "world" => {} = note: end type: &'static str = note: In a match expression, only numbers and characters can be matched against a range. This is because the compiler checks that the range is non-empty at compile-time, and is unable to evaluate arbitrary comparison functions. If you want to capture values of an orderable type between two end-points, you can use a guard. -error: aborting due to 2 previous errors +error: aborting due to previous error -Some errors occurred: E0029, E0658. -For more information about an error, try `rustc --explain E0029`. +For more information about this error, try `rustc --explain E0029`. diff --git a/src/test/ui/error-codes/E0029.rs b/src/test/ui/error-codes/E0029.rs index 80d215bd327c9..29b6fe4411358 100644 --- a/src/test/ui/error-codes/E0029.rs +++ b/src/test/ui/error-codes/E0029.rs @@ -14,7 +14,6 @@ fn main() { match s { "hello" ... "world" => {} //~^ ERROR only char and numeric types are allowed in range patterns - //~| ERROR non-reference pattern used to match a reference _ => {} } } diff --git a/src/test/ui/error-codes/E0029.stderr b/src/test/ui/error-codes/E0029.stderr index 53c228c6e38c9..bcdfa38711107 100644 --- a/src/test/ui/error-codes/E0029.stderr +++ b/src/test/ui/error-codes/E0029.stderr @@ -1,11 +1,3 @@ -error[E0658]: non-reference pattern used to match a reference (see issue #42640) - --> $DIR/E0029.rs:15:9 - | -LL | "hello" ... "world" => {} - | ^^^^^^^^^^^^^^^^^^^ help: consider using a reference: `&"hello" ... "world"` - | - = help: add #![feature(match_default_bindings)] to the crate attributes to enable - error[E0029]: only char and numeric types are allowed in range patterns --> $DIR/E0029.rs:15:9 | @@ -15,7 +7,6 @@ LL | "hello" ... "world" => {} = note: start type: &'static str = note: end type: &'static str -error: aborting due to 2 previous errors +error: aborting due to previous error -Some errors occurred: E0029, E0658. -For more information about an error, try `rustc --explain E0029`. +For more information about this error, try `rustc --explain E0029`. diff --git a/src/test/ui/feature-gate-match_default_bindings.rs b/src/test/ui/feature-gate-match_default_bindings.rs deleted file mode 100644 index 4ee2c1e2936a8..0000000000000 --- a/src/test/ui/feature-gate-match_default_bindings.rs +++ /dev/null @@ -1,17 +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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub fn main() { - match &Some(3) { - Some(n) => {}, - //~^ ERROR non-reference pattern used to match a reference - _ => panic!(), - } -} diff --git a/src/test/ui/feature-gate-match_default_bindings.stderr b/src/test/ui/feature-gate-match_default_bindings.stderr deleted file mode 100644 index 8fa553561de20..0000000000000 --- a/src/test/ui/feature-gate-match_default_bindings.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0658]: non-reference pattern used to match a reference (see issue #42640) - --> $DIR/feature-gate-match_default_bindings.rs:13:9 - | -LL | Some(n) => {}, - | ^^^^^^^ help: consider using a reference: `&Some(n)` - | - = 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`. diff --git a/src/test/ui/pat-slice-old-style.rs b/src/test/ui/pat-slice-old-style.rs deleted file mode 100644 index 65578e76d6d69..0000000000000 --- a/src/test/ui/pat-slice-old-style.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2016 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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// NB: this test was introduced in #23121 and will have to change when default match binding modes -// stabilizes. - -#![feature(slice_patterns)] - -fn slice_pat(x: &[u8]) { - // OLD! - match x { - [a, b..] => {}, - //~^ ERROR non-reference pattern used to match a reference - _ => panic!(), - } -} - -fn main() { - slice_pat("foo".as_bytes()); -} diff --git a/src/test/ui/pat-slice-old-style.stderr b/src/test/ui/pat-slice-old-style.stderr deleted file mode 100644 index 6fa5b18a14e86..0000000000000 --- a/src/test/ui/pat-slice-old-style.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0658]: non-reference pattern used to match a reference (see issue #42640) - --> $DIR/pat-slice-old-style.rs:19:9 - | -LL | [a, b..] => {}, - | ^^^^^^^^ help: consider using a reference: `&[a, b..]` - | - = 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`. diff --git a/src/test/ui/rfc-2005-default-binding-mode/const.rs b/src/test/ui/rfc-2005-default-binding-mode/const.rs index fca99f064a273..f80e47507ff04 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/const.rs +++ b/src/test/ui/rfc-2005-default-binding-mode/const.rs @@ -10,8 +10,6 @@ // FIXME(tschottdorf): this test should pass. -#![feature(match_default_bindings)] - #[derive(PartialEq, Eq)] struct Foo { bar: i32, diff --git a/src/test/ui/rfc-2005-default-binding-mode/const.stderr b/src/test/ui/rfc-2005-default-binding-mode/const.stderr index 302b3a8dbc325..4849c39a5d099 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/const.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/const.stderr @@ -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` diff --git a/src/test/ui/rfc-2005-default-binding-mode/enum.rs b/src/test/ui/rfc-2005-default-binding-mode/enum.rs index 76ea64e248ef8..a108653f85d20 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/enum.rs +++ b/src/test/ui/rfc-2005-default-binding-mode/enum.rs @@ -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), } diff --git a/src/test/ui/rfc-2005-default-binding-mode/enum.stderr b/src/test/ui/rfc-2005-default-binding-mode/enum.stderr index 18cd0774667c3..a7f3b507508e8 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/enum.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/enum.stderr @@ -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` diff --git a/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.rs b/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.rs index 2e43d9722a900..8001d980174e0 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.rs +++ b/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.rs @@ -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. diff --git a/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.stderr b/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.stderr index 392efecb9cd1f..f2b9bde41ab33 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.stderr @@ -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` diff --git a/src/test/ui/rfc-2005-default-binding-mode/for.rs b/src/test/ui/rfc-2005-default-binding-mode/for.rs index e9004c13a0e27..a354d2216a9c7 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/for.rs +++ b/src/test/ui/rfc-2005-default-binding-mode/for.rs @@ -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() { diff --git a/src/test/ui/rfc-2005-default-binding-mode/for.stderr b/src/test/ui/rfc-2005-default-binding-mode/for.stderr index 4094c185063e6..dbd4bd5dbec43 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/for.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/for.stderr @@ -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 diff --git a/src/test/ui/rfc-2005-default-binding-mode/issue-44912-or.rs b/src/test/ui/rfc-2005-default-binding-mode/issue-44912-or.rs index 9fbcf5d68b6ff..4f4c2a149a7d6 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/issue-44912-or.rs +++ b/src/test/ui/rfc-2005-default-binding-mode/issue-44912-or.rs @@ -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() { diff --git a/src/test/ui/rfc-2005-default-binding-mode/issue-44912-or.stderr b/src/test/ui/rfc-2005-default-binding-mode/issue-44912-or.stderr index 154fa79fa3f38..04fa3708ffb75 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/issue-44912-or.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/issue-44912-or.stderr @@ -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 diff --git a/src/test/ui/rfc-2005-default-binding-mode/lit.rs b/src/test/ui/rfc-2005-default-binding-mode/lit.rs index 783287fd458bc..209f584534615 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/lit.rs +++ b/src/test/ui/rfc-2005-default-binding-mode/lit.rs @@ -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() { diff --git a/src/test/ui/rfc-2005-default-binding-mode/lit.stderr b/src/test/ui/rfc-2005-default-binding-mode/lit.stderr index dde1f2d352c70..d5c230bc8de54 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/lit.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/lit.stderr @@ -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 diff --git a/src/test/ui/rfc-2005-default-binding-mode/slice.rs b/src/test/ui/rfc-2005-default-binding-mode/slice.rs index 20ef0624bf91b..fbe4dfe216196 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/slice.rs +++ b/src/test/ui/rfc-2005-default-binding-mode/slice.rs @@ -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() { diff --git a/src/test/ui/rfc-2005-default-binding-mode/slice.stderr b/src/test/ui/rfc-2005-default-binding-mode/slice.stderr index c0127e5990e97..18dc6b2869ab9 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/slice.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/slice.stderr @@ -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 diff --git a/src/test/ui/rfc-2005-default-binding-mode/suggestion.rs b/src/test/ui/rfc-2005-default-binding-mode/suggestion.rs deleted file mode 100644 index b9b974ff3c521..0000000000000 --- a/src/test/ui/rfc-2005-default-binding-mode/suggestion.rs +++ /dev/null @@ -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 or the MIT license -// , 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); - } -} diff --git a/src/test/ui/rfc-2005-default-binding-mode/suggestion.stderr b/src/test/ui/rfc-2005-default-binding-mode/suggestion.stderr deleted file mode 100644 index ea58c62fc8476..0000000000000 --- a/src/test/ui/rfc-2005-default-binding-mode/suggestion.stderr +++ /dev/null @@ -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`. diff --git a/src/test/ui/suggestions/dont-suggest-dereference-on-arg.rs b/src/test/ui/suggestions/dont-suggest-dereference-on-arg.rs deleted file mode 100644 index 0a2e7ef322606..0000000000000 --- a/src/test/ui/suggestions/dont-suggest-dereference-on-arg.rs +++ /dev/null @@ -1,19 +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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -fn foo(s: &str) -> bool { true } - -fn main() { - let x = vec![(String::new(), String::new())]; - x.iter() - .filter(|&(ref a, _)| foo(a)) - //~^ ERROR non-reference pattern used to match a reference - .collect(); -} diff --git a/src/test/ui/suggestions/dont-suggest-dereference-on-arg.stderr b/src/test/ui/suggestions/dont-suggest-dereference-on-arg.stderr deleted file mode 100644 index 4e2a321ffac09..0000000000000 --- a/src/test/ui/suggestions/dont-suggest-dereference-on-arg.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0658]: non-reference pattern used to match a reference (see issue #42640) - --> $DIR/dont-suggest-dereference-on-arg.rs:16:18 - | -LL | .filter(|&(ref a, _)| foo(a)) - | ^^^^^^^^^^^ help: consider using a reference: `&&(ref a, _)` - | - = 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`. diff --git a/src/tools/rustfmt b/src/tools/rustfmt index 374dba833e22c..a4462d18bf6b9 160000 --- a/src/tools/rustfmt +++ b/src/tools/rustfmt @@ -1 +1 @@ -Subproject commit 374dba833e22cc8df8e16e19cccbde61c69d9aed +Subproject commit a4462d18bf6b92aaec1eeb1c30d5ddf94a3ca987