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

emit diagnostic suggestion for error when if let used with enum varia… #102062

Closed
wants to merge 1 commit into from

Conversation

lyming2007
Copy link

…nt without being initialized

compare the span base id to get the correct expression and add suggestion to it
modified: compiler/rustc_infer/src/infer/error_reporting/mod.rs
modified: compiler/rustc_span/src/span_encoding.rs
modified: compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs
modified: compiler/rustc_typeck/src/check/compare_method.rs
modified: compiler/rustc_typeck/src/check/fn_ctxt/checks.rs
new file: src/test/ui/type/issue-101208.rs
new file: src/test/ui/type/issue-101208.stderr

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Sep 20, 2022
@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @jackh726 (or someone else) soon.

Please see the contribution instructions for more information.

@bors
Copy link
Contributor

bors commented Sep 22, 2022

☔ The latest upstream changes (presumably #98840) made this pull request unmergeable. Please resolve the merge conflicts.

@bors
Copy link
Contributor

bors commented Sep 27, 2022

☔ The latest upstream changes (presumably #102306) made this pull request unmergeable. Please resolve the merge conflicts.

…nt without being initialized

compare the span base id to get the correct expression and add suggestion to it
	modified:   compiler/rustc_infer/src/infer/error_reporting/mod.rs
	modified:   compiler/rustc_span/src/span_encoding.rs
	modified:   compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs
	modified:   compiler/rustc_typeck/src/check/compare_method.rs
	modified:   compiler/rustc_typeck/src/check/fn_ctxt/checks.rs
	new file:   src/test/ui/type/issue-101208.rs
	new file:   src/test/ui/type/issue-101208.stderr
Copy link
Member

@compiler-errors compiler-errors left a comment

Choose a reason for hiding this comment

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

I feel like this logic overlaps very heavily with FnCtxt::suggest_fn_call -- is it possible to use that instead?

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.

6 participants