Skip to content

Commit

Permalink
Unrolled build for rust-lang#123638
Browse files Browse the repository at this point in the history
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
  • Loading branch information
rust-timer authored Apr 9, 2024
2 parents 2805aed + 114e88c commit 5006b06
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/librustdoc/clean/auto_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
14 changes: 14 additions & 0 deletions tests/rustdoc/synthetic_auto/supertrait-bounds.rs
Original file line number Diff line number Diff line change
@@ -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 {}

0 comments on commit 5006b06

Please sign in to comment.