Error diagnostics for ?
regressed over try!
#42694
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
This is a thing that occured to me while giving a training on Rust: the diagnostics of
?
overtry!
are worse, despite it being special syntax.Compare:
over:
While the second makes perfect sense to advanced Rust developers, it is confusing to newcomers and leaks a lot of internal details. People have to know about traits, about the
ops
module, and similar. Also, it reports a macro invocation, where - from a user perspective - there is none. To my knowledge, this is the only place where we do this.Considering that
?
raises a macro to syntax, I would also think it gives opportunity for better diagnostics. It is a crucial part of the language with non-trivial semantics and making a pass on giving better errors here would help newcomers a lot.The text was updated successfully, but these errors were encountered: