about summary refs log tree commit diff
path: root/src/librustc
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2020-02-18 16:35:47 -0800
committerEsteban Küber <esteban@kuber.com.ar>2020-02-28 11:37:59 -0800
commit8119d0853d6f227c5e36ab423b6e2f22604fa87d (patch)
tree18d6127a160b0e44ed86f433f54bc488ad3eeb22 /src/librustc
parentad4777dbca1d4d1b052db01b1191862c9fbbad64 (diff)
downloadrust-8119d0853d6f227c5e36ab423b6e2f22604fa87d.tar.gz
rust-8119d0853d6f227c5e36ab423b6e2f22604fa87d.zip
Track all predicates in errors, not just trait obligations
Surface associated type projection bounds that could not be fulfilled in
E0599 errors. Always present the list of unfulfilled trait bounds,
regardless of whether we're pointing at the ADT or trait that didn't
satisfy it.
Diffstat (limited to 'src/librustc')
-rw-r--r--src/librustc/traits/mod.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/librustc/traits/mod.rs b/src/librustc/traits/mod.rs
index b05bd26f048..77c612cf34a 100644
--- a/src/librustc/traits/mod.rs
+++ b/src/librustc/traits/mod.rs
@@ -581,6 +581,20 @@ impl<'tcx, N> Vtable<'tcx, N> {
         }
     }
 
+    pub fn borrow_nested_obligations(&self) -> &[N] {
+        match &self {
+            VtableImpl(i) => &i.nested[..],
+            VtableParam(n) => &n[..],
+            VtableBuiltin(i) => &i.nested[..],
+            VtableAutoImpl(d) => &d.nested[..],
+            VtableClosure(c) => &c.nested[..],
+            VtableGenerator(c) => &c.nested[..],
+            VtableObject(d) => &d.nested[..],
+            VtableFnPointer(d) => &d.nested[..],
+            VtableTraitAlias(d) => &d.nested[..],
+        }
+    }
+
     pub fn map<M, F>(self, f: F) -> Vtable<'tcx, M>
     where
         F: FnMut(N) -> M,