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

Provide suggestion for const argument parsed as trait object #72273

Closed

Conversation

estebank
Copy link
Contributor

Split off #71592 as requested.

r? @petrochenkov

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 16, 2020
@petrochenkov
Copy link
Contributor

I'm unhappy with the cost/benefit ratio here and will try to come up with something less hacky.

@petrochenkov
Copy link
Contributor

Diagnostics for the test have two orthogonal issues.

The first one is

    //~| ERROR wrong number of const arguments: expected 1, found 0
    //~| ERROR wrong number of type arguments: expected 0, found 1

It is independent from trait objects, errors like this should probably be omitted in any of the arguments in question is poisoned by previous errors.

The second one is

    //~^ ERROR expected trait, found local variable `bar`

This looks like a material for fn smart_resolve_context_dependent_help which can add a note "this was parsed as a trait object" pointing to the full trait object type if trait is expected and value is found.
This will require adding a parent context field to PathSource::Trait similarly to how it's added to PathSource::Expr.

I may be able to implement the second item myself, but not earlier than the next weekend.

@petrochenkov petrochenkov 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 May 24, 2020
@Elinvynia Elinvynia 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 3, 2020
@Elinvynia Elinvynia 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 25, 2020
@bors
Copy link
Contributor

bors commented Jul 16, 2020

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

@petrochenkov
Copy link
Contributor

Closing due to inactivity.

bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 27, 2020
…ng-braces, r=petrochenkov

Suggest that expressions that look like const generic arguments should be enclosed in brackets

I pulled out the changes for const expressions from rust-lang#71592 (without the trait object diagnostic changes) and made some small changes; the implementation is `@estebank's.`

We're also going to want to make some changes separately to account for trait objects (they result in poor diagnostics, as is evident from one of the test cases here), such as an adaption of rust-lang#72273.

Fixes rust-lang#70753.

r? `@petrochenkov`
@estebank estebank deleted the const-expr-braces-part-deux branch November 9, 2023 05:16
@estebank estebank restored the const-expr-braces-part-deux branch November 9, 2023 05:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants