1

Add a never type option to make diverging blocks `()` by WaffleLapkin · Pull Req...

 1 month ago
source link: https://github.com/rust-lang/rust/pull/122843
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Conversation

Member

More experiments for the blood god T-lang!

Usage example:

 #![allow(internal_features)]
 #![feature(never_type, rustc_attrs)]
 #![rustc_never_type_options(diverging_block_default = "unit")]

fn main() {
    let _: u8 = { //~ error: expected `u8`, found `()`
        return;
    };
}

r? compiler-errors

I'm not sure how I feel about parsing the attribute every time we create FnCtxt. There must be a better way to do this, right?


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK