about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorAlik Aslanyan <inline0@protonmail.com>2021-07-15 16:34:45 +0400
committerAlik Aslanyan <inline0@protonmail.com>2021-07-15 16:34:49 +0400
commitb69090102e409fd8139ab554fcd38e567fda470f (patch)
tree48687d34f889a34189694e01068b1c4313cfd289 /compiler
parent9c107816f7b351ea5b5043cdbec52901a77526de (diff)
downloadrust-b69090102e409fd8139ab554fcd38e567fda470f.tar.gz
rust-b69090102e409fd8139ab554fcd38e567fda470f.zip
Suggest full enum variant for local modules
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_typeck/src/check/demand.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/rustc_typeck/src/check/demand.rs b/compiler/rustc_typeck/src/check/demand.rs
index 33bc25accb3..3ea59906d3d 100644
--- a/compiler/rustc_typeck/src/check/demand.rs
+++ b/compiler/rustc_typeck/src/check/demand.rs
@@ -10,6 +10,7 @@ use rustc_hir::lang_items::LangItem;
 use rustc_hir::{is_range_literal, Node};
 use rustc_middle::lint::in_external_macro;
 use rustc_middle::ty::adjustment::AllowTwoPhase;
+use rustc_middle::ty::print::with_no_trimmed_paths;
 use rustc_middle::ty::{self, AssocItem, Ty, TypeAndMut};
 use rustc_span::symbol::sym;
 use rustc_span::Span;
@@ -201,7 +202,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
                     let sole_field = &variant.fields[0];
                     let sole_field_ty = sole_field.ty(self.tcx, substs);
                     if self.can_coerce(expr_ty, sole_field_ty) {
-                        let variant_path = self.tcx.def_path_str(variant.def_id);
+                        let variant_path =
+                            with_no_trimmed_paths(|| self.tcx.def_path_str(variant.def_id));
                         // FIXME #56861: DRYer prelude filtering
                         if let Some(path) = variant_path.strip_prefix("std::prelude::") {
                             if let Some((_, path)) = path.split_once("::") {