@@ -1316,24 +1316,25 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnreachablePub {
1316
1316
}
1317
1317
}
1318
1318
1319
- /// Lint for trait and lifetime bounds that are (accidentally) accepted by the parser, but
1320
- /// ignored later.
1319
+ /// Lint for trait and lifetime bounds in type aliases being mostly ignored:
1320
+ /// They are relevant when using associated types, but otherwise neither checked
1321
+ /// at definition site nor enforced at use site.
1321
1322
1322
- pub struct IgnoredGenericBounds ;
1323
+ pub struct TypeAliasBounds ;
1323
1324
1324
1325
declare_lint ! {
1325
- IGNORED_GENERIC_BOUNDS ,
1326
+ TYPE_ALIAS_BOUNDS ,
1326
1327
Warn ,
1327
- "these generic bounds are ignored "
1328
+ "bounds in type aliases are not enforced "
1328
1329
}
1329
1330
1330
- impl LintPass for IgnoredGenericBounds {
1331
+ impl LintPass for TypeAliasBounds {
1331
1332
fn get_lints ( & self ) -> LintArray {
1332
- lint_array ! ( IGNORED_GENERIC_BOUNDS )
1333
+ lint_array ! ( TYPE_ALIAS_BOUNDS )
1333
1334
}
1334
1335
}
1335
1336
1336
- impl EarlyLintPass for IgnoredGenericBounds {
1337
+ impl EarlyLintPass for TypeAliasBounds {
1337
1338
fn check_item ( & mut self , cx : & EarlyContext , item : & ast:: Item ) {
1338
1339
let type_alias_generics = match item. node {
1339
1340
ast:: ItemKind :: Ty ( _, ref generics) => generics,
@@ -1343,8 +1344,8 @@ impl EarlyLintPass for IgnoredGenericBounds {
1343
1344
if !type_alias_generics. where_clause . predicates . is_empty ( ) {
1344
1345
let spans : Vec < _ > = type_alias_generics. where_clause . predicates . iter ( )
1345
1346
. map ( |pred| pred. span ( ) ) . collect ( ) ;
1346
- cx. span_lint ( IGNORED_GENERIC_BOUNDS , spans,
1347
- "where clauses are ignored in type aliases" ) ;
1347
+ cx. span_lint ( TYPE_ALIAS_BOUNDS , spans,
1348
+ "where clauses are not enforced in type aliases" ) ;
1348
1349
}
1349
1350
// The parameters must not have bounds
1350
1351
for param in type_alias_generics. params . iter ( ) {
@@ -1354,9 +1355,9 @@ impl EarlyLintPass for IgnoredGenericBounds {
1354
1355
} ;
1355
1356
if !spans. is_empty ( ) {
1356
1357
cx. span_lint (
1357
- IGNORED_GENERIC_BOUNDS ,
1358
+ TYPE_ALIAS_BOUNDS ,
1358
1359
spans,
1359
- "bounds on generic parameters are ignored in type aliases" ,
1360
+ "bounds on generic parameters are not enforced in type aliases" ,
1360
1361
) ;
1361
1362
}
1362
1363
}
0 commit comments