about summary refs log tree commit diff
path: root/src/librustc/infer
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2019-12-15 22:20:30 -0800
committerEsteban Küber <esteban@kuber.com.ar>2020-01-08 09:30:27 -0800
commit0dcdbaec0b49a149316719b32241d8975bd192c9 (patch)
treeb27c7c6580e22fe4acc7d4b4b64f95ac0b9613e9 /src/librustc/infer
parentc55615155d161c8abb307db0019ab58545cd246b (diff)
downloadrust-0dcdbaec0b49a149316719b32241d8975bd192c9.tar.gz
rust-0dcdbaec0b49a149316719b32241d8975bd192c9.zip
Point at the def span of trait refs E0277
Diffstat (limited to 'src/librustc/infer')
-rw-r--r--src/librustc/infer/error_reporting/mod.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/librustc/infer/error_reporting/mod.rs b/src/librustc/infer/error_reporting/mod.rs
index d0243dad700..d736d45a5a4 100644
--- a/src/librustc/infer/error_reporting/mod.rs
+++ b/src/librustc/infer/error_reporting/mod.rs
@@ -71,6 +71,7 @@ use rustc_hir::Node;
 use errors::{
     pluralize, struct_span_err, Applicability, DiagnosticBuilder, DiagnosticStyledString,
 };
+use rustc_data_structures::fx::{FxHashMap, FxHashSet};
 use rustc_error_codes::*;
 use rustc_span::{DesugaringKind, Pos, Span};
 use rustc_target::spec::abi;
@@ -1362,9 +1363,15 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
                 let kind = match t.kind {
                     ty::Closure(..) => "closure",
                     ty::Opaque(..) => "opaque type",
+                    ty::Generator(..) => "generator",
+                    ty::Foreign(..) => "foreign type",
                     _ => "",
                 };
-                if let ty::Closure(def_id, _) | ty::Opaque(def_id, _) = t.kind {
+                if let ty::Closure(def_id, _)
+                | ty::Opaque(def_id, _)
+                | ty::Generator(def_id, ..)
+                | ty::Foreign(def_id) = t.kind
+                {
                     let span = self.tcx.def_span(def_id);
                     // Avoid cluttering the output when the "found" and error span overlap:
                     //