forked from rust-lang/rust
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ui test for
multiple_bound_locations
lint
- Loading branch information
1 parent
d654acd
commit 6955a8a
Showing
2 changed files
with
118 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#![warn(clippy::multiple_bound_locations)] | ||
|
||
fn ty<F: std::fmt::Debug>(a: F) | ||
//~^ ERROR: bound is defined in more than one place | ||
where | ||
F: Sized, | ||
{ | ||
} | ||
|
||
fn lifetime<'a, 'b: 'a, 'c>(a: &'b str, b: &'a str, c: &'c str) | ||
//~^ ERROR: bound is defined in more than one place | ||
where | ||
'b: 'c, | ||
{ | ||
} | ||
|
||
fn ty_pred<F: Sized>() | ||
//~^ ERROR: bound is defined in more than one place | ||
where | ||
for<'a> F: Send + 'a, | ||
{ | ||
} | ||
|
||
struct B; | ||
|
||
impl B { | ||
fn ty<F: std::fmt::Debug>(a: F) | ||
//~^ ERROR: bound is defined in more than one place | ||
where | ||
F: Sized, | ||
{ | ||
} | ||
|
||
fn lifetime<'a, 'b: 'a, 'c>(a: &'b str, b: &'a str, c: &'c str) | ||
//~^ ERROR: bound is defined in more than one place | ||
where | ||
'b: 'c, | ||
{ | ||
} | ||
|
||
fn ty_pred<F: Sized>() | ||
//~^ ERROR: bound is defined in more than one place | ||
where | ||
for<'a> F: Send + 'a, | ||
{ | ||
} | ||
} | ||
|
||
struct C<F>(F); | ||
|
||
impl<F> C<F> { | ||
fn foo(_f: F) -> Self | ||
where F: std::fmt::Display | ||
{ | ||
todo!() | ||
} | ||
} | ||
|
||
fn main() {} |
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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
error: bound is defined in more than one place | ||
--> tests/ui/multiple_bound_locations.rs:3:7 | ||
| | ||
LL | fn ty<F: std::fmt::Debug>(a: F) | ||
| ^ | ||
... | ||
LL | F: Sized, | ||
| ^ | ||
| | ||
= note: `-D clippy::multiple-bound-locations` implied by `-D warnings` | ||
= help: to override `-D warnings` add `#[allow(clippy::multiple_bound_locations)]` | ||
|
||
error: bound is defined in more than one place | ||
--> tests/ui/multiple_bound_locations.rs:10:17 | ||
| | ||
LL | fn lifetime<'a, 'b: 'a, 'c>(a: &'b str, b: &'a str, c: &'c str) | ||
| ^^ | ||
... | ||
LL | 'b: 'c, | ||
| ^^ | ||
|
||
error: bound is defined in more than one place | ||
--> tests/ui/multiple_bound_locations.rs:17:12 | ||
| | ||
LL | fn ty_pred<F: Sized>() | ||
| ^ | ||
... | ||
LL | for<'a> F: Send + 'a, | ||
| ^ | ||
|
||
error: bound is defined in more than one place | ||
--> tests/ui/multiple_bound_locations.rs:27:11 | ||
| | ||
LL | fn ty<F: std::fmt::Debug>(a: F) | ||
| ^ | ||
... | ||
LL | F: Sized, | ||
| ^ | ||
|
||
error: bound is defined in more than one place | ||
--> tests/ui/multiple_bound_locations.rs:34:21 | ||
| | ||
LL | fn lifetime<'a, 'b: 'a, 'c>(a: &'b str, b: &'a str, c: &'c str) | ||
| ^^ | ||
... | ||
LL | 'b: 'c, | ||
| ^^ | ||
|
||
error: bound is defined in more than one place | ||
--> tests/ui/multiple_bound_locations.rs:41:16 | ||
| | ||
LL | fn ty_pred<F: Sized>() | ||
| ^ | ||
... | ||
LL | for<'a> F: Send + 'a, | ||
| ^ | ||
|
||
error: aborting due to 6 previous errors | ||
|