-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
E0221 needs more helpful information #35970
Comments
I'd be up to mentor this. The message is reported by some code in What this routine does is, given a type like If you look at the callers, there aren't that many (3, I think). Two of those are for trait objects, I think, where the bounds come from the supertraits of the trait object. Probably we could give those the spans of the trait type itself, though we may want to get the spans out of the trait definition where the supertraits come from (but that could be in another crate). That last part is a bit tricky because we'd have to extend the The other is the more general case of a type parameter. I think the major piece of work then is to augment this routine fn get_type_parameter_bounds(&self, span: Span, def_id: ast::NodeId)
-> Result<Vec<ty::PolyTraitRef<'tcx>>, ErrorReported>; so that it returns a Anyway, this is non-trivial, but seems to me to be achievable if anyone wants to dig in. If so, ping me (either on IRC, |
@nikomatsakis I'll try, I need some time to look around |
@nikomatsakis get_type_parameter_bounds in caller_bounds contains vec of Predicate w/o spans. May be is it easy only for error case in one_bound_for_associated_type get spans from ast_map (hir::map) by DefId extracted from TypeTraitItems like trait_defines_associated_type_named do? |
I've updated it mikhail-m1@585f835. But what do you think about trait from extern crate?
|
Make error E0221 more helpful fix rust-lang#35970 as part of rust-lang#35233 r? @jonathandturner
Currently, E0221 can give an error like:
This isn't terribly helpful. Ideally, we'd like to show where these associated types that cause ambiguity are coming from:
cc @nikomatsakis
The text was updated successfully, but these errors were encountered: