about summary refs log tree commit diff
path: root/compiler/rustc_ast_lowering/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-07-25 20:02:55 +0000
committerbors <bors@rust-lang.org>2022-07-25 20:02:55 +0000
commit6dbae3ad19309bb541d9e76638e6aa4b5449f29a (patch)
treea35d361e27036633b9422e60fae27c050e298ec8 /compiler/rustc_ast_lowering/src
parentbdf520fd419cd4dea184332f57206f1cf5ca3e8f (diff)
parentb9bd65e2ca68342bdb8ab56134677ad330d786ba (diff)
downloadrust-6dbae3ad19309bb541d9e76638e6aa4b5449f29a.tar.gz
rust-6dbae3ad19309bb541d9e76638e6aa4b5449f29a.zip
Auto merge of #97313 - cjgillot:ast-lifetimes-anon, r=petrochenkov
Resolve function lifetime elision on the AST

~Based on https://github.com/rust-lang/rust/pull/97720~

Lifetime elision for functions is purely syntactic in nature, so can be resolved on the AST.
This PR replicates the elision logic and diagnostics on the AST, and replaces HIR-based resolution by a `delay_span_bug`.

This refactor allows for more consistent diagnostics, which don't have to guess the original code from HIR.

r? `@petrochenkov`
Diffstat (limited to 'compiler/rustc_ast_lowering/src')
-rw-r--r--compiler/rustc_ast_lowering/src/lib.rs1
1 files changed, 0 insertions, 1 deletions
diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs
index 7cd360623ec..d4b41aad08c 100644
--- a/compiler/rustc_ast_lowering/src/lib.rs
+++ b/compiler/rustc_ast_lowering/src/lib.rs
@@ -1835,7 +1835,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
         debug!(?self.captured_lifetimes);
         let name = match res {
             LifetimeRes::Param { mut param, binder } => {
-                debug_assert_ne!(ident.name, kw::UnderscoreLifetime);
                 let p_name = ParamName::Plain(ident);
                 if let Some(mut captured_lifetimes) = self.captured_lifetimes.take() {
                     if !captured_lifetimes.binders_to_ignore.contains(&binder) {