diff options
| author | bors <bors@rust-lang.org> | 2017-03-30 14:20:20 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2017-03-30 14:20:20 +0000 |
| commit | 7ae95e548929f4924905b2e8f87f2dd57d8bc887 (patch) | |
| tree | aceb2641992bb0d995e317bb38e119a6ad13710d /src/libstd | |
| parent | fe151194e9a919ab23c2bb356767a5cbfa3811e7 (diff) | |
| parent | 2414222b17f45e33d68582dd5ebe0083ed27b8cc (diff) | |
| download | rust-7ae95e548929f4924905b2e8f87f2dd57d8bc887.tar.gz rust-7ae95e548929f4924905b2e8f87f2dd57d8bc887.zip | |
Auto merge of #40224 - nikomatsakis:issue-39808, r=eddyb
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.
Fixes #39984.
Diffstat (limited to 'src/libstd')
0 files changed, 0 insertions, 0 deletions
