diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2021-11-26 23:07:21 +0100 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2021-11-30 22:56:47 +0100 |
| commit | aa2450f41bc49752c45b1b7d51a4b71098c0c9e8 (patch) | |
| tree | 11329f51b8b823d0e02136235d27941ae3a5a683 /compiler/rustc_ast_lowering/src | |
| parent | 72dc29c260cb6730449ed789c8a0ab4292acb7b0 (diff) | |
| download | rust-aa2450f41bc49752c45b1b7d51a4b71098c0c9e8.tar.gz rust-aa2450f41bc49752c45b1b7d51a4b71098c0c9e8.zip | |
Merge Implicit and ImplicitMissing.
Diffstat (limited to 'compiler/rustc_ast_lowering/src')
| -rw-r--r-- | compiler/rustc_ast_lowering/src/lib.rs | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index a561475c76a..2a246a99a70 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -1786,7 +1786,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { GenericArg::Lifetime(hir::Lifetime { hir_id: self.next_id(), span: self.lower_span(span), - name: hir::LifetimeName::Implicit, + name: hir::LifetimeName::Implicit(false), }))); let generic_args = self.arena.alloc_from_iter(generic_args); @@ -1927,8 +1927,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { }); let param_name = match lt.name { hir::LifetimeName::Param(param_name) => param_name, - hir::LifetimeName::Implicit - | hir::LifetimeName::ImplicitMissing + hir::LifetimeName::Implicit(_) | hir::LifetimeName::Underscore | hir::LifetimeName::Static => hir::ParamName::Plain(lt.name.ident()), hir::LifetimeName::ImplicitObjectLifetimeDefault => { @@ -2291,7 +2290,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { AnonymousLifetimeMode::ReportError => self.new_error_lifetime(None, span), - AnonymousLifetimeMode::PassThrough => self.new_implicit_lifetime(span), + AnonymousLifetimeMode::PassThrough => self.new_implicit_lifetime(span, false), } } @@ -2344,12 +2343,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { // lifetime. Instead, we simply create an implicit lifetime, which will be checked // later, at which point a suitable error will be emitted. AnonymousLifetimeMode::PassThrough | AnonymousLifetimeMode::ReportError => { - if param_mode == ParamMode::Explicit { - let id = self.resolver.next_node_id(); - self.new_named_lifetime(id, span, hir::LifetimeName::ImplicitMissing) - } else { - self.new_implicit_lifetime(span) - } + self.new_implicit_lifetime(span, param_mode == ParamMode::Explicit) } } } @@ -2392,11 +2386,11 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { r } - fn new_implicit_lifetime(&mut self, span: Span) -> hir::Lifetime { + fn new_implicit_lifetime(&mut self, span: Span, missing: bool) -> hir::Lifetime { hir::Lifetime { hir_id: self.next_id(), span: self.lower_span(span), - name: hir::LifetimeName::Implicit, + name: hir::LifetimeName::Implicit(missing), } } @@ -2543,9 +2537,7 @@ fn lifetimes_from_impl_trait_bounds( fn visit_lifetime(&mut self, lifetime: &'v hir::Lifetime) { let name = match lifetime.name { - hir::LifetimeName::Implicit - | hir::LifetimeName::ImplicitMissing - | hir::LifetimeName::Underscore => { + hir::LifetimeName::Implicit(_) | hir::LifetimeName::Underscore => { if self.collect_elided_lifetimes { // Use `'_` for both implicit and underscore lifetimes in // `type Foo<'_> = impl SomeTrait<'_>;`. |
