Skip to content

Commit 6b72095

Browse files
committed
Suggest using --verbose when writing type to a file
1 parent e54ef0a commit 6b72095

File tree

4 files changed

+19
-0
lines changed

4 files changed

+19
-0
lines changed

compiler/rustc_hir_typeck/src/method/suggest.rs

+2
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
369369
};
370370
if let Some(file) = file {
371371
err.note(format!("the full type name has been written to '{}'", file.display()));
372+
err.note(format!("consider using --verbose to print full type name to console"));
372373
}
373374

374375
err
@@ -493,6 +494,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
493494

494495
if let Some(file) = ty_file {
495496
err.note(format!("the full type name has been written to '{}'", file.display(),));
497+
err.note(format!("consider using --verbose to print full type name to the console"));
496498
}
497499
if rcvr_ty.references_error() {
498500
err.downgrade_to_delayed_bug();

compiler/rustc_infer/src/infer/error_reporting/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1931,6 +1931,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
19311931
"the full type name has been written to '{}'",
19321932
path.display(),
19331933
));
1934+
diag.note(format!("consider using --verbose to print full type name to the console"));
19341935
}
19351936
}
19361937
}

compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs

+12
Original file line numberDiff line numberDiff line change
@@ -1554,6 +1554,9 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
15541554
"the full type name has been written to '{}'",
15551555
file.display()
15561556
));
1557+
err.note(format!(
1558+
"consider using --verbose to print full type name to the console"
1559+
));
15571560
}
15581561

15591562
if imm_ref_self_ty_satisfies_pred && mut_ref_self_ty_satisfies_pred {
@@ -3133,6 +3136,9 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
31333136
"the full name for the type has been written to '{}'",
31343137
file.display(),
31353138
));
3139+
err.note(format!(
3140+
"consider using --verbose to print full type name to the console"
3141+
));
31363142
}
31373143
}
31383144
ObligationCauseCode::RepeatElementCopy {
@@ -3600,6 +3606,9 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
36003606
"the full type name has been written to '{}'",
36013607
file.display(),
36023608
));
3609+
err.note(format!(
3610+
"consider using --verbose to print full type name to the console"
3611+
));
36033612
}
36043613
let mut parent_predicate = parent_trait_pred;
36053614
let mut data = &data.derived;
@@ -3653,6 +3662,9 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
36533662
"the full type name has been written to '{}'",
36543663
file.display(),
36553664
));
3665+
err.note(format!(
3666+
"consider using --verbose to print full type name to the console"
3667+
));
36563668
}
36573669
}
36583670
// #74711: avoid a stack overflow

tests/ui/diagnostic-width/long-E0308.stderr

+4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ LL | | ))))))))))))))))))))))))))))));
2121
= note: expected struct `Atype<Btype<..., ...>, ...>`
2222
found enum `Result<Result<..., ...>, ...>`
2323
= note: the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308/long-E0308.long-type-hash.txt'
24+
= note: consider using --verbose to print full type name to the console
2425

2526
error[E0308]: mismatched types
2627
--> $DIR/long-E0308.rs:57:26
@@ -36,6 +37,7 @@ LL | | ))))))))))))))))))))))));
3637
= note: expected enum `Option<Result<..., ...>>`
3738
found enum `Result<Result<..., ...>, ...>`
3839
= note: the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308/long-E0308.long-type-hash.txt'
40+
= note: consider using --verbose to print full type name to the console
3941

4042
error[E0308]: mismatched types
4143
--> $DIR/long-E0308.rs:88:9
@@ -55,6 +57,7 @@ LL | | > = ();
5557
= note: expected struct `Atype<Btype<..., ...>, ...>`
5658
found unit type `()`
5759
= note: the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308/long-E0308.long-type-hash.txt'
60+
= note: consider using --verbose to print full type name to the console
5861

5962
error[E0308]: mismatched types
6063
--> $DIR/long-E0308.rs:91:17
@@ -72,6 +75,7 @@ LL | | ))))))))))))))))))))))));
7275
= note: expected unit type `()`
7376
found enum `Result<Result<..., ...>, ...>`
7477
= note: the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308/long-E0308.long-type-hash.txt'
78+
= note: consider using --verbose to print full type name to the console
7579

7680
error: aborting due to 4 previous errors
7781

0 commit comments

Comments
 (0)