@@ -30,7 +30,7 @@ use rustc_span::hygiene::MacroKind;
30
30
use rustc_span:: source_map:: SourceMap ;
31
31
use rustc_span:: { BytePos , Ident , Span , Symbol , SyntaxContext , kw, sym} ;
32
32
use thin_vec:: { ThinVec , thin_vec} ;
33
- use tracing:: debug;
33
+ use tracing:: { debug, instrument } ;
34
34
35
35
use crate :: errors:: {
36
36
self , AddedMacroUse , ChangeImportBinding , ChangeImportBindingSuggestion , ConsiderAddingADerive ,
@@ -2235,14 +2235,13 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
2235
2235
}
2236
2236
2237
2237
/// Adds suggestions for a path that cannot be resolved.
2238
+ #[ instrument( level = "debug" , skip( self , parent_scope) ) ]
2238
2239
pub ( crate ) fn make_path_suggestion (
2239
2240
& mut self ,
2240
2241
span : Span ,
2241
2242
mut path : Vec < Segment > ,
2242
2243
parent_scope : & ParentScope < ' ra > ,
2243
2244
) -> Option < ( Vec < Segment > , Option < String > ) > {
2244
- debug ! ( "make_path_suggestion: span={:?} path={:?}" , span, path) ;
2245
-
2246
2245
match ( path. get ( 0 ) , path. get ( 1 ) ) {
2247
2246
// `{{root}}::ident::...` on both editions.
2248
2247
// On 2015 `{{root}}` is usually added implicitly.
@@ -2271,6 +2270,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
2271
2270
/// LL | use foo::Bar;
2272
2271
/// | ^^^ did you mean `self::foo`?
2273
2272
/// ```
2273
+ #[ instrument( level = "debug" , skip( self , parent_scope) ) ]
2274
2274
fn make_missing_self_suggestion (
2275
2275
& mut self ,
2276
2276
mut path : Vec < Segment > ,
@@ -2279,7 +2279,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
2279
2279
// Replace first ident with `self` and check if that is valid.
2280
2280
path[ 0 ] . ident . name = kw:: SelfLower ;
2281
2281
let result = self . maybe_resolve_path ( & path, None , parent_scope, None ) ;
2282
- debug ! ( "make_missing_self_suggestion: path={:?} result={:?}" , path, result) ;
2282
+ debug ! ( ? path, ? result) ;
2283
2283
if let PathResult :: Module ( ..) = result { Some ( ( path, None ) ) } else { None }
2284
2284
}
2285
2285
@@ -2290,6 +2290,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
2290
2290
/// LL | use foo::Bar;
2291
2291
/// | ^^^ did you mean `crate::foo`?
2292
2292
/// ```
2293
+ #[ instrument( level = "debug" , skip( self , parent_scope) ) ]
2293
2294
fn make_missing_crate_suggestion (
2294
2295
& mut self ,
2295
2296
mut path : Vec < Segment > ,
@@ -2298,7 +2299,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
2298
2299
// Replace first ident with `crate` and check if that is valid.
2299
2300
path[ 0 ] . ident . name = kw:: Crate ;
2300
2301
let result = self . maybe_resolve_path ( & path, None , parent_scope, None ) ;
2301
- debug ! ( "make_missing_crate_suggestion: path={:?} result={:?}" , path, result) ;
2302
+ debug ! ( ? path, ? result) ;
2302
2303
if let PathResult :: Module ( ..) = result {
2303
2304
Some ( (
2304
2305
path,
@@ -2321,6 +2322,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
2321
2322
/// LL | use foo::Bar;
2322
2323
/// | ^^^ did you mean `super::foo`?
2323
2324
/// ```
2325
+ #[ instrument( level = "debug" , skip( self , parent_scope) ) ]
2324
2326
fn make_missing_super_suggestion (
2325
2327
& mut self ,
2326
2328
mut path : Vec < Segment > ,
@@ -2329,7 +2331,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
2329
2331
// Replace first ident with `crate` and check if that is valid.
2330
2332
path[ 0 ] . ident . name = kw:: Super ;
2331
2333
let result = self . maybe_resolve_path ( & path, None , parent_scope, None ) ;
2332
- debug ! ( "make_missing_super_suggestion: path={:?} result={:?}" , path, result) ;
2334
+ debug ! ( ? path, ? result) ;
2333
2335
if let PathResult :: Module ( ..) = result { Some ( ( path, None ) ) } else { None }
2334
2336
}
2335
2337
@@ -2343,6 +2345,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
2343
2345
///
2344
2346
/// Used when importing a submodule of an external crate but missing that crate's
2345
2347
/// name as the first part of path.
2348
+ #[ instrument( level = "debug" , skip( self , parent_scope) ) ]
2346
2349
fn make_external_crate_suggestion (
2347
2350
& mut self ,
2348
2351
mut path : Vec < Segment > ,
@@ -2363,10 +2366,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
2363
2366
// Replace first ident with a crate name and check if that is valid.
2364
2367
path[ 0 ] . ident . name = name;
2365
2368
let result = self . maybe_resolve_path ( & path, None , parent_scope, None ) ;
2366
- debug ! (
2367
- "make_external_crate_suggestion: name={:?} path={:?} result={:?}" ,
2368
- name, path, result
2369
- ) ;
2369
+ debug ! ( ?path, ?name, ?result) ;
2370
2370
if let PathResult :: Module ( ..) = result {
2371
2371
return Some ( ( path, None ) ) ;
2372
2372
}
@@ -2433,10 +2433,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
2433
2433
import. span ,
2434
2434
import. use_span ,
2435
2435
) ;
2436
- debug ! (
2437
- "check_for_module_export_macro: found_closing_brace={:?} binding_span={:?}" ,
2438
- found_closing_brace, binding_span
2439
- ) ;
2436
+ debug ! ( found_closing_brace, ?binding_span) ;
2440
2437
2441
2438
let mut removal_span = binding_span;
2442
2439
if found_closing_brace {
@@ -2450,11 +2447,11 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
2450
2447
if let Some ( previous_span) =
2451
2448
extend_span_to_previous_binding ( self . tcx . sess , binding_span)
2452
2449
{
2453
- debug ! ( "check_for_module_export_macro: previous_span={:?}" , previous_span) ;
2450
+ debug ! ( ? previous_span) ;
2454
2451
removal_span = removal_span. with_lo ( previous_span. lo ( ) ) ;
2455
2452
}
2456
2453
}
2457
- debug ! ( "check_for_module_export_macro: removal_span={:?}" , removal_span) ;
2454
+ debug ! ( ? removal_span) ;
2458
2455
2459
2456
// Remove the `removal_span`.
2460
2457
corrections. push ( ( removal_span, "" . to_string ( ) ) ) ;
@@ -2470,10 +2467,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
2470
2467
module_name,
2471
2468
import. use_span ,
2472
2469
) ;
2473
- debug ! (
2474
- "check_for_module_export_macro: has_nested={:?} after_crate_name={:?}" ,
2475
- has_nested, after_crate_name
2476
- ) ;
2470
+ debug ! ( has_nested, ?after_crate_name) ;
2477
2471
2478
2472
let source_map = self . tcx . sess . source_map ( ) ;
2479
2473
@@ -2677,15 +2671,12 @@ fn extend_span_to_previous_binding(sess: &Session, binding_span: Span) -> Option
2677
2671
/// use foo::{a, b::{c, d}};
2678
2672
/// // ^^^^^^^^^^^^^^^ -- true
2679
2673
/// ```
2674
+ #[ instrument( level = "debug" , skip( sess) ) ]
2680
2675
fn find_span_immediately_after_crate_name (
2681
2676
sess : & Session ,
2682
2677
module_name : Symbol ,
2683
2678
use_span : Span ,
2684
2679
) -> ( bool , Span ) {
2685
- debug ! (
2686
- "find_span_immediately_after_crate_name: module_name={:?} use_span={:?}" ,
2687
- module_name, use_span
2688
- ) ;
2689
2680
let source_map = sess. source_map ( ) ;
2690
2681
2691
2682
// Using `use issue_59764::foo::{baz, makro};` as an example throughout..
0 commit comments