@@ -14,6 +14,7 @@ use rustc_ast::*;
14
14
use rustc_ast_pretty:: pprust:: { self , State } ;
15
15
use rustc_data_structures:: fx:: FxHashMap ;
16
16
use rustc_errors:: { error_code, fluent, pluralize, struct_span_err, Applicability } ;
17
+ use rustc_macros:: Subdiagnostic ;
17
18
use rustc_parse:: validate_attr;
18
19
use rustc_session:: lint:: builtin:: {
19
20
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) ->
1782
1783
}
1783
1784
1784
1785
/// Used to forbid `let` expressions in certain syntactic locations.
1785
- #[ derive( Clone , Copy ) ]
1786
+ #[ derive( Clone , Copy , Subdiagnostic ) ]
1786
1787
pub ( crate ) enum ForbiddenLetReason {
1787
1788
/// `let` is not valid and the source environment is not important
1788
1789
GenericForbidden ,
1789
1790
/// A let chain with the `||` operator
1790
- NotSupportedOr ( Span ) ,
1791
+ #[ note( ast_passes:: not_supported_or) ]
1792
+ NotSupportedOr ( #[ primary_span] Span ) ,
1791
1793
/// A let chain with invalid parentheses
1792
1794
///
1793
1795
/// For example, `let 1 = 1 && (expr && expr)` is allowed
1794
1796
/// 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 ) ,
1796
1799
}
0 commit comments