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

Consider emitting unreachable!() for absurd cases #19

Open
workingjubilee opened this issue Mar 19, 2024 · 1 comment
Open

Consider emitting unreachable!() for absurd cases #19

workingjubilee opened this issue Mar 19, 2024 · 1 comment

Comments

@workingjubilee
Copy link

workingjubilee commented Mar 19, 2024

In https://arxiv.org/pdf/2108.02995.pdf section 5.5 you say:

Handling absurd cases.

We follow the general strategy outlined in Section 5.1.3. The natural choice for implementing the elimination principle for an empty type is to use Rust’s panic! macro. In this case the elimination principle for False extracts to the following Rust code.

fn False_rect<P: Copy>(&’a self, u: ( ) ) -> P {
    panic!("Absurd case!")
}

We identify pattern-matchings with no branches at the pretty-printing stage and insert the
panic! macro

Have you considered simply reducing this to just emitting unreachable!(), which, as it diverges, will trivially unify with the other arms of a match expression where relevant? Using the stdlib macro will allow it to pick up any code-size improvements in this specific panic we manage to garner.

@spitters
Copy link
Contributor

spitters commented Mar 19, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants