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

Suggest .into() when all other coercion suggestions fail #102496

Merged
merged 1 commit into from
Oct 5, 2022

Conversation

compiler-errors
Copy link
Member

@compiler-errors compiler-errors commented Sep 30, 2022

Also removes some bogus suggestions because we now short-circuit when offering coercion suggestions(instead of, for example, suggesting every one that could possibly apply)

Fixes #102415

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

r? @nagisa

(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 Sep 30, 2022
@compiler-errors
Copy link
Member Author

r? diagnostics

@rust-highfive rust-highfive assigned davidtwco and unassigned nagisa Sep 30, 2022
@bors
Copy link
Contributor

bors commented Oct 1, 2022

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

vec![(expr.span.shrink_to_lo(), "(".to_owned()), (expr.span.shrink_to_hi(), ").into()".to_owned())]
};
diag.multipart_suggestion(
format!("call `into` on this expression to convert `{expr_ty}` into `{expected_ty}`"),
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
format!("call `into` on this expression to convert `{expr_ty}` into `{expected_ty}`"),
format!("call `std::convert::Into::into` on this expression to convert `{expr_ty}` into `{expected_ty}`"),

I agree with @lukaslueg that this might be clearer, maybe just Into::into?

@davidtwco
Copy link
Member

r=me after resolving comment

@compiler-errors
Copy link
Member Author

@bors r=davidtwco

@bors
Copy link
Contributor

bors commented Oct 4, 2022

📌 Commit 6eb33f1f3221824f08f79893647e8672c7ef9e96 has been approved by davidtwco

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 Oct 4, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 4, 2022
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#102441 (Suggest unwrap_or_else when a closure is given)
 - rust-lang#102547 (Migrate CSS theme for search results)
 - rust-lang#102567 (Delay evaluating lint primary message until after it would be suppressed)
 - rust-lang#102624 (rustdoc: remove font family CSS on `.rustdoc-toggle summary::before`)
 - rust-lang#102628 (Change the parameter name of From::from to `value`)
 - rust-lang#102637 (Ignore fuchsia on two compiler tests)
 - rust-lang#102639 (Improve spans when splitting multi-char operator tokens for proc macros.)

Failed merges:

 - rust-lang#102496 (Suggest `.into()` when all other coercion suggestions fail)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors
Copy link
Contributor

bors commented Oct 4, 2022

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

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Oct 4, 2022
@compiler-errors
Copy link
Member Author

@bors r=davidtwco

@bors
Copy link
Contributor

bors commented Oct 5, 2022

📌 Commit 28eda9b has been approved by davidtwco

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 5, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 5, 2022
Rollup of 5 pull requests

Successful merges:

 - rust-lang#100986 (Stop suggesting adding generic args for turbofish)
 - rust-lang#101061 (panic-on-uninit: adjust checks to 0x01-filling)
 - rust-lang#102440 (Only export `__tls_*` on wasm32-unknown-unknown.)
 - rust-lang#102496 (Suggest `.into()` when all other coercion suggestions fail)
 - rust-lang#102699 (Fix hamburger button color)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit cec087a into rust-lang:master Oct 5, 2022
@rustbot rustbot added this to the 1.66.0 milestone Oct 5, 2022
@compiler-errors compiler-errors deleted the into-suggestion branch November 2, 2022 02:56
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.

E0308 should suggest .into() if available
7 participants