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

Inconsistent analysis results for unsafe blocks and operators #64093

Closed
rchaser53 opened this issue Sep 2, 2019 · 2 comments
Closed

Inconsistent analysis results for unsafe blocks and operators #64093

rchaser53 opened this issue Sep 2, 2019 · 2 comments

Comments

@rchaser53
Copy link
Contributor

related: rust-lang/rustfmt#3770
rust playground link: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=ef4769175cb5b4febb445b05c1e27b82

The second !unsafe block return &&bool. I think the second block should return bool.

fn return_bool() -> bool {
    unsafe { false }            // expected (), found bool
        && !unsafe { true }     // expected bool found &&bool
        && !unsafe { false }    // expected bool found bool
}
@Mark-Simulacrum
Copy link
Member

Simplifies to:

fn return_bool() -> bool {
    {
        false
    }
    && { false }     
        && { false } 
}

@nagisa
Copy link
Member

nagisa commented Sep 2, 2019

This is an expected corner-case in parsing. See #17930.

Closing.

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

3 participants