]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_typeck/check/demand.rs
Auto merge of #43270 - petrochenkov:fixstab, r=alexcrichton
[rust.git] / src / librustc_typeck / check / demand.rs
index 26d51178f4d7ba10847cb3170f1787148a6e604d..828106df7821b2e1b435c295b4b3a40c471d36c4 100644 (file)
@@ -106,7 +106,10 @@ pub fn demand_coerce_diag(&self,
                         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) {
-                            compatible_variants.push(variant.name);
+                            let mut variant_path = self.tcx.item_path_str(variant.did);
+                            variant_path = variant_path.trim_left_matches("std::prelude::v1::")
+                                .to_string();
+                            compatible_variants.push(variant_path);
                         }
                     }
                 }
@@ -117,7 +120,6 @@ pub fn demand_coerce_diag(&self,
                     err.span_suggestions(expr.span,
                                          "perhaps you meant to use a variant of the expected type",
                                          suggestions);
-                    return Some(err);
                 }
             }