Skip to content

Commit

Permalink
Rollup merge of rust-lang#93339 - notriddle:notriddle/test-generics-m…
Browse files Browse the repository at this point in the history
…ulti-trait, r=GuillaumeGomez

rustdoc: add test case for multiple traits and erased names

rust-lang#92339 (comment)
  • Loading branch information
matthiaskrgr authored Jan 27, 2022
2 parents 6caa533 + f5cdfb4 commit b232c46
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/test/rustdoc-js/generics-multi-trait.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// exact-check

const QUERY = [
'Result<SomeTrait>',
'Zzzzzzzzzzzzzzzzzz',
'Nonononononononono',
];

const EXPECTED = [
// check one of the generic items
{
'in_args': [
{ 'path': 'generics_multi_trait', 'name': 'beta' },
],
'returned': [
{ 'path': 'generics_multi_trait', 'name': 'bet' },
],
},
{
'in_args': [
{ 'path': 'generics_multi_trait', 'name': 'beta' },
],
'returned': [
{ 'path': 'generics_multi_trait', 'name': 'bet' },
],
},
// ignore the name of the generic itself
{
'in_args': [],
'returned': [],
},
];
12 changes: 12 additions & 0 deletions src/test/rustdoc-js/generics-multi-trait.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
pub trait SomeTrait {}
pub trait Zzzzzzzzzzzzzzzzzz {}

pub fn bet<Nonononononononono: SomeTrait + Zzzzzzzzzzzzzzzzzz>() -> Result<Nonononononononono, ()> {
loop {}
}

pub fn beta<Nonononononononono: SomeTrait + Zzzzzzzzzzzzzzzzzz>(
_param: Result<Nonononononononono, ()>,
) {
loop {}
}

0 comments on commit b232c46

Please sign in to comment.