Skip to content

Commit

Permalink
Expand list of trait implementers in E0277 when calling rustc with --…
Browse files Browse the repository at this point in the history
…verbose

Signed-off-by: rongfu.leng <lenronfu@gmail.com>
  • Loading branch information
lengrongfu committed Jun 6, 2024
1 parent db8aca4 commit 69769fc
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 69769fc

Please sign in to comment.