]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #94150 - Enselic:synthetic-generic-parameters-in-json, r=CraftSpider
authorMatthias Krüger <matthias.krueger@famsik.de>
Sat, 12 Mar 2022 08:35:44 +0000 (09:35 +0100)
committerGitHub <noreply@github.com>
Sat, 12 Mar 2022 08:35:44 +0000 (09:35 +0100)
rustdoc-json: Include GenericParamDefKind::Type::synthetic in JSON

The rustdoc JSON for

```
pub fn f(_: impl Clone) {}
```

will effectively be

```
pub fn f<impl Clone: Clone>(_: impl Clone) {}
```

where a synthetic generic parameter called `impl Clone` with generic trait bound
`Clone` is added to the function declaration.

The generated HTML filters out these generic parameters by doing
`self.params.iter().filter(|p| !p.is_synthetic_type_param())`, because the
synthetic generic paramter is not of interest to regular users.

For the same reason, we should expose whether or not a generic parameter is
synthetic or not also in the rustdoc JSON, so that rustdoc JSON clients can also
have the option to hide syntehtic generic parameters.

`@rustbot` modify labels: +A-rustdoc-json


Trivial merge