about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/middle
diff options
context:
space:
mode:
authorb-naber <bn263@gmx.de>2021-02-18 21:01:44 +0100
committerb-naber <bn263@gmx.de>2021-05-11 14:09:46 +0200
commite4d9bc66f65fd3d206587c07e33c4877fda073f9 (patch)
tree1cbfff1dc8de7fd37b9c550e063d9e6256599676 /compiler/rustc_middle/src/middle
parentfe62c6e2958abfe54a9410a24a5750baf4c157e0 (diff)
downloadrust-e4d9bc66f65fd3d206587c07e33c4877fda073f9.tar.gz
rust-e4d9bc66f65fd3d206587c07e33c4877fda073f9.zip
improve diagnosts for GATs
Diffstat (limited to 'compiler/rustc_middle/src/middle')
-rw-r--r--compiler/rustc_middle/src/middle/resolve_lifetime.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/middle/resolve_lifetime.rs b/compiler/rustc_middle/src/middle/resolve_lifetime.rs
index aa6488b329e..2665ea8d7fd 100644
--- a/compiler/rustc_middle/src/middle/resolve_lifetime.rs
+++ b/compiler/rustc_middle/src/middle/resolve_lifetime.rs
@@ -49,6 +49,20 @@ pub enum Region {
     Free(DefId, /* lifetime decl */ DefId),
 }
 
+/// This is used in diagnostics to improve suggestions for missing generic arguments.
+/// It gives information on the type of lifetimes that are in scope for a particular `PathSegment`,
+/// so that we can e.g. suggest elided-lifetimes-in-paths of the form <'_, '_> e.g.
+#[derive(Clone, PartialEq, Eq, Hash, TyEncodable, TyDecodable, Debug, HashStable)]
+pub enum LifetimeScopeForPath {
+    // Contains all lifetime names that are in scope and could possibly be used in generics
+    // arguments of path.
+    NonElided(Vec<String>),
+
+    // Information that allows us to suggest args of the form `<'_>` in case
+    // no generic arguments were provided for a path.
+    Elided,
+}
+
 /// A set containing, at most, one known element.
 /// If two distinct values are inserted into a set, then it
 /// becomes `Many`, which can be used to detect ambiguities.