@@ -15,7 +15,9 @@ use rustc_ast_pretty::pprust::{self, State};
15
15
use rustc_data_structures:: fx:: FxHashMap ;
16
16
use rustc_errors:: { error_code, pluralize, struct_span_err, Applicability } ;
17
17
use rustc_parse:: validate_attr;
18
- use rustc_session:: lint:: builtin:: { MISSING_ABI , PATTERNS_IN_FNS_WITHOUT_BODY } ;
18
+ use rustc_session:: lint:: builtin:: {
19
+ DEPRECATED_WHERE_CLAUSE_LOCATION , MISSING_ABI , PATTERNS_IN_FNS_WITHOUT_BODY ,
20
+ } ;
19
21
use rustc_session:: lint:: { BuiltinLintDiagnostics , LintBuffer } ;
20
22
use rustc_session:: Session ;
21
23
use rustc_span:: source_map:: Spanned ;
@@ -123,11 +125,11 @@ impl<'a> AstValidator<'a> {
123
125
}
124
126
125
127
fn check_gat_where (
126
- & self ,
128
+ & mut self ,
129
+ id : NodeId ,
127
130
before_predicates : & [ WherePredicate ] ,
128
131
where_clauses : ( ast:: TyAliasWhereClause , ast:: TyAliasWhereClause ) ,
129
132
) {
130
- let sess = & self . session ;
131
133
if !before_predicates. is_empty ( ) {
132
134
let mut state = State :: new ( ) ;
133
135
if !where_clauses. 1 . 0 {
@@ -145,14 +147,16 @@ impl<'a> AstValidator<'a> {
145
147
state. print_where_predicate ( p) ;
146
148
}
147
149
let suggestion = state. s . eof ( ) ;
148
- sess. struct_span_err ( where_clauses. 0 . 1 , "where clause not allowed here" )
149
- . span_suggestion (
150
+ self . lint_buffer . buffer_lint_with_diagnostic (
151
+ DEPRECATED_WHERE_CLAUSE_LOCATION ,
152
+ id,
153
+ where_clauses. 0 . 1 ,
154
+ "where clause not allowed here" ,
155
+ BuiltinLintDiagnostics :: DeprecatedWhereclauseLocation (
150
156
where_clauses. 1 . 1 . shrink_to_hi ( ) ,
151
- "move it here" ,
152
157
suggestion,
153
- Applicability :: MachineApplicable ,
154
- )
155
- . emit ( ) ;
158
+ ) ,
159
+ ) ;
156
160
}
157
161
}
158
162
@@ -1568,6 +1572,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
1568
1572
self . check_type_no_bounds ( bounds, "`impl`s" ) ;
1569
1573
if ty. is_some ( ) {
1570
1574
self . check_gat_where (
1575
+ item. id ,
1571
1576
generics. where_clause . predicates . split_at ( * where_predicates_split) . 0 ,
1572
1577
* where_clauses,
1573
1578
) ;
0 commit comments