remove inhabitedness check
This commit is contained in:
parent
1205e82578
commit
93c1380e0b
5 changed files with 7 additions and 9 deletions
|
@ -16,7 +16,7 @@ impl<'tcx> MirPass<'tcx> for RemoveZsts {
|
||||||
StatementKind::Assign(box (place, _)) => {
|
StatementKind::Assign(box (place, _)) => {
|
||||||
let place_ty = place.ty(local_decls, tcx).ty;
|
let place_ty = place.ty(local_decls, tcx).ty;
|
||||||
if let Ok(layout) = tcx.layout_of(param_env.and(place_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(|| {
|
if tcx.consider_optimizing(|| {
|
||||||
format!(
|
format!(
|
||||||
"RemoveZsts - Place: {:?} SourceInfo: {:?}",
|
"RemoveZsts - Place: {:?} SourceInfo: {:?}",
|
||||||
|
|
|
@ -15,5 +15,5 @@ impl PrintName {
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let _ = PrintName::VOID;
|
let _ = PrintName::VOID;
|
||||||
//~^ ERROR erroneous constant used
|
//~^ ERROR erroneous constant encountered
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,12 +15,11 @@ LL | #![warn(const_err)]
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
= 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)
|
= 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
|
--> $DIR/panic-assoc-never-type.rs:17:13
|
||||||
|
|
|
|
||||||
LL | let _ = PrintName::VOID;
|
LL | let _ = PrintName::VOID;
|
||||||
| ^^^^^^^^^^^^^^^ referenced constant has errors
|
| ^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: aborting due to previous error; 1 warning emitted
|
error: aborting due to previous error; 1 warning emitted
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0080`.
|
|
||||||
|
|
|
@ -11,5 +11,5 @@ const VOID: ! = panic!();
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let _ = VOID;
|
let _ = VOID;
|
||||||
//~^ ERROR erroneous constant used
|
//~^ ERROR erroneous constant encountered
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,12 +15,11 @@ LL | #![warn(const_err)]
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
= 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)
|
= 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
|
--> $DIR/panic-never-type.rs:13:13
|
||||||
|
|
|
|
||||||
LL | let _ = VOID;
|
LL | let _ = VOID;
|
||||||
| ^^^^ referenced constant has errors
|
| ^^^^
|
||||||
|
|
||||||
error: aborting due to previous error; 1 warning emitted
|
error: aborting due to previous error; 1 warning emitted
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0080`.
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue