Skip to content

Commit

Permalink
remove inhabitedness check
Browse files Browse the repository at this point in the history
  • Loading branch information
erikdesjardins committed Mar 18, 2021
1 parent 1205e82 commit 93c1380
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_mir/src/transform/remove_zsts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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: {:?}",
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/consts/const-eval/panic-assoc-never-type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ impl PrintName {

fn main() {
let _ = PrintName::VOID;
//~^ ERROR erroneous constant used
//~^ ERROR erroneous constant encountered
}
5 changes: 2 additions & 3 deletions src/test/ui/consts/const-eval/panic-assoc-never-type.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
2 changes: 1 addition & 1 deletion src/test/ui/consts/const-eval/panic-never-type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ const VOID: ! = panic!();

fn main() {
let _ = VOID;
//~^ ERROR erroneous constant used
//~^ ERROR erroneous constant encountered
}
5 changes: 2 additions & 3 deletions src/test/ui/consts/const-eval/panic-never-type.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

0 comments on commit 93c1380

Please sign in to comment.