Skip to content

Conversation

WaffleLapkin
Copy link
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?

Previous:
  ```rust
  #![rustc_never_type_mode = "fallback_to_unit|..."]
  ```

New:
  ```rust
  #![rustc_never_type_options(fallback = "unit|...")]
  ```
This allows adding other options for other never-related experiments.
@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 Mar 21, 2024
@rust-log-analyzer

This comment has been minimized.

```rust
 #![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;
    };
}
```
@rust-cloud-vms rust-cloud-vms bot force-pushed the semicolon-vs-the-never branch from 2af16db to 93297bf Compare March 21, 2024 22:09
@compiler-errors
Copy link
Member

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Mar 21, 2024

📌 Commit 93297bf 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 Mar 21, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 22, 2024
…iaskrgr

Rollup of 11 pull requests

Successful merges:

 - rust-lang#121881 (std::net: adding acceptfilter feature for netbsd/freebsd.)
 - rust-lang#122817 (Doc Guarantee: BTree(Set|Map):  `IntoIter` Iterate in Sorted by key Order)
 - rust-lang#122826 (Add tests for shortcomings of associated type bounds)
 - rust-lang#122829 (Implement `FusedIterator` for `gen` block)
 - rust-lang#122831 (make failure logs less verbose)
 - rust-lang#122837 (add test for rust-lang#122549)
 - rust-lang#122838 (Avoid noop rewrite of issues.txt)
 - rust-lang#122841 (add 2 more tests for issues fixed by rust-lang#122749)
 - rust-lang#122843 (Add a never type option to make diverging blocks `()`)
 - rust-lang#122844 (add test for ice "cannot relate region: LUB(ReErased, ReError)")
 - rust-lang#122845 (Clippy subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit b469a6d into rust-lang:master Mar 22, 2024
@rustbot rustbot added this to the 1.79.0 milestone Mar 22, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Mar 22, 2024
Rollup merge of rust-lang#122843 - WaffleLapkin:semicolon-vs-the-never, r=compiler-errors

Add a never type option to make diverging blocks `()`

More experiments for ~~the blood god~~ T-lang!

Usage example:
```rust
 #![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?
@WaffleLapkin WaffleLapkin deleted the semicolon-vs-the-never branch March 22, 2024 09:43
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Apr 1, 2024
…ons, r=compiler-errors

Fixup parsing of `rustc_never_type_options` attribute

rust-lang#122843 had a copy paste error, which I did not caught when testing.

r? `@compiler-errors`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Apr 1, 2024
…ons, r=compiler-errors

Fixup parsing of `rustc_never_type_options` attribute

rust-lang#122843 had a copy paste error, which I did not caught when testing.

r? ``@compiler-errors``
workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Apr 1, 2024
…ons, r=compiler-errors

Fixup parsing of `rustc_never_type_options` attribute

rust-lang#122843 had a copy paste error, which I did not caught when testing.

r? ```@compiler-errors```
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 1, 2024
…s, r=compiler-errors

Fixup parsing of `rustc_never_type_options` attribute

rust-lang#122843 had a copy paste error, which I did not caught when testing.

r? `@compiler-errors`
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.

5 participants