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

Prefer non-[type error] candidates during selection #106309

Merged
merged 2 commits into from
Jan 12, 2023

Conversation

compiler-errors
Copy link
Member

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

Fixes #102130
Fixes #106351

r? types

note: Alternatively we could filter out error where-clauses during param-env construction? But we still need to filter out impls with errors during match_impl, I think.

@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 Dec 30, 2022
@compiler-errors compiler-errors force-pushed the prefer-non-err-candidates branch from 11e6fa3 to b6cbd21 Compare January 1, 2023 23:48
@compiler-errors compiler-errors force-pushed the prefer-non-err-candidates branch from b6cbd21 to db6d3b3 Compare January 1, 2023 23:51
@oli-obk
Copy link
Contributor

oli-obk commented Jan 9, 2023

Nice!

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Jan 9, 2023

📌 Commit db6d3b3 has been approved by oli-obk

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 Jan 9, 2023
JohnTitor pushed a commit to JohnTitor/rust that referenced this pull request Jan 9, 2023
…didates, r=oli-obk

Prefer non-`[type error]` candidates during selection

Fixes rust-lang#102130
Fixes rust-lang#106351

r? types

note: Alternatively we could filter out error where-clauses during param-env construction? But we still need to filter out impls with errors during `match_impl`, I think.
compiler-errors added a commit to compiler-errors/rust that referenced this pull request Jan 9, 2023
…didates, r=oli-obk

Prefer non-`[type error]` candidates during selection

Fixes rust-lang#102130
Fixes rust-lang#106351

r? types

note: Alternatively we could filter out error where-clauses during param-env construction? But we still need to filter out impls with errors during `match_impl`, I think.
@JohnTitor
Copy link
Member

@bors r-
Needs a rebase and bless tests, it seems.

@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 Jan 9, 2023
@compiler-errors compiler-errors force-pushed the prefer-non-err-candidates branch from db6d3b3 to 83fbc71 Compare January 11, 2023 20:14
@compiler-errors
Copy link
Member Author

Rebased

@bors r=oli-obk

@bors
Copy link
Contributor

bors commented Jan 11, 2023

📌 Commit 83fbc71 has been approved by oli-obk

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 Jan 11, 2023
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Jan 12, 2023
…didates, r=oli-obk

Prefer non-`[type error]` candidates during selection

Fixes rust-lang#102130
Fixes rust-lang#106351

r? types

note: Alternatively we could filter out error where-clauses during param-env construction? But we still need to filter out impls with errors during `match_impl`, I think.
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 12, 2023
…iaskrgr

Rollup of 10 pull requests

Successful merges:

 - rust-lang#106167 (Fix invalid syntax and incomplete suggestion in impl Trait parameter type suggestions for E0311)
 - rust-lang#106309 (Prefer non-`[type error]` candidates during selection)
 - rust-lang#106532 (Allow codegen to unsize `dyn*` to `dyn`)
 - rust-lang#106596 (Hide more of long types in E0271)
 - rust-lang#106638 (std tests: use __OsLocalKeyInner from realstd)
 - rust-lang#106676 (Test that we cannot use trait impl methods arguments as defining uses)
 - rust-lang#106702 (Conserve cause of `ImplDerivedObligation` in E0599)
 - rust-lang#106732 (rustc_llvm: replace llvm::makeArrayRef with ArrayRef constructors.)
 - rust-lang#106733 (Revert "warn newer available version of the x tool")
 - rust-lang#106748 (Clean up `OnUnimplementedFormatString::verify`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 9b538e8 into rust-lang:master Jan 12, 2023
@rustbot rustbot added this to the 1.68.0 milestone Jan 12, 2023
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Jan 23, 2023
…etrochenkov

Filter param-env predicates for errors before calling `to_opt_poly_trait_pred`

cc rust-lang#106309 rust-lang#106757 (comment)

r? `@ghost`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jul 25, 2023
…b-naber

Don't say that a type is uncallable if its fn signature has errors in it

This is fallout from rust-lang#106309, where we don't consider param-env candidates that reference errors because they unify with everything. This means, however, that we don't consider an APIT like `impl Fn(MissingType)` isn't considered to implement `Fn`, for example.

We can double-check that with a weaker heuristic [`extract_callable_info`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir_typeck/fn_ctxt/struct.FnCtxt.html#method.extract_callable_info), and suppress the knock-down error using that.

Fixes rust-lang#113566
@compiler-errors compiler-errors deleted the prefer-non-err-candidates branch August 11, 2023 20:13
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-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
5 participants