about summary refs log tree commit diff
path: root/compiler/rustc_resolve
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2022-05-27 11:29:18 +0200
committerCamille GILLOT <gillot.camille@gmail.com>2022-06-03 08:26:10 +0200
commitc75409d5e423d0ba21a44eb7c2bf11df6bcf6072 (patch)
treea47e38918ccd43f294def2fe42a224f10ddd120d /compiler/rustc_resolve
parenta265c49b252a932b06a94d5715013c8311989139 (diff)
downloadrust-c75409d5e423d0ba21a44eb7c2bf11df6bcf6072.tar.gz
rust-c75409d5e423d0ba21a44eb7c2bf11df6bcf6072.zip
Do not lower generic lifetime params when AST resolution emitted an error.
Diffstat (limited to 'compiler/rustc_resolve')
-rw-r--r--compiler/rustc_resolve/src/late.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/rustc_resolve/src/late.rs b/compiler/rustc_resolve/src/late.rs
index 5c9074773de..06778b6c551 100644
--- a/compiler/rustc_resolve/src/late.rs
+++ b/compiler/rustc_resolve/src/late.rs
@@ -1939,6 +1939,9 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
                             param.ident,
                             orig_is_param,
                         );
+                        // Record lifetime res, so lowering knows there is something fishy.
+                        self.record_lifetime_res(param.id, LifetimeRes::Error);
+                        continue;
                     }
                     Entry::Vacant(entry) => {
                         entry.insert(true);
@@ -1966,6 +1969,8 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
                 )
                 .span_label(param.ident.span, "`'_` is a reserved lifetime name")
                 .emit();
+                // Record lifetime res, so lowering knows there is something fishy.
+                self.record_lifetime_res(param.id, LifetimeRes::Error);
                 continue;
             }
 
@@ -1979,6 +1984,8 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
                 )
                 .span_label(param.ident.span, "'static is a reserved lifetime name")
                 .emit();
+                // Record lifetime res, so lowering knows there is something fishy.
+                self.record_lifetime_res(param.id, LifetimeRes::Error);
                 continue;
             }