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

On argument position impl Trait<A> where A is not found, hide useles error #132082

Closed
wants to merge 1 commit into from

Conversation

estebank
Copy link
Contributor

When given

fn foo(filename: impl AsRef<NonExistent>) {
    std::fs::write(filename, "hello").unwrap();
}

Emit only an error about NonExistent, and avoid an error complaining that impl AsRef<NonExistent>: AsRef<NonExistent> is not satisfied.

By making the res corresponding to the impl AsRef<NonExistent> type paremeter be Res::Err, E0277 (and others) errors are silenced.

…less error

When given

```rust
fn foo(filename: impl AsRef<NonExistent>) {
    std::fs::write(filename, "hello").unwrap();
}
```

Emit only an error about `NonExistent`, and avoid an error complaining that
`impl AsRef<NonExistent>: AsRef<NonExistent>` is not satisfied.

By making the `res` corresponding to the `impl AsRef<NonExistent>` type
paremeter be `Res::Err`, E0277 (and others) errors are silenced.
@rustbot
Copy link
Collaborator

rustbot commented Oct 23, 2024

r? @pnkfelix

rustbot has assigned @pnkfelix.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@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 Oct 23, 2024
@estebank
Copy link
Contributor Author

Closing in favor of #132084

@estebank estebank closed this Oct 24, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Oct 24, 2024
…, r=lcnr,estebank

Consider param-env candidates even if they have errors

I added this logic in rust-lang#106309, but frankly I don't know why -- the logic was a very large hammer. It seems like recent changes to error tainting has made that no longer necessary.

Ideally we'd rework the way we handle error reporting in all of candidate assembly to be a bit more responsible; we're just suppressing candidates all willy-nilly and it leads to mysterious *other* errors cropping up, like the one that rust-lang#132082 originally wanted to fix.

**N.B.** This has the side-effect of turning a failed resolution like `where Missing: Sized` into a trivial where clause that matches all types, but also I don't think it really matters?

I'm putting this up as an alternative to rust-lang#132082, since that PR doesn't address the case when one desugars the APIT into a regular type param.

r? lcnr vibeck
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Oct 24, 2024
Rollup merge of rust-lang#132084 - compiler-errors:param-env-with-err, r=lcnr,estebank

Consider param-env candidates even if they have errors

I added this logic in rust-lang#106309, but frankly I don't know why -- the logic was a very large hammer. It seems like recent changes to error tainting has made that no longer necessary.

Ideally we'd rework the way we handle error reporting in all of candidate assembly to be a bit more responsible; we're just suppressing candidates all willy-nilly and it leads to mysterious *other* errors cropping up, like the one that rust-lang#132082 originally wanted to fix.

**N.B.** This has the side-effect of turning a failed resolution like `where Missing: Sized` into a trivial where clause that matches all types, but also I don't think it really matters?

I'm putting this up as an alternative to rust-lang#132082, since that PR doesn't address the case when one desugars the APIT into a regular type param.

r? lcnr vibeck
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.

3 participants