diff options
| author | bors <bors@rust-lang.org> | 2021-12-15 09:31:59 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-12-15 09:31:59 +0000 |
| commit | 3ee016ae4d4c6ee4a34faa2eb7fdae2ffa7c9b46 (patch) | |
| tree | feda053596eb3645cbba8cb313676bdcd7024fee /compiler | |
| parent | df89fd2063aaa060c72c81254db0b930ff379e9a (diff) | |
| parent | 6c6cfa87c08a7bfb6b27bb01b9337aa3178716a5 (diff) | |
| download | rust-3ee016ae4d4c6ee4a34faa2eb7fdae2ffa7c9b46.tar.gz rust-3ee016ae4d4c6ee4a34faa2eb7fdae2ffa7c9b46.zip | |
Auto merge of #91959 - matthiaskrgr:rollup-rhajuvw, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #90521 (Stabilize `destructuring_assignment`) - #91479 (Add `[T]::as_simd(_mut)`) - #91584 (Improve code for rustdoc-gui tester) - #91886 (core: minor `Option` doc correction) - #91888 (Handle unordered const/ty generics for object lifetime defaults) - #91905 (Fix source code page sidebar on mobile) - #91906 (Removed `in_band_lifetimes` from `library\proc_macro`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_ast_lowering/src/expr.rs | 19 | ||||
| -rw-r--r-- | compiler/rustc_ast_lowering/src/lib.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_ast_passes/src/feature_gate.rs | 5 | ||||
| -rw-r--r-- | compiler/rustc_expand/src/lib.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_feature/src/accepted.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_feature/src/active.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_hir/src/hir.rs | 14 | ||||
| -rw-r--r-- | compiler/rustc_parse/src/parser/expr.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_resolve/src/late/lifetimes.rs | 9 | ||||
| -rw-r--r-- | compiler/rustc_typeck/src/check/expr.rs | 5 |
10 files changed, 8 insertions, 55 deletions
diff --git a/compiler/rustc_ast_lowering/src/expr.rs b/compiler/rustc_ast_lowering/src/expr.rs index 75a45a437e7..be67fe72127 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}; @@ -962,24 +961,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_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index fee2e7636ea..0077dec889d 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -52,7 +52,7 @@ use rustc_hir::def::{DefKind, Namespace, PartialRes, PerNS, Res}; use rustc_hir::def_id::{DefId, DefPathHash, LocalDefId, CRATE_DEF_ID}; use rustc_hir::definitions::{DefKey, DefPathData, Definitions}; use rustc_hir::intravisit; -use rustc_hir::{ConstArg, GenericArg, InferKind, ParamName}; +use rustc_hir::{ConstArg, GenericArg, ParamName}; use rustc_index::vec::{Idx, IndexVec}; use rustc_query_system::ich::StableHashingContext; use rustc_session::lint::builtin::BARE_TRAIT_OBJECTS; @@ -1113,7 +1113,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { return GenericArg::Infer(hir::InferArg { hir_id: self.lower_node_id(ty.id), span: self.lower_span(ty.span), - kind: InferKind::Type, }); } // We parse const arguments as path types as we cannot distinguish them during diff --git a/compiler/rustc_ast_passes/src/feature_gate.rs b/compiler/rustc_ast_passes/src/feature_gate.rs index 1d1539152be..975874b6b2c 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_expand/src/lib.rs b/compiler/rustc_expand/src/lib.rs index 60a62ac204c..47a64b457d0 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(let_else)] #![feature(proc_macro_diagnostic)] diff --git a/compiler/rustc_feature/src/accepted.rs b/compiler/rustc_feature/src/accepted.rs index 87b08dc5264..32a9d081ed8 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 22f6559d15f..ebd12d6ab4e 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_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index f044c187f39..e2358aac1e7 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -255,23 +255,9 @@ pub struct ConstArg { pub span: Span, } -#[derive(Copy, Clone, Encodable, Debug, HashStable_Generic)] -pub enum InferKind { - Const, - Type, -} - -impl InferKind { - #[inline] - pub fn is_type(self) -> bool { - matches!(self, InferKind::Type) - } -} - #[derive(Encodable, Debug, HashStable_Generic)] pub struct InferArg { pub hir_id: HirId, - pub kind: InferKind, pub span: Span, } diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index c62ebb271f4..ddb4f2dc25d 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -1297,7 +1297,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 @@ -2620,7 +2619,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_resolve/src/late/lifetimes.rs b/compiler/rustc_resolve/src/late/lifetimes.rs index c94c56df75b..05098defead 100644 --- a/compiler/rustc_resolve/src/late/lifetimes.rs +++ b/compiler/rustc_resolve/src/late/lifetimes.rs @@ -2541,8 +2541,8 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { GenericParamDefKind::Type { object_lifetime_default, .. } => { Some(object_lifetime_default) } - GenericParamDefKind::Lifetime - | GenericParamDefKind::Const { .. } => None, + GenericParamDefKind::Const { .. } => Some(Set1::Empty), + GenericParamDefKind::Lifetime => None, }) .collect() }) @@ -2569,12 +2569,11 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { } GenericArg::Const(ct) => { self.visit_anon_const(&ct.value); + i += 1; } GenericArg::Infer(inf) => { self.visit_id(inf.hir_id); - if inf.kind.is_type() { - i += 1; - } + i += 1; } } } diff --git a/compiler/rustc_typeck/src/check/expr.rs b/compiler/rustc_typeck/src/check/expr.rs index bc6ad3c9686..6a63feb09a1 100644 --- a/compiler/rustc_typeck/src/check/expr.rs +++ b/compiler/rustc_typeck/src/check/expr.rs @@ -878,11 +878,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(_) |
