Skip to content

Commit 5006b06

Browse files
authored
Unrolled build for rust-lang#123638
Rollup merge of rust-lang#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 rust-lang#123340, oops! Fixes rust-lang#123340 (comment), cc ``@tamird.`` An earlier local iteration of branch `rustdoc-simplify-auto-trait-impl-synth` (PR rust-lang#123340) contained a fix for issue rust-lang#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
2 parents 2805aed + 114e88c commit 5006b06

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/librustdoc/clean/auto_trait.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ fn clean_param_env<'tcx>(
168168

169169
// FIXME(#111101): Incorporate the explicit predicates of the item here...
170170
let item_predicates: FxIndexSet<_> =
171-
tcx.predicates_of(item_def_id).predicates.iter().map(|(pred, _)| pred).collect();
171+
tcx.param_env(item_def_id).caller_bounds().iter().collect();
172172
let where_predicates = param_env
173173
.caller_bounds()
174174
.iter()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Check that we don't add bounds to synthetic auto trait impls that are
2+
// already implied by the item (like supertrait bounds).
3+
4+
// In this case we don't want to add the bounds `T: Copy` and `T: 'static`
5+
// to the auto trait impl because they're implied by the bound `T: Bound`
6+
// on the implementor `Type`.
7+
8+
pub struct Type<T: Bound>(T);
9+
10+
// @has supertrait_bounds/struct.Type.html
11+
// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \
12+
// "impl<T> Send for Type<T>where T: Send,"
13+
14+
pub trait Bound: Copy + 'static {}

0 commit comments

Comments
 (0)