diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2024-04-09 13:39:22 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-09 13:39:22 +0200 |
| commit | 2e042eabbc9207bbd06498665e574c0d722c81dd (patch) | |
| tree | 9e40ae6ded622df2783aa23a1e3962081e28819e | |
| parent | fb0aab19760a46a6e8ccfd635c8507ae4f562f7f (diff) | |
| parent | 114e88c9d0b8bbc16027e0c10d34c73e15381d7b (diff) | |
| download | rust-2e042eabbc9207bbd06498665e574c0d722c81dd.tar.gz rust-2e042eabbc9207bbd06498665e574c0d722c81dd.zip | |
Rollup merge of #123638 - fmease:rustdoc-synth-auto-yeet-item-param-env-clauses, r=GuillaumeGomez
rustdoc: synthetic auto: filter out clauses from the implementor's ParamEnv ... not just the elaborated clauses. Fixes another regression introduced by me in #123340, oops! Fixes https://github.com/rust-lang/rust/pull/123340#issuecomment-2034195786, cc ``@tamird.`` An earlier local iteration of branch `rustdoc-simplify-auto-trait-impl-synth` (PR #123340) contained a fix for issue #111101 before I decided to limit the scope. I must've introduced this bug when manually reverting that part of the code. r? ``@GuillaumeGomez`` or rustdoc
| -rw-r--r-- | src/librustdoc/clean/auto_trait.rs | 2 | ||||
| -rw-r--r-- | tests/rustdoc/synthetic_auto/supertrait-bounds.rs | 14 |
2 files changed, 15 insertions, 1 deletions
diff --git a/src/librustdoc/clean/auto_trait.rs b/src/librustdoc/clean/auto_trait.rs index 217f6bb550b..daf63998461 100644 --- a/src/librustdoc/clean/auto_trait.rs +++ b/src/librustdoc/clean/auto_trait.rs @@ -168,7 +168,7 @@ fn clean_param_env<'tcx>( // FIXME(#111101): Incorporate the explicit predicates of the item here... let item_predicates: FxIndexSet<_> = - tcx.predicates_of(item_def_id).predicates.iter().map(|(pred, _)| pred).collect(); + tcx.param_env(item_def_id).caller_bounds().iter().collect(); let where_predicates = param_env .caller_bounds() .iter() diff --git a/tests/rustdoc/synthetic_auto/supertrait-bounds.rs b/tests/rustdoc/synthetic_auto/supertrait-bounds.rs new file mode 100644 index 00000000000..503e65d0f4f --- /dev/null +++ b/tests/rustdoc/synthetic_auto/supertrait-bounds.rs @@ -0,0 +1,14 @@ +// Check that we don't add bounds to synthetic auto trait impls that are +// already implied by the item (like supertrait bounds). + +// In this case we don't want to add the bounds `T: Copy` and `T: 'static` +// to the auto trait impl because they're implied by the bound `T: Bound` +// on the implementor `Type`. + +pub struct Type<T: Bound>(T); + +// @has supertrait_bounds/struct.Type.html +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \ +// "impl<T> Send for Type<T>where T: Send," + +pub trait Bound: Copy + 'static {} |
