diff options
| author | rongfu.leng <lenronfu@gmail.com> | 2024-06-06 09:38:09 +0800 |
|---|---|---|
| committer | rongfu.leng <lenronfu@gmail.com> | 2024-06-06 09:38:09 +0800 |
| commit | 69769fc79776a284fed2e5d9ea9605b36f50f83a (patch) | |
| tree | 713d42822fbb53f717db76aff373ecc30f03e2a7 | |
| parent | db8aca48129d86b2623e3ac8cbcf2902d4d313ad (diff) | |
| download | rust-69769fc79776a284fed2e5d9ea9605b36f50f83a.tar.gz rust-69769fc79776a284fed2e5d9ea9605b36f50f83a.zip | |
Expand list of trait implementers in E0277 when calling rustc with --verbose
Signed-off-by: rongfu.leng <lenronfu@gmail.com>
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs index 9a0929baeaf..1bdbd0f3ed7 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs @@ -2082,12 +2082,16 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { }) .collect(); - let end = if candidates.len() <= 9 { candidates.len() } else { 8 }; + let end = if candidates.len() <= 9 || self.tcx.sess.opts.verbose { + candidates.len() + } else { + 8 + }; err.help(format!( "the following {other}types implement trait `{}`:{}{}", trait_ref.print_trait_sugared(), candidates[..end].join(""), - if candidates.len() > 9 { + if candidates.len() > 9 && !self.tcx.sess.opts.verbose { format!("\nand {} others", candidates.len() - 8) } else { String::new() |
