about summary refs log tree commit diff
path: root/src/test/ui/thinlto
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-05-10 20:31:06 +0200
committerGitHub <noreply@github.com>2019-05-10 20:31:06 +0200
commitd94cb9f2ea86a088a970c6cf741efaef6fb6ed16 (patch)
tree7d5b594335fc716277a8514376971a6f84ef651d /src/test/ui/thinlto
parentcff1bdbd77d29a28a94ff9f5bf1e1c84e5bb6259 (diff)
parent1f0fb0391caf232dacabdf73fbbb84f2452b25c1 (diff)
downloadrust-d94cb9f2ea86a088a970c6cf741efaef6fb6ed16.tar.gz
rust-d94cb9f2ea86a088a970c6cf741efaef6fb6ed16.zip
Rollup merge of #60529 - davidtwco:rfc-2008-uninhabited, r=petrochenkov
RFC 2008: Uninhabitedness fixes for enum variants and tests

Part of #44109.

At the request of @Centril, this PR adds tests asserting that uninhabited non-exhaustive types are considered inhabited in extern crates. In adding these tests, I fixed an oversight in the implementation of RFC 2008 on enum variants that resulted in non-exhaustive enum variants being considered uninhabited in extern crates.

Before this PR, these lines would error:

```rust
// extern crate
pub enum UninhabitedVariants {
    #[non_exhaustive] Tuple(!),
    #[non_exhaustive] Struct { x: ! }
}

pub enum PartiallyInhabitedVariants {
    Tuple(u8),
    #[non_exhaustive] Struct { x: ! }
}

// current crate
match uninhabited_variant() /* fn() -> Option<UninhabitedVariants> */ {
    Some(_x) => (), //~ ERROR unreachable pattern
    None => (),
}

while let PartiallyInhabitedVariants::Struct { x, .. } = partially_inhabited_variant() /* fn() -> PartiallyInhabitedVariants */ {
    //~^ ERROR unreachable pattern
}
```

cc @Centril
r? @petrochenkov
Diffstat (limited to 'src/test/ui/thinlto')
0 files changed, 0 insertions, 0 deletions