Skip to content

Commit 4a205bb

Browse files
authored
Rollup merge of #121328 - ffmancera:ff/verbose_long_type, r=compiler-errors
Make --verbose imply -Z write-long-types-to-disk=no When shortening the type it is necessary to take into account the `--verbose` flag, if it is activated, we must always show the entire type and not write it in a file. Fixes: #119130
2 parents 94e459f + e35481f commit 4a205bb

File tree

5 files changed

+24
-1
lines changed

5 files changed

+24
-1
lines changed

compiler/rustc_hir_typeck/src/method/suggest.rs

+6
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,9 @@ 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!(
373+
"consider using `--verbose` to print the full type name to the console"
374+
));
372375
}
373376

374377
err
@@ -493,6 +496,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
493496

494497
if let Some(file) = ty_file {
495498
err.note(format!("the full type name has been written to '{}'", file.display(),));
499+
err.note(format!(
500+
"consider using `--verbose` to print the full type name to the console"
501+
));
496502
}
497503
if rcvr_ty.references_error() {
498504
err.downgrade_to_delayed_bug();

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

+1
Original file line numberDiff line numberDiff line change
@@ -1935,6 +1935,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
19351935
"the full type name has been written to '{}'",
19361936
path.display(),
19371937
));
1938+
diag.note(format!("consider using `--verbose` to print the full type name to the console"));
19381939
}
19391940
}
19401941
}

compiler/rustc_middle/src/ty/error.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ impl<'tcx> TyCtxt<'tcx> {
351351
})
352352
.expect("could not write to `String`");
353353

354-
if !self.sess.opts.unstable_opts.write_long_types_to_disk {
354+
if !self.sess.opts.unstable_opts.write_long_types_to_disk || self.sess.opts.verbose {
355355
return regular;
356356
}
357357

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

+12
Original file line numberDiff line numberDiff line change
@@ -1283,6 +1283,9 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
12831283
"the full type name has been written to '{}'",
12841284
file.display()
12851285
));
1286+
err.note(format!(
1287+
"consider using `--verbose` to print full type name to the console"
1288+
));
12861289
}
12871290

12881291
if imm_ref_self_ty_satisfies_pred && mut_ref_self_ty_satisfies_pred {
@@ -2866,6 +2869,9 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
28662869
"the full name for the type has been written to '{}'",
28672870
file.display(),
28682871
));
2872+
err.note(format!(
2873+
"consider using `--verbose` to print the full type name to the console"
2874+
));
28692875
}
28702876
}
28712877
ObligationCauseCode::RepeatElementCopy {
@@ -3333,6 +3339,9 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
33333339
"the full type name has been written to '{}'",
33343340
file.display(),
33353341
));
3342+
err.note(format!(
3343+
"consider using `--verbose` to print the full type name to the console"
3344+
));
33363345
}
33373346
let mut parent_predicate = parent_trait_pred;
33383347
let mut data = &data.derived;
@@ -3386,6 +3395,9 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
33863395
"the full type name has been written to '{}'",
33873396
file.display(),
33883397
));
3398+
err.note(format!(
3399+
"consider using `--verbose` to print the full type name to the console"
3400+
));
33893401
}
33903402
}
33913403
// #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 the 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 the 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 the 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 the full type name to the console
7579

7680
error: aborting due to 4 previous errors
7781

0 commit comments

Comments
 (0)