X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=compiler%2Frustc_hir_typeck%2Fsrc%2Fexpr.rs;h=91f65b8c0f21f6e74054bf74993e414419d1e402;hb=a673364c543986789cfbb844c925063519fb872a;hp=2764de751b08bc3fd52211d37500ddfa27bd58d8;hpb=9a9569698bc42aa59a78bcb1a2a889b43e32acec;p=rust.git diff --git a/compiler/rustc_hir_typeck/src/expr.rs b/compiler/rustc_hir_typeck/src/expr.rs index 2764de751b0..91f65b8c0f2 100644 --- a/compiler/rustc_hir_typeck/src/expr.rs +++ b/compiler/rustc_hir_typeck/src/expr.rs @@ -533,8 +533,8 @@ pub(crate) fn check_expr_path( self.set_tainted_by_errors(e); tcx.ty_error_with_guaranteed(e) } - Res::Def(DefKind::Ctor(_, CtorKind::Fictive), _) => { - let e = report_unexpected_variant_res(tcx, res, qpath, expr.span); + Res::Def(DefKind::Variant, _) => { + let e = report_unexpected_variant_res(tcx, res, qpath, expr.span, "E0533", "value"); tcx.ty_error_with_guaranteed(e) } _ => self.instantiate_value_path(segs, opt_ty, res, expr.span, expr.hir_id).0, @@ -1118,9 +1118,8 @@ fn check_expr_assign( let lhs_deref_ty_is_sized = self .infcx .type_implements_trait( - self.tcx.lang_items().sized_trait().unwrap(), - lhs_deref_ty, - ty::List::empty(), + self.tcx.require_lang_item(LangItem::Sized, None), + [lhs_deref_ty], self.param_env, ) .may_apply(); @@ -2025,8 +2024,8 @@ fn report_unknown_field( ); let variant_ident_span = self.tcx.def_ident_span(variant.def_id).unwrap(); - match variant.ctor_kind { - CtorKind::Fn => match ty.kind() { + match variant.ctor_kind() { + Some(CtorKind::Fn) => match ty.kind() { ty::Adt(adt, ..) if adt.is_enum() => { err.span_label( variant_ident_span,