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

Fix unreachable code warning for functions that return ! #265

Merged
merged 1 commit into from
Apr 11, 2024

Commits on Apr 11, 2024

  1. Fix unreachable code warning for functions that return !

    The generated code for function bodies produces an `unreachable_code`
    warning if the function has a `!` return type.
    
    The offending bit is:
    ```rust
    if let Some(__ret) == None::<!> {
      // unreachable
    }
    ```
    
    This PR fixes the warning by simply adding `#[allow(unreachable_code)]`
    to the return statement. It also adds a test for it.
    
    This problem can only be triggered on nightly with the `never_type`
    feature enabled, but it is easy to fix here.
    de-vri-es committed Apr 11, 2024
    Configuration menu
    Copy the full SHA
    c8d958d View commit details
    Browse the repository at this point in the history