Rollup merge of #93222 - mark-i-m:errorreported, r=oli-obk

Make ErrorReported impossible to construct outside `rustc_errors`

There are a few places were we have to construct it, though, and a few
places that are more invasive to change. To do this, we create a
constructor with a long obvious name.

cc #69426 `@varkor` `@eddyb` `@estebank`

I actually didn't see that I was assigned to this issue until now...
This commit is contained in:
Dylan DPC 2022-03-17 22:55:00 +01:00 committed by GitHub
commit 7e1415ea80
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
104 changed files with 705 additions and 550 deletions

View file

@ -212,10 +212,10 @@ impl<'a> Parser<'a> {
if let Err(mut e) = self.expect_semi() {
match tree.kind {
UseTreeKind::Glob => {
e.note("the wildcard token must be last on the path").emit();
e.note("the wildcard token must be last on the path");
}
UseTreeKind::Nested(..) => {
e.note("glob-like brace syntax must be last on the path").emit();
e.note("glob-like brace syntax must be last on the path");
}
_ => (),
}
@ -1507,7 +1507,7 @@ impl<'a> Parser<'a> {
// Make sure an error was emitted (either by recovering an angle bracket,
// or by finding an identifier as the next token), since we're
// going to continue parsing
assert!(self.sess.span_diagnostic.has_errors());
assert!(self.sess.span_diagnostic.has_errors().is_some());
} else {
return Err(err);
}