Skip to content

Commit

Permalink
Test qualified paths and similarly named traits.
Browse files Browse the repository at this point in the history
  • Loading branch information
Allen Hsu committed May 18, 2022
1 parent bcc5ba8 commit e6b34d7
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
8 changes: 8 additions & 0 deletions tests/ui/repeated_where_clause_or_trait_bound.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,12 @@ fn bad_generic<T: GenericTrait<u32> + GenericTrait<u64>>(arg0: T) {
unimplemented!();
}

mod foo {
pub trait Clone {}
}

fn qualified_path<T: Clone + foo::Clone>(arg0: T) {
unimplemented!();
}

fn main() {}
8 changes: 8 additions & 0 deletions tests/ui/repeated_where_clause_or_trait_bound.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,12 @@ fn bad_generic<T: GenericTrait<u64> + GenericTrait<u32> + GenericTrait<u64>>(arg
unimplemented!();
}

mod foo {
pub trait Clone {}
}

fn qualified_path<T: std::clone::Clone + Clone + foo::Clone>(arg0: T) {
unimplemented!();
}

fn main() {}
8 changes: 7 additions & 1 deletion tests/ui/repeated_where_clause_or_trait_bound.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,11 @@ error: these bounds contain repeated elements
LL | fn bad_generic<T: GenericTrait<u64> + GenericTrait<u32> + GenericTrait<u64>>(arg0: T) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `GenericTrait<u32> + GenericTrait<u64>`

error: aborting due to 7 previous errors
error: these bounds contain repeated elements
--> $DIR/repeated_where_clause_or_trait_bound.rs:109:22
|
LL | fn qualified_path<T: std::clone::Clone + Clone + foo::Clone>(arg0: T) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Clone + foo::Clone`

error: aborting due to 8 previous errors

0 comments on commit e6b34d7

Please sign in to comment.