@@ -119,33 +119,23 @@ 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- let sess = & self . session ;
123- if sess. opts . unstable_features . is_nightly_build ( ) {
124- let err = "`let` expressions are not supported here" ;
125- let mut diag = sess. struct_span_err ( expr. span , err) ;
126- diag. note ( "only supported directly in conditions of `if` and `while` expressions" ) ;
127- match forbidden_let_reason {
128- ForbiddenLetReason :: GenericForbidden => { }
129- ForbiddenLetReason :: NotSupportedOr ( span) => {
130- diag. span_note (
131- span,
132- "`||` operators are not supported in let chain expressions" ,
133- ) ;
134- }
135- ForbiddenLetReason :: NotSupportedParentheses ( span) => {
136- diag. span_note (
137- span,
138- "`let`s wrapped in parentheses are not supported in a context with let \
139- chains",
140- ) ;
141- }
122+ let err = "`let` expressions are not supported here" ;
123+ let mut diag = self . session . struct_span_err ( expr. span , err) ;
124+ diag. note ( "only supported directly in conditions of `if` and `while` expressions" ) ;
125+ match forbidden_let_reason {
126+ ForbiddenLetReason :: GenericForbidden => { }
127+ ForbiddenLetReason :: NotSupportedOr ( span) => {
128+ diag. span_note ( span, "`||` operators are not supported in let chain expressions" ) ;
129+ }
130+ ForbiddenLetReason :: NotSupportedParentheses ( span) => {
131+ diag. span_note (
132+ span,
133+ "`let`s wrapped in parentheses are not supported in a context with let \
134+ chains",
135+ ) ;
142136 }
143- diag. emit ( ) ;
144- } else {
145- sess. struct_span_err ( expr. span , "expected expression, found statement (`let`)" )
146- . note ( "variable declaration using `let` is a statement" )
147- . emit ( ) ;
148137 }
138+ diag. emit ( ) ;
149139 }
150140
151141 fn check_gat_where (
0 commit comments