I have a complex system of traits with a lot of where
clauses, and I have an error somewhere. Unfortunately the error message from the compiler is not very useful:
error[E0271]: type mismatch resolving `<session::MockInterner as session::lex::StringSource>::StringRef == session::lex::Literal<std::string::String>`
--> src/lib.rs:88:5
|
88 | ReentrancyActions::analyze_file(&mut session, name.into(), None)?;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `std::string::String`, found enum `session::lex::Literal`
|
::: src/session/reentrancy.rs:18:5
|
18 | fn analyze_file(&mut self, path: R, from: Option<S>) -> Result<(), CodebaseError>;
| ---------------------------------------------------------------------------------- required by `session::reentrancy::ReentrancyActions::analyze_file`
|
= note: expected struct `std::string::String`
found enum `session::lex::Literal<std::string::String>`
= note: required because of the requirements on the impl of `session::reentrancy::ReentrancyActions<std::string::String, span::Span<codebase::BufId, session::resolve::Ident<std::string::String>, std::string::String>>` for `session::CompositeSession<codebase::FileCodebase<'_, dyn codebase::FileSystem>, span::RcContextFactory<codebase::BufId, session::resolve::Ident<std::string::String>, std::string::String>, session::MockInterner, std::vec::Vec<std::rc::Rc<span::MacroDef<session::resolve::Ident<std::string::String>, session::lex::Literal<std::string::String>, span::Span<codebase::BufId, session::resolve::Ident<std::string::String>, std::string::String>>>>, session::resolve::BiLevelNameTable<session::resolve::BasicNameTable<session::macros::MacroId, object::Symbol<object::BuiltinId, object::ContentId>>>, session::builder::ObjectBuilder<span::Span<codebase::BufId, session::resolve::Ident<std::string::String>, std::string::String>>, session::diagnostics::OutputForwarder<'_>>`
It doesn't tell me which constraint is the problem, and checking them all (and the transitive constrains too) is a lot of error-prone work. Is there some magic flag to the compiler that will show me which constraint exactly is the problem?