about summary refs log tree commit diff
path: root/src/librustc
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-09-05 12:41:41 +0000
committerbors <bors@rust-lang.org>2019-09-05 12:41:41 +0000
commit618768492f0c731fcb770dc2d178abe840846419 (patch)
tree03b29a334b63823cf779ad069df33cbb620518ba /src/librustc
parent97767238814fd4bd3ce8a3972184b29fefb4923e (diff)
parentafc7e0e9d3945dbb9799752e3a83c749fdd26320 (diff)
downloadrust-618768492f0c731fcb770dc2d178abe840846419.tar.gz
rust-618768492f0c731fcb770dc2d178abe840846419.zip
Auto merge of #64172 - Centril:rollup-8i8oh54, r=Centril
Rollup of 11 pull requests

Successful merges:

 - #62848 (Use unicode-xid crate instead of libcore)
 - #63774 (Fix `window.hashchange is not a function`)
 - #63930 (Account for doc comments coming from proc macros without spans)
 - #64003 (place: Passing `align` = `layout.align.abi`, when also passing `layout`)
 - #64030 (Fix unlock ordering in SGX synchronization primitives)
 - #64041 (use TokenStream rather than &[TokenTree] for built-in macros)
 - #64051 (Add x86_64-linux-kernel target)
 - #64063 (Fix const_err with `-(-0.0)`)
 - #64083 (Point at appropriate arm on type error on if/else/match with one non-! arm)
 - #64100 (Fix const eval bug breaking run-pass tests in Miri)
 - #64157 (Opaque type locations in error message for clarity.)

Failed merges:

r? @ghost
Diffstat (limited to 'src/librustc')
-rw-r--r--src/librustc/infer/error_reporting/mod.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/librustc/infer/error_reporting/mod.rs b/src/librustc/infer/error_reporting/mod.rs
index bf9cb79fb8a..5883be6e268 100644
--- a/src/librustc/infer/error_reporting/mod.rs
+++ b/src/librustc/infer/error_reporting/mod.rs
@@ -1136,12 +1136,19 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
         if let Some((expected, found)) = expected_found {
             match (terr, is_simple_error, expected == found) {
                 (&TypeError::Sorts(ref values), false, true) => {
+                    let sort_string = | a_type: Ty<'tcx> |
+                        if let ty::Opaque(def_id, _) = a_type.sty {
+                            format!(" (opaque type at {})", self.tcx.sess.source_map()
+                                .mk_substr_filename(self.tcx.def_span(def_id)))
+                        } else {
+                            format!(" ({})", a_type.sort_string(self.tcx))
+                        };
                     diag.note_expected_found_extra(
                         &"type",
                         expected,
                         found,
-                        &format!(" ({})", values.expected.sort_string(self.tcx)),
-                        &format!(" ({})", values.found.sort_string(self.tcx)),
+                        &sort_string(values.expected),
+                        &sort_string(values.found),
                     );
                 }
                 (_, false, _) => {