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

Don't codegen impossible to satisfy impls #109110

Merged
merged 1 commit into from
Mar 14, 2023

Conversation

compiler-errors
Copy link
Member

Fixes #109098

@rustbot
Copy link
Collaborator

rustbot commented Mar 14, 2023

r? @jackh726

(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 Mar 14, 2023
@jackh726
Copy link
Member

This is certainly a way to do this. But just want to clarify.

When we monomorphize an impl with type parameters, we check that the where clauses hold, right? But this is after we've already type checked the call sites and errored on use. I guess we can't eagerly monomorphize those impls?

Might be worth expanding the comment a little bit. r=me after that

@compiler-errors
Copy link
Member Author

Left a more descriptive error message.

I guess we can't eagerly monomorphize those impls?

Yeah, we only eagerly monomorphize impls with no ty/ct params.

When we monomorphize an impl with type parameters, we check that the where clauses hold, right?

We don't actually have to re-check where-clauses during monomorphization in general. If something is reachable by fn main, then it must "inductively" have its where-clauses satisfied after monomorphization, we can never call something impossible from main since it has no where-clauses. Probably not the best explanation, not sure how to put it into other words.

This breaks down for eager monomorphization since we monomorphize impls with no type params that are not necessarily called by anything.

@compiler-errors
Copy link
Member Author

@bors r=jackh726

@bors
Copy link
Contributor

bors commented Mar 14, 2023

📌 Commit b36bbb0 has been approved by jackh726

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 Mar 14, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 14, 2023
…iaskrgr

Rollup of 9 pull requests

Successful merges:

 - rust-lang#108722 (Support for Fuchsia RISC-V target)
 - rust-lang#108880 (Remove tests/ui/impl-trait/in-trait/new-lowering-strategy in favor of using revisions on existing tests)
 - rust-lang#108909 (Fix object safety checks for new RPITITs)
 - rust-lang#108915 (Remove some direct calls to local_def_id_to_hir_id on diagnostics)
 - rust-lang#108923 (Make fns from other crates with RPITIT work for -Zlower-impl-trait-in-trait-to-assoc-ty)
 - rust-lang#109101 (Fall back to old metadata computation when type references errors)
 - rust-lang#109105 (Don't ICE for late-bound consts across `AnonConstBoundary`)
 - rust-lang#109110 (Don't codegen impossible to satisfy impls)
 - rust-lang#109116 (Emit diagnostic when calling methods on the unit type in method chains)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit b88c675 into rust-lang:master Mar 14, 2023
@rustbot rustbot added this to the 1.70.0 milestone Mar 14, 2023
@compiler-errors compiler-errors deleted the impossible-impl-mono branch August 11, 2023 20:03
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
Development

Successfully merging this pull request may close these issues.

ICE: failed to resolve instance for .. -Zprint-mono-items=eager
5 participants