1
Fork 0

Use Session::diagnostic in more places.

This commit is contained in:
Nicholas Nethercote 2023-12-01 13:45:29 +11:00
parent a179a53565
commit 31ac4efb31
7 changed files with 33 additions and 40 deletions

View file

@ -115,7 +115,7 @@ impl<'a> Parser<'a> {
Some(item) => NtItem(item),
None => {
return Err(UnexpectedNonterminal::Item(self.token.span)
.into_diagnostic(&self.sess.span_diagnostic));
.into_diagnostic(self.diagnostic()));
}
},
NonterminalKind::Block => {
@ -127,7 +127,7 @@ impl<'a> Parser<'a> {
Some(s) => NtStmt(P(s)),
None => {
return Err(UnexpectedNonterminal::Statement(self.token.span)
.into_diagnostic(&self.sess.span_diagnostic));
.into_diagnostic(self.diagnostic()));
}
},
NonterminalKind::PatParam { .. } | NonterminalKind::PatWithOr => {
@ -163,7 +163,7 @@ impl<'a> Parser<'a> {
span: self.token.span,
token: self.token.clone(),
}
.into_diagnostic(&self.sess.span_diagnostic));
.into_diagnostic(self.diagnostic()));
}
NonterminalKind::Path => {
NtPath(P(self.collect_tokens_no_attrs(|this| this.parse_path(PathStyle::Type))?))
@ -181,7 +181,7 @@ impl<'a> Parser<'a> {
span: self.token.span,
token: self.token.clone(),
}
.into_diagnostic(&self.sess.span_diagnostic));
.into_diagnostic(self.diagnostic()));
}
}
};