diff --git a/compiler/rustc_ast_lowering/src/expr.rs b/compiler/rustc_ast_lowering/src/expr.rs index c9578c2f50f90..40a0b476228f1 100644 --- a/compiler/rustc_ast_lowering/src/expr.rs +++ b/compiler/rustc_ast_lowering/src/expr.rs @@ -9,7 +9,6 @@ use rustc_errors::struct_span_err; use rustc_hir as hir; use rustc_hir::def::Res; use rustc_hir::definitions::DefPathData; -use rustc_session::parse::feature_err; use rustc_span::hygiene::ExpnId; use rustc_span::source_map::{respan, DesugaringKind, Span, Spanned}; use rustc_span::symbol::{sym, Ident, Symbol}; @@ -930,24 +929,6 @@ impl<'hir> LoweringContext<'_, 'hir> { self.lower_span(eq_sign_span), ); } - if !self.sess.features_untracked().destructuring_assignment { - let mut err = feature_err( - &self.sess.parse_sess, - sym::destructuring_assignment, - eq_sign_span, - "destructuring assignments are unstable", - ); - err.span_label(lhs.span, "cannot assign to this expression"); - if self.is_in_loop_condition { - err.span_suggestion_verbose( - lhs.span.shrink_to_lo(), - "you might have meant to use pattern destructuring", - "let ".to_string(), - rustc_errors::Applicability::MachineApplicable, - ); - } - err.emit(); - } let mut assignments = vec![]; diff --git a/compiler/rustc_ast_passes/src/feature_gate.rs b/compiler/rustc_ast_passes/src/feature_gate.rs index 1d1539152be02..975874b6b2c41 100644 --- a/compiler/rustc_ast_passes/src/feature_gate.rs +++ b/compiler/rustc_ast_passes/src/feature_gate.rs @@ -724,11 +724,6 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session) { gate_all!(half_open_range_patterns, "half-open range patterns are unstable"); gate_all!(inline_const, "inline-const is experimental"); gate_all!(inline_const_pat, "inline-const in pattern position is experimental"); - if sess.parse_sess.span_diagnostic.err_count() == 0 { - // Errors for `destructuring_assignment` can get quite noisy, especially where `_` is - // involved, so we only emit errors where there are no other parsing errors. - gate_all!(destructuring_assignment, "destructuring assignments are unstable"); - } // All uses of `gate_all!` below this point were added in #65742, // and subsequently disabled (with the non-early gating readded). diff --git a/compiler/rustc_borrowck/src/borrow_set.rs b/compiler/rustc_borrowck/src/borrow_set.rs index 952e18c1e570d..4a9904891ecad 100644 --- a/compiler/rustc_borrowck/src/borrow_set.rs +++ b/compiler/rustc_borrowck/src/borrow_set.rs @@ -84,7 +84,7 @@ pub enum LocalsStateAtExit { } impl LocalsStateAtExit { - fn build( + fn build<'tcx>( locals_are_invalidated_at_exit: bool, body: &Body<'tcx>, move_data: &MoveData<'tcx>, diff --git a/compiler/rustc_borrowck/src/diagnostics/bound_region_errors.rs b/compiler/rustc_borrowck/src/diagnostics/bound_region_errors.rs index 881ebed602946..96326ef2d5a07 100644 --- a/compiler/rustc_borrowck/src/diagnostics/bound_region_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/bound_region_errors.rs @@ -31,7 +31,7 @@ enum UniverseInfoInner<'tcx> { Other, } -impl UniverseInfo<'tcx> { +impl<'tcx> UniverseInfo<'tcx> { crate fn other() -> UniverseInfo<'tcx> { UniverseInfo(UniverseInfoInner::Other) } @@ -191,7 +191,7 @@ struct PredicateQuery<'tcx> { base_universe: ty::UniverseIndex, } -impl TypeOpInfo<'tcx> for PredicateQuery<'tcx> { +impl<'tcx> TypeOpInfo<'tcx> for PredicateQuery<'tcx> { fn fallback_error(&self, tcx: TyCtxt<'tcx>, span: Span) -> DiagnosticBuilder<'tcx> { let mut err = tcx.sess.struct_span_err(span, "higher-ranked lifetime error"); err.note(&format!("could not prove {}", self.canonical_query.value.value.predicate)); @@ -231,7 +231,7 @@ struct NormalizeQuery<'tcx, T> { base_universe: ty::UniverseIndex, } -impl TypeOpInfo<'tcx> for NormalizeQuery<'tcx, T> +impl<'tcx, T> TypeOpInfo<'tcx> for NormalizeQuery<'tcx, T> where T: Copy + fmt::Display + TypeFoldable<'tcx> + 'tcx, { @@ -291,7 +291,7 @@ struct AscribeUserTypeQuery<'tcx> { base_universe: ty::UniverseIndex, } -impl TypeOpInfo<'tcx> for AscribeUserTypeQuery<'tcx> { +impl<'tcx> TypeOpInfo<'tcx> for AscribeUserTypeQuery<'tcx> { fn fallback_error(&self, tcx: TyCtxt<'tcx>, span: Span) -> DiagnosticBuilder<'tcx> { // FIXME: This error message isn't great, but it doesn't show up in the existing UI tests, // and is only the fallback when the nice error fails. Consider improving this some more. diff --git a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs index 98c619cdd291c..ab9ecec9715d9 100644 --- a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs @@ -1598,8 +1598,8 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { location: Location, mpi: MovePathIndex, ) -> (Vec, Vec) { - fn predecessor_locations( - body: &'a mir::Body<'tcx>, + fn predecessor_locations<'a>( + body: &'a mir::Body<'_>, location: Location, ) -> impl Iterator + 'a { if location.statement_index == 0 { diff --git a/compiler/rustc_borrowck/src/diagnostics/mod.rs b/compiler/rustc_borrowck/src/diagnostics/mod.rs index dec1940ace881..46c85dd6d35e1 100644 --- a/compiler/rustc_borrowck/src/diagnostics/mod.rs +++ b/compiler/rustc_borrowck/src/diagnostics/mod.rs @@ -409,7 +409,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { /// Add a note that a type does not implement `Copy` pub(super) fn note_type_does_not_implement_copy( &self, - err: &mut DiagnosticBuilder<'a>, + err: &mut DiagnosticBuilder<'_>, place_desc: &str, ty: Ty<'tcx>, span: Option, @@ -733,7 +733,7 @@ pub(super) enum BorrowedContentSource<'tcx> { OverloadedIndex(Ty<'tcx>), } -impl BorrowedContentSource<'tcx> { +impl<'tcx> BorrowedContentSource<'tcx> { pub(super) fn describe_for_unnamed_place(&self, tcx: TyCtxt<'_>) -> String { match *self { BorrowedContentSource::DerefRawPointer => "a raw pointer".to_string(), diff --git a/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs b/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs index b4821ee36e0a3..0434c1ba59a10 100644 --- a/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs @@ -747,7 +747,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { HirId, ImplItem, ImplItemKind, Item, ItemKind, }; - fn maybe_body_id_of_fn(hir_map: &Map<'tcx>, id: HirId) -> Option { + fn maybe_body_id_of_fn(hir_map: &Map<'_>, id: HirId) -> Option { match hir_map.find(id) { Some(Node::Item(Item { kind: ItemKind::Fn(_, _, body_id), .. })) | Some(Node::ImplItem(ImplItem { kind: ImplItemKind::Fn(_, body_id), .. })) => { @@ -1066,7 +1066,7 @@ fn is_closure_or_generator(ty: Ty<'_>) -> bool { /// LL | s: &'a String /// | ---------- use `&'a mut String` here to make mutable /// ``` -fn annotate_struct_field( +fn annotate_struct_field<'tcx>( tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, field: &mir::Field, diff --git a/compiler/rustc_borrowck/src/lib.rs b/compiler/rustc_borrowck/src/lib.rs index 88fab269109f9..054516f49617c 100644 --- a/compiler/rustc_borrowck/src/lib.rs +++ b/compiler/rustc_borrowck/src/lib.rs @@ -3,7 +3,6 @@ #![feature(bool_to_option)] #![feature(box_patterns)] #![feature(crate_visibility_modifier)] -#![feature(in_band_lifetimes)] #![feature(iter_zip)] #![feature(let_else)] #![feature(min_specialization)] diff --git a/compiler/rustc_borrowck/src/member_constraints.rs b/compiler/rustc_borrowck/src/member_constraints.rs index f22d355e61344..0fe44328fd9f1 100644 --- a/compiler/rustc_borrowck/src/member_constraints.rs +++ b/compiler/rustc_borrowck/src/member_constraints.rs @@ -53,7 +53,7 @@ rustc_index::newtype_index! { } } -impl Default for MemberConstraintSet<'tcx, ty::RegionVid> { +impl Default for MemberConstraintSet<'_, ty::RegionVid> { fn default() -> Self { Self { first_constraints: Default::default(), @@ -97,7 +97,7 @@ impl<'tcx> MemberConstraintSet<'tcx, ty::RegionVid> { } } -impl MemberConstraintSet<'tcx, R1> +impl<'tcx, R1> MemberConstraintSet<'tcx, R1> where R1: Copy + Hash + Eq, { @@ -140,7 +140,7 @@ where } } -impl MemberConstraintSet<'tcx, R> +impl MemberConstraintSet<'_, R> where R: Copy + Hash + Eq, { diff --git a/compiler/rustc_borrowck/src/path_utils.rs b/compiler/rustc_borrowck/src/path_utils.rs index d5d00b467eeed..b2c8dfc82c206 100644 --- a/compiler/rustc_borrowck/src/path_utils.rs +++ b/compiler/rustc_borrowck/src/path_utils.rs @@ -141,7 +141,7 @@ pub(super) fn borrow_of_local_data(place: Place<'_>) -> bool { /// then returns the index of the field being projected. Note that this closure will always /// be `self` in the current MIR, because that is the only time we directly access the fields /// of a closure type. -pub(crate) fn is_upvar_field_projection( +pub(crate) fn is_upvar_field_projection<'tcx>( tcx: TyCtxt<'tcx>, upvars: &[Upvar<'tcx>], place_ref: PlaceRef<'tcx>, diff --git a/compiler/rustc_borrowck/src/type_check/free_region_relations.rs b/compiler/rustc_borrowck/src/type_check/free_region_relations.rs index 8d97c3cbb0b0e..fec6bdf314b1d 100644 --- a/compiler/rustc_borrowck/src/type_check/free_region_relations.rs +++ b/compiler/rustc_borrowck/src/type_check/free_region_relations.rs @@ -58,7 +58,7 @@ crate struct CreateResult<'tcx> { crate normalized_inputs_and_output: NormalizedInputsAndOutput<'tcx>, } -crate fn create( +crate fn create<'tcx>( infcx: &InferCtxt<'_, 'tcx>, param_env: ty::ParamEnv<'tcx>, implicit_region_bound: Option>, @@ -81,7 +81,7 @@ crate fn create( .create() } -impl UniversalRegionRelations<'tcx> { +impl UniversalRegionRelations<'_> { /// Records in the `outlives_relation` (and /// `inverse_outlives_relation`) that `fr_a: fr_b`. Invoked by the /// builder below. @@ -110,7 +110,7 @@ impl UniversalRegionRelations<'tcx> { /// outlives `fr` and (b) is not local. /// /// (*) If there are multiple competing choices, we return all of them. - crate fn non_local_upper_bounds(&'a self, fr: &'a RegionVid) -> Vec<&'a RegionVid> { + crate fn non_local_upper_bounds<'a>(&'a self, fr: &'a RegionVid) -> Vec<&'a RegionVid> { debug!("non_local_upper_bound(fr={:?})", fr); let res = self.non_local_bounds(&self.inverse_outlives, fr); assert!(!res.is_empty(), "can't find an upper bound!?"); @@ -232,7 +232,7 @@ struct UniversalRegionRelationsBuilder<'this, 'tcx> { region_bound_pairs: RegionBoundPairs<'tcx>, } -impl UniversalRegionRelationsBuilder<'cx, 'tcx> { +impl<'tcx> UniversalRegionRelationsBuilder<'_, 'tcx> { crate fn create(mut self) -> CreateResult<'tcx> { let unnormalized_input_output_tys = self .universal_regions diff --git a/compiler/rustc_borrowck/src/type_check/liveness/local_use_map.rs b/compiler/rustc_borrowck/src/type_check/liveness/local_use_map.rs index 8b74abd94c077..dd23683fae8de 100644 --- a/compiler/rustc_borrowck/src/type_check/liveness/local_use_map.rs +++ b/compiler/rustc_borrowck/src/type_check/liveness/local_use_map.rs @@ -152,7 +152,7 @@ impl LocalUseMapBuild<'_> { } } -impl Visitor<'tcx> for LocalUseMapBuild<'_> { +impl Visitor<'_> for LocalUseMapBuild<'_> { fn visit_local(&mut self, &local: &Local, context: PlaceContext, location: Location) { if self.locals_with_use_data[local] { match def_use::categorize(context) { diff --git a/compiler/rustc_borrowck/src/type_check/liveness/mod.rs b/compiler/rustc_borrowck/src/type_check/liveness/mod.rs index 1e712354d6a83..f18fe1f43d4da 100644 --- a/compiler/rustc_borrowck/src/type_check/liveness/mod.rs +++ b/compiler/rustc_borrowck/src/type_check/liveness/mod.rs @@ -74,7 +74,7 @@ pub(super) fn generate<'mir, 'tcx>( // to compute whether a variable `X` is live if that variable contains // some region `R` in its type where `R` is not known to outlive a free // region (i.e., where `R` may be valid for just a subset of the fn body). -fn compute_live_locals( +fn compute_live_locals<'tcx>( tcx: TyCtxt<'tcx>, free_regions: &FxHashSet, body: &Body<'tcx>, @@ -104,7 +104,7 @@ fn compute_live_locals( /// regions. For these regions, we do not need to compute /// liveness, since the outlives constraints will ensure that they /// are live over the whole fn body anyhow. -fn regions_that_outlive_free_regions( +fn regions_that_outlive_free_regions<'tcx>( num_region_vars: usize, universal_regions: &UniversalRegions<'tcx>, constraint_set: &OutlivesConstraintSet<'tcx>, diff --git a/compiler/rustc_borrowck/src/type_check/liveness/polonius.rs b/compiler/rustc_borrowck/src/type_check/liveness/polonius.rs index 79ab8b713f95d..ee067c4872f67 100644 --- a/compiler/rustc_borrowck/src/type_check/liveness/polonius.rs +++ b/compiler/rustc_borrowck/src/type_check/liveness/polonius.rs @@ -53,7 +53,7 @@ impl UseFactsExtractor<'_> { } } -impl Visitor<'tcx> for UseFactsExtractor<'_> { +impl Visitor<'_> for UseFactsExtractor<'_> { fn visit_local(&mut self, &local: &Local, context: PlaceContext, location: Location) { match def_use::categorize(context) { Some(DefUse::Def) => self.insert_def(local, location), @@ -63,7 +63,7 @@ impl Visitor<'tcx> for UseFactsExtractor<'_> { } } - fn visit_place(&mut self, place: &Place<'tcx>, context: PlaceContext, location: Location) { + fn visit_place(&mut self, place: &Place<'_>, context: PlaceContext, location: Location) { self.super_place(place, context, location); match context { PlaceContext::NonMutatingUse(_) => { @@ -82,7 +82,7 @@ impl Visitor<'tcx> for UseFactsExtractor<'_> { } } -pub(super) fn populate_access_facts( +pub(super) fn populate_access_facts<'tcx>( typeck: &mut TypeChecker<'_, 'tcx>, body: &Body<'tcx>, location_table: &LocationTable, @@ -123,7 +123,7 @@ pub(super) fn populate_access_facts( // For every potentially drop()-touched region `region` in `local`'s type // (`kind`), emit a Polonius `use_of_var_derefs_origin(local, origin)` fact. -pub(super) fn add_drop_of_var_derefs_origin( +pub(super) fn add_drop_of_var_derefs_origin<'tcx>( typeck: &mut TypeChecker<'_, 'tcx>, local: Local, kind: &GenericArg<'tcx>, diff --git a/compiler/rustc_borrowck/src/type_check/liveness/trace.rs b/compiler/rustc_borrowck/src/type_check/liveness/trace.rs index 73c284071d5cc..0969b9a508f1d 100644 --- a/compiler/rustc_borrowck/src/type_check/liveness/trace.rs +++ b/compiler/rustc_borrowck/src/type_check/liveness/trace.rs @@ -34,7 +34,7 @@ use crate::{ /// DROP-LIVE set are to the liveness sets for regions found in the /// `dropck_outlives` result of the variable's type (in particular, /// this respects `#[may_dangle]` annotations). -pub(super) fn trace( +pub(super) fn trace<'mir, 'tcx>( typeck: &mut TypeChecker<'_, 'tcx>, body: &Body<'tcx>, elements: &Rc, @@ -119,7 +119,7 @@ struct LivenessResults<'me, 'typeck, 'flow, 'tcx> { stack: Vec, } -impl LivenessResults<'me, 'typeck, 'flow, 'tcx> { +impl<'me, 'typeck, 'flow, 'tcx> LivenessResults<'me, 'typeck, 'flow, 'tcx> { fn new(cx: LivenessContext<'me, 'typeck, 'flow, 'tcx>) -> Self { let num_points = cx.elements.num_points(); LivenessResults { @@ -418,7 +418,7 @@ impl LivenessResults<'me, 'typeck, 'flow, 'tcx> { } } -impl LivenessContext<'_, '_, '_, 'tcx> { +impl<'tcx> LivenessContext<'_, '_, '_, 'tcx> { /// Returns `true` if the local variable (or some part of it) is initialized at the current /// cursor position. Callers should call one of the `seek` methods immediately before to point /// the cursor to the desired location. diff --git a/compiler/rustc_borrowck/src/type_check/mod.rs b/compiler/rustc_borrowck/src/type_check/mod.rs index 195ed13a02705..872a432144704 100644 --- a/compiler/rustc_borrowck/src/type_check/mod.rs +++ b/compiler/rustc_borrowck/src/type_check/mod.rs @@ -945,7 +945,7 @@ crate struct MirTypeckRegionConstraints<'tcx> { crate type_tests: Vec>, } -impl MirTypeckRegionConstraints<'tcx> { +impl<'tcx> MirTypeckRegionConstraints<'tcx> { fn placeholder_region( &mut self, infcx: &InferCtxt<'_, 'tcx>, diff --git a/compiler/rustc_borrowck/src/type_check/relate_tys.rs b/compiler/rustc_borrowck/src/type_check/relate_tys.rs index 415d1abaa8b08..cc3fe0a123c55 100644 --- a/compiler/rustc_borrowck/src/type_check/relate_tys.rs +++ b/compiler/rustc_borrowck/src/type_check/relate_tys.rs @@ -51,7 +51,7 @@ struct NllTypeRelatingDelegate<'me, 'bccx, 'tcx> { universe_info: UniverseInfo<'tcx>, } -impl NllTypeRelatingDelegate<'me, 'bccx, 'tcx> { +impl<'me, 'bccx, 'tcx> NllTypeRelatingDelegate<'me, 'bccx, 'tcx> { fn new( type_checker: &'me mut TypeChecker<'bccx, 'tcx>, locations: Locations, @@ -62,7 +62,7 @@ impl NllTypeRelatingDelegate<'me, 'bccx, 'tcx> { } } -impl TypeRelatingDelegate<'tcx> for NllTypeRelatingDelegate<'_, '_, 'tcx> { +impl<'tcx> TypeRelatingDelegate<'tcx> for NllTypeRelatingDelegate<'_, '_, 'tcx> { fn param_env(&self) -> ty::ParamEnv<'tcx> { self.type_checker.param_env } diff --git a/compiler/rustc_expand/src/lib.rs b/compiler/rustc_expand/src/lib.rs index c721c4b8d7c19..2098bc86328b5 100644 --- a/compiler/rustc_expand/src/lib.rs +++ b/compiler/rustc_expand/src/lib.rs @@ -1,6 +1,6 @@ #![feature(crate_visibility_modifier)] #![feature(decl_macro)] -#![feature(destructuring_assignment)] +#![cfg_attr(bootstrap, feature(destructuring_assignment))] #![feature(if_let_guard)] #![feature(iter_zip)] #![feature(let_else)] diff --git a/compiler/rustc_feature/src/accepted.rs b/compiler/rustc_feature/src/accepted.rs index 87b08dc52643e..32a9d081ed8c5 100644 --- a/compiler/rustc_feature/src/accepted.rs +++ b/compiler/rustc_feature/src/accepted.rs @@ -114,6 +114,8 @@ declare_features! ( (accepted, default_type_params, "1.0.0", None, None), /// Allows `#[deprecated]` attribute. (accepted, deprecated, "1.9.0", Some(29935), None), + /// Allows the use of destructuring assignments. + (accepted, destructuring_assignment, "1.59.0", Some(71126), None), /// Allows `#[doc(alias = "...")]`. (accepted, doc_alias, "1.48.0", Some(50146), None), /// Allows `..` in tuple (struct) patterns. diff --git a/compiler/rustc_feature/src/active.rs b/compiler/rustc_feature/src/active.rs index 22f6559d15fa2..ebd12d6ab4e2d 100644 --- a/compiler/rustc_feature/src/active.rs +++ b/compiler/rustc_feature/src/active.rs @@ -356,8 +356,6 @@ declare_features! ( (active, default_type_parameter_fallback, "1.3.0", Some(27336), None), /// Allows `#[derive(Default)]` and `#[default]` on enums. (active, derive_default_enum, "1.56.0", Some(86985), None), - /// Allows the use of destructuring assignments. - (active, destructuring_assignment, "1.49.0", Some(71126), None), /// Tells rustdoc to automatically generate `#[doc(cfg(...))]`. (active, doc_auto_cfg, "1.58.0", Some(43781), None), /// Allows `#[doc(cfg(...))]`. diff --git a/compiler/rustc_mir_transform/src/reveal_all.rs b/compiler/rustc_mir_transform/src/reveal_all.rs index a717dd3e0cd8a..ee661793a44aa 100644 --- a/compiler/rustc_mir_transform/src/reveal_all.rs +++ b/compiler/rustc_mir_transform/src/reveal_all.rs @@ -36,6 +36,9 @@ impl<'tcx> MutVisitor<'tcx> for RevealAllVisitor<'tcx> { #[inline] fn visit_ty(&mut self, ty: &mut Ty<'tcx>, _: TyContext) { - *ty = self.tcx.normalize_erasing_regions(self.param_env, ty); + // We have to use `try_normalize_erasing_regions` here, since it's + // possible that we visit impossible-to-satisfy where clauses here, + // see #91745 + *ty = self.tcx.try_normalize_erasing_regions(self.param_env, *ty).unwrap_or(ty); } } diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index 0f8c0e1b8cff8..89439665f9a36 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -1265,7 +1265,6 @@ impl<'a> Parser<'a> { } else if self.eat_keyword(kw::Let) { self.parse_let_expr(attrs) } else if self.eat_keyword(kw::Underscore) { - self.sess.gated_spans.gate(sym::destructuring_assignment, self.prev_token.span); Ok(self.mk_expr(self.prev_token.span, ExprKind::Underscore, attrs)) } else if !self.unclosed_delims.is_empty() && self.check(&token::Semi) { // Don't complain about bare semicolons after unclosed braces @@ -2588,7 +2587,6 @@ impl<'a> Parser<'a> { let exp_span = self.prev_token.span; // We permit `.. }` on the left-hand side of a destructuring assignment. if self.check(&token::CloseDelim(close_delim)) { - self.sess.gated_spans.gate(sym::destructuring_assignment, self.prev_token.span); base = ast::StructRest::Rest(self.prev_token.span.shrink_to_hi()); break; } diff --git a/compiler/rustc_passes/src/weak_lang_items.rs b/compiler/rustc_passes/src/weak_lang_items.rs index c6c32e69aab77..61c82f031dd5b 100644 --- a/compiler/rustc_passes/src/weak_lang_items.rs +++ b/compiler/rustc_passes/src/weak_lang_items.rs @@ -67,10 +67,16 @@ fn verify<'tcx>(tcx: TyCtxt<'tcx>, items: &lang_items::LanguageItems) { } else if item == LangItem::Oom { if !tcx.features().default_alloc_error_handler { tcx.sess.err("`#[alloc_error_handler]` function required, but not found"); - tcx.sess.note_without_error("Use `#![feature(default_alloc_error_handler)]` for a default error handler"); + tcx.sess.note_without_error("use `#![feature(default_alloc_error_handler)]` for a default error handler"); } } else { - tcx.sess.err(&format!("language item required, but not found: `{}`", name)); + tcx + .sess + .diagnostic() + .struct_err(&format!("language item required, but not found: `{}`", name)) + .note(&format!("this can occur when a binary crate with `#![no_std]` is compiled for a target where `{}` is defined in the standard library", name)) + .help(&format!("you may be able to compile for a target that doesn't need `{}`, specify a target with `--target` or in `.cargo/config`", name)) + .emit(); } } } diff --git a/compiler/rustc_typeck/src/check/expr.rs b/compiler/rustc_typeck/src/check/expr.rs index 311106474bea0..7e3107cb3c64c 100644 --- a/compiler/rustc_typeck/src/check/expr.rs +++ b/compiler/rustc_typeck/src/check/expr.rs @@ -877,11 +877,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { "let ".to_string(), Applicability::MachineApplicable, ); - if !self.sess().features_untracked().destructuring_assignment { - // We already emit an E0658 with a suggestion for `while let`, this is - // redundant output. - err.delay_as_bug(); - } break; } hir::Node::Item(_) diff --git a/library/alloc/src/collections/binary_heap.rs b/library/alloc/src/collections/binary_heap.rs index 76fbfa9fc59f7..6fc6002d551be 100644 --- a/library/alloc/src/collections/binary_heap.rs +++ b/library/alloc/src/collections/binary_heap.rs @@ -149,6 +149,7 @@ use core::mem::{self, swap, ManuallyDrop}; use core::ops::{Deref, DerefMut}; use core::ptr; +use crate::collections::TryReserveError; use crate::slice; use crate::vec::{self, AsIntoIter, Vec}; @@ -953,6 +954,84 @@ impl BinaryHeap { self.data.reserve(additional); } + /// Tries to reserve the minimum capacity for exactly `additional` + /// elements to be inserted in the given `BinaryHeap`. After calling + /// `try_reserve_exact`, capacity will be greater than or equal to + /// `self.len() + additional` if it returns `Ok(())`. + /// Does nothing if the capacity is already sufficient. + /// + /// Note that the allocator may give the collection more space than it + /// requests. Therefore, capacity can not be relied upon to be precisely + /// minimal. Prefer [`try_reserve`] if future insertions are expected. + /// + /// [`try_reserve`]: BinaryHeap::try_reserve + /// + /// # Errors + /// + /// If the capacity overflows, or the allocator reports a failure, then an error + /// is returned. + /// + /// # Examples + /// + /// ``` + /// #![feature(try_reserve_2)] + /// use std::collections::BinaryHeap; + /// use std::collections::TryReserveError; + /// + /// fn find_max_slow(data: &[u32]) -> Result, TryReserveError> { + /// let mut heap = BinaryHeap::new(); + /// + /// // Pre-reserve the memory, exiting if we can't + /// heap.try_reserve_exact(data.len())?; + /// + /// // Now we know this can't OOM in the middle of our complex work + /// heap.extend(data.iter()); + /// + /// Ok(heap.pop()) + /// } + /// # find_max_slow(&[1, 2, 3]).expect("why is the test harness OOMing on 12 bytes?"); + /// ``` + #[unstable(feature = "try_reserve_2", issue = "91789")] + pub fn try_reserve_exact(&mut self, additional: usize) -> Result<(), TryReserveError> { + self.data.try_reserve_exact(additional) + } + + /// Tries to reserve capacity for at least `additional` more elements to be inserted + /// in the given `BinaryHeap`. The collection may reserve more space to avoid + /// frequent reallocations. After calling `try_reserve`, capacity will be + /// greater than or equal to `self.len() + additional`. Does nothing if + /// capacity is already sufficient. + /// + /// # Errors + /// + /// If the capacity overflows, or the allocator reports a failure, then an error + /// is returned. + /// + /// # Examples + /// + /// ``` + /// #![feature(try_reserve_2)] + /// use std::collections::BinaryHeap; + /// use std::collections::TryReserveError; + /// + /// fn find_max_slow(data: &[u32]) -> Result, TryReserveError> { + /// let mut heap = BinaryHeap::new(); + /// + /// // Pre-reserve the memory, exiting if we can't + /// heap.try_reserve(data.len())?; + /// + /// // Now we know this can't OOM in the middle of our complex work + /// heap.extend(data.iter()); + /// + /// Ok(heap.pop()) + /// } + /// # find_max_slow(&[1, 2, 3]).expect("why is the test harness OOMing on 12 bytes?"); + /// ``` + #[unstable(feature = "try_reserve_2", issue = "91789")] + pub fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError> { + self.data.try_reserve(additional) + } + /// Discards as much additional capacity as possible. /// /// # Examples diff --git a/library/alloc/src/lib.rs b/library/alloc/src/lib.rs index 1bb257acff76a..9215b37b4f6f3 100644 --- a/library/alloc/src/lib.rs +++ b/library/alloc/src/lib.rs @@ -137,7 +137,7 @@ #![feature(cfg_target_has_atomic)] #![feature(const_fn_trait_bound)] #![feature(const_trait_impl)] -#![feature(destructuring_assignment)] +#![cfg_attr(bootstrap, feature(destructuring_assignment))] #![feature(dropck_eyepatch)] #![feature(exclusive_range_pattern)] #![feature(fundamental)] diff --git a/library/core/src/iter/traits/iterator.rs b/library/core/src/iter/traits/iterator.rs index 267fa40679836..9a9a844f41bb4 100644 --- a/library/core/src/iter/traits/iterator.rs +++ b/library/core/src/iter/traits/iterator.rs @@ -3028,7 +3028,8 @@ pub trait Iterator { /// /// Instead of stopping at [`None`], the iterator will instead start again, /// from the beginning. After iterating again, it will start at the - /// beginning again. And again. And again. Forever. + /// beginning again. And again. And again. Forever. Note that in case the + /// original iterator is empty, the resulting iterator will also be empty. /// /// # Examples /// diff --git a/library/core/src/mem/maybe_uninit.rs b/library/core/src/mem/maybe_uninit.rs index 9a29094b52c46..783a4b08ec19f 100644 --- a/library/core/src/mem/maybe_uninit.rs +++ b/library/core/src/mem/maybe_uninit.rs @@ -394,10 +394,11 @@ impl MaybeUninit { /// // This is undefined behavior. ⚠️ /// ``` #[stable(feature = "maybe_uninit", since = "1.36.0")] + #[rustc_const_unstable(feature = "const_maybe_uninit_zeroed", issue = "91850")] #[must_use] #[inline] #[rustc_diagnostic_item = "maybe_uninit_zeroed"] - pub fn zeroed() -> MaybeUninit { + pub const fn zeroed() -> MaybeUninit { let mut u = MaybeUninit::::uninit(); // SAFETY: `u.as_mut_ptr()` points to allocated memory. unsafe { diff --git a/library/core/src/option.rs b/library/core/src/option.rs index 381e2d6eed3f6..015366ed490c7 100644 --- a/library/core/src/option.rs +++ b/library/core/src/option.rs @@ -512,11 +512,11 @@ use crate::{ #[rustc_diagnostic_item = "Option"] #[stable(feature = "rust1", since = "1.0.0")] pub enum Option { - /// No value + /// No value. #[lang = "None"] #[stable(feature = "rust1", since = "1.0.0")] None, - /// Some value `T` + /// Some value of type `T`. #[lang = "Some"] #[stable(feature = "rust1", since = "1.0.0")] Some(#[stable(feature = "rust1", since = "1.0.0")] T), diff --git a/src/test/ui/associated-types/associated-type-destructuring-assignment.rs b/src/test/ui/associated-types/associated-type-destructuring-assignment.rs index fea7c7a383fbe..f038c9ce7ba2b 100644 --- a/src/test/ui/associated-types/associated-type-destructuring-assignment.rs +++ b/src/test/ui/associated-types/associated-type-destructuring-assignment.rs @@ -1,6 +1,5 @@ // check-pass -#![feature(destructuring_assignment)] #![feature(more_qualified_paths)] enum E { V() } diff --git a/src/test/ui/cross/cross-file-errors/main.rs b/src/test/ui/cross/cross-file-errors/main.rs index 1902ab94d4c0d..4219f892debbc 100644 --- a/src/test/ui/cross/cross-file-errors/main.rs +++ b/src/test/ui/cross/cross-file-errors/main.rs @@ -4,5 +4,4 @@ mod underscore; fn main() { underscore!(); //~^ ERROR `_` can only be used on the left-hand side of an assignment - //~| ERROR destructuring assignments are unstable } diff --git a/src/test/ui/cross/cross-file-errors/main.stderr b/src/test/ui/cross/cross-file-errors/main.stderr index 829535f9212eb..293a300ed6103 100644 --- a/src/test/ui/cross/cross-file-errors/main.stderr +++ b/src/test/ui/cross/cross-file-errors/main.stderr @@ -1,18 +1,3 @@ -error[E0658]: destructuring assignments are unstable - --> $DIR/underscore.rs:8:9 - | -LL | _ - | ^ - | - ::: $DIR/main.rs:5:5 - | -LL | underscore!(); - | ------------- in this macro invocation - | - = note: see issue #71126 for more information - = help: add `#![feature(destructuring_assignment)]` to the crate attributes to enable - = note: this error originates in the macro `underscore` (in Nightly builds, run with -Z macro-backtrace for more info) - error: in expressions, `_` can only be used on the left-hand side of an assignment --> $DIR/underscore.rs:8:9 | @@ -26,6 +11,5 @@ LL | underscore!(); | = note: this error originates in the macro `underscore` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to 2 previous errors +error: aborting due to previous error -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/destructuring-assignment/bad-expr-lhs.rs b/src/test/ui/destructuring-assignment/bad-expr-lhs.rs index 39536f12e3bb5..53794783a3c87 100644 --- a/src/test/ui/destructuring-assignment/bad-expr-lhs.rs +++ b/src/test/ui/destructuring-assignment/bad-expr-lhs.rs @@ -1,12 +1,9 @@ fn main() { 1 = 2; //~ ERROR invalid left-hand side of assignment 1 += 2; //~ ERROR invalid left-hand side of assignment - (1, 2) = (3, 4); //~ ERROR destructuring assignments are unstable + (1, 2) = (3, 4); + //~^ ERROR invalid left-hand side of assignment //~| ERROR invalid left-hand side of assignment - //~| ERROR invalid left-hand side of assignment - - let (a, b) = (1, 2); - (a, b) = (3, 4); //~ ERROR destructuring assignments are unstable None = Some(3); //~ ERROR invalid left-hand side of assignment } diff --git a/src/test/ui/destructuring-assignment/bad-expr-lhs.stderr b/src/test/ui/destructuring-assignment/bad-expr-lhs.stderr index d4b2193d09fc2..d298674748053 100644 --- a/src/test/ui/destructuring-assignment/bad-expr-lhs.stderr +++ b/src/test/ui/destructuring-assignment/bad-expr-lhs.stderr @@ -1,25 +1,3 @@ -error[E0658]: destructuring assignments are unstable - --> $DIR/bad-expr-lhs.rs:4:12 - | -LL | (1, 2) = (3, 4); - | ------ ^ - | | - | cannot assign to this expression - | - = note: see issue #71126 for more information - = help: add `#![feature(destructuring_assignment)]` to the crate attributes to enable - -error[E0658]: destructuring assignments are unstable - --> $DIR/bad-expr-lhs.rs:9:12 - | -LL | (a, b) = (3, 4); - | ------ ^ - | | - | cannot assign to this expression - | - = note: see issue #71126 for more information - = help: add `#![feature(destructuring_assignment)]` to the crate attributes to enable - error[E0070]: invalid left-hand side of assignment --> $DIR/bad-expr-lhs.rs:2:7 | @@ -53,14 +31,14 @@ LL | (1, 2) = (3, 4); | cannot assign to this expression error[E0070]: invalid left-hand side of assignment - --> $DIR/bad-expr-lhs.rs:11:10 + --> $DIR/bad-expr-lhs.rs:8:10 | LL | None = Some(3); | ---- ^ | | | cannot assign to this expression -error: aborting due to 7 previous errors +error: aborting due to 5 previous errors -Some errors have detailed explanations: E0067, E0070, E0658. +Some errors have detailed explanations: E0067, E0070. For more information about an error, try `rustc --explain E0067`. diff --git a/src/test/ui/destructuring-assignment/default-match-bindings-forbidden.rs b/src/test/ui/destructuring-assignment/default-match-bindings-forbidden.rs index adecd0ff291f9..ff867c000716e 100644 --- a/src/test/ui/destructuring-assignment/default-match-bindings-forbidden.rs +++ b/src/test/ui/destructuring-assignment/default-match-bindings-forbidden.rs @@ -1,5 +1,3 @@ -#![feature(destructuring_assignment)] - fn main() { let mut x = &0; let mut y = &0; diff --git a/src/test/ui/destructuring-assignment/default-match-bindings-forbidden.stderr b/src/test/ui/destructuring-assignment/default-match-bindings-forbidden.stderr index e6161fdfa2441..3d472bf63094d 100644 --- a/src/test/ui/destructuring-assignment/default-match-bindings-forbidden.stderr +++ b/src/test/ui/destructuring-assignment/default-match-bindings-forbidden.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/default-match-bindings-forbidden.rs:6:5 + --> $DIR/default-match-bindings-forbidden.rs:4:5 | LL | (x, y) = &(1, 2); | ^^^^^^ ------- this expression has type `&({integer}, {integer})` diff --git a/src/test/ui/destructuring-assignment/drop-order.rs b/src/test/ui/destructuring-assignment/drop-order.rs index d06b31c7f2702..79671054ca76c 100644 --- a/src/test/ui/destructuring-assignment/drop-order.rs +++ b/src/test/ui/destructuring-assignment/drop-order.rs @@ -2,7 +2,6 @@ //! Test that let bindings and destructuring assignments have consistent drop orders -#![feature(destructuring_assignment)] #![allow(unused_variables, unused_assignments)] use std::cell::RefCell; diff --git a/src/test/ui/destructuring-assignment/nested_destructure.rs b/src/test/ui/destructuring-assignment/nested_destructure.rs index 0d45ff7da7249..94b3a5ff9a7ed 100644 --- a/src/test/ui/destructuring-assignment/nested_destructure.rs +++ b/src/test/ui/destructuring-assignment/nested_destructure.rs @@ -1,7 +1,5 @@ // run-pass -#![feature(destructuring_assignment)] - struct Struct { a: S, b: T, diff --git a/src/test/ui/destructuring-assignment/note-unsupported.rs b/src/test/ui/destructuring-assignment/note-unsupported.rs index 249fba7f920bc..c69edd42170e1 100644 --- a/src/test/ui/destructuring-assignment/note-unsupported.rs +++ b/src/test/ui/destructuring-assignment/note-unsupported.rs @@ -3,25 +3,20 @@ struct S { x: u8, y: u8 } fn main() { let (a, b) = (1, 2); - (a, b) = (3, 4); //~ ERROR destructuring assignments are unstable + (a, b) = (3, 4); (a, b) += (3, 4); //~ ERROR invalid left-hand side of assignment //~| ERROR binary assignment operation `+=` cannot be applied - [a, b] = [3, 4]; //~ ERROR destructuring assignments are unstable + [a, b] = [3, 4]; [a, b] += [3, 4]; //~ ERROR invalid left-hand side of assignment //~| ERROR binary assignment operation `+=` cannot be applied let s = S { x: 3, y: 4 }; - S { x: a, y: b } = s; //~ ERROR destructuring assignments are unstable + S { x: a, y: b } = s; S { x: a, y: b } += s; //~ ERROR invalid left-hand side of assignment //~| ERROR binary assignment operation `+=` cannot be applied S { x: a, ..s } = S { x: 3, y: 4 }; //~^ ERROR functional record updates are not allowed in destructuring assignments - //~| ERROR destructuring assignments are unstable - - let c = 3; - - ((a, b), c) = ((3, 4), 5); //~ ERROR destructuring assignments are unstable } diff --git a/src/test/ui/destructuring-assignment/note-unsupported.stderr b/src/test/ui/destructuring-assignment/note-unsupported.stderr index 7b9788ca0fef3..3e2282743bfce 100644 --- a/src/test/ui/destructuring-assignment/note-unsupported.stderr +++ b/src/test/ui/destructuring-assignment/note-unsupported.stderr @@ -1,64 +1,9 @@ -error[E0658]: destructuring assignments are unstable - --> $DIR/note-unsupported.rs:6:12 - | -LL | (a, b) = (3, 4); - | ------ ^ - | | - | cannot assign to this expression - | - = note: see issue #71126 for more information - = help: add `#![feature(destructuring_assignment)]` to the crate attributes to enable - -error[E0658]: destructuring assignments are unstable - --> $DIR/note-unsupported.rs:10:12 - | -LL | [a, b] = [3, 4]; - | ------ ^ - | | - | cannot assign to this expression - | - = note: see issue #71126 for more information - = help: add `#![feature(destructuring_assignment)]` to the crate attributes to enable - -error[E0658]: destructuring assignments are unstable - --> $DIR/note-unsupported.rs:16:22 - | -LL | S { x: a, y: b } = s; - | ---------------- ^ - | | - | cannot assign to this expression - | - = note: see issue #71126 for more information - = help: add `#![feature(destructuring_assignment)]` to the crate attributes to enable - -error[E0658]: destructuring assignments are unstable - --> $DIR/note-unsupported.rs:20:21 - | -LL | S { x: a, ..s } = S { x: 3, y: 4 }; - | --------------- ^ - | | - | cannot assign to this expression - | - = note: see issue #71126 for more information - = help: add `#![feature(destructuring_assignment)]` to the crate attributes to enable - error: functional record updates are not allowed in destructuring assignments --> $DIR/note-unsupported.rs:20:17 | LL | S { x: a, ..s } = S { x: 3, y: 4 }; | ^ help: consider removing the trailing pattern -error[E0658]: destructuring assignments are unstable - --> $DIR/note-unsupported.rs:26:17 - | -LL | ((a, b), c) = ((3, 4), 5); - | ----------- ^ - | | - | cannot assign to this expression - | - = note: see issue #71126 for more information - = help: add `#![feature(destructuring_assignment)]` to the crate attributes to enable - error[E0368]: binary assignment operation `+=` cannot be applied to type `({integer}, {integer})` --> $DIR/note-unsupported.rs:7:5 | @@ -124,7 +69,7 @@ LL | S { x: a, y: b } += s; | | | cannot assign to this expression -error: aborting due to 12 previous errors +error: aborting due to 7 previous errors -Some errors have detailed explanations: E0067, E0368, E0658. +Some errors have detailed explanations: E0067, E0368. For more information about an error, try `rustc --explain E0067`. diff --git a/src/test/ui/destructuring-assignment/slice_destructure.rs b/src/test/ui/destructuring-assignment/slice_destructure.rs index 76cdc1260fcde..762c4b5e8ea4a 100644 --- a/src/test/ui/destructuring-assignment/slice_destructure.rs +++ b/src/test/ui/destructuring-assignment/slice_destructure.rs @@ -1,7 +1,5 @@ // run-pass -#![feature(destructuring_assignment)] - fn main() { let (mut a, mut b); [a, b] = [0, 1]; diff --git a/src/test/ui/destructuring-assignment/slice_destructure_fail.rs b/src/test/ui/destructuring-assignment/slice_destructure_fail.rs index 90d93892f7f22..33b09eb349da0 100644 --- a/src/test/ui/destructuring-assignment/slice_destructure_fail.rs +++ b/src/test/ui/destructuring-assignment/slice_destructure_fail.rs @@ -1,5 +1,3 @@ -#![feature(destructuring_assignment)] - fn main() { let (mut a, mut b); [a, .., b, ..] = [0, 1]; //~ ERROR `..` can only be used once per slice pattern diff --git a/src/test/ui/destructuring-assignment/slice_destructure_fail.stderr b/src/test/ui/destructuring-assignment/slice_destructure_fail.stderr index cc412c72df51d..92c86febac440 100644 --- a/src/test/ui/destructuring-assignment/slice_destructure_fail.stderr +++ b/src/test/ui/destructuring-assignment/slice_destructure_fail.stderr @@ -1,5 +1,5 @@ error: `..` can only be used once per slice pattern - --> $DIR/slice_destructure_fail.rs:5:14 + --> $DIR/slice_destructure_fail.rs:3:14 | LL | [a, .., b, ..] = [0, 1]; | -- ^^ can only be used once per slice pattern @@ -7,13 +7,13 @@ LL | [a, .., b, ..] = [0, 1]; | previously used here error[E0527]: pattern requires 3 elements but array has 2 - --> $DIR/slice_destructure_fail.rs:6:3 + --> $DIR/slice_destructure_fail.rs:4:3 | LL | [a, a, b] = [1, 2]; | ^^^^^^^^^ expected 2 elements error[E0527]: pattern requires 1 element but array has 2 - --> $DIR/slice_destructure_fail.rs:7:3 + --> $DIR/slice_destructure_fail.rs:5:3 | LL | [_] = [1, 2]; | ^^^ expected 2 elements diff --git a/src/test/ui/destructuring-assignment/struct_destructure.rs b/src/test/ui/destructuring-assignment/struct_destructure.rs index 2bcbd9d0d742e..8cceaadd7b929 100644 --- a/src/test/ui/destructuring-assignment/struct_destructure.rs +++ b/src/test/ui/destructuring-assignment/struct_destructure.rs @@ -1,6 +1,5 @@ // run-pass -#![feature(destructuring_assignment)] struct Struct { a: S, b: T, diff --git a/src/test/ui/destructuring-assignment/struct_destructure_fail.rs b/src/test/ui/destructuring-assignment/struct_destructure_fail.rs index 4aa327b61f497..c001fccd4cbfb 100644 --- a/src/test/ui/destructuring-assignment/struct_destructure_fail.rs +++ b/src/test/ui/destructuring-assignment/struct_destructure_fail.rs @@ -1,4 +1,3 @@ -#![feature(destructuring_assignment)] struct Struct { a: S, b: T, diff --git a/src/test/ui/destructuring-assignment/struct_destructure_fail.stderr b/src/test/ui/destructuring-assignment/struct_destructure_fail.stderr index 635bd5e7edf49..ae7b3d1e5a928 100644 --- a/src/test/ui/destructuring-assignment/struct_destructure_fail.stderr +++ b/src/test/ui/destructuring-assignment/struct_destructure_fail.stderr @@ -1,5 +1,5 @@ error: expected identifier, found reserved identifier `_` - --> $DIR/struct_destructure_fail.rs:12:17 + --> $DIR/struct_destructure_fail.rs:11:17 | LL | Struct { a, _ } = Struct { a: 1, b: 2 }; | ------ ^ expected identifier, found reserved identifier @@ -7,25 +7,25 @@ LL | Struct { a, _ } = Struct { a: 1, b: 2 }; | while parsing this struct error: functional record updates are not allowed in destructuring assignments - --> $DIR/struct_destructure_fail.rs:14:19 + --> $DIR/struct_destructure_fail.rs:13:19 | LL | Struct { a, ..d } = Struct { a: 1, b: 2 }; | ^ help: consider removing the trailing pattern error: base expression required after `..` - --> $DIR/struct_destructure_fail.rs:16:19 + --> $DIR/struct_destructure_fail.rs:15:19 | LL | Struct { a, .. }; | ^ add a base expression here error[E0026]: struct `Struct` does not have a field named `c` - --> $DIR/struct_destructure_fail.rs:11:20 + --> $DIR/struct_destructure_fail.rs:10:20 | LL | Struct { a, b, c } = Struct { a: 0, b: 1 }; | ^ struct `Struct` does not have this field error[E0027]: pattern does not mention field `b` - --> $DIR/struct_destructure_fail.rs:12:5 + --> $DIR/struct_destructure_fail.rs:11:5 | LL | Struct { a, _ } = Struct { a: 1, b: 2 }; | ^^^^^^^^^^^^^^^ missing field `b` diff --git a/src/test/ui/destructuring-assignment/tuple_destructure.rs b/src/test/ui/destructuring-assignment/tuple_destructure.rs index 2096182d421cf..2a8584029d0e2 100644 --- a/src/test/ui/destructuring-assignment/tuple_destructure.rs +++ b/src/test/ui/destructuring-assignment/tuple_destructure.rs @@ -1,7 +1,5 @@ // run-pass -#![feature(destructuring_assignment)] - fn main() { let (mut a, mut b); (a, b) = (0, 1); diff --git a/src/test/ui/destructuring-assignment/tuple_destructure_fail.rs b/src/test/ui/destructuring-assignment/tuple_destructure_fail.rs index 5524e91dc401b..4e3172d1973b2 100644 --- a/src/test/ui/destructuring-assignment/tuple_destructure_fail.rs +++ b/src/test/ui/destructuring-assignment/tuple_destructure_fail.rs @@ -1,5 +1,3 @@ -#![feature(destructuring_assignment)] - const C: i32 = 1; fn main() { diff --git a/src/test/ui/destructuring-assignment/tuple_destructure_fail.stderr b/src/test/ui/destructuring-assignment/tuple_destructure_fail.stderr index 1146b88278d49..55b08b74af062 100644 --- a/src/test/ui/destructuring-assignment/tuple_destructure_fail.stderr +++ b/src/test/ui/destructuring-assignment/tuple_destructure_fail.stderr @@ -1,5 +1,5 @@ error: `..` can only be used once per tuple pattern - --> $DIR/tuple_destructure_fail.rs:7:16 + --> $DIR/tuple_destructure_fail.rs:5:16 | LL | (a, .., b, ..) = (0, 1); | -- ^^ can only be used once per tuple pattern @@ -7,7 +7,7 @@ LL | (a, .., b, ..) = (0, 1); | previously used here error[E0308]: mismatched types - --> $DIR/tuple_destructure_fail.rs:8:5 + --> $DIR/tuple_destructure_fail.rs:6:5 | LL | (a, a, b) = (1, 2); | ^^^^^^^^^ ------ this expression has type `({integer}, {integer})` @@ -18,7 +18,7 @@ LL | (a, a, b) = (1, 2); found tuple `(_, _, _)` error[E0070]: invalid left-hand side of assignment - --> $DIR/tuple_destructure_fail.rs:9:13 + --> $DIR/tuple_destructure_fail.rs:7:13 | LL | (C, ..) = (0,1); | - ^ @@ -26,7 +26,7 @@ LL | (C, ..) = (0,1); | cannot assign to this expression error[E0308]: mismatched types - --> $DIR/tuple_destructure_fail.rs:10:5 + --> $DIR/tuple_destructure_fail.rs:8:5 | LL | (_,) = (1, 2); | ^^^^ ------ this expression has type `({integer}, {integer})` diff --git a/src/test/ui/destructuring-assignment/tuple_struct_destructure.rs b/src/test/ui/destructuring-assignment/tuple_struct_destructure.rs index 7b5c5ad2bae26..07b5f7a314e30 100644 --- a/src/test/ui/destructuring-assignment/tuple_struct_destructure.rs +++ b/src/test/ui/destructuring-assignment/tuple_struct_destructure.rs @@ -1,7 +1,5 @@ // run-pass -#![feature(destructuring_assignment)] - struct TupleStruct(S, T); impl TupleStruct { diff --git a/src/test/ui/destructuring-assignment/tuple_struct_destructure_fail.rs b/src/test/ui/destructuring-assignment/tuple_struct_destructure_fail.rs index c39db06117767..845f867d7b81f 100644 --- a/src/test/ui/destructuring-assignment/tuple_struct_destructure_fail.rs +++ b/src/test/ui/destructuring-assignment/tuple_struct_destructure_fail.rs @@ -1,5 +1,3 @@ -#![feature(destructuring_assignment)] - struct TupleStruct(S, T); enum Enum { diff --git a/src/test/ui/destructuring-assignment/tuple_struct_destructure_fail.stderr b/src/test/ui/destructuring-assignment/tuple_struct_destructure_fail.stderr index 9aae4b0a3faed..5cc7acba3f334 100644 --- a/src/test/ui/destructuring-assignment/tuple_struct_destructure_fail.stderr +++ b/src/test/ui/destructuring-assignment/tuple_struct_destructure_fail.stderr @@ -1,5 +1,5 @@ error: `..` can only be used once per tuple struct or variant pattern - --> $DIR/tuple_struct_destructure_fail.rs:25:27 + --> $DIR/tuple_struct_destructure_fail.rs:23:27 | LL | TupleStruct(a, .., b, ..) = TupleStruct(0, 1); | -- ^^ can only be used once per tuple struct or variant pattern @@ -7,7 +7,7 @@ LL | TupleStruct(a, .., b, ..) = TupleStruct(0, 1); | previously used here error: `..` can only be used once per tuple struct or variant pattern - --> $DIR/tuple_struct_destructure_fail.rs:27:35 + --> $DIR/tuple_struct_destructure_fail.rs:25:35 | LL | Enum::SingleVariant(a, .., b, ..) = Enum::SingleVariant(0, 1); | -- ^^ can only be used once per tuple struct or variant pattern @@ -15,7 +15,7 @@ LL | Enum::SingleVariant(a, .., b, ..) = Enum::SingleVariant(0, 1); | previously used here error[E0023]: this pattern has 3 fields, but the corresponding tuple struct has 2 fields - --> $DIR/tuple_struct_destructure_fail.rs:30:17 + --> $DIR/tuple_struct_destructure_fail.rs:28:17 | LL | struct TupleStruct(S, T); | - - tuple struct has 2 fields @@ -24,7 +24,7 @@ LL | TupleStruct(a, a, b) = TupleStruct(1, 2); | ^ ^ ^ expected 2 fields, found 3 error[E0023]: this pattern has 1 field, but the corresponding tuple struct has 2 fields - --> $DIR/tuple_struct_destructure_fail.rs:32:17 + --> $DIR/tuple_struct_destructure_fail.rs:30:17 | LL | struct TupleStruct(S, T); | - - tuple struct has 2 fields @@ -42,7 +42,7 @@ LL | TupleStruct(..) = TupleStruct(1, 2); | ~~ error[E0023]: this pattern has 3 fields, but the corresponding tuple variant has 2 fields - --> $DIR/tuple_struct_destructure_fail.rs:34:25 + --> $DIR/tuple_struct_destructure_fail.rs:32:25 | LL | SingleVariant(S, T) | - - tuple variant has 2 fields @@ -51,7 +51,7 @@ LL | Enum::SingleVariant(a, a, b) = Enum::SingleVariant(1, 2); | ^ ^ ^ expected 2 fields, found 3 error[E0023]: this pattern has 1 field, but the corresponding tuple variant has 2 fields - --> $DIR/tuple_struct_destructure_fail.rs:36:25 + --> $DIR/tuple_struct_destructure_fail.rs:34:25 | LL | SingleVariant(S, T) | - - tuple variant has 2 fields @@ -69,7 +69,7 @@ LL | Enum::SingleVariant(..) = Enum::SingleVariant(1, 2); | ~~ error[E0070]: invalid left-hand side of assignment - --> $DIR/tuple_struct_destructure_fail.rs:40:12 + --> $DIR/tuple_struct_destructure_fail.rs:38:12 | LL | test() = TupleStruct(0, 0); | ------ ^ @@ -77,7 +77,7 @@ LL | test() = TupleStruct(0, 0); | cannot assign to this expression error[E0070]: invalid left-hand side of assignment - --> $DIR/tuple_struct_destructure_fail.rs:42:14 + --> $DIR/tuple_struct_destructure_fail.rs:40:14 | LL | (test)() = TupleStruct(0, 0); | -------- ^ @@ -85,7 +85,7 @@ LL | (test)() = TupleStruct(0, 0); | cannot assign to this expression error[E0070]: invalid left-hand side of assignment - --> $DIR/tuple_struct_destructure_fail.rs:44:38 + --> $DIR/tuple_struct_destructure_fail.rs:42:38 | LL | as Test>::test() = TupleStruct(0, 0); | -------------------------------- ^ diff --git a/src/test/ui/destructuring-assignment/underscore-range-expr-gating.rs b/src/test/ui/destructuring-assignment/underscore-range-expr-gating.rs deleted file mode 100644 index 4ed4f56702c32..0000000000000 --- a/src/test/ui/destructuring-assignment/underscore-range-expr-gating.rs +++ /dev/null @@ -1,10 +0,0 @@ -fn main() {} - -struct S { x : u32 } - -#[cfg(FALSE)] -fn foo() { - _; //~ ERROR destructuring assignments are unstable - - S { x: 5, .. }; //~ ERROR destructuring assignments are unstable -} diff --git a/src/test/ui/destructuring-assignment/underscore-range-expr-gating.stderr b/src/test/ui/destructuring-assignment/underscore-range-expr-gating.stderr deleted file mode 100644 index a5ed761a01c33..0000000000000 --- a/src/test/ui/destructuring-assignment/underscore-range-expr-gating.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0658]: destructuring assignments are unstable - --> $DIR/underscore-range-expr-gating.rs:7:5 - | -LL | _; - | ^ - | - = note: see issue #71126 for more information - = help: add `#![feature(destructuring_assignment)]` to the crate attributes to enable - -error[E0658]: destructuring assignments are unstable - --> $DIR/underscore-range-expr-gating.rs:9:15 - | -LL | S { x: 5, .. }; - | ^^ - | - = note: see issue #71126 for more information - = help: add `#![feature(destructuring_assignment)]` to the crate attributes to enable - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/destructuring-assignment/warn-unused-duplication.rs b/src/test/ui/destructuring-assignment/warn-unused-duplication.rs index c1c5c2cd3cebb..390f44b8aa514 100644 --- a/src/test/ui/destructuring-assignment/warn-unused-duplication.rs +++ b/src/test/ui/destructuring-assignment/warn-unused-duplication.rs @@ -1,7 +1,5 @@ // run-pass -#![feature(destructuring_assignment)] - #![warn(unused_assignments)] fn main() { diff --git a/src/test/ui/destructuring-assignment/warn-unused-duplication.stderr b/src/test/ui/destructuring-assignment/warn-unused-duplication.stderr index b87ef6f1571c1..1df7a5f224f4f 100644 --- a/src/test/ui/destructuring-assignment/warn-unused-duplication.stderr +++ b/src/test/ui/destructuring-assignment/warn-unused-duplication.stderr @@ -1,11 +1,11 @@ warning: value assigned to `a` is never read - --> $DIR/warn-unused-duplication.rs:11:6 + --> $DIR/warn-unused-duplication.rs:9:6 | LL | (a, a) = (0, 1); | ^ | note: the lint level is defined here - --> $DIR/warn-unused-duplication.rs:5:9 + --> $DIR/warn-unused-duplication.rs:3:9 | LL | #![warn(unused_assignments)] | ^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/extern-flag/empty-extern-arg.stderr b/src/test/ui/extern-flag/empty-extern-arg.stderr index b0628a4f6dd62..39a66c08de098 100644 --- a/src/test/ui/extern-flag/empty-extern-arg.stderr +++ b/src/test/ui/extern-flag/empty-extern-arg.stderr @@ -1,6 +1,9 @@ error: extern location for std does not exist: error: language item required, but not found: `eh_personality` + | + = note: this can occur when a binary crate with `#![no_std]` is compiled for a target where `eh_personality` is defined in the standard library + = help: you may be able to compile for a target that doesn't need `eh_personality`, specify a target with `--target` or in `.cargo/config` error: `#[panic_handler]` function required, but not found diff --git a/src/test/ui/feature-gates/feature-gate-destructuring_assignment.rs b/src/test/ui/feature-gates/feature-gate-destructuring_assignment.rs deleted file mode 100644 index e7801f0e8ec2b..0000000000000 --- a/src/test/ui/feature-gates/feature-gate-destructuring_assignment.rs +++ /dev/null @@ -1,4 +0,0 @@ -fn main() { - let (a, b) = (0, 1); - (a, b) = (2, 3); //~ ERROR destructuring assignments are unstable -} diff --git a/src/test/ui/feature-gates/feature-gate-destructuring_assignment.stderr b/src/test/ui/feature-gates/feature-gate-destructuring_assignment.stderr deleted file mode 100644 index 62e71decb32a0..0000000000000 --- a/src/test/ui/feature-gates/feature-gate-destructuring_assignment.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0658]: destructuring assignments are unstable - --> $DIR/feature-gate-destructuring_assignment.rs:3:12 - | -LL | (a, b) = (2, 3); - | ------ ^ - | | - | cannot assign to this expression - | - = note: see issue #71126 for more information - = help: add `#![feature(destructuring_assignment)]` to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/issues/issue-77218/issue-77218-2.fixed b/src/test/ui/issues/issue-77218/issue-77218-2.fixed index 06487fe0886f9..0e835d49c6d58 100644 --- a/src/test/ui/issues/issue-77218/issue-77218-2.fixed +++ b/src/test/ui/issues/issue-77218/issue-77218-2.fixed @@ -1,5 +1,4 @@ // run-rustfix -#![feature(destructuring_assignment)] fn main() { let value = [7u8]; while let Some(0) = value.get(0) { //~ ERROR invalid left-hand side of assignment diff --git a/src/test/ui/issues/issue-77218/issue-77218-2.rs b/src/test/ui/issues/issue-77218/issue-77218-2.rs index e19cec08e4318..01dca1ae16c78 100644 --- a/src/test/ui/issues/issue-77218/issue-77218-2.rs +++ b/src/test/ui/issues/issue-77218/issue-77218-2.rs @@ -1,5 +1,4 @@ // run-rustfix -#![feature(destructuring_assignment)] fn main() { let value = [7u8]; while Some(0) = value.get(0) { //~ ERROR invalid left-hand side of assignment diff --git a/src/test/ui/issues/issue-77218/issue-77218-2.stderr b/src/test/ui/issues/issue-77218/issue-77218-2.stderr index 8d9eb2219d54c..58c1c18f9a9b0 100644 --- a/src/test/ui/issues/issue-77218/issue-77218-2.stderr +++ b/src/test/ui/issues/issue-77218/issue-77218-2.stderr @@ -1,5 +1,5 @@ error[E0070]: invalid left-hand side of assignment - --> $DIR/issue-77218-2.rs:5:19 + --> $DIR/issue-77218-2.rs:4:19 | LL | while Some(0) = value.get(0) { | - ^ diff --git a/src/test/ui/issues/issue-77218/issue-77218.fixed b/src/test/ui/issues/issue-77218/issue-77218.fixed index 4ea5110902225..4907b43b9a985 100644 --- a/src/test/ui/issues/issue-77218/issue-77218.fixed +++ b/src/test/ui/issues/issue-77218/issue-77218.fixed @@ -1,6 +1,5 @@ // run-rustfix fn main() { let value = [7u8]; - while let Some(0) = value.get(0) { //~ ERROR destructuring assignments are unstable - } + while let Some(0) = value.get(0) {} //~ ERROR invalid left-hand side of assignment } diff --git a/src/test/ui/issues/issue-77218/issue-77218.rs b/src/test/ui/issues/issue-77218/issue-77218.rs index 0f3c12f56351d..0ed154bf4d808 100644 --- a/src/test/ui/issues/issue-77218/issue-77218.rs +++ b/src/test/ui/issues/issue-77218/issue-77218.rs @@ -1,6 +1,5 @@ // run-rustfix fn main() { let value = [7u8]; - while Some(0) = value.get(0) { //~ ERROR destructuring assignments are unstable - } + while Some(0) = value.get(0) {} //~ ERROR invalid left-hand side of assignment } diff --git a/src/test/ui/issues/issue-77218/issue-77218.stderr b/src/test/ui/issues/issue-77218/issue-77218.stderr index 54f49609a4427..eda635646dfa4 100644 --- a/src/test/ui/issues/issue-77218/issue-77218.stderr +++ b/src/test/ui/issues/issue-77218/issue-77218.stderr @@ -1,18 +1,16 @@ -error[E0658]: destructuring assignments are unstable +error[E0070]: invalid left-hand side of assignment --> $DIR/issue-77218.rs:4:19 | -LL | while Some(0) = value.get(0) { - | ------- ^ - | | - | cannot assign to this expression +LL | while Some(0) = value.get(0) {} + | - ^ + | | + | cannot assign to this expression | - = note: see issue #71126 for more information - = help: add `#![feature(destructuring_assignment)]` to the crate attributes to enable help: you might have meant to use pattern destructuring | -LL | while let Some(0) = value.get(0) { +LL | while let Some(0) = value.get(0) {} | +++ error: aborting due to previous error -For more information about this error, try `rustc --explain E0658`. +For more information about this error, try `rustc --explain E0070`. diff --git a/src/test/ui/mir/issue-91745.rs b/src/test/ui/mir/issue-91745.rs new file mode 100644 index 0000000000000..ca3d66b1c8eb7 --- /dev/null +++ b/src/test/ui/mir/issue-91745.rs @@ -0,0 +1,21 @@ +// check-pass + +pub trait Foo { + type Bar; +} + +pub trait Broken { + type Assoc; + fn broken(&self) where Self::Assoc: Foo; +} + +impl Broken for T { + type Assoc = (); + fn broken(&self) where Self::Assoc: Foo { + let _x: ::Bar; + } +} + +fn main() { + let _m: &dyn Broken = &(); +} diff --git a/src/test/ui/missing/missing-alloc_error_handler.stderr b/src/test/ui/missing/missing-alloc_error_handler.stderr index ed84493deb563..995fa7cf85e96 100644 --- a/src/test/ui/missing/missing-alloc_error_handler.stderr +++ b/src/test/ui/missing/missing-alloc_error_handler.stderr @@ -1,6 +1,6 @@ error: `#[alloc_error_handler]` function required, but not found -note: Use `#![feature(default_alloc_error_handler)]` for a default error handler +note: use `#![feature(default_alloc_error_handler)]` for a default error handler error: aborting due to previous error diff --git a/src/test/ui/panic-handler/weak-lang-item.stderr b/src/test/ui/panic-handler/weak-lang-item.stderr index 1f14b20e4514d..cc25f08e33a80 100644 --- a/src/test/ui/panic-handler/weak-lang-item.stderr +++ b/src/test/ui/panic-handler/weak-lang-item.stderr @@ -11,6 +11,9 @@ LL | extern crate core as other_core; | error: language item required, but not found: `eh_personality` + | + = note: this can occur when a binary crate with `#![no_std]` is compiled for a target where `eh_personality` is defined in the standard library + = help: you may be able to compile for a target that doesn't need `eh_personality`, specify a target with `--target` or in `.cargo/config` error: `#[panic_handler]` function required, but not found diff --git a/src/test/ui/suggestions/fn-or-tuple-struct-with-underscore-args.rs b/src/test/ui/suggestions/fn-or-tuple-struct-with-underscore-args.rs index 00638e04f5db9..ae1dbfeea9340 100644 --- a/src/test/ui/suggestions/fn-or-tuple-struct-with-underscore-args.rs +++ b/src/test/ui/suggestions/fn-or-tuple-struct-with-underscore-args.rs @@ -10,16 +10,10 @@ fn main() { let _: usize = foo(_, _); //~^ ERROR `_` can only be used on the left-hand side of an assignment //~| ERROR `_` can only be used on the left-hand side of an assignment - //~| ERROR destructuring assignments are unstable - //~| ERROR destructuring assignments are unstable let _: S = S(_, _); //~^ ERROR `_` can only be used on the left-hand side of an assignment //~| ERROR `_` can only be used on the left-hand side of an assignment - //~| ERROR destructuring assignments are unstable - //~| ERROR destructuring assignments are unstable let _: usize = T::baz(_, _); //~^ ERROR `_` can only be used on the left-hand side of an assignment //~| ERROR `_` can only be used on the left-hand side of an assignment - //~| ERROR destructuring assignments are unstable - //~| ERROR destructuring assignments are unstable } diff --git a/src/test/ui/suggestions/fn-or-tuple-struct-with-underscore-args.stderr b/src/test/ui/suggestions/fn-or-tuple-struct-with-underscore-args.stderr index 248fa6b9c9cb2..aa56203061989 100644 --- a/src/test/ui/suggestions/fn-or-tuple-struct-with-underscore-args.stderr +++ b/src/test/ui/suggestions/fn-or-tuple-struct-with-underscore-args.stderr @@ -1,57 +1,3 @@ -error[E0658]: destructuring assignments are unstable - --> $DIR/fn-or-tuple-struct-with-underscore-args.rs:10:24 - | -LL | let _: usize = foo(_, _); - | ^ - | - = note: see issue #71126 for more information - = help: add `#![feature(destructuring_assignment)]` to the crate attributes to enable - -error[E0658]: destructuring assignments are unstable - --> $DIR/fn-or-tuple-struct-with-underscore-args.rs:10:27 - | -LL | let _: usize = foo(_, _); - | ^ - | - = note: see issue #71126 for more information - = help: add `#![feature(destructuring_assignment)]` to the crate attributes to enable - -error[E0658]: destructuring assignments are unstable - --> $DIR/fn-or-tuple-struct-with-underscore-args.rs:15:18 - | -LL | let _: S = S(_, _); - | ^ - | - = note: see issue #71126 for more information - = help: add `#![feature(destructuring_assignment)]` to the crate attributes to enable - -error[E0658]: destructuring assignments are unstable - --> $DIR/fn-or-tuple-struct-with-underscore-args.rs:15:21 - | -LL | let _: S = S(_, _); - | ^ - | - = note: see issue #71126 for more information - = help: add `#![feature(destructuring_assignment)]` to the crate attributes to enable - -error[E0658]: destructuring assignments are unstable - --> $DIR/fn-or-tuple-struct-with-underscore-args.rs:20:27 - | -LL | let _: usize = T::baz(_, _); - | ^ - | - = note: see issue #71126 for more information - = help: add `#![feature(destructuring_assignment)]` to the crate attributes to enable - -error[E0658]: destructuring assignments are unstable - --> $DIR/fn-or-tuple-struct-with-underscore-args.rs:20:30 - | -LL | let _: usize = T::baz(_, _); - | ^ - | - = note: see issue #71126 for more information - = help: add `#![feature(destructuring_assignment)]` to the crate attributes to enable - error: in expressions, `_` can only be used on the left-hand side of an assignment --> $DIR/fn-or-tuple-struct-with-underscore-args.rs:10:24 | @@ -65,29 +11,28 @@ LL | let _: usize = foo(_, _); | ^ `_` not allowed here error: in expressions, `_` can only be used on the left-hand side of an assignment - --> $DIR/fn-or-tuple-struct-with-underscore-args.rs:15:18 + --> $DIR/fn-or-tuple-struct-with-underscore-args.rs:13:18 | LL | let _: S = S(_, _); | ^ `_` not allowed here error: in expressions, `_` can only be used on the left-hand side of an assignment - --> $DIR/fn-or-tuple-struct-with-underscore-args.rs:15:21 + --> $DIR/fn-or-tuple-struct-with-underscore-args.rs:13:21 | LL | let _: S = S(_, _); | ^ `_` not allowed here error: in expressions, `_` can only be used on the left-hand side of an assignment - --> $DIR/fn-or-tuple-struct-with-underscore-args.rs:20:27 + --> $DIR/fn-or-tuple-struct-with-underscore-args.rs:16:27 | LL | let _: usize = T::baz(_, _); | ^ `_` not allowed here error: in expressions, `_` can only be used on the left-hand side of an assignment - --> $DIR/fn-or-tuple-struct-with-underscore-args.rs:20:30 + --> $DIR/fn-or-tuple-struct-with-underscore-args.rs:16:30 | LL | let _: usize = T::baz(_, _); | ^ `_` not allowed here -error: aborting due to 12 previous errors +error: aborting due to 6 previous errors -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/suggestions/if-let-typo.rs b/src/test/ui/suggestions/if-let-typo.rs index b9714b67e5888..375bd3f03c920 100644 --- a/src/test/ui/suggestions/if-let-typo.rs +++ b/src/test/ui/suggestions/if-let-typo.rs @@ -3,12 +3,9 @@ fn main() { let bar = None; if Some(x) = foo {} //~ ERROR cannot find value `x` in this scope //~^ ERROR mismatched types - //~^^ ERROR destructuring assignments are unstable if Some(foo) = bar {} //~ ERROR mismatched types - //~^ ERROR destructuring assignments are unstable if 3 = foo {} //~ ERROR mismatched types if Some(3) = foo {} //~ ERROR mismatched types - //~^ ERROR destructuring assignments are unstable - //~^^ ERROR invalid left-hand side of assignment + //~^ ERROR invalid left-hand side of assignment if x = 5 {} //~ ERROR cannot find value `x` in this scope } diff --git a/src/test/ui/suggestions/if-let-typo.stderr b/src/test/ui/suggestions/if-let-typo.stderr index 058f42f220064..3d9ac40ec367b 100644 --- a/src/test/ui/suggestions/if-let-typo.stderr +++ b/src/test/ui/suggestions/if-let-typo.stderr @@ -10,7 +10,7 @@ LL | if let Some(x) = foo {} | +++ error[E0425]: cannot find value `x` in this scope - --> $DIR/if-let-typo.rs:13:8 + --> $DIR/if-let-typo.rs:10:8 | LL | if x = 5 {} | ^ not found in this scope @@ -20,39 +20,6 @@ help: you might have meant to use pattern matching LL | if let x = 5 {} | +++ -error[E0658]: destructuring assignments are unstable - --> $DIR/if-let-typo.rs:4:16 - | -LL | if Some(x) = foo {} - | ------- ^ - | | - | cannot assign to this expression - | - = note: see issue #71126 for more information - = help: add `#![feature(destructuring_assignment)]` to the crate attributes to enable - -error[E0658]: destructuring assignments are unstable - --> $DIR/if-let-typo.rs:7:18 - | -LL | if Some(foo) = bar {} - | --------- ^ - | | - | cannot assign to this expression - | - = note: see issue #71126 for more information - = help: add `#![feature(destructuring_assignment)]` to the crate attributes to enable - -error[E0658]: destructuring assignments are unstable - --> $DIR/if-let-typo.rs:10:16 - | -LL | if Some(3) = foo {} - | ------- ^ - | | - | cannot assign to this expression - | - = note: see issue #71126 for more information - = help: add `#![feature(destructuring_assignment)]` to the crate attributes to enable - error[E0308]: mismatched types --> $DIR/if-let-typo.rs:4:8 | @@ -60,19 +27,19 @@ LL | if Some(x) = foo {} | ^^^^^^^^^^^^^ expected `bool`, found `()` error[E0308]: mismatched types - --> $DIR/if-let-typo.rs:7:8 + --> $DIR/if-let-typo.rs:6:8 | LL | if Some(foo) = bar {} | ^^^^^^^^^^^^^^^ expected `bool`, found `()` error[E0308]: mismatched types - --> $DIR/if-let-typo.rs:9:8 + --> $DIR/if-let-typo.rs:7:8 | LL | if 3 = foo {} | ^^^^^^^ expected `bool`, found `()` error[E0070]: invalid left-hand side of assignment - --> $DIR/if-let-typo.rs:10:16 + --> $DIR/if-let-typo.rs:8:16 | LL | if Some(3) = foo {} | - ^ @@ -80,12 +47,12 @@ LL | if Some(3) = foo {} | cannot assign to this expression error[E0308]: mismatched types - --> $DIR/if-let-typo.rs:10:8 + --> $DIR/if-let-typo.rs:8:8 | LL | if Some(3) = foo {} | ^^^^^^^^^^^^^ expected `bool`, found `()` -error: aborting due to 10 previous errors +error: aborting due to 7 previous errors -Some errors have detailed explanations: E0070, E0308, E0425, E0658. +Some errors have detailed explanations: E0070, E0308, E0425. For more information about an error, try `rustc --explain E0070`. diff --git a/src/test/ui/weird-exprs.rs b/src/test/ui/weird-exprs.rs index 2d7ebbf1d5b04..a02b3230689e8 100644 --- a/src/test/ui/weird-exprs.rs +++ b/src/test/ui/weird-exprs.rs @@ -1,7 +1,6 @@ // run-pass #![feature(generators)] -#![feature(destructuring_assignment)] #![allow(non_camel_case_types)] #![allow(dead_code)]