Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustdoc: synthetic impls don't include bounds that originate from the implementing type #111101

Open
fmease opened this issue May 2, 2023 · 0 comments
Assignees
Labels
A-auto-traits Area: auto traits (`auto trait Send`) A-synthetic-impls Area: Synthetic impls, used by rustdoc to document auto traits and traits with blanket impls C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@fmease
Copy link
Member

fmease commented May 2, 2023

For example, given

pub struct Ty<T: Clone>(T);

the impl of the auto trait Send synthesized for the generic type Ty looks like

impl<T> Send for Ty<T>
where
    T: Send

while ideally its where clause should be where T: Clone + Send since in its current form it isn't well-typed: the trait bound T: Clone is not satisfied (strictly speaking a manual Send impl would have to be additionally marked as unsafe to be well-formed but the omission is by design).

According to the following paragraph from the PR description of the initial implementation of synthetic impls (#47833):

All of this means that a user should be able to copy-paste a [synthetic impl] into their code, without any observable changes in behavior (assuming the rest of the program remains unchanged).

If we want to conform to this rule then the current behavior is incorrect (although it goes all the way back to said PR) since a copy-paste will lead to a type error.

Maybe all of this is intentional (less clutter, disk size reduction)? Opening for discussion (my bias: bug).

@rustbot label C-bug T-rustdoc A-auto-traits A-synthetic-impls

@rustbot rustbot added A-auto-traits Area: auto traits (`auto trait Send`) C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. A-synthetic-impls Area: Synthetic impls, used by rustdoc to document auto traits and traits with blanket impls labels May 2, 2023
@fmease fmease changed the title rustdoc: synthetic impls don't include bounds originating from implementing type rustdoc: synthetic impls don't include bounds that originate from the implementing type May 2, 2023
@fmease fmease self-assigned this Mar 31, 2024
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Apr 9, 2024
…m-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
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Apr 9, 2024
…m-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
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Apr 9, 2024
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-auto-traits Area: auto traits (`auto trait Send`) A-synthetic-impls Area: Synthetic impls, used by rustdoc to document auto traits and traits with blanket impls C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants