diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2017-03-02 21:15:26 -0500 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2017-03-30 07:55:29 -0400 |
| commit | 4c6c26eba1ca315677b024026a54001a5ab96cd0 (patch) | |
| tree | 8f529ab13033e07b3bbb7681643a1e63489a521c /src/rustllvm/RustWrapper.cpp | |
| parent | 066d44bc0d1680e2094867631920104049fd4948 (diff) | |
| download | rust-4c6c26eba1ca315677b024026a54001a5ab96cd0.tar.gz rust-4c6c26eba1ca315677b024026a54001a5ab96cd0.zip | |
change the strategy for diverging types
The new strategy is as follows. First, the `!` type is assigned
in two cases:
- a block with a diverging statement and no tail expression (e.g.,
`{return;}`);
- any expression with the type `!` is considered diverging.
Second, we track when we are in a diverging state, and we permit a value
of any type to be coerced **into** `!` if the expression that produced
it is diverging. This means that `fn foo() -> ! { panic!(); 22 }`
type-checks, even though the block has a type of `usize`.
Finally, coercions **from** the `!` type to any other are always
permitted.
Fixes #39808.
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
