about summary refs log tree commit diff
path: root/compiler/rustc_resolve/src
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2022-05-14 11:25:53 +0200
committerCamille GILLOT <gillot.camille@gmail.com>2022-05-14 11:37:40 +0200
commitc98eae6b8f6553bf50ce62879205f01840a8cc85 (patch)
tree8aa24cf5b608dbf75033178f319d4db0a806e0d7 /compiler/rustc_resolve/src
parenteb1e588e1d48e713ff536fb546fb50128295fd1c (diff)
downloadrust-c98eae6b8f6553bf50ce62879205f01840a8cc85.tar.gz
rust-c98eae6b8f6553bf50ce62879205f01840a8cc85.zip
Forbid nested opaque types to reference HRTB from opaque types.
Diffstat (limited to 'compiler/rustc_resolve/src')
-rw-r--r--compiler/rustc_resolve/src/late/lifetimes.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/compiler/rustc_resolve/src/late/lifetimes.rs b/compiler/rustc_resolve/src/late/lifetimes.rs
index afb19d7df9f..35caeefe157 100644
--- a/compiler/rustc_resolve/src/late/lifetimes.rs
+++ b/compiler/rustc_resolve/src/late/lifetimes.rs
@@ -1036,6 +1036,20 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
                         }
                         self.uninsert_lifetime_on_error(lifetime, def.unwrap());
                     }
+                    if let hir::Node::Item(hir::Item {
+                        kind: hir::ItemKind::OpaqueTy { .. }, ..
+                    }) = self.tcx.hir().get(parent_id)
+                    {
+                        if !self.trait_definition_only {
+                            let mut err = self.tcx.sess.struct_span_err(
+                                lifetime.span,
+                                "higher kinded lifetime bounds on nested opaque types are not supported yet",
+                            );
+                            err.span_note(self.tcx.def_span(def_id), "lifetime declared here");
+                            err.emit();
+                        }
+                        self.uninsert_lifetime_on_error(lifetime, def.unwrap());
+                    }
                 }
 
                 // We want to start our early-bound indices at the end of the parent scope,