enable desugaring-sensitive error messages and use them in Try
Maybe I should allow error messages to check the *specific* desugaring? Thanks @huntiep for the idea!
This commit is contained in:
@@ -205,6 +205,18 @@ impl Span {
|
||||
}
|
||||
}
|
||||
|
||||
/// Return the compiler desugaring that created this span, or None
|
||||
/// if this span is not from a desugaring.
|
||||
pub fn compiler_desugaring_kind(&self) -> Option<CompilerDesugaringKind> {
|
||||
match self.ctxt().outer().expn_info() {
|
||||
Some(info) => match info.callee.format {
|
||||
ExpnFormat::CompilerDesugaring(k) => Some(k),
|
||||
_ => None
|
||||
},
|
||||
None => None
|
||||
}
|
||||
}
|
||||
|
||||
/// Check if a span is "internal" to a macro in which `unsafe`
|
||||
/// can be used without triggering the `unsafe_code` lint
|
||||
// (that is, a macro marked with `#[allow_internal_unsafe]`).
|
||||
|
||||
Reference in New Issue
Block a user