Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
type_alias_bounds lint: If the type alias uses an associated type wit…
…hout "as", suggest to use the "as" form instead. This is necessary to get rid of the type bound, and hence silence the warning.
- Loading branch information
Showing
5 changed files
with
150 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,83 @@ | ||
warning: bounds on generic parameters are not enforced in type aliases | ||
--> $DIR/type-alias-bounds.rs:17:14 | ||
--> $DIR/type-alias-bounds.rs:18:14 | ||
| | ||
LL | type SVec<T: Send+Send> = Vec<T>; | ||
| ^^^^ ^^^^ | ||
| | ||
= note: #[warn(type_alias_bounds)] on by default | ||
= help: the bound will not be checked when the type alias is used, and should be removed | ||
|
||
warning: where clauses are not enforced in type aliases | ||
--> $DIR/type-alias-bounds.rs:19:21 | ||
--> $DIR/type-alias-bounds.rs:20:21 | ||
| | ||
LL | type S2Vec<T> where T: Send = Vec<T>; | ||
| ^^^^^^^ | ||
| | ||
= help: the clause will not be checked when the type alias is used, and should be removed | ||
|
||
warning: bounds on generic parameters are not enforced in type aliases | ||
--> $DIR/type-alias-bounds.rs:21:19 | ||
--> $DIR/type-alias-bounds.rs:22:19 | ||
| | ||
LL | type VVec<'b, 'a: 'b+'b> = (&'b u32, Vec<&'a i32>); | ||
| ^^ ^^ | ||
| | ||
= help: the bound will not be checked when the type alias is used, and should be removed | ||
|
||
warning: bounds on generic parameters are not enforced in type aliases | ||
--> $DIR/type-alias-bounds.rs:23:18 | ||
--> $DIR/type-alias-bounds.rs:24:18 | ||
| | ||
LL | type WVec<'b, T: 'b+'b> = (&'b u32, Vec<T>); | ||
| ^^ ^^ | ||
| | ||
= help: the bound will not be checked when the type alias is used, and should be removed | ||
|
||
warning: where clauses are not enforced in type aliases | ||
--> $DIR/type-alias-bounds.rs:25:25 | ||
--> $DIR/type-alias-bounds.rs:26:25 | ||
| | ||
LL | type W2Vec<'b, T> where T: 'b, T: 'b = (&'b u32, Vec<T>); | ||
| ^^^^^ ^^^^^ | ||
| | ||
= help: the clause will not be checked when the type alias is used, and should be removed | ||
|
||
warning: bounds on generic parameters are not enforced in type aliases | ||
--> $DIR/type-alias-bounds.rs:56:12 | ||
--> $DIR/type-alias-bounds.rs:57:12 | ||
| | ||
LL | type T1<U: Bound> = U::Assoc; | ||
LL | type T1<U: Bound> = U::Assoc; //~ WARN not enforced in type aliases | ||
| ^^^^^ | ||
| | ||
= help: the bound will not be checked when the type alias is used, and should be removed | ||
help: use absolute paths (i.e., <T as Trait>::Assoc) to refer to associated types in type aliases | ||
--> $DIR/type-alias-bounds.rs:57:21 | ||
| | ||
LL | type T1<U: Bound> = U::Assoc; //~ WARN not enforced in type aliases | ||
| ^^^^^^^^ | ||
|
||
warning: where clauses are not enforced in type aliases | ||
--> $DIR/type-alias-bounds.rs:58:18 | ||
| | ||
LL | type T2<U> where U: Bound = U::Assoc; | ||
LL | type T2<U> where U: Bound = U::Assoc; //~ WARN not enforced in type aliases | ||
| ^^^^^^^^ | ||
| | ||
= help: the clause will not be checked when the type alias is used, and should be removed | ||
help: use absolute paths (i.e., <T as Trait>::Assoc) to refer to associated types in type aliases | ||
--> $DIR/type-alias-bounds.rs:58:29 | ||
| | ||
LL | type T2<U> where U: Bound = U::Assoc; //~ WARN not enforced in type aliases | ||
| ^^^^^^^^ | ||
|
||
error[E0220]: associated type `Assoc` not found for `U` | ||
--> $DIR/type-alias-bounds.rs:60:14 | ||
warning: bounds on generic parameters are not enforced in type aliases | ||
--> $DIR/type-alias-bounds.rs:66:12 | ||
| | ||
LL | type T5<U: Bound> = <U as Bound>::Assoc; //~ WARN not enforced in type aliases | ||
| ^^^^^ | ||
| | ||
LL | type T3<U> = U::Assoc; | ||
| ^^^^^^^^ associated type `Assoc` not found | ||
= help: the bound will not be checked when the type alias is used, and should be removed | ||
|
||
error: aborting due to previous error | ||
warning: bounds on generic parameters are not enforced in type aliases | ||
--> $DIR/type-alias-bounds.rs:67:12 | ||
| | ||
LL | type T6<U: Bound> = ::std::vec::Vec<U>; //~ WARN not enforced in type aliases | ||
| ^^^^^ | ||
| | ||
= help: the bound will not be checked when the type alias is used, and should be removed | ||
|
||
If you want more information on this error, try using "rustc --explain E0220" |