diff --git a/src/doc/unstable-book/src/language-features/slice-patterns.md b/src/doc/unstable-book/src/language-features/slice-patterns.md deleted file mode 100644 index cdb74495884a8..0000000000000 --- a/src/doc/unstable-book/src/language-features/slice-patterns.md +++ /dev/null @@ -1,32 +0,0 @@ -# `slice_patterns` - -The tracking issue for this feature is: [#62254] - -[#62254]: https://github.com/rust-lang/rust/issues/62254 - ------------------------- - -The `slice_patterns` feature gate lets you use `..` to indicate any number of -elements inside a pattern matching a slice. This wildcard can only be used once -for a given array. If there's an pattern before the `..`, the subslice will be -matched against that pattern. For example: - -```rust -#![feature(slice_patterns)] - -fn is_symmetric(list: &[u32]) -> bool { - match list { - &[] | &[_] => true, - &[x, ref inside @ .., y] if x == y => is_symmetric(inside), - &[..] => false, - } -} - -fn main() { - let sym = &[0, 1, 4, 2, 4, 1, 0]; - assert!(is_symmetric(sym)); - - let not_sym = &[0, 1, 7, 2, 4, 1, 0]; - assert!(!is_symmetric(not_sym)); -} -``` diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index 15720ddcfc677..f77b4d7461e74 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -133,7 +133,7 @@ #![feature(associated_type_bounds)] #![feature(const_type_id)] #![feature(const_caller_location)] -#![feature(slice_patterns)] +#![cfg_attr(bootstrap, feature(slice_patterns))] #[prelude_import] #[allow(unused)] diff --git a/src/libcore/tests/lib.rs b/src/libcore/tests/lib.rs index 8c034938c2bb9..f0420247acfbd 100644 --- a/src/libcore/tests/lib.rs +++ b/src/libcore/tests/lib.rs @@ -19,7 +19,7 @@ #![feature(range_is_empty)] #![feature(raw)] #![feature(saturating_neg)] -#![feature(slice_patterns)] +#![cfg_attr(bootstrap, feature(slice_patterns))] #![feature(sort_internals)] #![feature(slice_partition_at_index)] #![feature(specialization)] diff --git a/src/librustc/benches/lib.rs b/src/librustc/benches/lib.rs index ffb12f11c5136..de82b262e4956 100644 --- a/src/librustc/benches/lib.rs +++ b/src/librustc/benches/lib.rs @@ -1,4 +1,4 @@ -#![feature(slice_patterns)] +#![cfg_attr(bootstrap, feature(slice_patterns))] #![feature(test)] extern crate test; diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs index b894aabd90100..69ca40636948f 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -42,7 +42,7 @@ #![feature(optin_builtin_traits)] #![feature(option_expect_none)] #![feature(range_is_empty)] -#![feature(slice_patterns)] +#![cfg_attr(bootstrap, feature(slice_patterns))] #![feature(specialization)] #![feature(unboxed_closures)] #![feature(thread_local)] diff --git a/src/librustc_ast_passes/feature_gate.rs b/src/librustc_ast_passes/feature_gate.rs index 1e4b1ae077762..4e1cca0a195c9 100644 --- a/src/librustc_ast_passes/feature_gate.rs +++ b/src/librustc_ast_passes/feature_gate.rs @@ -470,29 +470,8 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { visit::walk_expr(self, e) } - fn visit_arm(&mut self, arm: &'a ast::Arm) { - visit::walk_arm(self, arm) - } - fn visit_pat(&mut self, pattern: &'a ast::Pat) { match &pattern.kind { - PatKind::Slice(pats) => { - for pat in &*pats { - let span = pat.span; - let inner_pat = match &pat.kind { - PatKind::Ident(.., Some(pat)) => pat, - _ => pat, - }; - if inner_pat.is_rest() { - gate_feature_post!( - &self, - slice_patterns, - span, - "subslice patterns are unstable" - ); - } - } - } PatKind::Box(..) => { gate_feature_post!( &self, diff --git a/src/librustc_ast_passes/lib.rs b/src/librustc_ast_passes/lib.rs index eadbc485296e8..5de45f4e1f365 100644 --- a/src/librustc_ast_passes/lib.rs +++ b/src/librustc_ast_passes/lib.rs @@ -2,7 +2,7 @@ //! parsed by `rustc_parse` and then lowered, after the passes in this crate, //! by `rustc_ast_lowering`. -#![feature(slice_patterns)] +#![cfg_attr(bootstrap, feature(slice_patterns))] pub mod ast_validation; pub mod feature_gate; diff --git a/src/librustc_codegen_ssa/lib.rs b/src/librustc_codegen_ssa/lib.rs index ee527ecb509b2..aba77231268e7 100644 --- a/src/librustc_codegen_ssa/lib.rs +++ b/src/librustc_codegen_ssa/lib.rs @@ -4,7 +4,7 @@ #![feature(box_syntax)] #![feature(core_intrinsics)] #![feature(libc)] -#![feature(slice_patterns)] +#![cfg_attr(bootstrap, feature(slice_patterns))] #![feature(stmt_expr_attributes)] #![feature(try_blocks)] #![feature(in_band_lifetimes)] diff --git a/src/librustc_error_codes/error_codes/E0198.md b/src/librustc_error_codes/error_codes/E0198.md index 6504d60dbd1d5..687214a205096 100644 --- a/src/librustc_error_codes/error_codes/E0198.md +++ b/src/librustc_error_codes/error_codes/E0198.md @@ -1,17 +1,18 @@ -A negative implementation is one that excludes a type from implementing a -particular trait. Not being able to use a trait is always a safe operation, -so negative implementations are always safe and never need to be marked as -unsafe. +A negative implementation was marked as unsafe. -```compile_fail -#![feature(optin_builtin_traits)] +Erroneous code example: +```compile_fail struct Foo; -// unsafe is unnecessary -unsafe impl !Clone for Foo { } +unsafe impl !Clone for Foo { } // error! ``` +A negative implementation is one that excludes a type from implementing a +particular trait. Not being able to use a trait is always a safe operation, +so negative implementations are always safe and never need to be marked as +unsafe. + This will compile: ```ignore (ignore auto_trait future compatibility warning) diff --git a/src/librustc_error_codes/error_codes/E0199.md b/src/librustc_error_codes/error_codes/E0199.md index d0c12dc6f1755..88130e8e5e596 100644 --- a/src/librustc_error_codes/error_codes/E0199.md +++ b/src/librustc_error_codes/error_codes/E0199.md @@ -1,14 +1,23 @@ +A trait implementation was marked as unsafe while the trait is safe. + +Erroneous code example: + +```compile_fail,E0199 +struct Foo; + +trait Bar { } + +unsafe impl Bar for Foo { } // error! +``` + Safe traits should not have unsafe implementations, therefore marking an implementation for a safe trait unsafe will cause a compiler error. Removing -the unsafe marker on the trait noted in the error will resolve this problem. +the unsafe marker on the trait noted in the error will resolve this problem: -```compile_fail,E0199 +``` struct Foo; trait Bar { } -// this won't compile because Bar is safe -unsafe impl Bar for Foo { } -// this will compile -impl Bar for Foo { } +impl Bar for Foo { } // ok! ``` diff --git a/src/librustc_error_codes/error_codes/E0527.md b/src/librustc_error_codes/error_codes/E0527.md index 4bff39dc770e0..97ea312693881 100644 --- a/src/librustc_error_codes/error_codes/E0527.md +++ b/src/librustc_error_codes/error_codes/E0527.md @@ -17,8 +17,6 @@ Ensure that the pattern is consistent with the size of the matched array. Additional elements can be matched with `..`: ``` -#![feature(slice_patterns)] - let r = &[1, 2, 3, 4]; match r { &[a, b, ..] => { // ok! diff --git a/src/librustc_error_codes/error_codes/E0528.md b/src/librustc_error_codes/error_codes/E0528.md index 4b6ea2469919c..54c2c4d4e9d0f 100644 --- a/src/librustc_error_codes/error_codes/E0528.md +++ b/src/librustc_error_codes/error_codes/E0528.md @@ -4,8 +4,6 @@ matched array. Example of erroneous code: ```compile_fail,E0528 -#![feature(slice_patterns)] - let r = &[1, 2]; match r { &[a, b, c, rest @ ..] => { // error: pattern requires at least 3 @@ -19,8 +17,6 @@ Ensure that the matched array has at least as many elements as the pattern requires. You can match an arbitrary number of remaining elements with `..`: ``` -#![feature(slice_patterns)] - let r = &[1, 2, 3, 4, 5]; match r { &[a, b, c, rest @ ..] => { // ok! diff --git a/src/librustc_error_codes/error_codes/E0730.md b/src/librustc_error_codes/error_codes/E0730.md index 803a25148651c..bf1f72be32589 100644 --- a/src/librustc_error_codes/error_codes/E0730.md +++ b/src/librustc_error_codes/error_codes/E0730.md @@ -18,8 +18,6 @@ Ensure that the pattern is consistent with the size of the matched array. Additional elements can be matched with `..`: ``` -#![feature(slice_patterns)] - let r = &[1, 2, 3, 4]; match r { &[a, b, ..] => { // ok! diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs index 526b4e2971bef..b0e0cb611afaf 100644 --- a/src/librustc_errors/emitter.rs +++ b/src/librustc_errors/emitter.rs @@ -1476,6 +1476,15 @@ impl EmitterWriter { None => return Ok(()), }; + // Render the replacements for each suggestion + let suggestions = suggestion.splice_lines(&**sm); + + if suggestions.is_empty() { + // Suggestions coming from macros can have malformed spans. This is a heavy handed + // approach to avoid ICEs by ignoring the suggestion outright. + return Ok(()); + } + let mut buffer = StyledBuffer::new(); // Render the suggestion message @@ -1492,9 +1501,6 @@ impl EmitterWriter { Some(Style::HeaderMsg), ); - // Render the replacements for each suggestion - let suggestions = suggestion.splice_lines(&**sm); - let mut row_num = 2; let mut notice_capitalization = false; for (complete, parts, only_capitalization) in suggestions.iter().take(MAX_SUGGESTIONS) { @@ -1505,7 +1511,9 @@ impl EmitterWriter { let show_underline = !(parts.len() == 1 && parts[0].snippet.trim() == complete.trim()) && complete.lines().count() == 1; - let lines = sm.span_to_lines(parts[0].span).unwrap(); + let lines = sm + .span_to_lines(parts[0].span) + .expect("span_to_lines failed when emitting suggestion"); assert!(!lines.lines.is_empty()); diff --git a/src/librustc_errors/lib.rs b/src/librustc_errors/lib.rs index e24e8719133a9..827e9b831f32d 100644 --- a/src/librustc_errors/lib.rs +++ b/src/librustc_errors/lib.rs @@ -10,6 +10,7 @@ pub use emitter::ColorConfig; +use log::debug; use Level::*; use emitter::{is_case_difference, Emitter, EmitterWriter}; @@ -174,6 +175,15 @@ impl CodeSuggestion { self.substitutions .iter() + .filter(|subst| { + // Suggestions coming from macros can have malformed spans. This is a heavy + // handed approach to avoid ICEs by ignoring the suggestion outright. + let invalid = subst.parts.iter().any(|item| cm.is_valid_span(item.span).is_err()); + if invalid { + debug!("splice_lines: suggestion contains an invalid span: {:?}", subst); + } + !invalid + }) .cloned() .map(|mut substitution| { // Assumption: all spans are in the same file, and all spans diff --git a/src/librustc_feature/accepted.rs b/src/librustc_feature/accepted.rs index d880fc84b3819..007cee4c76424 100644 --- a/src/librustc_feature/accepted.rs +++ b/src/librustc_feature/accepted.rs @@ -257,6 +257,8 @@ declare_features! ( /// Allows relaxing the coherence rules such that /// `impl ForeignTrait for ForeignType` is permitted. (accepted, re_rebalance_coherence, "1.41.0", Some(55437), None), + /// Allows using subslice patterns, `[a, .., b]` and `[a, xs @ .., b]`. + (accepted, slice_patterns, "1.42.0", Some(62254), None), // ------------------------------------------------------------------------- // feature-group-end: accepted features diff --git a/src/librustc_feature/active.rs b/src/librustc_feature/active.rs index 4c8c47a567113..6af9b6c087278 100644 --- a/src/librustc_feature/active.rs +++ b/src/librustc_feature/active.rs @@ -262,9 +262,6 @@ declare_features! ( /// Allows using non lexical lifetimes (RFC 2094). (active, nll, "1.0.0", Some(43234), None), - /// Allows using slice patterns. - (active, slice_patterns, "1.0.0", Some(62254), None), - /// Allows the definition of `const` functions with some advanced features. (active, const_fn, "1.2.0", Some(57563), None), diff --git a/src/librustc_lint/nonstandard_style.rs b/src/librustc_lint/nonstandard_style.rs index a2b7884241ff7..394da4a5bb0c1 100644 --- a/src/librustc_lint/nonstandard_style.rs +++ b/src/librustc_lint/nonstandard_style.rs @@ -350,7 +350,20 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonSnakeCase { } fn check_pat(&mut self, cx: &LateContext<'_, '_>, p: &hir::Pat<'_>) { - if let &PatKind::Binding(_, _, ident, _) = &p.kind { + if let &PatKind::Binding(_, hid, ident, _) = &p.kind { + if let hir::Node::Pat(parent_pat) = cx.tcx.hir().get(cx.tcx.hir().get_parent_node(hid)) + { + if let PatKind::Struct(_, field_pats, _) = &parent_pat.kind { + for field in field_pats.iter() { + if field.ident != ident { + // Only check if a new name has been introduced, to avoid warning + // on both the struct definition and this pattern. + self.check_snake_case(cx, "variable", &ident); + } + } + return; + } + } self.check_snake_case(cx, "variable", &ident); } } diff --git a/src/librustc_metadata/lib.rs b/src/librustc_metadata/lib.rs index 0fec4bff1633d..cf925ab91875f 100644 --- a/src/librustc_metadata/lib.rs +++ b/src/librustc_metadata/lib.rs @@ -10,7 +10,7 @@ #![feature(proc_macro_internals)] #![feature(proc_macro_quote)] #![feature(rustc_private)] -#![feature(slice_patterns)] +#![cfg_attr(bootstrap, feature(slice_patterns))] #![feature(specialization)] #![feature(stmt_expr_attributes)] #![recursion_limit = "256"] diff --git a/src/librustc_mir/lib.rs b/src/librustc_mir/lib.rs index 1c25b269b18fd..5e42ba3279027 100644 --- a/src/librustc_mir/lib.rs +++ b/src/librustc_mir/lib.rs @@ -7,7 +7,7 @@ Rust MIR: a lowered representation of Rust. Also: an experiment! #![feature(nll)] #![feature(in_band_lifetimes)] #![feature(inner_deref)] -#![feature(slice_patterns)] +#![cfg_attr(bootstrap, feature(slice_patterns))] #![feature(bool_to_option)] #![feature(box_patterns)] #![feature(box_syntax)] diff --git a/src/librustc_mir/transform/qualify_min_const_fn.rs b/src/librustc_mir/transform/qualify_min_const_fn.rs index 7034556740849..d927553c72e8b 100644 --- a/src/librustc_mir/transform/qualify_min_const_fn.rs +++ b/src/librustc_mir/transform/qualify_min_const_fn.rs @@ -309,7 +309,11 @@ fn check_terminator( ) -> McfResult { let span = terminator.source_info.span; match &terminator.kind { - TerminatorKind::Goto { .. } | TerminatorKind::Return | TerminatorKind::Resume => Ok(()), + TerminatorKind::FalseEdges { .. } + | TerminatorKind::FalseUnwind { .. } + | TerminatorKind::Goto { .. } + | TerminatorKind::Return + | TerminatorKind::Resume => Ok(()), TerminatorKind::Drop { location, .. } => check_place(tcx, location, span, def_id, body), TerminatorKind::DropAndReplace { location, value, .. } => { @@ -317,13 +321,10 @@ fn check_terminator( check_operand(tcx, value, span, def_id, body) } - TerminatorKind::FalseEdges { .. } | TerminatorKind::SwitchInt { .. } - if !feature_allowed(tcx, def_id, sym::const_if_match) => - { + TerminatorKind::SwitchInt { .. } if !feature_allowed(tcx, def_id, sym::const_if_match) => { Err((span, "loops and conditional expressions are not stable in const fn".into())) } - TerminatorKind::FalseEdges { .. } => Ok(()), TerminatorKind::SwitchInt { discr, switch_ty: _, values: _, targets: _ } => { check_operand(tcx, discr, span, def_id, body) } @@ -367,13 +368,5 @@ fn check_terminator( TerminatorKind::Assert { cond, expected: _, msg: _, target: _, cleanup: _ } => { check_operand(tcx, cond, span, def_id, body) } - - TerminatorKind::FalseUnwind { .. } if feature_allowed(tcx, def_id, sym::const_loop) => { - Ok(()) - } - - TerminatorKind::FalseUnwind { .. } => { - Err((span, "loops are not allowed in const fn".into())) - } } } diff --git a/src/librustc_parse/lib.rs b/src/librustc_parse/lib.rs index 9227e968ecc4f..08f4f210152dd 100644 --- a/src/librustc_parse/lib.rs +++ b/src/librustc_parse/lib.rs @@ -2,7 +2,7 @@ #![feature(bool_to_option)] #![feature(crate_visibility_modifier)] -#![feature(slice_patterns)] +#![cfg_attr(bootstrap, feature(slice_patterns))] use syntax::ast; use syntax::print::pprust; diff --git a/src/librustc_passes/lib.rs b/src/librustc_passes/lib.rs index 65eb07b989d83..d746f097928ea 100644 --- a/src/librustc_passes/lib.rs +++ b/src/librustc_passes/lib.rs @@ -7,7 +7,7 @@ #![doc(html_root_url = "https://doc.rust-lang.org/nightly/")] #![feature(in_band_lifetimes)] #![feature(nll)] -#![feature(slice_patterns)] +#![cfg_attr(bootstrap, feature(slice_patterns))] #![recursion_limit = "256"] #[macro_use] diff --git a/src/librustc_span/source_map.rs b/src/librustc_span/source_map.rs index fb5fcf4a8303b..9c7c0f0c8b0ec 100644 --- a/src/librustc_span/source_map.rs +++ b/src/librustc_span/source_map.rs @@ -473,20 +473,23 @@ impl SourceMap { lo.line != hi.line } - pub fn span_to_lines(&self, sp: Span) -> FileLinesResult { - debug!("span_to_lines(sp={:?})", sp); - + pub fn is_valid_span(&self, sp: Span) -> Result<(Loc, Loc), SpanLinesError> { let lo = self.lookup_char_pos(sp.lo()); debug!("span_to_lines: lo={:?}", lo); let hi = self.lookup_char_pos(sp.hi()); debug!("span_to_lines: hi={:?}", hi); - if lo.file.start_pos != hi.file.start_pos { return Err(SpanLinesError::DistinctSources(DistinctSources { begin: (lo.file.name.clone(), lo.file.start_pos), end: (hi.file.name.clone(), hi.file.start_pos), })); } + Ok((lo, hi)) + } + + pub fn span_to_lines(&self, sp: Span) -> FileLinesResult { + debug!("span_to_lines(sp={:?})", sp); + let (lo, hi) = self.is_valid_span(sp)?; assert!(hi.line >= lo.line); let mut lines = Vec::with_capacity(hi.line - lo.line + 1); diff --git a/src/librustc_target/lib.rs b/src/librustc_target/lib.rs index 17413e77f9007..84c6d720b8e00 100644 --- a/src/librustc_target/lib.rs +++ b/src/librustc_target/lib.rs @@ -11,7 +11,7 @@ #![feature(box_syntax)] #![feature(bool_to_option)] #![feature(nll)] -#![feature(slice_patterns)] +#![cfg_attr(bootstrap, feature(slice_patterns))] #[macro_use] extern crate log; diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index b951883ac195a..95cd3c631ed22 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -64,7 +64,7 @@ This API is completely unstable and subject to change. #![feature(exhaustive_patterns)] #![feature(in_band_lifetimes)] #![feature(nll)] -#![feature(slice_patterns)] +#![cfg_attr(bootstrap, feature(slice_patterns))] #![feature(try_blocks)] #![feature(never_type)] #![recursion_limit = "256"] diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs index c7e0f1e9e704b..e54e716e042fe 100644 --- a/src/librustdoc/clean/inline.rs +++ b/src/librustdoc/clean/inline.rs @@ -273,6 +273,22 @@ fn build_type_alias(cx: &DocContext<'_>, did: DefId) -> clean::Typedef { clean::Typedef { type_: cx.tcx.type_of(did).clean(cx), generics: (cx.tcx.generics_of(did), predicates).clean(cx), + item_type: build_type_alias_type(cx, did), + } +} + +fn build_type_alias_type(cx: &DocContext<'_>, did: DefId) -> Option { + let type_ = cx.tcx.type_of(did).clean(cx); + type_.def_id().and_then(|did| build_ty(cx, did)) +} + +pub fn build_ty(cx: &DocContext, did: DefId) -> Option { + match cx.tcx.def_kind(did)? { + DefKind::Struct | DefKind::Union | DefKind::Enum | DefKind::Const | DefKind::Static => { + Some(cx.tcx.type_of(did).clean(cx)) + } + DefKind::TyAlias => build_type_alias_type(cx, did), + _ => None, } } diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index be9654612f504..20a5a6c54984d 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -1122,7 +1122,9 @@ impl Clean for hir::ImplItem<'_> { MethodItem((sig, &self.generics, body, Some(self.defaultness)).clean(cx)) } hir::ImplItemKind::TyAlias(ref ty) => { - TypedefItem(Typedef { type_: ty.clean(cx), generics: Generics::default() }, true) + let type_ = ty.clean(cx); + let item_type = type_.def_id().and_then(|did| inline::build_ty(cx, did)); + TypedefItem(Typedef { type_, generics: Generics::default(), item_type }, true) } hir::ImplItemKind::OpaqueTy(ref bounds) => OpaqueTyItem( OpaqueTy { bounds: bounds.clean(cx), generics: Generics::default() }, @@ -1282,10 +1284,13 @@ impl Clean for ty::AssocItem { AssocTypeItem(bounds, ty.clean(cx)) } else { + let type_ = cx.tcx.type_of(self.def_id).clean(cx); + let item_type = type_.def_id().and_then(|did| inline::build_ty(cx, did)); TypedefItem( Typedef { - type_: cx.tcx.type_of(self.def_id).clean(cx), + type_, generics: Generics { params: Vec::new(), where_predicates: Vec::new() }, + item_type, }, true, ) @@ -1989,6 +1994,8 @@ impl Clean for ast::Name { impl Clean for doctree::Typedef<'_> { fn clean(&self, cx: &DocContext<'_>) -> Item { + let type_ = self.ty.clean(cx); + let item_type = type_.def_id().and_then(|did| inline::build_ty(cx, did)); Item { name: Some(self.name.clean(cx)), attrs: self.attrs.clean(cx), @@ -1997,10 +2004,7 @@ impl Clean for doctree::Typedef<'_> { visibility: self.vis.clean(cx), stability: cx.stability(self.id).clean(cx), deprecation: cx.deprecation(self.id).clean(cx), - inner: TypedefItem( - Typedef { type_: self.ty.clean(cx), generics: self.gen.clean(cx) }, - false, - ), + inner: TypedefItem(Typedef { type_, generics: self.gen.clean(cx), item_type }, false), } } } @@ -2101,7 +2105,7 @@ impl Clean> for doctree::Impl<'_> { build_deref_target_impls(cx, &items, &mut ret); } - let provided = trait_ + let provided: FxHashSet = trait_ .def_id() .map(|did| { cx.tcx @@ -2112,7 +2116,12 @@ impl Clean> for doctree::Impl<'_> { }) .unwrap_or_default(); - ret.push(Item { + let for_ = self.for_.clean(cx); + let type_alias = for_.def_id().and_then(|did| match cx.tcx.def_kind(did) { + Some(DefKind::TyAlias) => Some(cx.tcx.type_of(did).clean(cx)), + _ => None, + }); + let make_item = |trait_: Option, for_: Type, items: Vec| Item { name: None, attrs: self.attrs.clean(cx), source: self.whence.clean(cx), @@ -2123,15 +2132,19 @@ impl Clean> for doctree::Impl<'_> { inner: ImplItem(Impl { unsafety: self.unsafety, generics: self.generics.clean(cx), - provided_trait_methods: provided, + provided_trait_methods: provided.clone(), trait_, - for_: self.for_.clean(cx), + for_, items, polarity: Some(cx.tcx.impl_polarity(def_id).clean(cx)), synthetic: false, blanket_impl: None, }), - }); + }; + if let Some(type_alias) = type_alias { + ret.push(make_item(trait_.clone(), type_alias, items.clone())); + } + ret.push(make_item(trait_, for_, items)); ret } } diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index 5d8e27ecadb82..79a078ca7a991 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -1406,6 +1406,14 @@ pub struct PathSegment { pub struct Typedef { pub type_: Type, pub generics: Generics, + // Type of target item. + pub item_type: Option, +} + +impl GetDefId for Typedef { + fn def_id(&self) -> Option { + self.type_.def_id() + } } #[derive(Clone, Debug)] diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 2d932eb7668c4..9406803825350 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -3469,20 +3469,23 @@ fn render_deref_methods( deref_mut: bool, ) { let deref_type = impl_.inner_impl().trait_.as_ref().unwrap(); - let target = impl_ + let (target, real_target) = impl_ .inner_impl() .items .iter() .filter_map(|item| match item.inner { - clean::TypedefItem(ref t, true) => Some(&t.type_), + clean::TypedefItem(ref t, true) => Some(match *t { + clean::Typedef { item_type: Some(ref type_), .. } => (type_, &t.type_), + _ => (&t.type_, &t.type_), + }), _ => None, }) .next() .expect("Expected associated type binding"); let what = - AssocItemRender::DerefFor { trait_: deref_type, type_: target, deref_mut_: deref_mut }; + AssocItemRender::DerefFor { trait_: deref_type, type_: real_target, deref_mut_: deref_mut }; if let Some(did) = target.def_id() { - render_assoc_items(w, cx, container_item, did, what) + render_assoc_items(w, cx, container_item, did, what); } else { if let Some(prim) = target.primitive_type() { if let Some(&did) = cx.cache.primitive_locations.get(&prim) { @@ -4123,12 +4126,15 @@ fn sidebar_assoc_items(it: &clean::Item) -> String { .filter(|i| i.inner_impl().trait_.is_some()) .find(|i| i.inner_impl().trait_.def_id() == c.deref_trait_did) { - if let Some(target) = impl_ + if let Some((target, real_target)) = impl_ .inner_impl() .items .iter() .filter_map(|item| match item.inner { - clean::TypedefItem(ref t, true) => Some(&t.type_), + clean::TypedefItem(ref t, true) => Some(match *t { + clean::Typedef { item_type: Some(ref type_), .. } => (type_, &t.type_), + _ => (&t.type_, &t.type_), + }), _ => None, }) .next() @@ -4147,7 +4153,7 @@ fn sidebar_assoc_items(it: &clean::Item) -> String { "{:#}", impl_.inner_impl().trait_.as_ref().unwrap().print() )), - Escape(&format!("{:#}", target.print())) + Escape(&format!("{:#}", real_target.print())) )); out.push_str(""); let mut ret = impls diff --git a/src/librustdoc/html/render/cache.rs b/src/librustdoc/html/render/cache.rs index 22507443b0842..f1f83acdda59e 100644 --- a/src/librustdoc/html/render/cache.rs +++ b/src/librustdoc/html/render/cache.rs @@ -277,7 +277,7 @@ impl DocFolder for Cache { | clean::StructFieldItem(..) | clean::VariantItem(..) => ( ( - Some(*self.parent_stack.last().unwrap()), + Some(*self.parent_stack.last().expect("parent_stack is empty")), Some(&self.stack[..self.stack.len() - 1]), ), false, @@ -286,7 +286,7 @@ impl DocFolder for Cache { if self.parent_stack.is_empty() { ((None, None), false) } else { - let last = self.parent_stack.last().unwrap(); + let last = self.parent_stack.last().expect("parent_stack is empty 2"); let did = *last; let path = match self.paths.get(&did) { // The current stack not necessarily has correlation @@ -468,7 +468,7 @@ impl DocFolder for Cache { self.impls.entry(did).or_insert(vec![]).push(impl_item.clone()); } } else { - let trait_did = impl_item.trait_did().unwrap(); + let trait_did = impl_item.trait_did().expect("no trait did"); self.orphan_trait_impls.push((trait_did, dids, impl_item)); } None @@ -478,10 +478,10 @@ impl DocFolder for Cache { }); if pushed { - self.stack.pop().unwrap(); + self.stack.pop().expect("stack already empty"); } if parent_pushed { - self.parent_stack.pop().unwrap(); + self.parent_stack.pop().expect("parent stack already empty"); } self.stripped_mod = orig_stripped_mod; self.parent_is_trait_impl = orig_parent_is_trait_impl; @@ -594,7 +594,7 @@ fn build_index(krate: &clean::Crate, cache: &mut Cache) -> String { for item in search_index { item.parent_idx = item.parent.map(|nodeid| { if nodeid_to_pathid.contains_key(&nodeid) { - *nodeid_to_pathid.get(&nodeid).unwrap() + *nodeid_to_pathid.get(&nodeid).expect("no pathid") } else { let pathid = lastpathid; nodeid_to_pathid.insert(nodeid, pathid); @@ -639,7 +639,7 @@ fn build_index(krate: &clean::Crate, cache: &mut Cache) -> String { items: crate_items, paths: crate_paths, }) - .unwrap() + .expect("failed serde conversion") ) } diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index f90647472c678..c8fae91fcf3a5 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -294,7 +294,7 @@ #![feature(shrink_to)] #![feature(slice_concat_ext)] #![feature(slice_internals)] -#![feature(slice_patterns)] +#![cfg_attr(bootstrap, feature(slice_patterns))] #![feature(specialization)] #![feature(staged_api)] #![feature(std_internals)] diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index 0184a3214b5b4..b0c2aa3dbb28e 100644 --- a/src/libsyntax/lib.rs +++ b/src/libsyntax/lib.rs @@ -13,7 +13,7 @@ #![feature(label_break_value)] #![feature(nll)] #![feature(try_trait)] -#![feature(slice_patterns)] +#![cfg_attr(bootstrap, feature(slice_patterns))] #![feature(unicode_internals)] #![recursion_limit = "256"] diff --git a/src/test/mir-opt/uniform_array_move_out.rs b/src/test/mir-opt/uniform_array_move_out.rs index f2e1864096ea9..d587d237227ad 100644 --- a/src/test/mir-opt/uniform_array_move_out.rs +++ b/src/test/mir-opt/uniform_array_move_out.rs @@ -1,5 +1,4 @@ #![feature(box_syntax)] -#![feature(slice_patterns)] fn move_out_from_end() { let a = [box 1, box 2]; diff --git a/src/test/rustdoc/deref-typedef.rs b/src/test/rustdoc/deref-typedef.rs new file mode 100644 index 0000000000000..770f8d7289c3b --- /dev/null +++ b/src/test/rustdoc/deref-typedef.rs @@ -0,0 +1,33 @@ +#![crate_name = "foo"] + +// @has 'foo/struct.Bar.html' +// @has '-' '//*[@id="deref-methods"]' 'Methods from Deref' +// @has '-' '//*[@class="impl-items"]//*[@id="method.foo_a"]' 'pub fn foo_a(&self)' +// @has '-' '//*[@class="impl-items"]//*[@id="method.foo_b"]' 'pub fn foo_b(&self)' +// @has '-' '//*[@class="impl-items"]//*[@id="method.foo_c"]' 'pub fn foo_c(&self)' +// @has '-' '//*[@class="sidebar-title"]' 'Methods from Deref' +// @has '-' '//*[@class="sidebar-links"]/a[@href="#method.foo_a"]' 'foo_a' +// @has '-' '//*[@class="sidebar-links"]/a[@href="#method.foo_b"]' 'foo_b' +// @has '-' '//*[@class="sidebar-links"]/a[@href="#method.foo_c"]' 'foo_c' + +pub struct FooA; +pub type FooB = FooA; +pub type FooC = FooB; + +impl FooA { + pub fn foo_a(&self) {} +} + +impl FooB { + pub fn foo_b(&self) {} +} + +impl FooC { + pub fn foo_c(&self) {} +} + +pub struct Bar; +impl std::ops::Deref for Bar { + type Target = FooC; + fn deref(&self) -> &Self::Target { unimplemented!() } +} diff --git a/src/test/ui/match/match-vec-mismatch.rs b/src/test/ui/array-slice-vec/slice-pat-type-mismatches.rs similarity index 96% rename from src/test/ui/match/match-vec-mismatch.rs rename to src/test/ui/array-slice-vec/slice-pat-type-mismatches.rs index a0ef92743ac5a..34adb42a32f96 100644 --- a/src/test/ui/match/match-vec-mismatch.rs +++ b/src/test/ui/array-slice-vec/slice-pat-type-mismatches.rs @@ -1,5 +1,3 @@ -#![feature(slice_patterns)] - fn main() { match "foo".to_string() { ['f', 'o', ..] => {} diff --git a/src/test/ui/match/match-vec-mismatch.stderr b/src/test/ui/array-slice-vec/slice-pat-type-mismatches.stderr similarity index 81% rename from src/test/ui/match/match-vec-mismatch.stderr rename to src/test/ui/array-slice-vec/slice-pat-type-mismatches.stderr index a3523bb689e6b..c4548142c13ef 100644 --- a/src/test/ui/match/match-vec-mismatch.stderr +++ b/src/test/ui/array-slice-vec/slice-pat-type-mismatches.stderr @@ -1,29 +1,29 @@ error[E0425]: cannot find value `does_not_exist` in this scope - --> $DIR/match-vec-mismatch.rs:28:11 + --> $DIR/slice-pat-type-mismatches.rs:26:11 | LL | match does_not_exist { | ^^^^^^^^^^^^^^ not found in this scope error[E0529]: expected an array or slice, found `std::string::String` - --> $DIR/match-vec-mismatch.rs:5:9 + --> $DIR/slice-pat-type-mismatches.rs:3:9 | LL | ['f', 'o', ..] => {} | ^^^^^^^^^^^^^^ pattern cannot match with input type `std::string::String` error[E0527]: pattern requires 1 element but array has 3 - --> $DIR/match-vec-mismatch.rs:20:9 + --> $DIR/slice-pat-type-mismatches.rs:18:9 | LL | [0] => {}, | ^^^ expected 3 elements error[E0528]: pattern requires at least 4 elements but array has 3 - --> $DIR/match-vec-mismatch.rs:25:9 + --> $DIR/slice-pat-type-mismatches.rs:23:9 | LL | [0, 1, 2, 3, x @ ..] => {} | ^^^^^^^^^^^^^^^^^^^^ pattern cannot match array of 3 elements error[E0282]: type annotations needed - --> $DIR/match-vec-mismatch.rs:36:9 + --> $DIR/slice-pat-type-mismatches.rs:34:9 | LL | [] => {} | ^^ cannot infer type diff --git a/src/test/ui/parser/match-vec-invalid.rs b/src/test/ui/array-slice-vec/subslice-only-once-semantic-restriction.rs similarity index 76% rename from src/test/ui/parser/match-vec-invalid.rs rename to src/test/ui/array-slice-vec/subslice-only-once-semantic-restriction.rs index 00f4374b256d2..97e33624bf6de 100644 --- a/src/test/ui/parser/match-vec-invalid.rs +++ b/src/test/ui/array-slice-vec/subslice-only-once-semantic-restriction.rs @@ -3,8 +3,6 @@ fn main() { match a { [1, tail @ .., tail @ ..] => {}, //~^ ERROR identifier `tail` is bound more than once in the same pattern - //~| ERROR subslice patterns are unstable - //~| ERROR subslice patterns are unstable //~| ERROR `..` can only be used once per slice pattern _ => () } diff --git a/src/test/ui/array-slice-vec/subslice-only-once-semantic-restriction.stderr b/src/test/ui/array-slice-vec/subslice-only-once-semantic-restriction.stderr new file mode 100644 index 0000000000000..4d6078788b228 --- /dev/null +++ b/src/test/ui/array-slice-vec/subslice-only-once-semantic-restriction.stderr @@ -0,0 +1,24 @@ +error[E0416]: identifier `tail` is bound more than once in the same pattern + --> $DIR/subslice-only-once-semantic-restriction.rs:4:24 + | +LL | [1, tail @ .., tail @ ..] => {}, + | ^^^^ used in a pattern more than once + +error: `..` can only be used once per slice pattern + --> $DIR/subslice-only-once-semantic-restriction.rs:4:31 + | +LL | [1, tail @ .., tail @ ..] => {}, + | -- ^^ can only be used once per slice pattern + | | + | previously used here + +error[E0308]: mismatched types + --> $DIR/subslice-only-once-semantic-restriction.rs:11:30 + | +LL | const RECOVERY_WITNESS: () = 0; + | ^ expected `()`, found integer + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0308, E0416. +For more information about an error, try `rustc --explain E0308`. diff --git a/src/test/ui/array-slice-vec/subslice-patterns-const-eval-match.rs b/src/test/ui/array-slice-vec/subslice-patterns-const-eval-match.rs index 0e767d9613a99..69c33921868cf 100644 --- a/src/test/ui/array-slice-vec/subslice-patterns-const-eval-match.rs +++ b/src/test/ui/array-slice-vec/subslice-patterns-const-eval-match.rs @@ -2,7 +2,7 @@ // run-pass -#![feature(slice_patterns, const_fn, const_if_match)] +#![feature(const_fn, const_if_match)] #[derive(PartialEq, Debug, Clone)] struct N(u8); diff --git a/src/test/ui/array-slice-vec/subslice-patterns-const-eval.rs b/src/test/ui/array-slice-vec/subslice-patterns-const-eval.rs index 5444f8a9051bd..0b793fa0120e9 100644 --- a/src/test/ui/array-slice-vec/subslice-patterns-const-eval.rs +++ b/src/test/ui/array-slice-vec/subslice-patterns-const-eval.rs @@ -2,8 +2,6 @@ // run-pass -#![feature(slice_patterns)] - #[derive(PartialEq, Debug, Clone)] struct N(u8); diff --git a/src/test/ui/array-slice-vec/subslice-patterns-pass.rs b/src/test/ui/array-slice-vec/subslice-patterns-pass.rs index 1ebf3def78876..e05790911f52d 100644 --- a/src/test/ui/array-slice-vec/subslice-patterns-pass.rs +++ b/src/test/ui/array-slice-vec/subslice-patterns-pass.rs @@ -4,8 +4,6 @@ // run-pass -#![feature(slice_patterns)] - #![allow(unreachable_patterns)] use std::convert::identity; diff --git a/src/test/ui/array-slice-vec/vec-matching-fixed.rs b/src/test/ui/array-slice-vec/vec-matching-fixed.rs index 5253bc1b21430..fdeb7e4fda640 100644 --- a/src/test/ui/array-slice-vec/vec-matching-fixed.rs +++ b/src/test/ui/array-slice-vec/vec-matching-fixed.rs @@ -1,7 +1,5 @@ // run-pass -#![feature(slice_patterns)] - fn a() { let x = [1, 2, 3]; match x { diff --git a/src/test/ui/array-slice-vec/vec-matching-fold.rs b/src/test/ui/array-slice-vec/vec-matching-fold.rs index f416160db2422..998899271e411 100644 --- a/src/test/ui/array-slice-vec/vec-matching-fold.rs +++ b/src/test/ui/array-slice-vec/vec-matching-fold.rs @@ -1,7 +1,5 @@ // run-pass -#![feature(slice_patterns)] - use std::fmt::Debug; fn foldl(values: &[T], diff --git a/src/test/ui/array-slice-vec/vec-matching-legal-tail-element-borrow.rs b/src/test/ui/array-slice-vec/vec-matching-legal-tail-element-borrow.rs index f0602c328b071..ed34f074a929a 100644 --- a/src/test/ui/array-slice-vec/vec-matching-legal-tail-element-borrow.rs +++ b/src/test/ui/array-slice-vec/vec-matching-legal-tail-element-borrow.rs @@ -1,7 +1,6 @@ // run-pass -#![allow(unused_variables)] -#![feature(slice_patterns)] +#![allow(unused_variables)] pub fn main() { let x = &[1, 2, 3, 4, 5]; diff --git a/src/test/ui/array-slice-vec/vec-matching.rs b/src/test/ui/array-slice-vec/vec-matching.rs index 49c736bd72847..7009244aa189a 100644 --- a/src/test/ui/array-slice-vec/vec-matching.rs +++ b/src/test/ui/array-slice-vec/vec-matching.rs @@ -1,7 +1,5 @@ // run-pass -#![feature(slice_patterns)] - fn a() { let x = [1]; match x { diff --git a/src/test/ui/array-slice-vec/vec-tail-matching.rs b/src/test/ui/array-slice-vec/vec-tail-matching.rs index 3c7b160dcc540..5f1699227d8e6 100644 --- a/src/test/ui/array-slice-vec/vec-tail-matching.rs +++ b/src/test/ui/array-slice-vec/vec-tail-matching.rs @@ -1,7 +1,5 @@ // run-pass -#![feature(slice_patterns)] - struct Foo { string: &'static str } diff --git a/src/test/ui/binding/empty-types-in-patterns.rs b/src/test/ui/binding/empty-types-in-patterns.rs index 4271ffb7b1b4d..0d0dbcaf40f43 100644 --- a/src/test/ui/binding/empty-types-in-patterns.rs +++ b/src/test/ui/binding/empty-types-in-patterns.rs @@ -1,7 +1,8 @@ // run-pass + #![feature(never_type, never_type_fallback)] #![feature(exhaustive_patterns)] -#![feature(slice_patterns)] + #![allow(unreachable_patterns)] #![allow(unreachable_code)] #![allow(unused_variables)] diff --git a/src/test/ui/binding/irrefutable-slice-patterns.rs b/src/test/ui/binding/irrefutable-slice-patterns.rs index ac733ef6e9c86..048e1e5e9b4b6 100644 --- a/src/test/ui/binding/irrefutable-slice-patterns.rs +++ b/src/test/ui/binding/irrefutable-slice-patterns.rs @@ -1,7 +1,6 @@ // run-pass -// #47096 -#![feature(slice_patterns)] +// Regression test for #47096. fn foo(s: &[i32]) -> &[i32] { let &[ref xs @ ..] = s; diff --git a/src/test/ui/binding/match-byte-array-patterns.rs b/src/test/ui/binding/match-byte-array-patterns.rs index e87745705da08..f0c988c01c2b8 100644 --- a/src/test/ui/binding/match-byte-array-patterns.rs +++ b/src/test/ui/binding/match-byte-array-patterns.rs @@ -1,5 +1,4 @@ // run-pass -#![feature(slice_patterns)] fn main() { let buf = &[0u8; 4]; diff --git a/src/test/ui/binding/match-vec-alternatives.rs b/src/test/ui/binding/match-vec-alternatives.rs index 9b06a86a7b91e..af95eb95df04c 100644 --- a/src/test/ui/binding/match-vec-alternatives.rs +++ b/src/test/ui/binding/match-vec-alternatives.rs @@ -1,5 +1,4 @@ // run-pass -#![feature(slice_patterns)] fn match_vecs<'a, T>(l1: &'a [T], l2: &'a [T]) -> &'static str { match (l1, l2) { diff --git a/src/test/ui/binding/zero_sized_subslice_match.rs b/src/test/ui/binding/zero_sized_subslice_match.rs index 5326fa612a87b..187c2983633e7 100644 --- a/src/test/ui/binding/zero_sized_subslice_match.rs +++ b/src/test/ui/binding/zero_sized_subslice_match.rs @@ -1,5 +1,4 @@ // run-pass -#![feature(slice_patterns)] fn main() { let x = [(), ()]; diff --git a/src/test/ui/borrowck/borrowck-closures-slice-patterns-ok.rs b/src/test/ui/borrowck/borrowck-closures-slice-patterns-ok.rs index a70ccb7aa4b73..0229ca37a692a 100644 --- a/src/test/ui/borrowck/borrowck-closures-slice-patterns-ok.rs +++ b/src/test/ui/borrowck/borrowck-closures-slice-patterns-ok.rs @@ -1,6 +1,5 @@ // Check that closure captures for slice patterns are inferred correctly -#![feature(slice_patterns)] #![allow(unused_variables)] // run-pass diff --git a/src/test/ui/borrowck/borrowck-closures-slice-patterns.rs b/src/test/ui/borrowck/borrowck-closures-slice-patterns.rs index 984eb8804b7a2..32057d5c126ed 100644 --- a/src/test/ui/borrowck/borrowck-closures-slice-patterns.rs +++ b/src/test/ui/borrowck/borrowck-closures-slice-patterns.rs @@ -1,7 +1,5 @@ // Check that closure captures for slice patterns are inferred correctly -#![feature(slice_patterns)] - fn arr_by_ref(mut x: [String; 3]) { let f = || { let [ref y, ref z @ ..] = x; diff --git a/src/test/ui/borrowck/borrowck-closures-slice-patterns.stderr b/src/test/ui/borrowck/borrowck-closures-slice-patterns.stderr index c5b27f5f8b403..483975e5778a8 100644 --- a/src/test/ui/borrowck/borrowck-closures-slice-patterns.stderr +++ b/src/test/ui/borrowck/borrowck-closures-slice-patterns.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-closures-slice-patterns.rs:9:13 + --> $DIR/borrowck-closures-slice-patterns.rs:7:13 | LL | let f = || { | -- immutable borrow occurs here @@ -13,7 +13,7 @@ LL | f(); | - immutable borrow later used here error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-closures-slice-patterns.rs:18:13 + --> $DIR/borrowck-closures-slice-patterns.rs:16:13 | LL | let mut f = || { | -- mutable borrow occurs here @@ -27,7 +27,7 @@ LL | f(); | - mutable borrow later used here error[E0382]: borrow of moved value: `x` - --> $DIR/borrowck-closures-slice-patterns.rs:27:5 + --> $DIR/borrowck-closures-slice-patterns.rs:25:5 | LL | fn arr_by_move(x: [String; 3]) { | - move occurs because `x` has type `[std::string::String; 3]`, which does not implement the `Copy` trait @@ -40,7 +40,7 @@ LL | &x; | ^^ value borrowed here after move error[E0502]: cannot borrow `*x` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-closures-slice-patterns.rs:35:13 + --> $DIR/borrowck-closures-slice-patterns.rs:33:13 | LL | let f = || { | -- immutable borrow occurs here @@ -54,7 +54,7 @@ LL | f(); | - immutable borrow later used here error[E0501]: cannot borrow `x` as immutable because previous closure requires unique access - --> $DIR/borrowck-closures-slice-patterns.rs:44:13 + --> $DIR/borrowck-closures-slice-patterns.rs:42:13 | LL | let mut f = || { | -- closure construction occurs here @@ -68,7 +68,7 @@ LL | f(); | - first borrow later used here error[E0382]: borrow of moved value: `x` - --> $DIR/borrowck-closures-slice-patterns.rs:53:5 + --> $DIR/borrowck-closures-slice-patterns.rs:51:5 | LL | fn arr_box_by_move(x: Box<[String; 3]>) { | - move occurs because `x` has type `std::boxed::Box<[std::string::String; 3]>`, which does not implement the `Copy` trait @@ -81,7 +81,7 @@ LL | &x; | ^^ value borrowed here after move error[E0502]: cannot borrow `*x` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-closures-slice-patterns.rs:61:13 + --> $DIR/borrowck-closures-slice-patterns.rs:59:13 | LL | let f = || { | -- immutable borrow occurs here @@ -95,7 +95,7 @@ LL | f(); | - immutable borrow later used here error[E0501]: cannot borrow `x` as immutable because previous closure requires unique access - --> $DIR/borrowck-closures-slice-patterns.rs:70:13 + --> $DIR/borrowck-closures-slice-patterns.rs:68:13 | LL | let mut f = || { | -- closure construction occurs here diff --git a/src/test/ui/borrowck/borrowck-describe-lvalue.rs b/src/test/ui/borrowck/borrowck-describe-lvalue.rs index 8425960aa8600..c8bfbe0729c59 100644 --- a/src/test/ui/borrowck/borrowck-describe-lvalue.rs +++ b/src/test/ui/borrowck/borrowck-describe-lvalue.rs @@ -1,7 +1,5 @@ // ignore-tidy-linelength -#![feature(slice_patterns)] - pub struct Foo { x: u32 } diff --git a/src/test/ui/borrowck/borrowck-describe-lvalue.stderr b/src/test/ui/borrowck/borrowck-describe-lvalue.stderr index 4213523d2fa4b..075e0e2e4515e 100644 --- a/src/test/ui/borrowck/borrowck-describe-lvalue.stderr +++ b/src/test/ui/borrowck/borrowck-describe-lvalue.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time - --> $DIR/borrowck-describe-lvalue.rs:258:13 + --> $DIR/borrowck-describe-lvalue.rs:256:13 | LL | let y = &mut x; | ------ first mutable borrow occurs here @@ -9,7 +9,7 @@ LL | *y = 1; | ------ first borrow later used here error[E0499]: cannot borrow `x` as mutable more than once at a time - --> $DIR/borrowck-describe-lvalue.rs:268:20 + --> $DIR/borrowck-describe-lvalue.rs:266:20 | LL | let y = &mut x; | ------ first mutable borrow occurs here @@ -19,7 +19,7 @@ LL | *y = 1; | ------ first borrow later used here error: captured variable cannot escape `FnMut` closure body - --> $DIR/borrowck-describe-lvalue.rs:266:16 + --> $DIR/borrowck-describe-lvalue.rs:264:16 | LL | || { | - inferred to be a `FnMut` closure @@ -35,7 +35,7 @@ LL | | } = note: ...therefore, they cannot allow references to captured variables to escape error[E0503]: cannot use `f.x` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:41:9 + --> $DIR/borrowck-describe-lvalue.rs:39:9 | LL | let x = f.x(); | - borrow of `f` occurs here @@ -45,7 +45,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `g.0` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:48:9 + --> $DIR/borrowck-describe-lvalue.rs:46:9 | LL | let x = g.x(); | - borrow of `g` occurs here @@ -55,7 +55,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `h.0` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:55:9 + --> $DIR/borrowck-describe-lvalue.rs:53:9 | LL | let x = &mut h.0; | -------- borrow of `h.0` occurs here @@ -65,7 +65,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `e.0` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:63:20 + --> $DIR/borrowck-describe-lvalue.rs:61:20 | LL | let x = e.x(); | - borrow of `e` occurs here @@ -77,7 +77,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `u.a` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:71:9 + --> $DIR/borrowck-describe-lvalue.rs:69:9 | LL | let x = &mut u.a; | -------- borrow of `u.a` occurs here @@ -87,7 +87,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `f.x` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:78:9 + --> $DIR/borrowck-describe-lvalue.rs:76:9 | LL | let x = f.x(); | - borrow of `*f` occurs here @@ -97,7 +97,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `g.0` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:85:9 + --> $DIR/borrowck-describe-lvalue.rs:83:9 | LL | let x = g.x(); | - borrow of `*g` occurs here @@ -107,7 +107,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `h.0` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:92:9 + --> $DIR/borrowck-describe-lvalue.rs:90:9 | LL | let x = &mut h.0; | -------- borrow of `h.0` occurs here @@ -117,7 +117,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `e.0` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:100:20 + --> $DIR/borrowck-describe-lvalue.rs:98:20 | LL | let x = e.x(); | - borrow of `*e` occurs here @@ -129,7 +129,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `u.a` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:109:9 + --> $DIR/borrowck-describe-lvalue.rs:107:9 | LL | let x = &mut u.a; | -------- borrow of `u.a` occurs here @@ -139,7 +139,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `v[..]` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:117:15 + --> $DIR/borrowck-describe-lvalue.rs:115:15 | LL | let x = &mut v; | ------ borrow of `v` occurs here @@ -151,7 +151,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `v[..]` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:122:18 + --> $DIR/borrowck-describe-lvalue.rs:120:18 | LL | let x = &mut v; | ------ borrow of `v` occurs here @@ -163,7 +163,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `v[..]` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:127:25 + --> $DIR/borrowck-describe-lvalue.rs:125:25 | LL | let x = &mut v; | ------ borrow of `v` occurs here @@ -175,7 +175,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `v[..]` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:132:28 + --> $DIR/borrowck-describe-lvalue.rs:130:28 | LL | let x = &mut v; | ------ borrow of `v` occurs here @@ -187,7 +187,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `v[..]` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:143:15 + --> $DIR/borrowck-describe-lvalue.rs:141:15 | LL | let x = &mut v; | ------ borrow of `v` occurs here @@ -199,7 +199,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `v[..]` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:148:18 + --> $DIR/borrowck-describe-lvalue.rs:146:18 | LL | let x = &mut v; | ------ borrow of `v` occurs here @@ -211,7 +211,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `v[..]` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:153:15 + --> $DIR/borrowck-describe-lvalue.rs:151:15 | LL | let x = &mut v; | ------ borrow of `v` occurs here @@ -223,7 +223,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `v[..]` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:158:18 + --> $DIR/borrowck-describe-lvalue.rs:156:18 | LL | let x = &mut v; | ------ borrow of `v` occurs here @@ -235,7 +235,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `e` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:171:13 + --> $DIR/borrowck-describe-lvalue.rs:169:13 | LL | let x = &mut e; | ------ borrow of `e` occurs here @@ -247,7 +247,7 @@ LL | drop(x); | - borrow later used here error[E0502]: cannot borrow `e.0` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-describe-lvalue.rs:171:18 + --> $DIR/borrowck-describe-lvalue.rs:169:18 | LL | let x = &mut e; | ------ mutable borrow occurs here @@ -259,7 +259,7 @@ LL | drop(x); | - mutable borrow later used here error[E0502]: cannot borrow `e.x` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-describe-lvalue.rs:175:23 + --> $DIR/borrowck-describe-lvalue.rs:173:23 | LL | let x = &mut e; | ------ mutable borrow occurs here @@ -271,7 +271,7 @@ LL | drop(x); | - mutable borrow later used here error[E0502]: cannot borrow `s.y.0` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-describe-lvalue.rs:188:22 + --> $DIR/borrowck-describe-lvalue.rs:186:22 | LL | let x = &mut s; | ------ mutable borrow occurs here @@ -283,7 +283,7 @@ LL | drop(x); | - mutable borrow later used here error[E0502]: cannot borrow `s.x.y` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-describe-lvalue.rs:194:28 + --> $DIR/borrowck-describe-lvalue.rs:192:28 | LL | let x = &mut s; | ------ mutable borrow occurs here @@ -295,7 +295,7 @@ LL | drop(x); | - mutable borrow later used here error[E0503]: cannot use `*v` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:236:9 + --> $DIR/borrowck-describe-lvalue.rs:234:9 | LL | let x = &mut v; | ------ borrow of `v` occurs here @@ -306,7 +306,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `v[_].y` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:236:9 + --> $DIR/borrowck-describe-lvalue.rs:234:9 | LL | let x = &mut v; | ------ borrow of `v` occurs here @@ -317,7 +317,7 @@ LL | drop(x); | - borrow later used here error[E0502]: cannot borrow `v[..].x` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-describe-lvalue.rs:247:24 + --> $DIR/borrowck-describe-lvalue.rs:245:24 | LL | let x = &mut v; | ------ mutable borrow occurs here @@ -329,7 +329,7 @@ LL | drop(x); | - mutable borrow later used here error[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-describe-lvalue.rs:210:29 + --> $DIR/borrowck-describe-lvalue.rs:208:29 | LL | let x = &mut block; | ---------- mutable borrow occurs here @@ -340,7 +340,7 @@ LL | drop(x); | - mutable borrow later used here error[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-describe-lvalue.rs:225:33 + --> $DIR/borrowck-describe-lvalue.rs:223:33 | LL | let x = &mut block; | ---------- mutable borrow occurs here @@ -351,7 +351,7 @@ LL | drop(x); | - mutable borrow later used here error[E0382]: use of moved value: `x` - --> $DIR/borrowck-describe-lvalue.rs:278:22 + --> $DIR/borrowck-describe-lvalue.rs:276:22 | LL | drop(x); | - value moved here diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array-match.rs b/src/test/ui/borrowck/borrowck-move-out-from-array-match.rs index 232d43679b484..c1513fcba8a66 100644 --- a/src/test/ui/borrowck/borrowck-move-out-from-array-match.rs +++ b/src/test/ui/borrowck/borrowck-move-out-from-array-match.rs @@ -1,5 +1,3 @@ -#![feature(slice_patterns)] - fn array() -> [(String, String); 3] { Default::default() } diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array-match.stderr b/src/test/ui/borrowck/borrowck-move-out-from-array-match.stderr index e46a58a8a3500..84930b000ccb3 100644 --- a/src/test/ui/borrowck/borrowck-move-out-from-array-match.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-from-array-match.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `a[..]` - --> $DIR/borrowck-move-out-from-array-match.rs:15:14 + --> $DIR/borrowck-move-out-from-array-match.rs:13:14 | LL | [_, _, _x] => {} | -- value moved here @@ -10,7 +10,7 @@ LL | [.., _y] => {} = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a[..]` - --> $DIR/borrowck-move-out-from-array-match.rs:25:14 + --> $DIR/borrowck-move-out-from-array-match.rs:23:14 | LL | [_, _, (_x, _)] => {} | -- value moved here @@ -21,7 +21,7 @@ LL | [.., _y] => {} = note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a[..].0` - --> $DIR/borrowck-move-out-from-array-match.rs:35:15 + --> $DIR/borrowck-move-out-from-array-match.rs:33:15 | LL | [_, _, (_x, _)] => {} | -- value moved here @@ -32,7 +32,7 @@ LL | [.., (_y, _)] => {} = note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a` - --> $DIR/borrowck-move-out-from-array-match.rs:46:11 + --> $DIR/borrowck-move-out-from-array-match.rs:44:11 | LL | [_x, _, _] => {} | -- value moved here @@ -43,7 +43,7 @@ LL | match a { = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a` - --> $DIR/borrowck-move-out-from-array-match.rs:57:11 + --> $DIR/borrowck-move-out-from-array-match.rs:55:11 | LL | [.., _x] => {} | -- value moved here @@ -54,7 +54,7 @@ LL | match a { = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a` - --> $DIR/borrowck-move-out-from-array-match.rs:68:11 + --> $DIR/borrowck-move-out-from-array-match.rs:66:11 | LL | [(_x, _), _, _] => {} | -- value moved here @@ -65,7 +65,7 @@ LL | match a { = note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a` - --> $DIR/borrowck-move-out-from-array-match.rs:79:11 + --> $DIR/borrowck-move-out-from-array-match.rs:77:11 | LL | [.., (_x, _)] => {} | -- value moved here @@ -76,7 +76,7 @@ LL | match a { = note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a[..].0` - --> $DIR/borrowck-move-out-from-array-match.rs:91:11 + --> $DIR/borrowck-move-out-from-array-match.rs:89:11 | LL | [_y @ .., _, _] => {} | ------- value moved here @@ -87,7 +87,7 @@ LL | [(_x, _), _, _] => {} = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a[..].0` - --> $DIR/borrowck-move-out-from-array-match.rs:101:15 + --> $DIR/borrowck-move-out-from-array-match.rs:99:15 | LL | [_, _, _y @ ..] => {} | ------- value moved here @@ -98,7 +98,7 @@ LL | [.., (_x, _)] => {} = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a` - --> $DIR/borrowck-move-out-from-array-match.rs:112:11 + --> $DIR/borrowck-move-out-from-array-match.rs:110:11 | LL | [x @ .., _] => {} | ------ value moved here diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array-no-overlap-match.rs b/src/test/ui/borrowck/borrowck-move-out-from-array-no-overlap-match.rs index e5e61697c68c6..056b8e672bd93 100644 --- a/src/test/ui/borrowck/borrowck-move-out-from-array-no-overlap-match.rs +++ b/src/test/ui/borrowck/borrowck-move-out-from-array-no-overlap-match.rs @@ -3,8 +3,6 @@ // Once the bug is fixed, the test, which is derived from a // passing test for `let` statements, should become check-pass. -#![feature(slice_patterns)] - fn array() -> [(String, String); 3] { Default::default() } diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array-no-overlap-match.stderr b/src/test/ui/borrowck/borrowck-move-out-from-array-no-overlap-match.stderr index 72cd4207cce65..ff5eab2442c83 100644 --- a/src/test/ui/borrowck/borrowck-move-out-from-array-no-overlap-match.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-from-array-no-overlap-match.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `a` - --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:19:11 + --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:17:11 | LL | [_, _, _x] => {} | -- value moved here @@ -10,7 +10,7 @@ LL | match a { = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a` - --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:30:11 + --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:28:11 | LL | [_, _, (_x, _)] => {} | -- value moved here @@ -21,7 +21,7 @@ LL | match a { = note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a` - --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:43:11 + --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:41:11 | LL | [_x, _, _] => {} | -- value moved here @@ -32,7 +32,7 @@ LL | match a { = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a` - --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:54:11 + --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:52:11 | LL | [.., _x] => {} | -- value moved here @@ -43,7 +43,7 @@ LL | match a { = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a` - --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:65:11 + --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:63:11 | LL | [(_x, _), _, _] => {} | -- value moved here @@ -54,7 +54,7 @@ LL | match a { = note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a` - --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:76:11 + --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:74:11 | LL | [.., (_x, _)] => {} | -- value moved here @@ -65,7 +65,7 @@ LL | match a { = note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a` - --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:87:11 + --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:85:11 | LL | [_, _y @ ..] => {} | ------- value moved here @@ -76,7 +76,7 @@ LL | match a { = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a` - --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:98:11 + --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:96:11 | LL | [_y @ .., _] => {} | ------- value moved here @@ -87,7 +87,7 @@ LL | match a { = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a` - --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:111:11 + --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:109:11 | LL | [x @ .., _, _] => {} | ------ value moved here diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array-no-overlap.rs b/src/test/ui/borrowck/borrowck-move-out-from-array-no-overlap.rs index 8f274cf73cb0e..c91b4286b6478 100644 --- a/src/test/ui/borrowck/borrowck-move-out-from-array-no-overlap.rs +++ b/src/test/ui/borrowck/borrowck-move-out-from-array-no-overlap.rs @@ -1,7 +1,5 @@ // check-pass -#![feature(slice_patterns)] - fn array() -> [(String, String); 3] { Default::default() } diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array-use-match.rs b/src/test/ui/borrowck/borrowck-move-out-from-array-use-match.rs index 1ca3df52ada91..604a25cdcc1d6 100644 --- a/src/test/ui/borrowck/borrowck-move-out-from-array-use-match.rs +++ b/src/test/ui/borrowck/borrowck-move-out-from-array-use-match.rs @@ -1,5 +1,3 @@ -#![feature(slice_patterns)] - fn array() -> [(String, String); 3] { Default::default() } diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array-use-match.stderr b/src/test/ui/borrowck/borrowck-move-out-from-array-use-match.stderr index 028442a4c07ea..0ef63105cfbd3 100644 --- a/src/test/ui/borrowck/borrowck-move-out-from-array-use-match.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-from-array-use-match.stderr @@ -1,5 +1,5 @@ error[E0382]: borrow of moved value: `a[..]` - --> $DIR/borrowck-move-out-from-array-use-match.rs:15:14 + --> $DIR/borrowck-move-out-from-array-use-match.rs:13:14 | LL | [_, _, _x] => {} | -- value moved here @@ -10,7 +10,7 @@ LL | [.., ref _y] => {} = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait error[E0382]: borrow of moved value: `a[..]` - --> $DIR/borrowck-move-out-from-array-use-match.rs:25:14 + --> $DIR/borrowck-move-out-from-array-use-match.rs:23:14 | LL | [_, _, (_x, _)] => {} | -- value moved here @@ -21,7 +21,7 @@ LL | [.., ref _y] => {} = note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: borrow of moved value: `a[..].0` - --> $DIR/borrowck-move-out-from-array-use-match.rs:35:15 + --> $DIR/borrowck-move-out-from-array-use-match.rs:33:15 | LL | [_, _, (_x, _)] => {} | -- value moved here @@ -32,7 +32,7 @@ LL | [.., (ref _y, _)] => {} = note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a` - --> $DIR/borrowck-move-out-from-array-use-match.rs:46:11 + --> $DIR/borrowck-move-out-from-array-use-match.rs:44:11 | LL | [_x, _, _] => {} | -- value moved here @@ -43,7 +43,7 @@ LL | match a { = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a` - --> $DIR/borrowck-move-out-from-array-use-match.rs:57:11 + --> $DIR/borrowck-move-out-from-array-use-match.rs:55:11 | LL | [.., _x] => {} | -- value moved here @@ -54,7 +54,7 @@ LL | match a { = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a` - --> $DIR/borrowck-move-out-from-array-use-match.rs:68:11 + --> $DIR/borrowck-move-out-from-array-use-match.rs:66:11 | LL | [(_x, _), _, _] => {} | -- value moved here @@ -65,7 +65,7 @@ LL | match a { = note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a` - --> $DIR/borrowck-move-out-from-array-use-match.rs:79:11 + --> $DIR/borrowck-move-out-from-array-use-match.rs:77:11 | LL | [.., (_x, _)] => {} | -- value moved here @@ -76,7 +76,7 @@ LL | match a { = note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: borrow of moved value: `a[..]` - --> $DIR/borrowck-move-out-from-array-use-match.rs:91:11 + --> $DIR/borrowck-move-out-from-array-use-match.rs:89:11 | LL | [_y @ .., _, _] => {} | ------- value moved here @@ -87,7 +87,7 @@ LL | [(ref _x, _), _, _] => {} = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait error[E0382]: borrow of moved value: `a[..]` - --> $DIR/borrowck-move-out-from-array-use-match.rs:101:15 + --> $DIR/borrowck-move-out-from-array-use-match.rs:99:15 | LL | [_, _, _y @ ..] => {} | ------- value moved here @@ -98,7 +98,7 @@ LL | [.., (ref _x, _)] => {} = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a` - --> $DIR/borrowck-move-out-from-array-use-match.rs:112:11 + --> $DIR/borrowck-move-out-from-array-use-match.rs:110:11 | LL | [x @ .., _] => {} | ------ value moved here @@ -109,7 +109,7 @@ LL | match a { = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a` - --> $DIR/borrowck-move-out-from-array-use-match.rs:125:5 + --> $DIR/borrowck-move-out-from-array-use-match.rs:123:5 | LL | [_, _, _x] => {} | -- value moved here @@ -120,7 +120,7 @@ LL | a[2] = Default::default(); = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a` - --> $DIR/borrowck-move-out-from-array-use-match.rs:133:5 + --> $DIR/borrowck-move-out-from-array-use-match.rs:131:5 | LL | [_, _, (_x, _)] => {} | -- value moved here @@ -131,7 +131,7 @@ LL | a[2].1 = Default::default(); = note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a` - --> $DIR/borrowck-move-out-from-array-use-match.rs:141:5 + --> $DIR/borrowck-move-out-from-array-use-match.rs:139:5 | LL | [_, _, _x @ ..] => {} | ------- value moved here @@ -142,7 +142,7 @@ LL | a[0] = Default::default(); = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a` - --> $DIR/borrowck-move-out-from-array-use-match.rs:149:5 + --> $DIR/borrowck-move-out-from-array-use-match.rs:147:5 | LL | [_, _, _x @ ..] => {} | ------- value moved here diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array-use-no-overlap-match.rs b/src/test/ui/borrowck/borrowck-move-out-from-array-use-no-overlap-match.rs index 79fe593009652..5afd6835dcfb6 100644 --- a/src/test/ui/borrowck/borrowck-move-out-from-array-use-no-overlap-match.rs +++ b/src/test/ui/borrowck/borrowck-move-out-from-array-use-no-overlap-match.rs @@ -3,8 +3,6 @@ // Once the bug is fixed, the test, which is derived from a // passing test for `let` statements, should become check-pass. -#![feature(slice_patterns)] - fn array() -> [(String, String); 3] { Default::default() } diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array-use-no-overlap-match.stderr b/src/test/ui/borrowck/borrowck-move-out-from-array-use-no-overlap-match.stderr index 43ba2b664a1e1..a4042ce7db336 100644 --- a/src/test/ui/borrowck/borrowck-move-out-from-array-use-no-overlap-match.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-from-array-use-no-overlap-match.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `a` - --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:19:11 + --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:17:11 | LL | [_, _, _x] => {} | -- value moved here @@ -10,7 +10,7 @@ LL | match a { = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a` - --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:30:11 + --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:28:11 | LL | [_, _, (_x, _)] => {} | -- value moved here @@ -21,7 +21,7 @@ LL | match a { = note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a` - --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:43:11 + --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:41:11 | LL | [_x, _, _] => {} | -- value moved here @@ -32,7 +32,7 @@ LL | match a { = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a` - --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:54:11 + --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:52:11 | LL | [.., _x] => {} | -- value moved here @@ -43,7 +43,7 @@ LL | match a { = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a` - --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:65:11 + --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:63:11 | LL | [(_x, _), _, _] => {} | -- value moved here @@ -54,7 +54,7 @@ LL | match a { = note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a` - --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:76:11 + --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:74:11 | LL | [.., (_x, _)] => {} | -- value moved here @@ -65,7 +65,7 @@ LL | match a { = note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a` - --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:87:11 + --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:85:11 | LL | [_, _y @ ..] => {} | ------- value moved here @@ -76,7 +76,7 @@ LL | match a { = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a` - --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:98:11 + --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:96:11 | LL | [_y @ .., _] => {} | ------- value moved here @@ -87,7 +87,7 @@ LL | match a { = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a` - --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:111:11 + --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:109:11 | LL | [x @ .., _, _] => {} | ------ value moved here diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array-use-no-overlap.rs b/src/test/ui/borrowck/borrowck-move-out-from-array-use-no-overlap.rs index 57ce2417570b0..e3498cef37719 100644 --- a/src/test/ui/borrowck/borrowck-move-out-from-array-use-no-overlap.rs +++ b/src/test/ui/borrowck/borrowck-move-out-from-array-use-no-overlap.rs @@ -1,7 +1,5 @@ // check-pass -#![feature(slice_patterns)] - fn array() -> [(String, String); 3] { Default::default() } diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array-use.rs b/src/test/ui/borrowck/borrowck-move-out-from-array-use.rs index 778beefbf2c85..ad08367a3b5b3 100644 --- a/src/test/ui/borrowck/borrowck-move-out-from-array-use.rs +++ b/src/test/ui/borrowck/borrowck-move-out-from-array-use.rs @@ -1,5 +1,3 @@ -#![feature(slice_patterns)] - fn array() -> [(String, String); 3] { Default::default() } diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array-use.stderr b/src/test/ui/borrowck/borrowck-move-out-from-array-use.stderr index 2a7b89132c1b7..7ad4116645e93 100644 --- a/src/test/ui/borrowck/borrowck-move-out-from-array-use.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-from-array-use.stderr @@ -1,5 +1,5 @@ error[E0382]: borrow of moved value: `a[..]` - --> $DIR/borrowck-move-out-from-array-use.rs:12:14 + --> $DIR/borrowck-move-out-from-array-use.rs:10:14 | LL | let [_, _, _x] = a; | -- value moved here @@ -9,7 +9,7 @@ LL | let [.., ref _y] = a; = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait error[E0382]: borrow of moved value: `a[..]` - --> $DIR/borrowck-move-out-from-array-use.rs:18:14 + --> $DIR/borrowck-move-out-from-array-use.rs:16:14 | LL | let [_, _, (_x, _)] = a; | -- value moved here @@ -19,7 +19,7 @@ LL | let [.., ref _y] = a; = note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: borrow of moved value: `a[..].0` - --> $DIR/borrowck-move-out-from-array-use.rs:24:15 + --> $DIR/borrowck-move-out-from-array-use.rs:22:15 | LL | let [_, _, (_x, _)] = a; | -- value moved here @@ -29,7 +29,7 @@ LL | let [.., (ref _y, _)] = a; = note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: borrow of moved value: `a` - --> $DIR/borrowck-move-out-from-array-use.rs:32:10 + --> $DIR/borrowck-move-out-from-array-use.rs:30:10 | LL | let [_x, _, _] = a; | -- value moved here @@ -39,7 +39,7 @@ LL | let [ref _y @ .., _, _] = a; = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait error[E0382]: borrow of moved value: `a` - --> $DIR/borrowck-move-out-from-array-use.rs:38:16 + --> $DIR/borrowck-move-out-from-array-use.rs:36:16 | LL | let [.., _x] = a; | -- value moved here @@ -49,7 +49,7 @@ LL | let [_, _, ref _y @ ..] = a; = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait error[E0382]: borrow of moved value: `a` - --> $DIR/borrowck-move-out-from-array-use.rs:44:10 + --> $DIR/borrowck-move-out-from-array-use.rs:42:10 | LL | let [(_x, _), _, _] = a; | -- value moved here @@ -59,7 +59,7 @@ LL | let [ref _y @ .., _, _] = a; = note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: borrow of moved value: `a` - --> $DIR/borrowck-move-out-from-array-use.rs:50:16 + --> $DIR/borrowck-move-out-from-array-use.rs:48:16 | LL | let [.., (_x, _)] = a; | -- value moved here @@ -69,7 +69,7 @@ LL | let [_, _, ref _y @ ..] = a; = note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: borrow of moved value: `a[..]` - --> $DIR/borrowck-move-out-from-array-use.rs:56:11 + --> $DIR/borrowck-move-out-from-array-use.rs:54:11 | LL | let [_y @ .., _, _] = a; | ------- value moved here @@ -79,7 +79,7 @@ LL | let [(ref _x, _), _, _] = a; = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait error[E0382]: borrow of moved value: `a[..]` - --> $DIR/borrowck-move-out-from-array-use.rs:62:15 + --> $DIR/borrowck-move-out-from-array-use.rs:60:15 | LL | let [_, _, _y @ ..] = a; | ------- value moved here @@ -89,7 +89,7 @@ LL | let [.., (ref _x, _)] = a; = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait error[E0382]: borrow of moved value: `a` - --> $DIR/borrowck-move-out-from-array-use.rs:70:13 + --> $DIR/borrowck-move-out-from-array-use.rs:68:13 | LL | let [x @ .., _] = a; | ------ value moved here @@ -99,7 +99,7 @@ LL | let [_, ref _y @ ..] = a; = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a` - --> $DIR/borrowck-move-out-from-array-use.rs:78:5 + --> $DIR/borrowck-move-out-from-array-use.rs:76:5 | LL | let [_, _, _x] = a; | -- value moved here @@ -109,7 +109,7 @@ LL | a[2] = Default::default(); = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a` - --> $DIR/borrowck-move-out-from-array-use.rs:84:5 + --> $DIR/borrowck-move-out-from-array-use.rs:82:5 | LL | let [_, _, (_x, _)] = a; | -- value moved here @@ -119,7 +119,7 @@ LL | a[2].1 = Default::default(); = note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a` - --> $DIR/borrowck-move-out-from-array-use.rs:90:5 + --> $DIR/borrowck-move-out-from-array-use.rs:88:5 | LL | let [_, _, _x @ ..] = a; | ------- value moved here @@ -129,7 +129,7 @@ LL | a[0] = Default::default(); = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a` - --> $DIR/borrowck-move-out-from-array-use.rs:96:5 + --> $DIR/borrowck-move-out-from-array-use.rs:94:5 | LL | let [_, _, _x @ ..] = a; | ------- value moved here diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array.rs b/src/test/ui/borrowck/borrowck-move-out-from-array.rs index f9d3f6f2c0724..83755812f4b32 100644 --- a/src/test/ui/borrowck/borrowck-move-out-from-array.rs +++ b/src/test/ui/borrowck/borrowck-move-out-from-array.rs @@ -1,5 +1,3 @@ -#![feature(slice_patterns)] - fn array() -> [(String, String); 3] { Default::default() } diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array.stderr b/src/test/ui/borrowck/borrowck-move-out-from-array.stderr index 08134a2a323e7..b7babd93ed7a6 100644 --- a/src/test/ui/borrowck/borrowck-move-out-from-array.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-from-array.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `a[..]` - --> $DIR/borrowck-move-out-from-array.rs:12:14 + --> $DIR/borrowck-move-out-from-array.rs:10:14 | LL | let [_, _, _x] = a; | -- value moved here @@ -9,7 +9,7 @@ LL | let [.., _y] = a; = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a[..]` - --> $DIR/borrowck-move-out-from-array.rs:18:14 + --> $DIR/borrowck-move-out-from-array.rs:16:14 | LL | let [_, _, (_x, _)] = a; | -- value moved here @@ -19,7 +19,7 @@ LL | let [.., _y] = a; = note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a[..].0` - --> $DIR/borrowck-move-out-from-array.rs:24:15 + --> $DIR/borrowck-move-out-from-array.rs:22:15 | LL | let [_, _, (_x, _)] = a; | -- value moved here @@ -29,7 +29,7 @@ LL | let [.., (_y, _)] = a; = note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a` - --> $DIR/borrowck-move-out-from-array.rs:32:10 + --> $DIR/borrowck-move-out-from-array.rs:30:10 | LL | let [_x, _, _] = a; | -- value moved here @@ -39,7 +39,7 @@ LL | let [_y @ .., _, _] = a; = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a` - --> $DIR/borrowck-move-out-from-array.rs:38:16 + --> $DIR/borrowck-move-out-from-array.rs:36:16 | LL | let [.., _x] = a; | -- value moved here @@ -49,7 +49,7 @@ LL | let [_, _, _y @ ..] = a; = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a` - --> $DIR/borrowck-move-out-from-array.rs:44:10 + --> $DIR/borrowck-move-out-from-array.rs:42:10 | LL | let [(_x, _), _, _] = a; | -- value moved here @@ -59,7 +59,7 @@ LL | let [_y @ .., _, _] = a; = note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a` - --> $DIR/borrowck-move-out-from-array.rs:50:16 + --> $DIR/borrowck-move-out-from-array.rs:48:16 | LL | let [.., (_x, _)] = a; | -- value moved here @@ -69,7 +69,7 @@ LL | let [_, _, _y @ ..] = a; = note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a[..].0` - --> $DIR/borrowck-move-out-from-array.rs:56:11 + --> $DIR/borrowck-move-out-from-array.rs:54:11 | LL | let [_y @ .., _, _] = a; | ------- value moved here @@ -79,7 +79,7 @@ LL | let [(_x, _), _, _] = a; = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a[..].0` - --> $DIR/borrowck-move-out-from-array.rs:62:15 + --> $DIR/borrowck-move-out-from-array.rs:60:15 | LL | let [_, _, _y @ ..] = a; | ------- value moved here @@ -89,7 +89,7 @@ LL | let [.., (_x, _)] = a; = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a` - --> $DIR/borrowck-move-out-from-array.rs:70:13 + --> $DIR/borrowck-move-out-from-array.rs:68:13 | LL | let [x @ .., _] = a; | ------ value moved here diff --git a/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.rs b/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.rs index fa9a3c217db77..8ece81a3c845e 100644 --- a/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.rs +++ b/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.rs @@ -1,7 +1,5 @@ // Test that we do not permit moves from &[] matched by a vec pattern. -#![feature(slice_patterns)] - #[derive(Clone, Debug)] struct Foo { string: String diff --git a/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.stderr b/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.stderr index 8fb4c062c0363..a345c1238f02c 100644 --- a/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.stderr @@ -1,5 +1,5 @@ error[E0508]: cannot move out of type `[Foo]`, a non-copy slice - --> $DIR/borrowck-move-out-of-vec-tail.rs:19:19 + --> $DIR/borrowck-move-out-of-vec-tail.rs:17:19 | LL | match tail { | ^^^^ cannot move out of here diff --git a/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-array-no-overlap.rs b/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-array-no-overlap.rs index 7d91a21264723..a8e56f648e2e5 100644 --- a/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-array-no-overlap.rs +++ b/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-array-no-overlap.rs @@ -1,7 +1,5 @@ // check-pass -#![feature(slice_patterns)] - fn nop(_s: &[& i32]) {} fn nop_subslice(_s: &[i32]) {} diff --git a/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-array.rs b/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-array.rs index f03a2ab8fa8e4..6b210d73228f8 100644 --- a/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-array.rs +++ b/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-array.rs @@ -1,5 +1,3 @@ -#![feature(slice_patterns)] - fn nop(_s: &[& i32]) {} fn nop_subslice(_s: &[i32]) {} diff --git a/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-array.stderr b/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-array.stderr index e50e7eb3e2230..0432aaf51d29f 100644 --- a/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-array.stderr +++ b/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-array.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-slice-pattern-element-loan-array.rs:8:13 + --> $DIR/borrowck-slice-pattern-element-loan-array.rs:6:13 | LL | let [ref first, ref second, ..] = *s; | ---------- immutable borrow occurs here @@ -9,7 +9,7 @@ LL | nop(&[first, second, second2, third]); | ------ immutable borrow later used here error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-slice-pattern-element-loan-array.rs:14:14 + --> $DIR/borrowck-slice-pattern-element-loan-array.rs:12:14 | LL | let [.., ref fourth, ref third, _, ref first] = *s; | --------- immutable borrow occurs here @@ -19,7 +19,7 @@ LL | nop(&[first, third, third2, fourth]); | ----- immutable borrow later used here error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-slice-pattern-element-loan-array.rs:21:16 + --> $DIR/borrowck-slice-pattern-element-loan-array.rs:19:16 | LL | let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s; | ------------- immutable borrow occurs here @@ -30,7 +30,7 @@ LL | nop(&[from_begin2, from_end1, from_end3, from_end4]); | --------- immutable borrow later used here error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-slice-pattern-element-loan-array.rs:23:19 + --> $DIR/borrowck-slice-pattern-element-loan-array.rs:21:19 | LL | let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s; | ------------- immutable borrow occurs here @@ -41,7 +41,7 @@ LL | nop(&[from_begin3, from_end1, from_end3, from_end4]); | --------- immutable borrow later used here error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-slice-pattern-element-loan-array.rs:28:14 + --> $DIR/borrowck-slice-pattern-element-loan-array.rs:26:14 | LL | let [ref from_begin0, ref from_begin1, _, ref from_begin3, _, ..] = *s; | --------------- immutable borrow occurs here @@ -52,7 +52,7 @@ LL | nop(&[from_begin0, from_begin1, from_begin3, from_end3]); | ----------- immutable borrow later used here error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-slice-pattern-element-loan-array.rs:34:13 + --> $DIR/borrowck-slice-pattern-element-loan-array.rs:32:13 | LL | let [ref first, ref second, ..] = *s; | ---------- immutable borrow occurs here @@ -62,7 +62,7 @@ LL | nop(&[first, second]); | ------ immutable borrow later used here error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-slice-pattern-element-loan-array.rs:41:10 + --> $DIR/borrowck-slice-pattern-element-loan-array.rs:39:10 | LL | let [.., ref second, ref first] = *s; | ---------- immutable borrow occurs here @@ -72,7 +72,7 @@ LL | nop(&[first, second]); | ------ immutable borrow later used here error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-slice-pattern-element-loan-array.rs:48:10 + --> $DIR/borrowck-slice-pattern-element-loan-array.rs:46:10 | LL | let [_, ref s1 @ ..] = *s; | ----------- immutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-rpass.rs b/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-rpass.rs index 048813b2b93e6..4367596c6ea88 100644 --- a/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-rpass.rs +++ b/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-rpass.rs @@ -1,7 +1,4 @@ // run-pass -//compile-flags: -Z borrowck=mir - -#![feature(slice_patterns)] fn mut_head_tail<'a, A>(v: &'a mut [A]) -> Option<(&'a mut A, &'a mut [A])> { match *v { diff --git a/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-slice-no-overlap.rs b/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-slice-no-overlap.rs index e69071f87720b..6390dc3a91a0d 100644 --- a/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-slice-no-overlap.rs +++ b/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-slice-no-overlap.rs @@ -1,7 +1,5 @@ // check-pass -#![feature(slice_patterns)] - fn nop(_s: &[& i32]) {} fn nop_subslice(_s: &[i32]) {} diff --git a/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-slice.rs b/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-slice.rs index 2ef98741dc35a..0e1c90a1cd83d 100644 --- a/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-slice.rs +++ b/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-slice.rs @@ -1,5 +1,3 @@ -#![feature(slice_patterns)] - fn nop(_s: &[& i32]) {} fn nop_subslice(_s: &[i32]) {} diff --git a/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-slice.stderr b/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-slice.stderr index b6f5ac64b2061..d3388e071aa53 100644 --- a/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-slice.stderr +++ b/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-slice.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-slice-pattern-element-loan-slice.rs:8:20 + --> $DIR/borrowck-slice-pattern-element-loan-slice.rs:6:20 | LL | if let [ref first, ref second, ..] = *s { | ---------- immutable borrow occurs here @@ -9,7 +9,7 @@ LL | nop(&[first, second, second2, third]); | ------ immutable borrow later used here error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-slice-pattern-element-loan-slice.rs:16:21 + --> $DIR/borrowck-slice-pattern-element-loan-slice.rs:14:21 | LL | if let [.., ref fourth, ref third, _, ref first] = *s { | --------- immutable borrow occurs here @@ -19,7 +19,7 @@ LL | nop(&[first, third, third2, fourth]); | ----- immutable borrow later used here error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-slice-pattern-element-loan-slice.rs:24:20 + --> $DIR/borrowck-slice-pattern-element-loan-slice.rs:22:20 | LL | if let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s { | ------------- immutable borrow occurs here @@ -29,7 +29,7 @@ LL | nop(&[from_begin1, from_end1, from_end3, from_end4]); | --------- immutable borrow later used here error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-slice-pattern-element-loan-slice.rs:27:23 + --> $DIR/borrowck-slice-pattern-element-loan-slice.rs:25:23 | LL | if let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s { | ------------- immutable borrow occurs here @@ -40,7 +40,7 @@ LL | nop(&[from_begin2, from_end1, from_end3, from_end4]); | --------- immutable borrow later used here error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-slice-pattern-element-loan-slice.rs:30:26 + --> $DIR/borrowck-slice-pattern-element-loan-slice.rs:28:26 | LL | if let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s { | ------------- immutable borrow occurs here @@ -51,7 +51,7 @@ LL | nop(&[from_begin3, from_end1, from_end3, from_end4]); | --------- immutable borrow later used here error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-slice-pattern-element-loan-slice.rs:35:21 + --> $DIR/borrowck-slice-pattern-element-loan-slice.rs:33:21 | LL | if let [ref from_begin0, ref from_begin1, _, ref from_begin3, _, ..] = *s { | --------------- immutable borrow occurs here @@ -61,7 +61,7 @@ LL | nop(&[from_begin0, from_begin1, from_begin3, from_end2]); | ----------- immutable borrow later used here error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-slice-pattern-element-loan-slice.rs:38:21 + --> $DIR/borrowck-slice-pattern-element-loan-slice.rs:36:21 | LL | if let [ref from_begin0, ref from_begin1, _, ref from_begin3, _, ..] = *s { | --------------- immutable borrow occurs here @@ -72,7 +72,7 @@ LL | nop(&[from_begin0, from_begin1, from_begin3, from_end3]); | ----------- immutable borrow later used here error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-slice-pattern-element-loan-slice.rs:41:21 + --> $DIR/borrowck-slice-pattern-element-loan-slice.rs:39:21 | LL | if let [ref from_begin0, ref from_begin1, _, ref from_begin3, _, ..] = *s { | --------------- immutable borrow occurs here @@ -83,7 +83,7 @@ LL | nop(&[from_begin0, from_begin1, from_begin3, from_end4]); | ----------- immutable borrow later used here error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-slice-pattern-element-loan-slice.rs:49:20 + --> $DIR/borrowck-slice-pattern-element-loan-slice.rs:47:20 | LL | if let [ref first, ref second, ..] = *s { | ---------- immutable borrow occurs here @@ -93,7 +93,7 @@ LL | nop(&[first, second]); | ------ immutable borrow later used here error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-slice-pattern-element-loan-slice.rs:58:17 + --> $DIR/borrowck-slice-pattern-element-loan-slice.rs:56:17 | LL | if let [.., ref second, ref first] = *s { | ---------- immutable borrow occurs here @@ -103,7 +103,7 @@ LL | nop(&[first, second]); | ------ immutable borrow later used here error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-slice-pattern-element-loan-slice.rs:67:17 + --> $DIR/borrowck-slice-pattern-element-loan-slice.rs:65:17 | LL | if let [_, _, _, ref s1 @ ..] = *s { | ----------- immutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.rs b/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.rs index 53a9bcef74a22..cd853b83363ab 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.rs +++ b/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.rs @@ -1,5 +1,3 @@ -#![feature(slice_patterns)] - fn a<'a>() -> &'a [isize] { let vec = vec![1, 2, 3, 4]; let vec: &[isize] = &vec; diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.stderr index da6d9293b408a..170982b1693fb 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.stderr +++ b/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return value referencing local variable `vec` - --> $DIR/borrowck-vec-pattern-element-loan.rs:10:5 + --> $DIR/borrowck-vec-pattern-element-loan.rs:8:5 | LL | let vec: &[isize] = &vec; | ---- `vec` is borrowed here @@ -8,7 +8,7 @@ LL | tail | ^^^^ returns a value referencing data owned by the current function error[E0515]: cannot return value referencing local variable `vec` - --> $DIR/borrowck-vec-pattern-element-loan.rs:20:5 + --> $DIR/borrowck-vec-pattern-element-loan.rs:18:5 | LL | let vec: &[isize] = &vec; | ---- `vec` is borrowed here @@ -17,7 +17,7 @@ LL | init | ^^^^ returns a value referencing data owned by the current function error[E0515]: cannot return value referencing local variable `vec` - --> $DIR/borrowck-vec-pattern-element-loan.rs:30:5 + --> $DIR/borrowck-vec-pattern-element-loan.rs:28:5 | LL | let vec: &[isize] = &vec; | ---- `vec` is borrowed here diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.rs b/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.rs index dd9023f6d9f79..05859c95d174d 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.rs +++ b/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.rs @@ -1,5 +1,3 @@ -#![feature(slice_patterns)] - fn a() { let mut v = vec![1, 2, 3]; let vb: &mut [isize] = &mut v; diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.stderr index 251f44592905d..5141fcc1bb261 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.stderr +++ b/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `v` as mutable more than once at a time - --> $DIR/borrowck-vec-pattern-loan-from-mut.rs:8:13 + --> $DIR/borrowck-vec-pattern-loan-from-mut.rs:6:13 | LL | let vb: &mut [isize] = &mut v; | ------ first mutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.rs b/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.rs index 420223009a45b..9b8ba2ea8adc5 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.rs +++ b/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.rs @@ -1,7 +1,3 @@ -// http://rust-lang.org/COPYRIGHT. - -#![feature(slice_patterns)] - fn main() { let mut a = [1, 2, 3, 4]; let t = match a { diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.stderr index 9f8e6fe3b6898..ff70ba9fcca8b 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.stderr +++ b/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `a[_]` because it is borrowed - --> $DIR/borrowck-vec-pattern-move-tail.rs:12:5 + --> $DIR/borrowck-vec-pattern-move-tail.rs:8:5 | LL | [1, 2, ref tail @ ..] => tail, | ------------- borrow of `a[_]` occurs here diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.rs b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.rs index e274d105e0503..67b6c12ba803a 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.rs +++ b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.rs @@ -1,6 +1,5 @@ #![feature(box_patterns)] #![feature(box_syntax)] -#![feature(slice_patterns)] fn a() { let mut vec = [box 1, box 2, box 3]; diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr index a3324f25d0bb5..e2c0852dd83c6 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr +++ b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `vec[_]` because it is borrowed - --> $DIR/borrowck-vec-pattern-nesting.rs:10:13 + --> $DIR/borrowck-vec-pattern-nesting.rs:9:13 | LL | [box ref _a, _, _] => { | ------ borrow of `vec[_]` occurs here @@ -11,7 +11,7 @@ LL | _a.use_ref(); | -- borrow later used here error[E0506]: cannot assign to `vec[_]` because it is borrowed - --> $DIR/borrowck-vec-pattern-nesting.rs:24:13 + --> $DIR/borrowck-vec-pattern-nesting.rs:23:13 | LL | &mut [ref _b @ ..] => { | ----------- borrow of `vec[_]` occurs here @@ -23,7 +23,7 @@ LL | _b.use_ref(); | -- borrow later used here error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice - --> $DIR/borrowck-vec-pattern-nesting.rs:35:11 + --> $DIR/borrowck-vec-pattern-nesting.rs:34:11 | LL | match vec { | ^^^ cannot move out of here @@ -45,7 +45,7 @@ LL | ] => { | error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice - --> $DIR/borrowck-vec-pattern-nesting.rs:47:13 + --> $DIR/borrowck-vec-pattern-nesting.rs:46:13 | LL | let a = vec[0]; | ^^^^^^ @@ -55,7 +55,7 @@ LL | let a = vec[0]; | help: consider borrowing here: `&vec[0]` error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice - --> $DIR/borrowck-vec-pattern-nesting.rs:56:11 + --> $DIR/borrowck-vec-pattern-nesting.rs:55:11 | LL | match vec { | ^^^ cannot move out of here @@ -74,7 +74,7 @@ LL | _b] => {} | error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice - --> $DIR/borrowck-vec-pattern-nesting.rs:66:13 + --> $DIR/borrowck-vec-pattern-nesting.rs:65:13 | LL | let a = vec[0]; | ^^^^^^ @@ -84,7 +84,7 @@ LL | let a = vec[0]; | help: consider borrowing here: `&vec[0]` error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice - --> $DIR/borrowck-vec-pattern-nesting.rs:75:11 + --> $DIR/borrowck-vec-pattern-nesting.rs:74:11 | LL | match vec { | ^^^ cannot move out of here @@ -100,7 +100,7 @@ LL | &mut [_a, _b, _c] => {} = note: move occurs because these variables have types that don't implement the `Copy` trait error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice - --> $DIR/borrowck-vec-pattern-nesting.rs:86:13 + --> $DIR/borrowck-vec-pattern-nesting.rs:85:13 | LL | let a = vec[0]; | ^^^^^^ diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.rs b/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.rs index c35be2f6be62c..39872825cd2a4 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.rs +++ b/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.rs @@ -1,5 +1,3 @@ -#![feature(slice_patterns)] - fn a<'a>() -> &'a isize { let vec = vec![1, 2, 3, 4]; let vec: &[isize] = &vec; diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.stderr index c1290a6f63f33..7e21c55f21b5f 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.stderr +++ b/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return value referencing local variable `vec` - --> $DIR/borrowck-vec-pattern-tail-element-loan.rs:10:5 + --> $DIR/borrowck-vec-pattern-tail-element-loan.rs:8:5 | LL | let vec: &[isize] = &vec; | ---- `vec` is borrowed here diff --git a/src/test/ui/const-generics/integer-literal-generic-arg-in-where-clause.rs b/src/test/ui/const-generics/integer-literal-generic-arg-in-where-clause.rs new file mode 100644 index 0000000000000..30fbfda112c55 --- /dev/null +++ b/src/test/ui/const-generics/integer-literal-generic-arg-in-where-clause.rs @@ -0,0 +1,18 @@ +// check-pass + +#![feature(const_generics)] +//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash + +fn takes_closure_of_array_3(f: F) where F: Fn([i32; 3]) { + f([1, 2, 3]); +} + +fn takes_closure_of_array_3_apit(f: impl Fn([i32; 3])) { + f([1, 2, 3]); +} + +fn returns_closure_of_array_3() -> impl Fn([i32; 3]) { + |_| {} +} + +fn main() {} diff --git a/src/test/ui/const-generics/integer-literal-generic-arg-in-where-clause.stderr b/src/test/ui/const-generics/integer-literal-generic-arg-in-where-clause.stderr new file mode 100644 index 0000000000000..7f37f3e2791ec --- /dev/null +++ b/src/test/ui/const-generics/integer-literal-generic-arg-in-where-clause.stderr @@ -0,0 +1,8 @@ +warning: the feature `const_generics` is incomplete and may cause the compiler to crash + --> $DIR/integer-literal-generic-arg-in-where-clause.rs:3:12 + | +LL | #![feature(const_generics)] + | ^^^^^^^^^^^^^^ + | + = note: `#[warn(incomplete_features)]` on by default + diff --git a/src/test/ui/consts/const_prop_slice_pat_ice.rs b/src/test/ui/consts/const_prop_slice_pat_ice.rs index 5fec36e44bd8c..60b06a497d6de 100644 --- a/src/test/ui/consts/const_prop_slice_pat_ice.rs +++ b/src/test/ui/consts/const_prop_slice_pat_ice.rs @@ -1,5 +1,4 @@ // check-pass -#![feature(slice_patterns)] fn main() { match &[0, 1] as &[i32] { diff --git a/src/test/ui/consts/miri_unleashed/mutable_const2.stderr b/src/test/ui/consts/miri_unleashed/mutable_const2.stderr index 655c31763ef44..0d7fb845a40ee 100644 --- a/src/test/ui/consts/miri_unleashed/mutable_const2.stderr +++ b/src/test/ui/consts/miri_unleashed/mutable_const2.stderr @@ -10,7 +10,7 @@ error: internal compiler error: mutable allocation in constant LL | const MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *mut _; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', src/librustc_errors/lib.rs:346:17 +thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', src/librustc_errors/lib.rs:356:17 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace error: internal compiler error: unexpected panic diff --git a/src/test/ui/drop/dynamic-drop-async.rs b/src/test/ui/drop/dynamic-drop-async.rs index 91063edf0f6c4..30a8960594493 100644 --- a/src/test/ui/drop/dynamic-drop-async.rs +++ b/src/test/ui/drop/dynamic-drop-async.rs @@ -7,7 +7,6 @@ // edition:2018 // ignore-wasm32-bare compiled with panic=abort by default -#![feature(slice_patterns)] #![allow(unused)] use std::{ diff --git a/src/test/ui/drop/dynamic-drop.rs b/src/test/ui/drop/dynamic-drop.rs index 0f0ec0ba460c8..b4406204a5db9 100644 --- a/src/test/ui/drop/dynamic-drop.rs +++ b/src/test/ui/drop/dynamic-drop.rs @@ -1,11 +1,10 @@ // run-pass -#![allow(unused_assignments)] -#![allow(unused_variables)] - // ignore-wasm32-bare compiled with panic=abort by default #![feature(generators, generator_trait, untagged_unions)] -#![feature(slice_patterns)] + +#![allow(unused_assignments)] +#![allow(unused_variables)] use std::cell::{Cell, RefCell}; use std::mem::ManuallyDrop; diff --git a/src/test/ui/error-codes/E0528.rs b/src/test/ui/error-codes/E0528.rs index 17d03b14fc6e1..0a337c9611c8b 100644 --- a/src/test/ui/error-codes/E0528.rs +++ b/src/test/ui/error-codes/E0528.rs @@ -1,5 +1,3 @@ -#![feature(slice_patterns)] - fn main() { let r = &[1, 2]; match r { diff --git a/src/test/ui/error-codes/E0528.stderr b/src/test/ui/error-codes/E0528.stderr index 0f566091145bf..21615f954c363 100644 --- a/src/test/ui/error-codes/E0528.stderr +++ b/src/test/ui/error-codes/E0528.stderr @@ -1,5 +1,5 @@ error[E0528]: pattern requires at least 3 elements but array has 2 - --> $DIR/E0528.rs:6:10 + --> $DIR/E0528.rs:4:10 | LL | &[a, b, c, rest @ ..] => { | ^^^^^^^^^^^^^^^^^^^^ pattern cannot match array of 2 elements diff --git a/src/test/ui/feature-gates/feature-gate-slice-patterns.rs b/src/test/ui/feature-gates/feature-gate-slice-patterns.rs deleted file mode 100644 index f2a1b135b69cb..0000000000000 --- a/src/test/ui/feature-gates/feature-gate-slice-patterns.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Test that slice pattern syntax with `..` is gated by `slice_patterns` feature gate - -fn main() { - let x = [1, 2, 3, 4, 5]; - match x { - [1, 2, ..] => {} //~ ERROR subslice patterns are unstable - [1, .., 5] => {} //~ ERROR subslice patterns are unstable - [.., 4, 5] => {} //~ ERROR subslice patterns are unstable - } - - let x = [ 1, 2, 3, 4, 5 ]; - match x { - [ xs @ .., 4, 5 ] => {} //~ ERROR subslice patterns are unstable - [ 1, xs @ .., 5 ] => {} //~ ERROR subslice patterns are unstable - [ 1, 2, xs @ .. ] => {} //~ ERROR subslice patterns are unstable - } -} diff --git a/src/test/ui/feature-gates/feature-gate-slice-patterns.stderr b/src/test/ui/feature-gates/feature-gate-slice-patterns.stderr deleted file mode 100644 index d4946a42b8f3d..0000000000000 --- a/src/test/ui/feature-gates/feature-gate-slice-patterns.stderr +++ /dev/null @@ -1,57 +0,0 @@ -error[E0658]: subslice patterns are unstable - --> $DIR/feature-gate-slice-patterns.rs:6:16 - | -LL | [1, 2, ..] => {} - | ^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/62254 - = help: add `#![feature(slice_patterns)]` to the crate attributes to enable - -error[E0658]: subslice patterns are unstable - --> $DIR/feature-gate-slice-patterns.rs:7:13 - | -LL | [1, .., 5] => {} - | ^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/62254 - = help: add `#![feature(slice_patterns)]` to the crate attributes to enable - -error[E0658]: subslice patterns are unstable - --> $DIR/feature-gate-slice-patterns.rs:8:10 - | -LL | [.., 4, 5] => {} - | ^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/62254 - = help: add `#![feature(slice_patterns)]` to the crate attributes to enable - -error[E0658]: subslice patterns are unstable - --> $DIR/feature-gate-slice-patterns.rs:13:11 - | -LL | [ xs @ .., 4, 5 ] => {} - | ^^^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/62254 - = help: add `#![feature(slice_patterns)]` to the crate attributes to enable - -error[E0658]: subslice patterns are unstable - --> $DIR/feature-gate-slice-patterns.rs:14:14 - | -LL | [ 1, xs @ .., 5 ] => {} - | ^^^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/62254 - = help: add `#![feature(slice_patterns)]` to the crate attributes to enable - -error[E0658]: subslice patterns are unstable - --> $DIR/feature-gate-slice-patterns.rs:15:17 - | -LL | [ 1, 2, xs @ .. ] => {} - | ^^^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/62254 - = help: add `#![feature(slice_patterns)]` to the crate attributes to enable - -error: aborting due to 6 previous errors - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/ignore-all-the-things.rs b/src/test/ui/ignore-all-the-things.rs index 8c046a289fad2..5980e1a857f26 100644 --- a/src/test/ui/ignore-all-the-things.rs +++ b/src/test/ui/ignore-all-the-things.rs @@ -3,9 +3,6 @@ #![allow(non_shorthand_field_patterns)] #![allow(dead_code)] #![allow(unused_variables)] -// pretty-expanded FIXME #23616 - -#![feature(slice_patterns)] struct Foo(isize, isize, isize, isize); struct Bar{a: isize, b: isize, c: isize, d: isize} diff --git a/src/test/ui/issues/issue-12369.rs b/src/test/ui/issues/issue-12369.rs index 0866131807463..0481c1fd9e1bb 100644 --- a/src/test/ui/issues/issue-12369.rs +++ b/src/test/ui/issues/issue-12369.rs @@ -1,4 +1,3 @@ -#![feature(slice_patterns)] #![deny(unreachable_patterns)] fn main() { diff --git a/src/test/ui/issues/issue-12369.stderr b/src/test/ui/issues/issue-12369.stderr index f27425e28c61d..754b94bab75eb 100644 --- a/src/test/ui/issues/issue-12369.stderr +++ b/src/test/ui/issues/issue-12369.stderr @@ -1,11 +1,11 @@ error: unreachable pattern - --> $DIR/issue-12369.rs:10:9 + --> $DIR/issue-12369.rs:9:9 | LL | &[10,a, ref rest @ ..] => 10 | ^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/issue-12369.rs:2:9 + --> $DIR/issue-12369.rs:1:9 | LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-12567.rs b/src/test/ui/issues/issue-12567.rs index 643d9a2fc69e9..1b2a37de47539 100644 --- a/src/test/ui/issues/issue-12567.rs +++ b/src/test/ui/issues/issue-12567.rs @@ -1,5 +1,3 @@ -#![feature(slice_patterns)] - fn match_vecs<'a, T>(l1: &'a [T], l2: &'a [T]) { match (l1, l2) { //~^ ERROR: cannot move out of type `[T]`, a non-copy slice diff --git a/src/test/ui/issues/issue-12567.stderr b/src/test/ui/issues/issue-12567.stderr index 9d9a88f4f9b06..2a88d8f0524ac 100644 --- a/src/test/ui/issues/issue-12567.stderr +++ b/src/test/ui/issues/issue-12567.stderr @@ -1,5 +1,5 @@ error[E0508]: cannot move out of type `[T]`, a non-copy slice - --> $DIR/issue-12567.rs:4:11 + --> $DIR/issue-12567.rs:2:11 | LL | match (l1, l2) { | ^^^^^^^^ cannot move out of here @@ -13,7 +13,7 @@ LL | (&[hd1, ..], &[hd2, ..]) = note: move occurs because these variables have types that don't implement the `Copy` trait error[E0508]: cannot move out of type `[T]`, a non-copy slice - --> $DIR/issue-12567.rs:4:11 + --> $DIR/issue-12567.rs:2:11 | LL | match (l1, l2) { | ^^^^^^^^ cannot move out of here diff --git a/src/test/ui/issues/issue-15080.rs b/src/test/ui/issues/issue-15080.rs index b11b1cda38ae1..4dd6981d448e5 100644 --- a/src/test/ui/issues/issue-15080.rs +++ b/src/test/ui/issues/issue-15080.rs @@ -1,5 +1,4 @@ // run-pass -#![feature(slice_patterns)] fn main() { let mut x: &[_] = &[1, 2, 3, 4]; diff --git a/src/test/ui/issues/issue-15104.rs b/src/test/ui/issues/issue-15104.rs index ee977541137db..47b207ea9cbf5 100644 --- a/src/test/ui/issues/issue-15104.rs +++ b/src/test/ui/issues/issue-15104.rs @@ -1,5 +1,4 @@ // run-pass -#![feature(slice_patterns)] fn main() { assert_eq!(count_members(&[1, 2, 3, 4]), 4); diff --git a/src/test/ui/issues/issue-17877.rs b/src/test/ui/issues/issue-17877.rs index fefa3f2f87304..126e01de5ee3f 100644 --- a/src/test/ui/issues/issue-17877.rs +++ b/src/test/ui/issues/issue-17877.rs @@ -1,5 +1,4 @@ // run-pass -#![feature(slice_patterns)] fn main() { assert_eq!(match [0u8; 1024] { diff --git a/src/test/ui/issues/issue-23311.rs b/src/test/ui/issues/issue-23311.rs index f275c6338b194..62c96840b3bc4 100644 --- a/src/test/ui/issues/issue-23311.rs +++ b/src/test/ui/issues/issue-23311.rs @@ -1,7 +1,6 @@ // run-pass -// Test that we do not ICE when pattern matching an array against a slice. -#![feature(slice_patterns)] +// Test that we do not ICE when pattern matching an array against a slice. fn main() { match "foo".as_bytes() { diff --git a/src/test/ui/issues/issue-26619.rs b/src/test/ui/issues/issue-26619.rs index 00e09f3f07764..b9d34b0555aee 100644 --- a/src/test/ui/issues/issue-26619.rs +++ b/src/test/ui/issues/issue-26619.rs @@ -1,5 +1,3 @@ -#![feature(slice_patterns)] - pub struct History<'a> { pub _s: &'a str } impl<'a> History<'a> { diff --git a/src/test/ui/issues/issue-26619.stderr b/src/test/ui/issues/issue-26619.stderr index d1157cda92bf8..1282fd7d3c238 100644 --- a/src/test/ui/issues/issue-26619.stderr +++ b/src/test/ui/issues/issue-26619.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return value referencing function parameter - --> $DIR/issue-26619.rs:7:76 + --> $DIR/issue-26619.rs:5:76 | LL | for s in vec!["1|2".to_string()].into_iter().filter_map(|ref line| self.make_entry(line)) { | -------- ^^^^^^^^^^^^^^^^^^^^^ returns a value referencing data owned by the current function diff --git a/src/test/ui/issues/issue-37598.rs b/src/test/ui/issues/issue-37598.rs index 31b3aba6bc204..458e999c3faa2 100644 --- a/src/test/ui/issues/issue-37598.rs +++ b/src/test/ui/issues/issue-37598.rs @@ -1,5 +1,4 @@ // check-pass -#![feature(slice_patterns)] fn check(list: &[u8]) { match list { diff --git a/src/test/ui/issues/issue-7784.rs b/src/test/ui/issues/issue-7784.rs index 5b70bd6e5ff54..b7323f09daff2 100644 --- a/src/test/ui/issues/issue-7784.rs +++ b/src/test/ui/issues/issue-7784.rs @@ -1,5 +1,4 @@ // run-pass -#![feature(slice_patterns)] use std::ops::Add; diff --git a/src/test/ui/lint/issue-66362-no-snake-case-warning-for-field-puns.rs b/src/test/ui/lint/issue-66362-no-snake-case-warning-for-field-puns.rs new file mode 100644 index 0000000000000..c2b81959f2cb8 --- /dev/null +++ b/src/test/ui/lint/issue-66362-no-snake-case-warning-for-field-puns.rs @@ -0,0 +1,29 @@ +#![deny(non_snake_case)] +#![allow(unused_variables)] +#![allow(dead_code)] + +enum Foo { + Bad { + lowerCamelCaseName: bool, + //~^ ERROR structure field `lowerCamelCaseName` should have a snake case name + }, + Good { + snake_case_name: bool, + }, +} + +fn main() { + let b = Foo::Bad { lowerCamelCaseName: true }; + + match b { + Foo::Bad { lowerCamelCaseName } => {} + Foo::Good { snake_case_name: lowerCamelCaseBinding } => { } + //~^ ERROR variable `lowerCamelCaseBinding` should have a snake case name + } + + if let Foo::Good { snake_case_name: anotherLowerCamelCaseBinding } = b { } + //~^ ERROR variable `anotherLowerCamelCaseBinding` should have a snake case name + + if let Foo::Bad { lowerCamelCaseName: yetAnotherLowerCamelCaseBinding } = b { } + //~^ ERROR variable `yetAnotherLowerCamelCaseBinding` should have a snake case name +} diff --git a/src/test/ui/lint/issue-66362-no-snake-case-warning-for-field-puns.stderr b/src/test/ui/lint/issue-66362-no-snake-case-warning-for-field-puns.stderr new file mode 100644 index 0000000000000..68956f21e8f1b --- /dev/null +++ b/src/test/ui/lint/issue-66362-no-snake-case-warning-for-field-puns.stderr @@ -0,0 +1,32 @@ +error: structure field `lowerCamelCaseName` should have a snake case name + --> $DIR/issue-66362-no-snake-case-warning-for-field-puns.rs:7:9 + | +LL | lowerCamelCaseName: bool, + | ^^^^^^^^^^^^^^^^^^ help: convert the identifier to snake case: `lower_camel_case_name` + | +note: lint level defined here + --> $DIR/issue-66362-no-snake-case-warning-for-field-puns.rs:1:9 + | +LL | #![deny(non_snake_case)] + | ^^^^^^^^^^^^^^ + +error: variable `lowerCamelCaseBinding` should have a snake case name + --> $DIR/issue-66362-no-snake-case-warning-for-field-puns.rs:20:38 + | +LL | Foo::Good { snake_case_name: lowerCamelCaseBinding } => { } + | ^^^^^^^^^^^^^^^^^^^^^ help: convert the identifier to snake case: `lower_camel_case_binding` + +error: variable `anotherLowerCamelCaseBinding` should have a snake case name + --> $DIR/issue-66362-no-snake-case-warning-for-field-puns.rs:24:41 + | +LL | if let Foo::Good { snake_case_name: anotherLowerCamelCaseBinding } = b { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert the identifier to snake case: `another_lower_camel_case_binding` + +error: variable `yetAnotherLowerCamelCaseBinding` should have a snake case name + --> $DIR/issue-66362-no-snake-case-warning-for-field-puns.rs:27:43 + | +LL | if let Foo::Bad { lowerCamelCaseName: yetAnotherLowerCamelCaseBinding } = b { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert the identifier to snake case: `yet_another_lower_camel_case_binding` + +error: aborting due to 4 previous errors + diff --git a/src/test/ui/moves/move-out-of-array-ref.rs b/src/test/ui/moves/move-out-of-array-ref.rs index 4ca60ddfec27c..343f00ff29181 100644 --- a/src/test/ui/moves/move-out-of-array-ref.rs +++ b/src/test/ui/moves/move-out-of-array-ref.rs @@ -1,7 +1,5 @@ // Ensure that we cannot move out of a reference to a fixed-size array -#![feature(slice_patterns)] - struct D { _x: u8 } impl Drop for D { fn drop(&mut self) { } } diff --git a/src/test/ui/moves/move-out-of-array-ref.stderr b/src/test/ui/moves/move-out-of-array-ref.stderr index ae3d2f5f2826a..fd682e56ae1de 100644 --- a/src/test/ui/moves/move-out-of-array-ref.stderr +++ b/src/test/ui/moves/move-out-of-array-ref.stderr @@ -1,5 +1,5 @@ error[E0508]: cannot move out of type `[D; 4]`, a non-copy array - --> $DIR/move-out-of-array-ref.rs:10:24 + --> $DIR/move-out-of-array-ref.rs:8:24 | LL | let [_, e, _, _] = *a; | - ^^ @@ -10,7 +10,7 @@ LL | let [_, e, _, _] = *a; | move occurs because `e` has type `D`, which does not implement the `Copy` trait error[E0508]: cannot move out of type `[D; 4]`, a non-copy array - --> $DIR/move-out-of-array-ref.rs:15:27 + --> $DIR/move-out-of-array-ref.rs:13:27 | LL | let [_, s @ .. , _] = *a; | ------ ^^ @@ -21,7 +21,7 @@ LL | let [_, s @ .. , _] = *a; | move occurs because `s` has type `[D; 2]`, which does not implement the `Copy` trait error[E0508]: cannot move out of type `[D; 4]`, a non-copy array - --> $DIR/move-out-of-array-ref.rs:20:24 + --> $DIR/move-out-of-array-ref.rs:18:24 | LL | let [_, e, _, _] = *a; | - ^^ @@ -32,7 +32,7 @@ LL | let [_, e, _, _] = *a; | move occurs because `e` has type `D`, which does not implement the `Copy` trait error[E0508]: cannot move out of type `[D; 4]`, a non-copy array - --> $DIR/move-out-of-array-ref.rs:25:27 + --> $DIR/move-out-of-array-ref.rs:23:27 | LL | let [_, s @ .. , _] = *a; | ------ ^^ diff --git a/src/test/ui/or-patterns/exhaustiveness-non-exhaustive.rs b/src/test/ui/or-patterns/exhaustiveness-non-exhaustive.rs index d7c191bb5a28d..8b0be2e7a66b4 100644 --- a/src/test/ui/or-patterns/exhaustiveness-non-exhaustive.rs +++ b/src/test/ui/or-patterns/exhaustiveness-non-exhaustive.rs @@ -1,5 +1,5 @@ #![feature(or_patterns)] -#![feature(slice_patterns)] + #![allow(incomplete_features)] #![deny(unreachable_patterns)] diff --git a/src/test/ui/or-patterns/exhaustiveness-pass.rs b/src/test/ui/or-patterns/exhaustiveness-pass.rs index ce0fe6fc2a375..f0dc3447f3154 100644 --- a/src/test/ui/or-patterns/exhaustiveness-pass.rs +++ b/src/test/ui/or-patterns/exhaustiveness-pass.rs @@ -1,5 +1,5 @@ #![feature(or_patterns)] -#![feature(slice_patterns)] + #![allow(incomplete_features)] #![deny(unreachable_patterns)] diff --git a/src/test/ui/or-patterns/exhaustiveness-unreachable-pattern.rs b/src/test/ui/or-patterns/exhaustiveness-unreachable-pattern.rs index 860c7a1bde5fb..81bc1176f572e 100644 --- a/src/test/ui/or-patterns/exhaustiveness-unreachable-pattern.rs +++ b/src/test/ui/or-patterns/exhaustiveness-unreachable-pattern.rs @@ -1,5 +1,5 @@ #![feature(or_patterns)] -#![feature(slice_patterns)] + #![allow(incomplete_features)] #![deny(unreachable_patterns)] diff --git a/src/test/ui/parser/match-vec-invalid.stderr b/src/test/ui/parser/match-vec-invalid.stderr deleted file mode 100644 index 58343e86d7b2d..0000000000000 --- a/src/test/ui/parser/match-vec-invalid.stderr +++ /dev/null @@ -1,42 +0,0 @@ -error[E0416]: identifier `tail` is bound more than once in the same pattern - --> $DIR/match-vec-invalid.rs:4:24 - | -LL | [1, tail @ .., tail @ ..] => {}, - | ^^^^ used in a pattern more than once - -error[E0658]: subslice patterns are unstable - --> $DIR/match-vec-invalid.rs:4:13 - | -LL | [1, tail @ .., tail @ ..] => {}, - | ^^^^^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/62254 - = help: add `#![feature(slice_patterns)]` to the crate attributes to enable - -error[E0658]: subslice patterns are unstable - --> $DIR/match-vec-invalid.rs:4:24 - | -LL | [1, tail @ .., tail @ ..] => {}, - | ^^^^^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/62254 - = help: add `#![feature(slice_patterns)]` to the crate attributes to enable - -error: `..` can only be used once per slice pattern - --> $DIR/match-vec-invalid.rs:4:31 - | -LL | [1, tail @ .., tail @ ..] => {}, - | -- ^^ can only be used once per slice pattern - | | - | previously used here - -error[E0308]: mismatched types - --> $DIR/match-vec-invalid.rs:13:30 - | -LL | const RECOVERY_WITNESS: () = 0; - | ^ expected `()`, found integer - -error: aborting due to 5 previous errors - -Some errors have detailed explanations: E0308, E0416, E0658. -For more information about an error, try `rustc --explain E0308`. diff --git a/src/test/ui/parser/pat-lt-bracket-6.rs b/src/test/ui/parser/pat-lt-bracket-6.rs index f27caa5d78c8e..7becffa9fe2f7 100644 --- a/src/test/ui/parser/pat-lt-bracket-6.rs +++ b/src/test/ui/parser/pat-lt-bracket-6.rs @@ -4,7 +4,6 @@ fn main() { let Test(&desc[..]) = x; //~^ ERROR: expected one of `)`, `,`, `@`, or `|`, found `[` - //~^^ ERROR subslice patterns are unstable } const RECOVERY_WITNESS: () = 0; //~ ERROR mismatched types diff --git a/src/test/ui/parser/pat-lt-bracket-6.stderr b/src/test/ui/parser/pat-lt-bracket-6.stderr index fe9603cb57f1f..035d0dbfe06d6 100644 --- a/src/test/ui/parser/pat-lt-bracket-6.stderr +++ b/src/test/ui/parser/pat-lt-bracket-6.stderr @@ -7,22 +7,12 @@ LL | let Test(&desc[..]) = x; | expected one of `)`, `,`, `@`, or `|` | help: missing `,` -error[E0658]: subslice patterns are unstable - --> $DIR/pat-lt-bracket-6.rs:5:20 - | -LL | let Test(&desc[..]) = x; - | ^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/62254 - = help: add `#![feature(slice_patterns)]` to the crate attributes to enable - error[E0308]: mismatched types - --> $DIR/pat-lt-bracket-6.rs:10:30 + --> $DIR/pat-lt-bracket-6.rs:9:30 | LL | const RECOVERY_WITNESS: () = 0; | ^ expected `()`, found integer -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors -Some errors have detailed explanations: E0308, E0658. -For more information about an error, try `rustc --explain E0308`. +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/pattern/bindings-after-at/borrowck-move-and-move.rs b/src/test/ui/pattern/bindings-after-at/borrowck-move-and-move.rs index 1d9f341c5146a..2cd375da9a56f 100644 --- a/src/test/ui/pattern/bindings-after-at/borrowck-move-and-move.rs +++ b/src/test/ui/pattern/bindings-after-at/borrowck-move-and-move.rs @@ -1,7 +1,6 @@ // Test that moving on both sides of an `@` pattern is not allowed. #![feature(bindings_after_at)] -#![feature(slice_patterns)] fn main() { struct U; // Not copy! diff --git a/src/test/ui/pattern/bindings-after-at/borrowck-move-and-move.stderr b/src/test/ui/pattern/bindings-after-at/borrowck-move-and-move.stderr index f3f8fd655ce0c..12ebcb72af11c 100644 --- a/src/test/ui/pattern/bindings-after-at/borrowck-move-and-move.stderr +++ b/src/test/ui/pattern/bindings-after-at/borrowck-move-and-move.stderr @@ -1,53 +1,53 @@ error[E0007]: cannot bind by-move with sub-bindings - --> $DIR/borrowck-move-and-move.rs:12:9 + --> $DIR/borrowck-move-and-move.rs:11:9 | LL | let a @ b = U; | ^^^^^ binds an already bound by-move value by moving it error[E0007]: cannot bind by-move with sub-bindings - --> $DIR/borrowck-move-and-move.rs:16:9 + --> $DIR/borrowck-move-and-move.rs:15:9 | LL | let a @ (b, c) = (U, U); | ^^^^^^^^^^ binds an already bound by-move value by moving it error[E0007]: cannot bind by-move with sub-bindings - --> $DIR/borrowck-move-and-move.rs:20:9 + --> $DIR/borrowck-move-and-move.rs:19:9 | LL | let a @ (b, c) = (u(), u()); | ^^^^^^^^^^ binds an already bound by-move value by moving it error[E0007]: cannot bind by-move with sub-bindings - --> $DIR/borrowck-move-and-move.rs:25:9 + --> $DIR/borrowck-move-and-move.rs:24:9 | LL | a @ Ok(b) | a @ Err(b) => {} | ^^^^^^^^^ binds an already bound by-move value by moving it error[E0007]: cannot bind by-move with sub-bindings - --> $DIR/borrowck-move-and-move.rs:25:21 + --> $DIR/borrowck-move-and-move.rs:24:21 | LL | a @ Ok(b) | a @ Err(b) => {} | ^^^^^^^^^^ binds an already bound by-move value by moving it error[E0007]: cannot bind by-move with sub-bindings - --> $DIR/borrowck-move-and-move.rs:37:9 + --> $DIR/borrowck-move-and-move.rs:36:9 | LL | xs @ [a, .., b] => {} | ^^^^^^^^^^^^^^^ binds an already bound by-move value by moving it error[E0007]: cannot bind by-move with sub-bindings - --> $DIR/borrowck-move-and-move.rs:43:9 + --> $DIR/borrowck-move-and-move.rs:42:9 | LL | xs @ [_, ys @ .., _] => {} | ^^^^^^^^^^^^^^^^^^^^ binds an already bound by-move value by moving it error[E0007]: cannot bind by-move with sub-bindings - --> $DIR/borrowck-move-and-move.rs:32:12 + --> $DIR/borrowck-move-and-move.rs:31:12 | LL | fn fun(a @ b: U) {} | ^^^^^ binds an already bound by-move value by moving it error[E0382]: use of moved value - --> $DIR/borrowck-move-and-move.rs:12:13 + --> $DIR/borrowck-move-and-move.rs:11:13 | LL | let a @ b = U; | ----^ - move occurs because value has type `main::U`, which does not implement the `Copy` trait @@ -56,7 +56,7 @@ LL | let a @ b = U; | value moved here error[E0382]: use of moved value - --> $DIR/borrowck-move-and-move.rs:16:17 + --> $DIR/borrowck-move-and-move.rs:15:17 | LL | let a @ (b, c) = (U, U); | --------^- ------ move occurs because value has type `(main::U, main::U)`, which does not implement the `Copy` trait @@ -65,7 +65,7 @@ LL | let a @ (b, c) = (U, U); | value moved here error[E0382]: use of moved value - --> $DIR/borrowck-move-and-move.rs:20:17 + --> $DIR/borrowck-move-and-move.rs:19:17 | LL | let a @ (b, c) = (u(), u()); | --------^- ---------- move occurs because value has type `(main::U, main::U)`, which does not implement the `Copy` trait @@ -74,7 +74,7 @@ LL | let a @ (b, c) = (u(), u()); | value moved here error[E0382]: use of moved value - --> $DIR/borrowck-move-and-move.rs:25:16 + --> $DIR/borrowck-move-and-move.rs:24:16 | LL | match Ok(U) { | ----- move occurs because value has type `std::result::Result`, which does not implement the `Copy` trait @@ -85,7 +85,7 @@ LL | a @ Ok(b) | a @ Err(b) => {} | value moved here error[E0382]: use of moved value - --> $DIR/borrowck-move-and-move.rs:25:29 + --> $DIR/borrowck-move-and-move.rs:24:29 | LL | match Ok(U) { | ----- move occurs because value has type `std::result::Result`, which does not implement the `Copy` trait @@ -96,7 +96,7 @@ LL | a @ Ok(b) | a @ Err(b) => {} | value moved here error[E0382]: use of moved value - --> $DIR/borrowck-move-and-move.rs:37:22 + --> $DIR/borrowck-move-and-move.rs:36:22 | LL | match [u(), u(), u(), u()] { | -------------------- move occurs because value has type `[main::U; 4]`, which does not implement the `Copy` trait @@ -107,7 +107,7 @@ LL | xs @ [a, .., b] => {} | value moved here error[E0382]: use of moved value - --> $DIR/borrowck-move-and-move.rs:43:18 + --> $DIR/borrowck-move-and-move.rs:42:18 | LL | match [u(), u(), u(), u()] { | -------------------- move occurs because value has type `[main::U; 4]`, which does not implement the `Copy` trait @@ -118,7 +118,7 @@ LL | xs @ [_, ys @ .., _] => {} | value moved here error[E0382]: use of moved value - --> $DIR/borrowck-move-and-move.rs:32:16 + --> $DIR/borrowck-move-and-move.rs:31:16 | LL | fn fun(a @ b: U) {} | ----^ diff --git a/src/test/ui/pattern/bindings-after-at/borrowck-pat-at-and-box-pass.rs b/src/test/ui/pattern/bindings-after-at/borrowck-pat-at-and-box-pass.rs index afac8d990b474..092bd1133dd62 100644 --- a/src/test/ui/pattern/bindings-after-at/borrowck-pat-at-and-box-pass.rs +++ b/src/test/ui/pattern/bindings-after-at/borrowck-pat-at-and-box-pass.rs @@ -4,7 +4,6 @@ #![feature(bindings_after_at)] #![feature(box_patterns)] -#![feature(slice_patterns)] #[derive(Copy, Clone)] struct C; diff --git a/src/test/ui/pattern/bindings-after-at/borrowck-pat-at-and-box.rs b/src/test/ui/pattern/bindings-after-at/borrowck-pat-at-and-box.rs index fce31409e16c4..3b2f598dc0157 100644 --- a/src/test/ui/pattern/bindings-after-at/borrowck-pat-at-and-box.rs +++ b/src/test/ui/pattern/bindings-after-at/borrowck-pat-at-and-box.rs @@ -2,7 +2,6 @@ #![feature(bindings_after_at)] #![feature(box_patterns)] -#![feature(slice_patterns)] #[derive(Copy, Clone)] struct C; diff --git a/src/test/ui/pattern/bindings-after-at/borrowck-pat-at-and-box.stderr b/src/test/ui/pattern/bindings-after-at/borrowck-pat-at-and-box.stderr index 5772fadd1e741..e96c15b0fa7dd 100644 --- a/src/test/ui/pattern/bindings-after-at/borrowck-pat-at-and-box.stderr +++ b/src/test/ui/pattern/bindings-after-at/borrowck-pat-at-and-box.stderr @@ -1,23 +1,23 @@ error[E0007]: cannot bind by-move with sub-bindings - --> $DIR/borrowck-pat-at-and-box.rs:17:9 + --> $DIR/borrowck-pat-at-and-box.rs:16:9 | LL | let a @ box &b = Box::new(&C); | ^^^^^^^^^^ binds an already bound by-move value by moving it error[E0007]: cannot bind by-move with sub-bindings - --> $DIR/borrowck-pat-at-and-box.rs:21:9 + --> $DIR/borrowck-pat-at-and-box.rs:20:9 | LL | let a @ box b = Box::new(C); | ^^^^^^^^^ binds an already bound by-move value by moving it error[E0007]: cannot bind by-move with sub-bindings - --> $DIR/borrowck-pat-at-and-box.rs:33:25 + --> $DIR/borrowck-pat-at-and-box.rs:32:25 | LL | match Box::new(C) { a @ box b => {} } | ^^^^^^^^^ binds an already bound by-move value by moving it error[E0009]: cannot bind by-move and by-ref in the same pattern - --> $DIR/borrowck-pat-at-and-box.rs:37:21 + --> $DIR/borrowck-pat-at-and-box.rs:36:21 | LL | let ref a @ box b = Box::new(NC); | ------------^ @@ -26,7 +26,7 @@ LL | let ref a @ box b = Box::new(NC); | by-ref pattern here error: cannot borrow `a` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-pat-at-and-box.rs:39:9 + --> $DIR/borrowck-pat-at-and-box.rs:38:9 | LL | let ref a @ box ref mut b = Box::new(nc()); | -----^^^^^^^--------- @@ -35,7 +35,7 @@ LL | let ref a @ box ref mut b = Box::new(nc()); | immutable borrow occurs here error: cannot borrow `a` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-pat-at-and-box.rs:41:9 + --> $DIR/borrowck-pat-at-and-box.rs:40:9 | LL | let ref a @ box ref mut b = Box::new(NC); | -----^^^^^^^--------- @@ -44,7 +44,7 @@ LL | let ref a @ box ref mut b = Box::new(NC); | immutable borrow occurs here error: cannot borrow `a` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-pat-at-and-box.rs:43:9 + --> $DIR/borrowck-pat-at-and-box.rs:42:9 | LL | let ref a @ box ref mut b = Box::new(NC); | -----^^^^^^^--------- @@ -53,7 +53,7 @@ LL | let ref a @ box ref mut b = Box::new(NC); | immutable borrow occurs here error: cannot borrow `a` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-pat-at-and-box.rs:46:9 + --> $DIR/borrowck-pat-at-and-box.rs:45:9 | LL | let ref a @ box ref mut b = Box::new(NC); | -----^^^^^^^--------- @@ -62,7 +62,7 @@ LL | let ref a @ box ref mut b = Box::new(NC); | immutable borrow occurs here error: cannot borrow `a` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-pat-at-and-box.rs:52:9 + --> $DIR/borrowck-pat-at-and-box.rs:51:9 | LL | let ref mut a @ box ref b = Box::new(NC); | ---------^^^^^^^----- @@ -71,7 +71,7 @@ LL | let ref mut a @ box ref b = Box::new(NC); | mutable borrow occurs here error: cannot borrow `a` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-pat-at-and-box.rs:66:9 + --> $DIR/borrowck-pat-at-and-box.rs:65:9 | LL | ref mut a @ box ref b => { | ---------^^^^^^^----- @@ -80,7 +80,7 @@ LL | ref mut a @ box ref b => { | mutable borrow occurs here error[E0009]: cannot bind by-move and by-ref in the same pattern - --> $DIR/borrowck-pat-at-and-box.rs:75:38 + --> $DIR/borrowck-pat-at-and-box.rs:74:38 | LL | box [Ok(a), ref xs @ .., Err(b)] => {} | ----------- ^ by-move pattern here @@ -88,7 +88,7 @@ LL | box [Ok(a), ref xs @ .., Err(b)] => {} | by-ref pattern here error[E0009]: cannot bind by-move and by-ref in the same pattern - --> $DIR/borrowck-pat-at-and-box.rs:81:46 + --> $DIR/borrowck-pat-at-and-box.rs:80:46 | LL | [Ok(box ref a), ref xs @ .., Err(box b), Err(box ref mut c)] => {} | ----- ----------- ^ --------- by-ref pattern here @@ -98,19 +98,19 @@ LL | [Ok(box ref a), ref xs @ .., Err(box b), Err(box ref mut c)] => {} | by-ref pattern here error[E0007]: cannot bind by-move with sub-bindings - --> $DIR/borrowck-pat-at-and-box.rs:25:11 + --> $DIR/borrowck-pat-at-and-box.rs:24:11 | LL | fn f1(a @ box &b: Box<&C>) {} | ^^^^^^^^^^ binds an already bound by-move value by moving it error[E0007]: cannot bind by-move with sub-bindings - --> $DIR/borrowck-pat-at-and-box.rs:29:11 + --> $DIR/borrowck-pat-at-and-box.rs:28:11 | LL | fn f2(a @ box b: Box) {} | ^^^^^^^^^ binds an already bound by-move value by moving it error: cannot borrow `a` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-pat-at-and-box.rs:58:11 + --> $DIR/borrowck-pat-at-and-box.rs:57:11 | LL | fn f5(ref mut a @ box ref b: Box) { | ---------^^^^^^^----- @@ -119,7 +119,7 @@ LL | fn f5(ref mut a @ box ref b: Box) { | mutable borrow occurs here error[E0382]: use of moved value - --> $DIR/borrowck-pat-at-and-box.rs:17:18 + --> $DIR/borrowck-pat-at-and-box.rs:16:18 | LL | let a @ box &b = Box::new(&C); | ---------^ ------------ move occurs because value has type `std::boxed::Box<&C>`, which does not implement the `Copy` trait @@ -128,7 +128,7 @@ LL | let a @ box &b = Box::new(&C); | value moved here error[E0382]: use of moved value - --> $DIR/borrowck-pat-at-and-box.rs:21:17 + --> $DIR/borrowck-pat-at-and-box.rs:20:17 | LL | let a @ box b = Box::new(C); | --------^ ----------- move occurs because value has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -137,7 +137,7 @@ LL | let a @ box b = Box::new(C); | value moved here error[E0382]: use of moved value - --> $DIR/borrowck-pat-at-and-box.rs:33:33 + --> $DIR/borrowck-pat-at-and-box.rs:32:33 | LL | match Box::new(C) { a @ box b => {} } | ----------- --------^ @@ -147,7 +147,7 @@ LL | match Box::new(C) { a @ box b => {} } | move occurs because value has type `std::boxed::Box`, which does not implement the `Copy` trait error[E0502]: cannot borrow `_` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-pat-at-and-box.rs:46:21 + --> $DIR/borrowck-pat-at-and-box.rs:45:21 | LL | let ref a @ box ref mut b = Box::new(NC); | ------------^^^^^^^^^ @@ -159,7 +159,7 @@ LL | drop(a); | - immutable borrow later used here error[E0502]: cannot borrow `_` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-pat-at-and-box.rs:52:25 + --> $DIR/borrowck-pat-at-and-box.rs:51:25 | LL | let ref mut a @ box ref b = Box::new(NC); | ----------------^^^^^ @@ -171,7 +171,7 @@ LL | *a = Box::new(NC); | -- mutable borrow later used here error[E0502]: cannot borrow `_` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-pat-at-and-box.rs:66:25 + --> $DIR/borrowck-pat-at-and-box.rs:65:25 | LL | ref mut a @ box ref b => { | ----------------^^^^^ @@ -183,7 +183,7 @@ LL | *a = Box::new(NC); | -- mutable borrow later used here error[E0382]: use of moved value - --> $DIR/borrowck-pat-at-and-box.rs:25:20 + --> $DIR/borrowck-pat-at-and-box.rs:24:20 | LL | fn f1(a @ box &b: Box<&C>) {} | ---------^ @@ -193,7 +193,7 @@ LL | fn f1(a @ box &b: Box<&C>) {} | move occurs because value has type `std::boxed::Box<&C>`, which does not implement the `Copy` trait error[E0382]: use of moved value - --> $DIR/borrowck-pat-at-and-box.rs:29:19 + --> $DIR/borrowck-pat-at-and-box.rs:28:19 | LL | fn f2(a @ box b: Box) {} | --------^ @@ -203,7 +203,7 @@ LL | fn f2(a @ box b: Box) {} | move occurs because value has type `std::boxed::Box`, which does not implement the `Copy` trait error[E0502]: cannot borrow `_` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-pat-at-and-box.rs:58:27 + --> $DIR/borrowck-pat-at-and-box.rs:57:27 | LL | fn f5(ref mut a @ box ref b: Box) { | ----------------^^^^^ diff --git a/src/test/ui/pattern/bindings-after-at/borrowck-pat-by-copy-bindings-in-at.rs b/src/test/ui/pattern/bindings-after-at/borrowck-pat-by-copy-bindings-in-at.rs index be19e5f2a85ca..c4ce50c8b9a16 100644 --- a/src/test/ui/pattern/bindings-after-at/borrowck-pat-by-copy-bindings-in-at.rs +++ b/src/test/ui/pattern/bindings-after-at/borrowck-pat-by-copy-bindings-in-at.rs @@ -2,7 +2,6 @@ // Test `Copy` bindings in the rhs of `@` patterns. -#![feature(slice_patterns)] #![feature(bindings_after_at)] #[derive(Copy, Clone)] diff --git a/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-both-sides.rs b/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-both-sides.rs index edf9fb3145890..fb243016a1185 100644 --- a/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-both-sides.rs +++ b/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-both-sides.rs @@ -4,7 +4,6 @@ // of an `@` pattern according to NLL borrowck. #![feature(bindings_after_at)] -#![feature(slice_patterns)] fn main() { struct U; // Not copy! diff --git a/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.rs b/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.rs index 559925c282f9a..e8510dfa64999 100644 --- a/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.rs +++ b/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.rs @@ -1,5 +1,4 @@ #![feature(bindings_after_at)] -#![feature(slice_patterns)] enum Option { None, diff --git a/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.stderr b/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.stderr index b5c26a1fa0399..0d7b703f1816b 100644 --- a/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.stderr +++ b/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.stderr @@ -1,5 +1,5 @@ error: cannot borrow `z` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:11:9 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:10:9 | LL | ref mut z @ &mut Some(ref a) => { | ---------^^^^^^^^^^^^^-----^ @@ -8,7 +8,7 @@ LL | ref mut z @ &mut Some(ref a) => { | mutable borrow occurs here error: cannot borrow `a` as mutable more than once at a time - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:32:9 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:31:9 | LL | let ref mut a @ (ref b @ ref mut c) = u(); // sub-in-sub | ---------^^^^-----------------^ @@ -18,7 +18,7 @@ LL | let ref mut a @ (ref b @ ref mut c) = u(); // sub-in-sub | first mutable borrow occurs here error: cannot borrow `b` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:32:22 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:31:22 | LL | let ref mut a @ (ref b @ ref mut c) = u(); // sub-in-sub | -----^^^--------- @@ -27,7 +27,7 @@ LL | let ref mut a @ (ref b @ ref mut c) = u(); // sub-in-sub | immutable borrow occurs here error: cannot borrow `a` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:36:9 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:35:9 | LL | let ref a @ ref mut b = U; | -----^^^--------- @@ -36,7 +36,7 @@ LL | let ref a @ ref mut b = U; | immutable borrow occurs here error: cannot borrow `a` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:38:9 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:37:9 | LL | let ref mut a @ ref b = U; | ---------^^^----- @@ -45,7 +45,7 @@ LL | let ref mut a @ ref b = U; | mutable borrow occurs here error: cannot borrow `a` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:40:9 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:39:9 | LL | let ref a @ (ref mut b, ref mut c) = (U, U); | -----^^^^---------^^---------^ @@ -55,7 +55,7 @@ LL | let ref a @ (ref mut b, ref mut c) = (U, U); | immutable borrow occurs here error: cannot borrow `a` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:42:9 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:41:9 | LL | let ref mut a @ (ref b, ref c) = (U, U); | ---------^^^^-----^^-----^ @@ -65,7 +65,7 @@ LL | let ref mut a @ (ref b, ref c) = (U, U); | mutable borrow occurs here error: cannot borrow `a` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:45:9 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:44:9 | LL | let ref mut a @ ref b = u(); | ---------^^^----- @@ -74,7 +74,7 @@ LL | let ref mut a @ ref b = u(); | mutable borrow occurs here error: cannot borrow `a` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:50:9 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:49:9 | LL | let ref a @ ref mut b = u(); | -----^^^--------- @@ -83,7 +83,7 @@ LL | let ref a @ ref mut b = u(); | immutable borrow occurs here error: cannot borrow `a` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:56:9 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:55:9 | LL | let ref mut a @ ref b = U; | ---------^^^----- @@ -92,7 +92,7 @@ LL | let ref mut a @ ref b = U; | mutable borrow occurs here error: cannot borrow `a` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:60:9 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:59:9 | LL | let ref a @ ref mut b = U; | -----^^^--------- @@ -101,7 +101,7 @@ LL | let ref a @ ref mut b = U; | immutable borrow occurs here error: cannot borrow `a` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:66:9 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:65:9 | LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) => { | ---------^^^^^^-----^ @@ -110,7 +110,7 @@ LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) => { | mutable borrow occurs here error: cannot borrow `a` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:66:33 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:65:33 | LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) => { | ---------^^^^^^^-----^ @@ -119,7 +119,7 @@ LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) => { | mutable borrow occurs here error: cannot borrow `a` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:75:9 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:74:9 | LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) => { | -----^^^^^^---------^ @@ -128,7 +128,7 @@ LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) => { | immutable borrow occurs here error: cannot borrow `a` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:75:33 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:74:33 | LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) => { | -----^^^^^^^---------^ @@ -137,7 +137,7 @@ LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) => { | immutable borrow occurs here error: cannot borrow `a` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:86:9 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:85:9 | LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { *b = U; false } => {} | -----^^^^^^---------^ @@ -146,7 +146,7 @@ LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { *b = U; false } | immutable borrow occurs here error: cannot borrow `a` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:86:33 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:85:33 | LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { *b = U; false } => {} | -----^^^^^^^---------^ @@ -155,7 +155,7 @@ LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { *b = U; false } | immutable borrow occurs here error: cannot borrow `a` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:93:9 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:92:9 | LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { *a = Err(U); false } => {} | ---------^^^^^^-----^ @@ -164,7 +164,7 @@ LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { *a = Err(U); fa | mutable borrow occurs here error: cannot borrow `a` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:93:33 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:92:33 | LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { *a = Err(U); false } => {} | ---------^^^^^^^-----^ @@ -173,7 +173,7 @@ LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { *a = Err(U); fa | mutable borrow occurs here error: cannot borrow `a` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:100:9 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:99:9 | LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { drop(b); false } => {} | -----^^^^^^---------^ @@ -182,7 +182,7 @@ LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { drop(b); false | immutable borrow occurs here error: cannot borrow `a` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:100:33 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:99:33 | LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { drop(b); false } => {} | -----^^^^^^^---------^ @@ -191,7 +191,7 @@ LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { drop(b); false | immutable borrow occurs here error: cannot borrow `a` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:108:9 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:107:9 | LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false } => {} | ---------^^^^^^-----^ @@ -200,7 +200,7 @@ LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false | mutable borrow occurs here error: cannot borrow `a` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:108:33 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:107:33 | LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false } => {} | ---------^^^^^^^-----^ @@ -209,7 +209,7 @@ LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false | mutable borrow occurs here error: cannot borrow `a` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:116:9 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:115:9 | LL | let ref a @ (ref mut b, ref mut c) = (U, U); | -----^^^^---------^^---------^ @@ -219,7 +219,7 @@ LL | let ref a @ (ref mut b, ref mut c) = (U, U); | immutable borrow occurs here error: cannot borrow `a` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:121:9 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:120:9 | LL | let ref a @ (ref mut b, ref mut c) = (U, U); | -----^^^^---------^^---------^ @@ -229,7 +229,7 @@ LL | let ref a @ (ref mut b, ref mut c) = (U, U); | immutable borrow occurs here error: cannot borrow `a` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:128:9 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:127:9 | LL | let ref a @ (ref mut b, ref mut c) = (U, U); | -----^^^^---------^^---------^ @@ -239,7 +239,7 @@ LL | let ref a @ (ref mut b, ref mut c) = (U, U); | immutable borrow occurs here error: cannot borrow `a` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:133:9 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:132:9 | LL | let ref mut a @ (ref b, ref c) = (U, U); | ---------^^^^-----^^-----^ @@ -249,7 +249,7 @@ LL | let ref mut a @ (ref b, ref c) = (U, U); | mutable borrow occurs here error: cannot borrow `a` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:25:11 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:24:11 | LL | fn f1(ref a @ ref mut b: U) {} | -----^^^--------- @@ -258,7 +258,7 @@ LL | fn f1(ref a @ ref mut b: U) {} | immutable borrow occurs here error: cannot borrow `a` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:27:11 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:26:11 | LL | fn f2(ref mut a @ ref b: U) {} | ---------^^^----- @@ -267,7 +267,7 @@ LL | fn f2(ref mut a @ ref b: U) {} | mutable borrow occurs here error: cannot borrow `a` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:29:11 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:28:11 | LL | fn f3(ref a @ [ref b, ref mut mid @ .., ref c]: [U; 4]) {} | -----^^^^^^^^^^^----------------^^^^^^^^ @@ -276,7 +276,7 @@ LL | fn f3(ref a @ [ref b, ref mut mid @ .., ref c]: [U; 4]) {} | immutable borrow occurs here error[E0502]: cannot borrow `_` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:11:31 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:10:31 | LL | ref mut z @ &mut Some(ref a) => { | ----------------------^^^^^- @@ -288,7 +288,7 @@ LL | **z = None; | ---------- mutable borrow later used here error[E0502]: cannot borrow `_` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:45:21 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:44:21 | LL | let ref mut a @ ref b = u(); | ------------^^^^^ @@ -300,7 +300,7 @@ LL | *a = u(); | -------- mutable borrow later used here error[E0502]: cannot borrow `_` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:50:17 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:49:17 | LL | let ref a @ ref mut b = u(); | --------^^^^^^^^^ @@ -312,7 +312,7 @@ LL | drop(a); | - immutable borrow later used here error[E0502]: cannot borrow `_` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:75:20 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:74:20 | LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) => { | -----------^^^^^^^^^- @@ -324,7 +324,7 @@ LL | drop(a); | - immutable borrow later used here error[E0502]: cannot borrow `_` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:75:45 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:74:45 | LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) => { | ------------^^^^^^^^^- @@ -336,7 +336,7 @@ LL | drop(a); | - immutable borrow later used here error[E0594]: cannot assign to `*b`, as it is immutable for the pattern guard - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:86:61 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:85:61 | LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { *b = U; false } => {} | ^^^^^^ cannot assign @@ -344,7 +344,7 @@ LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { *b = U; false } = note: variables bound in patterns are immutable until the end of the pattern guard error[E0594]: cannot assign to `*a`, as it is immutable for the pattern guard - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:93:61 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:92:61 | LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { *a = Err(U); false } => {} | ^^^^^^^^^^^ cannot assign @@ -352,7 +352,7 @@ LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { *a = Err(U); fa = note: variables bound in patterns are immutable until the end of the pattern guard error[E0507]: cannot move out of `b` in pattern guard - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:100:66 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:99:66 | LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { drop(b); false } => {} | ^ move occurs because `b` has type `&mut main::U`, which does not implement the `Copy` trait @@ -360,7 +360,7 @@ LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { drop(b); false = note: variables bound in patterns cannot be moved from until after the end of the pattern guard error[E0507]: cannot move out of `b` in pattern guard - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:100:66 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:99:66 | LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { drop(b); false } => {} | ^ move occurs because `b` has type `&mut main::U`, which does not implement the `Copy` trait @@ -368,7 +368,7 @@ LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { drop(b); false = note: variables bound in patterns cannot be moved from until after the end of the pattern guard error[E0507]: cannot move out of `a` in pattern guard - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:108:66 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:107:66 | LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false } => {} | ^ move occurs because `a` has type `&mut std::result::Result`, which does not implement the `Copy` trait @@ -376,7 +376,7 @@ LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false = note: variables bound in patterns cannot be moved from until after the end of the pattern guard error[E0507]: cannot move out of `a` in pattern guard - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:108:66 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:107:66 | LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false } => {} | ^ move occurs because `a` has type `&mut std::result::Result`, which does not implement the `Copy` trait @@ -384,7 +384,7 @@ LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false = note: variables bound in patterns cannot be moved from until after the end of the pattern guard error[E0502]: cannot borrow `_` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:121:18 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:120:18 | LL | let ref a @ (ref mut b, ref mut c) = (U, U); | ---------^^^^^^^^^------------ @@ -396,7 +396,7 @@ LL | drop(a); | - immutable borrow later used here error[E0502]: cannot borrow `_` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:121:29 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:120:29 | LL | let ref a @ (ref mut b, ref mut c) = (U, U); | --------------------^^^^^^^^^- @@ -408,7 +408,7 @@ LL | drop(a); | - immutable borrow later used here error[E0502]: cannot borrow `_` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:128:18 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:127:18 | LL | let ref a @ (ref mut b, ref mut c) = (U, U); | ---------^^^^^^^^^------------ @@ -420,7 +420,7 @@ LL | drop(a); | - immutable borrow later used here error[E0502]: cannot borrow `_` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:128:29 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:127:29 | LL | let ref a @ (ref mut b, ref mut c) = (U, U); | --------------------^^^^^^^^^- diff --git a/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-twice.rs b/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-twice.rs index 6b8b7545e687d..f425b35630d17 100644 --- a/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-twice.rs +++ b/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-twice.rs @@ -1,7 +1,6 @@ // Test that `ref mut x @ ref mut y` and varieties of that are not allowed. #![feature(bindings_after_at)] -#![feature(slice_patterns)] fn main() { struct U; diff --git a/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-twice.stderr b/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-twice.stderr index 1b5e6c7411703..d07ad140cc23a 100644 --- a/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-twice.stderr +++ b/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-twice.stderr @@ -1,5 +1,5 @@ error: cannot borrow `a` as mutable more than once at a time - --> $DIR/borrowck-pat-ref-mut-twice.rs:25:9 + --> $DIR/borrowck-pat-ref-mut-twice.rs:24:9 | LL | let ref mut a @ ref mut b = U; | ---------^^^--------- @@ -8,7 +8,7 @@ LL | let ref mut a @ ref mut b = U; | first mutable borrow occurs here error: cannot borrow `a` as mutable more than once at a time - --> $DIR/borrowck-pat-ref-mut-twice.rs:29:9 + --> $DIR/borrowck-pat-ref-mut-twice.rs:28:9 | LL | let ref mut a @ ref mut b = U; | ---------^^^--------- @@ -17,7 +17,7 @@ LL | let ref mut a @ ref mut b = U; | first mutable borrow occurs here error: cannot borrow `a` as mutable more than once at a time - --> $DIR/borrowck-pat-ref-mut-twice.rs:32:9 + --> $DIR/borrowck-pat-ref-mut-twice.rs:31:9 | LL | let ref mut a @ ref mut b = U; | ---------^^^--------- @@ -26,7 +26,7 @@ LL | let ref mut a @ ref mut b = U; | first mutable borrow occurs here error: cannot borrow `a` as mutable more than once at a time - --> $DIR/borrowck-pat-ref-mut-twice.rs:35:9 + --> $DIR/borrowck-pat-ref-mut-twice.rs:34:9 | LL | let ref mut a @ ref mut b = U; | ---------^^^--------- @@ -35,7 +35,7 @@ LL | let ref mut a @ ref mut b = U; | first mutable borrow occurs here error: cannot borrow `a` as mutable more than once at a time - --> $DIR/borrowck-pat-ref-mut-twice.rs:39:9 + --> $DIR/borrowck-pat-ref-mut-twice.rs:38:9 | LL | let ref mut a @ ref mut b = U; | ---------^^^--------- @@ -44,7 +44,7 @@ LL | let ref mut a @ ref mut b = U; | first mutable borrow occurs here error: cannot borrow `a` as mutable more than once at a time - --> $DIR/borrowck-pat-ref-mut-twice.rs:43:9 + --> $DIR/borrowck-pat-ref-mut-twice.rs:42:9 | LL | let ref mut a @ ( | ^-------- @@ -66,7 +66,7 @@ LL | | ) = (U, [U, U, U]); | |_____^ error: cannot borrow `a` as mutable more than once at a time - --> $DIR/borrowck-pat-ref-mut-twice.rs:53:9 + --> $DIR/borrowck-pat-ref-mut-twice.rs:52:9 | LL | let ref mut a @ ( | ^-------- @@ -88,31 +88,31 @@ LL | | ) = (u(), [u(), u(), u()]); | |_________^ error[E0007]: cannot bind by-move with sub-bindings - --> $DIR/borrowck-pat-ref-mut-twice.rs:63:9 + --> $DIR/borrowck-pat-ref-mut-twice.rs:62:9 | LL | let a @ (ref mut b, ref mut c) = (U, U); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ binds an already bound by-move value by moving it error[E0007]: cannot bind by-move with sub-bindings - --> $DIR/borrowck-pat-ref-mut-twice.rs:67:9 + --> $DIR/borrowck-pat-ref-mut-twice.rs:66:9 | LL | let a @ (b, [c, d]) = &mut val; // Same as ^-- | ^^^^^^^^^^^^^^^ binds an already bound by-move value by moving it error[E0007]: cannot bind by-move with sub-bindings - --> $DIR/borrowck-pat-ref-mut-twice.rs:71:9 + --> $DIR/borrowck-pat-ref-mut-twice.rs:70:9 | LL | let a @ &mut ref mut b = &mut U; | ^^^^^^^^^^^^^^^^^^ binds an already bound by-move value by moving it error[E0007]: cannot bind by-move with sub-bindings - --> $DIR/borrowck-pat-ref-mut-twice.rs:74:9 + --> $DIR/borrowck-pat-ref-mut-twice.rs:73:9 | LL | let a @ &mut (ref mut b, ref mut c) = &mut (U, U); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ binds an already bound by-move value by moving it error: cannot borrow `a` as mutable more than once at a time - --> $DIR/borrowck-pat-ref-mut-twice.rs:79:9 + --> $DIR/borrowck-pat-ref-mut-twice.rs:78:9 | LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { | ---------^^^^^^---------^ @@ -121,7 +121,7 @@ LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { | first mutable borrow occurs here error: cannot borrow `a` as mutable more than once at a time - --> $DIR/borrowck-pat-ref-mut-twice.rs:79:37 + --> $DIR/borrowck-pat-ref-mut-twice.rs:78:37 | LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { | ---------^^^^^^^---------^ @@ -130,7 +130,7 @@ LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { | first mutable borrow occurs here error: cannot borrow `a` as mutable more than once at a time - --> $DIR/borrowck-pat-ref-mut-twice.rs:85:9 + --> $DIR/borrowck-pat-ref-mut-twice.rs:84:9 | LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { | ---------^^^^^^---------^ @@ -139,7 +139,7 @@ LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { | first mutable borrow occurs here error: cannot borrow `a` as mutable more than once at a time - --> $DIR/borrowck-pat-ref-mut-twice.rs:85:37 + --> $DIR/borrowck-pat-ref-mut-twice.rs:84:37 | LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { | ---------^^^^^^^---------^ @@ -148,7 +148,7 @@ LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { | first mutable borrow occurs here error: cannot borrow `a` as mutable more than once at a time - --> $DIR/borrowck-pat-ref-mut-twice.rs:92:9 + --> $DIR/borrowck-pat-ref-mut-twice.rs:91:9 | LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { | ---------^^^^^^---------^ @@ -157,7 +157,7 @@ LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { | first mutable borrow occurs here error: cannot borrow `a` as mutable more than once at a time - --> $DIR/borrowck-pat-ref-mut-twice.rs:92:37 + --> $DIR/borrowck-pat-ref-mut-twice.rs:91:37 | LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { | ---------^^^^^^^---------^ @@ -166,7 +166,7 @@ LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { | first mutable borrow occurs here error: cannot borrow `a` as mutable more than once at a time - --> $DIR/borrowck-pat-ref-mut-twice.rs:104:9 + --> $DIR/borrowck-pat-ref-mut-twice.rs:103:9 | LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { | ---------^^^^^^---------^ @@ -175,7 +175,7 @@ LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { | first mutable borrow occurs here error: cannot borrow `a` as mutable more than once at a time - --> $DIR/borrowck-pat-ref-mut-twice.rs:104:37 + --> $DIR/borrowck-pat-ref-mut-twice.rs:103:37 | LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { | ---------^^^^^^^---------^ @@ -184,7 +184,7 @@ LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { | first mutable borrow occurs here error: cannot borrow `a` as mutable more than once at a time - --> $DIR/borrowck-pat-ref-mut-twice.rs:11:11 + --> $DIR/borrowck-pat-ref-mut-twice.rs:10:11 | LL | fn f1(ref mut a @ ref mut b: U) {} | ---------^^^--------- @@ -193,7 +193,7 @@ LL | fn f1(ref mut a @ ref mut b: U) {} | first mutable borrow occurs here error: cannot borrow `a` as mutable more than once at a time - --> $DIR/borrowck-pat-ref-mut-twice.rs:13:11 + --> $DIR/borrowck-pat-ref-mut-twice.rs:12:11 | LL | fn f2(ref mut a @ ref mut b: U) {} | ---------^^^--------- @@ -202,7 +202,7 @@ LL | fn f2(ref mut a @ ref mut b: U) {} | first mutable borrow occurs here error: cannot borrow `a` as mutable more than once at a time - --> $DIR/borrowck-pat-ref-mut-twice.rs:16:9 + --> $DIR/borrowck-pat-ref-mut-twice.rs:15:9 | LL | ref mut a @ [ | ^-------- @@ -220,7 +220,7 @@ LL | | ] : [[U; 4]; 5] | |_________^ error[E0499]: cannot borrow `_` as mutable more than once at a time - --> $DIR/borrowck-pat-ref-mut-twice.rs:25:21 + --> $DIR/borrowck-pat-ref-mut-twice.rs:24:21 | LL | let ref mut a @ ref mut b = U; | ------------^^^^^^^^^ @@ -232,7 +232,7 @@ LL | drop(a); | - first borrow later used here error[E0499]: cannot borrow `_` as mutable more than once at a time - --> $DIR/borrowck-pat-ref-mut-twice.rs:35:21 + --> $DIR/borrowck-pat-ref-mut-twice.rs:34:21 | LL | let ref mut a @ ref mut b = U; | ------------^^^^^^^^^ @@ -244,7 +244,7 @@ LL | *a = U; | ------ first borrow later used here error[E0382]: borrow of moved value - --> $DIR/borrowck-pat-ref-mut-twice.rs:63:25 + --> $DIR/borrowck-pat-ref-mut-twice.rs:62:25 | LL | let a @ (ref mut b, ref mut c) = (U, U); | ----------------^^^^^^^^^- ------ move occurs because value has type `(main::U, main::U)`, which does not implement the `Copy` trait @@ -253,7 +253,7 @@ LL | let a @ (ref mut b, ref mut c) = (U, U); | value moved here error[E0382]: borrow of moved value - --> $DIR/borrowck-pat-ref-mut-twice.rs:67:21 + --> $DIR/borrowck-pat-ref-mut-twice.rs:66:21 | LL | let a @ (b, [c, d]) = &mut val; // Same as ^-- | ------------^-- -------- move occurs because value has type `&mut (main::U, [main::U; 2])`, which does not implement the `Copy` trait @@ -262,7 +262,7 @@ LL | let a @ (b, [c, d]) = &mut val; // Same as ^-- | value moved here error[E0382]: borrow of moved value - --> $DIR/borrowck-pat-ref-mut-twice.rs:71:18 + --> $DIR/borrowck-pat-ref-mut-twice.rs:70:18 | LL | let a @ &mut ref mut b = &mut U; | ---------^^^^^^^^^ ------ move occurs because value has type `&mut main::U`, which does not implement the `Copy` trait @@ -271,7 +271,7 @@ LL | let a @ &mut ref mut b = &mut U; | value moved here error[E0382]: borrow of moved value - --> $DIR/borrowck-pat-ref-mut-twice.rs:74:30 + --> $DIR/borrowck-pat-ref-mut-twice.rs:73:30 | LL | let a @ &mut (ref mut b, ref mut c) = &mut (U, U); | ---------------------^^^^^^^^^- ----------- move occurs because value has type `&mut (main::U, main::U)`, which does not implement the `Copy` trait @@ -280,7 +280,7 @@ LL | let a @ &mut (ref mut b, ref mut c) = &mut (U, U); | value moved here error[E0499]: cannot borrow `_` as mutable more than once at a time - --> $DIR/borrowck-pat-ref-mut-twice.rs:92:24 + --> $DIR/borrowck-pat-ref-mut-twice.rs:91:24 | LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { | ---------------^^^^^^^^^- @@ -292,7 +292,7 @@ LL | *a = Err(U); | ----------- first borrow later used here error[E0499]: cannot borrow `_` as mutable more than once at a time - --> $DIR/borrowck-pat-ref-mut-twice.rs:92:53 + --> $DIR/borrowck-pat-ref-mut-twice.rs:91:53 | LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { | ----------------^^^^^^^^^- @@ -304,7 +304,7 @@ LL | *a = Err(U); | ----------- first borrow later used here error[E0499]: cannot borrow `_` as mutable more than once at a time - --> $DIR/borrowck-pat-ref-mut-twice.rs:104:24 + --> $DIR/borrowck-pat-ref-mut-twice.rs:103:24 | LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { | ---------------^^^^^^^^^- @@ -316,7 +316,7 @@ LL | drop(a); | - first borrow later used here error[E0499]: cannot borrow `_` as mutable more than once at a time - --> $DIR/borrowck-pat-ref-mut-twice.rs:104:53 + --> $DIR/borrowck-pat-ref-mut-twice.rs:103:53 | LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { | ----------------^^^^^^^^^- diff --git a/src/test/ui/pattern/issue-53820-slice-pattern-large-array.rs b/src/test/ui/pattern/usefulness/issue-53820-slice-pattern-large-array.rs similarity index 65% rename from src/test/ui/pattern/issue-53820-slice-pattern-large-array.rs rename to src/test/ui/pattern/usefulness/issue-53820-slice-pattern-large-array.rs index c910cded96be4..5b0482de2200e 100644 --- a/src/test/ui/pattern/issue-53820-slice-pattern-large-array.rs +++ b/src/test/ui/pattern/usefulness/issue-53820-slice-pattern-large-array.rs @@ -1,8 +1,6 @@ // check-pass -// This used to cause a stack overflow in the compiler. - -#![feature(slice_patterns)] +// This used to cause a stack overflow during exhaustiveness checking in the compiler. fn main() { const LARGE_SIZE: usize = 1024 * 1024; diff --git a/src/test/ui/pattern/usefulness/65413-constants-and-slices-exhaustiveness.rs b/src/test/ui/pattern/usefulness/issue-65413-constants-and-slices-exhaustiveness.rs similarity index 89% rename from src/test/ui/pattern/usefulness/65413-constants-and-slices-exhaustiveness.rs rename to src/test/ui/pattern/usefulness/issue-65413-constants-and-slices-exhaustiveness.rs index 6c54c938bf110..54dfa889ee35a 100644 --- a/src/test/ui/pattern/usefulness/65413-constants-and-slices-exhaustiveness.rs +++ b/src/test/ui/pattern/usefulness/issue-65413-constants-and-slices-exhaustiveness.rs @@ -1,5 +1,5 @@ // check-pass -#![feature(slice_patterns)] + #![deny(unreachable_patterns)] const C0: &'static [u8] = b"\x00"; diff --git a/src/test/ui/pattern/usefulness/match-byte-array-patterns.rs b/src/test/ui/pattern/usefulness/match-byte-array-patterns.rs index 7541ea3e2e263..9b6c8bd5556be 100644 --- a/src/test/ui/pattern/usefulness/match-byte-array-patterns.rs +++ b/src/test/ui/pattern/usefulness/match-byte-array-patterns.rs @@ -1,4 +1,3 @@ -#![feature(slice_patterns)] #![deny(unreachable_patterns)] fn main() { diff --git a/src/test/ui/pattern/usefulness/match-byte-array-patterns.stderr b/src/test/ui/pattern/usefulness/match-byte-array-patterns.stderr index b28646b50cf01..09484692fab08 100644 --- a/src/test/ui/pattern/usefulness/match-byte-array-patterns.stderr +++ b/src/test/ui/pattern/usefulness/match-byte-array-patterns.stderr @@ -1,53 +1,53 @@ error: unreachable pattern - --> $DIR/match-byte-array-patterns.rs:9:9 + --> $DIR/match-byte-array-patterns.rs:8:9 | LL | &[0x41, 0x41, 0x41, 0x41] => {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/match-byte-array-patterns.rs:2:9 + --> $DIR/match-byte-array-patterns.rs:1:9 | LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ error: unreachable pattern - --> $DIR/match-byte-array-patterns.rs:15:9 + --> $DIR/match-byte-array-patterns.rs:14:9 | LL | b"AAAA" => {}, | ^^^^^^^ error: unreachable pattern - --> $DIR/match-byte-array-patterns.rs:21:9 + --> $DIR/match-byte-array-patterns.rs:20:9 | LL | b"AAAA" => {}, | ^^^^^^^ error: unreachable pattern - --> $DIR/match-byte-array-patterns.rs:27:9 + --> $DIR/match-byte-array-patterns.rs:26:9 | LL | b"AAAA" => {}, | ^^^^^^^ error: unreachable pattern - --> $DIR/match-byte-array-patterns.rs:35:9 + --> $DIR/match-byte-array-patterns.rs:34:9 | LL | &[0x41, 0x41, 0x41, 0x41] => {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: unreachable pattern - --> $DIR/match-byte-array-patterns.rs:41:9 + --> $DIR/match-byte-array-patterns.rs:40:9 | LL | b"AAAA" => {}, | ^^^^^^^ error: unreachable pattern - --> $DIR/match-byte-array-patterns.rs:47:9 + --> $DIR/match-byte-array-patterns.rs:46:9 | LL | b"AAAA" => {}, | ^^^^^^^ error: unreachable pattern - --> $DIR/match-byte-array-patterns.rs:53:9 + --> $DIR/match-byte-array-patterns.rs:52:9 | LL | b"AAAA" => {}, | ^^^^^^^ diff --git a/src/test/ui/pattern/usefulness/match-slice-patterns.rs b/src/test/ui/pattern/usefulness/match-slice-patterns.rs index af7fd53a1f1e9..92d74b8c229d6 100644 --- a/src/test/ui/pattern/usefulness/match-slice-patterns.rs +++ b/src/test/ui/pattern/usefulness/match-slice-patterns.rs @@ -1,5 +1,3 @@ -#![feature(slice_patterns)] - fn check(list: &[Option<()>]) { match list { //~^ ERROR `&[_, Some(_), .., None, _]` not covered diff --git a/src/test/ui/pattern/usefulness/match-slice-patterns.stderr b/src/test/ui/pattern/usefulness/match-slice-patterns.stderr index 72ae5d5fe3b33..977a112808190 100644 --- a/src/test/ui/pattern/usefulness/match-slice-patterns.stderr +++ b/src/test/ui/pattern/usefulness/match-slice-patterns.stderr @@ -1,5 +1,5 @@ error[E0004]: non-exhaustive patterns: `&[_, Some(_), .., None, _]` not covered - --> $DIR/match-slice-patterns.rs:4:11 + --> $DIR/match-slice-patterns.rs:2:11 | LL | match list { | ^^^^ pattern `&[_, Some(_), .., None, _]` not covered diff --git a/src/test/ui/pattern/usefulness/match-vec-unreachable.rs b/src/test/ui/pattern/usefulness/match-vec-unreachable.rs index 78810525bad0f..3342389be6e4c 100644 --- a/src/test/ui/pattern/usefulness/match-vec-unreachable.rs +++ b/src/test/ui/pattern/usefulness/match-vec-unreachable.rs @@ -1,4 +1,3 @@ -#![feature(slice_patterns)] #![deny(unreachable_patterns)] fn main() { diff --git a/src/test/ui/pattern/usefulness/match-vec-unreachable.stderr b/src/test/ui/pattern/usefulness/match-vec-unreachable.stderr index 415c24ae77ef5..e9a751074c2e1 100644 --- a/src/test/ui/pattern/usefulness/match-vec-unreachable.stderr +++ b/src/test/ui/pattern/usefulness/match-vec-unreachable.stderr @@ -1,23 +1,23 @@ error: unreachable pattern - --> $DIR/match-vec-unreachable.rs:9:9 + --> $DIR/match-vec-unreachable.rs:8:9 | LL | [(1, 2), (2, 3), b] => (), | ^^^^^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/match-vec-unreachable.rs:2:9 + --> $DIR/match-vec-unreachable.rs:1:9 | LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ error: unreachable pattern - --> $DIR/match-vec-unreachable.rs:19:9 + --> $DIR/match-vec-unreachable.rs:18:9 | LL | [_, _, _, _, _] => { } | ^^^^^^^^^^^^^^^ error: unreachable pattern - --> $DIR/match-vec-unreachable.rs:27:9 + --> $DIR/match-vec-unreachable.rs:26:9 | LL | ['a', 'b', 'c'] => {} | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui/pattern/usefulness/non-exhaustive-match-nested.rs b/src/test/ui/pattern/usefulness/non-exhaustive-match-nested.rs index 9423a2891a620..d198144790be1 100644 --- a/src/test/ui/pattern/usefulness/non-exhaustive-match-nested.rs +++ b/src/test/ui/pattern/usefulness/non-exhaustive-match-nested.rs @@ -1,5 +1,3 @@ -#![feature(slice_patterns)] - enum T { A(U), B } enum U { C, D } diff --git a/src/test/ui/pattern/usefulness/non-exhaustive-match-nested.stderr b/src/test/ui/pattern/usefulness/non-exhaustive-match-nested.stderr index 67c818e19cbda..72b4b522198e0 100644 --- a/src/test/ui/pattern/usefulness/non-exhaustive-match-nested.stderr +++ b/src/test/ui/pattern/usefulness/non-exhaustive-match-nested.stderr @@ -1,5 +1,5 @@ error[E0004]: non-exhaustive patterns: `(Some(&[]), Err(_))` not covered - --> $DIR/non-exhaustive-match-nested.rs:7:11 + --> $DIR/non-exhaustive-match-nested.rs:5:11 | LL | match (l1, l2) { | ^^^^^^^^ pattern `(Some(&[]), Err(_))` not covered @@ -7,7 +7,7 @@ LL | match (l1, l2) { = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `A(C)` not covered - --> $DIR/non-exhaustive-match-nested.rs:17:11 + --> $DIR/non-exhaustive-match-nested.rs:15:11 | LL | enum T { A(U), B } | ------------------ diff --git a/src/test/ui/pattern/usefulness/non-exhaustive-match.rs b/src/test/ui/pattern/usefulness/non-exhaustive-match.rs index bfca5352353a7..9947989dc1211 100644 --- a/src/test/ui/pattern/usefulness/non-exhaustive-match.rs +++ b/src/test/ui/pattern/usefulness/non-exhaustive-match.rs @@ -1,4 +1,3 @@ -#![feature(slice_patterns)] #![allow(illegal_floating_point_literal_pattern)] enum T { A, B } diff --git a/src/test/ui/pattern/usefulness/non-exhaustive-match.stderr b/src/test/ui/pattern/usefulness/non-exhaustive-match.stderr index 577867e4e7122..a06ad5788515c 100644 --- a/src/test/ui/pattern/usefulness/non-exhaustive-match.stderr +++ b/src/test/ui/pattern/usefulness/non-exhaustive-match.stderr @@ -1,5 +1,5 @@ error[E0004]: non-exhaustive patterns: `A` not covered - --> $DIR/non-exhaustive-match.rs:8:11 + --> $DIR/non-exhaustive-match.rs:7:11 | LL | enum T { A, B } | --------------- @@ -13,7 +13,7 @@ LL | match x { T::B => { } } = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `false` not covered - --> $DIR/non-exhaustive-match.rs:9:11 + --> $DIR/non-exhaustive-match.rs:8:11 | LL | match true { | ^^^^ pattern `false` not covered @@ -21,7 +21,7 @@ LL | match true { = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `Some(_)` not covered - --> $DIR/non-exhaustive-match.rs:12:11 + --> $DIR/non-exhaustive-match.rs:11:11 | LL | match Some(10) { | ^^^^^^^^ pattern `Some(_)` not covered @@ -29,7 +29,7 @@ LL | match Some(10) { = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `(_, _, std::i32::MIN..=3i32)` and `(_, _, 5i32..=std::i32::MAX)` not covered - --> $DIR/non-exhaustive-match.rs:15:11 + --> $DIR/non-exhaustive-match.rs:14:11 | LL | match (2, 3, 4) { | ^^^^^^^^^ patterns `(_, _, std::i32::MIN..=3i32)` and `(_, _, 5i32..=std::i32::MAX)` not covered @@ -37,7 +37,7 @@ LL | match (2, 3, 4) { = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `(A, A)` not covered - --> $DIR/non-exhaustive-match.rs:19:11 + --> $DIR/non-exhaustive-match.rs:18:11 | LL | match (T::A, T::A) { | ^^^^^^^^^^^^ pattern `(A, A)` not covered @@ -45,7 +45,7 @@ LL | match (T::A, T::A) { = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `B` not covered - --> $DIR/non-exhaustive-match.rs:23:11 + --> $DIR/non-exhaustive-match.rs:22:11 | LL | enum T { A, B } | --------------- @@ -59,7 +59,7 @@ LL | match T::A { = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `[]` not covered - --> $DIR/non-exhaustive-match.rs:34:11 + --> $DIR/non-exhaustive-match.rs:33:11 | LL | match *vec { | ^^^^ pattern `[]` not covered @@ -67,7 +67,7 @@ LL | match *vec { = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `[_, _, _, _, ..]` not covered - --> $DIR/non-exhaustive-match.rs:47:11 + --> $DIR/non-exhaustive-match.rs:46:11 | LL | match *vec { | ^^^^ pattern `[_, _, _, _, ..]` not covered diff --git a/src/test/ui/pattern/usefulness/non-exhaustive-pattern-witness.rs b/src/test/ui/pattern/usefulness/non-exhaustive-pattern-witness.rs index 4ca1cbcebccf5..abb4ea8daf57b 100644 --- a/src/test/ui/pattern/usefulness/non-exhaustive-pattern-witness.rs +++ b/src/test/ui/pattern/usefulness/non-exhaustive-pattern-witness.rs @@ -1,5 +1,3 @@ -#![feature(slice_patterns)] - struct Foo { first: bool, second: Option<[usize; 4]> diff --git a/src/test/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr b/src/test/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr index a0b497dd4c0ba..2a9fa07d22fe7 100644 --- a/src/test/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr +++ b/src/test/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr @@ -1,5 +1,5 @@ error[E0004]: non-exhaustive patterns: `Foo { first: false, second: Some([_, _, _, _]) }` not covered - --> $DIR/non-exhaustive-pattern-witness.rs:9:11 + --> $DIR/non-exhaustive-pattern-witness.rs:7:11 | LL | / struct Foo { LL | | first: bool, @@ -13,7 +13,7 @@ LL | match (Foo { first: true, second: None }) { = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `Red` not covered - --> $DIR/non-exhaustive-pattern-witness.rs:25:11 + --> $DIR/non-exhaustive-pattern-witness.rs:23:11 | LL | / enum Color { LL | | Red, @@ -29,7 +29,7 @@ LL | match Color::Red { = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `East`, `South` and `West` not covered - --> $DIR/non-exhaustive-pattern-witness.rs:37:11 + --> $DIR/non-exhaustive-pattern-witness.rs:35:11 | LL | / enum Direction { LL | | North, East, South, West @@ -46,7 +46,7 @@ LL | match Direction::North { = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `Second`, `Third`, `Fourth` and 8 more not covered - --> $DIR/non-exhaustive-pattern-witness.rs:48:11 + --> $DIR/non-exhaustive-pattern-witness.rs:46:11 | LL | / enum ExcessiveEnum { LL | | First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth, Tenth, Eleventh, Twelfth @@ -59,7 +59,7 @@ LL | match ExcessiveEnum::First { = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `CustomRGBA { a: true, .. }` not covered - --> $DIR/non-exhaustive-pattern-witness.rs:56:11 + --> $DIR/non-exhaustive-pattern-witness.rs:54:11 | LL | / enum Color { LL | | Red, @@ -75,7 +75,7 @@ LL | match Color::Red { = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `[Second(true), Second(false)]` not covered - --> $DIR/non-exhaustive-pattern-witness.rs:72:11 + --> $DIR/non-exhaustive-pattern-witness.rs:70:11 | LL | match *x { | ^^ pattern `[Second(true), Second(false)]` not covered @@ -83,7 +83,7 @@ LL | match *x { = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `((), false)` not covered - --> $DIR/non-exhaustive-pattern-witness.rs:85:11 + --> $DIR/non-exhaustive-pattern-witness.rs:83:11 | LL | match ((), false) { | ^^^^^^^^^^^ pattern `((), false)` not covered diff --git a/src/test/ui/pattern/usefulness/slice-patterns-exhaustiveness.rs b/src/test/ui/pattern/usefulness/slice-patterns-exhaustiveness.rs index 41ba2cc4501c0..52d1320dad153 100644 --- a/src/test/ui/pattern/usefulness/slice-patterns-exhaustiveness.rs +++ b/src/test/ui/pattern/usefulness/slice-patterns-exhaustiveness.rs @@ -1,5 +1,3 @@ -#![feature(slice_patterns)] - fn main() { let s: &[bool] = &[true; 0]; let s1: &[bool; 1] = &[false; 1]; diff --git a/src/test/ui/pattern/usefulness/slice-patterns-exhaustiveness.stderr b/src/test/ui/pattern/usefulness/slice-patterns-exhaustiveness.stderr index 8cb342f33dfa0..b3701efef3de2 100644 --- a/src/test/ui/pattern/usefulness/slice-patterns-exhaustiveness.stderr +++ b/src/test/ui/pattern/usefulness/slice-patterns-exhaustiveness.stderr @@ -1,5 +1,5 @@ error[E0004]: non-exhaustive patterns: `&[false, _]` not covered - --> $DIR/slice-patterns-exhaustiveness.rs:10:11 + --> $DIR/slice-patterns-exhaustiveness.rs:8:11 | LL | match s2 { | ^^ pattern `&[false, _]` not covered @@ -7,7 +7,7 @@ LL | match s2 { = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `&[false, ..]` not covered - --> $DIR/slice-patterns-exhaustiveness.rs:14:11 + --> $DIR/slice-patterns-exhaustiveness.rs:12:11 | LL | match s3 { | ^^ pattern `&[false, ..]` not covered @@ -15,7 +15,7 @@ LL | match s3 { = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `&[false, ..]` not covered - --> $DIR/slice-patterns-exhaustiveness.rs:18:11 + --> $DIR/slice-patterns-exhaustiveness.rs:16:11 | LL | match s10 { | ^^^ pattern `&[false, ..]` not covered @@ -23,7 +23,7 @@ LL | match s10 { = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `&[false, true]` not covered - --> $DIR/slice-patterns-exhaustiveness.rs:27:11 + --> $DIR/slice-patterns-exhaustiveness.rs:25:11 | LL | match s2 { | ^^ pattern `&[false, true]` not covered @@ -31,7 +31,7 @@ LL | match s2 { = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `&[false, .., true]` not covered - --> $DIR/slice-patterns-exhaustiveness.rs:32:11 + --> $DIR/slice-patterns-exhaustiveness.rs:30:11 | LL | match s3 { | ^^ pattern `&[false, .., true]` not covered @@ -39,7 +39,7 @@ LL | match s3 { = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `&[false, .., true]` not covered - --> $DIR/slice-patterns-exhaustiveness.rs:37:11 + --> $DIR/slice-patterns-exhaustiveness.rs:35:11 | LL | match s { | ^ pattern `&[false, .., true]` not covered @@ -47,7 +47,7 @@ LL | match s { = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `&[_, ..]` not covered - --> $DIR/slice-patterns-exhaustiveness.rs:44:11 + --> $DIR/slice-patterns-exhaustiveness.rs:42:11 | LL | match s { | ^ pattern `&[_, ..]` not covered @@ -55,7 +55,7 @@ LL | match s { = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `&[_, _, ..]` not covered - --> $DIR/slice-patterns-exhaustiveness.rs:48:11 + --> $DIR/slice-patterns-exhaustiveness.rs:46:11 | LL | match s { | ^ pattern `&[_, _, ..]` not covered @@ -63,7 +63,7 @@ LL | match s { = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `&[false, ..]` not covered - --> $DIR/slice-patterns-exhaustiveness.rs:53:11 + --> $DIR/slice-patterns-exhaustiveness.rs:51:11 | LL | match s { | ^ pattern `&[false, ..]` not covered @@ -71,7 +71,7 @@ LL | match s { = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `&[false, _, ..]` not covered - --> $DIR/slice-patterns-exhaustiveness.rs:58:11 + --> $DIR/slice-patterns-exhaustiveness.rs:56:11 | LL | match s { | ^ pattern `&[false, _, ..]` not covered @@ -79,7 +79,7 @@ LL | match s { = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `&[_, .., false]` not covered - --> $DIR/slice-patterns-exhaustiveness.rs:64:11 + --> $DIR/slice-patterns-exhaustiveness.rs:62:11 | LL | match s { | ^ pattern `&[_, .., false]` not covered @@ -87,7 +87,7 @@ LL | match s { = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `&[_, _, .., true]` not covered - --> $DIR/slice-patterns-exhaustiveness.rs:71:11 + --> $DIR/slice-patterns-exhaustiveness.rs:69:11 | LL | match s { | ^ pattern `&[_, _, .., true]` not covered @@ -95,7 +95,7 @@ LL | match s { = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `&[true, _, .., _]` not covered - --> $DIR/slice-patterns-exhaustiveness.rs:78:11 + --> $DIR/slice-patterns-exhaustiveness.rs:76:11 | LL | match s { | ^ pattern `&[true, _, .., _]` not covered @@ -103,7 +103,7 @@ LL | match s { = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `&[..]` not covered - --> $DIR/slice-patterns-exhaustiveness.rs:87:11 + --> $DIR/slice-patterns-exhaustiveness.rs:85:11 | LL | match s { | ^ pattern `&[..]` not covered @@ -111,7 +111,7 @@ LL | match s { = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `&[true]` not covered - --> $DIR/slice-patterns-exhaustiveness.rs:91:11 + --> $DIR/slice-patterns-exhaustiveness.rs:89:11 | LL | match s { | ^ pattern `&[true]` not covered @@ -119,7 +119,7 @@ LL | match s { = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `&[false]` not covered - --> $DIR/slice-patterns-exhaustiveness.rs:99:11 + --> $DIR/slice-patterns-exhaustiveness.rs:97:11 | LL | match s1 { | ^^ pattern `&[false]` not covered diff --git a/src/test/ui/pattern/usefulness/slice-patterns-irrefutable.rs b/src/test/ui/pattern/usefulness/slice-patterns-irrefutable.rs index 3b716bae77209..cbf64e2c53d02 100644 --- a/src/test/ui/pattern/usefulness/slice-patterns-irrefutable.rs +++ b/src/test/ui/pattern/usefulness/slice-patterns-irrefutable.rs @@ -1,5 +1,4 @@ // check-pass -#![feature(slice_patterns)] fn main() { let s: &[bool] = &[true; 0]; diff --git a/src/test/ui/pattern/usefulness/slice-patterns-reachability.rs b/src/test/ui/pattern/usefulness/slice-patterns-reachability.rs index cd229a0fcbee4..7c747b5e0b9d3 100644 --- a/src/test/ui/pattern/usefulness/slice-patterns-reachability.rs +++ b/src/test/ui/pattern/usefulness/slice-patterns-reachability.rs @@ -1,4 +1,3 @@ -#![feature(slice_patterns)] #![deny(unreachable_patterns)] fn main() { diff --git a/src/test/ui/pattern/usefulness/slice-patterns-reachability.stderr b/src/test/ui/pattern/usefulness/slice-patterns-reachability.stderr index 333ce170283ea..e24d10281170d 100644 --- a/src/test/ui/pattern/usefulness/slice-patterns-reachability.stderr +++ b/src/test/ui/pattern/usefulness/slice-patterns-reachability.stderr @@ -1,41 +1,41 @@ error: unreachable pattern - --> $DIR/slice-patterns-reachability.rs:9:9 + --> $DIR/slice-patterns-reachability.rs:8:9 | LL | [true, ..] => {} | ^^^^^^^^^^ | note: lint level defined here - --> $DIR/slice-patterns-reachability.rs:2:9 + --> $DIR/slice-patterns-reachability.rs:1:9 | LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ error: unreachable pattern - --> $DIR/slice-patterns-reachability.rs:10:9 + --> $DIR/slice-patterns-reachability.rs:9:9 | LL | [true] => {} | ^^^^^^ error: unreachable pattern - --> $DIR/slice-patterns-reachability.rs:15:9 + --> $DIR/slice-patterns-reachability.rs:14:9 | LL | [.., true] => {} | ^^^^^^^^^^ error: unreachable pattern - --> $DIR/slice-patterns-reachability.rs:16:9 + --> $DIR/slice-patterns-reachability.rs:15:9 | LL | [true] => {} | ^^^^^^ error: unreachable pattern - --> $DIR/slice-patterns-reachability.rs:21:9 + --> $DIR/slice-patterns-reachability.rs:20:9 | LL | [false, .., true] => {} | ^^^^^^^^^^^^^^^^^ error: unreachable pattern - --> $DIR/slice-patterns-reachability.rs:22:9 + --> $DIR/slice-patterns-reachability.rs:21:9 | LL | [false, true] => {} | ^^^^^^^^^^^^^ 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 1484b8c4a1f13..363a0e3e649d9 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/slice.rs +++ b/src/test/ui/rfc-2005-default-binding-mode/slice.rs @@ -1,5 +1,3 @@ -#![feature(slice_patterns)] - pub fn main() { let sl: &[u8] = b"foo"; 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 f1e91a05f082f..c234fdf46ed2d 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:6:11 + --> $DIR/slice.rs:4:11 | LL | match sl { | ^^ pattern `&[]` not covered diff --git a/src/test/ui/rfcs/rfc-2005-default-binding-mode/slice.rs b/src/test/ui/rfcs/rfc-2005-default-binding-mode/slice.rs index 38b0941aad0a6..33229a205f4d8 100644 --- a/src/test/ui/rfcs/rfc-2005-default-binding-mode/slice.rs +++ b/src/test/ui/rfcs/rfc-2005-default-binding-mode/slice.rs @@ -1,5 +1,4 @@ // run-pass -#![feature(slice_patterns)] fn slice_pat() { let sl: &[u8] = b"foo"; diff --git a/src/test/ui/trailing-comma.rs b/src/test/ui/trailing-comma.rs index 929c35a9e1122..97006ae50a0bf 100644 --- a/src/test/ui/trailing-comma.rs +++ b/src/test/ui/trailing-comma.rs @@ -1,8 +1,6 @@ // run-pass // pretty-expanded FIXME #23616 -#![feature(slice_patterns)] - fn f(_: T,) {} struct Foo(T); diff --git a/src/test/ui/uninhabited/uninhabited-patterns.rs b/src/test/ui/uninhabited/uninhabited-patterns.rs index 1bf01184a08e7..58c726d2185c4 100644 --- a/src/test/ui/uninhabited/uninhabited-patterns.rs +++ b/src/test/ui/uninhabited/uninhabited-patterns.rs @@ -2,7 +2,7 @@ #![feature(box_syntax)] #![feature(never_type)] #![feature(exhaustive_patterns)] -#![feature(slice_patterns)] + #![deny(unreachable_patterns)] mod foo {