Skip to content

Suggest assoc type on type not found in trait method definition #62669

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

Merged
merged 1 commit into from
Jul 18, 2019

Conversation

estebank
Copy link
Contributor

Given

trait A {
    type Bla;
    fn to_bla(&self) -> Bla;
}

suggest using Self::Bla:

error[E0412]: cannot find type `Bla` in this scope
  --> file.rs:3:25
   |
LL |     fn to_bla(&self) -> Bla;
   |                         ^^^ help: try: `Self::Bla`

Fix #62650.

@rust-highfive
Copy link
Contributor

r? @cramertj

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 14, 2019
@rust-highfive

This comment has been minimized.

@estebank estebank force-pushed the suggest-assoc-type branch from 8108021 to 6b9580b Compare July 14, 2019 04:17
@cramertj
Copy link
Member

@bors r+

@bors
Copy link
Collaborator

bors commented Jul 15, 2019

📌 Commit 6b9580b has been approved by cramertj

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 15, 2019
@bors
Copy link
Collaborator

bors commented Jul 18, 2019

⌛ Testing commit 6b9580b with merge 2c3b05d...

bors added a commit that referenced this pull request Jul 18, 2019
Suggest assoc type on type not found in trait method definition

Given

```
trait A {
    type Bla;
    fn to_bla(&self) -> Bla;
}
```
suggest using `Self::Bla`:

```
error[E0412]: cannot find type `Bla` in this scope
  --> file.rs:3:25
   |
LL |     fn to_bla(&self) -> Bla;
   |                         ^^^ help: try: `Self::Bla`
```

Fix #62650.
@bors
Copy link
Collaborator

bors commented Jul 18, 2019

☀️ Test successful - checks-azure
Approved by: cramertj
Pushing 2c3b05d to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jul 18, 2019
@bors bors merged commit 6b9580b into rust-lang:master Jul 18, 2019
@estebank estebank deleted the suggest-assoc-type branch November 9, 2023 05:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

diagnostics: suggest "Self::" on missing type not found in trait definition
4 participants