You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add "diagnostic items" which behave like lang items #39131
It would be nice to have a (rustc-only) system of that lets us annotate structs with things like #[diagnostic_item="String"].
This lets us improve the diagnostics in special cases involving that type (e.g. #39116 (comment)). Clippy currently string-compares the path to do this, but that's hacky and I would rather we avoided that code in rustc.
It's something that would only get hit when we have an error case, so we probably can just store these in a hash map or something.
We add a new attribute to the compiler: #[diagnostic = "debug_trait"] and similar so we can stop checking for lang items and instead just check for diagnostic-specific items.
This will be a bit more involved. Essentially we need to
duplicate the get_lang_items query. Though I don't think there's any point in having a method per diagnostic item.
So I suggest we just make the query return a FxHashMap<Symbol, NodeId>.
We can then build a wrapper method on the TyCtxt that maps a &str to an Option<NodeId> for user convenience
Activity
Manishearth commentedon Apr 7, 2019
More details in #58070 (comment)
cc @oli-obk @phansch
Manishearth commentedon Apr 7, 2019
Copying over the relevant comment:
Auto merge of #60966 - oli-obk:diagnostic_items, r=eddyb