diff options
| author | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2020-04-16 13:48:17 +0300 |
|---|---|---|
| committer | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2020-04-16 19:00:30 +0300 |
| commit | e22d4795d849d2c6a229ccb666db922ae5b76410 (patch) | |
| tree | aa97f4f66ee4edc4fee0b0d8ce99d3c60f7e2068 | |
| parent | 2deb39dd1fd7525eedbb9067ca52dfa71eed4fab (diff) | |
| download | rust-e22d4795d849d2c6a229ccb666db922ae5b76410.tar.gz rust-e22d4795d849d2c6a229ccb666db922ae5b76410.zip | |
Partially revert "Do not ICE in the face of invalid enum discriminant"
This (partially) reverts commit f47c4ffdfacc783b3fe4bad395a6e16ae296b3d1.
| -rw-r--r-- | src/librustc_mir_build/hair/cx/expr.rs | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/librustc_mir_build/hair/cx/expr.rs b/src/librustc_mir_build/hair/cx/expr.rs index d2d99cf030d..21d632b9f6b 100644 --- a/src/librustc_mir_build/hair/cx/expr.rs +++ b/src/librustc_mir_build/hair/cx/expr.rs @@ -12,7 +12,7 @@ use rustc_middle::ty::adjustment::{ Adjust, Adjustment, AutoBorrow, AutoBorrowMutability, PointerCast, }; use rustc_middle::ty::subst::{InternalSubsts, SubstsRef}; -use rustc_middle::ty::{self, AdtKind, Ty, TypeFoldable}; +use rustc_middle::ty::{self, AdtKind, Ty}; use rustc_span::Span; impl<'tcx> Mirror<'tcx> for &'tcx hir::Expr<'tcx> { @@ -718,7 +718,8 @@ fn convert_path_expr<'a, 'tcx>( Res::Def(DefKind::Ctor(_, CtorKind::Const), def_id) => { let user_provided_types = cx.tables.user_provided_types(); - let user_ty = user_provided_types.get(expr.hir_id).copied(); + let user_provided_type = user_provided_types.get(expr.hir_id).copied(); + debug!("convert_path_expr: user_provided_type={:?}", user_provided_type); let ty = cx.tables().node_type(expr.hir_id); match ty.kind { // A unit struct/variant which is used as a value. @@ -727,17 +728,10 @@ fn convert_path_expr<'a, 'tcx>( adt_def, variant_index: adt_def.variant_index_with_ctor_id(def_id), substs, - user_ty, + user_ty: user_provided_type, fields: vec![], base: None, }, - _ if ty.references_error() => { - // Handle degenerate input without ICE (#67377). - ExprKind::Literal { - literal: ty::Const::zero_sized(cx.tcx, cx.tcx.types.err), - user_ty: None, - } - } _ => bug!("unexpected ty: {:?}", ty), } } |
