@@ -14,6 +14,7 @@ use rustc_ast::*;
1414use rustc_ast_pretty:: pprust:: { self , State } ;
1515use rustc_data_structures:: fx:: FxHashMap ;
1616use rustc_errors:: { error_code, fluent, pluralize, struct_span_err, Applicability } ;
17+ use rustc_macros:: Subdiagnostic ;
1718use rustc_parse:: validate_attr;
1819use rustc_session:: lint:: builtin:: {
1920 DEPRECATED_WHERE_CLAUSE_LOCATION , MISSING_ABI , PATTERNS_IN_FNS_WITHOUT_BODY ,
@@ -1782,15 +1783,17 @@ pub fn check_crate(session: &Session, krate: &Crate, lints: &mut LintBuffer) ->
17821783}
17831784
17841785/// Used to forbid `let` expressions in certain syntactic locations.
1785- #[ derive( Clone , Copy ) ]
1786+ #[ derive( Clone , Copy , Subdiagnostic ) ]
17861787pub ( crate ) enum ForbiddenLetReason {
17871788 /// `let` is not valid and the source environment is not important
17881789 GenericForbidden ,
17891790 /// A let chain with the `||` operator
1790- NotSupportedOr ( Span ) ,
1791+ #[ note( ast_passes:: not_supported_or) ]
1792+ NotSupportedOr ( #[ primary_span] Span ) ,
17911793 /// A let chain with invalid parentheses
17921794 ///
17931795 /// For example, `let 1 = 1 && (expr && expr)` is allowed
17941796 /// but `(let 1 = 1 && (let 1 = 1 && (let 1 = 1))) && let a = 1` is not
1795- NotSupportedParentheses ( Span ) ,
1797+ #[ note( ast_passes:: not_supported_parentheses) ]
1798+ NotSupportedParentheses ( #[ primary_span] Span ) ,
17961799}
0 commit comments