@@ -29,7 +29,7 @@ use rustc_span::{BytePos, Span, SyntaxContext};
2929use thin_vec:: ThinVec ;
3030
3131use crate :: errors as errs;
32- use crate :: imports:: { Import , ImportKind , ImportResolver } ;
32+ use crate :: imports:: { Import , ImportKind } ;
3333use crate :: late:: { PatternSource , Rib } ;
3434use crate :: path_names_to_string;
3535use crate :: { AmbiguityError , AmbiguityErrorMisc , AmbiguityKind , BindingError , Finalize } ;
@@ -1888,15 +1888,13 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
18881888 ( format ! ( "use of undeclared crate or module `{}`" , ident) , suggestion)
18891889 }
18901890 }
1891- }
18921891
1893- impl < ' a , ' b , ' tcx > ImportResolver < ' a , ' b , ' tcx > {
18941892 /// Adds suggestions for a path that cannot be resolved.
18951893 pub ( crate ) fn make_path_suggestion (
18961894 & mut self ,
18971895 span : Span ,
18981896 mut path : Vec < Segment > ,
1899- parent_scope : & ParentScope < ' b > ,
1897+ parent_scope : & ParentScope < ' a > ,
19001898 ) -> Option < ( Vec < Segment > , Option < String > ) > {
19011899 debug ! ( "make_path_suggestion: span={:?} path={:?}" , span, path) ;
19021900
@@ -1931,11 +1929,11 @@ impl<'a, 'b, 'tcx> ImportResolver<'a, 'b, 'tcx> {
19311929 fn make_missing_self_suggestion (
19321930 & mut self ,
19331931 mut path : Vec < Segment > ,
1934- parent_scope : & ParentScope < ' b > ,
1932+ parent_scope : & ParentScope < ' a > ,
19351933 ) -> Option < ( Vec < Segment > , Option < String > ) > {
19361934 // Replace first ident with `self` and check if that is valid.
19371935 path[ 0 ] . ident . name = kw:: SelfLower ;
1938- let result = self . r . maybe_resolve_path ( & path, None , parent_scope) ;
1936+ let result = self . maybe_resolve_path ( & path, None , parent_scope) ;
19391937 debug ! ( "make_missing_self_suggestion: path={:?} result={:?}" , path, result) ;
19401938 if let PathResult :: Module ( ..) = result { Some ( ( path, None ) ) } else { None }
19411939 }
@@ -1950,11 +1948,11 @@ impl<'a, 'b, 'tcx> ImportResolver<'a, 'b, 'tcx> {
19501948 fn make_missing_crate_suggestion (
19511949 & mut self ,
19521950 mut path : Vec < Segment > ,
1953- parent_scope : & ParentScope < ' b > ,
1951+ parent_scope : & ParentScope < ' a > ,
19541952 ) -> Option < ( Vec < Segment > , Option < String > ) > {
19551953 // Replace first ident with `crate` and check if that is valid.
19561954 path[ 0 ] . ident . name = kw:: Crate ;
1957- let result = self . r . maybe_resolve_path ( & path, None , parent_scope) ;
1955+ let result = self . maybe_resolve_path ( & path, None , parent_scope) ;
19581956 debug ! ( "make_missing_crate_suggestion: path={:?} result={:?}" , path, result) ;
19591957 if let PathResult :: Module ( ..) = result {
19601958 Some ( (
@@ -1981,11 +1979,11 @@ impl<'a, 'b, 'tcx> ImportResolver<'a, 'b, 'tcx> {
19811979 fn make_missing_super_suggestion (
19821980 & mut self ,
19831981 mut path : Vec < Segment > ,
1984- parent_scope : & ParentScope < ' b > ,
1982+ parent_scope : & ParentScope < ' a > ,
19851983 ) -> Option < ( Vec < Segment > , Option < String > ) > {
19861984 // Replace first ident with `crate` and check if that is valid.
19871985 path[ 0 ] . ident . name = kw:: Super ;
1988- let result = self . r . maybe_resolve_path ( & path, None , parent_scope) ;
1986+ let result = self . maybe_resolve_path ( & path, None , parent_scope) ;
19891987 debug ! ( "make_missing_super_suggestion: path={:?} result={:?}" , path, result) ;
19901988 if let PathResult :: Module ( ..) = result { Some ( ( path, None ) ) } else { None }
19911989 }
@@ -2003,7 +2001,7 @@ impl<'a, 'b, 'tcx> ImportResolver<'a, 'b, 'tcx> {
20032001 fn make_external_crate_suggestion (
20042002 & mut self ,
20052003 mut path : Vec < Segment > ,
2006- parent_scope : & ParentScope < ' b > ,
2004+ parent_scope : & ParentScope < ' a > ,
20072005 ) -> Option < ( Vec < Segment > , Option < String > ) > {
20082006 if path[ 1 ] . ident . span . is_rust_2015 ( ) {
20092007 return None ;
@@ -2013,13 +2011,13 @@ impl<'a, 'b, 'tcx> ImportResolver<'a, 'b, 'tcx> {
20132011 // 1) some consistent ordering for emitted diagnostics, and
20142012 // 2) `std` suggestions before `core` suggestions.
20152013 let mut extern_crate_names =
2016- self . r . extern_prelude . iter ( ) . map ( |( ident, _) | ident. name ) . collect :: < Vec < _ > > ( ) ;
2014+ self . extern_prelude . iter ( ) . map ( |( ident, _) | ident. name ) . collect :: < Vec < _ > > ( ) ;
20172015 extern_crate_names. sort_by ( |a, b| b. as_str ( ) . partial_cmp ( a. as_str ( ) ) . unwrap ( ) ) ;
20182016
20192017 for name in extern_crate_names. into_iter ( ) {
20202018 // Replace first ident with a crate name and check if that is valid.
20212019 path[ 0 ] . ident . name = name;
2022- let result = self . r . maybe_resolve_path ( & path, None , parent_scope) ;
2020+ let result = self . maybe_resolve_path ( & path, None , parent_scope) ;
20232021 debug ! (
20242022 "make_external_crate_suggestion: name={:?} path={:?} result={:?}" ,
20252023 name, path, result
@@ -2046,8 +2044,8 @@ impl<'a, 'b, 'tcx> ImportResolver<'a, 'b, 'tcx> {
20462044 /// ```
20472045 pub ( crate ) fn check_for_module_export_macro (
20482046 & mut self ,
2049- import : & ' b Import < ' b > ,
2050- module : ModuleOrUniformRoot < ' b > ,
2047+ import : & ' a Import < ' a > ,
2048+ module : ModuleOrUniformRoot < ' a > ,
20512049 ident : Ident ,
20522050 ) -> Option < ( Option < Suggestion > , Option < String > ) > {
20532051 let ModuleOrUniformRoot :: Module ( mut crate_module) = module else {
@@ -2064,8 +2062,8 @@ impl<'a, 'b, 'tcx> ImportResolver<'a, 'b, 'tcx> {
20642062 return None ;
20652063 }
20662064
2067- let resolutions = self . r . resolutions ( crate_module) . borrow ( ) ;
2068- let resolution = resolutions. get ( & self . r . new_key ( ident, MacroNS ) ) ?;
2065+ let resolutions = self . resolutions ( crate_module) . borrow ( ) ;
2066+ let resolution = resolutions. get ( & self . new_key ( ident, MacroNS ) ) ?;
20692067 let binding = resolution. borrow ( ) . binding ( ) ?;
20702068 if let Res :: Def ( DefKind :: Macro ( MacroKind :: Bang ) , _) = binding. res ( ) {
20712069 let module_name = crate_module. kind . name ( ) . unwrap ( ) ;
@@ -2086,7 +2084,7 @@ impl<'a, 'b, 'tcx> ImportResolver<'a, 'b, 'tcx> {
20862084 // ie. `use a::b::{c, d, e};`
20872085 // ^^^
20882086 let ( found_closing_brace, binding_span) = find_span_of_binding_until_next_binding (
2089- self . r . tcx . sess ,
2087+ self . tcx . sess ,
20902088 import. span ,
20912089 import. use_span ,
20922090 ) ;
@@ -2105,7 +2103,7 @@ impl<'a, 'b, 'tcx> ImportResolver<'a, 'b, 'tcx> {
21052103 // ie. `use a::b::{c, d};`
21062104 // ^^^
21072105 if let Some ( previous_span) =
2108- extend_span_to_previous_binding ( self . r . tcx . sess , binding_span)
2106+ extend_span_to_previous_binding ( self . tcx . sess , binding_span)
21092107 {
21102108 debug ! ( "check_for_module_export_macro: previous_span={:?}" , previous_span) ;
21112109 removal_span = removal_span. with_lo ( previous_span. lo ( ) ) ;
@@ -2123,7 +2121,7 @@ impl<'a, 'b, 'tcx> ImportResolver<'a, 'b, 'tcx> {
21232121 // or `use a::{b, c, d}};`
21242122 // ^^^^^^^^^^^
21252123 let ( has_nested, after_crate_name) = find_span_immediately_after_crate_name (
2126- self . r . tcx . sess ,
2124+ self . tcx . sess ,
21272125 module_name,
21282126 import. use_span ,
21292127 ) ;
@@ -2132,7 +2130,7 @@ impl<'a, 'b, 'tcx> ImportResolver<'a, 'b, 'tcx> {
21322130 has_nested, after_crate_name
21332131 ) ;
21342132
2135- let source_map = self . r . tcx . sess . source_map ( ) ;
2133+ let source_map = self . tcx . sess . source_map ( ) ;
21362134
21372135 // Make sure this is actually crate-relative.
21382136 let is_definitely_crate = import
0 commit comments