Add more information to impl Trait error by compiler-errors · Pull Request #92806 · rust-lang/rust (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation9 Commits2 Checks0 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

compiler-errors

Fixes #92458

Let me know if I went overboard here, or if the suggestions could use some refinement.

r? @estebank
Feel free to reassign to someone else

@rustbot rustbot added the T-compiler

Relevant to the compiler team, which will review and decide on the PR/issue.

label

Jan 12, 2022

@compiler-errors

Alternatively we can disambiguate #92458 by just adding that word "inherent", without adding these ImplTraitPositions everywhere..

@bors

estebank

Choose a reason for hiding this comment

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

Couple of nitpicks, r=me after rebasing

Comment on lines 1403 to 1406

"`impl Trait` not allowed outside of \
function and inherent method return types",
);
err.note(&format!("found `impl Trait` in {}", position));

Choose a reason for hiding this comment

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

I'm concerned about "inherent" in this wording not being too clear. "associated functions" doesn't communicate the same meaning, sadly. Either way, I would likely change this to be

"`impl Trait` not allowed outside of \
function and inherent method return types",
);
err.note(&format!("found `impl Trait` in {}", position));
"`impl Trait` only allowed in function and inherent method return types, not in {}", position
);
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let name = match self {
ImplTraitPosition::Path => "path",
ImplTraitPosition::Variable => "variable",

Choose a reason for hiding this comment

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

ImplTraitPosition::Variable => "variable",
ImplTraitPosition::Variable => "variable binding",

@estebank estebank 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-review

Status: Awaiting review from the assignee but also interested parties.

labels

Feb 17, 2022

@compiler-errors

@compiler-errors

@compiler-errors

Rebased and addressed comments, ready for r+

@compiler-errors

@rustbot rustbot added S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

and removed S-waiting-on-author

Status: This is awaiting some action (such as code changes or more information) from the author.

labels

Feb 18, 2022

@estebank

@bors

📌 Commit 207fb5f has been approved by estebank

@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

Feb 18, 2022

bors added a commit to rust-lang-ci/rust that referenced this pull request

Feb 19, 2022

@bors

…askrgr

Rollup of 10 pull requests

Successful merges:

Failed merges:

r? @ghost @rustbot modify labels: rollup

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.