diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-09-10 16:19:40 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-09-12 08:40:12 +1000 |
| commit | d4fc76cbf386eeeb184bf0411af670912e9bc70d (patch) | |
| tree | d087fc48b6c9ed73893f1fe0b55f45abd3f9020c /compiler/rustc_resolve/src/diagnostics.rs | |
| parent | c2f74c3f928aeb503f15b4e9ef5778e77f3058b8 (diff) | |
| download | rust-d4fc76cbf386eeeb184bf0411af670912e9bc70d.tar.gz rust-d4fc76cbf386eeeb184bf0411af670912e9bc70d.zip | |
Introduce `'ra` lifetime name.
`rustc_resolve` allocates many things in `ResolverArenas`. The lifetime used for references into the arena is mostly `'a`, and sometimes `'b`. This commit changes it to `'ra`, which is much more descriptive. The commit also changes the order of lifetimes on a couple of structs so that '`ra` is second last, before `'tcx`, and does other minor renamings such as `'r` to `'a`.
Diffstat (limited to 'compiler/rustc_resolve/src/diagnostics.rs')
| -rw-r--r-- | compiler/rustc_resolve/src/diagnostics.rs | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index bcbdf627b56..f349713f22d 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -123,7 +123,7 @@ fn reduce_impl_span_to_impl_keyword(sm: &SourceMap, impl_span: Span) -> Span { sm.span_until_whitespace(impl_span) } -impl<'a, 'tcx> Resolver<'a, 'tcx> { +impl<'ra, 'tcx> Resolver<'ra, 'tcx> { pub(crate) fn dcx(&self) -> DiagCtxtHandle<'tcx> { self.tcx.dcx() } @@ -208,8 +208,8 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { parent: Module<'_>, ident: Ident, ns: Namespace, - new_binding: NameBinding<'a>, - old_binding: NameBinding<'a>, + new_binding: NameBinding<'ra>, + old_binding: NameBinding<'ra>, ) { // Error on the second of two conflicting names if old_binding.span.lo() > new_binding.span.lo() { @@ -531,7 +531,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { pub(crate) fn add_module_candidates( &mut self, - module: Module<'a>, + module: Module<'ra>, names: &mut Vec<TypoSuggestion>, filter_fn: &impl Fn(Res) -> bool, ctxt: Option<SyntaxContext>, @@ -553,7 +553,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { pub(crate) fn report_error( &mut self, span: Span, - resolution_error: ResolutionError<'a>, + resolution_error: ResolutionError<'ra>, ) -> ErrorGuaranteed { self.into_struct_error(span, resolution_error).emit() } @@ -561,7 +561,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { pub(crate) fn into_struct_error( &mut self, span: Span, - resolution_error: ResolutionError<'a>, + resolution_error: ResolutionError<'ra>, ) -> Diag<'_> { match resolution_error { ResolutionError::GenericParamsFromOuterItem( @@ -1020,8 +1020,8 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { /// Lookup typo candidate in scope for a macro or import. fn early_lookup_typo_candidate( &mut self, - scope_set: ScopeSet<'a>, - parent_scope: &ParentScope<'a>, + scope_set: ScopeSet<'ra>, + parent_scope: &ParentScope<'ra>, ident: Ident, filter_fn: &impl Fn(Res) -> bool, ) -> Option<TypoSuggestion> { @@ -1156,8 +1156,8 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { &mut self, lookup_ident: Ident, namespace: Namespace, - parent_scope: &ParentScope<'a>, - start_module: Module<'a>, + parent_scope: &ParentScope<'ra>, + start_module: Module<'ra>, crate_path: ThinVec<ast::PathSegment>, filter_fn: FilterFn, ) -> Vec<ImportSuggestion> @@ -1343,7 +1343,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { &mut self, lookup_ident: Ident, namespace: Namespace, - parent_scope: &ParentScope<'a>, + parent_scope: &ParentScope<'ra>, filter_fn: FilterFn, ) -> Vec<ImportSuggestion> where @@ -1421,7 +1421,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { &mut self, err: &mut Diag<'_>, macro_kind: MacroKind, - parent_scope: &ParentScope<'a>, + parent_scope: &ParentScope<'ra>, ident: Ident, krate: &Crate, ) { @@ -1749,7 +1749,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { None } - fn report_privacy_error(&mut self, privacy_error: &PrivacyError<'a>) { + fn report_privacy_error(&mut self, privacy_error: &PrivacyError<'ra>) { let PrivacyError { ident, binding, outermost_res, parent_scope, single_nested, dedup_span } = *privacy_error; @@ -1954,7 +1954,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { pub(crate) fn find_similarly_named_module_or_crate( &mut self, ident: Symbol, - current_module: Module<'a>, + current_module: Module<'ra>, ) -> Option<Symbol> { let mut candidates = self .extern_prelude @@ -1982,11 +1982,11 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { &mut self, path: &[Segment], opt_ns: Option<Namespace>, // `None` indicates a module path in import - parent_scope: &ParentScope<'a>, - ribs: Option<&PerNS<Vec<Rib<'a>>>>, - ignore_binding: Option<NameBinding<'a>>, - ignore_import: Option<Import<'a>>, - module: Option<ModuleOrUniformRoot<'a>>, + parent_scope: &ParentScope<'ra>, + ribs: Option<&PerNS<Vec<Rib<'ra>>>>, + ignore_binding: Option<NameBinding<'ra>>, + ignore_import: Option<Import<'ra>>, + module: Option<ModuleOrUniformRoot<'ra>>, failed_segment_idx: usize, ident: Ident, ) -> (String, Option<Suggestion>) { @@ -2228,7 +2228,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { &mut self, span: Span, mut path: Vec<Segment>, - parent_scope: &ParentScope<'a>, + parent_scope: &ParentScope<'ra>, ) -> Option<(Vec<Segment>, Option<String>)> { debug!("make_path_suggestion: span={:?} path={:?}", span, path); @@ -2263,7 +2263,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { fn make_missing_self_suggestion( &mut self, mut path: Vec<Segment>, - parent_scope: &ParentScope<'a>, + parent_scope: &ParentScope<'ra>, ) -> Option<(Vec<Segment>, Option<String>)> { // Replace first ident with `self` and check if that is valid. path[0].ident.name = kw::SelfLower; @@ -2282,7 +2282,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { fn make_missing_crate_suggestion( &mut self, mut path: Vec<Segment>, - parent_scope: &ParentScope<'a>, + parent_scope: &ParentScope<'ra>, ) -> Option<(Vec<Segment>, Option<String>)> { // Replace first ident with `crate` and check if that is valid. path[0].ident.name = kw::Crate; @@ -2313,7 +2313,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { fn make_missing_super_suggestion( &mut self, mut path: Vec<Segment>, - parent_scope: &ParentScope<'a>, + parent_scope: &ParentScope<'ra>, ) -> Option<(Vec<Segment>, Option<String>)> { // Replace first ident with `crate` and check if that is valid. path[0].ident.name = kw::Super; @@ -2335,7 +2335,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { fn make_external_crate_suggestion( &mut self, mut path: Vec<Segment>, - parent_scope: &ParentScope<'a>, + parent_scope: &ParentScope<'ra>, ) -> Option<(Vec<Segment>, Option<String>)> { if path[1].ident.span.is_rust_2015() { return None; @@ -2378,8 +2378,8 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { /// ``` pub(crate) fn check_for_module_export_macro( &mut self, - import: Import<'a>, - module: ModuleOrUniformRoot<'a>, + import: Import<'ra>, + module: ModuleOrUniformRoot<'ra>, ident: Ident, ) -> Option<(Option<Suggestion>, Option<String>)> { let ModuleOrUniformRoot::Module(mut crate_module) = module else { |
