Skip to content

Show more information when multiple impls apply - #114811

Merged
bors merged 7 commits into
rust-lang:masterfrom
estebank:impl-ambiguity
Oct 6, 2023
Merged

Show more information when multiple impls apply#114811
bors merged 7 commits into
rust-lang:masterfrom
estebank:impl-ambiguity

Conversation

@estebank

@estebank estebank commented Aug 14, 2023

Copy link
Copy Markdown
Contributor
  • When there are impls without type params, show only those (to avoid showing overly generic impls).
error[E0283]: type annotations needed
  --> $DIR/multiple-impl-apply.rs:34:9
   |
LL |     let y = x.into();
   |         ^     ---- type must be known at this point
   |
note: multiple `impl`s satisfying `_: From<Baz>` found
  --> $DIR/multiple-impl-apply.rs:14:1
   |
LL | impl From<Baz> for Bar {
   | ^^^^^^^^^^^^^^^^^^^^^^
...
LL | impl From<Baz> for Foo {
   | ^^^^^^^^^^^^^^^^^^^^^^
   = note: required for `Baz` to implement `Into<_>`
help: consider giving `y` an explicit type
   |
LL |     let y: /* Type */ = x.into();
   |          ++++++++++++
  • Lower the importance of T: Sized, T: WellFormed and coercion errors, to prioritize more relevant errors. The pre-existing deduplication logic deals with hiding redundant errors better that way, and we show errors with more metadata that is useful to the user.

  • Show <SelfTy as Trait>::assoc_fn suggestion in more cases.

error[E0790]: cannot call associated function on trait without specifying the corresponding `impl` type
  --> $DIR/cross-return-site-inference.rs:38:16
   |
LL |     return Err(From::from("foo"));
   |                ^^^^^^^^^^ cannot call associated function of trait
   |
help: use a fully-qualified path to a specific available implementation
   |
LL |     return Err(</* self type */ as From>::from("foo"));
   |                +++++++++++++++++++     +

Fix #88284.

@rustbot

rustbot commented Aug 14, 2023

Copy link
Copy Markdown
Collaborator

r? @wesleywiser

(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 Aug 14, 2023
@rustbot

ghost commented Aug 14, 2023

Copy link
Copy Markdown
Collaborator

Some changes occurred in engine.rs, potentially modifying the public API of ObligationCtxt.

cc @lcnr, @compiler-errors

@rust-log-analyzer

This comment was marked as resolved.

@rust-log-analyzer

This comment was marked as resolved.

@rustbot

ghost commented Aug 14, 2023

Copy link
Copy Markdown
Collaborator

Some changes occurred in need_type_info.rs

cc @lcnr

@rust-log-analyzer

This comment has been minimized.

Comment thread tests/ui/inference/question-mark-type-infer.stderr Outdated
@rust-log-analyzer

This comment has been minimized.

ghost left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you fix up the history of this PR as well? Some of the intermediate changes like formatting and rebase fallout can probably be squashed down into the PRs that they're most closely related to.

ghost Aug 14, 2023

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you find a better representative for E0282? This is trivially ambiguous, but I think this error should have a more descriptive example.

Also, the description below doesn't match this example.

@bors

ghost commented Sep 22, 2023

Copy link
Copy Markdown
Collaborator

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

@compiler-errors

ghost commented Sep 28, 2023

Copy link
Copy Markdown
Contributor

Needs rebase

@rust-log-analyzer

This comment has been minimized.

ghost left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

tidy error: /checkout/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs: too many lines (3023) (add // ignore-tidy-filelength to the file to suppress this error)

r=me when CI is green 🙂

@estebank

ghost commented Sep 28, 2023

Copy link
Copy Markdown
Contributor Author

Split the file instead.

@bors r=wesleywiser

@bors

ghost commented Sep 28, 2023

Copy link
Copy Markdown
Collaborator

📌 Commit b3eec8b has been approved by wesleywiser

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 Sep 28, 2023
@bors

ghost commented Sep 28, 2023

Copy link
Copy Markdown
Collaborator

⌛ Testing commit b3eec8b with merge 883fa79...

@bors bors added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 5, 2023
@estebank

ghost commented Oct 6, 2023

Copy link
Copy Markdown
Contributor Author

This better work or I'm gonna pull what remains of my hair out.

@bors r=wesleywiser

@bors

ghost commented Oct 6, 2023

Copy link
Copy Markdown
Collaborator

📌 Commit 4483ac2 has been approved by wesleywiser

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 6, 2023
@bors

ghost commented Oct 6, 2023

Copy link
Copy Markdown
Collaborator

⌛ Testing commit 4483ac2 with merge 94bc9c7...

@bors

ghost commented Oct 6, 2023

Copy link
Copy Markdown
Collaborator

☀️ Test successful - checks-actions
Approved by: wesleywiser
Pushing 94bc9c7 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Oct 6, 2023
@bors
bors merged commit 94bc9c7 into rust-lang:master Oct 6, 2023
@rustbot rustbot added this to the 1.75.0 milestone Oct 6, 2023
@jamesmunns

ghost commented Oct 6, 2023

Copy link
Copy Markdown
Contributor

Thank you @estebank!

@rust-timer

ghost commented Oct 7, 2023

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (94bc9c7): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
3.2% [3.2%, 3.2%] 1
Regressions ❌
(secondary)
4.3% [4.3%, 4.3%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-1.3% [-1.3%, -1.3%] 1
All ❌✅ (primary) 3.2% [3.2%, 3.2%] 1

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 623.951s -> 623.472s (-0.08%)
Artifact size: 270.64 MiB -> 270.63 MiB (-0.00%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged-by-bors This PR was explicitly merged by bors. 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.

Missing Type Annotations Error Lacks Suggestions

8 participants