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

compiler: die immediately instead of handling unknown target codegen #136833

Merged

Conversation

workingjubilee
Copy link
Member

We cannot produce anything useful if asked to compile unknown targets. We should handle the error immediately at the point of discovery instead of propagating it upward, and preferably in the simplest way: Die.

This allows cleaning up our "error-handling" spread across 5 crates.

We cannot produce anything useful if asked to compile unknown targets.
We should handle the error immediately at the point of discovery instead
of propagating it upward, and preferably in the simplest way: Die.

This allows cleaning up our "error-handling" spread across 5 crates.
@rustbot
Copy link
Collaborator

rustbot commented Feb 10, 2025

r? @lcnr

rustbot has assigned @lcnr.
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 Feb 10, 2025
@rustbot
Copy link
Collaborator

rustbot commented Feb 10, 2025

Some changes occurred to the CTFE machinery

cc @rust-lang/wg-const-eval

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri, @rust-lang/wg-const-eval

@workingjubilee
Copy link
Member Author

For more on why we should do this, I defer to https://burntsushi.net/unwrap/ as it is essentially the same problem.

@workingjubilee
Copy link
Member Author

also so far I haven't found a test that is diffed by this which suggests it never happens in our test suite, which means we just had a pile of untested code anyways.

@rust-log-analyzer

This comment has been minimized.

@rustbot
Copy link
Collaborator

rustbot commented Feb 10, 2025

Some changes occurred in compiler/rustc_codegen_gcc

cc @antoyo, @GuillaumeGomez

/// An error occurred during FnAbi computation: the passed --target lacks FFI support
/// (which unfortunately typeck does not reject).
/// Not using `FnAbiError` as that contains a nested `LayoutError`.
FnAbiAdjustForForeignAbi(rustc_target::callconv::AdjustForForeignAbiError),
Copy link
Member

Choose a reason for hiding this comment

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

Definitely happy to see this one go :)

@compiler-errors
Copy link
Member

I'm happy with turning this into a fatal or a delayed bug later on if we ever find a way to trigger this panic.

@compiler-errors
Copy link
Member

r=me if CI ends up green

@workingjubilee
Copy link
Member Author

@bors r=compiler-errors

@bors
Copy link
Contributor

bors commented Feb 10, 2025

📌 Commit fd58652 has been approved by compiler-errors

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 Feb 10, 2025
jhpratt added a commit to jhpratt/rust that referenced this pull request Feb 11, 2025
…be-impossible, r=compiler-errors

compiler: die immediately instead of handling unknown target codegen

We cannot produce anything useful if asked to compile unknown targets. We should handle the error immediately at the point of discovery instead of propagating it upward, and preferably in the simplest way: Die.

This allows cleaning up our "error-handling" spread across 5 crates.
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 11, 2025
Rollup of 6 pull requests

Successful merges:

 - rust-lang#134999 (Add cygwin target.)
 - rust-lang#135677 (Small `rustc_resolve` cleanups)
 - rust-lang#136699 (std: replace the `FromInner` implementation for addresses with private conversion functions)
 - rust-lang#136758 (tests: `-Copt-level=3` instead of `-O` in assembly tests)
 - rust-lang#136761 (tests: `-Copt-level=3` instead of `-O` in codegen tests)
 - rust-lang#136833 (compiler: die immediately instead of handling unknown target codegen)

Failed merges:

 - rust-lang#136808 (Try to recover from path sep error in type parsing)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 11, 2025
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#135285 (it-self → itself, build-system → build system, type-alias → type alias)
 - rust-lang#135677 (Small `rustc_resolve` cleanups)
 - rust-lang#136239 (show supported register classes in error message)
 - rust-lang#136246 (include note on variance and example)
 - rust-lang#136354 (Update docs for impl keyword)
 - rust-lang#136786 (Remove the deduplicate_blocks pass)
 - rust-lang#136833 (compiler: die immediately instead of handling unknown target codegen)
 - rust-lang#136847 (Simplify intra-crate qualifiers.)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 11, 2025
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#135285 (it-self → itself, build-system → build system, type-alias → type alias)
 - rust-lang#135677 (Small `rustc_resolve` cleanups)
 - rust-lang#136239 (show supported register classes in error message)
 - rust-lang#136246 (include note on variance and example)
 - rust-lang#136354 (Update docs for impl keyword)
 - rust-lang#136786 (Remove the deduplicate_blocks pass)
 - rust-lang#136833 (compiler: die immediately instead of handling unknown target codegen)
 - rust-lang#136847 (Simplify intra-crate qualifiers.)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 8ade6ba into rust-lang:master Feb 12, 2025
6 checks passed
@rustbot rustbot added this to the 1.86.0 milestone Feb 12, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Feb 12, 2025
Rollup merge of rust-lang#136833 - workingjubilee:let-the-impossible-be-impossible, r=compiler-errors

compiler: die immediately instead of handling unknown target codegen

We cannot produce anything useful if asked to compile unknown targets. We should handle the error immediately at the point of discovery instead of propagating it upward, and preferably in the simplest way: Die.

This allows cleaning up our "error-handling" spread across 5 crates.
@workingjubilee workingjubilee deleted the let-the-impossible-be-impossible branch February 13, 2025 00:44
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.

7 participants