-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #54125 - varkor:less-conservative-uninhabitedness-check…
…, r=<try> Less conservative uninhabitedness check Extends the uninhabitedness check to structs, non-empty enums, tuples and arrays. Pulled out of #47291 and #50262. Blocked on #54123. r? @nikomatsakis
- Loading branch information
Showing
12 changed files
with
61 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,25 @@ | ||
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
// NOTE Instantiating an empty enum is UB. This test may break in the future. | ||
|
||
// LLDB can't handle zero-sized values | ||
// | ||
// LLDB can't handle zero-sized values. | ||
// ignore-lldb | ||
|
||
|
||
// compile-flags:-g | ||
// gdb-command:run | ||
|
||
// gdb-command:print first | ||
// gdb-command:print *first | ||
// gdbg-check:$1 = {<No data fields>} | ||
// gdbr-check:$1 = <error reading variable> | ||
|
||
// gdb-command:print second | ||
// gdbg-check:$2 = {<No data fields>} | ||
// gdbr-check:$2 = <error reading variable> | ||
|
||
#![allow(unused_variables)] | ||
#![feature(omit_gdb_pretty_printer_section)] | ||
#![feature(maybe_uninit)] | ||
#![omit_gdb_pretty_printer_section] | ||
|
||
use std::mem::MaybeUninit; | ||
|
||
enum ANilEnum {} | ||
enum AnotherNilEnum {} | ||
enum Void {} | ||
|
||
// This test relies on gdbg printing the string "{<No data fields>}" for empty | ||
// structs (which may change some time) | ||
// The error from gdbr is expected since nil enums are not supposed to exist. | ||
fn main() { | ||
unsafe { | ||
let first: ANilEnum = MaybeUninit::uninitialized().into_inner(); | ||
let second: AnotherNilEnum = MaybeUninit::uninitialized().into_inner(); | ||
let first: *const Void = 1 as *const _; | ||
|
||
zzz(); // #break | ||
} | ||
zzz(); // #break | ||
} | ||
|
||
fn zzz() {()} | ||
fn zzz() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters