Skip to content

Make --verbose imply -Z write-long-types-to-disk=no #121328

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions compiler/rustc_hir_typeck/src/method/suggest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
};
if let Some(file) = file {
err.note(format!("the full type name has been written to '{}'", file.display()));
err.note(format!(
"consider using `--verbose` to print the full type name to the console"
));
}

err
Expand Down Expand Up @@ -493,6 +496,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {

if let Some(file) = ty_file {
err.note(format!("the full type name has been written to '{}'", file.display(),));
err.note(format!(
"consider using `--verbose` to print the full type name to the console"
));
}
if rcvr_ty.references_error() {
err.downgrade_to_delayed_bug();
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_infer/src/infer/error_reporting/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1931,6 +1931,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
"the full type name has been written to '{}'",
path.display(),
));
diag.note(format!("consider using `--verbose` to print the full type name to the console"));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/ty/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ impl<'tcx> TyCtxt<'tcx> {
})
.expect("could not write to `String`");

if !self.sess.opts.unstable_opts.write_long_types_to_disk {
if !self.sess.opts.unstable_opts.write_long_types_to_disk || self.sess.opts.verbose {
return regular;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1554,6 +1554,9 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
"the full type name has been written to '{}'",
file.display()
));
err.note(format!(
"consider using `--verbose` to print full type name to the console"
));
}

if imm_ref_self_ty_satisfies_pred && mut_ref_self_ty_satisfies_pred {
Expand Down Expand Up @@ -3133,6 +3136,9 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
"the full name for the type has been written to '{}'",
file.display(),
));
err.note(format!(
"consider using `--verbose` to print the full type name to the console"
));
}
}
ObligationCauseCode::RepeatElementCopy {
Expand Down Expand Up @@ -3600,6 +3606,9 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
"the full type name has been written to '{}'",
file.display(),
));
err.note(format!(
"consider using `--verbose` to print the full type name to the console"
));
}
let mut parent_predicate = parent_trait_pred;
let mut data = &data.derived;
Expand Down Expand Up @@ -3653,6 +3662,9 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
"the full type name has been written to '{}'",
file.display(),
));
err.note(format!(
"consider using `--verbose` to print the full type name to the console"
));
}
}
// #74711: avoid a stack overflow
Expand Down
4 changes: 4 additions & 0 deletions tests/ui/diagnostic-width/long-E0308.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ LL | | ))))))))))))))))))))))))))))));
= note: expected struct `Atype<Btype<..., ...>, ...>`
found enum `Result<Result<..., ...>, ...>`
= note: the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308/long-E0308.long-type-hash.txt'
= note: consider using `--verbose` to print the full type name to the console

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

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

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

error: aborting due to 4 previous errors

Expand Down