diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2022-05-07 22:41:53 +0200 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2022-06-04 15:28:15 +0200 |
| commit | a07290047e6b27638f491ee7ebb90e20fece2a79 (patch) | |
| tree | 122b053ed54a3422253a96bbffd4ff4b9dfcdcc9 /compiler/rustc_middle/src | |
| parent | cb0584f86b8cfa952dffad55f7d83bd90765120f (diff) | |
| download | rust-a07290047e6b27638f491ee7ebb90e20fece2a79.tar.gz rust-a07290047e6b27638f491ee7ebb90e20fece2a79.zip | |
Compute lifetimes in scope at diagnostic time.
Diffstat (limited to 'compiler/rustc_middle/src')
| -rw-r--r-- | compiler/rustc_middle/src/hir/map/mod.rs | 6 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/middle/resolve_lifetime.rs | 3 |
2 files changed, 6 insertions, 3 deletions
diff --git a/compiler/rustc_middle/src/hir/map/mod.rs b/compiler/rustc_middle/src/hir/map/mod.rs index 779af7a3827..ebda9f7588d 100644 --- a/compiler/rustc_middle/src/hir/map/mod.rs +++ b/compiler/rustc_middle/src/hir/map/mod.rs @@ -298,6 +298,7 @@ impl<'hir> Map<'hir> { Node::Stmt(_) | Node::PathSegment(_) | Node::Ty(_) + | Node::TypeBinding(_) | Node::Infer(_) | Node::TraitRef(_) | Node::Pat(_) @@ -323,7 +324,8 @@ impl<'hir> Map<'hir> { } pub fn get_parent_node(self, hir_id: HirId) -> HirId { - self.find_parent_node(hir_id).unwrap() + self.find_parent_node(hir_id) + .unwrap_or_else(|| bug!("No parent for node {:?}", self.node_to_string(hir_id))) } /// Retrieves the `Node` corresponding to `id`, returning `None` if cannot be found. @@ -973,6 +975,7 @@ impl<'hir> Map<'hir> { .with_hi(seg.args.map_or_else(|| ident_span.hi(), |args| args.span_ext.hi())) } Node::Ty(ty) => ty.span, + Node::TypeBinding(tb) => tb.span, Node::TraitRef(tr) => tr.path.span, Node::Binding(pat) => pat.span, Node::Pat(pat) => pat.span, @@ -1205,6 +1208,7 @@ fn hir_id_to_string(map: Map<'_>, id: HirId) -> String { Some(Node::Stmt(_)) => node_str("stmt"), Some(Node::PathSegment(_)) => node_str("path segment"), Some(Node::Ty(_)) => node_str("type"), + Some(Node::TypeBinding(_)) => node_str("type binding"), Some(Node::TraitRef(_)) => node_str("trait ref"), Some(Node::Binding(_)) => node_str("local"), Some(Node::Pat(_)) => node_str("pat"), diff --git a/compiler/rustc_middle/src/middle/resolve_lifetime.rs b/compiler/rustc_middle/src/middle/resolve_lifetime.rs index cdc0d076801..7d0b751d35a 100644 --- a/compiler/rustc_middle/src/middle/resolve_lifetime.rs +++ b/compiler/rustc_middle/src/middle/resolve_lifetime.rs @@ -23,8 +23,7 @@ pub enum Region { pub enum LifetimeScopeForPath { /// Contains all lifetime names that are in scope and could possibly be used in generics /// arguments of path. - NonElided(Vec<LocalDefId>), - + NonElided, /// Information that allows us to suggest args of the form `<'_>` in case /// no generic arguments were provided for a path. Elided, |
