1
Fork 0

remove inhabitedness check

This commit is contained in:
Erik Desjardins 2021-03-17 20:31:00 -04:00
parent 1205e82578
commit 93c1380e0b
5 changed files with 7 additions and 9 deletions

View file

@ -16,7 +16,7 @@ impl<'tcx> MirPass<'tcx> for RemoveZsts {
StatementKind::Assign(box (place, _)) => {
let place_ty = place.ty(local_decls, tcx).ty;
if let Ok(layout) = tcx.layout_of(param_env.and(place_ty)) {
if layout.is_zst() && !layout.abi.is_uninhabited() {
if layout.is_zst() {
if tcx.consider_optimizing(|| {
format!(
"RemoveZsts - Place: {:?} SourceInfo: {:?}",

View file

@ -15,5 +15,5 @@ impl PrintName {
fn main() {
let _ = PrintName::VOID;
//~^ ERROR erroneous constant used
//~^ ERROR erroneous constant encountered
}

View file

@ -15,12 +15,11 @@ LL | #![warn(const_err)]
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
= note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0080]: erroneous constant used
error: erroneous constant encountered
--> $DIR/panic-assoc-never-type.rs:17:13
|
LL | let _ = PrintName::VOID;
| ^^^^^^^^^^^^^^^ referenced constant has errors
| ^^^^^^^^^^^^^^^
error: aborting due to previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0080`.

View file

@ -11,5 +11,5 @@ const VOID: ! = panic!();
fn main() {
let _ = VOID;
//~^ ERROR erroneous constant used
//~^ ERROR erroneous constant encountered
}

View file

@ -15,12 +15,11 @@ LL | #![warn(const_err)]
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
= note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0080]: erroneous constant used
error: erroneous constant encountered
--> $DIR/panic-never-type.rs:13:13
|
LL | let _ = VOID;
| ^^^^ referenced constant has errors
| ^^^^
error: aborting due to previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0080`.