Skip to content

Silence wf error in signature if it points at assoc type - #164930

Open
estebank wants to merge 3 commits into
rust-lang:mainfrom
estebank:issue-83868
Open

estebank wants to merge 3 commits into
rust-lang:mainfrom
estebank:issue-83868

Conversation

@estebank

@estebank estebank commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Avoid emitting both

error[E0277]: the trait bound `String: Copy` is not satisfied
 --> issue-83868.rs:9:18
  |
9 |     type Assoc = AssertCopy<String>;
  |                  ^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String`
  |
note: required by a bound in `AssertCopy`
 --> issue-83868.rs:1:22
  |
1 | struct AssertCopy<T: Copy>(T);
  |                      ^^^^ required by this bound in `AssertCopy`

and

error[E0277]: the trait bound `String: Copy` is not satisfied
  --> issue-83868.rs:10:23
   |
10 |     fn my_method() -> Self::Assoc {
   |                       ^^^^^^^^^^^ the trait `Copy` is not implemented for `String`
   |
note: required by a bound in `AssertCopy`
  --> issue-83868.rs:1:22
   |
 1 | struct AssertCopy<T: Copy>(T);
   |                      ^^^^ required by this bound in `AssertCopy`

as the former implies the latter. We now only emit the former.

Fix #83868.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 25, 2026
@rustbot

rustbot commented Oct 25, 2026

Copy link
Copy Markdown
Collaborator

r? @jackh726

rustbot has assigned @jackh726.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 77 candidates
  • Random selection from 20 candidates

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@estebank

This comment was marked as resolved.

@rustbot

rustbot commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

Avoid emitting both

```
error[E0277]: the trait bound `String: Copy` is not satisfied
 --> issue-83868.rs:9:18
  |
9 |     type Assoc = AssertCopy<String>;
  |                  ^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String`
  |
note: required by a bound in `AssertCopy`
 --> issue-83868.rs:1:22
  |
1 | struct AssertCopy<T: Copy>(T);
  |                      ^^^^ required by this bound in `AssertCopy`
```
and
```
error[E0277]: the trait bound `String: Copy` is not satisfied
  --> issue-83868.rs:10:23
   |
10 |     fn my_method() -> Self::Assoc {
   |                       ^^^^^^^^^^^ the trait `Copy` is not implemented for `String`
   |
note: required by a bound in `AssertCopy`
  --> issue-83868.rs:1:22
   |
 1 | struct AssertCopy<T: Copy>(T);
   |                      ^^^^ required by this bound in `AssertCopy`
```
as the former implies the latter. We now only emit the former.
@rust-log-analyzer

This comment has been minimized.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Duplicate error when impl associated type is not well-formed

4 participants