Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit a0d0709

Browse files
committed
Auto merge of rust-lang#100812 - Nilstrieb:revert-let-chains-nightly, r=Mark-Simulacrum
Revert let_chains stabilization This is the revert against master, the beta revert was already done in rust-lang#100538. Bumps the stage0 compiler which already has it reverted.
2 parents 9f4d5d2 + 01acfef commit a0d0709

File tree

62 files changed

+1120
-734
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+1120
-734
lines changed

compiler/rustc_ast/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#![feature(const_trait_impl)]
1515
#![feature(if_let_guard)]
1616
#![cfg_attr(bootstrap, feature(label_break_value))]
17+
#![feature(let_chains)]
1718
#![feature(min_specialization)]
1819
#![feature(negative_impls)]
1920
#![feature(slice_internals)]

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
//! in the HIR, especially for multiple identifiers.
3232
3333
#![feature(box_patterns)]
34+
#![feature(let_chains)]
3435
#![feature(let_else)]
3536
#![feature(never_type)]
3637
#![recursion_limit = "256"]

compiler/rustc_ast_passes/src/ast_validation.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,12 @@ impl<'a> AstValidator<'a> {
119119

120120
/// Emits an error banning the `let` expression provided in the given location.
121121
fn ban_let_expr(&self, expr: &'a Expr, forbidden_let_reason: ForbiddenLetReason) {
122-
self.session.emit_err(ForbiddenLet { span: expr.span, reason: forbidden_let_reason });
122+
let sess = &self.session;
123+
if sess.opts.unstable_features.is_nightly_build() {
124+
sess.emit_err(ForbiddenLet { span: expr.span, reason: forbidden_let_reason });
125+
} else {
126+
sess.emit_err(ForbiddenLetStable { span: expr.span });
127+
}
123128
}
124129

125130
fn check_gat_where(

compiler/rustc_ast_passes/src/errors.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ impl AddSubdiagnostic for ForbiddenLetReason {
3030
}
3131
}
3232

33+
#[derive(SessionDiagnostic)]
34+
#[diag(ast_passes::forbidden_let_stable)]
35+
#[note]
36+
pub struct ForbiddenLetStable {
37+
#[primary_span]
38+
pub span: Span,
39+
}
40+
3341
#[derive(SessionDiagnostic)]
3442
#[diag(ast_passes::forbidden_assoc_constraint)]
3543
pub struct ForbiddenAssocConstraint {

compiler/rustc_ast_passes/src/feature_gate.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,6 +777,7 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session) {
777777
"`if let` guards are experimental",
778778
"you can write `if matches!(<expr>, <pattern>)` instead of `if let <pattern> = <expr>`"
779779
);
780+
gate_all!(let_chains, "`let` expressions in this position are unstable");
780781
gate_all!(
781782
async_closure,
782783
"async closures are unstable",

compiler/rustc_ast_passes/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#![feature(box_patterns)]
99
#![feature(if_let_guard)]
1010
#![feature(iter_is_partitioned)]
11+
#![feature(let_chains)]
1112
#![feature(let_else)]
1213
#![recursion_limit = "256"]
1314

compiler/rustc_attr/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
//! The goal is to move the definition of `MetaItem` and things that don't need to be in `syntax`
55
//! to this crate.
66
7+
#![feature(let_chains)]
78
#![feature(let_else)]
89
#![deny(rustc::untranslatable_diagnostic)]
910
#![deny(rustc::diagnostic_outside_of_impl)]

compiler/rustc_borrowck/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
33
#![allow(rustc::potential_query_instability)]
44
#![feature(box_patterns)]
5+
#![feature(let_chains)]
56
#![feature(let_else)]
67
#![feature(min_specialization)]
78
#![feature(never_type)]

compiler/rustc_builtin_macros/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#![feature(decl_macro)]
99
#![feature(if_let_guard)]
1010
#![feature(is_sorted)]
11+
#![feature(let_chains)]
1112
#![feature(let_else)]
1213
#![feature(proc_macro_internals)]
1314
#![feature(proc_macro_quote)]

compiler/rustc_codegen_llvm/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
77
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
88
#![feature(hash_raw_entry)]
9+
#![feature(let_chains)]
910
#![feature(let_else)]
1011
#![feature(extern_types)]
1112
#![feature(once_cell)]

0 commit comments

Comments
 (0)