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

Emits E0599 when meeting MyTrait::missing_method #111588

Merged
merged 1 commit into from
May 17, 2023

Conversation

mu001999
Copy link
Contributor

Fixes #111312

@rustbot
Copy link
Collaborator

rustbot commented May 15, 2023

r? @oli-obk

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

@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 May 15, 2023
compiler/rustc_hir_typeck/src/method/suggest.rs Outdated Show resolved Hide resolved
compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs Outdated Show resolved Hide resolved
compiler/rustc_hir_analysis/src/astconv/mod.rs Outdated Show resolved Hide resolved
compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs Outdated Show resolved Hide resolved
@mu001999 mu001999 requested a review from fee1-dead May 17, 2023 02:45
@mu001999 mu001999 requested a review from fee1-dead May 17, 2023 04:20
@fee1-dead
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented May 17, 2023

📌 Commit db64512 has been approved by fee1-dead

It is now in the queue for this repository.

@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 May 17, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request May 17, 2023
Rollup of 6 pull requests

Successful merges:

 - rust-lang#110930 (Don't expect normalization to succeed in elaborate_drops)
 - rust-lang#111557 (Revert "Validate resolution for SelfCtor too.")
 - rust-lang#111565 (rustdoc-json: Add tests for visibility of impls)
 - rust-lang#111588 (Emits E0599 when meeting `MyTrait::missing_method`)
 - rust-lang#111625 (Move rustc_middle/src/ty/query.rs to rustc_middle/src/query/plumbing.rs)
 - rust-lang#111674 (Add missing backslash in HTML string)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 291ced5 into rust-lang:master May 17, 2023
@rustbot rustbot added this to the 1.71.0 milestone May 17, 2023
@mu001999 mu001999 deleted the diag/improve-e0782 branch May 18, 2023 03:34
Copy link
Contributor

@cjgillot cjgillot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 nits here. @mu001999 could you see about them as part of #111731?

diag.emit();
}
Ok(r)
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this redundant with the code below?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so. This code emits steal and emit the diag when it is able to find the target method for dyn MyTrait. The code below is executed only when it is not able to find such a method.

diag.emit();
}
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this code be in report_method_error?

Copy link
Contributor Author

@mu001999 mu001999 May 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is good to pass only trait_missing_method to report_method_error. There are two reasons for this: first, the diag for the bare traits will only be emitted or cancelled here; and second, the diag for bare traits is not a method error. Putting this code in report_method_error will lead to logical dispersion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

confusing diagnostic when calling a method that doesn't exist on a trait but exists on another trait
7 participants