-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Closed
Copy link
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsD-terseDiagnostics: An error or lint that doesn't give enough information about the problem at hand.Diagnostics: An error or lint that doesn't give enough information about the problem at hand.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.P-lowLow priorityLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
When emitting an error like the following
error[E0277]: the trait bound `MaybeMissing<std::string::String>: Reconcile` is not satisfied
--> src/main.rs:3:19
|
3 | #[derive(Hydrate, Reconcile)]
| ^^^^^^^^^ the trait `Reconcile` is not implemented for `MaybeMissing<std::string::String>`, which is required by `&MaybeMissing<std::string::String>: Reconcile`
4 | struct S {
5 | s: MaybeMissing<String>,
| - required by a bound introduced by this call
|
= help: the following other types implement trait `Reconcile`:
bool
i8
i16
i32
i64
u8
u16
u32
and 17 others
= note: required for `&MaybeMissing<std::string::String>` to implement `Reconcile`
note: required by a bound in `autosurgeon::reconcile::MapReconciler::put`
--> /home/matt/.cargo/registry/src/index.crates.io-6f17d22bba15001f/autosurgeon-0.8.3/src/reconcile.rs:114:15
|
114 | fn put<R: Reconcile, P: AsRef<str>>(&mut self, prop: P, value: R) -> Result<(), Self::Error>;
| ^^^^^^^^^ required by this bound in `MapReconciler::put`
Allow the --verbose
flag (self.tcx.sess.opts.verbose
) to print the whole list by modifying
rust/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs
Lines 2075 to 2085 in bc33782
let end = if candidates.len() <= 9 { 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 { | |
format!("\nand {} others", candidates.len() - 8) | |
} else { | |
String::new() | |
} | |
)); |
There are other places where we limit output where we don't currently listen to this flag to expand the output. For type name shortening I believe we already do, but we should look for all of them and make the appropriate change for them too.
Originally reported at https://users.rust-lang.org/t/how-can-i-get-a-list-of-the-and-17-others-types-in-this-compilation-error/112458
fmease and correabuscar
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsD-terseDiagnostics: An error or lint that doesn't give enough information about the problem at hand.Diagnostics: An error or lint that doesn't give enough information about the problem at hand.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.P-lowLow priorityLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.